@ -61,35 +61,24 @@ uint Environment::makeVersion(uint major, uint minor, uint release) const
uint Environment : : identifyPlasmaDesktopVersion ( )
uint Environment : : identifyPlasmaDesktopVersion ( )
{
{
//! Identify Plasma Desktop version
//! Identify Plasma Desktop version
QProcess process ;
QStringList plasmaDesktopVersionParts = QString ( PLASMA_WORKSPACE_VERSION ) . split ( " . " ) ;
process . start ( " plasmashell " , QStringList ( ) < < " -v " ) ;
process . waitForFinished ( ) ;
QString output ( process . readAllStandardOutput ( ) ) ;
QStringList stringSplit = output . split ( " " ) ;
if ( plasmaDesktopVersionParts . count ( ) = = 3 ) {
if ( stringSplit . count ( ) > = 2 ) {
qDebug ( ) < < " ///////////////////////// " ;
qDebug ( ) < < " ///////////////////////// " ;
QString cleanVersionString = stringSplit [ 1 ] . remove ( " \n " ) ;
uint maj = plasmaDesktopVersionParts [ 0 ] . toUInt ( ) ;
QStringList plasmaDesktopVersionParts = cleanVersionString . split ( " . " ) ;
uint min = plasmaDesktopVersionParts [ 1 ] . toUInt ( ) ;
uint rel = plasmaDesktopVersionParts [ 2 ] . toUInt ( ) ;
if ( plasmaDesktopVersionParts . count ( ) = = 3 ) {
uint maj = plasmaDesktopVersionParts [ 0 ] . toUInt ( ) ;
uint min = plasmaDesktopVersionParts [ 1 ] . toUInt ( ) ;
uint rel = plasmaDesktopVersionParts [ 2 ] . toUInt ( ) ;
if ( maj > 0 ) {
uint desktopVersion = makeVersion ( maj , min , rel ) ;
if ( maj > 0 ) {
uint desktopVersion = makeVersion ( maj , min , rel ) ;
QString message ( " Plasma Desktop version: " + QString : : number ( maj ) + " . "
QString message ( " Plasma Desktop version: " + QString : : number ( maj ) + " . "
+ QString : : number ( min ) + " . " + QString : : number ( rel )
+ QString : : number ( min ) + " . " + QString : : number ( rel )
+ " ( " + QString : : number ( desktopVersion ) + " ) " ) ;
+ " ( " + QString : : number ( desktopVersion ) + " ) " ) ;
qDebug ( ) < < message ;
qDebug ( ) < < message ;
qDebug ( ) < < " ///////////////////////// " ;
qDebug ( ) < < " ///////////////////////// " ;
return desktopVersion ;
return desktopVersion ;
}
}
}
qDebug ( ) < < " ///////////////////////// " ;
qDebug ( ) < < " ///////////////////////// " ;