┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/search
diff options
context:
space:
mode:
authorarnav dhamija <[email protected]>2017-02-13 22:23:41 +0530
committerarnav dhamija <[email protected]>2017-02-13 22:23:41 +0530
commit41253c0c81bafb54a0b6c82e5282e3add85e8a50 (patch)
tree9a5ccfbade73ee481884ac53aa7e2fe724f25272 /src/search
parent67099640b90588af1c72c340756253400da3e95b (diff)
parent7fce8f0e9b1e0bb2deb6e32fe88d5411b9be2834 (diff)
Merge branch 'master' of git.kde.org:dolphin
Diffstat (limited to 'src/search')
-rw-r--r--src/search/dolphinsearchbox.cpp26
-rw-r--r--src/search/dolphinsearchbox.h3
2 files changed, 28 insertions, 1 deletions
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp
index 26ddd27f8..5d5906b78 100644
--- a/src/search/dolphinsearchbox.cpp
+++ b/src/search/dolphinsearchbox.cpp
@@ -26,6 +26,7 @@
#include <QLineEdit>
#include <KLocalizedString>
#include <KSeparator>
+#include <KNS3/KMoreToolsMenuFactory>
#include <QButtonGroup>
#include <QDir>
@@ -206,6 +207,13 @@ void DolphinSearchBox::showEvent(QShowEvent* event)
}
}
+void DolphinSearchBox::hideEvent(QHideEvent* event)
+{
+ Q_UNUSED(event);
+ m_startedSearching = false;
+ m_startSearchTimer->stop();
+}
+
void DolphinSearchBox::keyReleaseEvent(QKeyEvent* event)
{
QWidget::keyReleaseEvent(event);
@@ -378,6 +386,20 @@ void DolphinSearchBox::init()
searchLocationGroup->addButton(m_fromHereButton);
searchLocationGroup->addButton(m_everywhereButton);
+ auto moreSearchToolsButton = new QToolButton(this);
+ moreSearchToolsButton->setAutoRaise(true);
+ moreSearchToolsButton->setPopupMode(QToolButton::InstantPopup);
+ moreSearchToolsButton->setIcon(QIcon::fromTheme("arrow-down-double"));
+ moreSearchToolsButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ moreSearchToolsButton->setText(i18n("More Search Tools"));
+ moreSearchToolsButton->setMenu(new QMenu(this));
+ connect(moreSearchToolsButton->menu(), &QMenu::aboutToShow, moreSearchToolsButton->menu(), [this, moreSearchToolsButton]()
+ {
+ m_menuFactory.reset(new KMoreToolsMenuFactory("dolphin/search-tools"));
+ moreSearchToolsButton->menu()->clear();
+ m_menuFactory->fillMenuFromGroupingNames(moreSearchToolsButton->menu(), { "files-find" }, this->m_searchPath);
+ } );
+
// Create "Facets" widgets
m_facetsToggleButton = new QToolButton(this);
m_facetsToggleButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
@@ -397,8 +419,10 @@ void DolphinSearchBox::init()
optionsLayout->addWidget(m_separator);
optionsLayout->addWidget(m_fromHereButton);
optionsLayout->addWidget(m_everywhereButton);
- optionsLayout->addStretch(1);
+ optionsLayout->addWidget(new KSeparator(Qt::Vertical, this));
optionsLayout->addWidget(m_facetsToggleButton);
+ optionsLayout->addWidget(moreSearchToolsButton);
+ optionsLayout->addStretch(1);
// Put the options into a QScrollArea. This prevents increasing the view width
// in case that not enough width for the options is available.
diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h
index a80617476..5063c2bf5 100644
--- a/src/search/dolphinsearchbox.h
+++ b/src/search/dolphinsearchbox.h
@@ -30,6 +30,7 @@ class QToolButton;
class QScrollArea;
class QLabel;
class QVBoxLayout;
+class KMoreToolsMenuFactory;
/**
* @brief Input box for searching files with or without Baloo.
@@ -100,6 +101,7 @@ public:
protected:
virtual bool event(QEvent* event) Q_DECL_OVERRIDE;
virtual void showEvent(QShowEvent* event) Q_DECL_OVERRIDE;
+ virtual void hideEvent(QHideEvent* event) Q_DECL_OVERRIDE;
virtual void keyReleaseEvent(QKeyEvent* event) Q_DECL_OVERRIDE;
virtual bool eventFilter(QObject* obj, QEvent* event) Q_DECL_OVERRIDE;
@@ -175,6 +177,7 @@ private:
DolphinFacetsWidget* m_facetsWidget;
QUrl m_searchPath;
+ QScopedPointer<KMoreToolsMenuFactory> m_menuFactory;
QTimer* m_startSearchTimer;
};