summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <[email protected]>2017-01-03 09:56:25 +0100
committerKai Uwe Broulik <[email protected]>2017-01-03 09:56:25 +0100
commit53c4f98a33911a55204df9f3afbc8be13b80ffb2 (patch)
tree94aa5f6185b63aa6bdbc9f2d98cdc0cdb1e3661d
parentbc46f163234f7a3882469c54bdd5d682937e5f78 (diff)
[Icon Applet] Fully re-populate when user changes Link URL
When applying KPropertiesDialog of a Link desktop file, the URL might have changed. In this case nuke the local file and start afresh. Differential Revision: https://phabricator.kde.org/D3906
-rw-r--r--applets/icon/iconapplet.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/applets/icon/iconapplet.cpp b/applets/icon/iconapplet.cpp
index efc7312..81ef466 100644
--- a/applets/icon/iconapplet.cpp
+++ b/applets/icon/iconapplet.cpp
@@ -362,7 +362,14 @@ void IconApplet::configure()
m_configDialog = dialog;
connect(dialog, &KPropertiesDialog::applied, this, [this] {
- populate();
+ KDesktopFile desktopFile(m_localPath);
+ if (desktopFile.hasLinkType()) {
+ // make sure to fully repopulate in case the user changed the Link URL
+ QFile::remove(m_localPath);
+ setUrl(QUrl(desktopFile.readUrl())); // calls populate() itself
+ } else {
+ populate();
+ }
});
dialog->setAttribute(Qt::WA_DeleteOnClose, true);