diff --git a/src/filewidgets/kfileplaceeditdialog.h b/src/filewidgets/kfileplaceeditdialog.h
--- a/src/filewidgets/kfileplaceeditdialog.h
+++ b/src/filewidgets/kfileplaceeditdialog.h
@@ -114,6 +114,12 @@
* @returns the configured icon
*/
const QString &icon() const;
+
+ /**
+ * @returns whether the item's icon is editable
+ * @since 5.49
+ */
+ bool isIconEditable() const;
/**
* @returns whether the item should be local to the application or global.
diff --git a/src/filewidgets/kfileplaceeditdialog.cpp b/src/filewidgets/kfileplaceeditdialog.cpp
--- a/src/filewidgets/kfileplaceeditdialog.cpp
+++ b/src/filewidgets/kfileplaceeditdialog.cpp
@@ -62,7 +62,9 @@
// set the return parameters
url = dialog->url();
label = dialog->label();
- icon = dialog->icon();
+ if (dialog->m_iconButton) {
+ icon = dialog->icon();
+ }
appLocal = dialog->applicationLocal();
delete dialog;
@@ -79,7 +81,7 @@
bool isAddingNewPlace,
bool appLocal, int iconSize,
QWidget *parent)
- : QDialog(parent)
+ : QDialog(parent), m_iconButton(nullptr)
{
if (isAddingNewPlace) {
setWindowTitle(i18n("Add Places Entry"));
@@ -117,21 +119,22 @@
// Room for at least 40 chars (average char width is half of height)
m_urlEdit->setMinimumWidth(m_urlEdit->fontMetrics().height() * (40 / 2));
- whatsThisText = i18n("This is the icon that will appear in the Places panel.
"
- "Click on the button to select a different icon.");
- m_iconButton = new KIconButton(this);
- layout->addRow(i18n("Choose an &icon:"), m_iconButton);
- m_iconButton->setObjectName(QStringLiteral("icon button"));
- m_iconButton->setIconSize(iconSize);
- m_iconButton->setIconType(KIconLoader::NoGroup, KIconLoader::Place);
- if (icon.isEmpty()) {
- m_iconButton->setIcon(KIO::iconNameForUrl(url));
- } else {
- m_iconButton->setIcon(icon);
+ if (url.scheme() != QLatin1String("trash")) {
+ whatsThisText = i18n("This is the icon that will appear in the Places panel.
"
+ "Click on the button to select a different icon.");
+ m_iconButton = new KIconButton(this);
+ layout->addRow(i18n("Choose an &icon:"), m_iconButton);
+ m_iconButton->setObjectName(QStringLiteral("icon button"));
+ m_iconButton->setIconSize(iconSize);
+ m_iconButton->setIconType(KIconLoader::NoGroup, KIconLoader::Place);
+ if (icon.isEmpty()) {
+ m_iconButton->setIcon(KIO::iconNameForUrl(url));
+ } else {
+ m_iconButton->setIcon(icon);
+ }
+ m_iconButton->setWhatsThis(whatsThisText);
+ layout->labelForField(m_iconButton)->setWhatsThis(whatsThisText);
}
- m_iconButton->setWhatsThis(whatsThisText);
- layout->labelForField(m_iconButton)->setWhatsThis(whatsThisText);
-
if (allowGlobal) {
QString appName;
appName = QGuiApplication::applicationDisplayName();