-rw-r--r-- | core/applets/clockapplet/clock.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp index c186fb3..ba079bf 100644 --- a/core/applets/clockapplet/clock.cpp +++ b/core/applets/clockapplet/clock.cpp | |||
@@ -9,69 +9,80 @@ | |||
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "clock.h" | 21 | #include "clock.h" |
22 | 22 | ||
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/qcopenvelope_qws.h> | ||
25 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
26 | 27 | ||
27 | #include <qmainwindow.h> | 28 | #include <qmainwindow.h> |
28 | #include <qlayout.h> | 29 | #include <qlayout.h> |
29 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
30 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
31 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
32 | #include <qtimer.h> | 33 | #include <qtimer.h> |
33 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qfile.h> | ||
34 | #include <stdlib.h> | 36 | #include <stdlib.h> |
35 | 37 | ||
36 | 38 | ||
37 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) | 39 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) |
38 | { | 40 | { |
39 | // If you want a sunken border around the clock do this: | 41 | // If you want a sunken border around the clock do this: |
40 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 42 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
41 | setFont( QFont( "Helvetica", 10, QFont::Normal ) ); | 43 | setFont( QFont( "Helvetica", 10, QFont::Normal ) ); |
42 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) ); | 44 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) ); |
43 | connect( qApp, SIGNAL( clockChanged( bool ) ), | 45 | connect( qApp, SIGNAL( clockChanged( bool ) ), |
44 | this, SLOT( slotClockChanged( bool ) ) ); | 46 | this, SLOT( slotClockChanged( bool ) ) ); |
45 | readConfig(); | 47 | readConfig(); |
46 | timerId = 0; | 48 | timerId = 0; |
47 | timerEvent( 0 ); | 49 | timerEvent( 0 ); |
48 | show(); | 50 | show(); |
49 | } | 51 | } |
50 | 52 | ||
51 | void LauncherClock::readConfig() { | 53 | void LauncherClock::readConfig() { |
52 | Config config( "qpe" ); | 54 | Config config( "qpe" ); |
53 | config.setGroup( "Time" ); | 55 | config.setGroup( "Time" ); |
54 | ampmFormat = config.readBoolEntry( "AMPM", TRUE ); | 56 | ampmFormat = config.readBoolEntry( "AMPM", TRUE ); |
55 | config.setGroup( "Date" ); | 57 | config.setGroup( "Date" ); |
56 | format = config.readNumEntry("ClockApplet",0); | 58 | format = config.readNumEntry("ClockApplet",0); |
57 | } | 59 | } |
58 | 60 | ||
59 | void LauncherClock::mouseReleaseEvent( QMouseEvent * ) | 61 | void LauncherClock::mouseReleaseEvent( QMouseEvent * ) |
60 | { | 62 | { |
61 | Global::execute( "systemtime" ); | 63 | QCString setTimeApp; |
64 | if (QFile::exists(QPEApplication::qpeDir()+"bin/netsystemtime")) | ||
65 | setTimeApp="netsystemtime"; | ||
66 | else setTimeApp="systemtime"; | ||
67 | qDebug("app "+setTimeApp); | ||
68 | QCopEnvelope e("QPE/Application/"+setTimeApp, "setDocument(QString)"); | ||
69 | QString lf = QString::null; | ||
70 | |||
71 | e << lf; | ||
72 | |||
62 | } | 73 | } |
63 | 74 | ||
64 | 75 | ||
65 | void LauncherClock::timerEvent( QTimerEvent *e ) | 76 | void LauncherClock::timerEvent( QTimerEvent *e ) |
66 | { | 77 | { |
67 | if ( !e || e->timerId() == timerId ) { | 78 | if ( !e || e->timerId() == timerId ) { |
68 | killTimer( timerId ); | 79 | killTimer( timerId ); |
69 | changeTime(); | 80 | changeTime(); |
70 | QTime t = QTime::currentTime(); | 81 | QTime t = QTime::currentTime(); |
71 | int ms = (60 - t.second())*1000 - t.msec(); | 82 | int ms = (60 - t.second())*1000 - t.msec(); |
72 | timerId = startTimer( ms ); | 83 | timerId = startTimer( ms ); |
73 | } else { | 84 | } else { |
74 | QLabel::timerEvent( e ); | 85 | QLabel::timerEvent( e ); |
75 | } | 86 | } |
76 | } | 87 | } |
77 | 88 | ||