diff options
author | Ken Moore <ken@pcbsd.org> | 2015-05-22 14:42:31 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-05-22 14:42:31 -0400 |
commit | f0e519beb8a0efde6bf724d0712b0977cf479938 (patch) | |
tree | 9e17cc0e23825bddcc6867a6b5ebb0d7e7c7126c /lumina-config/mainUI.cpp | |
parent | Commit some debug output for the new Memory/CPU calculations. (diff) | |
download | lumina-f0e519beb8a0efde6bf724d0712b0977cf479938.tar.gz lumina-f0e519beb8a0efde6bf724d0712b0977cf479938.tar.bz2 lumina-f0e519beb8a0efde6bf724d0712b0977cf479938.zip |
Ensure that the "change User icon" button in lumina-config only makes the cahnge pending until the user clicks the save button.
Diffstat (limited to 'lumina-config/mainUI.cpp')
-rw-r--r-- | lumina-config/mainUI.cpp | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index ae7cc350..ddc62842 100644 --- a/lumina-config/mainUI.cpp +++ b/lumina-config/mainUI.cpp @@ -2007,6 +2007,26 @@ void MainUI::saveSessionSettings(){ } } + + + if( !ui->push_session_setUserIcon->whatsThis().isEmpty()){ + QString filepath = ui->push_session_setUserIcon->whatsThis(); + if(filepath.isEmpty()){ filepath = QDir::homePath()+"/.loginIcon.png"; } + if(filepath=="reset"){ + QFile::remove(QDir::homePath()+"/.loginIcon.png"); + }else{ + QPixmap pix(filepath); + //Now scale it down if necessary + if(pix.width() > 64 || pix.height()>64){ + pix = pix.scaled(64,64,Qt::KeepAspectRatio, Qt::SmoothTransformation); + } + //Now save that to the icon file (will automatically convert it to a PNG file format) + pix.save(QDir::homePath()+"/.loginIcon.png"); + } + ui->push_session_setUserIcon->setWhatsThis(""); //clear it for later + //Now touch the settings file so that it re-loads the panel + QProcess::startDetached("touch \""+settings->fileName()+"\""); + } //ok = overwriteFile(QDir::homePath()+"/.lumina/startapps", STARTUP); //if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/startapps"; } @@ -2025,7 +2045,6 @@ void MainUI::saveSessionSettings(){ sessionsettings->setValue("CustomTimeZone", true); sessionsettings->setValue("TimeZoneByteCode", ui->combo_session_timezone->currentData().toByteArray()); //clear the value } - //Now do the theme options QString themefile = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString(); QString colorfile = ui->combo_session_colorfile->itemData( ui->combo_session_colorfile->currentIndex() ).toString(); @@ -2176,11 +2195,15 @@ void MainUI::sessionChangeUserIcon(){ //User cancelled the operation if(QFile::exists(QDir::homePath()+"/.loginIcon.png")){ if(QMessageBox::Yes == QMessageBox::question(this,tr("Reset User Image"), tr("Would you like to reset the user image to the system default?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){ - QFile::remove(QDir::homePath()+"/.loginIcon.png"); + //QFile::remove(QDir::homePath()+"/.loginIcon.png"); + ui->push_session_setUserIcon->setWhatsThis("reset"); + }else{ + return; } } }else{ - QPixmap pix(filepath); + ui->push_session_setUserIcon->setWhatsThis(filepath); + /*QPixmap pix(filepath); //Now scale it down if necessary if(pix.width() > 64 || pix.height()>64){ pix = pix.scaled(64,64,Qt::KeepAspectRatio, Qt::SmoothTransformation); @@ -2188,10 +2211,14 @@ void MainUI::sessionChangeUserIcon(){ //Now save that to the icon file (will automatically convert it to a PNG file format) pix.save(QDir::homePath()+"/.loginIcon.png"); //Now touch the settings file so that it re-loads the panel - QProcess::startDetached("touch \""+settings->fileName()+"\""); + QProcess::startDetached("touch \""+settings->fileName()+"\"");*/ } //Now re-load the icon in the UI - ui->push_session_setUserIcon->setIcon( LXDG::findIcon(QDir::homePath()+"/.loginIcon.png", "user-identity") ); + QString path = ui->push_session_setUserIcon->whatsThis(); + if(path.isEmpty()){ path = QDir::homePath()+"/.loginIcon.png"; } + if(path=="reset"){ path.clear(); } + ui->push_session_setUserIcon->setIcon( LXDG::findIcon(path, "user-identity") ); + sessionoptchanged(); } void MainUI::sessionResetSys(){ |