diff options
Diffstat (limited to 'lumina-desktop/panel-plugins/userbutton')
3 files changed, 7 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); diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h index 3a3e1616..2251344c 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h +++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h @@ -31,6 +31,7 @@ public: UserItemWidget(QWidget *parent=0, XDGDesktop item= XDGDesktop()); ~UserItemWidget(); + bool gooditem; private: QToolButton *button, *actButton; QLabel *icon, *name; diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp index 6848d12d..8873cce6 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp +++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp @@ -266,6 +266,7 @@ void UserWidget::updateFavItems(bool newfilter){ //qDebug() << " - Creating Items:" << favitems; for(int i=0; i<favitems.length(); i++){ UserItemWidget *it = new UserItemWidget(ui->scroll_fav->widget(), favitems[i].section("::::",2,50), favitems[i].section("::::",1,1) ); + if(!it->gooditem){ continue; } ui->scroll_fav->widget()->layout()->addWidget(it); connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); connect(it, SIGNAL(NewShortcut()), this, SLOT(updateFavItems()) ); |