diff options
author | Weblate <noreply@weblate.org> | 2016-09-23 08:47:32 +0000 |
---|---|---|
committer | Weblate <noreply@weblate.org> | 2016-09-23 08:47:32 +0000 |
commit | 3b6320ffa0a3fd3e4385df2faa7ac4a5c5d6df0b (patch) | |
tree | 05aac860fdec6f1af2332bbf128a2bac7f27f02b /src-qt5/core/lumina-desktop/panel-plugins/userbutton | |
parent | Translated using Weblate (l_TERMINAL@sv (generated)) (diff) | |
parent | Translated using Weblate (lumina_WM@lt (generated)) (diff) | |
download | lumina-3b6320ffa0a3fd3e4385df2faa7ac4a5c5d6df0b.tar.gz lumina-3b6320ffa0a3fd3e4385df2faa7ac4a5c5d6df0b.tar.bz2 lumina-3b6320ffa0a3fd3e4385df2faa7ac4a5c5d6df0b.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src-qt5/core/lumina-desktop/panel-plugins/userbutton')
4 files changed, 26 insertions, 26 deletions
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp index 1d32440a..a1dfe956 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp @@ -15,12 +15,11 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, 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); - if(ok && LXDG::checkValidity(item) ){ + XDGDesktop item(itemPath); + if( item.isValid() ){ 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); + setupActions(&item); }else{ gooditem = false; return; @@ -63,22 +62,23 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, setupButton(goback); } -UserItemWidget::UserItemWidget(QWidget *parent, XDGDesktop item) : QFrame(parent){ +UserItemWidget::UserItemWidget(QWidget *parent, XDGDesktop *item) : QFrame(parent){ + if(item==0){ return; } createWidget(); isDirectory = false; - if(LUtils::isFavorite(item.filePath)){ - linkPath = item.filePath; + if(LUtils::isFavorite(item->filePath)){ + linkPath = item->filePath; isShortcut=true; - }else if( item.filePath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){ + }else if( item->filePath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){ isShortcut = true; }else{ isShortcut = false; } //Now fill it appropriately - icon->setPixmap( LXDG::findIcon(item.icon,"preferences-system-windows-actions").pixmap(32,32) ); - name->setText( this->fontMetrics().elidedText(item.name, Qt::ElideRight, TEXTCUTOFF) ); + icon->setPixmap( LXDG::findIcon(item->icon,"preferences-system-windows-actions").pixmap(32,32) ); + name->setText( this->fontMetrics().elidedText(item->name, Qt::ElideRight, TEXTCUTOFF) ); this->setWhatsThis(name->text()); - icon->setWhatsThis(item.filePath); + icon->setWhatsThis(item->filePath); //Now setup the buttons appropriately setupButton(); setupActions(item); @@ -152,14 +152,14 @@ void UserItemWidget::setupButton(bool disable){ } } -void UserItemWidget::setupActions(XDGDesktop app){ - if(app.actions.isEmpty()){ actButton->setVisible(false); return; } +void UserItemWidget::setupActions(XDGDesktop *app){ + if(app==0 || app->actions.isEmpty()){ actButton->setVisible(false); return; } //Actions Available - go ahead and list them all actButton->setMenu( new QMenu(this) ); - for(int i=0; i<app.actions.length(); i++){ - QAction *act = new QAction(LXDG::findIcon(app.actions[i].icon, app.icon), app.actions[i].name, this); - act->setToolTip(app.actions[i].ID); - act->setWhatsThis(app.actions[i].ID); + for(int i=0; i<app->actions.length(); i++){ + QAction *act = new QAction(LXDG::findIcon(app->actions[i].icon, app->icon), app->actions[i].name, this); + act->setToolTip(app->actions[i].ID); + act->setWhatsThis(app->actions[i].ID); actButton->menu()->addAction(act); } connect(actButton->menu(), SIGNAL(triggered(QAction*)), this, SLOT(actionClicked(QAction*)) ); @@ -201,4 +201,4 @@ void UserItemWidget::actionClicked(QAction *act){ if(!linkPath.isEmpty()){ cmd = cmd.arg(linkPath); } else{ cmd = cmd.arg(icon->whatsThis()); } emit RunItem(cmd); -}
\ No newline at end of file +} diff --git a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h index 2251344c..0b212f10 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h @@ -28,7 +28,7 @@ class UserItemWidget : public QFrame{ Q_OBJECT public: UserItemWidget(QWidget *parent=0, QString itemPath="", QString type="unknown", bool goback=false); - UserItemWidget(QWidget *parent=0, XDGDesktop item= XDGDesktop()); + UserItemWidget(QWidget *parent=0, XDGDesktop *item= 0); ~UserItemWidget(); bool gooditem; @@ -41,7 +41,7 @@ private: void createWidget(); void setupButton(bool disable = false); - void setupActions(XDGDesktop); + void setupActions(XDGDesktop*); private slots: void buttonClicked(); diff --git a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp index c7d8109c..fb58c7f6 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp @@ -130,8 +130,8 @@ void UserWidget::UpdateAll(){ QString APPSTORE = LOS::AppStoreShortcut(); if(QFile::exists(APPSTORE) && !APPSTORE.isEmpty()){ //Now load the info - bool ok = false; - XDGDesktop store = LXDG::loadDesktopFile(APPSTORE, ok); + XDGDesktop store(APPSTORE); + bool ok = store.isValid(); if(ok){ ui->tool_app_store->setIcon( LXDG::findIcon(store.icon, "") ); ui->tool_app_store->setText( store.name ); @@ -143,8 +143,8 @@ void UserWidget::UpdateAll(){ QString CONTROLPANEL = LOS::ControlPanelShortcut(); if(QFile::exists(CONTROLPANEL) && !CONTROLPANEL.isEmpty()){ //Now load the info - bool ok = false; - XDGDesktop cpan = LXDG::loadDesktopFile(CONTROLPANEL, ok); + XDGDesktop cpan(CONTROLPANEL); + bool ok = cpan.isValid(); if(ok){ ui->tool_controlpanel->setIcon( LXDG::findIcon(cpan.icon, "") ); } @@ -307,7 +307,7 @@ void UserWidget::updateAppCategories(){ void UserWidget::updateApps(){ if(ui->combo_app_cats->currentIndex() < 0){ return; } //no cat QString cat = ui->combo_app_cats->itemData( ui->combo_app_cats->currentIndex() ).toString(); - QList<XDGDesktop> items = sysapps->value(cat); + QList<XDGDesktop*> items = sysapps->value(cat); ClearScrollArea(ui->scroll_apps); for(int i=0; i<items.length(); i++){ UserItemWidget *it = new UserItemWidget(ui->scroll_apps->widget(), items[i]); diff --git a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.h b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.h index af9408dd..8b03c489 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.h @@ -42,7 +42,7 @@ public slots: private: Ui::UserWidget *ui; - QHash<QString, QList<XDGDesktop> > *sysapps; + QHash<QString, QList<XDGDesktop*> > *sysapps; QDateTime lastUpdate, lastHomeUpdate; QStringList favs; QFileInfoList homefiles; |