diff options
-rw-r--r-- | bin/rununittests.bat | 1 | ||||
-rwxr-xr-x | bin/rununittests.sh | 1 | ||||
-rw-r--r-- | doc/html/qsystemnetworkinfo-members.html | 2 | ||||
-rw-r--r-- | doc/html/qsystemnetworkinfo.html | 6 | ||||
-rw-r--r-- | doc/html/qt-mobility-library.index | 4 | ||||
-rw-r--r-- | doc/src/systeminfo.qdocconf | 106 | ||||
-rw-r--r-- | examples/sysinfo/dialog.cpp | 9 | ||||
-rw-r--r-- | systeminfo/qhalservice_linux.cpp | 69 | ||||
-rw-r--r-- | systeminfo/qhalservice_linux_p.h | 18 | ||||
-rw-r--r-- | systeminfo/qsysteminfo.cpp | 1660 | ||||
-rw-r--r-- | systeminfo/qsysteminfo.h | 2 | ||||
-rw-r--r-- | systeminfo/qsysteminfo_linux.cpp | 120 | ||||
-rw-r--r-- | systeminfo/qsysteminfo_linux_p.h | 6 | ||||
-rw-r--r-- | systeminfo/qsysteminfo_mac.cpp | 1025 | ||||
-rw-r--r-- | systeminfo/qsysteminfo_mac_p.h | 239 | ||||
-rw-r--r-- | systeminfo/qsysteminfo_win.cpp | 34 | ||||
-rw-r--r-- | systeminfo/qsysteminfo_win_p.h | 2 | ||||
-rw-r--r-- | systeminfo/systeminfo.pro | 15 | ||||
-rw-r--r-- | tests/auto/auto.pro | 3 | ||||
-rw-r--r-- | tests/auto/qsystemnetworkinfo/tst_qsystemnetworkinfo.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qsystemscreensaver/qsystemscreensaver.pro | 14 | ||||
-rw-r--r-- | tests/auto/qsystemscreensaver/tst_qsystemscreensaver.cpp | 101 |
22 files changed, 1932 insertions, 1517 deletions
diff --git a/bin/rununittests.bat b/bin/rununittests.bat index 8dc155e072..dcf7d36c8c 100644 --- a/bin/rununittests.bat +++ b/bin/rununittests.bat @@ -45,6 +45,7 @@ tst_qsystemdisplayinfo.exe tst_qsysteminfo.exe tst_qsystemmemoryinfo.exe tst_qsystemnetworkinfo.exe +tst_qsystemscreensaver.exe cd %SAVED_PWD% diff --git a/bin/rununittests.sh b/bin/rununittests.sh index 61cf217d9c..75dac6dac3 100755 --- a/bin/rununittests.sh +++ b/bin/rununittests.sh @@ -56,6 +56,7 @@ LD_LIBRARY_PATH=$shell_path/../lib:$LD_LIBRARY_PATH ./tst_qsysteminfo ./tst_qsystemmemoryinfo ./tst_qsystemnetworkinfo +./tst_qsystemscreensaver cd $SAVED_PWD diff --git a/doc/html/qsystemnetworkinfo-members.html b/doc/html/qsystemnetworkinfo-members.html index ca847b8c79..6ee4d9923e 100644 --- a/doc/html/qsystemnetworkinfo-members.html +++ b/doc/html/qsystemnetworkinfo-members.html @@ -61,7 +61,7 @@ <li><div class="fn"><b><a href="http://qt.nokia.com/doc/4.5/qobject.html#metaObject">metaObject</a></b> () const</div></li> <li><div class="fn"><b><a href="http://qt.nokia.com/doc/4.5/qobject.html#moveToThread">moveToThread</a></b> ( QThread * )</div></li> <li><div class="fn"><b><a href="qsystemnetworkinfo.html#networkModeChanged">networkModeChanged</a></b> ( QSystemNetworkInfo::NetworkMode )</div></li> -<li><div class="fn"><b><a href="qsystemnetworkinfo.html#networkName">networkName</a></b> () : QString</div></li> +<li><div class="fn"><b><a href="qsystemnetworkinfo.html#networkName">networkName</a></b> ( QSystemNetworkInfo::NetworkMode ) : QString</div></li> <li><div class="fn"><b><a href="qsystemnetworkinfo.html#networkNameChanged">networkNameChanged</a></b> ( QSystemNetworkInfo::NetworkMode, const QString & )</div></li> <li><div class="fn"><b><a href="qsystemnetworkinfo.html#networkSignalStrength">networkSignalStrength</a></b> ( QSystemNetworkInfo::NetworkMode ) : int</div></li> <li><div class="fn"><b><a href="qsystemnetworkinfo.html#networkSignalStrengthChanged">networkSignalStrengthChanged</a></b> ( QSystemNetworkInfo::NetworkMode, int )</div></li> diff --git a/doc/html/qsystemnetworkinfo.html b/doc/html/qsystemnetworkinfo.html index e7f8b51d71..4c7e435d75 100644 --- a/doc/html/qsystemnetworkinfo.html +++ b/doc/html/qsystemnetworkinfo.html @@ -63,7 +63,7 @@ <tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemnetworkinfo.html#homeMobileCountryCode">homeMobileCountryCode</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemnetworkinfo.html#homeMobileNetworkCode">homeMobileNetworkCode</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qsystemnetworkinfo.html#locationAreaCode">locationAreaCode</a></b> ()</td></tr> -<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemnetworkinfo.html#networkName">networkName</a></b> ()</td></tr> +<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemnetworkinfo.html#networkName">networkName</a></b> ( QSystemNetworkInfo::NetworkMode <i>mode</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qsystemnetworkinfo.html#networkSignalStrength">networkSignalStrength</a></b> ( QSystemNetworkInfo::NetworkMode <i>mode</i> )</td></tr> </table> <ul> @@ -139,8 +139,8 @@ <p>Returns the MAC address for the interface servicing the network <i>mode</i>.</p> <h3 class="fn"><a name="networkModeChanged"></a>void QSystemNetworkInfo::networkModeChanged ( <a href="qsystemnetworkinfo.html#NetworkMode-enum">QSystemNetworkInfo::NetworkMode</a> <i>mode</i> ) <tt> [signal]</tt></h3> <p>This signal is emitted whenever the network mode changes, specified by <i>mode</i>.</p> -<h3 class="fn"><a name="networkName"></a><a href="http://qt.nokia.com/doc/4.5/qstring.html">QString</a> QSystemNetworkInfo::networkName () <tt> [static]</tt></h3> -<p>Returns the name of the operator. For wlan this returns the network's current SSID. In the case of none such as a desktop, "No Operator".</p> +<h3 class="fn"><a name="networkName"></a><a href="http://qt.nokia.com/doc/4.5/qstring.html">QString</a> QSystemNetworkInfo::networkName ( <a href="qsystemnetworkinfo.html#NetworkMode-enum">QSystemNetworkInfo::NetworkMode</a> <i>mode</i> ) <tt> [static]</tt></h3> +<p>Returns the name of the operator for the network <i>mode</i>. For wlan this returns the network's current SSID. In the case of no network such as a desktop, "No Operator".</p> <h3 class="fn"><a name="networkNameChanged"></a>void QSystemNetworkInfo::networkNameChanged ( <a href="qsystemnetworkinfo.html#NetworkMode-enum">QSystemNetworkInfo::NetworkMode</a> <i>mode</i>, const <a href="http://qt.nokia.com/doc/4.5/qstring.html">QString</a> & <i>netName</i> ) <tt> [signal]</tt></h3> <p>This signal is emitted whenever the network <i>mode</i> name changes, specified by <i>netName</i>.</p> <h3 class="fn"><a name="networkSignalStrength"></a>int QSystemNetworkInfo::networkSignalStrength ( <a href="qsystemnetworkinfo.html#NetworkMode-enum">QSystemNetworkInfo::NetworkMode</a> <i>mode</i> ) <tt> [static]</tt></h3> diff --git a/doc/html/qt-mobility-library.index b/doc/html/qt-mobility-library.index index 6b10f49f6a..c2632641e3 100644 --- a/doc/html/qt-mobility-library.index +++ b/doc/html/qt-mobility-library.index @@ -333,7 +333,9 @@ <function access="public" threadsafety="unspecified" status="commendable" name="currentMobileNetworkCode" fullname="QSystemNetworkInfo::currentMobileNetworkCode" href="qsystemnetworkinfo.html#currentMobileNetworkCode" location="qsysteminfo.h" virtual="non" meta="plain" const="false" static="true" overload="false" type="QString" signature="currentMobileNetworkCode()"/> <function access="public" threadsafety="unspecified" status="commendable" name="homeMobileCountryCode" fullname="QSystemNetworkInfo::homeMobileCountryCode" href="qsystemnetworkinfo.html#homeMobileCountryCode" location="qsysteminfo.h" virtual="non" meta="plain" const="false" static="true" overload="false" type="QString" signature="homeMobileCountryCode()"/> <function access="public" threadsafety="unspecified" status="commendable" name="homeMobileNetworkCode" fullname="QSystemNetworkInfo::homeMobileNetworkCode" href="qsystemnetworkinfo.html#homeMobileNetworkCode" location="qsysteminfo.h" virtual="non" meta="plain" const="false" static="true" overload="false" type="QString" signature="homeMobileNetworkCode()"/> - <function access="public" threadsafety="unspecified" status="commendable" name="networkName" fullname="QSystemNetworkInfo::networkName" href="qsystemnetworkinfo.html#networkName" location="qsysteminfo.h" virtual="non" meta="plain" const="false" static="true" overload="false" type="QString" signature="networkName()"/> + <function access="public" threadsafety="unspecified" status="commendable" name="networkName" fullname="QSystemNetworkInfo::networkName" href="qsystemnetworkinfo.html#networkName" location="qsysteminfo.h" virtual="non" meta="plain" const="false" static="true" overload="false" type="QString" signature="networkName(QSystemNetworkInfo::NetworkMode mode)"> + <parameter left="QSystemNetworkInfo::NetworkMode" right="" name="mode" default=""/> + </function> <function access="public" threadsafety="unspecified" status="commendable" name="interfaceForMode" fullname="QSystemNetworkInfo::interfaceForMode" href="qsystemnetworkinfo.html#interfaceForMode" location="qsysteminfo.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="QNetworkInterface" signature="interfaceForMode(QSystemNetworkInfo::NetworkMode mode)"> <parameter left="QSystemNetworkInfo::NetworkMode" right="" name="mode" default=""/> </function> diff --git a/doc/src/systeminfo.qdocconf b/doc/src/systeminfo.qdocconf deleted file mode 100644 index 10eb5d214e..0000000000 --- a/doc/src/systeminfo.qdocconf +++ /dev/null @@ -1,106 +0,0 @@ -project = SystemInformation Library -description = System Information Library Reference Documentation - -imagedirs = images - -headerdirs = ../../systeminfo - -sourcedirs = ../../systeminfo \ - . - -sources.fileextensions = "*.qdoc *.cpp" - -outputdir = ../html - -indexes = qt.index - -extraimages.HTML = qtlogo \ - codeless - -versionsym = "SystemInfo API 1.0" - -base = file:./doc/html - -defines = Q_QDOC \ - __cplusplus - -Cpp.ignoretokens = QAXFACTORY_EXPORT \ - QM_EXPORT_CANVAS \ - QM_EXPORT_DNS \ - QM_EXPORT_DOM \ - QM_EXPORT_FTP \ - QM_EXPORT_HTTP \ - QM_EXPORT_ICONVIEW \ - QM_EXPORT_NETWORK \ - QM_EXPORT_OPENGL \ - QM_EXPORT_SQL \ - QM_EXPORT_TABLE \ - QM_EXPORT_WORKSPACE \ - QM_EXPORT_XML \ - QT_WIDGET_PLUGIN_EXPORT \ - Q_COMPAT_EXPORT \ - Q_CORE_EXPORT \ - Q_EXPLICIT \ - Q_EXPORT \ - Q_EXPORT_CODECS_CN \ - Q_EXPORT_CODECS_JP \ - Q_EXPORT_CODECS_KR \ - Q_EXPORT_PLUGIN \ - Q_GFX_INLINE \ - Q_GUI_EXPORT \ - Q_GUI_EXPORT_STYLE_CDE \ - Q_GUI_EXPORT_STYLE_COMPACT \ - Q_GUI_EXPORT_STYLE_MAC \ - Q_GUI_EXPORT_STYLE_MOTIF \ - Q_GUI_EXPORT_STYLE_MOTIFPLUS \ - Q_GUI_EXPORT_STYLE_PLATINUM \ - Q_GUI_EXPORT_STYLE_POCKETPC \ - Q_GUI_EXPORT_STYLE_SGI \ - Q_GUI_EXPORT_STYLE_WINDOWS \ - Q_GUI_EXPORT_STYLE_WINDOWSXP \ - Q_INLINE_TEMPLATE \ - Q_INVOKABLE \ - Q_NETWORK_EXPORT \ - Q_OPENGL_EXPORT \ - Q_OUTOFLINE_TEMPLATE \ - Q_SQL_EXPORT \ - Q_TYPENAME \ - Q_XML_EXPORT \ - QTUITEST_EXPORT - -Cpp.ignoredirectives = Q_DECLARE_INTERFACE \ - Q_DECLARE_OPERATORS_FOR_FLAGS \ - Q_DECLARE_USER_METATYPE \ - Q_DECLARE_USER_METATYPE_NO_OPERATORS \ - Q_DECLARE_PRIVATE \ - Q_DECLARE_PUBLIC \ - Q_DISABLE_COPY \ - Q_DECLARE_USER_METATYPE \ - Q_DECLARE_USER_METATYPE_NO_OPERATORS \ - Q_DUMMY_COMPARISON_OPERATOR \ - Q_ENUMS \ - Q_FLAGS \ - Q_INTERFACES \ - QT_MODULE \ - __attribute__ - -HTML.stylesheets = classic.css - -HTML.postheader = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n" \ - "<tr>\n" \ - "<td align=\"left\" valign=\"top\" width=\"32\">" \ - "<img src=\"images/qtlogo.png\" align=\"left\" border=\"0\" />" \ - "</td>\n" \ - "<td width=\"1\"> </td>" \ - "<td class=\"postheader\" valign=\"center\">" \ - "<a href=\"index.html\">" \ - "<font color=\"#004faf\">Home</font></a>" \ - "</td>\n" \ - "<td align=\"right\" valign=\"top\" width=\"230\"><img src=\"images/codeless.png\" border=\"0\" /></td></tr></table>" - -HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \ - "<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \ - "<td align=\"left\">Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \ - "<td align=\"right\"><div align=\"right\">System Information API</div></td>\n" \ - "</tr></table></div></address>" - diff --git a/examples/sysinfo/dialog.cpp b/examples/sysinfo/dialog.cpp index 25307dd246..6bde6591bd 100644 --- a/examples/sysinfo/dialog.cpp +++ b/examples/sysinfo/dialog.cpp @@ -13,11 +13,7 @@ Dialog::Dialog(QWidget *parent) : { ui->setupUi(this); setupGeneral(); -// setupDevice(); -// setupDisplay(); -// setupMemory(); -// setupNetwork(); -// setupSaver(); + connect(ui->tabWidget,SIGNAL(currentChanged(int)),this,SLOT(tabChanged(int))); connect(ui->versionComboBox,SIGNAL(activated(int)), this,SLOT(getVersion(int))); @@ -188,7 +184,6 @@ void Dialog::setupNetwork() ui->homeMMCLabel->setText(ni.homeMobileCountryCode()); ui->homeMNCLabel->setText(ni.homeMobileNetworkCode()); - ui->operatorNameLabel->setText(ni.networkName()); } void Dialog::netStatusComboActivated(int index) { @@ -235,6 +230,8 @@ void Dialog::netStatusComboActivated(int index) ui->signalLevelProgressBar->setValue(strength); ui->InterfaceLabel->setText(ni.interfaceForMode((QSystemNetworkInfo::NetworkMode)reIndex).humanReadableName()); + + ui->operatorNameLabel->setText(ni.networkName((QSystemNetworkInfo::NetworkMode)reIndex)); } void Dialog::getVersion(int index) diff --git a/systeminfo/qhalservice_linux.cpp b/systeminfo/qhalservice_linux.cpp index b56dd71246..b608e4c4df 100644 --- a/systeminfo/qhalservice_linux.cpp +++ b/systeminfo/qhalservice_linux.cpp @@ -110,6 +110,14 @@ QStringList QHalInterface::getAllDevices() return QStringList(); } +bool QHalInterface::deviceExists(const QString &path) +{ + QDBusReply< bool > reply = d->connectionInterface->call("DeviceExists", path); + if (!reply.isValid()) { + return reply.value(); + } + return false; +} ///////// class QHalDeviceInterfacePrivate @@ -223,6 +231,20 @@ bool QHalDeviceInterface::queryCapability(const QString &cap) return false; } + + +bool QHalDeviceInterface::propertyExists(const QString &prop) +{ + QDBusReply< bool > reply = d->connectionInterface->call("PropertyExists", prop); + if ( reply.isValid() ) { + return reply.value(); + } else { +// qDebug() << reply.error().message(); + } + return false; + +} + ///////// class QHalDeviceLaptopPanelInterfacePrivate @@ -280,3 +302,50 @@ void QHalDeviceLaptopPanelInterface::setBrightness(quint32 brightness) } } +//////////////// +class QHalDeviceKillSwitchInterfacePrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QHalDeviceKillSwitchInterface::QHalDeviceKillSwitchInterface(const QString &devicePathName, QObject *parent ) + : QObject(parent) +{ + d = new QHalDeviceKillSwitchInterfacePrivate(); + d->path = devicePathName; + d->connectionInterface = new QDBusInterface(HAL_DBUS_SERVICE, + d->path, + HAL_DEVICE_KILLSWITCH_INTERFACE, + dbusConnection); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qDebug() << "Could not find HalDeviceLaptopPanelInterface"; + return; + } else { + d->valid = true; + } +} + +QHalDeviceKillSwitchInterface::~QHalDeviceKillSwitchInterface() +{ + delete d->connectionInterface; + delete d; +} + +bool QHalDeviceKillSwitchInterface::isValid() +{ + return d->valid; +} + +quint32 QHalDeviceKillSwitchInterface::getPower() +{ + QDBusReply< qint32 > reply = d->connectionInterface->call("GetPower"); + if ( reply.isValid() ) { + qDebug() << __FUNCTION__ << reply.value(); + return reply.value(); + } + return -1; +} diff --git a/systeminfo/qhalservice_linux_p.h b/systeminfo/qhalservice_linux_p.h index 5a9724b553..47b9044cab 100644 --- a/systeminfo/qhalservice_linux_p.h +++ b/systeminfo/qhalservice_linux_p.h @@ -69,6 +69,7 @@ #define HAL_DEVICES_PATH "/org/freedesktop/Hal/devices" #define HAL_DEVICES_LAPTOPPANEL_INTERFACE "org.freedesktop.Hal.Device.LaptopPanel" +#define HAL_DEVICE_KILLSWITCH_INTERFACE "org.freedesktop.Hal.Device.KillSwitch" typedef struct halProp { QString propertyName; @@ -94,6 +95,7 @@ public: QDBusInterface *connectionInterface() const; QStringList findDeviceByCapability(const QString &cap); QStringList getAllDevices(); + bool deviceExists(const QString &path); private Q_SLOTS: private: @@ -118,6 +120,7 @@ public: bool queryCapability(const QString &cap); bool setConnections(); + bool propertyExists(const QString &); Q_SIGNALS: void propertyModified( int, QVariantList); @@ -144,4 +147,19 @@ private: QHalDeviceLaptopPanelInterfacePrivate *d; }; +class QHalDeviceKillSwitchInterfacePrivate; +class QHalDeviceKillSwitchInterface : public QObject +{ + Q_OBJECT + +public: + QHalDeviceKillSwitchInterface(const QString &devicePathName, QObject *parent = 0); + ~QHalDeviceKillSwitchInterface(); + bool isValid(); +public: + quint32 getPower(); //returns 1 if on + +private: + QHalDeviceKillSwitchInterfacePrivate *d; +}; #endif // diff --git a/systeminfo/qsysteminfo.cpp b/systeminfo/qsysteminfo.cpp index e92d9a7f81..70a1ad03e9 100644 --- a/systeminfo/qsysteminfo.cpp +++ b/systeminfo/qsysteminfo.cpp @@ -1,826 +1,834 @@ -/**************************************************************************** -** -** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** If you have questions regarding the use of this file, please -** contact Nokia at http://qt.nokia.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsysteminfo.h" - -#ifdef Q_OS_LINUX -#include "qsysteminfo_linux_p.h" -#endif -#ifdef Q_OS_WIN -#include "qsysteminfo_win_p.h" -#endif - -#include <QStringList> -#include <QSize> -#include <QFile> -#include <QTextStream> -#include <QLocale> -#include <QLibraryInfo> -#include <QApplication> -#include <QDesktopWidget> -#include <QDebug> - - -#include <locale.h> - -QT_BEGIN_NAMESPACE - - /*! - \class QSystemInfo - - \brief The QSystemInfo class provides access to various general information from the system. - - */ -/*! - \enum QSystemInfo::Version - This enum describes the version component. - - \value Os Operating system version / platform ID. - \value QtCore Qt libs version. - \value WrtCore Web runtime version. - \value Webkit Version of Webkit. - \value ServiceFramework version of Service Framework. - \value WrtExtensions version of Web runtime. - \value ServiceProvider Version of requested service provider. - \value NetscapePlugin Version of Netscap plugin. - \value WebApp Web Application identifier. - \value Firmware Version of (flashable) system as a whole. - - */ -/*! - \enum QSystemInfo::Feature - This enum describes the features of the device or computer. - - \value BluetoothFeature Bluetooth feature available. - \value CameraFeature Camera feature available. - \value FmradioFeature FM Radio feature available. - \value IrFeature Infrared feature available. - \value LedFeature LED's feature available. - \value MemcardFeature Memory card feature available. - \value UsbFeature Univeral System Bus (USB) feature available. - \value VibFeature Vibration feature available. - \value WlanFeature Wireless Local Area Network (WLAN) feature available. - \value SimFeature Subscriber Identity Module (SIM) available. - \value LocationFeature Global Positioning System (GPS) and/or other location feature available. - \value VideoOutFeature Video out feature available. - \value HapticsFeature Haptics feature available. - */ - - /*! - \class QSystemNetworkInfo - - \brief The QSystemNetworkInfo class provides access to network information from the system. - - */ -/*! - \enum QSystemNetworkInfo::NetworkStatus - This enum describes the status of the network connection: - - \value UndefinedStatus There is no network device, or error. - \value NoNetworkAvailable There is no network available. - \value EmergencyOnly Emergency calls only. - \value Searching Searching for or connecting with the network. - \value Busy Network is busy. - \value Connected Connected to newtwork. - \value HomeNetwork On Home Network. - \value Denied Network access denied. - \value Roaming On Roaming network. - - */ -/*! - \enum QSystemNetworkInfo::NetworkMode - This enum describes the type of network: - - \value UnknownMode Unknown network.or netowrk error. - \value GsmMode Global System for Mobile (GSM) network. - \value CdmaMode Code division multiple access (CDMA) network. - \value WcdmaMode Wideband Code Division Multiple Access (W-CDMA) network. - \value WlanMode Wireless Local Area Network (WLAN) network. - \value EthernetMode Wired Local Area network. - \value BluetoothMode Bluetooth network. - \value WimaxMode Wimax network. - - */ - -/*! - \class QSystemDisplayInfo - - \brief The QSystemDisplayInfo class provides access to display information from the system. - - */ - - /*! - \class QSystemMemoryInfo - - \brief The QSystemMemoryInfo class provides access to memory and disk information from the system. - - */ - -/*! - \enum QSystemMemoryInfo::VolumeType - This enum describes the type of drive or volume - - \value NoVolume Volume type undetermined. - \value Internal Is internal drive. - \value Removable Is removable. - \value Remote Is a network drive. - \value Cdrom Is a cd rom drive. -*/ - - -/*! - \class QSystemDeviceInfo - - \brief The QSystemDeviceInfo class provides access to device information from the system. - - */ -/*! - \fn void QSystemDeviceInfo::batteryLevelChanged(int level) - - This signal is emitted when battery level has changed. - \a level is the new level. - */ - -/*! - \fn void QSystemDeviceInfo::batteryStatusChanged(QSystemDeviceInfo::BatteryStatus status) - - This signal is emitted when battery status has changed. - \a status is the new status. - */ - - /*! - \fn void QSystemDeviceInfo::powerStateChanged(QSystemDeviceInfo::PowerState state) - - This signal is emitted when the power state has changed, such as when a phone gets plugged qint32o the wall. - \a state is the new power state. - */ - -/*! - \fn void QSystemDeviceInfo::currentProfileChanged(QSystemDeviceInfo::Profile profile) - - This signal is emitted whenever the network profile changes, specified by \a profile. -*/ - - -/*! - \enum QSystemDeviceInfo::BatteryStatus - This enum describes the status of the main battery. - - \value NoBatteryLevel Battery level undetermined. - \value BatteryCritical Battery level is critical 3% or less. - \value BatteryVeryLow Battery level is very low, 10% or less. - \value BatteryLow Battery level is low 40% or less. - \value BatteryNormal Battery level is above 40%. - - */ -/*! - \enum QSystemDeviceInfo::PowerState - This enum describes the power state: - - \value UnknownPower Power error. - \value BatteryPower On battery power. - \value WallPower On wall power. - - */ -/*! - \enum QSystemDeviceInfo::Profile - This enum describes the current operating profile of the device or computer. - - \value UnknownProfile Profile unknown or error. - \value SilentProfile Silent profile. - \value NormalProfile Normal profile. - \value LoudProfile Loud profile. - \value VibProfile Vibrate profile. - \value OfflineProfile Offline profile. - \value PowersaveProfile Powersave profile. - \value CustomProfile Custom profile. - - */ - -/*! - \enum QSystemDeviceInfo::SimStatus - This enum describes the status is the sim card or cards. - - \value SimNotAvailable SIM is not available on this device. - \value SingleAvailable One SIM card is available on this. - \value DualAvailable Two SIM cards are available on this device. - \value Locked Device has SIM lock enabled. -*/ - -/*! - \enum QSystemDeviceInfo::InputMethod - This enum describes the device method of user input. - - \value Keys Device has key/buttons. - \value Keypad Device has keypad (1,2,3, etc). - \value Keyboard Device has qwerty keyboard. - \value SingleTouch Device has single touch screen. - \value MultiTouch Device has muti touch screen. - \value Mouse Device has a mouse. -*/ - -/*! - \class QSystemScreenSaver - - \brief The QSystemScreenSaver class provides access to screen saver and blanking. - - */ - -/*! - \fn void QSystemInfo::currentLanguageChanged(const QString &lang) - - This signal is emitted whenever the current language changes, specified by \a lang, - which is in 2 letter, ISO 639-1 specification form. - */ - -/*! - \fn void QSystemNetworkInfo::networkStatusChanged(QSystemNetworkInfo::NetworkMode mode, QSystemNetworkInfo::NetworkStatus status) - - This signal is emitted whenever the network status of \a mode changes, specified by \a status. - */ - -/*! - \fn void QSystemNetworkInfo::networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode mode,int strength) - - This signal is emitted whenever the network \a mode signal strength changes, specified by \a strength. - */ - -/*! - \fn void QSystemNetworkInfo::currentMobileCountryCodeChanged(const QString &mcc) - - This signal is emitted whenever the Mobile Country Code changes, specified by \a mcc. -*/ - -/*! - \fn void QSystemNetworkInfo::currentMobileNetworkCodeChanged(const QString &mnc) - - This signal is emitted whenever the network Mobile Network Code changes, specified by \a mnc. -*/ - -/*! - \fn void QSystemNetworkInfo::networkNameChanged(QSystemNetworkInfo::NetworkMode mode,const QString & netName) - - This signal is emitted whenever the network \a mode name changes, specified by \a netName. - -*/ - -/*! - \fn void QSystemNetworkInfo::networkModeChanged(QSystemNetworkInfo::NetworkMode mode) - - This signal is emitted whenever the network mode changes, specified by \a mode. -*/ - -/*! - \fn void QSystemDeviceInfo::bluetoothStateChanged(bool on) - - This signal is emitted whenever bluetooth state changes, specified by \a on. -*/ - - /*! - Constructs a QSystemInfo object with the given \a parent. - */ -QSystemInfo::QSystemInfo(QObject *parent) -{ - d = new QSystemInfoPrivate(parent); - connect(d,SIGNAL(currentLanguageChanged(QString)), - this,SIGNAL(currentLanguageChanged(QString))); -} - -/*! - Destroys the QSystemInfo object -*/ -QSystemInfo::~QSystemInfo() -{ - delete d; -} - -/*! - Returns the current language in 2 letter ISO 639-1 format. - */ -QString QSystemInfo::currentLanguage() -{ - QSystemInfoPrivate dp; - return dp.currentLanguage(); -} -/*! - Returns a QStringList of available Qt language translations in 2 letter ISO 639-1 format. - If the Qt translations cannot be found, returns the current system language. - */ -QStringList QSystemInfo::availableLanguages() -{ - QSystemInfoPrivate dp; - return dp.availableLanguages(); -} - -/*! - Returns the version of QSystemInfo::Version \a type, - with optional platform dependent \a parameter as a string. - - Version will be returned in "major.minor.build" form. - - In case a particular version does not use the "build" part, it is set to 0. -If a particular element is not available at all, an error "Not Installed" will be returned by -the API. -*/ -QString QSystemInfo::version(QSystemInfo::Version type, const QString ¶meter) -{ - return d->version(type, parameter); -} - -/*! - Returns the 2 letter ISO 3166-1 for the current country code. -*/ -QString QSystemInfo::currentCountryCode() -{ - QSystemInfoPrivate dp; - return dp.currentCountryCode(); -} - -/*! - Returns true if the QSystemInfo::Feature \a feature is supported, otherwise false. -*/ - -bool QSystemInfo::hasFeatureSupported(QSystemInfo::Feature feature) -{ - return d->hasFeatureSupported(feature); -} - - /*! - Constructs a QSystemNetworkInfo object with the given \a parent. - */ -QSystemNetworkInfo::QSystemNetworkInfo(QObject *parent) -{ - d = new QSystemNetworkInfoPrivate(parent); - connect(d,SIGNAL(currentMobileCountryCodeChanged(QString)), - this,SIGNAL(currentMobileCountryCodeChanged(QString))); - connect(d,SIGNAL(currentMobileNetworkCodeChanged(QString)), - this,SIGNAL(currentMobileNetworkCodeChanged(QString))); - connect(d,SIGNAL(networkModeChanged(QSystemNetworkInfo::NetworkMode)), - this,SIGNAL(networkModeChanged(QSystemNetworkInfo::NetworkMode))); - connect(d,SIGNAL(networkNameChanged(QString)), - this,SIGNAL(networkNameChanged(QString))); - connect(d,SIGNAL(networkSignalStrengthChanged(int)), - this,SIGNAL(networkSignalStrengthChanged(int))); - connect(d,SIGNAL(networkStatusChanged(QSystemNetworkInfo::NetworkStatus)), - this,SIGNAL(networkStatusChanged(QSystemNetworkInfo::NetworkStatus))); -} - -/*! - Destroys the QSystemNetworkInfo object. - */ -QSystemNetworkInfo::~QSystemNetworkInfo() -{ - delete d; -} - -/*! - Returns the status of the network \a mode. -*/ -QSystemNetworkInfo::NetworkStatus QSystemNetworkInfo::networkStatus(QSystemNetworkInfo::NetworkMode mode) { - return d->networkStatus(mode); -} - -/*! - Returns the strength of the network signal, per network \a mode , 0 - 100 linear scaling, - or -1 in the case of unknown network mode or error. - - In the case of QSystemNetworkInfo::EthMode, it will either be 100 for carrier active, or 0 for when - there is no carrier or cable connected. -*/ -int QSystemNetworkInfo::networkSignalStrength(QSystemNetworkInfo::NetworkMode mode) -{ - QSystemNetworkInfoPrivate dnp; - return dnp.networkSignalStrength(mode); -} - -/*! - Returns the Cell ID of the connected tower or based station. -*/ -int QSystemNetworkInfo::cellId() -{ - QSystemNetworkInfoPrivate dnp; - return dnp.cellId(); -} - -/*! - Returns the Location Area Code. In the case of none such as a Desktop, "No Mobile Network." -*/ -int QSystemNetworkInfo::locationAreaCode() -{ - QSystemNetworkInfoPrivate dnp; - return dnp.locationAreaCode(); -} - - /*! - Returns the current Mobile Country Code. In the case of none such as a Desktop, "No Mobile Network." -/*/ -QString QSystemNetworkInfo::currentMobileCountryCode() -{ - QSystemNetworkInfoPrivate dnp; - return dnp.currentMobileCountryCode(); -} - -/*! - Returns the current Mobile Network Code. In the case of none such as a Desktop, "No Mobile Network." -*/ -QString QSystemNetworkInfo::currentMobileNetworkCode() -{ - QSystemNetworkInfoPrivate dnp; - return dnp.currentMobileNetworkCode(); -} - -/*! - Returns the home Mobile Network Code. In the case of none such as a Desktop, "No Mobile Network." -*/ -QString QSystemNetworkInfo::homeMobileCountryCode() -{ - QSystemNetworkInfoPrivate dnp; - return dnp.homeMobileCountryCode(); -} - -/*! - Returns the home Mobile Country Code. In the case of none such as a Desktop, "No Mobile Network." -*/ -QString QSystemNetworkInfo::homeMobileNetworkCode() -{ - QSystemNetworkInfoPrivate dnp; - return dnp.homeMobileNetworkCode(); -} - -/*! - Returns the name of the operator. For wlan this returns the network's current SSID. -In the case of none such as a desktop, "No Operator". -*/ -QString QSystemNetworkInfo::networkName() -{ - QSystemNetworkInfoPrivate dnp; - return dnp.networkName(); -} - -/*! - Returns the MAC address for the interface servicing the network \a mode. - */ -QString QSystemNetworkInfo::macAddress(QSystemNetworkInfo::NetworkMode mode) -{ - return d->macAddress(mode); -} - -/*! - Returns the first found QNetworkInterface for type \a mode. - */ -QNetworkInterface QSystemNetworkInfo::interfaceForMode(QSystemNetworkInfo::NetworkMode mode) -{ - return d->interfaceForMode(mode); -} - -// display - /*! - Constructs a QSystemDisplayInfo object. - */ -QSystemDisplayInfo::QSystemDisplayInfo() -{ -} - -/*! - Destroys the QSystemDisplayInfo object. - */ -QSystemDisplayInfo::~QSystemDisplayInfo() -{ -} - -/*! - Returns the display brightness of \a screen in %, 1 - 100 scale. - - Depending on platform, displayBrightness may not be available due to - differing hardware, software or driver implementation. In which case this - will return 0. - -*/ -int QSystemDisplayInfo::displayBrightness(int screen) -{ - QSystemDisplayInfoPrivate dp; - return dp.displayBrightness(screen); -} - -/*! - Returns the color depth of the screen \a screenNumber, in bits per pixel. -*/ -int QSystemDisplayInfo::colorDepth(int screenNumber) -{ - QSystemDisplayInfoPrivate dp; - return dp.colorDepth(screenNumber); -} - - /*! - Constructs a QSystemMemoryInfo object with the given \a parent. - */ -QSystemMemoryInfo::QSystemMemoryInfo(QObject *parent) -{ - d = new QSystemMemoryInfoPrivate(parent); -} - -/*! - Destroys the QSystemMemoryInfo object. -*/ -QSystemMemoryInfo::~QSystemMemoryInfo() -{ - delete d; -} - -/*! - Returns the amount of total space on the \a volumeDrive, - in bytes. -*/ -qlonglong QSystemMemoryInfo::totalDiskSpace(const QString &volumeDrive) -{ - return d->totalDiskSpace(volumeDrive); -} - -/*! - Returns the amount of available free space on the \a volumeDrive, -in bytes. -*/ -qlonglong QSystemMemoryInfo::availableDiskSpace(const QString &volumeDrive) -{ - return d->availableDiskSpace(volumeDrive); -} - -/*! - Returns a QStringList of volumes or partitions. -*/ -QStringList QSystemMemoryInfo::listOfVolumes() -{ - QSystemMemoryInfoPrivate dp; - return dp.listOfVolumes(); -} - -/*! - Returns the type of volume \a driveVolume -*/ -QSystemMemoryInfo::VolumeType QSystemMemoryInfo::volumeType(const QString &driveVolume) -{ - return d->volumeType(driveVolume); -} - -// device - /*! - Constructs a QSystemDeviceInfo with the given \a parent. - */ -QSystemDeviceInfo::QSystemDeviceInfo(QObject *parent) -{ - - d = new QSystemDeviceInfoPrivate(parent); - connect(d,SIGNAL(batteryLevelChanged(int)), - this,SIGNAL(batteryLevelChanged(int))); - - connect(d,SIGNAL(batteryStatusChanged(QSystemDeviceInfo::BatteryStatus)), - this,SIGNAL(batteryStatusChanged(QSystemDeviceInfo::BatteryStatus))); - - connect(d,SIGNAL(bluetoothStateChanged(bool)), - this,SIGNAL(bluetoothStateChanged(bool))); - - connect(d,SIGNAL(currentProfileChanged(QSystemDeviceInfo::Profile)), - this,SIGNAL(currentProfileChanged(QSystemDeviceInfo::Profile))); - - connect(d,SIGNAL(powerStateChanged(QSystemDeviceInfo::PowerState)), - this,SIGNAL(powerStateChanged(QSystemDeviceInfo::PowerState))); - } - -/*! - Destroys the QSystemDeviceInfo object. - */ -QSystemDeviceInfo::~QSystemDeviceInfo() -{ - delete d; -} - - -/*! - Returns the QSystemDeviceInfo::InputMethodFlags InputMethodType that the system uses. -*/ -QSystemDeviceInfo::InputMethodFlags QSystemDeviceInfo::inputMethodType() -{ - return d->inputMethodType(); -} -/*! - Returns the International Mobile Equipment Identity (IMEI), or a null QString in the case of none. -*/ -QString QSystemDeviceInfo::imei() -{ - QSystemDeviceInfoPrivate dip; - return dip.imei(); -} - -/*! - Returns the International Mobile Subscriber Identity (IMSI), or a null QString in the case of none. -*/ -QString QSystemDeviceInfo::imsi() -{ - QSystemDeviceInfoPrivate dip; - return dip.imsi(); -} - -/*! - Returns the name of the manufacturer of this device. In the case of desktops, the name of the vendor - of the motherboard. -*/ -QString QSystemDeviceInfo::manufacturer() -{ - QSystemDeviceInfoPrivate dip; - return dip.manufacturer(); -} - -/*! - Returns the model information of the device. In the case of desktops where no - model information is present, the CPU architect, such as i686, and machine type, such as Server, - Desktop or Laptop. -*/ -QString QSystemDeviceInfo::model() -{ - QSystemDeviceInfoPrivate dip; - return dip.model(); -} - -/*! - Returns the product name of the device. In the case where no product information is available, - -*/ -QString QSystemDeviceInfo::productName() -{ - QSystemDeviceInfoPrivate dip; - return dip.productName(); -} -/*! - Returns the battery charge level as percentage 1 - 100 scale. -*/ -int QSystemDeviceInfo::batteryLevel() const -{ - return d->batteryLevel(); -} - - /*! - Returns the battery charge status. -*/ -QSystemDeviceInfo::BatteryStatus QSystemDeviceInfo::batteryStatus() -{ - return d->batteryStatus(); -} - -/*! - Returns true if the battery is charging, otherwise false. -*/ -bool QSystemDeviceInfo::isBatteryCharging() -{ - return d->isBatteryCharging(); -} - -/*! - \property QSystemDeviceInfo::simStatus - \brief the status of the sim card. - Returns the QSystemDeviceInfo::simStatus status of SIM card. -*/ -QSystemDeviceInfo::SimStatus QSystemDeviceInfo::simStatus() -{ - return d->simStatus(); -} -/*! - Returns true if the device is locked, otherwise false. -*/ -bool QSystemDeviceInfo::isDeviceLocked() -{ - return d->isDeviceLocked(); -} - -/*! - \property QSystemDeviceInfo::currentProfile - \brief the device profile - Gets the current QSystemDeviceInfo::currentProfile device profile. -*/ -QSystemDeviceInfo::Profile QSystemDeviceInfo::currentProfile() -{ - return d->currentProfile(); -} - -/*! - \property QSystemDeviceInfo::currentPowerState - \brief the power state. - - Gets the current QSystemDeviceInfo::currentPowerState state. -*/ -QSystemDeviceInfo::PowerState QSystemDeviceInfo::currentPowerState() -{ -return d->currentPowerState(); -} - - -///// - /*! - Constructs a QSystemScreenSaver object with the given \a parent. - - On platforms where there is no one default screensaver mechanism, such as Linux, this class - may not be available. - */ -QSystemScreenSaver::QSystemScreenSaver(QObject *parent) -{ - d = new QSystemScreenSaverPrivate(parent); - screenSaverIsEnabled = screenSaverEnabled(); - screenBlankingIsEnabled = screenBlankingEnabled(); -} - -/*! - Destroys the QSystemScreenSaver object. - */ -QSystemScreenSaver::~QSystemScreenSaver() -{ - qWarning() << Q_FUNC_INFO; - if(screenSaverIsEnabled != screenSaverEnabled()) - setScreenSaverEnabled(screenSaverIsEnabled); - if(screenBlankingIsEnabled != screenBlankingEnabled()) - setScreenBlankingEnabled(screenBlankingIsEnabled); - delete d; -} - -/*! - Temporarily enables the screensaver if \a b is true, otherwise inhibits it. - - Will be reverted upon destruction of the QSystemScreenSaver object. - Returns true on success, otherwise false. - - On platforms that support it, if screensaver is secure by policy, the policy will be honored - and this will fail. -*/ -bool QSystemScreenSaver::setScreenSaverEnabled(bool b) -{ - return d->setScreenSaverEnabled(b); -} - -/*! - Temporarily enables the screen blanking on if \a b is true, otherwise inhibits it. - - Will be reverted upon destruction of the QSystemScreenSaver object. - Returns true on success, otherwise false. - - On platforms that support it, if screensaver is secure by policy, the policy will be honored - and this will fail. -*/ -bool QSystemScreenSaver::setScreenBlankingEnabled(bool b) -{ - return d->setScreenBlankingEnabled(b); -} - -/*! - Returns true if the screensaver is enabled, otherwise false. -*/ -bool QSystemScreenSaver::screenSaverEnabled() -{ - return d->screenSaverEnabled(); -} - -/*! - Returns true if screen blanking is enabled, otherwise false. -*/ -bool QSystemScreenSaver::screenBlankingEnabled() -{ - return d->screenBlankingEnabled(); -} - -/*! - Returns whether the systems screen lock is turned on. -*/ -bool QSystemScreenSaver::isScreenLockOn() -{ - QSystemScreenSaverPrivate dp; - return dp.isScreenLockOn(); -} - -QT_END_NAMESPACE +/****************************************************************************
+**
+** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please
+** contact Nokia at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsysteminfo.h"
+
+#ifdef Q_OS_LINUX
+#include "qsysteminfo_linux_p.h"
+#endif
+#ifdef Q_OS_WIN
+#include "qsysteminfo_win_p.h"
+#endif
+#ifdef Q_OS_MAC
+#include "qsysteminfo_mac_p.h"
+#endif
+
+#include <QStringList>
+#include <QSize>
+#include <QFile>
+#include <QTextStream>
+#include <QLocale>
+#include <QLibraryInfo>
+#include <QApplication>
+#include <QDesktopWidget>
+#include <QDebug>
+
+
+#include <locale.h>
+
+QT_BEGIN_NAMESPACE
+
+ /*!
+ \class QSystemInfo
+
+ \brief The QSystemInfo class provides access to various general information from the system.
+
+ */
+/*!
+ \enum QSystemInfo::Version
+ This enum describes the version component.
+
+ \value Os Operating system version / platform ID.
+ \value QtCore Qt libs version.
+ \value WrtCore Web runtime version.
+ \value Webkit Version of Webkit.
+ \value ServiceFramework version of Service Framework.
+ \value WrtExtensions version of Web runtime.
+ \value ServiceProvider Version of requested service provider.
+ \value NetscapePlugin Version of Netscap plugin.
+ \value WebApp Web Application identifier.
+ \value Firmware Version of (flashable) system as a whole.
+
+ */
+/*!
+ \enum QSystemInfo::Feature
+ This enum describes the features of the device or computer.
+
+ \value BluetoothFeature Bluetooth feature available.
+ \value CameraFeature Camera feature available.
+ \value FmradioFeature FM Radio feature available.
+ \value IrFeature Infrared feature available.
+ \value LedFeature LED's feature available.
+ \value MemcardFeature Memory card feature available.
+ \value UsbFeature Univeral System Bus (USB) feature available.
+ \value VibFeature Vibration feature available.
+ \value WlanFeature Wireless Local Area Network (WLAN) feature available.
+ \value SimFeature Subscriber Identity Module (SIM) available.
+ \value LocationFeature Global Positioning System (GPS) and/or other location feature available.
+ \value VideoOutFeature Video out feature available.
+ \value HapticsFeature Haptics feature available.
+ */
+
+ /*!
+ \class QSystemNetworkInfo
+
+ \brief The QSystemNetworkInfo class provides access to network information from the system.
+
+ */
+/*!
+ \enum QSystemNetworkInfo::NetworkStatus
+ This enum describes the status of the network connection:
+
+ \value UndefinedStatus There is no network device, or error.
+ \value NoNetworkAvailable There is no network available.
+ \value EmergencyOnly Emergency calls only.
+ \value Searching Searching for or connecting with the network.
+ \value Busy Network is busy.
+ \value Connected Connected to newtwork.
+ \value HomeNetwork On Home Network.
+ \value Denied Network access denied.
+ \value Roaming On Roaming network.
+
+ */
+/*!
+ \enum QSystemNetworkInfo::NetworkMode
+ This enum describes the type of network:
+
+ \value UnknownMode Unknown network.or netowrk error.
+ \value GsmMode Global System for Mobile (GSM) network.
+ \value CdmaMode Code division multiple access (CDMA) network.
+ \value WcdmaMode Wideband Code Division Multiple Access (W-CDMA) network.
+ \value WlanMode Wireless Local Area Network (WLAN) network.
+ \value EthernetMode Wired Local Area network.
+ \value BluetoothMode Bluetooth network.
+ \value WimaxMode Wimax network.
+
+ */
+
+/*!
+ \class QSystemDisplayInfo
+
+ \brief The QSystemDisplayInfo class provides access to display information from the system.
+
+ */
+
+ /*!
+ \class QSystemMemoryInfo
+
+ \brief The QSystemMemoryInfo class provides access to memory and disk information from the system.
+
+ */
+
+/*!
+ \enum QSystemMemoryInfo::VolumeType
+ This enum describes the type of drive or volume
+
+ \value NoVolume Volume type undetermined.
+ \value Internal Is internal drive.
+ \value Removable Is removable.
+ \value Remote Is a network drive.
+ \value Cdrom Is a cd rom drive.
+*/
+
+
+/*!
+ \class QSystemDeviceInfo
+
+ \brief The QSystemDeviceInfo class provides access to device information from the system.
+
+ */
+/*!
+ \fn void QSystemDeviceInfo::batteryLevelChanged(int level)
+
+ This signal is emitted when battery level has changed.
+ \a level is the new level.
+ */
+
+/*!
+ \fn void QSystemDeviceInfo::batteryStatusChanged(QSystemDeviceInfo::BatteryStatus status)
+
+ This signal is emitted when battery status has changed.
+ \a status is the new status.
+ */
+
+ /*!
+ \fn void QSystemDeviceInfo::powerStateChanged(QSystemDeviceInfo::PowerState state)
+
+ This signal is emitted when the power state has changed, such as when a phone gets plugged qint32o the wall.
+ \a state is the new power state.
+ */
+
+/*!
+ \fn void QSystemDeviceInfo::currentProfileChanged(QSystemDeviceInfo::Profile profile)
+
+ This signal is emitted whenever the network profile changes, specified by \a profile.
+*/
+
+
+/*!
+ \enum QSystemDeviceInfo::BatteryStatus
+ This enum describes the status of the main battery.
+
+ \value NoBatteryLevel Battery level undetermined.
+ \value BatteryCritical Battery level is critical 3% or less.
+ \value BatteryVeryLow Battery level is very low, 10% or less.
+ \value BatteryLow Battery level is low 40% or less.
+ \value BatteryNormal Battery level is above 40%.
+
+ */
+/*!
+ \enum QSystemDeviceInfo::PowerState
+ This enum describes the power state:
+
+ \value UnknownPower Power error.
+ \value BatteryPower On battery power.
+ \value WallPower On wall power.
+
+ */
+/*!
+ \enum QSystemDeviceInfo::Profile
+ This enum describes the current operating profile of the device or computer.
+
+ \value UnknownProfile Profile unknown or error.
+ \value SilentProfile Silent profile.
+ \value NormalProfile Normal profile.
+ \value LoudProfile Loud profile.
+ \value VibProfile Vibrate profile.
+ \value OfflineProfile Offline profile.
+ \value PowersaveProfile Powersave profile.
+ \value CustomProfile Custom profile.
+
+ */
+
+/*!
+ \enum QSystemDeviceInfo::SimStatus
+ This enum describes the status is the sim card or cards.
+
+ \value SimNotAvailable SIM is not available on this device.
+ \value SingleAvailable One SIM card is available on this.
+ \value DualAvailable Two SIM cards are available on this device.
+ \value Locked Device has SIM lock enabled.
+*/
+
+/*!
+ \enum QSystemDeviceInfo::InputMethod
+ This enum describes the device method of user input.
+
+ \value Keys Device has key/buttons.
+ \value Keypad Device has keypad (1,2,3, etc).
+ \value Keyboard Device has qwerty keyboard.
+ \value SingleTouch Device has single touch screen.
+ \value MultiTouch Device has muti touch screen.
+ \value Mouse Device has a mouse.
+*/
+
+/*!
+ \class QSystemScreenSaver
+
+ \brief The QSystemScreenSaver class provides access to screen saver and blanking.
+
+ */
+
+/*!
+ \fn void QSystemInfo::currentLanguageChanged(const QString &lang)
+
+ This signal is emitted whenever the current language changes, specified by \a lang,
+ which is in 2 letter, ISO 639-1 specification form.
+ */
+
+/*!
+ \fn void QSystemNetworkInfo::networkStatusChanged(QSystemNetworkInfo::NetworkMode mode, QSystemNetworkInfo::NetworkStatus status)
+
+ This signal is emitted whenever the network status of \a mode changes, specified by \a status.
+ */
+
+/*!
+ \fn void QSystemNetworkInfo::networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode mode,int strength)
+
+ This signal is emitted whenever the network \a mode signal strength changes, specified by \a strength.
+ */
+
+/*!
+ \fn void QSystemNetworkInfo::currentMobileCountryCodeChanged(const QString &mcc)
+
+ This signal is emitted whenever the Mobile Country Code changes, specified by \a mcc.
+*/
+
+/*!
+ \fn void QSystemNetworkInfo::currentMobileNetworkCodeChanged(const QString &mnc)
+
+ This signal is emitted whenever the network Mobile Network Code changes, specified by \a mnc.
+*/
+
+/*!
+ \fn void QSystemNetworkInfo::networkNameChanged(QSystemNetworkInfo::NetworkMode mode,const QString & netName)
+
+ This signal is emitted whenever the network \a mode name changes, specified by \a netName.
+
+*/
+
+/*!
+ \fn void QSystemNetworkInfo::networkModeChanged(QSystemNetworkInfo::NetworkMode mode)
+
+ This signal is emitted whenever the network mode changes, specified by \a mode.
+*/
+
+/*!
+ \fn void QSystemDeviceInfo::bluetoothStateChanged(bool on)
+
+ This signal is emitted whenever bluetooth state changes, specified by \a on.
+*/
+
+ /*!
+ Constructs a QSystemInfo object with the given \a parent.
+ */
+QSystemInfo::QSystemInfo(QObject *parent)
+{
+ d = new QSystemInfoPrivate(parent);
+ connect(d,SIGNAL(currentLanguageChanged(QString)),
+ this,SIGNAL(currentLanguageChanged(QString)));
+}
+
+/*!
+ Destroys the QSystemInfo object
+*/
+QSystemInfo::~QSystemInfo()
+{
+ delete d;
+}
+
+/*!
+ Returns the current language in 2 letter ISO 639-1 format.
+ */
+QString QSystemInfo::currentLanguage()
+{
+ QSystemInfoPrivate dp;
+ return dp.currentLanguage();
+}
+/*!
+ Returns a QStringList of available Qt language translations in 2 letter ISO 639-1 format.
+ If the Qt translations cannot be found, returns the current system language.
+ */
+QStringList QSystemInfo::availableLanguages()
+{
+ QSystemInfoPrivate dp;
+ return dp.availableLanguages();
+}
+
+/*!
+ Returns the version of QSystemInfo::Version \a type,
+ with optional platform dependent \a parameter as a string.
+
+ Version will be returned in "major.minor.build" form.
+
+ In case a particular version does not use the "build" part, it is set to 0.
+If a particular element is not available at all, an error "Not Installed" will be returned by
+the API.
+*/
+QString QSystemInfo::version(QSystemInfo::Version type, const QString ¶meter)
+{
+ return d->version(type, parameter);
+}
+
+/*!
+ Returns the 2 letter ISO 3166-1 for the current country code.
+*/
+QString QSystemInfo::currentCountryCode()
+{
+ QSystemInfoPrivate dp;
+ return dp.currentCountryCode();
+}
+
+/*!
+ Returns true if the QSystemInfo::Feature \a feature is supported, otherwise false.
+*/
+
+bool QSystemInfo::hasFeatureSupported(QSystemInfo::Feature feature)
+{
+ return d->hasFeatureSupported(feature);
+}
+
+ /*!
+ Constructs a QSystemNetworkInfo object with the given \a parent.
+ */
+QSystemNetworkInfo::QSystemNetworkInfo(QObject *parent)
+{
+ d = new QSystemNetworkInfoPrivate(parent);
+ connect(d,SIGNAL(currentMobileCountryCodeChanged(QString)),
+ this,SIGNAL(currentMobileCountryCodeChanged(QString)));
+
+ connect(d,SIGNAL(currentMobileNetworkCodeChanged(QString)),
+ this,SIGNAL(currentMobileNetworkCodeChanged(QString)));
+
+ connect(d,SIGNAL(networkModeChanged(QSystemNetworkInfo::NetworkMode)),
+ this,SIGNAL(networkModeChanged(QSystemNetworkInfo::NetworkMode)));
+
+ connect(d,SIGNAL(networkNameChanged(QSystemNetworkInfo::NetworkMode,QString)),
+ this,SIGNAL(networkNameChanged(QSystemNetworkInfo::NetworkMode,QString)));
+
+ connect(d,SIGNAL(networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode,int)),
+ this,SIGNAL(networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode,int)));
+
+ connect(d,SIGNAL(networkStatusChanged(QSystemNetworkInfo::NetworkMode,QSystemNetworkInfo::NetworkStatus)),
+ this,SIGNAL(networkStatusChanged(QSystemNetworkInfo::NetworkMode,QSystemNetworkInfo::NetworkStatus)));
+}
+
+/*!
+ Destroys the QSystemNetworkInfo object.
+ */
+QSystemNetworkInfo::~QSystemNetworkInfo()
+{
+ delete d;
+}
+
+/*!
+ Returns the status of the network \a mode.
+*/
+QSystemNetworkInfo::NetworkStatus QSystemNetworkInfo::networkStatus(QSystemNetworkInfo::NetworkMode mode) {
+ return d->networkStatus(mode);
+}
+
+/*!
+ Returns the strength of the network signal, per network \a mode , 0 - 100 linear scaling,
+ or -1 in the case of unknown network mode or error.
+
+ In the case of QSystemNetworkInfo::EthMode, it will either be 100 for carrier active, or 0 for when
+ there is no carrier or cable connected.
+*/
+int QSystemNetworkInfo::networkSignalStrength(QSystemNetworkInfo::NetworkMode mode)
+{
+ QSystemNetworkInfoPrivate dnp;
+ return dnp.networkSignalStrength(mode);
+}
+
+/*!
+ Returns the Cell ID of the connected tower or based station.
+*/
+int QSystemNetworkInfo::cellId()
+{
+ QSystemNetworkInfoPrivate dnp;
+ return dnp.cellId();
+}
+
+/*!
+ Returns the Location Area Code. In the case of none such as a Desktop, "No Mobile Network."
+*/
+int QSystemNetworkInfo::locationAreaCode()
+{
+ QSystemNetworkInfoPrivate dnp;
+ return dnp.locationAreaCode();
+}
+
+ /*!
+ Returns the current Mobile Country Code. In the case of none such as a Desktop, "No Mobile Network."
+/*/
+QString QSystemNetworkInfo::currentMobileCountryCode()
+{
+ QSystemNetworkInfoPrivate dnp;
+ return dnp.currentMobileCountryCode();
+}
+
+/*!
+ Returns the current Mobile Network Code. In the case of none such as a Desktop, "No Mobile Network."
+*/
+QString QSystemNetworkInfo::currentMobileNetworkCode()
+{
+ QSystemNetworkInfoPrivate dnp;
+ return dnp.currentMobileNetworkCode();
+}
+
+/*!
+ Returns the home Mobile Network Code. In the case of none such as a Desktop, "No Mobile Network."
+*/
+QString QSystemNetworkInfo::homeMobileCountryCode()
+{
+ QSystemNetworkInfoPrivate dnp;
+ return dnp.homeMobileCountryCode();
+}
+
+/*!
+ Returns the home Mobile Country Code. In the case of none such as a Desktop, "No Mobile Network."
+*/
+QString QSystemNetworkInfo::homeMobileNetworkCode()
+{
+ QSystemNetworkInfoPrivate dnp;
+ return dnp.homeMobileNetworkCode();
+}
+
+/*!
+ Returns the name of the operator for the network \a mode. For wlan this returns the network's current SSID.
+In the case of no network such as a desktop, "No Operator".
+*/
+QString QSystemNetworkInfo::networkName(QSystemNetworkInfo::NetworkMode mode)
+{
+ QSystemNetworkInfoPrivate dnp;
+ return dnp.networkName(mode);
+}
+
+/*!
+ Returns the MAC address for the interface servicing the network \a mode.
+ */
+QString QSystemNetworkInfo::macAddress(QSystemNetworkInfo::NetworkMode mode)
+{
+ return d->macAddress(mode);
+}
+
+/*!
+ Returns the first found QNetworkInterface for type \a mode.
+ */
+QNetworkInterface QSystemNetworkInfo::interfaceForMode(QSystemNetworkInfo::NetworkMode mode)
+{
+ return d->interfaceForMode(mode);
+}
+
+// display
+ /*!
+ Constructs a QSystemDisplayInfo object.
+ */
+QSystemDisplayInfo::QSystemDisplayInfo()
+{
+}
+
+/*!
+ Destroys the QSystemDisplayInfo object.
+ */
+QSystemDisplayInfo::~QSystemDisplayInfo()
+{
+}
+
+/*!
+ Returns the display brightness of \a screen in %, 1 - 100 scale.
+
+ Depending on platform, displayBrightness may not be available due to
+ differing hardware, software or driver implementation. In which case this
+ will return 0.
+
+*/
+int QSystemDisplayInfo::displayBrightness(int screen)
+{
+ QSystemDisplayInfoPrivate dp;
+ return dp.displayBrightness(screen);
+}
+
+/*!
+ Returns the color depth of the screen \a screenNumber, in bits per pixel.
+*/
+int QSystemDisplayInfo::colorDepth(int screenNumber)
+{
+ QSystemDisplayInfoPrivate dp;
+ return dp.colorDepth(screenNumber);
+}
+
+ /*!
+ Constructs a QSystemMemoryInfo object with the given \a parent.
+ */
+QSystemMemoryInfo::QSystemMemoryInfo(QObject *parent)
+{
+ d = new QSystemMemoryInfoPrivate(parent);
+}
+
+/*!
+ Destroys the QSystemMemoryInfo object.
+*/
+QSystemMemoryInfo::~QSystemMemoryInfo()
+{
+ delete d;
+}
+
+/*!
+ Returns the amount of total space on the \a volumeDrive,
+ in bytes.
+*/
+qlonglong QSystemMemoryInfo::totalDiskSpace(const QString &volumeDrive)
+{
+ return d->totalDiskSpace(volumeDrive);
+}
+
+/*!
+ Returns the amount of available free space on the \a volumeDrive,
+in bytes.
+*/
+qlonglong QSystemMemoryInfo::availableDiskSpace(const QString &volumeDrive)
+{
+ return d->availableDiskSpace(volumeDrive);
+}
+
+/*!
+ Returns a QStringList of volumes or partitions.
+*/
+QStringList QSystemMemoryInfo::listOfVolumes()
+{
+ QSystemMemoryInfoPrivate dp;
+ return dp.listOfVolumes();
+}
+
+/*!
+ Returns the type of volume \a driveVolume
+*/
+QSystemMemoryInfo::VolumeType QSystemMemoryInfo::volumeType(const QString &driveVolume)
+{
+ return d->volumeType(driveVolume);
+}
+
+// device
+ /*!
+ Constructs a QSystemDeviceInfo with the given \a parent.
+ */
+QSystemDeviceInfo::QSystemDeviceInfo(QObject *parent)
+{
+
+ d = new QSystemDeviceInfoPrivate(parent);
+ connect(d,SIGNAL(batteryLevelChanged(int)),
+ this,SIGNAL(batteryLevelChanged(int)));
+
+ connect(d,SIGNAL(batteryStatusChanged(QSystemDeviceInfo::BatteryStatus)),
+ this,SIGNAL(batteryStatusChanged(QSystemDeviceInfo::BatteryStatus)));
+
+ connect(d,SIGNAL(bluetoothStateChanged(bool)),
+ this,SIGNAL(bluetoothStateChanged(bool)));
+
+ connect(d,SIGNAL(currentProfileChanged(QSystemDeviceInfo::Profile)),
+ this,SIGNAL(currentProfileChanged(QSystemDeviceInfo::Profile)));
+
+ connect(d,SIGNAL(powerStateChanged(QSystemDeviceInfo::PowerState)),
+ this,SIGNAL(powerStateChanged(QSystemDeviceInfo::PowerState)));
+ }
+
+/*!
+ Destroys the QSystemDeviceInfo object.
+ */
+QSystemDeviceInfo::~QSystemDeviceInfo()
+{
+ delete d;
+}
+
+
+/*!
+ Returns the QSystemDeviceInfo::InputMethodFlags InputMethodType that the system uses.
+*/
+QSystemDeviceInfo::InputMethodFlags QSystemDeviceInfo::inputMethodType()
+{
+ return d->inputMethodType();
+}
+/*!
+ Returns the International Mobile Equipment Identity (IMEI), or a null QString in the case of none.
+*/
+QString QSystemDeviceInfo::imei()
+{
+ QSystemDeviceInfoPrivate dip;
+ return dip.imei();
+}
+
+/*!
+ Returns the International Mobile Subscriber Identity (IMSI), or a null QString in the case of none.
+*/
+QString QSystemDeviceInfo::imsi()
+{
+ QSystemDeviceInfoPrivate dip;
+ return dip.imsi();
+}
+
+/*!
+ Returns the name of the manufacturer of this device. In the case of desktops, the name of the vendor
+ of the motherboard.
+*/
+QString QSystemDeviceInfo::manufacturer()
+{
+ QSystemDeviceInfoPrivate dip;
+ return dip.manufacturer();
+}
+
+/*!
+ Returns the model information of the device. In the case of desktops where no
+ model information is present, the CPU architect, such as i686, and machine type, such as Server,
+ Desktop or Laptop.
+*/
+QString QSystemDeviceInfo::model()
+{
+ QSystemDeviceInfoPrivate dip;
+ return dip.model();
+}
+
+/*!
+ Returns the product name of the device. In the case where no product information is available,
+
+*/
+QString QSystemDeviceInfo::productName()
+{
+ QSystemDeviceInfoPrivate dip;
+ return dip.productName();
+}
+/*!
+ Returns the battery charge level as percentage 1 - 100 scale.
+*/
+int QSystemDeviceInfo::batteryLevel() const
+{
+ return d->batteryLevel();
+}
+
+ /*!
+ Returns the battery charge status.
+*/
+QSystemDeviceInfo::BatteryStatus QSystemDeviceInfo::batteryStatus()
+{
+ return d->batteryStatus();
+}
+
+/*!
+ Returns true if the battery is charging, otherwise false.
+*/
+bool QSystemDeviceInfo::isBatteryCharging()
+{
+ return d->isBatteryCharging();
+}
+
+/*!
+ \property QSystemDeviceInfo::simStatus
+ \brief the status of the sim card.
+ Returns the QSystemDeviceInfo::simStatus status of SIM card.
+*/
+QSystemDeviceInfo::SimStatus QSystemDeviceInfo::simStatus()
+{
+ return d->simStatus();
+}
+/*!
+ Returns true if the device is locked, otherwise false.
+*/
+bool QSystemDeviceInfo::isDeviceLocked()
+{
+ return d->isDeviceLocked();
+}
+
+/*!
+ \property QSystemDeviceInfo::currentProfile
+ \brief the device profile
+ Gets the current QSystemDeviceInfo::currentProfile device profile.
+*/
+QSystemDeviceInfo::Profile QSystemDeviceInfo::currentProfile()
+{
+ return d->currentProfile();
+}
+
+/*!
+ \property QSystemDeviceInfo::currentPowerState
+ \brief the power state.
+
+ Gets the current QSystemDeviceInfo::currentPowerState state.
+*/
+QSystemDeviceInfo::PowerState QSystemDeviceInfo::currentPowerState()
+{
+return d->currentPowerState();
+}
+
+
+/////
+ /*!
+ Constructs a QSystemScreenSaver object with the given \a parent.
+
+ On platforms where there is no one default screensaver mechanism, such as Linux, this class
+ may not be available.
+ */
+QSystemScreenSaver::QSystemScreenSaver(QObject *parent)
+{
+ d = new QSystemScreenSaverPrivate(parent);
+ screenSaverIsEnabled = screenSaverEnabled();
+ screenBlankingIsEnabled = screenBlankingEnabled();
+}
+
+/*!
+ Destroys the QSystemScreenSaver object.
+ */
+QSystemScreenSaver::~QSystemScreenSaver()
+{
+ qWarning() << Q_FUNC_INFO;
+ if(screenSaverIsEnabled != screenSaverEnabled())
+ setScreenSaverEnabled(screenSaverIsEnabled);
+ if(screenBlankingIsEnabled != screenBlankingEnabled())
+ setScreenBlankingEnabled(screenBlankingIsEnabled);
+ delete d;
+}
+
+/*!
+ Temporarily enables the screensaver if \a b is true, otherwise inhibits it.
+
+ Will be reverted upon destruction of the QSystemScreenSaver object.
+ Returns true on success, otherwise false.
+
+ On platforms that support it, if screensaver is secure by policy, the policy will be honored
+ and this will fail.
+*/
+bool QSystemScreenSaver::setScreenSaverEnabled(bool b)
+{
+ return d->setScreenSaverEnabled(b);
+}
+
+/*!
+ Temporarily enables the screen blanking on if \a b is true, otherwise inhibits it.
+
+ Will be reverted upon destruction of the QSystemScreenSaver object.
+ Returns true on success, otherwise false.
+
+ On platforms that support it, if screensaver is secure by policy, the policy will be honored
+ and this will fail.
+*/
+bool QSystemScreenSaver::setScreenBlankingEnabled(bool b)
+{
+ return d->setScreenBlankingEnabled(b);
+}
+
+/*!
+ Returns true if the screensaver is enabled, otherwise false.
+*/
+bool QSystemScreenSaver::screenSaverEnabled()
+{
+ return d->screenSaverEnabled();
+}
+
+/*!
+ Returns true if screen blanking is enabled, otherwise false.
+*/
+bool QSystemScreenSaver::screenBlankingEnabled()
+{
+ return d->screenBlankingEnabled();
+}
+
+/*!
+ Returns whether the systems screen lock is turned on.
+*/
+bool QSystemScreenSaver::isScreenLockOn()
+{
+ QSystemScreenSaverPrivate dp;
+ return dp.isScreenLockOn();
+}
+
+QT_END_NAMESPACE
diff --git a/systeminfo/qsysteminfo.h b/systeminfo/qsysteminfo.h index 76adf039db..025561838c 100644 --- a/systeminfo/qsysteminfo.h +++ b/systeminfo/qsysteminfo.h @@ -169,7 +169,7 @@ public: static QString currentMobileNetworkCode(); //signal static QString homeMobileCountryCode(); static QString homeMobileNetworkCode(); - static QString networkName(); //signal + static QString networkName(QSystemNetworkInfo::NetworkMode mode); //signal /*static*/ QNetworkInterface interfaceForMode(QSystemNetworkInfo::NetworkMode mode); // networkmode change //signal diff --git a/systeminfo/qsysteminfo_linux.cpp b/systeminfo/qsysteminfo_linux.cpp index 0c4967b25f..62aae66802 100644 --- a/systeminfo/qsysteminfo_linux.cpp +++ b/systeminfo/qsysteminfo_linux.cpp @@ -322,11 +322,22 @@ bool QSystemInfoPrivate::hasFeatureSupported(QSystemInfo::Feature feature) case QSystemInfo::BluetoothFeature : { #if !defined(QT_NO_DBUS) - featureSupported = hasHalDeviceFeature("bluetooth"); - if(featureSupported) - return featureSupported; -#endif + QHalInterface iface; + + QStringList list = iface.getAllDevices(); + if(!list.isEmpty()) { + foreach(QString dev, list) { + QHalDeviceInterface *halIfaceDevice = new QHalDeviceInterface(dev); + if (halIfaceDevice->isValid()) { + return halIfaceDevice->propertyExists("bluetooth_hci.originating_device"); + return true; + } + } + } + +#else featureSupported = hasSysFeature("bluetooth"); +#endif } break; case QSystemInfo::CameraFeature : @@ -459,7 +470,6 @@ QSystemNetworkInfoPrivate::QSystemNetworkInfoPrivate(QObject *parent) QSystemNetworkInfoPrivate::~QSystemNetworkInfoPrivate() { - qWarning() << Q_FUNC_INFO; } QSystemNetworkInfo::NetworkStatus QSystemNetworkInfoPrivate::networkStatus(QSystemNetworkInfo::NetworkMode mode) @@ -602,46 +612,60 @@ QString QSystemNetworkInfoPrivate::homeMobileNetworkCode() return "No Mobile Network"; } -QString QSystemNetworkInfoPrivate::networkName() +QString QSystemNetworkInfoPrivate::networkName(QSystemNetworkInfo::NetworkMode mode) { - QString essid; - if(networkStatus(QSystemNetworkInfo::WlanMode) != QSystemNetworkInfo::Connected) { - return essid; - } - QString wlanInterface; - QString baseSysDir = "/sys/class/net/"; - QDir wDir(baseSysDir); - QStringList dirs = wDir.entryList(QStringList() << "*", QDir::AllDirs | QDir::NoDotAndDotDot); - foreach(QString dir, dirs) { - QString devFile = baseSysDir + dir; - QFileInfo fi(devFile + "/wireless"); - if(fi.exists()) { - wlanInterface = dir; - qWarning() << "interface is" << wlanInterface; - } - } - int sock = socket(PF_INET, SOCK_DGRAM, 0); - if (sock > 0) { - const char* someRandomBuffer[IW_ESSID_MAX_SIZE + 1]; - struct iwreq wifiExchange; - memset(&wifiExchange, 0, sizeof(wifiExchange)); - memset(someRandomBuffer, 0, sizeof(someRandomBuffer)); - - wifiExchange.u.essid.pointer = (caddr_t) someRandomBuffer; - wifiExchange.u.essid.length = IW_ESSID_MAX_SIZE; - wifiExchange.u.essid.flags = 0; + QString netname = "No network available"; - const char* interfaceName = wlanInterface.toLatin1(); - strncpy(wifiExchange.ifr_name, interfaceName, IFNAMSIZ); - wifiExchange.u.essid.length = IW_ESSID_MAX_SIZE + 1; + switch(mode) { + case QSystemNetworkInfo::WlanMode: + { + if(networkStatus(mode) != QSystemNetworkInfo::Connected) { + return netname; + } - if (ioctl(sock, SIOCGIWESSID, &wifiExchange) == 0) { - const char *ssid = (const char *)wifiExchange.u.essid.pointer; - essid = ssid; + QString wlanInterface; + QString baseSysDir = "/sys/class/net/"; + QDir wDir(baseSysDir); + QStringList dirs = wDir.entryList(QStringList() << "*", QDir::AllDirs | QDir::NoDotAndDotDot); + foreach(QString dir, dirs) { + QString devFile = baseSysDir + dir; + QFileInfo fi(devFile + "/wireless"); + if(fi.exists()) { + wlanInterface = dir; + qWarning() << "interface is" << wlanInterface; + } + } + int sock = socket(PF_INET, SOCK_DGRAM, 0); + if (sock > 0) { + const char* someRandomBuffer[IW_ESSID_MAX_SIZE + 1]; + struct iwreq wifiExchange; + memset(&wifiExchange, 0, sizeof(wifiExchange)); + memset(someRandomBuffer, 0, sizeof(someRandomBuffer)); + + wifiExchange.u.essid.pointer = (caddr_t) someRandomBuffer; + wifiExchange.u.essid.length = IW_ESSID_MAX_SIZE; + wifiExchange.u.essid.flags = 0; + + const char* interfaceName = wlanInterface.toLatin1(); + strncpy(wifiExchange.ifr_name, interfaceName, IFNAMSIZ); + wifiExchange.u.essid.length = IW_ESSID_MAX_SIZE + 1; + + if (ioctl(sock, SIOCGIWESSID, &wifiExchange) == 0) { + const char *ssid = (const char *)wifiExchange.u.essid.pointer; + netname = ssid; + } + } + close(sock); } - } - close(sock); - return essid; + break; + case QSystemNetworkInfo::EthernetMode: + { + } + break; + default: + break; + }; + return netname; } QString QSystemNetworkInfoPrivate::macAddress(QSystemNetworkInfo::NetworkMode mode) @@ -985,20 +1009,20 @@ void QSystemDeviceInfoPrivate::setConnection() } } } - - } #endif + } } QSystemDeviceInfoPrivate::~QSystemDeviceInfoPrivate() { } +#if !defined(QT_NO_DBUS) void QSystemDeviceInfoPrivate::halChanged(int,QVariantList map) { for(int i=0; i < map.count(); i++) { -// qWarning() << map.at(i).toString(); - if(map.at(i).toString() == "battery.charge_level.percentage") { +// qWarning() << __FUNCTION__ << map.at(i).toString(); + if(map.at(i).toString() == "battery.charge_level.percentage") { int level = batteryLevel(); emit batteryLevelChanged(level); if(level < 4) { @@ -1020,7 +1044,7 @@ void QSystemDeviceInfoPrivate::halChanged(int,QVariantList map) } } //end map } - +#endif QSystemDeviceInfo::Profile QSystemDeviceInfoPrivate::currentProfile() { @@ -1446,6 +1470,10 @@ bool QSystemDeviceInfoPrivate::isDeviceLocked() whichWMRunning(); } + QSystemScreenSaverPrivate::~QSystemScreenSaverPrivate() + { + } + bool QSystemScreenSaverPrivate::setScreenSaverEnabled(bool state) { if(kdeIsRunning || gnomeIsRunning) { diff --git a/systeminfo/qsysteminfo_linux_p.h b/systeminfo/qsysteminfo_linux_p.h index 1e66226740..72ddc322bf 100644 --- a/systeminfo/qsysteminfo_linux_p.h +++ b/systeminfo/qsysteminfo_linux_p.h @@ -120,7 +120,7 @@ public: QString homeMobileCountryCode(); QString homeMobileNetworkCode(); - QString networkName(); + QString networkName(QSystemNetworkInfo::NetworkMode mode); QString macAddress(QSystemNetworkInfo::NetworkMode mode); QNetworkInterface interfaceForMode(QSystemNetworkInfo::NetworkMode mode); @@ -178,7 +178,7 @@ class QSystemDeviceInfoPrivate : public QObject public: QSystemDeviceInfoPrivate(QObject *parent = 0); - virtual ~QSystemDeviceInfoPrivate(); + ~QSystemDeviceInfoPrivate(); // device @@ -211,7 +211,6 @@ Q_SIGNALS: private: #if !defined(QT_NO_DBUS) - QHalInterface *halIface; QHalDeviceInterface *halIfaceDevice; @@ -227,6 +226,7 @@ class QSystemScreenSaverPrivate : public QObject public: QSystemScreenSaverPrivate(QObject *parent = 0); + ~QSystemScreenSaverPrivate(); bool screenSaverEnabled(); bool screenBlankingEnabled(); diff --git a/systeminfo/qsysteminfo_mac.cpp b/systeminfo/qsysteminfo_mac.cpp index 2c5f951346..d3400be893 100644 --- a/systeminfo/qsysteminfo_mac.cpp +++ b/systeminfo/qsysteminfo_mac.cpp @@ -1,504 +1,521 @@ -/**************************************************************************** -** -** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** If you have questions regarding the use of this file, please -** contact Nokia at http://qt.nokia.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qsysteminfo.h" -#include "qsysteminfo_p.h" - -#include <QStringList> -#include <QSize> -#include <QFile> -#include <QTextStream> -#include <QLocale> -#include <QLibraryInfo> -#include <QApplication> -#include <QDesktopWidget> -#include <QDebug> -#include <QSettings> -#include <QSysInfo> -#include <QNetworkInterface> -#include <QList> -#include <QSettings> -#include <QDir> -#include <QNetworkInterface> -#include <QString> - -#include <locale.h> - -//////// -QSystemInfoPrivate::QSystemInfoPrivate(QObject *parent) - : QObject(parent) -{ -} - -QSystemInfoPrivate::~QSystemInfoPrivate() -{ - -} - -// 2 letter ISO 639-1 -QString QSystemInfoPrivate::currentLanguage() const -{ - QString lang = QLocale::system().name().left(2); - if(lang.isEmpty() || lang == "C") { - lang = "en"; - } - return lang; -} - -// 2 letter ISO 639-1 -QStringList QSystemInfoPrivate::availableLanguages() const -{ - - return QStringList() << currentLanguage(); -} - -// "major.minor.build" format. -QString QSystemInfoPrivate::version(QSystemInfo::Version type, const QString ¶meter) -{ - Q_UNUSED(parameter); - QString errorStr = "Not Available"; - bool useDate = false; - if(parameter == "versionDate") { - useDate = true; - } - switch(type) { - case QSystemInfo::Os : - { - - } - break; - case QSystemInfo::QtCore : - return qVersion(); - break; - case QSystemInfo::WrtCore : - { - } - break; - case QSystemInfo::Webkit : - { - } - break; - case QSystemInfo::ServiceFramework : - { - } - break; - case QSystemInfo::WrtExtensions : - { - } - break; - case QSystemInfo::ServiceProvider : - { - } - break; - case QSystemInfo::NetscapePlugin : - { - } - break; - case QSystemInfo::WebApp : - { - } - break; - case QSystemInfo::Firmware : - { - } - break; - }; - return errorStr; -} - - -//2 letter ISO 3166-1 -QString QSystemInfoPrivate::currentCountryCode() const -{ - return QLocale::system().name().mid(3,2); -} - - -bool QSystemInfoPrivate::hasFeatureSupported(QSystemInfo::Feature feature) -{ - bool featureSupported = false; - switch (feature) { - case QSystemInfo::BluetoothFeature : - { - - } - break; - case QSystemInfo::CameraFeature : - { - - } - break; - case QSystemInfo::FmradioFeature : - { - - } - break; - case QSystemInfo::IrFeature : - { - - } - break; - case QSystemInfo::LedFeature : - { - - } - break; - case QSystemInfo::MemcardFeature : - { - - } - break; - case QSystemInfo::UsbFeature : - { - - } - break; - case QSystemInfo::VibFeature : - { - - } - break; - case QSystemInfo::WlanFeature : - { - - } - break; - case QSystemInfo::SimFeature : - { - - } - break; - case QSystemInfo::LocationFeature : - { - - } - break; - case QSystemInfo::VideoOutFeature : - { - - } - break; - case QSystemInfo::HapticsFeature: - break; - default: - featureSupported = false; - break; - }; - return featureSupported; -} - -//////// QSystemNetworkInfo -QSystemNetworkInfoPrivate::QSystemNetworkInfoPrivate(QObject *parent) - : QObject(parent) -{ -} - -QSystemNetworkInfoPrivate::~QSystemNetworkInfoPrivate() -{ -} - -QSystemNetworkInfo::NetworkStatus QSystemNetworkInfoPrivate::networkStatus(QSystemNetworkInfo::NetworkMode mode) -{ - switch(mode) { - case QSystemNetworkInfo::GsmMode: - break; - case QSystemNetworkInfo::CdmaMode: - break; - case QSystemNetworkInfo::WcdmaMode: - break; - case QSystemNetworkInfo::WlanMode: - { - - } - break; - case QSystemNetworkInfo::EthernetMode: - { - - } - break; - case QSystemNetworkInfo::BluetoothMode: - { - - } - break; - case QSystemNetworkInfo::WimaxMode: - break; - }; - return QSystemNetworkInfo::NoNetworkAvailable; -} - -int QSystemNetworkInfoPrivate::networkSignalStrength(QSystemNetworkInfo::NetworkMode mode) -{ - switch(mode) { - case QSystemNetworkInfo::GsmMode: - break; - case QSystemNetworkInfo::CdmaMode: - break; - case QSystemNetworkInfo::WcdmaMode: - break; - case QSystemNetworkInfo::WlanMode: - { - - } - break; - case QSystemNetworkInfo::EthernetMode: - { - - - } - break; - case QSystemNetworkInfo::BluetoothMode: - break; - case QSystemNetworkInfo::WimaxMode: - break; - }; - return -1; -} - -int QSystemNetworkInfoPrivate::cellId() -{ - return -1; -} - -int QSystemNetworkInfoPrivate::locationAreaCode() -{ - return -1; -} - -// Mobile Country Code -QString QSystemNetworkInfoPrivate::currentMobileCountryCode() -{ - return "No Network"; -} - -// Mobile Network Code -QString QSystemNetworkInfoPrivate::currentMobileNetworkCode() -{ - return "No Network"; -} - -QString QSystemNetworkInfoPrivate::homeMobileCountryCode() -{ - return "No Network"; -} - -QString QSystemNetworkInfoPrivate::homeMobileNetworkCode() -{ - return "No Network"; -} - -QString QSystemNetworkInfoPrivate::operatorName() -{ - return "No Operator"; -} - -QString QSystemNetworkInfoPrivate::wlanSsid() -{ - QString essid; - - return essid; -} - -QString QSystemNetworkInfoPrivate::macAddress(QSystemNetworkInfo::NetworkMode mode) -{ - return interfaceForMode(mode).hardwareAddress(); -} - -QNetworkInterface QSystemNetworkInfoPrivate::interfaceForMode(QSystemNetworkInfo::NetworkMode mode) -{ - - return QNetworkInterface(); -} - -//////// QSystemDisplayInfo -QSystemDisplayInfoPrivate::QSystemDisplayInfoPrivate(QObject *parent) - : QObject(parent) -{ -} - -QSystemDisplayInfoPrivate::~QSystemDisplayInfoPrivate() -{ -} - -int QSystemDisplayInfoPrivate::displayBrightness(int screen) -{ - return -1; -} - -int QSystemDisplayInfoPrivate::colorDepth(int screen) -{ - int bpp; - return bpp; -} - -//////// QSystemMemoryInfo -QSystemMemoryInfoPrivate::QSystemMemoryInfoPrivate(QObject *parent) - : QObject(parent) -{ -} - - -QSystemMemoryInfoPrivate::~QSystemMemoryInfoPrivate() -{ -} - -qint64 QSystemMemoryInfoPrivate::availableDiskSpace(const QString &driveVolume) -{ - qint64 totalFreeBytes; -} - -qint64 QSystemMemoryInfoPrivate::totalDiskSpace(const QString &driveVolume) -{ - qint64 totalBytes; - return totalBytes; -} - -QSystemMemoryInfo::VolumeType QSystemMemoryInfoPrivate::volumeType(const QString &driveVolume) -{ - return QSystemMemoryInfo::NoVolume; -} - -QStringList QSystemMemoryInfoPrivate::listOfVolumes() -{ - QStringList drivesList; - return drivesList; -} - -//////// QSystemDeviceInfo -QSystemDeviceInfoPrivate::QSystemDeviceInfoPrivate(QObject *parent) - : QObject(parent) -{ -} - -QSystemDeviceInfoPrivate::~QSystemDeviceInfoPrivate() -{ -} - -QSystemDeviceInfo::Profile QSystemDeviceInfoPrivate::currentProfile() -{ - return QSystemDeviceInfo::UnknownProfile; -} - -QSystemDeviceInfo::InputMethodFlags QSystemDeviceInfoPrivate::inputMethodType() -{ - QSystemDeviceInfo::InputMethodFlags methods; - return methods; -} - - -QSystemDeviceInfo::PowerState QSystemDeviceInfoPrivate::currentPowerState() -{ -return QSystemDeviceInfo::UnknownPower; -} - -QString QSystemDeviceInfoPrivate::imei() -{ - return "Sim Not Available"; -} - -QString QSystemDeviceInfoPrivate::imsi() -{ - return "Sim Not Available"; -} - -QString QSystemDeviceInfoPrivate::manufacturer() -{ - return manu; -} - -QString QSystemDeviceInfoPrivate::model() -{ - return model; -} - -QString QSystemDeviceInfoPrivate::productName() -{ - - return name; -} - -bool QSystemDeviceInfoPrivate::isBatteryCharging() -{ - return isCharging; -} - -int QSystemDeviceInfoPrivate::batteryLevel() const -{ - return 0; -} - -QSystemDeviceInfo::SimStatus QSystemDeviceInfoPrivate::simStatus() -{ - return QSystemDeviceInfo::SimNotAvailable; -} - -bool QSystemDeviceInfoPrivate::isDeviceLocked() -{ - return false; -} - -////////////// -/////// -QSystemScreenSaverPrivate::QSystemScreenSaverPrivate(QObject *parent) - : QObject(parent) -{ -} - - -bool QSystemScreenSaverPrivate::setScreenSaverEnabled(bool state) -{ -} - -bool QSystemScreenSaverPrivate::setScreenBlankingEnabled(bool state) -{ - return false; -} - -bool QSystemScreenSaverPrivate::screenSaverEnabled() -{ - - return false; -} - -bool QSystemScreenSaverPrivate::screenBlankingEnabled() -{ - return false; -} - -bool QSystemScreenSaverPrivate::isScreenLockOn() -{ - - return false; -} - - -QT_END_NAMESPACE +/****************************************************************************
+**
+** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please
+** contact Nokia at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qsysteminfo.h"
+#include "qsysteminfo_mac_p.h"
+
+#include <QStringList>
+#include <QSize>
+#include <QFile>
+#include <QTextStream>
+#include <QLocale>
+#include <QLibraryInfo>
+#include <QApplication>
+#include <QDesktopWidget>
+#include <QDebug>
+#include <QSettings>
+#include <QSysInfo>
+#include <QNetworkInterface>
+#include <QList>
+#include <QSettings>
+#include <QDir>
+#include <QNetworkInterface>
+#include <QString>
+
+#include <locale.h>
+
+////////
+QSystemInfoPrivate::QSystemInfoPrivate(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QSystemInfoPrivate::~QSystemInfoPrivate()
+{
+
+}
+
+// 2 letter ISO 639-1
+QString QSystemInfoPrivate::currentLanguage() const
+{
+ QString lang = QLocale::system().name().left(2);
+ if(lang.isEmpty() || lang == "C") {
+ lang = "en";
+ }
+ return lang;
+}
+
+// 2 letter ISO 639-1
+QStringList QSystemInfoPrivate::availableLanguages() const
+{
+
+ return QStringList() << currentLanguage();
+}
+
+// "major.minor.build" format.
+QString QSystemInfoPrivate::version(QSystemInfo::Version type, const QString ¶meter)
+{
+ Q_UNUSED(parameter);
+ QString errorStr = "Not Available";
+ bool useDate = false;
+ if(parameter == "versionDate") {
+ useDate = true;
+ }
+ switch(type) {
+ case QSystemInfo::Os :
+ {
+
+ }
+ break;
+ case QSystemInfo::QtCore :
+ return qVersion();
+ break;
+ case QSystemInfo::WrtCore :
+ {
+ }
+ break;
+ case QSystemInfo::Webkit :
+ {
+ }
+ break;
+ case QSystemInfo::ServiceFramework :
+ {
+ }
+ break;
+ case QSystemInfo::WrtExtensions :
+ {
+ }
+ break;
+ case QSystemInfo::ServiceProvider :
+ {
+ }
+ break;
+ case QSystemInfo::NetscapePlugin :
+ {
+ }
+ break;
+ case QSystemInfo::WebApp :
+ {
+ }
+ break;
+ case QSystemInfo::Firmware :
+ {
+ }
+ break;
+ };
+ return errorStr;
+}
+
+
+//2 letter ISO 3166-1
+QString QSystemInfoPrivate::currentCountryCode() const
+{
+ return QLocale::system().name().mid(3,2);
+}
+
+
+bool QSystemInfoPrivate::hasFeatureSupported(QSystemInfo::Feature feature)
+{
+ bool featureSupported = false;
+ switch (feature) {
+ case QSystemInfo::BluetoothFeature :
+ {
+
+ }
+ break;
+ case QSystemInfo::CameraFeature :
+ {
+
+ }
+ break;
+ case QSystemInfo::FmradioFeature :
+ {
+
+ }
+ break;
+ case QSystemInfo::IrFeature :
+ {
+
+ }
+ break;
+ case QSystemInfo::LedFeature :
+ {
+
+ }
+ break;
+ case QSystemInfo::MemcardFeature :
+ {
+
+ }
+ break;
+ case QSystemInfo::UsbFeature :
+ {
+
+ }
+ break;
+ case QSystemInfo::VibFeature :
+ {
+
+ }
+ break;
+ case QSystemInfo::WlanFeature :
+ {
+
+ }
+ break;
+ case QSystemInfo::SimFeature :
+ {
+
+ }
+ break;
+ case QSystemInfo::LocationFeature :
+ {
+
+ }
+ break;
+ case QSystemInfo::VideoOutFeature :
+ {
+
+ }
+ break;
+ case QSystemInfo::HapticsFeature:
+ break;
+ default:
+ featureSupported = false;
+ break;
+ };
+ return featureSupported;
+}
+
+//////// QSystemNetworkInfo
+QSystemNetworkInfoPrivate::QSystemNetworkInfoPrivate(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QSystemNetworkInfoPrivate::~QSystemNetworkInfoPrivate()
+{
+}
+
+QSystemNetworkInfo::NetworkStatus QSystemNetworkInfoPrivate::networkStatus(QSystemNetworkInfo::NetworkMode mode)
+{
+ switch(mode) {
+ case QSystemNetworkInfo::GsmMode:
+ break;
+ case QSystemNetworkInfo::CdmaMode:
+ break;
+ case QSystemNetworkInfo::WcdmaMode:
+ break;
+ case QSystemNetworkInfo::WlanMode:
+ {
+
+ }
+ break;
+ case QSystemNetworkInfo::EthernetMode:
+ {
+
+ }
+ break;
+ case QSystemNetworkInfo::BluetoothMode:
+ {
+
+ }
+ break;
+ case QSystemNetworkInfo::WimaxMode:
+ break;
+ default:
+ break;
+ };
+ return QSystemNetworkInfo::NoNetworkAvailable;
+}
+
+int QSystemNetworkInfoPrivate::networkSignalStrength(QSystemNetworkInfo::NetworkMode mode)
+{
+ switch(mode) {
+ case QSystemNetworkInfo::GsmMode:
+ break;
+ case QSystemNetworkInfo::CdmaMode:
+ break;
+ case QSystemNetworkInfo::WcdmaMode:
+ break;
+ case QSystemNetworkInfo::WlanMode:
+ {
+
+ }
+ break;
+ case QSystemNetworkInfo::EthernetMode:
+ {
+
+
+ }
+ break;
+ case QSystemNetworkInfo::BluetoothMode:
+ break;
+ case QSystemNetworkInfo::WimaxMode:
+ break;
+ default:
+ break;
+ };
+ return -1;
+}
+
+int QSystemNetworkInfoPrivate::cellId()
+{
+ return -1;
+}
+
+int QSystemNetworkInfoPrivate::locationAreaCode()
+{
+ return -1;
+}
+
+// Mobile Country Code
+QString QSystemNetworkInfoPrivate::currentMobileCountryCode()
+{
+ return "No Network";
+}
+
+// Mobile Network Code
+QString QSystemNetworkInfoPrivate::currentMobileNetworkCode()
+{
+ return "No Network";
+}
+
+QString QSystemNetworkInfoPrivate::homeMobileCountryCode()
+{
+ return "No Network";
+}
+
+QString QSystemNetworkInfoPrivate::homeMobileNetworkCode()
+{
+ return "No Network";
+}
+
+QString QSystemNetworkInfoPrivate::networkName(QSystemNetworkInfo::NetworkMode mode)
+{
+ Q_UNUSED(mode);
+ return "No Operator";
+}
+
+QString QSystemNetworkInfoPrivate::macAddress(QSystemNetworkInfo::NetworkMode mode)
+{
+ return interfaceForMode(mode).hardwareAddress();
+}
+
+QNetworkInterface QSystemNetworkInfoPrivate::interfaceForMode(QSystemNetworkInfo::NetworkMode mode)
+{
+ Q_UNUSED(mode);
+ return QNetworkInterface();
+}
+
+//////// QSystemDisplayInfo
+QSystemDisplayInfoPrivate::QSystemDisplayInfoPrivate(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QSystemDisplayInfoPrivate::~QSystemDisplayInfoPrivate()
+{
+}
+
+int QSystemDisplayInfoPrivate::displayBrightness(int screen)
+{
+ Q_UNUSED(screen);
+ return -1;
+}
+
+int QSystemDisplayInfoPrivate::colorDepth(int screen)
+{
+ Q_UNUSED(screen);
+
+ int bpp=0;
+ return bpp;
+}
+
+//////// QSystemMemoryInfo
+QSystemMemoryInfoPrivate::QSystemMemoryInfoPrivate(QObject *parent)
+ : QObject(parent)
+{
+}
+
+
+QSystemMemoryInfoPrivate::~QSystemMemoryInfoPrivate()
+{
+}
+
+qint64 QSystemMemoryInfoPrivate::availableDiskSpace(const QString &driveVolume)
+{
+ Q_UNUSED(driveVolume);
+
+ qint64 totalFreeBytes=0;
+ return totalFreeBytes;
+}
+
+qint64 QSystemMemoryInfoPrivate::totalDiskSpace(const QString &driveVolume)
+{
+ Q_UNUSED(driveVolume);
+
+ qint64 totalBytes=0;
+ return totalBytes;
+}
+
+QSystemMemoryInfo::VolumeType QSystemMemoryInfoPrivate::volumeType(const QString &driveVolume)
+{
+ Q_UNUSED(driveVolume);
+
+ return QSystemMemoryInfo::NoVolume;
+}
+
+QStringList QSystemMemoryInfoPrivate::listOfVolumes()
+{
+ QStringList drivesList;
+ return drivesList;
+}
+
+//////// QSystemDeviceInfo
+QSystemDeviceInfoPrivate::QSystemDeviceInfoPrivate(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QSystemDeviceInfoPrivate::~QSystemDeviceInfoPrivate()
+{
+}
+
+QSystemDeviceInfo::Profile QSystemDeviceInfoPrivate::currentProfile()
+{
+ return QSystemDeviceInfo::UnknownProfile;
+}
+
+QSystemDeviceInfo::InputMethodFlags QSystemDeviceInfoPrivate::inputMethodType()
+{
+ QSystemDeviceInfo::InputMethodFlags methods;
+ return methods;
+}
+
+
+QSystemDeviceInfo::PowerState QSystemDeviceInfoPrivate::currentPowerState()
+{
+ return QSystemDeviceInfo::UnknownPower;
+}
+
+QString QSystemDeviceInfoPrivate::imei()
+{
+ return "Sim Not Available";
+}
+
+QString QSystemDeviceInfoPrivate::imsi()
+{
+ return "Sim Not Available";
+}
+
+QString QSystemDeviceInfoPrivate::manufacturer()
+{
+ return QString();
+}
+
+QString QSystemDeviceInfoPrivate::model()
+{
+ return QString();
+}
+
+QString QSystemDeviceInfoPrivate::productName()
+{
+ return QString();
+}
+
+bool QSystemDeviceInfoPrivate::isBatteryCharging()
+{
+ return false;
+}
+
+int QSystemDeviceInfoPrivate::batteryLevel() const
+{
+ return 0;
+}
+
+QSystemDeviceInfo::BatteryStatus QSystemDeviceInfoPrivate::batteryStatus()
+{
+ return QSystemDeviceInfo::NoBatteryLevel;
+}
+
+QSystemDeviceInfo::SimStatus QSystemDeviceInfoPrivate::simStatus()
+{
+ return QSystemDeviceInfo::SimNotAvailable;
+}
+
+bool QSystemDeviceInfoPrivate::isDeviceLocked()
+{
+ return false;
+}
+
+//////////////
+///////
+QSystemScreenSaverPrivate::QSystemScreenSaverPrivate(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QSystemScreenSaverPrivate::~QSystemScreenSaverPrivate()
+{
+}
+
+bool QSystemScreenSaverPrivate::setScreenSaverEnabled(bool state)
+{
+ Q_UNUSED(state);
+
+ return false;
+}
+
+bool QSystemScreenSaverPrivate::setScreenBlankingEnabled(bool state)
+{
+ Q_UNUSED(state);
+
+ return false;
+}
+
+bool QSystemScreenSaverPrivate::screenSaverEnabled()
+{
+ return false;
+}
+
+bool QSystemScreenSaverPrivate::screenBlankingEnabled()
+{
+ return false;
+}
+
+bool QSystemScreenSaverPrivate::isScreenLockOn()
+{
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/systeminfo/qsysteminfo_mac_p.h b/systeminfo/qsysteminfo_mac_p.h new file mode 100644 index 0000000000..aabf780b50 --- /dev/null +++ b/systeminfo/qsysteminfo_mac_p.h @@ -0,0 +1,239 @@ +/****************************************************************************
+**
+** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please
+** contact Nokia at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QSYSTEMINFO_LINUX_P_H
+#define QSYSTEMINFO_LINUX_P_H
+
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#include <QObject>
+#include <QSize>
+#include <QHash>
+
+#include "qsysteminfo.h"
+#include <qsysinfoglobal.h>
+
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QStringList;
+class QSystemNetworkInfo;
+class QTimer;
+
+class QSystemInfoPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ QSystemInfoPrivate(QObject *parent = 0);
+ virtual ~QSystemInfoPrivate();
+// general
+ QString currentLanguage() const; // 2 letter ISO 639-1
+ QStringList availableLanguages() const; // 2 letter ISO 639-1
+
+ QString version(QSystemInfo::Version, const QString ¶meter = QString());
+
+ QString currentCountryCode() const; //2 letter ISO 3166-1
+//features
+ bool hasFeatureSupported(QSystemInfo::Feature feature);
+Q_SIGNALS:
+ void currentLanguageChanged(const QString &);
+
+private:
+ QTimer *langTimer;
+ QString langCached;
+
+private Q_SLOTS:
+
+};
+
+class QSystemNetworkInfoPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ QSystemNetworkInfoPrivate(QObject *parent = 0);
+ virtual ~QSystemNetworkInfoPrivate();
+
+ QSystemNetworkInfo::NetworkStatus networkStatus(QSystemNetworkInfo::NetworkMode mode);
+ qint32 networkSignalStrength(QSystemNetworkInfo::NetworkMode mode);
+ int cellId();
+ int locationAreaCode();
+
+ QString currentMobileCountryCode(); // Mobile Country Code
+ QString currentMobileNetworkCode(); // Mobile Network Code
+
+ QString homeMobileCountryCode();
+ QString homeMobileNetworkCode();
+
+ QString networkName(QSystemNetworkInfo::NetworkMode mode);
+ QString macAddress(QSystemNetworkInfo::NetworkMode mode);
+
+ QNetworkInterface interfaceForMode(QSystemNetworkInfo::NetworkMode mode);
+
+Q_SIGNALS:
+ void networkStatusChanged(QSystemNetworkInfo::NetworkMode, QSystemNetworkInfo::NetworkStatus);
+ void networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode,int);
+ void currentMobileCountryCodeChanged(const QString &);
+ void currentMobileNetworkCodeChanged(const QString &);
+ void networkNameChanged(QSystemNetworkInfo::NetworkMode, const QString &);
+ void networkModeChanged(QSystemNetworkInfo::NetworkMode);
+
+};
+
+class QSystemDisplayInfoPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ QSystemDisplayInfoPrivate(QObject *parent = 0);
+ virtual ~QSystemDisplayInfoPrivate();
+
+
+// display
+ int displayBrightness(int screen);
+ int colorDepth(int screen);
+};
+
+class QSystemMemoryInfoPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ QSystemMemoryInfoPrivate(QObject *parent = 0);
+ virtual ~QSystemMemoryInfoPrivate();
+
+ // memory
+ qint64 availableDiskSpace(const QString &driveVolume);
+ qint64 totalDiskSpace(const QString &driveVolume);
+ QStringList listOfVolumes();
+ QSystemMemoryInfo::VolumeType volumeType(const QString &driveVolume); //returns enum
+
+private:
+ QHash<QString, QString> mountEntriesHash;
+ void mountEntries();
+
+};
+
+class QSystemDeviceInfoPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ QSystemDeviceInfoPrivate(QObject *parent = 0);
+ ~QSystemDeviceInfoPrivate();
+
+// device
+
+ static QString imei();
+ static QString imsi();
+ static QString manufacturer();
+ static QString model();
+ static QString productName();
+
+ QSystemDeviceInfo::InputMethodFlags inputMethodType();
+
+ int batteryLevel() const;
+ QSystemDeviceInfo::BatteryStatus batteryStatus();
+
+ QSystemDeviceInfo::SimStatus simStatus();
+ bool isDeviceLocked();
+ QSystemDeviceInfo::Profile currentProfile();
+ bool isBatteryCharging();
+
+ QSystemDeviceInfo::PowerState currentPowerState();
+ void setConnection();
+
+Q_SIGNALS:
+ void batteryLevelChanged(int);
+ void batteryStatusChanged(QSystemDeviceInfo::BatteryStatus );
+
+ void powerStateChanged(QSystemDeviceInfo::PowerState);
+ void currentProfileChanged(QSystemDeviceInfo::Profile);
+ void bluetoothStateChanged(bool);
+
+private:
+};
+
+
+class QSystemScreenSaverPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+ QSystemScreenSaverPrivate(QObject *parent = 0);
+ ~QSystemScreenSaverPrivate();
+
+ bool screenSaverEnabled();
+ bool screenBlankingEnabled();
+ bool setScreenSaverEnabled(bool b);
+ bool setScreenBlankingEnabled(bool b);
+ bool isScreenLockOn();
+
+private:
+ QString screenPath;
+ QString settingsPath;
+ bool screenSaverSecure;
+
+ uint currentPid;
+ bool kdeIsRunning;
+ bool gnomeIsRunning;
+ void whichWMRunning();
+
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif /*QSYSTEMSINFO_LINUX_P_H*/
+
+// End of file
+
diff --git a/systeminfo/qsysteminfo_win.cpp b/systeminfo/qsysteminfo_win.cpp index 606ac6e71c..2811a025cb 100644 --- a/systeminfo/qsysteminfo_win.cpp +++ b/systeminfo/qsysteminfo_win.cpp @@ -596,19 +596,31 @@ QString QSystemNetworkInfoPrivate::homeMobileNetworkCode() return "No Network"; } -QString QSystemNetworkInfoPrivate::networkName() +QString QSystemNetworkInfoPrivate::networkName(QSystemNetworkInfo::NetworkMode mode) { - QString essid; - PWLAN_CONNECTION_ATTRIBUTES connAtts = getWifiConnectionAttributes(); - if(connAtts != NULL) { - DOT11_SSID ssid; - ssid = connAtts->wlanAssociationAttributes.dot11Ssid; - for(uint i = 0; i < ssid.uSSIDLength;i++) { - essid += ssid.ucSSID[i]; + QString netname = "No network available"; + switch(mode) { + case QSystemNetworkInfo::WlanMode: + { + PWLAN_CONNECTION_ATTRIBUTES connAtts = getWifiConnectionAttributes(); + if(connAtts != NULL) { + DOT11_SSID ssid; + ssid = connAtts->wlanAssociationAttributes.dot11Ssid; + for(uint i = 0; i < ssid.uSSIDLength;i++) { + netname += ssid.ucSSID[i]; + } + } + WlanFreeMemory(connAtts); } - } - WlanFreeMemory(connAtts); - return essid; + break; + case QSystemNetworkInfo::EthernetMode: + { + } + break; + default: + break; + }; + return netname; } QString QSystemNetworkInfoPrivate::macAddress(QSystemNetworkInfo::NetworkMode mode) diff --git a/systeminfo/qsysteminfo_win_p.h b/systeminfo/qsysteminfo_win_p.h index 045f341bc0..0123ae74e0 100644 --- a/systeminfo/qsysteminfo_win_p.h +++ b/systeminfo/qsysteminfo_win_p.h @@ -108,7 +108,7 @@ public: QString homeMobileCountryCode(); QString homeMobileNetworkCode(); - QString networkName(); + QString networkName(QSystemNetworkInfo::NetworkMode mode); QString macAddress(QSystemNetworkInfo::NetworkMode mode); QNetworkInterface interfaceForMode(QSystemNetworkInfo::NetworkMode mode); diff --git a/systeminfo/systeminfo.pro b/systeminfo/systeminfo.pro index faa20589e3..a8b44acea8 100644 --- a/systeminfo/systeminfo.pro +++ b/systeminfo/systeminfo.pro @@ -39,20 +39,23 @@ win32 { Ifapi.lib \ Coredll.lib } -unix: { - linux-*: { - QT += gui +unix: { + QT += gui + linux-*: { SOURCES += qsysteminfo_linux.cpp HEADERS += qsysteminfo_linux_p.h - contains(QT_CONFIG,dbus): { + contains(QT_CONFIG,dbus): { QT += dbus SOURCES += qhalservice_linux.cpp HEADERS += qhalservice_linux_p.h } - LIBS += -lXxf86vm + #LIBS += -lXxf86vm + } + mac: { + SOURCES += qsysteminfo_mac.cpp + HEADERS += qsysteminfo_mac_p.h } - macx:: symbian:: } diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index cab159edb8..5a2eca620e 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -34,4 +34,5 @@ SUBDIRS += qsysteminfo \ #SystemInformation qsystemdeviceinfo \ qsystemdisplayinfo \ qsystemmemoryinfo \ - qsystemnetworkinfo + qsystemnetworkinfo \ + qsystemscreensaver diff --git a/tests/auto/qsystemnetworkinfo/tst_qsystemnetworkinfo.cpp b/tests/auto/qsystemnetworkinfo/tst_qsystemnetworkinfo.cpp index e0b4abee25..13e84e4eb1 100644 --- a/tests/auto/qsystemnetworkinfo/tst_qsystemnetworkinfo.cpp +++ b/tests/auto/qsystemnetworkinfo/tst_qsystemnetworkinfo.cpp @@ -167,8 +167,18 @@ void tst_QSystemNetworkInfo::tst_homeMobileNetworkCode() void tst_QSystemNetworkInfo::tst_networkName() { QSystemNetworkInfo ni; - QVERIFY(!ni.networkName().isEmpty()); + QList<QSystemNetworkInfo::NetworkMode> modeList; + modeList << QSystemNetworkInfo::GsmMode; + modeList << QSystemNetworkInfo::CdmaMode; + modeList << QSystemNetworkInfo::WcdmaMode; + modeList << QSystemNetworkInfo::WlanMode; + modeList << QSystemNetworkInfo::EthernetMode; + modeList << QSystemNetworkInfo::BluetoothMode; + modeList << QSystemNetworkInfo::WimaxMode; + foreach(QSystemNetworkInfo::NetworkMode mode, modeList) { + QVERIFY(!ni.networkName(mode).isEmpty()); + } } diff --git a/tests/auto/qsystemscreensaver/qsystemscreensaver.pro b/tests/auto/qsystemscreensaver/qsystemscreensaver.pro new file mode 100644 index 0000000000..59f6a888ff --- /dev/null +++ b/tests/auto/qsystemscreensaver/qsystemscreensaver.pro @@ -0,0 +1,14 @@ +TARGET = tst_qsystemscreensaver +CONFIG+=testcase +QT = gui core network + +INCLUDEPATH += ../../../systeminfo +SOURCES += tst_qsystemscreensaver.cpp + +include(../../../common.pri) +LIBS += -lQtSystemInfo + +symbian { + TARGET.CAPABILITY = All -TCB -DRM +} + diff --git a/tests/auto/qsystemscreensaver/tst_qsystemscreensaver.cpp b/tests/auto/qsystemscreensaver/tst_qsystemscreensaver.cpp new file mode 100644 index 0000000000..e22e1e72ef --- /dev/null +++ b/tests/auto/qsystemscreensaver/tst_qsystemscreensaver.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please +** contact Nokia at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <QtTest/QtTest> +#include "qsysteminfo.h" + +class tst_QSystemScreenSaver : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void tst_screenSaverEnabled(); + void tst_screenBlankingEnabled(); + void tst_setScreenSaverEnabled(); + void tst_setScreenBlankingEnabled(); + + void tst_isScreenLockOn(); + +}; + + void tst_QSystemScreenSaver::initTestCase() + { + + } + +void tst_QSystemScreenSaver::tst_screenSaverEnabled() +{ + QSystemScreenSaver si; + bool enabled = si.screenSaverEnabled(); + QVERIFY( enabled || !enabled); + +} + +void tst_QSystemScreenSaver::tst_screenBlankingEnabled() +{ + QSystemScreenSaver si; + bool enabled = si.screenBlankingEnabled(); + QVERIFY( enabled || !enabled); + +} + +void tst_QSystemScreenSaver::tst_setScreenSaverEnabled() +{ + QSystemScreenSaver si; + bool enabled = si.setScreenSaverEnabled(true); + QVERIFY( enabled || !enabled); + + enabled = si.setScreenSaverEnabled(false); + QVERIFY( enabled || !enabled); +} + +void tst_QSystemScreenSaver::tst_setScreenBlankingEnabled() +{ + QSystemScreenSaver si; + bool enabled = si.setScreenBlankingEnabled(true); + QVERIFY( enabled || !enabled); + + enabled = si.setScreenBlankingEnabled(false); + QVERIFY( enabled || !enabled); +} + +void tst_QSystemScreenSaver::tst_isScreenLockOn() +{ + QSystemScreenSaver si; + bool enabled = si.isScreenLockOn(); + QVERIFY( enabled || !enabled); + +} + +QTEST_MAIN(tst_QSystemScreenSaver) +#include "tst_qsystemscreensaver.moc" |