Diffstat (limited to 'core/applets/clockapplet/clock.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/clockapplet/clock.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp index 120a019..3b13d74 100644 --- a/core/applets/clockapplet/clock.cpp +++ b/core/applets/clockapplet/clock.cpp | |||
@@ -4,48 +4,49 @@ | |||
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
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 <opie2/otaskbarapplet.h> | 23 | #include <opie2/otaskbarapplet.h> |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
26 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | 27 | ||
28 | using namespace Opie::Ui; | ||
28 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) | 29 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) |
29 | { | 30 | { |
30 | // If you want a sunken border around the clock do this: | 31 | // If you want a sunken border around the clock do this: |
31 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 32 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
32 | //setFont( QFont( "Helvetica", , QFont::Normal ) ); | 33 | //setFont( QFont( "Helvetica", , QFont::Normal ) ); |
33 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime() ) ); | 34 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime() ) ); |
34 | connect( qApp, SIGNAL( clockChanged(bool) ), | 35 | connect( qApp, SIGNAL( clockChanged(bool) ), |
35 | this, SLOT( slotClockChanged(bool) ) ); | 36 | this, SLOT( slotClockChanged(bool) ) ); |
36 | readConfig(); | 37 | readConfig(); |
37 | timerId = 0; | 38 | timerId = 0; |
38 | timerEvent( 0 ); | 39 | timerEvent( 0 ); |
39 | show(); | 40 | show(); |
40 | } | 41 | } |
41 | 42 | ||
42 | int LauncherClock::position() | 43 | int LauncherClock::position() |
43 | { | 44 | { |
44 | return 10; | 45 | return 10; |
45 | } | 46 | } |
46 | 47 | ||
47 | void LauncherClock::readConfig() { | 48 | void LauncherClock::readConfig() { |
48 | Config config( "qpe" ); | 49 | Config config( "qpe" ); |
49 | config.setGroup( "Time" ); | 50 | config.setGroup( "Time" ); |
50 | ampmFormat = config.readBoolEntry( "AMPM", TRUE ); | 51 | ampmFormat = config.readBoolEntry( "AMPM", TRUE ); |
51 | config.setGroup( "Date" ); | 52 | config.setGroup( "Date" ); |
@@ -93,29 +94,27 @@ void LauncherClock::changeTime( void ) | |||
93 | } else | 94 | } else |
94 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | 95 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); |
95 | 96 | ||
96 | if (format==1) { | 97 | if (format==1) { |
97 | QDate dm = QDate::currentDate(); | 98 | QDate dm = QDate::currentDate(); |
98 | QString d; | 99 | QString d; |
99 | d.sprintf("%d/%d ", dm.day(), dm.month()); | 100 | d.sprintf("%d/%d ", dm.day(), dm.month()); |
100 | setText( d+s ); | 101 | setText( d+s ); |
101 | } else if (format==2) { | 102 | } else if (format==2) { |
102 | QDate dm = QDate::currentDate(); | 103 | QDate dm = QDate::currentDate(); |
103 | QString d; | 104 | QString d; |
104 | d.sprintf("%d/%d ", dm.month(), dm.day()); | 105 | d.sprintf("%d/%d ", dm.month(), dm.day()); |
105 | setText( d+s ); | 106 | setText( d+s ); |
106 | } else { | 107 | } else { |
107 | setText( s ); | 108 | setText( s ); |
108 | } | 109 | } |
109 | } | 110 | } |
110 | 111 | ||
111 | void LauncherClock::slotClockChanged( bool pm ) | 112 | void LauncherClock::slotClockChanged( bool pm ) |
112 | { | 113 | { |
113 | readConfig(); | 114 | readConfig(); |
114 | updateTime(); | 115 | updateTime(); |
115 | } | 116 | } |
116 | 117 | ||
117 | Q_EXPORT_INTERFACE() | 118 | |
118 | { | 119 | EXPORT_OPIE_APPLET_v1( LauncherClock ) |
119 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<LauncherClock> ); | ||
120 | } | ||
121 | 120 | ||