diff options
author | Ken Moore <moorekou@gmail.com> | 2016-02-04 13:10:28 -0500 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-02-04 13:10:28 -0500 |
commit | df9bf6b64ba0246203bf52a53ab1eb9338f18f44 (patch) | |
tree | d38a28e907a2d67504c846a425c221c639f0c778 /lumina-desktop/LDesktopPluginSpace.h | |
parent | Quick patch to skip the desktop removal routine if the number of available X ... (diff) | |
download | lumina-df9bf6b64ba0246203bf52a53ab1eb9338f18f44.tar.gz lumina-df9bf6b64ba0246203bf52a53ab1eb9338f18f44.tar.bz2 lumina-df9bf6b64ba0246203bf52a53ab1eb9338f18f44.zip |
Cleanup how the ~/Desktop/* shortcuts are removed a bit. Now it catches these special files and only runs the QFile::remove() function on it (just like deleteing the file from teh CLI), and the plugin itself is removed by the update routine later on after the filesystem watcher sees the change.
Diffstat (limited to 'lumina-desktop/LDesktopPluginSpace.h')
-rw-r--r-- | lumina-desktop/LDesktopPluginSpace.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lumina-desktop/LDesktopPluginSpace.h b/lumina-desktop/LDesktopPluginSpace.h index 51d594f8..5ef51930 100644 --- a/lumina-desktop/LDesktopPluginSpace.h +++ b/lumina-desktop/LDesktopPluginSpace.h @@ -16,6 +16,8 @@ #include <QDebug> #include <QFile> #include <QDir> +#include <QFileInfo> +#include <QProcess> #include "desktop-plugins/LDPlugin.h" @@ -158,14 +160,26 @@ private slots: setupDrag(ID, "resize"); } void RemoveItem(QString ID){ + //Special case - desktop file/dir link using the "applauncher" plugin + if(ID.startsWith("applauncher::")){ + QFileInfo info(ID.section("---",0,0).section("::",1,50) ); + if(info.exists() && info.absolutePath()==QDir::homePath()+"/Desktop"){ + qDebug() << "Deleting Desktop Item:" << info.absoluteFilePath(); + if(!info.isSymLink() && info.isDir()){ QProcess::startDetached("rm -r \""+info.absoluteFilePath()+"\""); } + else{ QFile::remove(info.absoluteFilePath()); } //just remove the file/symlink directly + emit PluginRemovedByUser(ID); + return; + } + } + //Any other type of plugin for(int i=0; i<ITEMS.length(); i++){ if(ITEMS[i]->whatsThis()==ID){ ITEMS[i]->Cleanup(); delete ITEMS.takeAt(i); - emit PluginRemovedByUser(ID); - return; + break; } } + emit PluginRemovedByUser(ID); } protected: |