From 6351e4832587a76bb5ecf4570f9f7ac8d7a0e4c2 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 20 Aug 2015 07:55:45 -0400 Subject: Clean up a couple new bugs in the userbutton: 1) Fix which icons are loaded for files (mimetypes) 2) If an application shortcut is invalid (the app was removed but the shortcut remains), don't show it on the favorites tab --- lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp') diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp index ffee7b69..1d32440a 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp +++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp @@ -17,14 +17,13 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, if(itemPath.endsWith(".desktop") || type=="app"){ bool ok = false; XDGDesktop item = LXDG::loadDesktopFile(itemPath, ok); - if(ok){ + if(ok && LXDG::checkValidity(item) ){ icon->setPixmap( LXDG::findIcon(item.icon, "preferences-system-windows-actions").pixmap(32,32) ); name->setText( this->fontMetrics().elidedText(item.name, Qt::ElideRight, TEXTCUTOFF) ); setupActions(item); }else{ - icon->setPixmap( LXDG::findIcon("unknown","").pixmap(32,32) ); - name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); - actButton->setVisible(false); + gooditem = false; + return; } }else if(type=="dir"){ actButton->setVisible(false); @@ -45,7 +44,7 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, }else if(LUtils::imageExtensions().contains(itemPath.section("/",-1).section(".",-1).toLower()) ){ icon->setPixmap( QIcon(itemPath).pixmap(32,32) ); }else{ - icon->setPixmap( LXDG::findMimeIcon(type).pixmap(32,32) ); + icon->setPixmap( LXDG::findMimeIcon(itemPath.section("/",-1)).pixmap(32,32) ); } name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); } @@ -94,6 +93,7 @@ UserItemWidget::~UserItemWidget(){ void UserItemWidget::createWidget(){ //Initialize the widgets + gooditem = true; menuopen = false; menureset = new QTimer(this); menureset->setSingleShot(true); -- cgit