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);
}
}
+void DolphinUrlNavigator::clearText() const
+{
+ editor()->lineEdit()->clear();
+}
+
+void DolphinUrlNavigator::setPlaceholderText(const QString &text)
+{
+ editor()->lineEdit()->setPlaceholderText(text);
+}
+
void DolphinUrlNavigator::slotReturnPressed()
{
if (!GeneralSettings::editableUrl()) {
*/
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