qtmobility/src/systeminfo/qsysteminfo_maemo.cpp
changeset 11 06b8e2af4411
parent 8 71781823f776
child 14 6fbed849b4f4
equal deleted inserted replaced
8:71781823f776 11:06b8e2af4411
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the Qt Mobility Components.
     7 ** This file is part of the Qt Mobility Components.
     8 **
     8 **
    36 **
    36 **
    37 **
    37 **
    38 ** $QT_END_LICENSE$
    38 ** $QT_END_LICENSE$
    39 **
    39 **
    40 ****************************************************************************/
    40 ****************************************************************************/
    41 #include <qsysteminfo.h>
    41 #include "qsysteminfo.h"
    42 #include <qsysteminfo_maemo_p.h>
    42 #include "qsysteminfo_maemo_p.h"
       
    43 
    43 #include <QStringList>
    44 #include <QStringList>
    44 #include <QSize>
    45 #include <QSize>
    45 #include <QFile>
    46 #include <QFile>
    46 #include <QTextStream>
    47 #include <QTextStream>
    47 #include <QLocale>
    48 #include <QLocale>
   160     case QSystemInfo::LocationFeature :
   161     case QSystemInfo::LocationFeature :
   161         {
   162         {
   162             GConfItem locationValues("/system/nokia/location");
   163             GConfItem locationValues("/system/nokia/location");
   163             const QStringList locationKeys = locationValues.listEntries();
   164             const QStringList locationKeys = locationValues.listEntries();
   164             if(locationKeys.count()) {
   165             if(locationKeys.count()) {
   165                 featureSupported = true;
       
   166             }
       
   167         }
       
   168         break;
       
   169     case QSystemInfo::VideoOutFeature :
       
   170         {
       
   171             const QString sysPath = "/sys/class/video4linux/";
       
   172             const QDir sysDir(sysPath);
       
   173             QStringList filters;
       
   174             filters << "*";
       
   175             const QStringList sysList = sysDir.entryList( filters ,QDir::Dirs, QDir::Name);
       
   176             if(sysList.contains("video0")) {
       
   177                 featureSupported = true;
   166                 featureSupported = true;
   178             }
   167             }
   179         }
   168         }
   180         break;
   169         break;
   181     case QSystemInfo::HapticsFeature:
   170     case QSystemInfo::HapticsFeature:
  1021     flightMode = newMode == "flight";
  1010     flightMode = newMode == "flight";
  1022     if (previousFlightMode != flightMode)
  1011     if (previousFlightMode != flightMode)
  1023         emit currentProfileChanged(currentProfile());
  1012         emit currentProfileChanged(currentProfile());
  1024 }
  1013 }
  1025 
  1014 
  1026 void QSystemDeviceInfoPrivate::profileChanged(bool, bool, QString profile, QList<ProfileDataValue> values)
  1015 void QSystemDeviceInfoPrivate::profileChanged(bool changed, bool active, QString profile, QList<ProfileDataValue> values)
  1027 {
  1016 {
  1028     const QSystemDeviceInfo::Profile previousProfile = currentProfile();
  1017     if (active) {
  1029 
  1018         const QSystemDeviceInfo::Profile previousProfile = currentProfile();
  1030     profileName = profile;
  1019         profileName = profile;
  1031     foreach (const ProfileDataValue value, values) {
  1020         foreach (const ProfileDataValue value, values) {
  1032         if (value.key == "ringing.alert.type")
  1021             if (value.key == "ringing.alert.type")
  1033             silentProfile = value.val == "silent";
  1022                 silentProfile = value.val == "silent";
  1034         else if (value.key == "vibrating.alert.enabled")
  1023             else if (value.key == "vibrating.alert.enabled")
  1035             vibratingAlertEnabled = value.val == "On";
  1024                 vibratingAlertEnabled = value.val == "On";
  1036         else if (value.key == "ringing.alert.volume")
  1025             else if (value.key == "ringing.alert.volume")
  1037             ringingAlertVolume = value.val.toInt();
  1026                 ringingAlertVolume = value.val.toInt();
  1038     }
  1027         }
  1039 
  1028         QSystemDeviceInfo::Profile newProfile = currentProfile();
  1040     QSystemDeviceInfo::Profile newProfile = currentProfile();
  1029         if (previousProfile != newProfile)
  1041     if (previousProfile != newProfile)
  1030            emit currentProfileChanged(newProfile);
  1042         emit currentProfileChanged(newProfile);
  1031     }
  1043 }
  1032 }
  1044 
  1033 
  1045 #endif
  1034 #endif
  1046 
  1035 
  1047 //////////////
  1036 //////////////