25
25
#include <QtGui/QCheckBox>
26
26
#include <QtGui/QWhatsThis>
28
#include <QtGui/QSpinBox>
29
28
#include <QtGui/QPushButton>
30
29
#include <QtGui/QApplication>
31
30
#include <QtGui/QDesktopWidget>
172
172
findCreated = new QCheckBox(i18n("Find all files created or &modified:"), pages[1]);
173
173
bg = new QButtonGroup();
174
174
rb[0] = new QRadioButton(i18n("&between"), pages[1] );
175
rb[1] = new QRadioButton(i18n("&during the previous"), pages[1] );
175
rb[1] = new QRadioButton(pages[1]); // text set in updateDateLabels
176
176
andL = new QLabel(i18n("and"), pages[1]);
177
177
andL->setObjectName( "and" );
178
178
betweenType = new KComboBox( pages[1] );
179
betweenType->setEditable( false );
180
179
betweenType->setObjectName( "comboBetweenType" );
181
betweenType->addItem(i18n("minute(s)"));
182
betweenType->addItem(i18n("hour(s)"));
183
betweenType->addItem(i18nc("use date ranges to search files by modified time","day(s)"));
184
betweenType->addItem(i18n("month(s)"));
185
betweenType->addItem(i18n("year(s)"));
180
betweenType->addItems(QVector<QString>(5).toList()); // texts set in updateDateLabels
186
181
betweenType->setCurrentIndex(1);
182
updateDateLabels(1, 1);
189
184
QDate dt = KGlobal::locale()->calendar()->addYears(QDate::currentDate(), -1);
192
187
fromDate->setObjectName( "fromDate" );
193
188
toDate = new KDateCombo(pages[1] );
194
189
toDate->setObjectName( "toDate" );
195
timeBox = new QSpinBox( pages[1] );
190
timeBox = new KIntSpinBox( pages[1] );
196
191
timeBox->setRange( 1, 60 );
197
192
timeBox->setSingleStep( 1 );
198
193
timeBox->setObjectName( "timeBox" );
200
195
sizeBox =new KComboBox( pages[1] );
201
sizeBox->setEditable( false );
202
196
sizeBox->setObjectName( "sizeBox" );
203
197
QLabel * sizeL =new QLabel(i18n("File &size is:"), pages[1]);
204
198
sizeL->setBuddy( sizeBox );
205
sizeEdit=new QSpinBox(pages[1] );
199
sizeEdit=new KIntSpinBox(pages[1] );
206
200
sizeEdit->setRange( 0, INT_MAX );
207
201
sizeEdit->setSingleStep( 1 );
208
202
sizeEdit->setObjectName( "sizeEdit" );
209
203
sizeEdit->setValue(1);
210
204
sizeUnitBox =new KComboBox( pages[1] );
211
sizeUnitBox->setEditable( false );
212
205
sizeUnitBox->setObjectName( "sizeUnitBox" );
214
207
m_usernameBox = new KComboBox( pages[1] );
227
220
sizeBox ->addItem( i18n("At Most") );
228
221
sizeBox ->addItem( i18n("Equal To") );
230
sizeUnitBox ->addItem( i18n("Bytes") );
223
sizeUnitBox ->addItem( i18np("Byte", "Bytes", 1) );
231
224
sizeUnitBox ->addItem( i18n("KiB") );
232
225
sizeUnitBox ->addItem( i18n("MiB") );
233
226
sizeUnitBox ->addItem( i18n("GiB") );
284
277
connect( findCreated, SIGNAL(toggled(bool)), SLOT(fixLayout()) );
285
278
connect( bg, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(fixLayout()) );
286
279
connect( sizeBox, SIGNAL(activated(int)), this, SLOT(slotSizeBoxChanged(int)));
280
connect( timeBox, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateDateLabelsForNumber(int)));
281
connect( betweenType, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDateLabelsForType(int)));
282
connect( sizeEdit, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateByteComboBox(int)));
289
285
// ************ Page Three
292
288
pages[2]->setObjectName( "page3" );
294
290
typeBox =new KComboBox( pages[2] );
295
typeBox->setEditable( false );
296
291
typeBox->setObjectName( "typeBox" );
297
292
typeBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); // allow smaller than widest entry
298
293
QLabel * typeL =new QLabel( i18nc("label for the file type combobox","File &type:"), pages[2] );
866
861
return subdirsCb->isChecked();
864
void KfindTabWidget::slotUpdateDateLabelsForNumber(int value)
866
updateDateLabels(betweenType->currentIndex(), value);
869
void KfindTabWidget::slotUpdateDateLabelsForType(int index)
871
updateDateLabels(index, timeBox->value());
874
void KfindTabWidget::updateDateLabels(int type, int value)
876
QString typeKey(type == 0 ? 'i' : type == 1 ? 'h' : type == 2 ? 'd' : type == 3 ? 'm' : 'y');
877
rb[1]->setText(ki18ncp("during the previous minute(s)/hour(s)/...; "
878
"dynamic context 'type': 'i' minutes, 'h' hours, 'd' days, 'm' months, 'y' years",
879
"&during the previous", "&during the previous").subs(value).inContext("type", typeKey).toString());
880
betweenType->setItemText(0, i18ncp("use date ranges to search files by modified time", "minute", "minutes", value));
881
betweenType->setItemText(1, i18ncp("use date ranges to search files by modified time", "hour", "hours", value));
882
betweenType->setItemText(2, i18ncp("use date ranges to search files by modified time", "day", "days", value));
883
betweenType->setItemText(3, i18ncp("use date ranges to search files by modified time", "month", "months", value));
884
betweenType->setItemText(4, i18ncp("use date ranges to search files by modified time", "year", "years", value));
887
void KfindTabWidget::slotUpdateByteComboBox(int value)
889
sizeUnitBox->setItemText(0, i18np("Byte", "Bytes", value) );
871
894
Digit validator. Allows only digits to be typed.