diff options
author | Arnar Mar Sig <antab@antab.is> | 2017-02-04 22:01:51 +0000 |
---|---|---|
committer | Arnar Mar Sig <antab@antab.is> | 2017-02-04 22:01:51 +0000 |
commit | cd433a5466fabe22df271f0e7de088d72a244381 (patch) | |
tree | defc263cc588dd472c7d3a9530e821fc61d1b281 /src-qt5/core-utils | |
parent | Change the app selection comboBox to list and add search feature. (diff) | |
download | lumina-cd433a5466fabe22df271f0e7de088d72a244381.tar.gz lumina-cd433a5466fabe22df271f0e7de088d72a244381.tar.bz2 lumina-cd433a5466fabe22df271f0e7de088d72a244381.zip |
Add defaultPath parameter to set what app is selected by default.
Diffstat (limited to 'src-qt5/core-utils')
-rw-r--r-- | src-qt5/core-utils/lumina-config/AppDialog.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src-qt5/core-utils/lumina-config/AppDialog.h b/src-qt5/core-utils/lumina-config/AppDialog.h index 4eb6471c..2b03fc76 100644 --- a/src-qt5/core-utils/lumina-config/AppDialog.h +++ b/src-qt5/core-utils/lumina-config/AppDialog.h @@ -23,18 +23,22 @@ private: Ui::AppDialog *ui; public: - AppDialog(QWidget *parent = 0) : QDialog(parent), ui(new Ui::AppDialog){ + AppDialog(QWidget *parent = 0, QString defaultPath = "") : QDialog(parent), ui(new Ui::AppDialog){ ui->setupUi(this); //load the designer file appreset = false; ui->listApps->clear(); + QListWidgetItem *defaultItem = nullptr; QList<XDGDesktop*> APPS = LXDG::sortDesktopNames(APPSLIST->apps(false,false)); //Don't show all/hidden for(int i=0; i<APPS.length(); i++){ QListWidgetItem *app = new QListWidgetItem(LXDG::findIcon(APPS[i]->icon,"application-x-executable"), APPS[i]->name); app->setData(Qt::UserRole, APPS[i]->filePath); ui->listApps->addItem(app); + if(APPS[i]->filePath == defaultPath){ + defaultItem = app; + } } if(ui->listApps->count()){ - ui->listApps->setCurrentItem(ui->listApps->item(0)); + ui->listApps->setCurrentItem(defaultItem != nullptr ? defaultItem : ui->listApps->item(0)); } this->setWindowIcon( LXDG::findIcon("system-search","") ); if(parent!=0){ |