┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-11-25 15:42:15 +0000
committerPeter Penz <[email protected]>2010-11-25 15:42:15 +0000
commitd63a5c26e20fe62eeeb2202ad9703470f2e096e7 (patch)
tree4683bc23b8c62fbffc0895ac9e4160d046cc7307 /src
parentcbbadab33a25c9748eb61710fd161b1eb4bfb3c1 (diff)
Don't offer the "Search everywhere" option for non-local URLs.
svn path=/trunk/KDE/kdebase/apps/; revision=1200741
Diffstat (limited to 'src')
-rw-r--r--src/search/dolphinsearchbox.cpp44
-rw-r--r--src/search/dolphinsearchbox.h6
2 files changed, 30 insertions, 20 deletions
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp
index b265ea99a..71c227501 100644
--- a/src/search/dolphinsearchbox.cpp
+++ b/src/search/dolphinsearchbox.cpp
@@ -57,10 +57,11 @@ DolphinSearchBox::DolphinSearchBox(QWidget* parent) :
m_nepomukActivated(false),
m_topLayout(0),
m_searchInput(0),
- m_fromHereButton(0),
- m_everywhereButton(0),
m_fileNameButton(0),
m_contentButton(0),
+ m_separator(0),
+ m_fromHereButton(0),
+ m_everywhereButton(0),
m_searchPath(),
m_startSearchTimer(0)
{
@@ -94,6 +95,11 @@ void DolphinSearchBox::setSearchPath(const KUrl& url)
const QString elidedLocation = metrics.elidedText(location, Qt::ElideMiddle, maxWidth);
m_fromHereButton->setText(i18nc("action:button", "From Here (%1)", elidedLocation));
+
+ const bool showSearchFromButtons = url.isLocalFile();
+ m_separator->setVisible(showSearchFromButtons);
+ m_fromHereButton->setVisible(showSearchFromButtons);
+ m_everywhereButton->setVisible(showSearchFromButtons);
}
KUrl DolphinSearchBox::searchPath() const
@@ -249,19 +255,6 @@ void DolphinSearchBox::init()
searchInputLayout->addWidget(searchLabel);
searchInputLayout->addWidget(m_searchInput);
- // Create "From Here" and "Everywhere"button
- m_fromHereButton = new QPushButton(this);
- m_fromHereButton->setText(i18nc("action:button", "From Here"));
- initButton(m_fromHereButton);
-
- m_everywhereButton = new QPushButton(this);
- m_everywhereButton->setText(i18nc("action:button", "Everywhere"));
- initButton(m_everywhereButton);
-
- QButtonGroup* searchLocationGroup = new QButtonGroup(this);
- searchLocationGroup->addButton(m_fromHereButton);
- searchLocationGroup->addButton(m_everywhereButton);
-
// Create "Filename" and "Content" button
m_fileNameButton = new QPushButton(this);
m_fileNameButton->setText(i18nc("action:button", "Filename"));
@@ -275,14 +268,29 @@ void DolphinSearchBox::init()
searchWhatGroup->addButton(m_fileNameButton);
searchWhatGroup->addButton(m_contentButton);
+ m_separator = new KSeparator(Qt::Vertical, this);
+
+ // Create "From Here" and "Everywhere"button
+ m_fromHereButton = new QPushButton(this);
+ m_fromHereButton->setText(i18nc("action:button", "From Here"));
+ initButton(m_fromHereButton);
+
+ m_everywhereButton = new QPushButton(this);
+ m_everywhereButton->setText(i18nc("action:button", "Everywhere"));
+ initButton(m_everywhereButton);
+
+ QButtonGroup* searchLocationGroup = new QButtonGroup(this);
+ searchLocationGroup->addButton(m_fromHereButton);
+ searchLocationGroup->addButton(m_everywhereButton);
+
// Apply layout for the options
QHBoxLayout* optionsLayout = new QHBoxLayout();
optionsLayout->setMargin(0);
- optionsLayout->addWidget(m_fromHereButton);
- optionsLayout->addWidget(m_everywhereButton);
- optionsLayout->addWidget(new KSeparator(Qt::Vertical));
optionsLayout->addWidget(m_fileNameButton);
optionsLayout->addWidget(m_contentButton);
+ optionsLayout->addWidget(m_separator);
+ optionsLayout->addWidget(m_fromHereButton);
+ optionsLayout->addWidget(m_everywhereButton);
optionsLayout->addStretch(1);
m_topLayout = new QVBoxLayout(this);
diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h
index 18883b512..cbe164502 100644
--- a/src/search/dolphinsearchbox.h
+++ b/src/search/dolphinsearchbox.h
@@ -26,6 +26,7 @@
class AbstractSearchFilterWidget;
class KLineEdit;
+class KSeparator;
class QFormLayout;
class QPushButton;
class QVBoxLayout;
@@ -119,10 +120,11 @@ private:
QVBoxLayout* m_topLayout;
KLineEdit* m_searchInput;
- QPushButton* m_fromHereButton;
- QPushButton* m_everywhereButton;
QPushButton* m_fileNameButton;
QPushButton* m_contentButton;
+ KSeparator* m_separator;
+ QPushButton* m_fromHereButton;
+ QPushButton* m_everywhereButton;
KUrl m_searchPath;