mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +00:00
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 feature, this commit makes the following change: When the view is displaying the remote:/ ioslave (i.e. the "Networks" place), the URL navigator is put into URL entry mode and given some placeholder text that hints at what it can do. It reverts to breadcrumbs mode when you leave. BUG: 414670 FIXED-IN: 21.04
This commit is contained in:
parent
88d3f92dff
commit
b14f98de19
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue