diff options
author | Ken Moore <moorekou@gmail.com> | 2015-08-20 07:55:45 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-08-20 07:55:45 -0400 |
commit | 6351e4832587a76bb5ecf4570f9f7ac8d7a0e4c2 (patch) | |
tree | 788cff046bf6a974bcf616bb3228450d2f2b83aa /lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp | |
parent | Add a function to convert a number of bytes into a display string (3 digits) (diff) | |
download | lumina-6351e4832587a76bb5ecf4570f9f7ac8d7a0e4c2.tar.gz lumina-6351e4832587a76bb5ecf4570f9f7ac8d7a0e4c2.tar.bz2 lumina-6351e4832587a76bb5ecf4570f9f7ac8d7a0e4c2.zip |
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
Diffstat (limited to 'lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp')
-rw-r--r-- | lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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); |