qtmobility/src/systeminfo/qsysteminfo_linux.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    45 #include <QSize>
    45 #include <QSize>
    46 #include <QFile>
    46 #include <QFile>
    47 #include <QTextStream>
    47 #include <QTextStream>
    48 #include <QLocale>
    48 #include <QLocale>
    49 #include <QLibraryInfo>
    49 #include <QLibraryInfo>
    50 #include <QtGui>
       
    51 #include <QDebug>
    50 #include <QDebug>
    52 #include <QTimer>
    51 #include <QTimer>
    53 #include <QDir>
    52 #include <QDir>
    54 #include <QTimer>
    53 #include <QTimer>
    55 #include <QMapIterator>
    54 #include <QMapIterator>
       
    55 #include <QSettings>
    56 
    56 
    57 #ifndef QT_NO_NETWORKMANAGER
    57 #ifndef QT_NO_NETWORKMANAGER
    58 #include <qnetworkmanagerservice_linux_p.h>
    58 #include <qnetworkmanagerservice_linux_p.h>
    59 #include <QtDBus/QtDBus>
    59 #include <QtDBus/QtDBus>
    60 #include <QtDBus/QDBusConnection>
    60 #include <QtDBus/QDBusConnection>
    90     QStringList langList;
    90     QStringList langList;
    91 
    91 
    92     if(transDir.exists()) {
    92     if(transDir.exists()) {
    93         QStringList localeList = transDir.entryList( QStringList() << QLatin1String("qt_*.qm") ,QDir::Files
    93         QStringList localeList = transDir.entryList( QStringList() << QLatin1String("qt_*.qm") ,QDir::Files
    94                                                      | QDir::NoDotAndDotDot, QDir::Name);
    94                                                      | QDir::NoDotAndDotDot, QDir::Name);
    95         foreach(QString localeName, localeList) {
    95         foreach(const QString localeName, localeList) {
    96             QString lang = localeName.mid(3,2);
    96             const QString lang = localeName.mid(3,2);
    97             if(!langList.contains(lang) && !lang.isEmpty() && !lang.contains(QLatin1String("help"))) {
    97             if(!langList.contains(lang) && !lang.isEmpty() && !lang.contains(QLatin1String("help"))) {
    98                 langList <<lang;
    98                 langList <<lang;
    99             }
    99             }
   100         }
   100         }
   101         if(langList.count() > 0) {
   101         if(langList.count() > 0) {
   154         : QSystemNetworkInfoLinuxCommonPrivate(parent)
   154         : QSystemNetworkInfoLinuxCommonPrivate(parent)
   155 {
   155 {
   156 #if !defined(QT_NO_NETWORKMANAGER)
   156 #if !defined(QT_NO_NETWORKMANAGER)
   157     setupNmConnections();
   157     setupNmConnections();
   158     updateActivePaths();
   158     updateActivePaths();
   159     QTimer::singleShot(200, this,SLOT(getPrimaryMode()));
       
   160 #endif
   159 #endif
   161 }
   160 }
   162 
   161 
   163 QSystemNetworkInfoPrivate::~QSystemNetworkInfoPrivate()
   162 QSystemNetworkInfoPrivate::~QSystemNetworkInfoPrivate()
   164 {
   163 {
   167 #if !defined(QT_NO_NETWORKMANAGER)
   166 #if !defined(QT_NO_NETWORKMANAGER)
   168 void QSystemNetworkInfoPrivate::setupNmConnections()
   167 void QSystemNetworkInfoPrivate::setupNmConnections()
   169 {
   168 {
   170     iface = new QNetworkManagerInterface(this);
   169     iface = new QNetworkManagerInterface(this);
   171 
   170 
   172    foreach(QDBusObjectPath path, iface->getDevices()) {
   171    foreach(const QDBusObjectPath path, iface->getDevices()) {
   173         QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path(), this);
   172         QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path(), this);
   174 
   173 
   175         switch(devIface->deviceType()) {
   174         switch(devIface->deviceType()) {
   176         case DEVICE_TYPE_802_3_ETHERNET:
   175         case DEVICE_TYPE_802_3_ETHERNET:
   177             {
   176             {
   219         }
   218         }
   220     }
   219     }
   221     return isDefault;
   220     return isDefault;
   222 }
   221 }
   223 
   222 
   224 void QSystemNetworkInfoPrivate::getPrimaryMode()
   223 void QSystemNetworkInfoPrivate::primaryModeChanged()
   225 {
   224 {
   226     // try to see if there are any default route
   225     emit networkModeChanged(currentMode());
   227     bool anyDefaultRoute = false;
       
   228 
       
   229     QMapIterator<QString, QString> i(activePaths);
       
   230     QString devicepath;
       
   231     while (i.hasNext()) {
       
   232         i.next();
       
   233         QScopedPointer<QNetworkManagerConnectionActive> activeCon;
       
   234         activeCon.reset(new QNetworkManagerConnectionActive(i.key(), this));
       
   235 
       
   236         if(activeCon->defaultRoute()) {
       
   237             anyDefaultRoute = activeCon->defaultRoute();
       
   238             QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(i.value(), this);
       
   239             emit networkModeChanged(deviceTypeToMode(devIface->deviceType()));
       
   240         }
       
   241         devicepath = i.value();
       
   242     }
       
   243 
       
   244     if(!anyDefaultRoute) {
       
   245         emit networkModeChanged(QSystemNetworkInfo::UnknownMode);
       
   246     }
       
   247 }
   226 }
   248 
   227 
   249 
   228 
   250 QString QSystemNetworkInfoPrivate::getNmNetName(QSystemNetworkInfo::NetworkMode mode)
   229 QString QSystemNetworkInfoPrivate::getNmNetName(QSystemNetworkInfo::NetworkMode mode)
   251 {
   230 {
   303         activeCon.reset(new QNetworkManagerConnectionActive(i.key()));
   282         activeCon.reset(new QNetworkManagerConnectionActive(i.key()));
   304         if(i.value() == path) {
   283         if(i.value() == path) {
   305             QScopedPointer<QNetworkManagerSettingsConnection> settingsConIface;
   284             QScopedPointer<QNetworkManagerSettingsConnection> settingsConIface;
   306             settingsConIface.reset(new QNetworkManagerSettingsConnection(activeCon->serviceName(),activeCon->connection().path(), this));
   285             settingsConIface.reset(new QNetworkManagerSettingsConnection(activeCon->serviceName(),activeCon->connection().path(), this));
   307             if(settingsConIface->isValid()) {
   286             if(settingsConIface->isValid()) {
   308                 qWarning() << settingsConIface->getId();
       
   309                 return settingsConIface->getId();
   287                 return settingsConIface->getId();
   310             } else {
       
   311                 //qWarning() << "not valid";
       
   312             }
   288             }
   313         }
   289         }
   314     }
   290     }
   315     return QLatin1String("");
   291     return QLatin1String("");
   316 }
   292 }
   319 {
   295 {
   320     activePaths.clear();
   296     activePaths.clear();
   321     QScopedPointer<QNetworkManagerInterface> dbIface;
   297     QScopedPointer<QNetworkManagerInterface> dbIface;
   322     dbIface.reset(new QNetworkManagerInterface(this));
   298     dbIface.reset(new QNetworkManagerInterface(this));
   323 
   299 
   324     QList <QDBusObjectPath> connections = dbIface->activeConnections();
   300     const QList <QDBusObjectPath> connections = dbIface->activeConnections();
   325 
   301 
   326     foreach(QDBusObjectPath activeconpath, connections) {
   302     foreach(const QDBusObjectPath activeconpath, connections) {
   327 
       
   328         QScopedPointer<QNetworkManagerConnectionActive> activeCon;
   303         QScopedPointer<QNetworkManagerConnectionActive> activeCon;
   329         activeCon.reset(new QNetworkManagerConnectionActive(activeconpath.path(), this));
   304         activeCon.reset(new QNetworkManagerConnectionActive(activeconpath.path(), this));
   330 
   305 
   331         QList<QDBusObjectPath> devices = activeCon->devices();
   306         const QList<QDBusObjectPath> devices = activeCon->devices();
   332         foreach(QDBusObjectPath device, devices) {
   307         foreach(const QDBusObjectPath device, devices) {
   333             activePaths.insert(activeconpath.path(),device.path());
   308             activePaths.insert(activeconpath.path(),device.path());
   334         }
   309         }
   335     }
   310     }
   336 }
   311 }
   337 
   312 
   382             accessPointIface = new QNetworkManagerInterfaceAccessPoint(path, this);
   357             accessPointIface = new QNetworkManagerInterfaceAccessPoint(path, this);
   383 
   358 
   384             accessPointIface->setConnections();
   359             accessPointIface->setConnections();
   385             if(!connect(accessPointIface, SIGNAL(propertiesChanged(const QString &,QMap<QString,QVariant>)),
   360             if(!connect(accessPointIface, SIGNAL(propertiesChanged(const QString &,QMap<QString,QVariant>)),
   386                         this,SLOT(nmAPPropertiesChanged( const QString &, QMap<QString,QVariant>)))) {
   361                         this,SLOT(nmAPPropertiesChanged( const QString &, QMap<QString,QVariant>)))) {
   387              //   qWarning() << "connect is false";
       
   388             }
   362             }
   389 
   363 
   390         }
   364         }
   391         if( i.key() == QLatin1String("Carrier")) {
   365         if( i.key() == QLatin1String("Carrier")) {
   392             int strength = 0;
   366             int strength = 0;
   399             };
   373             };
   400             emit networkSignalStrengthChanged(QSystemNetworkInfo::EthernetMode, strength);
   374             emit networkSignalStrengthChanged(QSystemNetworkInfo::EthernetMode, strength);
   401         }
   375         }
   402         if( i.key() == QLatin1String("Ip4Config")) {
   376         if( i.key() == QLatin1String("Ip4Config")) {
   403             // || i.key() == "Ip46Config") {
   377             // || i.key() == "Ip46Config") {
   404             getPrimaryMode();
   378             primaryModeChanged();
   405         }
   379         }
   406     }
   380     }
   407 }
   381 }
   408 
   382 
   409 void QSystemNetworkInfoPrivate::nmAPPropertiesChanged( const QString & /*path*/, QMap<QString,QVariant> map)
   383 void QSystemNetworkInfoPrivate::nmAPPropertiesChanged( const QString & /*path*/, QMap<QString,QVariant> map)
   440 {
   414 {
   441     switch(mode) {
   415     switch(mode) {
   442     case QSystemNetworkInfo::WlanMode:
   416     case QSystemNetworkInfo::WlanMode:
   443         {
   417         {
   444             QString result;
   418             QString result;
   445             QString baseSysDir = QLatin1String("/sys/class/net/");
   419             const QString baseSysDir = QLatin1String("/sys/class/net/");
   446             QDir wDir(baseSysDir);
   420             const QDir wDir(baseSysDir);
   447             QStringList dirs = wDir.entryList(QStringList() << QLatin1String("*"), QDir::AllDirs | QDir::NoDotAndDotDot);
   421             const QStringList dirs = wDir.entryList(QStringList() << QLatin1String("*"), QDir::AllDirs | QDir::NoDotAndDotDot);
   448             foreach(QString dir, dirs) {
   422             foreach(const QString dir, dirs) {
   449                 QString devFile = baseSysDir + dir;
   423                 QString devFile = baseSysDir + dir;
   450                 QFileInfo fi(devFile + QLatin1String("/wireless/link"));
   424                 QFileInfo fi(devFile + QLatin1String("/wireless/link"));
   451                 if(fi.exists()) {
   425                 if(fi.exists()) {
   452                     QFile rx(fi.absoluteFilePath());
   426                     QFile rx(fi.absoluteFilePath());
   453                     if(rx.exists() && rx.open(QIODevice::ReadOnly | QIODevice::Text)) {
   427                     if(rx.exists() && rx.open(QIODevice::ReadOnly | QIODevice::Text)) {
   462         }
   436         }
   463         break;
   437         break;
   464     case QSystemNetworkInfo::EthernetMode:
   438     case QSystemNetworkInfo::EthernetMode:
   465         {
   439         {
   466             QString result;
   440             QString result;
   467             QString baseSysDir = QLatin1String("/sys/class/net/");
   441             const QString baseSysDir = QLatin1String("/sys/class/net/");
   468             QDir eDir(baseSysDir);
   442             const QDir eDir(baseSysDir);
   469             QStringList dirs = eDir.entryList(QStringList() << QLatin1String("eth*"), QDir::AllDirs | QDir::NoDotAndDotDot);
   443             const QStringList dirs = eDir.entryList(QStringList() << QLatin1String("eth*"), QDir::AllDirs | QDir::NoDotAndDotDot);
   470             foreach(QString dir, dirs) {
   444             foreach(const QString dir, dirs) {
   471                 QString devFile = baseSysDir + dir;
   445                 QString devFile = baseSysDir + dir;
   472                 QFileInfo fi(devFile + QLatin1String("/carrier"));
   446                 QFileInfo fi(devFile + QLatin1String("/carrier"));
   473                 if(fi.exists()) {
   447                 if(fi.exists()) {
   474                     QFile rx(fi.absoluteFilePath());
   448                     QFile rx(fi.absoluteFilePath());
   475                     if(rx.exists() && rx.open(QIODevice::ReadOnly | QIODevice::Text)) {
   449                     if(rx.exists() && rx.open(QIODevice::ReadOnly | QIODevice::Text)) {
   525 QString QSystemNetworkInfoPrivate::homeMobileNetworkCode()
   499 QString QSystemNetworkInfoPrivate::homeMobileNetworkCode()
   526 {
   500 {
   527     return QString();
   501     return QString();
   528 }
   502 }
   529 
   503 
       
   504 QSystemNetworkInfo::NetworkMode QSystemNetworkInfoPrivate::currentMode()
       
   505 {
       
   506     QSystemNetworkInfo::NetworkMode mode = QSystemNetworkInfo::UnknownMode;
       
   507 
       
   508 #if !defined(QT_NO_NETWORKMANAGER)
       
   509     bool anyDefaultRoute = false;
       
   510 
       
   511     QMapIterator<QString, QString> i(activePaths);
       
   512     QString devicepath;
       
   513     while (i.hasNext()) {
       
   514         i.next();
       
   515         QScopedPointer<QNetworkManagerConnectionActive> activeCon;
       
   516         activeCon.reset(new QNetworkManagerConnectionActive(i.key(), this));
       
   517 
       
   518         if(activeCon->defaultRoute()) {
       
   519             anyDefaultRoute = activeCon->defaultRoute();
       
   520             QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(i.value(), this);
       
   521             return deviceTypeToMode(devIface->deviceType());
       
   522         }
       
   523         devicepath = i.value();
       
   524     }
       
   525 #endif
       
   526 
       
   527     return mode;
       
   528 }
       
   529 
   530 QSystemDisplayInfoPrivate::QSystemDisplayInfoPrivate(QSystemDisplayInfoLinuxCommonPrivate *parent)
   530 QSystemDisplayInfoPrivate::QSystemDisplayInfoPrivate(QSystemDisplayInfoLinuxCommonPrivate *parent)
   531         : QSystemDisplayInfoLinuxCommonPrivate(parent)
   531         : QSystemDisplayInfoLinuxCommonPrivate(parent)
   532 {
   532 {
   533 }
   533 }
   534 
   534 
   559     return QSystemDeviceInfo::UnknownProfile;
   559     return QSystemDeviceInfo::UnknownProfile;
   560 }
   560 }
   561 
   561 
   562 QString QSystemDeviceInfoPrivate::imei()
   562 QString QSystemDeviceInfoPrivate::imei()
   563 {
   563 {
   564         return QLatin1String("Sim Not Available");
   564         return QLatin1String("");
   565 }
   565 }
   566 
   566 
   567 QString QSystemDeviceInfoPrivate::imsi()
   567 QString QSystemDeviceInfoPrivate::imsi()
   568 {
   568 {
   569         return QLatin1String("Sim Not Available");
   569         return QLatin1String("");
   570 }
   570 }
   571 
   571 
   572 QSystemDeviceInfo::SimStatus QSystemDeviceInfoPrivate::simStatus()
   572 QSystemDeviceInfo::SimStatus QSystemDeviceInfoPrivate::simStatus()
   573 {
   573 {
   574     return QSystemDeviceInfo::SimNotAvailable;
   574     return QSystemDeviceInfo::SimNotAvailable;
   585 
   585 
   586     return false;
   586     return false;
   587 }
   587 }
   588 
   588 
   589  QSystemScreenSaverPrivate::QSystemScreenSaverPrivate(QSystemScreenSaverLinuxCommonPrivate *parent)
   589  QSystemScreenSaverPrivate::QSystemScreenSaverPrivate(QSystemScreenSaverLinuxCommonPrivate *parent)
   590          : QSystemScreenSaverLinuxCommonPrivate(parent)
   590          : QSystemScreenSaverLinuxCommonPrivate(parent), currentPid(0)
   591  {
   591  {
   592      kdeIsRunning = false;
   592      kdeIsRunning = false;
   593      gnomeIsRunning = false;
   593      gnomeIsRunning = false;
   594      whichWMRunning();
   594      whichWMRunning();
   595  }
   595  }
   596 
   596 
   597  QSystemScreenSaverPrivate::~QSystemScreenSaverPrivate()
   597  QSystemScreenSaverPrivate::~QSystemScreenSaverPrivate()
   598  {
   598  {
       
   599      if(currentPid != 0) {
       
   600 #if !defined(QT_NO_DBUS)
       
   601          QDBusConnection dbusConnection = QDBusConnection::sessionBus();
       
   602 
       
   603          QStringList ifaceList;
       
   604          ifaceList <<  QLatin1String("org.freedesktop.ScreenSaver");
       
   605          ifaceList << QLatin1String("org.gnome.ScreenSaver");
       
   606          QDBusInterface *connectionInterface;
       
   607          foreach(const QString iface, ifaceList) {
       
   608              connectionInterface = new QDBusInterface(QLatin1String(iface.toLatin1()),
       
   609                                                       QLatin1String("/ScreenSaver"),
       
   610                                                       QLatin1String(iface.toLatin1()),
       
   611                                                       dbusConnection);
       
   612              if(connectionInterface->isValid()) {
       
   613                  QDBusReply<uint> reply =  connectionInterface->call(QLatin1String("UnInhibit"),
       
   614                                                                      currentPid);
       
   615              }
       
   616          }
       
   617 #endif
       
   618      }
   599  }
   619  }
   600 
   620 
   601  bool QSystemScreenSaverPrivate::setScreenSaverInhibit()
   621  bool QSystemScreenSaverPrivate::setScreenSaverInhibit()
   602  {
   622  {
   603      if(kdeIsRunning || gnomeIsRunning) {
   623      if(kdeIsRunning || gnomeIsRunning) {
   604 #if !defined(QT_NO_DBUS)
   624 #if !defined(QT_NO_DBUS)
   605          pid_t pid = getppid();
   625          const pid_t pid = getppid();
   606          QDBusConnection dbusConnection = QDBusConnection::sessionBus();
   626          QDBusConnection dbusConnection = QDBusConnection::sessionBus();
   607 
   627 
   608          QStringList ifaceList;
   628          QStringList ifaceList;
   609          ifaceList <<  QLatin1String("org.freedesktop.ScreenSaver");
   629          ifaceList <<  QLatin1String("org.freedesktop.ScreenSaver");
   610          ifaceList << QLatin1String("org.gnome.ScreenSaver");
   630          ifaceList << QLatin1String("org.gnome.ScreenSaver");
   611          QDBusInterface *connectionInterface;
   631          QDBusInterface *connectionInterface;
   612          foreach(QString iface, ifaceList) {
   632          foreach(const QString iface, ifaceList) {
   613              connectionInterface = new QDBusInterface(QLatin1String(iface.toLatin1()),
   633              connectionInterface = new QDBusInterface(QLatin1String(iface.toLatin1()),
   614                                                       QLatin1String("/ScreenSaver"),
   634                                                       QLatin1String("/ScreenSaver"),
   615                                                       QLatin1String(iface.toLatin1()),
   635                                                       QLatin1String(iface.toLatin1()),
   616                                                       dbusConnection);
   636                                                       dbusConnection);
   617              QDBusReply<uint> reply =  connectionInterface->call(QLatin1String("Inhibit"),
   637              if(connectionInterface->isValid()) {
   618                                                                  QString::number((int)pid),
   638                  QDBusReply<uint> reply =  connectionInterface->call(QLatin1String("Inhibit"),
   619                                                                  QLatin1String("QSystemScreenSaver"));
   639                                                                      QString::number((int)pid),
   620              if(reply.isValid()) {
   640                                                                      QLatin1String("QSystemScreenSaver"));
   621                  currentPid = reply.value();
   641                  if(reply.isValid()) {
   622                  qWarning() << "Inhibit" << currentPid;
   642                      currentPid = reply.value();
   623                  return reply.isValid();
   643                      return reply.isValid();
   624              } else {
   644                  }
   625                  qWarning() << reply.error();
       
   626              }
   645              }
   627          }
   646          }
   628 #endif
   647 #endif
   629      } else {
   648      } else {
   630 #ifdef Q_WS_X11
   649 #ifdef Q_WS_X11
   641 }
   660 }
   642 
   661 
   643 
   662 
   644 bool QSystemScreenSaverPrivate::screenSaverInhibited()
   663 bool QSystemScreenSaverPrivate::screenSaverInhibited()
   645 {
   664 {
   646     if(kdeIsRunning) {
   665     if(kdeIsRunning || gnomeIsRunning) {
   647         QString kdeSSConfig;
   666         if(currentPid != 0) {
   648         if(QDir( QDir::homePath()+QLatin1String("/.kde4/")).exists()) {
   667             return true;
   649             kdeSSConfig = QDir::homePath()+QLatin1String("/.kde4/share/config/kscreensaverrc");
   668         } else {
   650         } else if(QDir(QDir::homePath()+QLatin1String("/.kde/")).exists()) {
   669             return false;
   651             kdeSSConfig = QDir::homePath()+QLatin1String("/.kde/share/config/kscreensaverrc");
   670         }
   652         }
       
   653         QSettings kdeScreenSaveConfig(kdeSSConfig, QSettings::IniFormat);
       
   654         kdeScreenSaveConfig.beginGroup(QLatin1String("ScreenSaver"));
       
   655         if(kdeScreenSaveConfig.status() == QSettings::NoError) {
       
   656             if(kdeScreenSaveConfig.value(QLatin1String("Enabled")).toBool() == false) {
       
   657             } else {
       
   658                 return true;
       
   659             }
       
   660         }
       
   661     } else if(gnomeIsRunning) {
       
   662 
       
   663     }
   671     }
   664 
   672 
   665 #ifdef Q_WS_X11
   673 #ifdef Q_WS_X11
   666     int timeout;
   674     int timeout;
   667     int interval;
   675     int interval;
   724 
   732 
   725 bool QSystemScreenSaverPrivate::isScreenSaverActive()
   733 bool QSystemScreenSaverPrivate::isScreenSaverActive()
   726 {
   734 {
   727     if(kdeIsRunning || gnomeIsRunning) {
   735     if(kdeIsRunning || gnomeIsRunning) {
   728 #if !defined(QT_NO_DBUS)
   736 #if !defined(QT_NO_DBUS)
   729         pid_t pid = getppid();
   737         const pid_t pid = getppid();
   730         QDBusConnection dbusConnection = QDBusConnection::sessionBus();
   738         QDBusConnection dbusConnection = QDBusConnection::sessionBus();
   731 
   739 
   732         QStringList ifaceList;
   740         QStringList ifaceList;
   733         ifaceList <<  QLatin1String("org.freedesktop.ScreenSaver");
   741         ifaceList <<  QLatin1String("org.freedesktop.ScreenSaver");
   734         ifaceList << QLatin1String("org.gnome.ScreenSaver");
   742         ifaceList << QLatin1String("org.gnome.ScreenSaver");
   735         QDBusInterface *connectionInterface;
   743         QDBusInterface *connectionInterface;
   736         foreach(QString iface, ifaceList) {
   744         foreach(const QString iface, ifaceList) {
   737             connectionInterface = new QDBusInterface(QLatin1String(iface.toLatin1()),
   745             connectionInterface = new QDBusInterface(QLatin1String(iface.toLatin1()),
   738                                                      QLatin1String("/ScreenSaver"),
   746                                                      QLatin1String("/ScreenSaver"),
   739                                                      QLatin1String(iface.toLatin1()),
   747                                                      QLatin1String(iface.toLatin1()),
   740                                                      dbusConnection);
   748                                                      dbusConnection);
   741 
   749 
   742             QDBusReply<bool> reply =  connectionInterface->call(QLatin1String("GetActive"),
   750             const QDBusReply<bool> reply =  connectionInterface->call(QLatin1String("GetActive"),
   743                                                                 QString::number((int)pid),
   751                                                                 QString::number((int)pid),
   744                                                                 QLatin1String("QSystemScreenSaver"));
   752                                                                 QLatin1String("QSystemScreenSaver"));
   745             if(reply.isValid()) {
   753             if(reply.isValid()) {
   746                 return reply.value();
   754                 return reply.value();
   747             }
   755             }