summaryrefslogtreecommitdiffstats
path: root/src/app/Filter
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/Filter')
-rw-r--r--src/app/Filter/Makefile.am11
-rw-r--r--src/app/Filter/advancedfilter.cpp711
-rw-r--r--src/app/Filter/advancedfilter.h116
-rw-r--r--src/app/Filter/filterbase.h51
-rw-r--r--src/app/Filter/filterdialog.cpp87
-rw-r--r--src/app/Filter/filterdialog.h61
-rw-r--r--src/app/Filter/filtertabs.cpp133
-rw-r--r--src/app/Filter/filtertabs.h81
-rw-r--r--src/app/Filter/generalfilter.cpp536
-rw-r--r--src/app/Filter/generalfilter.h107
10 files changed, 1894 insertions, 0 deletions
diff --git a/src/app/Filter/Makefile.am b/src/app/Filter/Makefile.am
new file mode 100644
index 0000000..98b044b
--- /dev/null
+++ b/src/app/Filter/Makefile.am
@@ -0,0 +1,11 @@
+noinst_LIBRARIES = libFilter.a
+
+INCLUDES = $(all_includes)
+
+libFilter_a_METASOURCES = AUTO
+
+libFilter_a_SOURCES = \
+ advancedfilter.cpp \
+ generalfilter.cpp \
+ filtertabs.cpp \
+ filterdialog.cpp
diff --git a/src/app/Filter/advancedfilter.cpp b/src/app/Filter/advancedfilter.cpp
new file mode 100644
index 0000000..299a5d8
--- /dev/null
+++ b/src/app/Filter/advancedfilter.cpp
@@ -0,0 +1,711 @@
+/***************************************************************************
+ advancedfilter.cpp - description
+ -------------------
+ copyright : (C) 2003 + by Shie Erlich & Rafi Yanai & Csaba Karai
+ e-mail : krusader@users.sourceforge.net
+ web site : http://krusader.sourceforge.net
+ ---------------------------------------------------------------------------
+ Description
+ ***************************************************************************
+
+ A
+
+ db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b.
+ 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D
+ 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY'
+ 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b
+ 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88.
+ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD
+
+ S o u r c e F i l e
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "../krusader.h"
+#include "advancedfilter.h"
+#include "../Dialogs/krdialogs.h"
+
+#include <tqgroupbox.h>
+#include <tdelocale.h>
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqbuttongroup.h>
+#include <tqfile.h>
+#include <kdebug.h>
+#include <tdemessagebox.h>
+#include <time.h>
+#include <kiconloader.h>
+
+#define USERSFILE TQString("/etc/passwd")
+#define GROUPSFILE TQString("/etc/group")
+
+AdvancedFilter::AdvancedFilter( FilterTabs *tabs, TQWidget *parent, const char *name ) : TQWidget( parent, name ), fltTabs( tabs )
+{
+ TQGridLayout *filterLayout = new TQGridLayout( this );
+ filterLayout->setSpacing( 6 );
+ filterLayout->setMargin( 11 );
+
+ // Options for size
+
+ TQGroupBox *sizeGroup = new TQGroupBox( this, "sizeGroup" );
+ sizeGroup->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)1, sizeGroup->sizePolicy().hasHeightForWidth() ) );
+ sizeGroup->setTitle( i18n( "Size" ) );
+ sizeGroup->setColumnLayout(0, TQt::Vertical );
+ sizeGroup->layout()->setSpacing( 0 );
+ sizeGroup->layout()->setMargin( 0 );
+ TQGridLayout *sizeLayout = new TQGridLayout( sizeGroup->layout() );
+ sizeLayout->setAlignment( TQt::AlignTop );
+ sizeLayout->setSpacing( 6 );
+ sizeLayout->setMargin( 11 );
+
+ biggerThanEnabled = new TQCheckBox( sizeGroup, "biggerThanEnabled" );
+ biggerThanEnabled->setText( i18n( "&Bigger than" ) );
+ sizeLayout->addWidget( biggerThanEnabled, 0, 0 );
+
+ biggerThanAmount = new TQLineEdit( sizeGroup, "biggerThanAmount" );
+ biggerThanAmount->setEnabled( false );
+ biggerThanAmount->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed, biggerThanAmount->sizePolicy().hasHeightForWidth() ) );
+ sizeLayout->addWidget( biggerThanAmount, 0, 1 );
+
+ biggerThanType = new KComboBox( false, sizeGroup, "biggerThanType" );
+ biggerThanType->insertItem( i18n( "Bytes" ) );
+ biggerThanType->insertItem( i18n( "KB" ) );
+ biggerThanType->insertItem( i18n( "MB" ) );
+ biggerThanType->setEnabled( false );
+ sizeLayout->addWidget( biggerThanType, 0, 2 );
+
+ smallerThanEnabled = new TQCheckBox( sizeGroup, "smallerThanEnabled" );
+ smallerThanEnabled->setText( i18n( "&Smaller than" ) );
+ sizeLayout->addWidget( smallerThanEnabled, 0, 3 );
+
+ smallerThanAmount = new TQLineEdit( sizeGroup, "smallerThanAmount" );
+ smallerThanAmount->setEnabled( false );
+ smallerThanAmount->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed, smallerThanAmount->sizePolicy().hasHeightForWidth() ) );
+ sizeLayout->addWidget( smallerThanAmount, 0, 4 );
+
+ smallerThanType = new KComboBox( false, sizeGroup, "smallerThanType" );
+ smallerThanType->insertItem( i18n( "Bytes" ) );
+ smallerThanType->insertItem( i18n( "KB" ) );
+ smallerThanType->insertItem( i18n( "MB" ) );
+ smallerThanType->setEnabled( false );
+ sizeLayout->addWidget( smallerThanType, 0, 5 );
+
+ // set a tighter box around the type box
+
+ int height = TQFontMetrics(biggerThanType->font()).height()+2;
+ biggerThanType->setMaximumHeight(height);
+ smallerThanType->setMaximumHeight(height);
+
+ filterLayout->addWidget( sizeGroup, 0, 0 );
+
+ // Options for date
+
+ TQPixmap iconDate = krLoader->loadIcon( "date", TDEIcon::Toolbar, 16 );
+
+ TQButtonGroup *dateGroup = new TQButtonGroup( this, "dateGroup" );
+ dateGroup->setTitle( i18n( "Date" ) );
+ dateGroup->setExclusive( true );
+ dateGroup->setColumnLayout(0, TQt::Vertical );
+ dateGroup->layout()->setSpacing( 0 );
+ dateGroup->layout()->setMargin( 0 );
+ TQGridLayout *dateLayout = new TQGridLayout( dateGroup->layout() );
+ dateLayout->setAlignment( TQt::AlignTop );
+ dateLayout->setSpacing( 6 );
+ dateLayout->setMargin( 11 );
+
+ modifiedBetweenEnabled = new TQRadioButton( dateGroup, "modifiedBetweenEnabled" );
+ modifiedBetweenEnabled->setText( i18n( "&Modified between" ) );
+ dateGroup->insert( modifiedBetweenEnabled, 0 );
+
+ dateLayout->addMultiCellWidget( modifiedBetweenEnabled, 0, 0, 0, 1 );
+
+ modifiedBetweenData1 = new TQLineEdit( dateGroup, "modifiedBetweenData1" );
+ modifiedBetweenData1->setEnabled( false );
+ modifiedBetweenData1->setText( "" );
+ dateLayout->addMultiCellWidget( modifiedBetweenData1, 0, 0, 2, 3 );
+
+ modifiedBetweenBtn1 = new TQToolButton( dateGroup, "modifiedBetweenBtn1" );
+ modifiedBetweenBtn1->setEnabled( false );
+ modifiedBetweenBtn1->setText( "" );
+ modifiedBetweenBtn1->setPixmap( iconDate );
+ dateLayout->addWidget( modifiedBetweenBtn1, 0, 4 );
+
+ TQLabel *andLabel = new TQLabel( dateGroup, "andLabel" );
+ andLabel->setText( i18n( "an&d" ) );
+ dateLayout->addWidget( andLabel, 0, 5 );
+
+ modifiedBetweenData2 = new TQLineEdit( dateGroup, "modifiedBetweenData2" );
+ modifiedBetweenData2->setEnabled( false );
+ modifiedBetweenData2->setText( "" );
+ andLabel->setBuddy(modifiedBetweenData2);
+ dateLayout->addWidget( modifiedBetweenData2, 0, 6 );
+
+ modifiedBetweenBtn2 = new TQToolButton( dateGroup, "modifiedBetweenBtn2" );
+ modifiedBetweenBtn2->setEnabled( false );
+ modifiedBetweenBtn2->setText( "" );
+ modifiedBetweenBtn2->setPixmap( iconDate );
+ dateLayout->addWidget( modifiedBetweenBtn2, 0, 7 );
+
+ notModifiedAfterEnabled = new TQRadioButton( dateGroup, "notModifiedAfterEnabled" );
+ notModifiedAfterEnabled->setText( i18n( "&Not modified after" ) );
+ dateGroup->insert( notModifiedAfterEnabled, 0 );
+ dateLayout->addMultiCellWidget( notModifiedAfterEnabled, 1, 1, 0, 1 );
+
+ notModifiedAfterData = new TQLineEdit( dateGroup, "notModifiedAfterData" );
+ notModifiedAfterData->setEnabled( false );
+ notModifiedAfterData->setText( "" );
+ dateLayout->addMultiCellWidget( notModifiedAfterData, 1, 1, 2, 3 );
+
+ notModifiedAfterBtn = new TQToolButton( dateGroup, "notModifiedAfterBtn" );
+ notModifiedAfterBtn->setEnabled( false );
+ notModifiedAfterBtn->setText( "" );
+ notModifiedAfterBtn->setPixmap( iconDate );
+ dateLayout->addWidget( notModifiedAfterBtn, 1, 4 );
+
+ modifiedInTheLastEnabled = new TQRadioButton( dateGroup, "modifiedInTheLastEnabled" );
+ modifiedInTheLastEnabled->setText( i18n("Mod&ified in the last") );
+ dateGroup->insert( modifiedInTheLastEnabled, 0 );
+ dateLayout->addWidget( modifiedInTheLastEnabled, 2, 0 );
+
+ modifiedInTheLastData = new TQLineEdit( dateGroup, "modifiedInTheLastData" );
+ modifiedInTheLastData->setEnabled( false );
+ modifiedInTheLastData->setText( "" );
+ dateLayout->addWidget( modifiedInTheLastData, 2, 2 );
+
+ modifiedInTheLastType = new TQComboBox( false, dateGroup, "modifiedInTheLastType" );
+ modifiedInTheLastType->insertItem( i18n( "days" ) );
+ modifiedInTheLastType->insertItem( i18n( "weeks" ) );
+ modifiedInTheLastType->insertItem( i18n( "months" ) );
+ modifiedInTheLastType->insertItem( i18n( "years" ) );
+ modifiedInTheLastType->setEnabled( false );
+ dateLayout->addMultiCellWidget( modifiedInTheLastType, 2, 2, 3, 4 );
+
+ notModifiedInTheLastData = new TQLineEdit( dateGroup, "notModifiedInTheLastData" );
+ notModifiedInTheLastData->setEnabled( false );
+ notModifiedInTheLastData->setText( "" );
+ dateLayout->addWidget( notModifiedInTheLastData, 3, 2 );
+
+ TQLabel *notModifiedInTheLastLbl = new TQLabel( dateGroup, "notModifiedInTheLastLbl" );
+ notModifiedInTheLastLbl->setText( i18n( "No&t modified in the last" ) );
+ notModifiedInTheLastLbl->setBuddy(notModifiedInTheLastData);
+ dateLayout->addWidget( notModifiedInTheLastLbl, 3, 0 );
+
+ notModifiedInTheLastType = new TQComboBox( false, dateGroup, "notModifiedInTheLastType" );
+ notModifiedInTheLastType->insertItem( i18n( "days" ) );
+ notModifiedInTheLastType->insertItem( i18n( "weeks" ) );
+ notModifiedInTheLastType->insertItem( i18n( "months" ) );
+ notModifiedInTheLastType->insertItem( i18n( "years" ) );
+ notModifiedInTheLastType->setEnabled( false );
+ dateLayout->addMultiCellWidget( notModifiedInTheLastType, 3, 3, 3, 4 );
+
+ filterLayout->addWidget( dateGroup, 1, 0 );
+
+ // Options for ownership
+
+ TQGroupBox *ownershipGroup = new TQGroupBox( this, "ownershipGroup" );
+ ownershipGroup->setTitle( i18n( "Ownership" ) );
+ ownershipGroup->setColumnLayout(0, TQt::Vertical );
+ ownershipGroup->layout()->setSpacing( 0 );
+ ownershipGroup->layout()->setMargin( 0 );
+ TQGridLayout *ownershipLayout = new TQGridLayout( ownershipGroup->layout() );
+ ownershipLayout->setAlignment( TQt::AlignTop );
+ ownershipLayout->setSpacing( 6 );
+ ownershipLayout->setMargin( 11 );
+
+ TQHBoxLayout *hboxLayout = new TQHBoxLayout();
+ hboxLayout->setSpacing( 6 );
+ hboxLayout->setMargin( 0 );
+
+ belongsToUserEnabled = new TQCheckBox( ownershipGroup, "belongsToUserEnabled" );
+ belongsToUserEnabled->setText( i18n( "Belongs to &user" ) );
+ hboxLayout->addWidget( belongsToUserEnabled );
+
+ belongsToUserData = new TQComboBox( false, ownershipGroup, "belongsToUserData" );
+ belongsToUserData->setEnabled( false );
+ belongsToUserData->setEditable( false );
+ hboxLayout->addWidget( belongsToUserData );
+
+ belongsToGroupEnabled = new TQCheckBox( ownershipGroup, "belongsToGroupEnabled" );
+ belongsToGroupEnabled->setText( i18n( "Belongs to gr&oup" ) );
+ hboxLayout->addWidget( belongsToGroupEnabled );
+
+ belongsToGroupData = new TQComboBox( false, ownershipGroup, "belongsToGroupData" );
+ belongsToGroupData->setEnabled( false );
+ belongsToGroupData->setEditable( false );
+ hboxLayout->addWidget( belongsToGroupData );
+
+ ownershipLayout->addMultiCellLayout( hboxLayout, 0, 0, 0, 3 );
+
+ permissionsEnabled = new TQCheckBox( ownershipGroup, "permissionsEnabled" );
+ permissionsEnabled->setText( i18n( "P&ermissions" ) );
+ ownershipLayout->addWidget( permissionsEnabled, 1, 0 );
+
+ TQGroupBox *ownerGroup = new TQGroupBox( ownershipGroup, "ownerGroup" );
+ ownerGroup->setTitle( i18n( "O&wner" ) );
+ int width = 2*height + height / 2;
+
+ ownerR = new TQComboBox( false, ownerGroup, "ownerR" );
+ ownerR->insertItem( i18n( "?" ) );
+ ownerR->insertItem( i18n( "r" ) );
+ ownerR->insertItem( i18n( "-" ) );
+ ownerR->setEnabled( false );
+ ownerR->setGeometry( TQRect( 10, 20, width, height+6 ) );
+
+ ownerW = new TQComboBox( false, ownerGroup, "ownerW" );
+ ownerW->insertItem( i18n( "?" ) );
+ ownerW->insertItem( i18n( "w" ) );
+ ownerW->insertItem( i18n( "-" ) );
+ ownerW->setEnabled( false );
+ ownerW->setGeometry( TQRect( 10 + width, 20, width, height+6 ) );
+
+ ownerX = new TQComboBox( false, ownerGroup, "ownerX" );
+ ownerX->insertItem( i18n( "?" ) );
+ ownerX->insertItem( i18n( "x" ) );
+ ownerX->insertItem( i18n( "-" ) );
+ ownerX->setEnabled( false );
+ ownerX->setGeometry( TQRect( 10 + 2*width, 20, width, height+6 ) );
+
+ ownershipLayout->addWidget( ownerGroup, 1, 1 );
+
+ TQGroupBox *groupGroup = new TQGroupBox( ownershipGroup, "groupGroup" );
+ groupGroup->setTitle( i18n( "Grou&p" ) );
+
+ groupR = new TQComboBox( false, groupGroup, "groupR" );
+ groupR->insertItem( i18n( "?" ) );
+ groupR->insertItem( i18n( "r" ) );
+ groupR->insertItem( i18n( "-" ) );
+ groupR->setEnabled( false );
+ groupR->setGeometry( TQRect( 10, 20, width, height+6 ) );
+
+ groupW = new TQComboBox( false, groupGroup, "groupW" );
+ groupW->insertItem( i18n( "?" ) );
+ groupW->insertItem( i18n( "w" ) );
+ groupW->insertItem( i18n( "-" ) );
+ groupW->setEnabled( false );
+ groupW->setGeometry( TQRect( 10 + width, 20, width, height+6 ) );
+
+ groupX = new TQComboBox( false, groupGroup, "groupX" );
+ groupX->insertItem( i18n( "?" ) );
+ groupX->insertItem( i18n( "x" ) );
+ groupX->insertItem( i18n( "-" ) );
+ groupX->setEnabled( false );
+ groupX->setGeometry( TQRect( 10 + 2*width, 20, width, height+6 ) );
+
+ ownershipLayout->addWidget( groupGroup, 1, 2 );
+
+ TQGroupBox *allGroup = new TQGroupBox( ownershipGroup, "allGroup" );
+ allGroup->setTitle( i18n( "A&ll" ) );
+
+ allR = new TQComboBox( false, allGroup, "allR" );
+ allR->insertItem( i18n( "?" ) );
+ allR->insertItem( i18n( "r" ) );
+ allR->insertItem( i18n( "-" ) );
+ allR->setEnabled( false );
+ allR->setGeometry( TQRect( 10, 20, width, height+6 ) );
+
+ allW = new TQComboBox( false, allGroup, "allW" );
+ allW->insertItem( i18n( "?" ) );
+ allW->insertItem( i18n( "w" ) );
+ allW->insertItem( i18n( "-" ) );
+ allW->setEnabled( false );
+ allW->setGeometry( TQRect( 10 + width, 20, width, height+6 ) );
+
+ allX = new TQComboBox( false, allGroup, "allX" );
+ allX->insertItem( i18n( "?" ) );
+ allX->insertItem( i18n( "x" ) );
+ allX->insertItem( i18n( "-" ) );
+ allX->setEnabled( false );
+ allX->setGeometry( TQRect( 10 + 2*width, 20, width, height+6 ) );
+
+ ownershipLayout->addWidget( allGroup, 1, 3 );
+
+ TQLabel *infoLabel = new TQLabel( ownershipGroup, "TextLabel4" );
+ TQFont infoLabel_font( infoLabel->font() );
+ infoLabel_font.setFamily( "adobe-helvetica" );
+ infoLabel_font.setItalic( true );
+ infoLabel->setFont( infoLabel_font );
+ infoLabel->setText( i18n( "Note: a '?' is a wildcard" ) );
+
+ ownershipLayout->addMultiCellWidget( infoLabel, 2, 2, 0, 3, TQt::AlignRight );
+
+ filterLayout->addWidget( ownershipGroup, 2, 0 );
+
+ // Connection table
+
+ connect( biggerThanEnabled, TQ_SIGNAL( toggled(bool) ), biggerThanAmount, TQ_SLOT( setEnabled(bool) ) );
+ connect( biggerThanEnabled, TQ_SIGNAL( toggled(bool) ), biggerThanType, TQ_SLOT( setEnabled(bool) ) );
+ connect( smallerThanEnabled, TQ_SIGNAL( toggled(bool) ), smallerThanAmount, TQ_SLOT( setEnabled(bool) ) );
+ connect( smallerThanEnabled, TQ_SIGNAL( toggled(bool) ), smallerThanType, TQ_SLOT( setEnabled(bool) ) );
+ connect( modifiedBetweenEnabled, TQ_SIGNAL( toggled(bool) ), modifiedBetweenData1, TQ_SLOT( setEnabled(bool) ) );
+ connect( modifiedBetweenEnabled, TQ_SIGNAL( toggled(bool) ), modifiedBetweenBtn1, TQ_SLOT( setEnabled(bool) ) );
+ connect( modifiedBetweenEnabled, TQ_SIGNAL( toggled(bool) ), modifiedBetweenData2, TQ_SLOT( setEnabled(bool) ) );
+ connect( modifiedBetweenEnabled, TQ_SIGNAL( toggled(bool) ), modifiedBetweenBtn2, TQ_SLOT( setEnabled(bool) ) );
+ connect( notModifiedAfterEnabled, TQ_SIGNAL( toggled(bool) ), notModifiedAfterData, TQ_SLOT( setEnabled(bool) ) );
+ connect( notModifiedAfterEnabled, TQ_SIGNAL( toggled(bool) ), notModifiedAfterBtn, TQ_SLOT( setEnabled(bool) ) );
+ connect( modifiedInTheLastEnabled, TQ_SIGNAL( toggled(bool) ), modifiedInTheLastData, TQ_SLOT( setEnabled(bool) ) );
+ connect( modifiedInTheLastEnabled, TQ_SIGNAL( toggled(bool) ), modifiedInTheLastType, TQ_SLOT( setEnabled(bool) ) );
+ connect( modifiedInTheLastEnabled, TQ_SIGNAL( toggled(bool) ), notModifiedInTheLastData, TQ_SLOT( setEnabled(bool) ) );
+ connect( modifiedInTheLastEnabled, TQ_SIGNAL( toggled(bool) ), notModifiedInTheLastType, TQ_SLOT( setEnabled(bool) ) );
+ connect( belongsToUserEnabled, TQ_SIGNAL( toggled(bool) ), belongsToUserData, TQ_SLOT( setEnabled(bool) ) );
+ connect( belongsToGroupEnabled, TQ_SIGNAL( toggled(bool) ), belongsToGroupData, TQ_SLOT( setEnabled(bool) ) );
+ connect( permissionsEnabled, TQ_SIGNAL( toggled(bool) ), ownerR, TQ_SLOT( setEnabled(bool) ) );
+ connect( permissionsEnabled, TQ_SIGNAL( toggled(bool) ), ownerW, TQ_SLOT( setEnabled(bool) ) );
+ connect( permissionsEnabled, TQ_SIGNAL( toggled(bool) ), ownerX, TQ_SLOT( setEnabled(bool) ) );
+ connect( permissionsEnabled, TQ_SIGNAL( toggled(bool) ), groupR, TQ_SLOT( setEnabled(bool) ) );
+ connect( permissionsEnabled, TQ_SIGNAL( toggled(bool) ), groupW, TQ_SLOT( setEnabled(bool) ) );
+ connect( permissionsEnabled, TQ_SIGNAL( toggled(bool) ), groupX, TQ_SLOT( setEnabled(bool) ) );
+ connect( permissionsEnabled, TQ_SIGNAL( toggled(bool) ), allR, TQ_SLOT( setEnabled(bool) ) );
+ connect( permissionsEnabled, TQ_SIGNAL( toggled(bool) ), allW, TQ_SLOT( setEnabled(bool) ) );
+ connect( permissionsEnabled, TQ_SIGNAL( toggled(bool) ), allX, TQ_SLOT( setEnabled(bool) ) );
+ connect( modifiedBetweenBtn1, TQ_SIGNAL( clicked() ), this, TQ_SLOT( modifiedBetweenSetDate1() ) );
+ connect( modifiedBetweenBtn2, TQ_SIGNAL( clicked() ), this, TQ_SLOT( modifiedBetweenSetDate2() ) );
+ connect( notModifiedAfterBtn, TQ_SIGNAL( clicked() ), this, TQ_SLOT( notModifiedAfterSetDate() ) );
+
+ // fill the users and groups list
+
+ fillList(belongsToUserData, USERSFILE);
+ fillList(belongsToGroupData, GROUPSFILE);
+
+ // tab order
+ setTabOrder( biggerThanEnabled, biggerThanAmount );
+ setTabOrder( biggerThanAmount, smallerThanEnabled );
+ setTabOrder( smallerThanEnabled, smallerThanAmount );
+ setTabOrder( smallerThanAmount, modifiedBetweenEnabled );
+ setTabOrder( modifiedBetweenEnabled, modifiedBetweenData1 );
+ setTabOrder( modifiedBetweenData1, modifiedBetweenData2 );
+ setTabOrder( modifiedBetweenData2, notModifiedAfterEnabled );
+ setTabOrder( notModifiedAfterEnabled, notModifiedAfterData );
+ setTabOrder( notModifiedAfterData, modifiedInTheLastEnabled );
+ setTabOrder( modifiedInTheLastEnabled, modifiedInTheLastData );
+ setTabOrder( modifiedInTheLastData, notModifiedInTheLastData );
+ setTabOrder( notModifiedInTheLastData, belongsToUserEnabled );
+ setTabOrder( belongsToUserEnabled, belongsToUserData );
+ setTabOrder( belongsToUserData, belongsToGroupEnabled );
+ setTabOrder( belongsToGroupEnabled, belongsToGroupData );
+ setTabOrder( belongsToGroupData, permissionsEnabled );
+ setTabOrder( permissionsEnabled, ownerR );
+ setTabOrder( ownerR, ownerW );
+ setTabOrder( ownerW, ownerX );
+ setTabOrder( ownerX, groupR );
+ setTabOrder( groupR, groupW );
+ setTabOrder( groupW, groupX );
+ setTabOrder( groupX, allR );
+ setTabOrder( allR, allW );
+ setTabOrder( allW, allX );
+ setTabOrder( allX, biggerThanType );
+ setTabOrder( biggerThanType, smallerThanType );
+ setTabOrder( smallerThanType, modifiedInTheLastType );
+ setTabOrder( modifiedInTheLastType, notModifiedInTheLastType );
+}
+
+void AdvancedFilter::modifiedBetweenSetDate1()
+{
+ changeDate(modifiedBetweenData1);
+}
+
+void AdvancedFilter::modifiedBetweenSetDate2()
+{
+ changeDate(modifiedBetweenData2);
+}
+
+void AdvancedFilter::notModifiedAfterSetDate()
+{
+ changeDate(notModifiedAfterData);
+}
+
+void AdvancedFilter::changeDate(TQLineEdit *p) {
+ // check if the current date is valid
+ TQDate d = TDEGlobal::locale()->readDate(p->text());
+ if (!d.isValid()) d = TQDate::currentDate();
+
+ KRGetDate *gd = new KRGetDate(d, this);
+ d = gd->getDate();
+ // if a user pressed ESC or closed the dialog, we'll return an invalid date
+ if (d.isValid())
+ p->setText(TDEGlobal::locale()->formatDate(d, true));
+ delete gd;
+}
+
+// bool start: set it to true if this date is the beginning of the search,
+// if it's the end, set it to false
+void AdvancedFilter::qdate2time_t(time_t *dest, TQDate d, bool start) {
+ struct tm t;
+ t.tm_sec = (start ? 0 : 59);
+ t.tm_min = (start ? 0 : 59);
+ t.tm_hour = (start ? 0 : 23);
+ t.tm_mday = d.day();
+ t.tm_mon = d.month() - 1;
+ t.tm_year = d.year() - 1900;
+ t.tm_wday = d.dayOfWeek() - 1; // actually ignored by mktime
+ t.tm_yday = d.dayOfYear() - 1; // actually ignored by mktime
+ t.tm_isdst = -1; // daylight saving time information isn't availble
+
+ (*dest) = mktime( &t );
+}
+
+
+void AdvancedFilter::fillList(TQComboBox *list, TQString filename) {
+ TQFile data(filename);
+ if (!data.open(IO_ReadOnly))
+ {
+ krOut << "Search: Unable to read " << filename << " !!!" << endl;
+ return;
+ }
+ // and read it into the temporary array
+ TQTextStream t(&data);
+ while (!data.atEnd())
+ {
+ TQString s = t.readLine();
+ TQString name = s.left(s.find(':'));
+ list->insertItem(name);
+ }
+}
+
+void AdvancedFilter::invalidDateMessage(TQLineEdit *p)
+{
+ // FIXME p->text() is empty sometimes (to reproduce, set date to "13.09.005")
+ KMessageBox::detailedError(this, i18n("Invalid date entered."),
+ i18n("The date %1 is not valid according to your locale. Please re-enter a valid date (use the date button for easy access).").arg(p->text()) );
+ p->setFocus();
+}
+
+bool AdvancedFilter::fillQuery( KRQuery *query )
+{
+ TDEIO::filesize_t minSize = 0, maxSize = 0;
+
+ // size calculations ////////////////////////////////////////////////
+ if ( biggerThanEnabled->isChecked() &&
+ !(biggerThanAmount->text().simplifyWhiteSpace()).isEmpty() ) {
+ minSize = biggerThanAmount->text().toULong();
+ switch ( biggerThanType->currentItem() ) {
+ case 1 : minSize *= 1024;
+ break;
+ case 2 : minSize *= (1024*1024);
+ break;
+ }
+ query->setMinimumFileSize( minSize );
+ }
+ if ( smallerThanEnabled->isChecked() &&
+ !(smallerThanAmount->text().simplifyWhiteSpace()).isEmpty()) {
+ maxSize = smallerThanAmount->text().toULong();
+ switch (smallerThanType->currentItem()) {
+ case 1 : maxSize *= 1024;
+ break;
+ case 2 : maxSize *= (1024*1024);
+ break;
+ }
+ query->setMaximumFileSize( maxSize );
+ }
+ // check that minSize is smaller than maxSize
+ if ( ( minSize > 0) && ( maxSize > 0) && ( maxSize < minSize)) {
+ KMessageBox::detailedError(this, i18n("Specified sizes are inconsistent!"),
+ i18n("Please re-enter the values, so that the left side size will be smaller than (or equal to) the right side size."));
+ biggerThanAmount->setFocus();
+ return false;
+ }
+
+ // date calculations ////////////////////////////////////////////////////
+ if (modifiedBetweenEnabled->isChecked()) {
+ // first, if both dates are empty, than don't use them
+ if ( !(modifiedBetweenData1->text().simplifyWhiteSpace().isEmpty() &&
+ modifiedBetweenData2->text().simplifyWhiteSpace().isEmpty()) ) {
+ // check if date is valid
+ TQDate d1 = TDEGlobal::locale()->readDate(modifiedBetweenData1->text());
+ if (!d1.isValid()) { invalidDateMessage(modifiedBetweenData1); return false; }
+ TQDate d2 = TDEGlobal::locale()->readDate(modifiedBetweenData2->text());
+ if (!d2.isValid()) { invalidDateMessage(modifiedBetweenData2); return false; }
+
+ if (d1 > d2) {
+ KMessageBox::detailedError(this, i18n("Dates are inconsistent!"),
+ i18n("The date on the left is later than the date on the right. Please re-enter the dates, so that the left side date will be earlier than the right side date."));
+ modifiedBetweenData1->setFocus();
+ return false;
+ }
+ // all seems to be ok, create time_t
+
+ time_t newerTime, olderTime;
+ qdate2time_t(&newerTime, d1, true);
+ qdate2time_t(&olderTime, d2, false);
+ query->setNewerThan( newerTime );
+ query->setOlderThan( olderTime );
+ }
+ } else if (notModifiedAfterEnabled->isChecked()) {
+ if ( !notModifiedAfterData->text().simplifyWhiteSpace().isEmpty() ) {
+ TQDate d = TDEGlobal::locale()->readDate(notModifiedAfterData->text());
+ if (!d.isValid()) { invalidDateMessage(notModifiedAfterData); return false; }
+ time_t olderTime;
+ qdate2time_t(&olderTime, d, false);
+ query->setOlderThan( olderTime );
+ }
+ } else if (modifiedInTheLastEnabled->isChecked()) {
+ if ( !(modifiedInTheLastData->text().simplifyWhiteSpace().isEmpty() &&
+ notModifiedInTheLastData->text().simplifyWhiteSpace().isEmpty()) ) {
+ TQDate d1 = TQDate::currentDate(); TQDate d2 = TQDate::currentDate();
+ if (!modifiedInTheLastData->text().simplifyWhiteSpace().isEmpty()) {
+ int tmp1 = modifiedInTheLastData->text().simplifyWhiteSpace().toInt();
+ switch (modifiedInTheLastType->currentItem()) {
+ case 1 : tmp1 *= 7;
+ break;
+ case 2 : tmp1 *= 30;
+ break;
+ case 3 : tmp1 *= 365;
+ break;
+ }
+ d1 = d1.addDays((-1) * tmp1);
+ time_t newerTime;
+ qdate2time_t(&newerTime, d1, true);
+ query->setNewerThan( newerTime );
+ }
+ if (!notModifiedInTheLastData->text().simplifyWhiteSpace().isEmpty()) {
+ int tmp2 = notModifiedInTheLastData->text().simplifyWhiteSpace().toInt();
+ switch (notModifiedInTheLastType->currentItem()) {
+ case 1 : tmp2 *= 7;
+ break;
+ case 2 : tmp2 *= 30;
+ break;
+ case 3 : tmp2 *= 365;
+ break;
+ }
+ d2 = d2.addDays((-1) * tmp2);
+ time_t olderTime;
+ qdate2time_t(&olderTime, d2, true);
+ query->setOlderThan( olderTime );
+ }
+ if ( !modifiedInTheLastData->text().simplifyWhiteSpace().isEmpty() &&
+ !notModifiedInTheLastData->text().simplifyWhiteSpace().isEmpty() ) {
+ if (d1 > d2) {
+ KMessageBox::detailedError(this, i18n("Dates are inconsistent!"),
+ i18n("The date on top is later than the date on the bottom. Please re-enter the dates, so that the top date will be earlier than the bottom date."));
+ modifiedInTheLastData->setFocus();
+ return false;
+ }
+ }
+ }
+ }
+ // permissions and ownership /////////////////////////////////////
+ if (permissionsEnabled->isChecked()) {
+ TQString perm = ownerR->currentText() + ownerW->currentText() + ownerX->currentText() +
+ groupR->currentText() + groupW->currentText() + groupX->currentText() +
+ allR->currentText() + allW->currentText() + allX->currentText();
+ query->setPermissions( perm );
+ }
+ if (belongsToUserEnabled->isChecked())
+ query->setOwner( belongsToUserData->currentText() );
+ if (belongsToGroupEnabled->isChecked())
+ query->setGroup( belongsToGroupData->currentText() );
+
+ return true;
+}
+
+void AdvancedFilter::loadFromProfile( TQString name )
+{
+ krConfig->setGroup( name );
+
+ smallerThanEnabled->setChecked( krConfig->readBoolEntry( "Smaller Than Enabled", false ) );
+ smallerThanAmount->setText( krConfig->readEntry( "Smaller Than Amount", "" ) );
+ smallerThanType->setCurrentItem( krConfig->readNumEntry( "Smaller Than Type", 0 ) );
+
+ biggerThanEnabled->setChecked( krConfig->readBoolEntry( "Bigger Than Enabled", false ) );
+ biggerThanAmount->setText( krConfig->readEntry( "Bigger Than Amount", "" ) );
+ biggerThanType->setCurrentItem( krConfig->readNumEntry( "Bigger Than Type", 0 ) );
+
+ modifiedBetweenEnabled->setChecked( krConfig->readBoolEntry( "Modified Between Enabled", false ) );
+ notModifiedAfterEnabled->setChecked( krConfig->readBoolEntry( "Not Modified After Enabled", false ) );
+ modifiedInTheLastEnabled->setChecked( krConfig->readBoolEntry( "Modified In The Last Enabled", false ) );
+
+ modifiedBetweenData1->setText( krConfig->readEntry( "Modified Between 1", "" ) );
+ modifiedBetweenData2->setText( krConfig->readEntry( "Modified Between 2", "" ) );
+
+ notModifiedAfterData->setText( krConfig->readEntry( "Not Modified After", "" ) );
+ modifiedInTheLastData->setText( krConfig->readEntry( "Modified In The Last", "" ) );
+ notModifiedInTheLastData->setText( krConfig->readEntry( "Not Modified In The Last", "" ) );
+
+ modifiedInTheLastType->setCurrentItem( krConfig->readNumEntry( "Modified In The Last Type", 0 ) );
+ notModifiedInTheLastType->setCurrentItem( krConfig->readNumEntry( "Not Modified In The Last Type", 0 ) );
+
+ belongsToUserEnabled->setChecked( krConfig->readBoolEntry( "Belongs To User Enabled", false ) );
+ belongsToGroupEnabled->setChecked( krConfig->readBoolEntry( "Belongs To Group Enabled", false ) );
+
+ TQString user = krConfig->readEntry( "Belongs To User", "" );
+ for( int i = belongsToUserData->count(); i >= 0; i-- )
+ {
+ belongsToUserData->setCurrentItem( i );
+ if( belongsToUserData->currentText() == user )
+ break;
+ }
+
+ TQString group = krConfig->readEntry( "Belongs To Group", "" );
+ for( int i = belongsToGroupData->count(); i >= 0; i-- )
+ {
+ belongsToGroupData->setCurrentItem( i );
+ if( belongsToGroupData->currentText() == group )
+ break;
+ }
+
+ permissionsEnabled->setChecked( krConfig->readBoolEntry( "Permissions Enabled", false ) );
+
+ ownerW->setCurrentItem( krConfig->readNumEntry( "Owner Write", 0 ) );
+ ownerR->setCurrentItem( krConfig->readNumEntry( "Owner Read", 0 ) );
+ ownerX->setCurrentItem( krConfig->readNumEntry( "Owner Execute", 0 ) );
+ groupW->setCurrentItem( krConfig->readNumEntry( "Group Write", 0 ) );
+ groupR->setCurrentItem( krConfig->readNumEntry( "Group Read", 0 ) );
+ groupX->setCurrentItem( krConfig->readNumEntry( "Group Execute", 0 ) );
+ allW->setCurrentItem( krConfig->readNumEntry( "All Write", 0 ) );
+ allR->setCurrentItem( krConfig->readNumEntry( "All Read", 0 ) );
+ allX->setCurrentItem( krConfig->readNumEntry( "All Execute", 0 ) );
+}
+
+void AdvancedFilter::saveToProfile( TQString name )
+{
+ krConfig->setGroup( name );
+
+ krConfig->writeEntry( "Smaller Than Enabled", smallerThanEnabled->isChecked() );
+ krConfig->writeEntry( "Smaller Than Amount", smallerThanAmount->text() );
+ krConfig->writeEntry( "Smaller Than Type", smallerThanType->currentItem() );
+
+ krConfig->writeEntry( "Bigger Than Enabled", biggerThanEnabled->isChecked() );
+ krConfig->writeEntry( "Bigger Than Amount", biggerThanAmount->text() );
+ krConfig->writeEntry( "Bigger Than Type", biggerThanType->currentItem() );
+
+ krConfig->writeEntry( "Modified Between Enabled", modifiedBetweenEnabled->isChecked() );
+ krConfig->writeEntry( "Not Modified After Enabled", notModifiedAfterEnabled->isChecked() );
+ krConfig->writeEntry( "Modified In The Last Enabled", modifiedInTheLastEnabled->isChecked() );
+
+ krConfig->writeEntry( "Modified Between 1", modifiedBetweenData1->text() );
+ krConfig->writeEntry( "Modified Between 2", modifiedBetweenData2->text() );
+
+ krConfig->writeEntry( "Not Modified After", notModifiedAfterData->text() );
+ krConfig->writeEntry( "Modified In The Last", modifiedInTheLastData->text() );
+ krConfig->writeEntry( "Not Modified In The Last", notModifiedInTheLastData->text() );
+
+ krConfig->writeEntry( "Modified In The Last Type", modifiedInTheLastType->currentItem() );
+ krConfig->writeEntry( "Not Modified In The Last Type", notModifiedInTheLastType->currentItem() );
+
+ krConfig->writeEntry( "Belongs To User Enabled", belongsToUserEnabled->isChecked() );
+ krConfig->writeEntry( "Belongs To Group Enabled", belongsToGroupEnabled->isChecked() );
+
+ krConfig->writeEntry( "Belongs To User", belongsToUserData->currentText() );
+ krConfig->writeEntry( "Belongs To Group", belongsToGroupData->currentText() );
+
+ krConfig->writeEntry( "Permissions Enabled", permissionsEnabled->isChecked() );
+
+ krConfig->writeEntry( "Owner Write", ownerW->currentItem() );
+ krConfig->writeEntry( "Owner Read", ownerR->currentItem() );
+ krConfig->writeEntry( "Owner Execute", ownerX->currentItem() );
+ krConfig->writeEntry( "Group Write", groupW->currentItem() );
+ krConfig->writeEntry( "Group Read", groupR->currentItem() );
+ krConfig->writeEntry( "Group Execute", groupX->currentItem() );
+ krConfig->writeEntry( "All Write", allW->currentItem() );
+ krConfig->writeEntry( "All Read", allR->currentItem() );
+ krConfig->writeEntry( "All Execute", allX->currentItem() );
+}
+
+
+#include "advancedfilter.moc"
diff --git a/src/app/Filter/advancedfilter.h b/src/app/Filter/advancedfilter.h
new file mode 100644
index 0000000..48cf85e
--- /dev/null
+++ b/src/app/Filter/advancedfilter.h
@@ -0,0 +1,116 @@
+/***************************************************************************
+ advancedfilter.h - description
+ -------------------
+ copyright : (C) 2003 + by Shie Erlich & Rafi Yanai & Csaba Karai
+ e-mail : krusader@users.sourceforge.net
+ web site : http://krusader.sourceforge.net
+ ---------------------------------------------------------------------------
+ Description
+ ***************************************************************************
+
+ A
+
+ db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b.
+ 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D
+ 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY'
+ 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b
+ 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88.
+ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD
+
+ H e a d e r F i l e
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef ADVANCEDFILTER_H
+#define ADVANCEDFILTER_H
+
+#include "filterbase.h"
+#include "../VFS/krquery.h"
+
+#include <tqwidget.h>
+#include <tqcheckbox.h>
+#include <kcombobox.h>
+#include <klineedit.h>
+#include <tqradiobutton.h>
+#include <tqtoolbutton.h>
+
+class AdvancedFilter : public TQWidget, public FilterBase
+{
+ TQ_OBJECT
+
+
+public:
+ AdvancedFilter( FilterTabs *tabs, TQWidget *parent = 0, const char *name = 0 );
+
+ virtual void queryAccepted() {}
+ virtual bool fillQuery( KRQuery *query );
+ virtual void loadFromProfile( TQString name );
+ virtual void saveToProfile( TQString name );
+ virtual TQString name() { return "AdvancedFilter";}
+ virtual FilterTabs * filterTabs() { return fltTabs; }
+
+public slots:
+ void modifiedBetweenSetDate1();
+ void modifiedBetweenSetDate2();
+ void notModifiedAfterSetDate();
+
+public:
+ TQCheckBox* smallerThanEnabled;
+ TQLineEdit* smallerThanAmount;
+ KComboBox* smallerThanType;
+
+ TQCheckBox* biggerThanEnabled;
+ KComboBox* biggerThanType;
+ TQLineEdit* biggerThanAmount;
+
+ TQRadioButton* modifiedBetweenEnabled;
+ TQRadioButton* notModifiedAfterEnabled;
+ TQRadioButton* modifiedInTheLastEnabled;
+
+ TQLineEdit* modifiedBetweenData1;
+ TQLineEdit* modifiedBetweenData2;
+
+ TQToolButton* modifiedBetweenBtn1;
+ TQToolButton* modifiedBetweenBtn2;
+ TQToolButton* notModifiedAfterBtn;
+
+ TQLineEdit* notModifiedAfterData;
+ TQLineEdit* modifiedInTheLastData;
+ TQLineEdit* notModifiedInTheLastData;
+ TQComboBox* modifiedInTheLastType;
+ TQComboBox* notModifiedInTheLastType;
+
+ TQCheckBox* belongsToUserEnabled;
+ TQComboBox* belongsToUserData;
+ TQCheckBox* belongsToGroupEnabled;
+ TQComboBox* belongsToGroupData;
+
+ TQCheckBox* permissionsEnabled;
+
+ TQComboBox* ownerW;
+ TQComboBox* ownerR;
+ TQComboBox* ownerX;
+ TQComboBox* groupW;
+ TQComboBox* groupR;
+ TQComboBox* groupX;
+ TQComboBox* allW;
+ TQComboBox* allX;
+ TQComboBox* allR;
+
+ FilterTabs *fltTabs;
+
+private:
+ void changeDate(TQLineEdit *p);
+ void fillList(TQComboBox *list, TQString filename);
+ void qdate2time_t(time_t *dest, TQDate d, bool start);
+ void invalidDateMessage(TQLineEdit *p);
+};
+
+#endif /* ADVANCEDFILTER_H */
diff --git a/src/app/Filter/filterbase.h b/src/app/Filter/filterbase.h
new file mode 100644
index 0000000..bdcdce0
--- /dev/null
+++ b/src/app/Filter/filterbase.h
@@ -0,0 +1,51 @@
+/***************************************************************************
+ filterbase.h - description
+ -------------------
+ copyright : (C) 2005 + by Csaba Karai
+ e-mail : krusader@users.sourceforge.net
+ web site : http://krusader.sourceforge.net
+ ---------------------------------------------------------------------------
+ Description
+ ***************************************************************************
+
+ A
+
+ db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b.
+ 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D
+ 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY'
+ 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b
+ 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88.
+ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD
+
+ H e a d e r F i l e
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef FILTERBASE_H
+#define FILTERBASE_H
+
+#include "../VFS/krquery.h"
+#include <tqstring.h>
+
+class FilterTabs;
+
+class FilterBase
+{
+public:
+ virtual bool fillQuery( KRQuery *query ) = 0;
+ virtual void queryAccepted() = 0;
+ virtual void loadFromProfile( TQString name ) = 0;
+ virtual void saveToProfile( TQString name ) = 0;
+ virtual TQString name() = 0;
+ virtual FilterTabs * filterTabs() = 0;
+ virtual ~FilterBase() {}
+};
+
+#endif /* FILTERBASE_H */
diff --git a/src/app/Filter/filterdialog.cpp b/src/app/Filter/filterdialog.cpp
new file mode 100644
index 0000000..dc1e3e6
--- /dev/null
+++ b/src/app/Filter/filterdialog.cpp
@@ -0,0 +1,87 @@
+/***************************************************************************
+ filterdialog.cpp - description
+ -------------------
+ copyright : (C) 2005 + by Csaba Karai
+ e-mail : krusader@users.sourceforge.net
+ web site : http://krusader.sourceforge.net
+ ---------------------------------------------------------------------------
+ Description
+ ***************************************************************************
+
+ A
+
+ db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b.
+ 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D
+ 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY'
+ 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b
+ 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88.
+ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD
+
+ H e a d e r F i l e
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "filterdialog.h"
+#include "filtertabs.h"
+#include "generalfilter.h"
+
+#include <tdelocale.h>
+
+FilterDialog::FilterDialog( TQWidget *parent, const char *name )
+ : KDialogBase( parent, name, true, i18n("Krusader::Choose Files"), Ok|Cancel )
+{
+ TQGridLayout *filterGrid = new TQGridLayout( this->layout() );
+ filterGrid->setSpacing( 6 );
+ filterGrid->setMargin( 11 );
+
+ TQTabWidget *filterWidget = new TQTabWidget( this, "filterTabs" );
+
+ filterTabs = FilterTabs::addTo( filterWidget, FilterTabs::HasProfileHandler );
+ generalFilter = (GeneralFilter *)filterTabs->get( "GeneralFilter" );
+ generalFilter->searchFor->setEditText( "*" );
+
+ filterGrid->addWidget( filterWidget, 0, 0 );
+ setMainWidget(filterWidget);
+
+ generalFilter->searchFor->setFocus();
+
+ connect( filterTabs, TQ_SIGNAL( closeRequest(bool) ), this, TQ_SLOT( slotCloseRequest(bool) ) );
+
+ exec();
+}
+
+KRQuery FilterDialog::getQuery()
+{
+ return query;
+}
+
+void FilterDialog::slotCloseRequest( bool doAccept )
+{
+ if( doAccept )
+ {
+ slotOk();
+ accept();
+ }
+ else
+ reject();
+}
+
+void FilterDialog::slotOk()
+{
+ if( filterTabs->fillQuery( &query ) )
+ {
+ KDialogBase::slotOk();
+ return;
+ }
+
+ query = KRQuery();
+}
+
+#include "filterdialog.moc"
diff --git a/src/app/Filter/filterdialog.h b/src/app/Filter/filterdialog.h
new file mode 100644
index 0000000..c4c96d9
--- /dev/null
+++ b/src/app/Filter/filterdialog.h
@@ -0,0 +1,61 @@
+/***************************************************************************
+ filterdialog.h - description
+ -------------------
+ copyright : (C) 2005 + by Csaba Karai
+ e-mail : krusader@users.sourceforge.net
+ web site : http://krusader.sourceforge.net
+ ---------------------------------------------------------------------------
+ Description
+ ***************************************************************************
+
+ A
+
+ db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b.
+ 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D
+ 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY'
+ 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b
+ 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88.
+ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD
+
+ H e a d e r F i l e
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef FILTERDIALOG_H
+#define FILTERDIALOG_H
+
+#include <kdialogbase.h>
+#include "../VFS/krquery.h"
+
+class FilterTabs;
+class GeneralFilter;
+
+class FilterDialog : public KDialogBase
+{
+ TQ_OBJECT
+
+
+public:
+ FilterDialog( TQWidget *parent = 0, const char *name = 0 );
+ KRQuery getQuery();
+
+public slots:
+ void slotCloseRequest( bool doAccept );
+
+protected:
+ void slotOk();
+
+private:
+ FilterTabs * filterTabs;
+ GeneralFilter * generalFilter;
+ KRQuery query;
+};
+
+#endif /* FILTERDIALOG_H */
diff --git a/src/app/Filter/filtertabs.cpp b/src/app/Filter/filtertabs.cpp
new file mode 100644
index 0000000..f1e5339
--- /dev/null
+++ b/src/app/Filter/filtertabs.cpp
@@ -0,0 +1,133 @@
+/***************************************************************************
+ filtertab.cpp - description
+ -------------------
+ copyright : (C) 2005 + by Csaba Karai
+ e-mail : krusader@users.sourceforge.net
+ web site : http://krusader.sourceforge.net
+ ---------------------------------------------------------------------------
+ Description
+ ***************************************************************************
+
+ A
+
+ db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b.
+ 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D
+ 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY'
+ 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b
+ 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88.
+ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD
+
+ S o u r c e F i l e
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "filtertabs.h"
+#include "filterdialog.h"
+#include "generalfilter.h"
+#include "advancedfilter.h"
+
+#include <tdelocale.h>
+
+FilterTabs::FilterTabs( int properties, TQTabWidget *tabWidget, TQObject *parent ) :
+ TQObject( parent, 0 )
+{
+ this->tabWidget = tabWidget;
+
+ GeneralFilter *generalFilter = new GeneralFilter( this, properties, tabWidget, "generalFilter" );
+ tabWidget->insertTab( generalFilter, i18n( "&General" ) );
+ filterList.append( generalFilter );
+ pageNumbers.append( tabWidget->indexOf( generalFilter ) );
+
+ AdvancedFilter *advancedFilter = new AdvancedFilter( this, tabWidget, "advancedFilter" );
+ tabWidget->insertTab( advancedFilter, i18n( "&Advanced" ) );
+ filterList.append( advancedFilter );
+ pageNumbers.append( tabWidget->indexOf( advancedFilter ) );
+}
+
+FilterTabs * FilterTabs::addTo( TQTabWidget *tabWidget, int props )
+{
+ return new FilterTabs( props, tabWidget, tabWidget );
+}
+
+void FilterTabs::saveToProfile( TQString name )
+{
+ FilterBase *filter = filterList.first();
+
+ while( filter )
+ {
+ filter->saveToProfile( name );
+ filter = filterList.next();
+ }
+}
+
+void FilterTabs::loadFromProfile( TQString name )
+{
+ FilterBase *filter = filterList.first();
+
+ while( filter )
+ {
+ filter->loadFromProfile( name );
+ filter = filterList.next();
+ }
+}
+
+void FilterTabs::acceptQuery()
+{
+ FilterBase *filter = filterList.first();
+
+ while( filter )
+ {
+ filter->queryAccepted();
+ filter = filterList.next();
+ }
+}
+
+bool FilterTabs::fillQuery( KRQuery *query )
+{
+ for( unsigned int i=0; i != filterList.count(); i++ )
+ {
+
+ FilterBase *filter = filterList.at( i );
+
+ bool result = filter->fillQuery( query );
+ if( result == false )
+ {
+ tabWidget->setCurrentPage( pageNumbers[ i ] );
+ return false;
+ }
+ }
+
+ acceptQuery();
+ return true;
+}
+
+FilterBase * FilterTabs::get( TQString name )
+{
+ FilterBase *filter = filterList.first();
+
+ while( filter )
+ {
+ if( filter->name() == name )
+ return filter;
+
+ filter = filterList.next();
+ }
+
+ return 0;
+}
+
+KRQuery FilterTabs::getQuery( TQWidget *parent, const char *name )
+{
+ FilterDialog dialog( parent, name );
+ return dialog.getQuery();
+}
+
+#include "filtertabs.moc"
+
diff --git a/src/app/Filter/filtertabs.h b/src/app/Filter/filtertabs.h
new file mode 100644
index 0000000..ae8e3ec
--- /dev/null
+++ b/src/app/Filter/filtertabs.h
@@ -0,0 +1,81 @@
+/***************************************************************************
+ filtertab.h - description
+ -------------------
+ copyright : (C) 2005 + by Csaba Karai
+ e-mail : krusader@users.sourceforge.net
+ web site : http://krusader.sourceforge.net
+ ---------------------------------------------------------------------------
+ Description
+ ***************************************************************************
+
+ A
+
+ db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b.
+ 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D
+ 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY'
+ 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b
+ 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88.
+ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD
+
+ H e a d e r F i l e
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef FILTERTABS_H
+#define FILTERTABS_H
+
+#include <tqtabwidget.h>
+#include <tqptrlist.h>
+
+#include "filterbase.h"
+
+class FilterTabs : public TQObject
+{
+ TQ_OBJECT
+
+
+ public:
+
+ enum
+ {
+ HasRemoteContentSearch = 0x0800,
+ HasProfileHandler = 0x1000,
+ HasRecurseOptions = 0x2000,
+ HasSearchIn = 0x4000,
+ HasDontSearchIn = 0x8000,
+
+ Default = 0xe000
+ };
+
+ static FilterTabs * addTo( TQTabWidget *tabWidget, int props = FilterTabs::Default );
+ static KRQuery getQuery( TQWidget *parent = 0, const char *name = 0 );
+
+ FilterBase *get( TQString name );
+
+ public slots:
+ void loadFromProfile( TQString );
+ void saveToProfile( TQString );
+ bool fillQuery( KRQuery *query );
+ void close( bool accept = true ) { emit closeRequest( accept ); }
+
+ signals:
+ void closeRequest( bool accept = true );
+
+ private:
+ FilterTabs( int properties, TQTabWidget *tabWidget, TQObject *parent );
+ void acceptQuery();
+
+ TQPtrList<FilterBase> filterList;
+ TQValueList<int> pageNumbers;
+
+ TQTabWidget * tabWidget;
+};
+
+#endif /* FILTERTABS_H */
diff --git a/src/app/Filter/generalfilter.cpp b/src/app/Filter/generalfilter.cpp
new file mode 100644
index 0000000..70be90f
--- /dev/null
+++ b/src/app/Filter/generalfilter.cpp
@@ -0,0 +1,536 @@
+/***************************************************************************
+ generalfilter.cpp - description
+ -------------------
+ copyright : (C) 2003 + by Shie Erlich & Rafi Yanai & Csaba Karai
+ e-mail : krusader@users.sourceforge.net
+ web site : http://krusader.sourceforge.net
+ ---------------------------------------------------------------------------
+ Description
+ ***************************************************************************
+
+ A
+
+ db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b.
+ 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D
+ 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY'
+ 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b
+ 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88.
+ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD
+
+ S o u r c e F i l e
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "generalfilter.h"
+#include "filtertabs.h"
+#include "../krusader.h"
+#include "../VFS/vfs.h"
+
+#include <tdelocale.h>
+#include <tdefiledialog.h>
+#include <tdemessagebox.h>
+#include <kiconloader.h>
+#include <tqwhatsthis.h>
+#include <tqpushbutton.h>
+
+GeneralFilter::GeneralFilter( FilterTabs *tabs, int properties, TQWidget *parent, const char *name ) : TQWidget( parent, name ),
+ profileManager( 0 ), fltTabs( tabs )
+{
+ TQGridLayout *filterLayout = new TQGridLayout( this );
+ filterLayout->setSpacing( 6 );
+ filterLayout->setMargin( 11 );
+
+ this->properties = properties;
+
+ // Options for name filtering
+
+ TQGroupBox *nameGroup = new TQGroupBox( this, "nameGroup" );
+ nameGroup->setTitle( i18n( "File name" ) );
+ nameGroup->setColumnLayout(0, TQt::Vertical );
+ nameGroup->layout()->setSpacing( 0 );
+ nameGroup->layout()->setMargin( 0 );
+ TQGridLayout *nameGroupLayout = new TQGridLayout( nameGroup->layout() );
+ nameGroupLayout->setAlignment( TQt::AlignTop );
+ nameGroupLayout->setSpacing( 6 );
+ nameGroupLayout->setMargin( 11 );
+
+ searchForCase = new TQCheckBox( nameGroup, "searchForCase" );
+ searchForCase->setText( i18n( "&Case sensitive" ) );
+ searchForCase->setChecked( false );
+ nameGroupLayout->addWidget( searchForCase, 1, 2 );
+
+ TQLabel *searchForLabel = new TQLabel( nameGroup, "searchForLabel" );
+ searchForLabel->setText( i18n( "Search &for:" ) );
+ nameGroupLayout->addWidget( searchForLabel, 0, 0 );
+
+ searchFor = new KHistoryCombo( false, nameGroup, "searchFor" );
+ searchFor->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, searchFor->sizePolicy().hasHeightForWidth() ) );
+ searchFor->setEditable( true );
+ searchFor->setDuplicatesEnabled( false );
+ searchFor->setMaxCount( 25 );
+ searchForLabel->setBuddy( searchFor );
+ nameGroupLayout->addMultiCellWidget( searchFor, 0, 0, 1, 2 );
+
+ TQString s = "<p><img src='toolbar|find'></p>" + i18n("<p>The filename filtering criteria is defined here.</p><p>You can make use of wildcards. Multiple patterns are separated by space (means logical OR) and patterns are excluded from the search using the pipe symbol.</p><p>If the pattern is ended with a slash (<code>*pattern*/</code>), that means that pattern relates to recursive search of directories.<ul><li><code>pattern</code> - means to search those files/directories that name is <code>pattern</code>, recursive search goes through all subdirectories independently of the value of <code>pattern</code></li><li><code>pattern/</code> - means to search all files/directories, but recursive search goes through/excludes the directories that name is <code>pattern</code></li></ul><p></p><p>It's allowed to use quotation marks for names that contain space. Filter <code>\"Program&nbsp;Files\"</code> searches out those files/directories that name is <code>Program&nbsp;Files</code>.</p><p>Examples:<ul><code><li>*.o</li><li>*.h *.c\?\?</li><li>*.cpp *.h | *.moc.cpp</li><li>* | CVS/ .svn/</li></code></ul><b>Note</b>: the search term '<code>text</code>' is equivalent to '<code>*text*</code>'.</p>");
+ TQWhatsThis::add(searchFor, s);
+ TQWhatsThis::add(searchForLabel, s);
+
+ TQLabel *searchType = new TQLabel( nameGroup, "searchType" );
+ searchType->setText( i18n( "&Of type:" ) );
+ nameGroupLayout->addWidget( searchType, 1, 0 );
+
+ ofType = new KComboBox( false, nameGroup, "ofType" );
+ ofType->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, ofType->sizePolicy().hasHeightForWidth() ) );
+ ofType->setEditable( false );
+ searchType->setBuddy(ofType);
+ ofType->insertItem(i18n("All Files"));
+ ofType->insertItem(i18n("Archives"));
+ ofType->insertItem(i18n("Directories"));
+ ofType->insertItem(i18n("Image Files"));
+ ofType->insertItem(i18n("Text Files"));
+ ofType->insertItem(i18n("Video Files"));
+ ofType->insertItem(i18n("Audio Files"));
+
+ nameGroupLayout->addWidget( ofType, 1, 1 );
+ filterLayout->addWidget( nameGroup, 0, 0 );
+
+ middleLayout = new TQHBoxLayout();
+ middleLayout->setSpacing( 6 );
+ middleLayout->setMargin( 0 );
+ TQSpacerItem* middleSpacer = new TQSpacerItem( 1, 1, TQSizePolicy::Fixed, TQSizePolicy::Fixed );
+ middleLayout->addItem( middleSpacer );
+
+ if( properties & FilterTabs::HasProfileHandler )
+ {
+ // The profile handler
+
+ TQGroupBox *profileHandler = new TQGroupBox( this, "profileHandler" );
+ profileHandler->setTitle( i18n( "&Profile handler" ) );
+ profileHandler->setColumnLayout(0, TQt::Vertical );
+ profileHandler->layout()->setSpacing( 0 );
+ profileHandler->layout()->setMargin( 0 );
+ TQGridLayout *profileLayout = new TQGridLayout( profileHandler->layout() );
+ profileLayout->setAlignment( TQt::AlignTop );
+ profileLayout->setSpacing( 6 );
+ profileLayout->setMargin( 11 );
+
+ profileListBox = new TQListBox( profileHandler, "profileListBox" );
+ profileLayout->addMultiCellWidget( profileListBox, 0, 3, 0, 0 );
+
+ profileAddBtn = new TQPushButton( i18n( "&Add" ), profileHandler, "profileAddBtn" );
+ profileLayout->addWidget( profileAddBtn, 0, 1 );
+
+ profileLoadBtn = new TQPushButton( i18n( "&Load" ), profileHandler, "profileLoadBtn" );
+ profileLoadBtn->setEnabled( false );
+ profileLayout->addWidget( profileLoadBtn, 1, 1 );
+
+ profileOverwriteBtn = new TQPushButton( i18n( "&Overwrite" ), profileHandler, "profileOverwriteBtn" );
+ profileOverwriteBtn->setEnabled( false );
+ profileLayout->addWidget( profileOverwriteBtn, 2, 1 );
+
+ profileRemoveBtn = new TQPushButton( i18n( "&Remove" ), profileHandler, "profileRemoveBtn" );
+ profileRemoveBtn->setEnabled( false );
+ profileLayout->addWidget( profileRemoveBtn, 3, 1 );
+
+ profileManager = new ProfileManager( "SelectionProfile", this, "selectionProfileManager" );
+ profileManager->hide();
+
+ middleLayout->addWidget( profileHandler );
+
+ refreshProfileListBox();
+ }
+
+ if( properties & FilterTabs::HasSearchIn )
+ {
+ // Options for search in
+
+ TQGroupBox *searchInGroup = new TQGroupBox( this, "searchInGroup" );
+ searchInGroup->setTitle( i18n( "&Search in" ) );
+ searchInGroup->setColumnLayout(0, TQt::Vertical );
+ searchInGroup->layout()->setSpacing( 0 );
+ searchInGroup->layout()->setMargin( 0 );
+ TQGridLayout *searchInLayout = new TQGridLayout( searchInGroup->layout() );
+ searchInLayout->setAlignment( TQt::AlignTop );
+ searchInLayout->setSpacing( 6 );
+ searchInLayout->setMargin( 11 );
+
+ searchIn = new KURLListRequester( searchInGroup, "searchIn" );
+ searchInLayout->addWidget( searchIn, 0, 0 );
+
+ middleLayout->addWidget( searchInGroup );
+ }
+
+ if( properties & FilterTabs::HasDontSearchIn )
+ {
+ // Options for don't search in
+
+ TQGroupBox *dontSearchInGroup = new TQGroupBox( this, "dontSearchInGroup" );
+ dontSearchInGroup->setTitle( i18n( "&Don't search in" ) );
+ dontSearchInGroup->setColumnLayout(0, TQt::Vertical );
+ dontSearchInGroup->layout()->setSpacing( 0 );
+ dontSearchInGroup->layout()->setMargin( 0 );
+ TQGridLayout *dontSearchInLayout = new TQGridLayout( dontSearchInGroup->layout() );
+ dontSearchInLayout->setAlignment( TQt::AlignTop );
+ dontSearchInLayout->setSpacing( 6 );
+ dontSearchInLayout->setMargin( 11 );
+
+ dontSearchIn = new KURLListRequester( dontSearchInGroup, "dontSearchIn" );
+ dontSearchInLayout->addWidget( dontSearchIn, 0, 0 );
+
+ middleLayout->addWidget( dontSearchInGroup );
+ }
+
+ filterLayout->addLayout( middleLayout, 1, 0 );
+
+ // Options for containing text
+
+ TQGroupBox *containsGroup = new TQGroupBox( this, "containsGroup" );
+ containsGroup->setTitle( i18n( "Containing text" ) );
+ containsGroup->setColumnLayout(0, TQt::Vertical );
+ containsGroup->layout()->setSpacing( 0 );
+ containsGroup->layout()->setMargin( 0 );
+ TQGridLayout *containsLayout = new TQGridLayout( containsGroup->layout() );
+ containsLayout->setAlignment( TQt::AlignTop );
+ containsLayout->setSpacing( 6 );
+ containsLayout->setMargin( 11 );
+
+ TQHBoxLayout *containsTextLayout = new TQHBoxLayout();
+ containsTextLayout->setSpacing( 6 );
+ containsTextLayout->setMargin( 0 );
+
+ TQLabel *containsLabel = new TQLabel( containsGroup, "containsLabel" );
+ containsLabel->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)1, containsLabel->sizePolicy().hasHeightForWidth() ) );
+ containsLabel->setText( i18n( "&Text:" ) );
+ containsTextLayout->addWidget( containsLabel );
+
+ containsText = new KHistoryCombo( false, containsGroup, "containsText" );
+ containsText->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, containsText->sizePolicy().hasHeightForWidth() ) );
+ containsText->setDuplicatesEnabled( false );
+ containsText->setMaxCount( 25 );
+ containsTextLayout->addWidget( containsText );
+ containsLabel->setBuddy(containsText);
+
+ containsLayout->addLayout( containsTextLayout, 0, 0 );
+
+ TQHBoxLayout *containsCbsLayout = new TQHBoxLayout();
+ containsCbsLayout->setSpacing( 6 );
+ containsCbsLayout->setMargin( 0 );
+ TQSpacerItem* cbSpacer = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
+ containsCbsLayout->addItem( cbSpacer );
+
+ remoteContentSearch = new TQCheckBox( containsGroup, "remoteContentSearch" );
+ remoteContentSearch->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)0, remoteContentSearch->sizePolicy().hasHeightForWidth() ) );
+ remoteContentSearch->setText( i18n( "&Remote content search" ) );
+ remoteContentSearch->setChecked( false );
+ containsCbsLayout->addWidget( remoteContentSearch );
+ if( !( properties & FilterTabs::HasRemoteContentSearch ) )
+ remoteContentSearch->hide();
+
+ containsWholeWord = new TQCheckBox( containsGroup, "containsWholeWord" );
+ containsWholeWord->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)0, containsWholeWord->sizePolicy().hasHeightForWidth() ) );
+ containsWholeWord->setText( i18n( "&Match whole word only" ) );
+ containsWholeWord->setChecked( false );
+ containsCbsLayout->addWidget( containsWholeWord );
+
+ containsTextCase = new TQCheckBox( containsGroup, "containsTextCase" );
+ containsTextCase->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)0, containsTextCase->sizePolicy().hasHeightForWidth() ) );
+ containsTextCase->setText( i18n( "Cas&e sensitive" ) );
+ containsTextCase->setChecked( true );
+ containsCbsLayout->addWidget( containsTextCase );
+
+ containsLayout->addLayout( containsCbsLayout, 1, 0 );
+
+ filterLayout->addWidget( containsGroup, 2, 0 );
+
+ if( properties & FilterTabs::HasRecurseOptions )
+ {
+ // Options for recursive searching
+
+ TQHBoxLayout *recurseLayout = new TQHBoxLayout();
+ recurseLayout->setSpacing( 6 );
+ recurseLayout->setMargin( 0 );
+ TQSpacerItem* recurseSpacer = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
+ recurseLayout->addItem( recurseSpacer );
+
+ searchInDirs = new TQCheckBox( this, "searchInDirs" );
+ searchInDirs->setText( i18n( "Search in s&ubdirectories" ) );
+ searchInDirs->setChecked( true );
+ recurseLayout->addWidget( searchInDirs );
+
+ searchInArchives = new TQCheckBox( this, "searchInArchives" );
+ searchInArchives->setText( i18n( "Search in arch&ives" ) );
+ recurseLayout->addWidget( searchInArchives );
+
+ followLinks = new TQCheckBox( this, "followLinks" );
+ followLinks->setText( i18n( "Follow &links" ) );
+ recurseLayout->addWidget( followLinks );
+
+ filterLayout->addLayout( recurseLayout, 3, 0 );
+ }
+
+ // Connection table
+
+ if( properties & FilterTabs::HasProfileHandler )
+ {
+ connect( profileAddBtn, TQ_SIGNAL(clicked()) , this, TQ_SLOT( slotAddBtnClicked() ) );
+ connect( profileLoadBtn, TQ_SIGNAL(clicked()) , this, TQ_SLOT( slotLoadBtnClicked() ) );
+ connect( profileOverwriteBtn, TQ_SIGNAL(clicked()) , this, TQ_SLOT( slotOverwriteBtnClicked() ) );
+ connect( profileRemoveBtn, TQ_SIGNAL(clicked()) , this, TQ_SLOT( slotRemoveBtnClicked() ) );
+ connect( profileListBox, TQ_SIGNAL(doubleClicked(TQListBoxItem *)) , this, TQ_SLOT( slotProfileDoubleClicked(TQListBoxItem *) ) );
+ connect( profileManager, TQ_SIGNAL(loadFromProfile(TQString )), fltTabs, TQ_SLOT( loadFromProfile(TQString ) ) );
+ connect( profileManager, TQ_SIGNAL(saveToProfile(TQString )), fltTabs, TQ_SLOT( saveToProfile(TQString ) ) );
+ }
+
+ connect( searchFor, TQ_SIGNAL(activated(const TQString&)), searchFor, TQ_SLOT(addToHistory(const TQString&)));
+ connect( containsText, TQ_SIGNAL(activated(const TQString&)), containsText, TQ_SLOT(addToHistory(const TQString&)));
+
+ // load the completion and history lists
+ // ==> search for
+ krConfig->setGroup("Search");
+ TQStringList list = krConfig->readListEntry("SearchFor Completion");
+ searchFor->completionObject()->setItems(list);
+ list = krConfig->readListEntry("SearchFor History");
+ searchFor->setHistoryItems(list);
+ // ==> grep
+ krConfig->setGroup("Search");
+ list = krConfig->readListEntry("ContainsText Completion");
+ containsText->completionObject()->setItems(list);
+ list = krConfig->readListEntry("ContainsText History");
+ containsText->setHistoryItems(list);
+
+ setTabOrder( searchFor, containsText ); // search for -> content
+ setTabOrder( containsText, searchType ); // content -> search type
+}
+
+GeneralFilter::~GeneralFilter()
+{
+ // save the history combos
+ // ==> search for
+ TQStringList list = searchFor->completionObject()->items();
+ krConfig->setGroup("Search");
+ krConfig->writeEntry("SearchFor Completion", list);
+ list = searchFor->historyItems();
+ krConfig->writeEntry("SearchFor History", list);
+ // ==> grep text
+ list = containsText->completionObject()->items();
+ krConfig->setGroup("Search");
+ krConfig->writeEntry("ContainsText Completion", list);
+ list = containsText->historyItems();
+ krConfig->writeEntry("ContainsText History", list);
+
+ krConfig->sync();
+}
+
+bool GeneralFilter::fillQuery( KRQuery *query )
+{
+ // check that we have (at least) what to search, and where to search in
+ if (searchFor->currentText().simplifyWhiteSpace().isEmpty()) {
+ KMessageBox::error(this ,i18n("No search criteria entered!"));
+ searchFor->setFocus();
+ return false;
+ }
+
+ // now fill the query
+
+ query->setNameFilter( searchFor->currentText().stripWhiteSpace(), searchForCase->isChecked() );
+
+ bool remoteContent = (properties & FilterTabs::HasRemoteContentSearch ) ?
+ remoteContentSearch->isChecked() : false;
+
+ query->setContent( containsText->currentText(),
+ containsTextCase->isChecked(),
+ containsWholeWord->isChecked(),
+ remoteContent );
+
+ if (ofType->currentText()!=i18n("All Files"))
+ query->setMimeType( ofType->currentText() );
+ else query->setMimeType( TQString() );
+
+ if ( properties & FilterTabs::HasRecurseOptions )
+ {
+ query->setSearchInArchives( searchInArchives->isChecked() );
+ query->setRecursive( searchInDirs->isChecked() );
+ query->setFollowLinks( followLinks->isChecked() );
+
+ // create the lists
+ }
+ if( properties & FilterTabs::HasSearchIn )
+ {
+ query->setSearchInDirs( searchIn->urlList() );
+
+ // checking the lists
+
+ if (query->searchInDirs().isEmpty() ) { // we need a place to search in
+ KMessageBox::error(this ,i18n("Please specify a location to search in."));
+ searchIn->lineEdit()->setFocus();
+ return false;
+ }
+ }
+
+ if( properties & FilterTabs::HasDontSearchIn )
+ query->setDontSearchInDirs( dontSearchIn->urlList() );
+
+ return true;
+}
+
+void GeneralFilter::queryAccepted()
+{
+ searchFor->addToHistory(searchFor->currentText());
+ containsText->addToHistory(containsText->currentText());
+}
+
+void GeneralFilter::loadFromProfile( TQString name )
+{
+ krConfig->setGroup( name );
+
+ searchForCase->setChecked( krConfig->readBoolEntry( "Case Sensitive Search", false ) );
+ containsTextCase->setChecked( krConfig->readBoolEntry( "Case Sensitive Content", false ) );
+ remoteContentSearch->setChecked( krConfig->readBoolEntry( "Remote Content Search", false ) );
+ containsWholeWord->setChecked( krConfig->readBoolEntry( "Match Whole Word Only", false ) );
+ containsText->setEditText( krConfig->readEntry( "Contains Text", "" ) );
+ searchFor->setEditText( krConfig->readEntry( "Search For", "" ) );
+
+ TQString mime = krConfig->readEntry( "Mime Type", "" );
+ for( int i = ofType->count(); i >= 0; i-- )
+ {
+ ofType->setCurrentItem( i );
+ if( ofType->currentText() == mime )
+ break;
+ }
+
+ if( properties & FilterTabs::HasRecurseOptions )
+ {
+ searchInDirs->setChecked( krConfig->readBoolEntry( "Search In Subdirectories", true ) );
+ searchInArchives->setChecked( krConfig->readBoolEntry( "Search In Archives", false ) );
+ followLinks->setChecked( krConfig->readBoolEntry( "Follow Symlinks", false ) );
+ }
+
+ if( properties & FilterTabs::HasSearchIn )
+ {
+ searchIn->lineEdit()->setText( krConfig->readEntry( "Search In Edit", "" ) );
+
+ searchIn->listBox()->clear();
+ TQStringList searchInList = krConfig->readListEntry( "Search In List" );
+ if( !searchInList.isEmpty() )
+ searchIn->listBox()->insertStringList( searchInList );
+ }
+
+ if( properties & FilterTabs::HasDontSearchIn )
+ {
+ dontSearchIn->lineEdit()->setText( krConfig->readEntry( "Dont Search In Edit", "" ) );
+
+ dontSearchIn->listBox()->clear();
+ TQStringList dontSearchInList = krConfig->readListEntry( "Dont Search In List" );
+ if( !dontSearchInList.isEmpty() )
+ dontSearchIn->listBox()->insertStringList( dontSearchInList );
+ }
+}
+
+void GeneralFilter::saveToProfile( TQString name )
+{
+ krConfig->setGroup( name );
+
+ krConfig->writeEntry( "Case Sensitive Search", searchForCase->isChecked() );
+ krConfig->writeEntry( "Case Sensitive Content", containsTextCase->isChecked() );
+ krConfig->writeEntry( "Remote Content Search", remoteContentSearch->isChecked() );
+ krConfig->writeEntry( "Match Whole Word Only", containsWholeWord->isChecked() );
+ krConfig->writeEntry( "Contains Text", containsText->currentText() );
+ krConfig->writeEntry( "Search For", searchFor->currentText() );
+
+ krConfig->writeEntry( "Mime Type", ofType->currentText() );
+
+ if( properties & FilterTabs::HasRecurseOptions )
+ {
+ krConfig->writeEntry( "Search In Subdirectories", searchInDirs->isChecked() );
+ krConfig->writeEntry( "Search In Archives", searchInArchives->isChecked() );
+ krConfig->writeEntry( "Follow Symlinks", followLinks->isChecked() );
+ }
+
+ if( properties & FilterTabs::HasSearchIn )
+ {
+ krConfig->writeEntry( "Search In Edit", searchIn->lineEdit()->text() );
+
+ TQStringList searchInList;
+ for ( TQListBoxItem *item = searchIn->listBox()->firstItem(); item != 0; item = item->next() )
+ searchInList.append( item->text().simplifyWhiteSpace() );
+ krConfig->writeEntry( "Search In List", searchInList );
+ }
+
+ if( properties & FilterTabs::HasDontSearchIn )
+ {
+ krConfig->writeEntry( "Dont Search In Edit", dontSearchIn->lineEdit()->text() );
+
+ TQStringList dontSearchInList;
+ for ( TQListBoxItem *item = dontSearchIn->listBox()->firstItem(); item != 0; item = item->next() )
+ dontSearchInList.append( item->text().simplifyWhiteSpace() );
+ krConfig->writeEntry( "Dont Search In List", dontSearchInList );
+ }
+}
+
+void GeneralFilter::refreshProfileListBox()
+{
+ profileListBox->clear();
+ profileListBox->insertStringList( ProfileManager::availableProfiles( "SelectionProfile" ) );
+
+ if( profileListBox->count() != 0 )
+ {
+ profileLoadBtn->setEnabled( true );
+ profileOverwriteBtn->setEnabled( true );
+ profileRemoveBtn->setEnabled( true );
+ }
+ else
+ {
+ profileLoadBtn->setEnabled( false );
+ profileOverwriteBtn->setEnabled( false );
+ profileRemoveBtn->setEnabled( false );
+ }
+}
+
+void GeneralFilter::slotAddBtnClicked()
+{
+ profileManager->newProfile( searchFor->currentText().simplifyWhiteSpace() );
+ refreshProfileListBox();
+}
+
+void GeneralFilter::slotOverwriteBtnClicked()
+{
+ TQListBoxItem *item = profileListBox->item( profileListBox->currentItem() );
+ if( item != 0 )
+ profileManager->overwriteProfile( item->text() );
+}
+
+void GeneralFilter::slotRemoveBtnClicked()
+{
+ TQListBoxItem *item = profileListBox->item( profileListBox->currentItem() );
+ if( item != 0 )
+ {
+ profileManager->deleteProfile( item->text() );
+ refreshProfileListBox();
+ }
+}
+
+void GeneralFilter::slotProfileDoubleClicked( TQListBoxItem *item )
+{
+ if( item != 0 )
+ {
+ TQString profileName = item->text();
+ profileManager->loadProfile( profileName );
+ fltTabs->close( true );
+ }
+}
+
+void GeneralFilter::slotLoadBtnClicked()
+{
+ TQListBoxItem *item = profileListBox->item( profileListBox->currentItem() );
+ if( item != 0 )
+ profileManager->loadProfile( item->text() );
+}
+
+#include "generalfilter.moc"
diff --git a/src/app/Filter/generalfilter.h b/src/app/Filter/generalfilter.h
new file mode 100644
index 0000000..d968551
--- /dev/null
+++ b/src/app/Filter/generalfilter.h
@@ -0,0 +1,107 @@
+/***************************************************************************
+ generalfilter.h - description
+ -------------------
+ copyright : (C) 2003 + by Csaba Karai
+ e-mail : krusader@users.sourceforge.net
+ web site : http://krusader.sourceforge.net
+ ---------------------------------------------------------------------------
+ Description
+ ***************************************************************************
+
+ A
+
+ db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b.
+ 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D
+ 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY'
+ 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b
+ 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88.
+ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD
+
+ H e a d e r F i l e
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef GENERALFILTER_H
+#define GENERALFILTER_H
+
+#include "filterbase.h"
+#include "../VFS/krquery.h"
+#include "../Dialogs/kurllistrequester.h"
+#include "../GUI/profilemanager.h"
+
+#include <tqwidget.h>
+#include <tqlayout.h>
+#include <tqgroupbox.h>
+#include <tqcheckbox.h>
+#include <tqlabel.h>
+#include <tqlistbox.h>
+#include <kcombobox.h>
+#include <kshellcompletion.h>
+
+class GeneralFilter : public TQWidget, public FilterBase
+{
+ TQ_OBJECT
+
+
+public:
+ GeneralFilter( FilterTabs *tabs, int properties, TQWidget *parent = 0, const char *name = 0 );
+ ~GeneralFilter();
+
+ virtual bool fillQuery( KRQuery *query );
+ virtual void queryAccepted();
+ virtual void loadFromProfile( TQString name );
+ virtual void saveToProfile( TQString name );
+ virtual TQString name() { return "GeneralFilter";}
+ virtual FilterTabs * filterTabs() { return fltTabs; }
+
+public slots:
+ void slotAddBtnClicked();
+ void slotLoadBtnClicked();
+ void slotOverwriteBtnClicked();
+ void slotRemoveBtnClicked();
+ void slotProfileDoubleClicked( TQListBoxItem * );
+ void refreshProfileListBox();
+
+public:
+ TQCheckBox* searchForCase;
+ TQCheckBox* remoteContentSearch;
+ TQCheckBox* containsTextCase;
+ TQCheckBox* containsWholeWord;
+ TQCheckBox* searchInDirs;
+ TQCheckBox* searchInArchives;
+ TQCheckBox* followLinks;
+
+ KURLListRequester *searchIn;
+ KURLListRequester *dontSearchIn;
+ TQHBoxLayout *middleLayout;
+
+ KHistoryCombo* searchFor;
+ KHistoryCombo* containsText;
+
+ KComboBox* ofType;
+
+ KShellCompletion completion;
+
+ TQListBox* profileListBox;
+
+ TQPushButton *profileAddBtn;
+ TQPushButton *profileLoadBtn;
+ TQPushButton *profileOverwriteBtn;
+ TQPushButton *profileRemoveBtn;
+
+ ProfileManager *profileManager;
+
+ int properties;
+
+ FilterTabs *fltTabs;
+
+};
+
+#endif /* GENERALFILTER_H */