[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kfile
From: Peter Penz <peter.penz () gmx ! at>
Date: 2010-05-11 18:42:23
Message-ID: 20100511184223.128C9AC8B2 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1125564 by ppenz:
Show the available protocols, if the path box gets cleared (based on the patch of \
http://reviewboard.kde.org/r/3861 by Todd).
CCMAIL: toddrme2178@gmail.com
M +25 -11 kurlnavigator.cpp
M +1 -0 kurlnavigator.h
--- trunk/KDE/kdelibs/kfile/kurlnavigator.cpp #1125563:1125564
@@ -99,6 +99,8 @@
void openContextMenu();
+ void slotPathBoxChanged(const QString& text);
+
void updateContent();
/**
@@ -247,6 +249,8 @@
q, SLOT(slotReturnPressed()));
connect(m_pathBox, SIGNAL(urlActivated(KUrl)),
q, SLOT(setUrl(KUrl)));
+ connect(m_pathBox, SIGNAL(editTextChanged(QString)),
+ q, SLOT(slotPathBoxChanged(QString)));
// create toggle button which allows to switch between
// the breadcrumb and traditional view
@@ -349,15 +353,19 @@
KUrl url;
url.setScheme(protocol);
url.setPath("/");
+
+ if (m_editable) {
+ m_pathBox->setEditUrl(url);
+ } else if (KProtocolInfo::protocolClass(protocol) == QLatin1String(":local")) {
+ // No host is required, the URL can be applied immediately
+ q->setLocationUrl(url);
+ } else {
foreach (KUrlNavigatorButton* button, m_navButtons) {
button->hide();
button->deleteLater();
}
m_navButtons.clear();
- if (KProtocolInfo::protocolClass(protocol) == QLatin1String(":local")) {
- q->setLocationUrl(url);
- } else {
m_host->setText(QString());
m_host->show();
m_host->setFocus();
@@ -503,6 +511,11 @@
}
}
+void KUrlNavigator::Private::slotPathBoxChanged(const QString& text)
+{
+ m_protocols->setVisible(text.isEmpty());
+}
+
void KUrlNavigator::Private::updateContent()
{
const KUrl currentUrl = q->locationUrl();
@@ -561,17 +574,16 @@
// check whether the protocol-combo and the host-editor should be shown
const bool hasPlaceItem = currentUrl.isLocalFile() || placeUrl.isValid();
- const bool isVisible = !hasPlaceItem &&
- (placePath == path) &&
- (KProtocolInfo::protocolClass(protocol) != ":local");
+ const bool showProtocols = !hasPlaceItem &&
+ (KProtocolInfo::protocolClass(protocol) != \
QLatin1String(":local")); + const bool showHost = showProtocols && (placePath \
== path); + m_protocols->setVisible(showProtocols);
+ m_host->setVisible(showHost);
- m_host->setVisible(isVisible);
- m_protocols->setVisible(isVisible);
-
// calculate the start index for the directories that should be shown as \
buttons // and create the buttons
int startIndex = placePath.count('/');
- if (isVisible) {
+ if (showHost) {
// the host is shown by the line editor m_host and no button should be \
created ++startIndex;
} else if (!hasPlaceItem && hostText.isEmpty()) {
@@ -750,7 +762,9 @@
} else {
// Check whether going upwards is possible. If this is the case, show the \
drop-down button. const KUrl url = m_navButtons.front()->url();
- const bool visible = (url != url.upUrl()) && (url.protocol() != \
"nepomuksearch"); + const bool visible = (url != url.upUrl()) &&
+ (url.protocol() != "nepomuksearch") &&
+ !m_protocols->isVisible();
m_dropDownButton->setVisible(visible);
}
}
--- trunk/KDE/kdelibs/kfile/kurlnavigator.h #1125563:1125564
@@ -451,6 +451,7 @@
Q_PRIVATE_SLOT(d, void openPathSelectorMenu())
Q_PRIVATE_SLOT(d, void updateButtonVisibility())
Q_PRIVATE_SLOT(d, void switchToBreadcrumbMode())
+ Q_PRIVATE_SLOT(d, void slotPathBoxChanged(const QString& text))
Q_PRIVATE_SLOT(d, void updateContent())
private:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic