diff options
| author | Peter Penz <[email protected]> | 2009-10-17 19:24:05 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2009-10-17 19:24:05 +0000 |
| commit | 884b5ad3a91fff896fb3d53e590fe26300b1c957 (patch) | |
| tree | 376fc718ef7c446569e5aacf94b56b4cae120898 /src/search | |
| parent | 002787543fd245291cb9a9ece7a0071e08498d3b (diff) | |
add A search options widget, which later on will include Adam Kidder's search prototype from playground
svn path=/trunk/KDE/kdebase/apps/; revision=1036776
Diffstat (limited to 'src/search')
| -rw-r--r-- | src/search/dolphinsearchbox.cpp | 8 | ||||
| -rw-r--r-- | src/search/dolphinsearchbox.h | 39 | ||||
| -rw-r--r-- | src/search/dolphinsearchoptionsconfigurator.cpp | 73 | ||||
| -rw-r--r-- | src/search/dolphinsearchoptionsconfigurator.h | 34 |
4 files changed, 131 insertions, 23 deletions
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index d224575ea..312bfb1cb 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -261,8 +261,8 @@ DolphinSearchBox::DolphinSearchBox(QWidget* parent) : m_searchInput->setClickMessage(i18nc("@label:textbox", "Search...")); m_searchInput->installEventFilter(this); hLayout->addWidget(m_searchInput); - connect(m_searchInput, SIGNAL(textEdited(const QString&)), - this, SLOT(slotTextEdited(const QString&))); + connect(m_searchInput, SIGNAL(textChanged(const QString&)), + this, SIGNAL(textChanged(const QString&))); connect(m_searchInput, SIGNAL(returnPressed()), this, SLOT(emitSearchSignal())); @@ -311,8 +311,4 @@ void DolphinSearchBox::emitSearchSignal() emit search(KUrl("nepomuksearch:/" + m_searchInput->text())); } -void DolphinSearchBox::slotTextEdited(const QString& text) -{ -} - #include "dolphinsearchbox.moc" diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h index 93c033bb8..2e4c6b85a 100644 --- a/src/search/dolphinsearchbox.h +++ b/src/search/dolphinsearchbox.h @@ -37,26 +37,27 @@ class QToolButton; class DolphinSearchCompleter : public QObject { Q_OBJECT - public: - DolphinSearchCompleter(KLineEdit *linedit); - public slots: - void highlighted(const QModelIndex& index); - void activated(const QModelIndex& index); - void slotTextEdited(const QString &text); +public: + DolphinSearchCompleter(KLineEdit *linedit); + +public slots: + void highlighted(const QModelIndex& index); + void activated(const QModelIndex& index); + void slotTextEdited(const QString &text); - private: - void addCompletionItem(const QString& displayed, const QString& usedForCompletition, const QString& description = QString(), const QString& toolTip = QString(), const KIcon& icon = KIcon()); +private: + void addCompletionItem(const QString& displayed, const QString& usedForCompletition, const QString& description = QString(), const QString& toolTip = QString(), const KIcon& icon = KIcon()); - void findText(int* wordStart, int* wordEnd, QString* newWord, int cursorPos, const QString &input); + void findText(int* wordStart, int* wordEnd, QString* newWord, int cursorPos, const QString &input); - private: - KLineEdit* q; - QCompleter* m_completer; - QStandardItemModel* m_completionModel; - QString m_userText; - int m_wordStart; - int m_wordEnd; +private: + KLineEdit* q; + QCompleter* m_completer; + QStandardItemModel* m_completionModel; + QString m_userText; + int m_wordStart; + int m_wordEnd; }; /** @@ -82,9 +83,13 @@ signals: */ void search(const KUrl& url); + /** + * Is emitted if the text of the searchbox has been changed. + */ + void textChanged(const QString& text); + private slots: void emitSearchSignal(); - void slotTextEdited(const QString& text); private: KLineEdit* m_searchInput; diff --git a/src/search/dolphinsearchoptionsconfigurator.cpp b/src/search/dolphinsearchoptionsconfigurator.cpp new file mode 100644 index 000000000..5e270d53f --- /dev/null +++ b/src/search/dolphinsearchoptionsconfigurator.cpp @@ -0,0 +1,73 @@ +/*************************************************************************** + * Copyright (C) 2009 by Peter Penz <[email protected]> * + * * + * 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. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "dolphinsearchoptionsconfigurator.h" + +#include <kcombobox.h> +#include <klocale.h> + +#include <QButtonGroup> +#include <QHBoxLayout> +#include <QLabel> +#include <QPushButton> +#include <QVBoxLayout> + +DolphinSearchOptionsConfigurator::DolphinSearchOptionsConfigurator(QWidget* parent) : + QWidget(parent) +{ + QVBoxLayout* vBoxLayout = new QVBoxLayout(this); + + // add "search" configuration + QLabel* searchLabel = new QLabel(i18nc("@label", "Search:")); + + KComboBox* searchFromBox = new KComboBox(); + searchFromBox->addItem(i18nc("label", "Everywhere")); + searchFromBox->addItem(i18nc("label", "From Here")); + + // add "what" configuration + QLabel* whatLabel = new QLabel(i18nc("@label", "What:")); + + KComboBox* searchWhatBox = new KComboBox(); + searchWhatBox->addItem(i18nc("label", "All")); + searchWhatBox->addItem(i18nc("label", "Images")); + searchWhatBox->addItem(i18nc("label", "Texts")); + searchWhatBox->addItem(i18nc("label", "File Names")); + + QWidget* filler = new QWidget(); + + // add button "Save" + QPushButton* saveButton = new QPushButton(); + saveButton->setText(i18nc("@action:button", "Save")); + + QHBoxLayout* hBoxLayout = new QHBoxLayout(this); + hBoxLayout->addWidget(searchLabel); + hBoxLayout->addWidget(searchFromBox); + hBoxLayout->addWidget(whatLabel); + hBoxLayout->addWidget(searchWhatBox); + hBoxLayout->addWidget(filler, 1); + hBoxLayout->addWidget(saveButton); + + vBoxLayout->addLayout(hBoxLayout); +} + +DolphinSearchOptionsConfigurator::~DolphinSearchOptionsConfigurator() +{ +} + +#include "dolphinsearchoptionsconfigurator.moc" diff --git a/src/search/dolphinsearchoptionsconfigurator.h b/src/search/dolphinsearchoptionsconfigurator.h new file mode 100644 index 000000000..9b5a70b03 --- /dev/null +++ b/src/search/dolphinsearchoptionsconfigurator.h @@ -0,0 +1,34 @@ +/*************************************************************************** + * Copyright (C) 2009 by Peter Penz <[email protected]> * + * * + * 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. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef DOLPHINSEARCHOPTIONSCONFIGURATOR_H +#define DOLPHINSEARCHOPTIONSCONFIGURATOR_H + +#include <QWidget> + +class DolphinSearchOptionsConfigurator : public QWidget +{ + Q_OBJECT + +public: + DolphinSearchOptionsConfigurator(QWidget* parent = 0); + virtual ~DolphinSearchOptionsConfigurator(); +}; + +#endif |
