• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

qmtime.h

Go to the documentation of this file.
00001 
00032 #ifndef MEEGO_QMTIME_H
00033 #define MEEGO_QMTIME_H
00034 
00035 #include "system_global.h"
00036 #include <QtCore/qobject.h>
00037 #include <QTime>
00038 #include <QDate>
00039 #include <QDateTime>
00040 #include <time.h>
00041 
00042 QT_BEGIN_HEADER
00043 
00044 namespace MeeGo { class QmTime ; }
00045 namespace MeeGo { class QmTimePrivate2 ; }
00046 
00047 /* these macros are temporary, that's why no proper "MEEGO_QMTIME_" prefix */
00048 #define F_SUPPORT_DEPRECATED 1
00049 
00050 #if F_SUPPORT_DEPRECATED
00051 /* to be replaces by MeeGo::QmTime::WhatChanged */
00052 namespace MeeGo
00053 {
00059   enum QmTimeWhatChanged
00060   {
00061       QmTimeTimeChanged = 0,      
00062       QmTimeOnlySettingsChanged   
00063   };
00064   Q_ENUMS(QmTimeWhatChanged);
00065 }
00066 #endif
00067 
00077 class MeeGo::QmTime : public QObject
00078 {
00079   QmTimePrivate2 *p ;
00080 
00081   Q_OBJECT ;
00082   Q_ENUMS(TimeFormat);
00083   Q_ENUMS(WhatChanged) ;
00084   Q_ENUMS(DisconnectionPolicy) ;
00085   Q_ENUMS(SettingsSynchronizationPolicy) ;
00086   Q_ENUMS(AutoSystemTimeStatus) ;
00087   Q_ENUMS(AutoTimeZoneStatus) ;
00088 
00089 public:
00091   enum WhatChanged
00092   {
00093     TimeChanged,         
00094     OnlySettingsChanged  
00095   } ;
00096 
00098   enum DisconnectionPolicy
00099   {
00100     DisconnectWhenPossible, 
00101     KeepConnected           
00102   } ;
00103 
00105   enum SettingsSynchronizationPolicy
00106   {
00107     SynchronizeOnWrite, 
00108     WaitForSignal       
00109   } ;
00110 
00112   enum AutoSystemTimeStatus
00113   {
00114     AutoSystemTimeOff,     
00115     AutoSystemTimeOn,      
00116     AutoSystemTimeUnknown  
00117   } ;
00118 
00120   enum AutoTimeZoneStatus
00121   {
00122     AutoTimeZoneOff,     
00123     AutoTimeZoneOn,      
00124     AutoTimeZoneUnknown  
00125   } ;
00126 
00127   QmTime(QObject *parent=NULL) ;
00128   virtual ~QmTime() ;
00129 
00141   static bool setDisconnectionPolicy(DisconnectionPolicy p) ;
00142 
00154   static bool setSynchronizationPolicy(SettingsSynchronizationPolicy p) ;
00155 
00163   bool synchronize() ;
00164 
00172   enum AutoSystemTimeStatus autoSystemTime() ;
00173 
00187   bool setAutoSystemTime(enum AutoSystemTimeStatus new_status) ;
00188 
00196   enum AutoTimeZoneStatus autoTimeZone() ;
00197 
00211   bool setAutoTimeZone(enum AutoTimeZoneStatus new_status) ;
00212 
00222   bool setTime(time_t time) ;
00223 
00258   bool setTimezone(const QString tz) ;
00259 
00270   bool getTimezone(QString &tz) ;
00271 
00281   bool getAutoTimezone(QString &tz) ;
00282 
00289   time_t getAutoTime() ;
00290 
00298   bool isOperatorTimeAccessible(bool &result) ;
00299 
00307   bool deviceDefaultTimezone(QString &default_timezone) ;
00308 
00319   static bool remoteTime(const QString &tz, time_t t, QDateTime &dt, struct tm *p=NULL) ;
00320 
00330   static bool localTime(time_t t, QDateTime &dt, struct tm *p=NULL) ;
00331 
00345   int getTimeDiff(time_t t, const QString &location1, const QString &location2) ;
00346 
00347   // obsolete deprecated methods //
00348 
00349 #if F_SUPPORT_DEPRECATED
00350 
00354   bool setTime(const QDateTime& time);
00355 #endif
00356 
00357 Q_SIGNALS:
00362   void timeOrSettingsChanged(MeeGo::QmTime::WhatChanged what);
00363 
00364 #if F_SUPPORT_DEPRECATED
00365   /*
00366    * @brief Deprecated, use timeOrSettingsChanged(MeeGo::QmTime::WhatChanged) instead.
00367    * @deprecated
00368    */
00369   void timeOrSettingsChanged(MeeGo::QmTimeWhatChanged what);
00370 #endif
00371 
00372 private:
00373     Q_DISABLE_COPY(QmTime)
00374 };
00375 
00376 QT_END_HEADER
00377 
00378 #endif // MEEGO_QMTIME_H

Generated on Mon Jul 4 2011 14:27:35 for QmSystem by  doxygen 1.7.1