#include <kdialog.h>
#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file './kdardirectoryfilterdlg.ui'
**
** Created: Sun Jul 10 12:14:25 2005
**      by: The User Interface Compiler ($Id: qt/main.cpp   3.3.4   edited Nov 24 2003 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "kdardirectoryfilterdlg.h"

#include <qvariant.h>
#include <qpushbutton.h>
#include <qframe.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <kurlrequester.h>
#include <qcombobox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>

/*
 *  Constructs a kdarDirectoryFilterDlg as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
kdarDirectoryFilterDlg::kdarDirectoryFilterDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "kdarDirectoryFilterDlg" );
    kdarDirectoryFilterDlgLayout = new QVBoxLayout( this, 11, 6, "kdarDirectoryFilterDlgLayout"); 

    frame6 = new QFrame( this, "frame6" );
    frame6->setFrameShape( QFrame::StyledPanel );
    frame6->setFrameShadow( QFrame::Raised );
    frame6Layout = new QVBoxLayout( frame6, 11, 6, "frame6Layout"); 

    directoryButtonGroup = new QButtonGroup( frame6, "directoryButtonGroup" );
    directoryButtonGroup->setColumnLayout(0, Qt::Vertical );
    directoryButtonGroup->layout()->setSpacing( 6 );
    directoryButtonGroup->layout()->setMargin( 11 );
    directoryButtonGroupLayout = new QGridLayout( directoryButtonGroup->layout() );
    directoryButtonGroupLayout->setAlignment( Qt::AlignTop );

    listRadioButton = new QRadioButton( directoryButtonGroup, "listRadioButton" );
    listRadioButton->setChecked( TRUE );

    directoryButtonGroupLayout->addWidget( listRadioButton, 0, 0 );

    filesystemRadioButton = new QRadioButton( directoryButtonGroup, "filesystemRadioButton" );

    directoryButtonGroupLayout->addMultiCellWidget( filesystemRadioButton, 1, 1, 0, 1 );

    directoryFilterValueKURLRequester = new KURLRequester( directoryButtonGroup, "directoryFilterValueKURLRequester" );

    directoryButtonGroupLayout->addWidget( directoryFilterValueKURLRequester, 1, 4 );

    directoryFilesystemTypeComboBox = new QComboBox( FALSE, directoryButtonGroup, "directoryFilesystemTypeComboBox" );
    directoryFilesystemTypeComboBox->setEnabled( FALSE );

    directoryButtonGroupLayout->addWidget( directoryFilesystemTypeComboBox, 1, 3 );

    directoryListComboBox = new QComboBox( FALSE, directoryButtonGroup, "directoryListComboBox" );

    directoryButtonGroupLayout->addWidget( directoryListComboBox, 0, 4 );

    directoryListTypeComboBox = new QComboBox( FALSE, directoryButtonGroup, "directoryListTypeComboBox" );

    directoryButtonGroupLayout->addWidget( directoryListTypeComboBox, 0, 3 );
    spacer39 = new QSpacerItem( 80, 21, QSizePolicy::Maximum, QSizePolicy::Minimum );
    directoryButtonGroupLayout->addMultiCell( spacer39, 0, 0, 1, 2 );
    spacer40 = new QSpacerItem( 21, 20, QSizePolicy::Maximum, QSizePolicy::Minimum );
    directoryButtonGroupLayout->addItem( spacer40, 1, 2 );
    frame6Layout->addWidget( directoryButtonGroup );
    kdarDirectoryFilterDlgLayout->addWidget( frame6 );

    layout45 = new QHBoxLayout( 0, 0, 6, "layout45"); 
    spacer34 = new QSpacerItem( 301, 21, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout45->addItem( spacer34 );

    fileFilterOKButton = new QPushButton( this, "fileFilterOKButton" );
    layout45->addWidget( fileFilterOKButton );

    fileFilterCancelButton = new QPushButton( this, "fileFilterCancelButton" );
    layout45->addWidget( fileFilterCancelButton );
    kdarDirectoryFilterDlgLayout->addLayout( layout45 );
    languageChange();
    resize( QSize(561, 192).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( fileFilterOKButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
    connect( fileFilterCancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
    connect( listRadioButton, SIGNAL( toggled(bool) ), directoryListTypeComboBox, SLOT( setEnabled(bool) ) );
    connect( listRadioButton, SIGNAL( toggled(bool) ), directoryListComboBox, SLOT( setEnabled(bool) ) );
    connect( filesystemRadioButton, SIGNAL( toggled(bool) ), directoryFilesystemTypeComboBox, SLOT( setEnabled(bool) ) );
    connect( directoryFilterValueKURLRequester, SIGNAL( openFileDialog(KURLRequester*) ), this, SLOT( slotDirectoryFilterSelect(KURLRequester*) ) );
    connect( filesystemRadioButton, SIGNAL( toggled(bool) ), directoryFilterValueKURLRequester, SLOT( setEnabled(bool) ) );
}

/*
 *  Destroys the object and frees any allocated resources
 */
kdarDirectoryFilterDlg::~kdarDirectoryFilterDlg()
{
    // no need to delete child widgets, Qt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void kdarDirectoryFilterDlg::languageChange()
{
    setCaption( tr2i18n( "Add directory filter", "Caption for directory filter dialog" ) );
    directoryButtonGroup->setTitle( tr2i18n( "Choose from:", "when adding directory filter, the user has to choose from a list or filesystem" ) );
    listRadioButton->setText( tr2i18n( "list", "indicates a list of default directory filters" ) );
    filesystemRadioButton->setText( tr2i18n( "filesystem", "indicates the user can choose a directory filter by browsing the filesystem" ) );
    directoryFilesystemTypeComboBox->clear();
    directoryFilesystemTypeComboBox->insertItem( tr2i18n( "Exclude" ) );
    directoryFilesystemTypeComboBox->insertItem( tr2i18n( "Include" ) );
    directoryListComboBox->clear();
    directoryListComboBox->insertItem( tr2i18n( "/proc" ) );
    directoryListComboBox->insertItem( tr2i18n( "/dev/pts" ) );
    directoryListComboBox->insertItem( tr2i18n( "/tmp" ) );
    directoryListComboBox->insertItem( tr2i18n( "/var/tmp" ) );
    directoryListComboBox->insertItem( tr2i18n( "All of the above" ) );
    directoryListTypeComboBox->clear();
    directoryListTypeComboBox->insertItem( tr2i18n( "Exclude" ) );
    directoryListTypeComboBox->insertItem( tr2i18n( "Include" ) );
    fileFilterOKButton->setText( tr2i18n( "&OK" ) );
    fileFilterOKButton->setAccel( QKeySequence( tr2i18n( "Alt+O" ) ) );
    fileFilterCancelButton->setText( tr2i18n( "&Cancel" ) );
    fileFilterCancelButton->setAccel( QKeySequence( tr2i18n( "Alt+C" ) ) );
}

void kdarDirectoryFilterDlg::slotDirectoryFilterSelect(KURLRequester*)
{
    qWarning( "kdarDirectoryFilterDlg::slotDirectoryFilterSelect(KURLRequester*): Not implemented yet" );
}

#include "kdardirectoryfilterdlg.moc"
