diff options
Diffstat (limited to 'lumina-desktop/desktop-plugins')
3 files changed, 20 insertions, 2 deletions
diff --git a/lumina-desktop/desktop-plugins/LDPlugin.h b/lumina-desktop/desktop-plugins/LDPlugin.h index d49fa40a..a77674ee 100644 --- a/lumina-desktop/desktop-plugins/LDPlugin.h +++ b/lumina-desktop/desktop-plugins/LDPlugin.h @@ -53,9 +53,18 @@ public: return settings->value(prefix+var, defaultval); } - void removeSettings(){ //such as when a plugin is deleted + virtual void Cleanup(){ + //This needs to be re-implemented in the subclassed plugin + //This is where any last-minute changes are performed before a plugin is removed permanently + //Note1: This is *not* called if the plugin is being temporarily closed + //Note2: All the settings for this plugin will be automatically removed after this is finished + } + + void removeSettings(bool permanent = false){ //such as when a plugin is deleted + if(permanent){ Cleanup(); } QStringList list = settings->allKeys().filter(prefix); for(int i=0; i<list.length(); i++){ settings->remove(list[i]); } + } /*virtual void scalePlugin(double xscale, double yscale){ diff --git a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp index ea42f151..ae454511 100644 --- a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp +++ b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp @@ -33,6 +33,13 @@ AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(par QTimer::singleShot(100,this, SLOT(loadButton()) ); } +void AppLauncherPlugin::Cleanup(){ + //This is run only when the plugin was forcibly closed/removed + if(QFile::exists(button->whatsThis()) && button->whatsThis().startsWith(QDir::homePath()+"/Desktop") ){ + deleteFile(); + } +} + void AppLauncherPlugin::loadButton(bool onchange){ QString def = this->ID().section("::",1,50).section("---",0,0).simplified(); QString path = this->readSetting("applicationpath",def).toString(); //use the default if necessary diff --git a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h index 9eefebf1..796d8f04 100644 --- a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h +++ b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h @@ -28,7 +28,9 @@ class AppLauncherPlugin : public LDPlugin{ public: AppLauncherPlugin(QWidget* parent, QString ID); ~AppLauncherPlugin(){} - + + void Cleanup(); //special function for final cleanup + private: QToolButton *button; QFileSystemWatcher *watcher; |