-rw-r--r-- | core/applets/clockapplet/clock.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp index ba079bf..52d285b 100644 --- a/core/applets/clockapplet/clock.cpp +++ b/core/applets/clockapplet/clock.cpp | |||
@@ -35,65 +35,64 @@ | |||
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | 38 | ||
39 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) | 39 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) |
40 | { | 40 | { |
41 | // If you want a sunken border around the clock do this: | 41 | // If you want a sunken border around the clock do this: |
42 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 42 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
43 | setFont( QFont( "Helvetica", 10, QFont::Normal ) ); | 43 | setFont( QFont( "Helvetica", 10, QFont::Normal ) ); |
44 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) ); | 44 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) ); |
45 | connect( qApp, SIGNAL( clockChanged( bool ) ), | 45 | connect( qApp, SIGNAL( clockChanged( bool ) ), |
46 | this, SLOT( slotClockChanged( bool ) ) ); | 46 | this, SLOT( slotClockChanged( bool ) ) ); |
47 | readConfig(); | 47 | readConfig(); |
48 | timerId = 0; | 48 | timerId = 0; |
49 | timerEvent( 0 ); | 49 | timerEvent( 0 ); |
50 | show(); | 50 | show(); |
51 | } | 51 | } |
52 | 52 | ||
53 | void LauncherClock::readConfig() { | 53 | void LauncherClock::readConfig() { |
54 | Config config( "qpe" ); | 54 | Config config( "qpe" ); |
55 | config.setGroup( "Time" ); | 55 | config.setGroup( "Time" ); |
56 | ampmFormat = config.readBoolEntry( "AMPM", TRUE ); | 56 | ampmFormat = config.readBoolEntry( "AMPM", TRUE ); |
57 | config.setGroup( "Date" ); | 57 | config.setGroup( "Date" ); |
58 | format = config.readNumEntry("ClockApplet",0); | 58 | format = config.readNumEntry("ClockApplet",0); |
59 | } | 59 | } |
60 | 60 | ||
61 | void LauncherClock::mouseReleaseEvent( QMouseEvent * ) | 61 | void LauncherClock::mouseReleaseEvent( QMouseEvent * ) |
62 | { | 62 | { |
63 | QCString setTimeApp; | 63 | QCString setTimeApp; |
64 | if (QFile::exists(QPEApplication::qpeDir()+"bin/netsystemtime")) | 64 | if (QFile::exists(QPEApplication::qpeDir()+"bin/netsystemtime")) |
65 | setTimeApp="netsystemtime"; | 65 | setTimeApp="netsystemtime"; |
66 | else setTimeApp="systemtime"; | 66 | else setTimeApp="systemtime"; |
67 | qDebug("app "+setTimeApp); | ||
68 | QCopEnvelope e("QPE/Application/"+setTimeApp, "setDocument(QString)"); | 67 | QCopEnvelope e("QPE/Application/"+setTimeApp, "setDocument(QString)"); |
69 | QString lf = QString::null; | 68 | QString lf = QString::null; |
70 | 69 | ||
71 | e << lf; | 70 | e << lf; |
72 | 71 | ||
73 | } | 72 | } |
74 | 73 | ||
75 | 74 | ||
76 | void LauncherClock::timerEvent( QTimerEvent *e ) | 75 | void LauncherClock::timerEvent( QTimerEvent *e ) |
77 | { | 76 | { |
78 | if ( !e || e->timerId() == timerId ) { | 77 | if ( !e || e->timerId() == timerId ) { |
79 | killTimer( timerId ); | 78 | killTimer( timerId ); |
80 | changeTime(); | 79 | changeTime(); |
81 | QTime t = QTime::currentTime(); | 80 | QTime t = QTime::currentTime(); |
82 | int ms = (60 - t.second())*1000 - t.msec(); | 81 | int ms = (60 - t.second())*1000 - t.msec(); |
83 | timerId = startTimer( ms ); | 82 | timerId = startTimer( ms ); |
84 | } else { | 83 | } else { |
85 | QLabel::timerEvent( e ); | 84 | QLabel::timerEvent( e ); |
86 | } | 85 | } |
87 | } | 86 | } |
88 | 87 | ||
89 | void LauncherClock::updateTime( void ) | 88 | void LauncherClock::updateTime( void ) |
90 | { | 89 | { |
91 | changeTime(); | 90 | changeTime(); |
92 | } | 91 | } |
93 | 92 | ||
94 | void LauncherClock::changeTime( void ) | 93 | void LauncherClock::changeTime( void ) |
95 | { | 94 | { |
96 | QTime tm = QDateTime::currentDateTime().time(); | 95 | QTime tm = QDateTime::currentDateTime().time(); |
97 | QString s; | 96 | QString s; |
98 | if( ampmFormat ) { | 97 | if( ampmFormat ) { |
99 | int hour = tm.hour(); | 98 | int hour = tm.hour(); |