From df9bf6b64ba0246203bf52a53ab1eb9338f18f44 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 4 Feb 2016 13:10:28 -0500 Subject: 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. --- lumina-desktop/LDesktop.cpp | 4 ++-- lumina-desktop/LDesktopPluginSpace.h | 18 ++++++++++++++++-- lumina-desktop/LSession.cpp | 15 +-------------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index 4da38e78..b7259e86 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -362,7 +362,7 @@ void LDesktop::RemoveDeskPlugin(QString ID){ settings->setValue(DPREFIX+"pluginlist", plugs); settings->sync(); QTimer::singleShot(200, this, SLOT(UnlockSettings()) ); - }else if(ID.startsWith("applauncher::") ){ + }/*else if(ID.startsWith("applauncher::") ){ //This was a temporary plugin (desktop file?) check for existance/dir and remove it as necessary QString path = ID.section("---",0,0).section("::",1,50); //full file path QFileInfo info(path); @@ -373,7 +373,7 @@ void LDesktop::RemoveDeskPlugin(QString ID){ if(!info.isSymLink() && info.isDir()){ QProcess::startDetached("rm -r \""+path+"\""); } else{ QFile::remove(path); } //just remove the file/symlink directly } - } + }*/ } void LDesktop::IncreaseDesktopPluginIcons(){ 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 #include #include +#include +#include #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; iwhatsThis()==ID){ ITEMS[i]->Cleanup(); delete ITEMS.takeAt(i); - emit PluginRemovedByUser(ID); - return; + break; } } + emit PluginRemovedByUser(ID); } protected: diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index 7885b9b9..b33f19ee 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -157,7 +157,7 @@ void LSession::setupSession(){ watcher->addPath( QDir::homePath()+"/.lumina/LuminaDE/desktopsettings.conf" ); watcher->addPath( QDir::homePath()+"/.lumina/fluxbox-init" ); watcher->addPath( QDir::homePath()+"/.lumina/fluxbox-keys" ); - watcher->addPath( QDir::homePath() ); + watcher->addPath( QDir::homePath()+"/Desktop" ); //connect internal signals/slots connect(this->desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(screensChanged()) ); @@ -276,19 +276,6 @@ void LSession::launchStartupApps(){ qDebug() << " - - Screen Brightness:" << QString::number(tmp)+"%"; } QProcess::startDetached("nice lumina-open -autostart-apps"); - //Now get any XDG startup applications and launch them - /*QList xdgapps = LXDG::findAutoStartFiles(); - for(int i=0; ishowScreen("app::"+xdgapps[i].name); - if(xdgapps[i].startupNotify){ - LSession::LaunchApplication("nice lumina-open \""+xdgapps[i].filePath+"\""); - }else{ - //Don't update the mouse cursor - QProcess::startDetached("nice lumina-open \""+xdgapps[i].filePath+"\""); - } - LSession::processEvents(); - }*/ //Re-load the screen brightness and volume settings from the previous session // Wait until after the XDG-autostart functions, since the audio system might be started that way -- cgit