diff options
author | Ken Moore <ken@pcbsd.org> | 2015-05-12 17:28:02 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-05-12 17:28:02 -0400 |
commit | b0207c8f23b81913dcfd8fb75e0f28f4931f11f0 (patch) | |
tree | 021ab1d1427786893b7e3a209a1492ae12707bd3 /lumina-config | |
parent | Large update to the XDG autostart spec - Add full write support in libLumina. (diff) | |
download | lumina-b0207c8f23b81913dcfd8fb75e0f28f4931f11f0.tar.gz lumina-b0207c8f23b81913dcfd8fb75e0f28f4931f11f0.tar.bz2 lumina-b0207c8f23b81913dcfd8fb75e0f28f4931f11f0.zip |
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).
Diffstat (limited to 'lumina-config')
-rw-r--r-- | lumina-config/mainUI.cpp | 77 | ||||
-rw-r--r-- | lumina-config/mainUI.h | 3 | ||||
-rw-r--r-- | lumina-config/mainUI.ui | 15 |
3 files changed, 66 insertions, 29 deletions
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<STARTUP.length(); i++){ + for(int i=0; i<STARTAPPS.length(); i++){ + //qDebug() << STARTAPPS[i].filePath +" -> " +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; i<STARTUP.length(); i++){ if(STARTUP[i].startsWith("#")){ continue; } else if(STARTUP[i].startsWith("lumina-open ")){ //Application or file @@ -1835,7 +1849,7 @@ void MainUI::loadSessionSettings(){ it->setWhatsThis(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; i<ui->list_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; i<STARTAPPS.length(); i++){ + if(STARTAPPS[i].filePath==file){ + found = true; + if(enabled != !STARTAPPS[i].isHidden){ + //value is different + qDebug() << "Setting Autostart:" << enabled << STARTAPPS[i].filePath; + LXDG::setAutoStarted(enabled, STARTAPPS[i]); + } + break; + } + } + if(!found && enabled){ + //New file/binary/app + qDebug() << "Adding new AutoStart File:" << file; + LXDG::setAutoStarted(enabled, file); + newstartapps = true; + } } - ok = overwriteFile(QDir::homePath()+"/.lumina/startapps", STARTUP); - if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/startapps"; } + + //ok = overwriteFile(QDir::homePath()+"/.lumina/startapps", STARTUP); + //if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/startapps"; } //Now do the general session options sessionsettings->setValue("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<XDGDesktop> sysApps; + QList<XDGDesktop> 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 @@ <enum>QFrame::StyledPanel</enum> </property> <property name="currentIndex"> - <number>1</number> + <number>3</number> </property> <widget class="QWidget" name="page_desktop"> <layout class="QVBoxLayout" name="verticalLayout_3"> @@ -602,7 +602,7 @@ <rect> <x>0</x> <y>0</y> - <width>249</width> + <width>238</width> <height>215</height> </rect> </property> @@ -836,7 +836,7 @@ <rect> <x>0</x> <y>0</y> - <width>249</width> + <width>238</width> <height>209</height> </rect> </property> @@ -1224,13 +1224,6 @@ <item> <layout class="QHBoxLayout" name="horizontalLayout_17"> <item> - <widget class="QToolButton" name="tool_session_rmapp"> - <property name="text"> - <string notr="true">rem</string> - </property> - </widget> - </item> - <item> <spacer name="horizontalSpacer_14"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -1876,7 +1869,7 @@ <x>0</x> <y>0</y> <width>129</width> - <height>16</height> + <height>28</height> </rect> </property> <property name="sizePolicy"> |