aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-08-20 07:55:45 -0400
committerKen Moore <moorekou@gmail.com>2015-08-20 07:55:45 -0400
commit6351e4832587a76bb5ecf4570f9f7ac8d7a0e4c2 (patch)
tree788cff046bf6a974bcf616bb3228450d2f2b83aa
parentAdd a function to convert a number of bytes into a display string (3 digits) (diff)
downloadlumina-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
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp10
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserItemWidget.h1
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.cpp1
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()) );
bgstack15