Commit b14f98de authored by Nate Graham's avatar Nate Graham 🔩 Committed by Elvis Angelaccio
Browse files

Make it more obvious that you can connect to servers on remote:/ page

Right now it is not super obvious how you connect to a remote server
in Dolphin when you already know the URL. Users will go to the
"Network" item in the Places panel, but from there it is not totally
clear. The "Add Network Folder" icon in the view opens a complicated
wizard and it's also a bit of an odd UX to have it living in the view as
opposed to being a toolbar button.

Old hands and developers know that the URL navigator is, well, a URL
navigator, and as such, it accepts arbitrary URLs from any view.
However this may not be obvious to other more casual users, for
two reasons:
1. The URL navigator is in breadcrumbs view nearly all of the time and
   by default, so may users may not know that it can accept text at all
2. Even when it's displaying URLs, they are almost always local paths,
   so users may not make the connection that it can accept remote URLs
   rather that just local paths

To improve the discoverability of this fea...
parent 88d3f92d
Pipeline #45482 passed with stage
in 7 minutes and 2 seconds
......@@ -212,11 +212,24 @@ QWidget *DolphinNavigatorsWidgetAction::createNavigatorWidget(Side side) const
auto emptyTrashButton = newEmptyTrashButton(urlNavigator, navigatorWidget);
layout->addWidget(emptyTrashButton);
connect(urlNavigator, &KUrlNavigator::urlChanged, this, [this]() {
connect(urlNavigator, &KUrlNavigator::urlChanged, this, [urlNavigator, this]() {
// Update URL navigator to show a server URL entry placeholder text if we
// just loaded the remote:/ page, to make it easier for users to figure out
// that they can enter arbitrary remote URLs. See bug 414670
if (urlNavigator->locationUrl().scheme() == QLatin1String("remote")) {
if (!urlNavigator->isUrlEditable()) {
urlNavigator->setUrlEditable(true);
}
urlNavigator->clearText();
urlNavigator->setPlaceholderText(i18n("Enter server URL (e.g. smb://[ip address])"));
} else {
urlNavigator->setPlaceholderText(QString());
}
// We have to wait for DolphinUrlNavigator::sizeHint() to update which
// happens a little bit later than when urlChanged is emitted.
this->m_adjustSpacingTimer->start();
});
}, Qt::QueuedConnection);
auto trailingSpacing = new QWidget{navigatorWidget};
layout->addWidget(trailingSpacing);
......
......@@ -101,6 +101,16 @@ void DolphinUrlNavigator::setVisualState(const VisualState& visualState)
}
}
void DolphinUrlNavigator::clearText() const
{
editor()->lineEdit()->clear();
}
void DolphinUrlNavigator::setPlaceholderText(const QString &text)
{
editor()->lineEdit()->setPlaceholderText(text);
}
void DolphinUrlNavigator::slotReturnPressed()
{
if (!GeneralSettings::editableUrl()) {
......
......@@ -66,6 +66,16 @@ public:
*/
void setVisualState(const VisualState &visualState);
/**
* Clears the text in the text field
*/
void clearText() const;
/**
* Displays placeholder text in the URL navigator
*/
void setPlaceholderText(const QString &text);
public slots:
/**
* Switches to "breadcrumb" mode if the editable mode is not set to be
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment