aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-05-28 09:37:59 -0400
committerKen Moore <ken@pcbsd.org>2015-05-28 09:37:59 -0400
commitb5db5df70877212dba11d975e8afa6ebf7b3c9c4 (patch)
tree6b2841abc33bcdd68b2596e8a76bae192cf520cc /lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
parentTurn off the "uniformItemSizes" Qt flag in the File manager list widget. This... (diff)
downloadlumina-b5db5df70877212dba11d975e8afa6ebf7b3c9c4.tar.gz
lumina-b5db5df70877212dba11d975e8afa6ebf7b3c9c4.tar.bz2
lumina-b5db5df70877212dba11d975e8afa6ebf7b3c9c4.zip
Fix up the display of directories in the user button plugin.
Diffstat (limited to 'lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp')
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
index ad1c2fd6..4a274cdf 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
@@ -10,6 +10,8 @@
UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, bool goback) : QFrame(parent){
createWidget();
//Now fill it appropriately
+ bool inHome = type.endsWith("-home"); //internal code
+ if(inHome){ type = type.remove("-home"); }
if(itemPath.endsWith(".desktop") || type=="app"){
bool ok = false;
XDGDesktop item = LXDG::loadDesktopFile(itemPath, ok);
@@ -39,8 +41,10 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type,
if(LUtils::isFavorite(itemPath)){
linkPath = itemPath;
isShortcut=true;
- }else if( itemPath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){
+ }else if( inHome ){//|| itemPath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){
isShortcut = true;
+ }else{
+ isShortcut = false;
}
//Now setup the button appropriately
setupButton(goback);
@@ -95,20 +99,21 @@ void UserItemWidget::createWidget(){
}
void UserItemWidget::setupButton(bool disable){
+ if(isDirectory){ qDebug() << "Directory Entry:" << isShortcut << linkPath << icon->whatsThis(); }
+
if(disable){
button->setVisible(false);
- }else if( !isDirectory && isShortcut ){
- //This is a current desktop shortcut -- allow the user to remove it
- button->setWhatsThis("remove");
- if(!linkPath.isEmpty()){
+ }else if(isShortcut && !linkPath.isEmpty()){ //Favorite Item - can always remove this
+ button->setWhatsThis("remove");
button->setIcon( LXDG::findIcon("list-remove","") );
button->setToolTip(tr("Remove Shortcut"));
- }else{
+ connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
+ }else if(isShortcut && !isDirectory){ //Physical File - can remove
+ button->setWhatsThis("remove");
button->setIcon( LXDG::findIcon("user-trash","") );
button->setToolTip(tr("Delete File"));
- }
- connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
- }else if( !QFile::exists( QDir::homePath()+"/Desktop/"+icon->whatsThis().section("/",-1) ) && !LUtils::isFavorite(icon->whatsThis() ) ){
+ connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
+ }else if(!isShortcut){// if( !QFile::exists( QDir::homePath()+"/Desktop/"+icon->whatsThis().section("/",-1) ) && !LUtils::isFavorite(icon->whatsThis() ) ){
//This file does not have a shortcut yet -- allow the user to add it
button->setWhatsThis("add");
button->setIcon( LXDG::findIcon("bookmark-toolbar","") );
bgstack15