diff options
-rw-r--r-- | lumina-desktop/LSession.cpp | 31 | ||||
-rw-r--r-- | lumina-desktop/LSession.h | 2 |
2 files changed, 25 insertions, 8 deletions
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index b472a60a..bce1d607 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -171,6 +171,20 @@ void LSession::CleanupSession(){ for(int i=0; i<20; i++){ LSession::processEvents(); usleep(25); } //1/2 second pause } +int LSession::VersionStringToNumber(QString version){ + version = version.section("-",0,0); //trim any extra labels off the end + int maj, mid, min; //major/middle/minor version numbers (<Major>.<Middle>.<Minor>) + maj = mid = min = 0; + bool ok = true; + maj = version.section(".",0,0).toInt(&ok); + if(ok){ mid = version.section(".",1,1).toInt(&ok); }else{ maj = 0; } + if(ok){ min = version.section(".",2,2).toInt(&ok); }else{ mid = 0; } + if(!ok){ min = 0; } + //Now assemble the number + //NOTE: This format allows numbers to be anywhere from 0->999 without conflict + return (maj*1000000 + mid*1000 + min); +} + void LSession::launchStartupApps(){ //First start any system-defined startups, then do user defined qDebug() << "Launching startup applications"; @@ -252,15 +266,16 @@ void LSession::watcherChange(QString changed){ } void LSession::checkUserFiles(){ - //version conversion examples: [1.0.0 -> 100], [1.2.0 -> 120], [0.6.0 -> 60] - int oldversion = sessionsettings->value("DesktopVersion","0").toString().section("-",0,0).remove(".").toInt(); - bool newversion = ( oldversion < this->applicationVersion().remove(".").toInt() ); + //internal version conversion examples: + // [1.0.0 -> 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001] + int oldversion = VersionStringToNumber(sessionsettings->value("DesktopVersion","0").toString()); + bool newversion = ( oldversion < VersionStringToNumber(this->applicationVersion()) ); //Check for the desktop settings file QString dset = QDir::homePath()+"/.lumina/LuminaDE/desktopsettings.conf"; bool firstrun = false; - if(!QFile::exists(dset) || oldversion < 50){ - if( oldversion < 50 ){ QFile::remove(dset); qDebug() << "Current desktop settings obsolete: Re-implementing defaults"; } + if(!QFile::exists(dset) || oldversion < 5000){ + if( oldversion < 5000 ){ QFile::remove(dset); qDebug() << "Current desktop settings obsolete: Re-implementing defaults"; } else{ firstrun = true; } /*if(QFile::exists(LOS::LuminaShare()+"desktopsettings.conf")){ if( QFile::copy(LOS::LuminaShare()+"desktopsettings.conf", dset) ){ @@ -269,10 +284,10 @@ void LSession::checkUserFiles(){ }*/ LUtils::LoadSystemDefaults(); } - if(oldversion <= 83){ - //Convert the old->new favorites framework + /*if(oldversion <= 8003){ + //Convert the old->new favorites framework (Not implemented yet) - } + }*/ //Check for the default applications file for lumina-open dset = QDir::homePath()+"/.lumina/LuminaDE/lumina-open.conf"; diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h index fdd47eb6..4c9ea15e 100644 --- a/lumina-desktop/LSession.h +++ b/lumina-desktop/LSession.h @@ -112,6 +112,8 @@ private: void CleanupSession(); + int VersionStringToNumber(QString version); + public slots: void launchStartupApps(); void StartLogout(); |