From ea4124dc0452413c6ce323cfa339466a221e5bbb Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 28 May 2015 11:59:50 -0400 Subject: Add the ability to remove directories from the desktop via the user button as well. --- lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp index 1cceb5e2..fccb518f 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp +++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp @@ -112,7 +112,7 @@ void UserItemWidget::setupButton(bool disable){ button->setIcon( LXDG::findIcon("list-remove","") ); button->setToolTip(tr("Remove Shortcut")); connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) ); - }else if(isShortcut && !isDirectory){ //Physical File - can remove + }else if(isShortcut){ //Physical File/Dir - can remove button->setWhatsThis("remove"); button->setIcon( LXDG::findIcon("user-trash","") ); button->setToolTip(tr("Delete File")); @@ -139,8 +139,14 @@ void UserItemWidget::buttonClicked(){ //QFile::link(icon->whatsThis(), QDir::homePath()+"/.lumina/favorites/"+icon->whatsThis().section("/",-1) ); emit NewShortcut(); }else if(button->whatsThis()=="remove"){ - if(linkPath.isEmpty()){ QFile::remove(icon->whatsThis()); } //This is a desktop file - else{ LUtils::removeFavorite(icon->whatsThis()); } //This is a favorite + if(linkPath.isEmpty()){ + //This is a desktop file + if(isDirectory){ + QProcess::startDetached("rm -r \""+icon->whatsThis()+"\""); + }else{ + QFile::remove(icon->whatsThis()); + } + }else{ LUtils::removeFavorite(icon->whatsThis()); } //This is a favorite emit RemovedShortcut(); } } -- cgit