┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-11-24 16:03:10 +0000
committerPeter Penz <[email protected]>2010-11-24 16:03:10 +0000
commitcbbadab33a25c9748eb61710fd161b1eb4bfb3c1 (patch)
tree162f78155b33fde4e4311be7cd337b6243bc4b07
parent32764c9696bcdbaf8136e47376ec6fe7a1c8ce05 (diff)
Assure that the "From Here (...)" button contains always a useful content also for non-local URLs
svn path=/trunk/KDE/kdebase/apps/; revision=1200307
-rw-r--r--src/search/dolphinsearchbox.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp
index 7c2d15264..b265ea99a 100644
--- a/src/search/dolphinsearchbox.cpp
+++ b/src/search/dolphinsearchbox.cpp
@@ -82,8 +82,18 @@ void DolphinSearchBox::setSearchPath(const KUrl& url)
QFontMetrics metrics(m_fromHereButton->font());
const int maxWidth = metrics.averageCharWidth() * 15;
- const QString fileName = metrics.elidedText(url.fileName(), Qt::ElideMiddle, maxWidth);
- m_fromHereButton->setText(i18nc("action:button", "From Here (%1)", fileName));
+
+ QString location = url.fileName();
+ if (location.isEmpty()) {
+ if (url.isLocalFile()) {
+ location = QLatin1String("/");
+ } else {
+ location = url.protocol() + QLatin1String(" - ") + url.host();
+ }
+ }
+
+ const QString elidedLocation = metrics.elidedText(location, Qt::ElideMiddle, maxWidth);
+ m_fromHereButton->setText(i18nc("action:button", "From Here (%1)", elidedLocation));
}
KUrl DolphinSearchBox::searchPath() const