📄 advancedfilter.cpp
字号:
/*************************************************************************** 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 <qgroupbox.h>#include <klocale.h>#include <qlayout.h>#include <qlabel.h>#include <qbuttongroup.h>#include <qfile.h>#include <kdebug.h>#include <kmessagebox.h>#include <time.h>#include <kiconloader.h>#define USERSFILE QString("/etc/passwd")#define GROUPSFILE QString("/etc/group")AdvancedFilter::AdvancedFilter( FilterTabs *tabs, QWidget *parent, const char *name ) : QWidget( parent, name ), fltTabs( tabs ){ QGridLayout *filterLayout = new QGridLayout( this ); filterLayout->setSpacing( 6 ); filterLayout->setMargin( 11 ); // Options for size QGroupBox *sizeGroup = new QGroupBox( this, "sizeGroup" ); sizeGroup->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, sizeGroup->sizePolicy().hasHeightForWidth() ) ); sizeGroup->setTitle( i18n( "Size" ) ); sizeGroup->setColumnLayout(0, Qt::Vertical ); sizeGroup->layout()->setSpacing( 0 ); sizeGroup->layout()->setMargin( 0 ); QGridLayout *sizeLayout = new QGridLayout( sizeGroup->layout() ); sizeLayout->setAlignment( Qt::AlignTop ); sizeLayout->setSpacing( 6 ); sizeLayout->setMargin( 11 ); biggerThanEnabled = new QCheckBox( sizeGroup, "biggerThanEnabled" ); biggerThanEnabled->setText( i18n( "&Bigger than" ) ); sizeLayout->addWidget( biggerThanEnabled, 0, 0 ); biggerThanAmount = new QLineEdit( sizeGroup, "biggerThanAmount" ); biggerThanAmount->setEnabled( false ); biggerThanAmount->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::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 QCheckBox( sizeGroup, "smallerThanEnabled" ); smallerThanEnabled->setText( i18n( "&Smaller than" ) ); sizeLayout->addWidget( smallerThanEnabled, 0, 3 ); smallerThanAmount = new QLineEdit( sizeGroup, "smallerThanAmount" ); smallerThanAmount->setEnabled( false ); smallerThanAmount->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::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 = QFontMetrics(biggerThanType->font()).height()+2; biggerThanType->setMaximumHeight(height); smallerThanType->setMaximumHeight(height); filterLayout->addWidget( sizeGroup, 0, 0 ); // Options for date QPixmap iconDate = krLoader->loadIcon( "date", KIcon::Toolbar, 16 ); QButtonGroup *dateGroup = new QButtonGroup( this, "dateGroup" ); dateGroup->setTitle( i18n( "Date" ) ); dateGroup->setExclusive( true ); dateGroup->setColumnLayout(0, Qt::Vertical ); dateGroup->layout()->setSpacing( 0 ); dateGroup->layout()->setMargin( 0 ); QGridLayout *dateLayout = new QGridLayout( dateGroup->layout() ); dateLayout->setAlignment( Qt::AlignTop ); dateLayout->setSpacing( 6 ); dateLayout->setMargin( 11 ); modifiedBetweenEnabled = new QRadioButton( dateGroup, "modifiedBetweenEnabled" ); modifiedBetweenEnabled->setText( i18n( "&Modified between" ) ); dateGroup->insert( modifiedBetweenEnabled, 0 ); dateLayout->addMultiCellWidget( modifiedBetweenEnabled, 0, 0, 0, 1 ); modifiedBetweenData1 = new QLineEdit( dateGroup, "modifiedBetweenData1" ); modifiedBetweenData1->setEnabled( false ); modifiedBetweenData1->setText( "" ); dateLayout->addMultiCellWidget( modifiedBetweenData1, 0, 0, 2, 3 ); modifiedBetweenBtn1 = new QToolButton( dateGroup, "modifiedBetweenBtn1" ); modifiedBetweenBtn1->setEnabled( false ); modifiedBetweenBtn1->setText( "" ); modifiedBetweenBtn1->setPixmap( iconDate ); dateLayout->addWidget( modifiedBetweenBtn1, 0, 4 ); QLabel *andLabel = new QLabel( dateGroup, "andLabel" ); andLabel->setText( i18n( "an&d" ) ); dateLayout->addWidget( andLabel, 0, 5 ); modifiedBetweenData2 = new QLineEdit( dateGroup, "modifiedBetweenData2" ); modifiedBetweenData2->setEnabled( false ); modifiedBetweenData2->setText( "" ); andLabel->setBuddy(modifiedBetweenData2); dateLayout->addWidget( modifiedBetweenData2, 0, 6 ); modifiedBetweenBtn2 = new QToolButton( dateGroup, "modifiedBetweenBtn2" ); modifiedBetweenBtn2->setEnabled( false ); modifiedBetweenBtn2->setText( "" ); modifiedBetweenBtn2->setPixmap( iconDate ); dateLayout->addWidget( modifiedBetweenBtn2, 0, 7 ); notModifiedAfterEnabled = new QRadioButton( dateGroup, "notModifiedAfterEnabled" ); notModifiedAfterEnabled->setText( i18n( "&Not modified after" ) ); dateGroup->insert( notModifiedAfterEnabled, 0 ); dateLayout->addMultiCellWidget( notModifiedAfterEnabled, 1, 1, 0, 1 ); notModifiedAfterData = new QLineEdit( dateGroup, "notModifiedAfterData" ); notModifiedAfterData->setEnabled( false ); notModifiedAfterData->setText( "" ); dateLayout->addMultiCellWidget( notModifiedAfterData, 1, 1, 2, 3 ); notModifiedAfterBtn = new QToolButton( dateGroup, "notModifiedAfterBtn" ); notModifiedAfterBtn->setEnabled( false ); notModifiedAfterBtn->setText( "" ); notModifiedAfterBtn->setPixmap( iconDate ); dateLayout->addWidget( notModifiedAfterBtn, 1, 4 ); modifiedInTheLastEnabled = new QRadioButton( dateGroup, "modifiedInTheLastEnabled" ); modifiedInTheLastEnabled->setText( i18n("Mod&ified in the last") ); dateGroup->insert( modifiedInTheLastEnabled, 0 ); dateLayout->addWidget( modifiedInTheLastEnabled, 2, 0 ); modifiedInTheLastData = new QLineEdit( dateGroup, "modifiedInTheLastData" ); modifiedInTheLastData->setEnabled( false ); modifiedInTheLastData->setText( "" ); dateLayout->addWidget( modifiedInTheLastData, 2, 2 ); modifiedInTheLastType = new QComboBox( 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 QLineEdit( dateGroup, "notModifiedInTheLastData" ); notModifiedInTheLastData->setEnabled( false ); notModifiedInTheLastData->setText( "" ); dateLayout->addWidget( notModifiedInTheLastData, 3, 2 ); QLabel *notModifiedInTheLastLbl = new QLabel( dateGroup, "notModifiedInTheLastLbl" ); notModifiedInTheLastLbl->setText( i18n( "No&t modified in the last" ) ); notModifiedInTheLastLbl->setBuddy(notModifiedInTheLastData); dateLayout->addWidget( notModifiedInTheLastLbl, 3, 0 ); notModifiedInTheLastType = new QComboBox( 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 QGroupBox *ownershipGroup = new QGroupBox( this, "ownershipGroup" ); ownershipGroup->setTitle( i18n( "Ownership" ) ); ownershipGroup->setColumnLayout(0, Qt::Vertical ); ownershipGroup->layout()->setSpacing( 0 ); ownershipGroup->layout()->setMargin( 0 ); QGridLayout *ownershipLayout = new QGridLayout( ownershipGroup->layout() ); ownershipLayout->setAlignment( Qt::AlignTop ); ownershipLayout->setSpacing( 6 ); ownershipLayout->setMargin( 11 ); QHBoxLayout *hboxLayout = new QHBoxLayout(); hboxLayout->setSpacing( 6 ); hboxLayout->setMargin( 0 ); belongsToUserEnabled = new QCheckBox( ownershipGroup, "belongsToUserEnabled" ); belongsToUserEnabled->setText( i18n( "Belongs to &user" ) ); hboxLayout->addWidget( belongsToUserEnabled ); belongsToUserData = new QComboBox( false, ownershipGroup, "belongsToUserData" ); belongsToUserData->setEnabled( false ); belongsToUserData->setEditable( false ); hboxLayout->addWidget( belongsToUserData ); belongsToGroupEnabled = new QCheckBox( ownershipGroup, "belongsToGroupEnabled" ); belongsToGroupEnabled->setText( i18n( "Belongs to gr&oup" ) ); hboxLayout->addWidget( belongsToGroupEnabled );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -