diff -r bf4420e9fa4d -r 2e16851ffecd ginebra/devicedelegate.h --- a/ginebra/devicedelegate.h Fri Jun 11 16:23:26 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef DEVICEDELEGATE_H -#define DEVICEDELEGATE_H - -#include -#include -#ifdef QT_MOBILITY_BEARER_SYSINFO -#include "qsysteminfo.h" -#include "qnetworkconfiguration.h" -#include "qnetworkconfigmanager.h" - -QTM_USE_NAMESPACE // using QtMobility namespace - -#endif // QT_MOBILITY_BEARER_SYSINFO - - -/*! - Class to provide device information. It uses QtMobility to provide - information about battery level, network signal strength, and network name. -*/ -class DeviceDelegate : public QObject { - Q_OBJECT - public: - // default constructor and destructor - DeviceDelegate(); - ~DeviceDelegate(); - - // properties accessible to javascript snippets - Q_PROPERTY(int batteryLevel READ getBatteryLevel) - Q_PROPERTY(int networkSignalStrength READ getNetworkSignalStrength) - Q_PROPERTY(QString networkName READ getNetworkName) - Q_PROPERTY(bool batteryCharging READ isBatteryCharging) - - - // public methods - int getBatteryLevel() const; - int getNetworkSignalStrength() const; - QString getNetworkName() const; - bool isBatteryCharging() const; - - private: - // private methods -#ifdef QT_MOBILITY_BEARER_SYSINFO - void updateSignalStrength(int strength); - QSystemNetworkInfo::NetworkMode bearerNameToMode(QString) const; - QSystemNetworkInfo::NetworkMode getInternetConfigurationMode(); - - // private member variables - QSystemDeviceInfo *m_deviceInfo; - QSystemNetworkInfo *m_networkInfo; - QSystemNetworkInfo::NetworkMode m_currentMode; - QNetworkConfigurationManager *m_networkConfigManager; -#endif - QString m_currentConfigIdentifier; - bool m_batteryCharging; - bool m_updating; // updating network configurations - - signals: - // Sent when the battery level or charging state changes. - void batteryLevelChanged(int); - // Sent when the network signal strength changes. - void networkSignalStrengthChanged(int); - // Sent when the network name changes. - void networkNameChanged(const QString&); - - private slots: -#ifdef QT_MOBILITY_BEARER_SYSINFO - // handles signals from network configuration manager - void configurationAdded(const QNetworkConfiguration &config); - void configurationRemoved(const QNetworkConfiguration &config); - void configurationChanged(const QNetworkConfiguration &config); - void handleUpdateComplete(); - - // handles signals from system network info - void handleNetworkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode, int); - void handleNetworkNameChanged(QSystemNetworkInfo::NetworkMode, const QString&); - - // handles signals from system device info - void handlePowerStateChanged(QSystemDeviceInfo::PowerState); -#endif -}; - -#endif // DEVICEDELEGATE_H