┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/search
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2009-11-10 21:44:24 +0000
committerPeter Penz <[email protected]>2009-11-10 21:44:24 +0000
commitd9e3139e505857e1a590f324fc7516ca589169aa (patch)
tree73d03696ab01844be71ef04b028a1bc54be8d9e2 /src/search
parenta97291c90d244c15d3112f33a1261c2c3f134258 (diff)
* Show the search options as soon as the search bar gains focus.
* Allow the user to manually close the options. * Added tooltip descriptions. svn path=/trunk/KDE/kdebase/apps/; revision=1047281
Diffstat (limited to 'src/search')
-rw-r--r--src/search/dolphinsearchbox.cpp7
-rw-r--r--src/search/dolphinsearchbox.h5
-rw-r--r--src/search/dolphinsearchoptionsconfigurator.cpp40
-rw-r--r--src/search/dolphinsearchoptionsconfigurator.h5
4 files changed, 50 insertions, 7 deletions
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp
index d1a97d9a2..e2fd81a6f 100644
--- a/src/search/dolphinsearchbox.cpp
+++ b/src/search/dolphinsearchbox.cpp
@@ -284,9 +284,10 @@ bool DolphinSearchBox::eventFilter(QObject* watched, QEvent* event)
// Postpone the creation of the search completer until
// the search box is used. This decreases the startup time
// of Dolphin.
- Q_ASSERT(m_completer == 0);
- m_completer = new DolphinSearchCompleter(m_searchInput);
- m_searchInput->removeEventFilter(this);
+ if (m_completer == 0) {
+ m_completer = new DolphinSearchCompleter(m_searchInput);
+ }
+ emit requestSearchOptions();
}
return QWidget::eventFilter(watched, event);
diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h
index e3f07a265..81c412aa0 100644
--- a/src/search/dolphinsearchbox.h
+++ b/src/search/dolphinsearchbox.h
@@ -82,10 +82,7 @@ signals:
*/
void search(const KUrl& url);
- /**
- * Is emitted if the text of the searchbox has been changed.
- */
- void textChanged(const QString& text);
+ void requestSearchOptions();
private slots:
void emitSearchSignal();
diff --git a/src/search/dolphinsearchoptionsconfigurator.cpp b/src/search/dolphinsearchoptionsconfigurator.cpp
index dc1ad6813..cebf71cdb 100644
--- a/src/search/dolphinsearchoptionsconfigurator.cpp
+++ b/src/search/dolphinsearchoptionsconfigurator.cpp
@@ -22,7 +22,9 @@
#include "searchcriterionselector.h"
#include <kcombobox.h>
+#include <kdialog.h>
#include <kicon.h>
+#include <klineedit.h>
#include <klocale.h>
#include <kseparator.h>
@@ -61,11 +63,22 @@ DolphinSearchOptionsConfigurator::DolphinSearchOptionsConfigurator(QWidget* pare
// add button "Save"
QPushButton* saveButton = new QPushButton(this);
+ saveButton->setIcon(KIcon("document-save"));
saveButton->setText(i18nc("@action:button", "Save"));
+ saveButton->setToolTip(i18nc("@info", "Save search options"));
+ connect(saveButton, SIGNAL(clicked()), this, SLOT(saveQuery()));
+
+ // add button "Close"
+ QPushButton* closeButton = new QPushButton(this);
+ closeButton->setIcon(KIcon("dialog-close"));
+ closeButton->setText(i18nc("@action:button", "Close"));
+ closeButton->setToolTip(i18nc("@info", "Close search options"));
+ connect(closeButton, SIGNAL(clicked()), this, SLOT(hide()));
// add "Add selector" button
m_addSelectorButton = new QPushButton(this);
m_addSelectorButton->setIcon(KIcon("list-add"));
+ m_addSelectorButton->setToolTip(i18nc("@info", "Add search option"));
m_addSelectorButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
connect(m_addSelectorButton, SIGNAL(clicked()), this, SLOT(addSelector()));
@@ -76,6 +89,7 @@ DolphinSearchOptionsConfigurator::DolphinSearchOptionsConfigurator(QWidget* pare
hBoxLayout->addWidget(m_searchWhatBox);
hBoxLayout->addWidget(filler, 1);
hBoxLayout->addWidget(saveButton);
+ hBoxLayout->addWidget(closeButton);
hBoxLayout->addWidget(m_addSelectorButton);
m_vBoxLayout->addWidget(new KSeparator(this));
@@ -114,4 +128,30 @@ void DolphinSearchOptionsConfigurator::updateSelectorButton()
m_addSelectorButton->setEnabled(selectors < 10);
}
+void DolphinSearchOptionsConfigurator::saveQuery()
+{
+ KDialog dialog(0, Qt::Dialog);
+
+ QWidget* container = new QWidget(&dialog);
+
+ QLabel* label = new QLabel(i18nc("@label", "Name:"), container);
+ KLineEdit* lineEdit = new KLineEdit(container);
+ lineEdit->setMinimumWidth(250);
+
+ QHBoxLayout* layout = new QHBoxLayout(container);
+ layout->addWidget(label, Qt::AlignRight);
+ layout->addWidget(lineEdit);
+
+ dialog.setMainWidget(container);
+ dialog.setCaption(i18nc("@title:window", "Save Search Options"));
+ dialog.setButtons(KDialog::Ok | KDialog::Cancel);
+ dialog.setDefaultButton(KDialog::Ok);
+ dialog.setButtonText(KDialog::Ok, i18nc("@action:button", "Save"));
+
+ KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"),
+ "SaveSearchOptionsDialog");
+ dialog.restoreDialogSize(dialogConfig);
+ dialog.exec(); // TODO...
+}
+
#include "dolphinsearchoptionsconfigurator.moc"
diff --git a/src/search/dolphinsearchoptionsconfigurator.h b/src/search/dolphinsearchoptionsconfigurator.h
index 1fcb8cb19..b66ab340d 100644
--- a/src/search/dolphinsearchoptionsconfigurator.h
+++ b/src/search/dolphinsearchoptionsconfigurator.h
@@ -52,6 +52,11 @@ private slots:
*/
void updateSelectorButton();
+ /**
+ * Saves the current query by adding it as Places entry.
+ */
+ void saveQuery();
+
private:
KComboBox* m_searchFromBox;
KComboBox* m_searchWhatBox;