diff --git a/src/filewidgets/kfilewidget.h b/src/filewidgets/kfilewidget.h --- a/src/filewidgets/kfilewidget.h +++ b/src/filewidgets/kfilewidget.h @@ -346,13 +346,22 @@ /** * Sets the text to be displayed in front of the selection. * - * The default is "Location". + * The default is "Name". * Most useful if you want to make clear what * the location is used for. */ void setLocationLabel(const QString &text); /** + * Sets the text to be displayed in front of the selection. + * + * The default is "Filter". + * Most useful if you want to change the text to something more appropriate + * for each of the various modes that the filewidget can be created with + */ + void setFilterLabel(const QString &text); + + /** * Returns a pointer to the toolbar. * */ diff --git a/src/filewidgets/kfilewidget.cpp b/src/filewidgets/kfilewidget.cpp --- a/src/filewidgets/kfilewidget.cpp +++ b/src/filewidgets/kfilewidget.cpp @@ -115,7 +115,8 @@ delete ops; } - void updateLocationWhatsThis(); + void updateWhatsThis(); + void updateFilterLabel(); void updateAutoSelectExtension(); void initSpeedbar(); void initGUI(); @@ -570,7 +571,6 @@ connect(d->locationEdit, SIGNAL(editTextChanged(QString)), SLOT(_k_slotLocationChanged(QString))); - d->updateLocationWhatsThis(); d->locationLabel->setBuddy(d->locationEdit); KUrlCompletion *fileCompletionObj = new KUrlCompletion(KUrlCompletion::FileCompletion); @@ -583,28 +583,23 @@ this, SLOT(_k_locationAccepted(QString))); // the Filter label/edit - whatsThisText = i18n("This is the filter to apply to the file list. " - "File names that do not match the filter will not be shown.

" - "You may select from one of the preset filters in the " - "drop down menu, or you may enter a custom filter " - "directly into the text area.

" - "Wildcards such as * and ? are allowed.

"); d->filterLabel = new QLabel(i18n("&Filter:"), this); - d->filterLabel->setWhatsThis(whatsThisText); d->filterWidget = new KFileFilterCombo(this); // Properly let the dialog be resized (to smaller). Otherwise we could have // huge dialogs that can't be resized to smaller (it would be as big as the longest // item in this combo box). (ereslibre) d->filterWidget->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); - d->filterWidget->setWhatsThis(whatsThisText); d->filterLabel->setBuddy(d->filterWidget); connect(d->filterWidget, SIGNAL(filterChanged()), SLOT(_k_slotFilterChanged())); d->filterDelayTimer.setSingleShot(true); d->filterDelayTimer.setInterval(300); connect(d->filterWidget, SIGNAL(editTextChanged(QString)), &d->filterDelayTimer, SLOT(start())); connect(&d->filterDelayTimer, SIGNAL(timeout()), SLOT(_k_slotFilterChanged())); + d->updateWhatsThis(); + d->updateFilterLabel(); + // the Automatically Select Extension checkbox // (the text, visibility etc. is set in updateAutoSelectExtension(), which is called by readConfig()) d->autoSelectExtCheckBox = new QCheckBox(this); @@ -684,6 +679,11 @@ d->locationLabel->setText(text); } +void KFileWidget::setFilterLabel(const QString &text) +{ + d->filterLabel->setText(text); +} + void KFileWidget::setFilter(const QString &filter) { int pos = filter.indexOf('/'); @@ -1329,24 +1329,43 @@ } } -void KFileWidgetPrivate::updateLocationWhatsThis() +void KFileWidgetPrivate::updateWhatsThis() { - QString whatsThisText; + QString locationWhatsThisText; + QString filterWhatsThisText; + if (operationMode == KFileWidget::Saving) { - whatsThisText = "" + i18n("This is the name to save the file as.") + + locationWhatsThisText = "" + i18n("This is the name to save the file as.") + i18n(autocompletionWhatsThisText); + filterWhatsThisText = i18n("This is the file type selector. " + "Use it to choose the type for the file that will be saved."); } else if (ops->mode() & KFile::Files) { - whatsThisText = "" + i18n("This is the list of files to open. More than " + locationWhatsThisText = "" + i18n("This is the list of files to open. More than " "one file can be specified by listing several " "files, separated by spaces.") + i18n(autocompletionWhatsThisText); } else { - whatsThisText = "" + i18n("This is the name of the file to open.") + + locationWhatsThisText = "" + i18n("This is the name of the file to open.") + i18n(autocompletionWhatsThisText); + filterWhatsThisText = i18n("This is the filter to apply to the file list. " + "File names that do not match the filter will not be shown.

" + "You may select from one of the preset filters in the " + "drop down menu, or you may enter a custom filter " + "directly into the text area.

" + "Wildcards such as * and ? are allowed.

"); } - locationLabel->setWhatsThis(whatsThisText); - locationEdit->setWhatsThis(whatsThisText); + locationLabel->setWhatsThis(locationWhatsThisText); + locationEdit->setWhatsThis(locationWhatsThisText); + filterLabel->setWhatsThis(filterWhatsThisText); + filterWidget->setWhatsThis(filterWhatsThisText); +} + +void KFileWidgetPrivate::updateFilterLabel() +{ + if (operationMode == KFileWidget::Saving) { + q->setFilterLabel(i18n("&File Type:")); + } } void KFileWidgetPrivate::initSpeedbar() @@ -2062,7 +2081,8 @@ } else { KGuiItem::assign(d->okButton, KStandardGuiItem::ok()); } - d->updateLocationWhatsThis(); + d->updateWhatsThis(); + d->updateFilterLabel(); d->updateAutoSelectExtension(); if (d->ops) {