From b0207c8f23b81913dcfd8fb75e0f28f4931f11f0 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 12 May 2015 17:28:02 -0400 Subject: Finish cleaning up the new XDG autostart write-support and enable it in lumina-config. Now Lumina use the XDG spec entirely for auto-starting applications/utilities. NOTE: The conversion routine from the old->new autostart spec has not been implemented yet, so the old file will still be used for a short while (just not changeable through lumina-config). --- lumina-config/mainUI.cpp | 77 +++++++++++++++++++++++++++++++++++++----------- lumina-config/mainUI.h | 3 +- lumina-config/mainUI.ui | 15 +++------- 3 files changed, 66 insertions(+), 29 deletions(-) (limited to 'lumina-config') diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index b548d7cd..6d43308e 100644 --- a/lumina-config/mainUI.cpp +++ b/lumina-config/mainUI.cpp @@ -128,7 +128,7 @@ void MainUI::setupIcons(){ ui->tabWidget_apps->setTabIcon( ui->tabWidget_apps->indexOf(ui->tab_defaults), LXDG::findIcon("preferences-desktop-filetype-association", "") ); //Session Page - ui->tool_session_rmapp->setIcon( LXDG::findIcon("list-remove","") ); + //ui->tool_session_rmapp->setIcon( LXDG::findIcon("list-remove","") ); ui->tool_session_addapp->setIcon( LXDG::findIcon("system-run","") ); ui->tool_session_addbin->setIcon( LXDG::findIcon("system-search","") ); ui->tool_session_addfile->setIcon( LXDG::findIcon("run-build-file","") ); @@ -217,7 +217,7 @@ void MainUI::setupConnections(){ connect(ui->tool_session_addapp, SIGNAL(clicked()), this, SLOT(addsessionstartapp()) ); connect(ui->tool_session_addbin, SIGNAL(clicked()), this, SLOT(addsessionstartbin()) ); connect(ui->tool_session_addfile, SIGNAL(clicked()), this, SLOT(addsessionstartfile()) ); - connect(ui->tool_session_rmapp, SIGNAL(clicked()), this, SLOT(rmsessionstartitem()) ); + //connect(ui->tool_session_rmapp, SIGNAL(clicked()), this, SLOT(rmsessionstartitem()) ); connect(ui->combo_session_wfocus, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->combo_session_wloc, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->combo_session_wtheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionthemechanged()) ); @@ -225,7 +225,8 @@ void MainUI::setupConnections(){ connect(ui->check_session_playloginaudio, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->check_session_playlogoutaudio, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->spin_session_wkspaces, SIGNAL(valueChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->list_session_start, SIGNAL(currentRowChanged(int)), this, SLOT(sessionstartchanged()) ); + //connect(ui->list_session_start, SIGNAL(currentRowChanged(int)), this, SLOT(sessionstartchanged()) ); + connect(ui->list_session_start, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(sessionoptchanged()) ); connect(ui->spin_session_fontsize, SIGNAL(valueChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->combo_session_themefile, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->combo_session_colorfile, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); @@ -771,7 +772,7 @@ void MainUI::saveCurrentSettings(bool screenonly){ moddesk = modpan = false; if(!screenonly){ modmenu = modshort = moddef = modses = false; } ui->push_save->setEnabled(modmenu || modshort || moddef || modses); //wait for new changes - ui->push_save->setVisible(!ui->actionDefaults->isChecked() || modmenu || modshort || moddef || modses); + //ui->push_save->setVisible(!ui->actionDefaults->isChecked() || modmenu || modshort || moddef || modses); } @@ -1810,8 +1811,21 @@ void MainUI::loadSessionSettings(){ //Now do the startup applications QStringList STARTUP = readFile(QDir::homePath()+"/.lumina/startapps"); + STARTAPPS = LXDG::findAutoStartFiles(true); //also want invalid/disabled items + //qDebug() << "StartApps:"; ui->list_session_start->clear(); - for(int i=0; i " +STARTAPPS[i].name << STARTAPPS[i].isHidden; + if( !LXDG::checkValidity(STARTAPPS[i],false) || !QFile::exists(STARTAPPS[i].filePath) ){ continue; } + QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(STARTAPPS[i].icon,"application-x-executable"), STARTAPPS[i].name ); + it->setWhatsThis(STARTAPPS[i].filePath); //keep the file location + it->setToolTip(STARTAPPS[i].comment); + if(STARTAPPS[i].isHidden){ it->setCheckState( Qt::Unchecked); } + else{it->setCheckState( Qt::Checked); } + ui->list_session_start->addItem(it); + } + + /*for(int i=0; isetWhatsThis(STARTUP[i]); //keep the raw line ui->list_session_start->addItem(it); } - } + }*/ //Now do the general session options ui->check_session_numlock->setChecked( sessionsettings->value("EnableNumlock", true).toBool() ); @@ -1900,7 +1914,7 @@ void MainUI::loadSessionSettings(){ // - Font Size ui->spin_session_fontsize->setValue( current[4].section("p",0,0).toInt() ); - sessionstartchanged(); //make sure to update buttons + //sessionstartchanged(); //make sure to update buttons sessionLoadTimeSample(); sessionLoadDateSample(); } @@ -1931,14 +1945,35 @@ void MainUI::saveSessionSettings(){ //Save the fluxbox settings bool ok = overwriteFile(QDir::homePath()+"/.lumina/fluxbox-init", FB); - if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/startapps"; } + if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/fluxbox-init"; } + //Now do the start apps - QStringList STARTUP; + bool newstartapps = false; for(int i=0; ilist_session_start->count(); i++){ - STARTUP << ui->list_session_start->item(i)->whatsThis(); + QString file = ui->list_session_start->item(i)->whatsThis(); + bool enabled = ui->list_session_start->item(i)->checkState()==Qt::Checked; + bool found = false; + for(int i=0; isetValue("EnableNumlock", ui->check_session_numlock->isChecked()); @@ -1964,6 +1999,7 @@ void MainUI::saveSessionSettings(){ QString fontsize = QString::number(ui->spin_session_fontsize->value())+"pt"; //qDebug() << "Saving theme options:" << themefile << colorfile << iconset << font << fontsize; LTHEME::setCurrentSettings( themefile, colorfile, iconset, font, fontsize); + if(newstartapps){ loadSessionSettings(); } //make sure to re-load the session settings to catch the new files } void MainUI::rmsessionstartitem(){ @@ -1977,7 +2013,10 @@ void MainUI::addsessionstartapp(){ XDGDesktop desk = getSysApp(); if(desk.filePath.isEmpty()){ return; } //cancelled QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name ); - it->setWhatsThis("lumina-open "+desk.filePath); //command to be saved/run + it->setWhatsThis(desk.filePath); + it->setToolTip(desk.comment); + it->setCheckState(Qt::Checked); + ui->list_session_start->addItem(it); ui->list_session_start->setCurrentItem(it); sessionoptchanged(); @@ -1994,6 +2033,8 @@ void MainUI::addsessionstartbin(){ } QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon("application-x-executable",""), bin.section("/",-1) ); it->setWhatsThis(bin); //command to be saved/run + it->setToolTip(bin); + it->setCheckState(Qt::Checked); ui->list_session_start->addItem(it); ui->list_session_start->setCurrentItem(it); sessionoptchanged(); @@ -2003,8 +2044,10 @@ void MainUI::addsessionstartfile(){ QString chkpath = QDir::homePath(); QString bin = QFileDialog::getOpenFileName(this, tr("Select File"), chkpath, tr("All Files (*)") ); if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled - QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon("unknown",""), bin.section("/",-1) ); - it->setWhatsThis("lumina-open "+bin); //command to be saved/run + QListWidgetItem *it = new QListWidgetItem( LXDG::findMimeIcon(bin), bin.section("/",-1) ); + it->setWhatsThis(bin); //file to be saved/run + it->setToolTip(bin); + it->setCheckState(Qt::Checked); ui->list_session_start->addItem(it); ui->list_session_start->setCurrentItem(it); sessionoptchanged(); @@ -2029,9 +2072,9 @@ void MainUI::sessionthemechanged(){ sessionoptchanged(); } -void MainUI::sessionstartchanged(){ +/*void MainUI::sessionstartchanged(){ ui->tool_session_rmapp->setEnabled( ui->list_session_start->currentRow()>=0 ); -} +}*/ void MainUI::sessionEditColor(){ //Get the current color file diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h index 2593d648..397f750b 100644 --- a/lumina-config/mainUI.h +++ b/lumina-config/mainUI.h @@ -57,6 +57,7 @@ private: QString panelcolor; QString DEFAULTBG; QList sysApps; + QList STARTAPPS; bool loading, panadjust; bool moddesk, modpan, modmenu, modshort, moddef, modses; //page modified flags int panelnumber; @@ -164,7 +165,7 @@ private slots: void addsessionstartfile(); void sessionoptchanged(); void sessionthemechanged(); - void sessionstartchanged(); + //void sessionstartchanged(); void sessionEditColor(); void sessionEditTheme(); void sessionChangeUserIcon(); diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui index 791165d7..99cf6f83 100644 --- a/lumina-config/mainUI.ui +++ b/lumina-config/mainUI.ui @@ -109,7 +109,7 @@ QFrame::StyledPanel - 1 + 3 @@ -602,7 +602,7 @@ 0 0 - 249 + 238 215 @@ -836,7 +836,7 @@ 0 0 - 249 + 238 209 @@ -1223,13 +1223,6 @@ - - - - rem - - - @@ -1876,7 +1869,7 @@ 0 0 129 - 16 + 28 -- cgit