-rw-r--r-- | core/applets/clockapplet/clock.cpp | 6 | ||||
-rw-r--r-- | core/applets/clockapplet/clockapplet.pro | 2 | ||||
-rw-r--r-- | core/applets/clockapplet/config.in | 2 | ||||
-rw-r--r-- | core/applets/clockapplet/opie-clockapplet.control | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp index d7d326d..ba8eb15 100644 --- a/core/applets/clockapplet/clock.cpp +++ b/core/applets/clockapplet/clock.cpp | |||
@@ -1,160 +1,160 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (C) 2002 Trolltech AS. All rights reserved. | 3 | ** Copyright (C) 2002 Trolltech AS. All rights reserved. |
4 | ** | 4 | ** |
5 | ** This file is part of Qtopia Environment. | 5 | ** This file is part of Qtopia Environment. |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | // merged in the StyleFix. Applets should raise Popup! | 21 | // merged in the StyleFix. Applets should raise Popup! |
22 | // by zecke@handhelds.org 6th of may 2004 | 22 | // by zecke@handhelds.org 6th of may 2004 |
23 | 23 | ||
24 | #include "clock.h" | 24 | #include "clock.h" |
25 | 25 | ||
26 | /* OPIE */ | 26 | /* OPIE */ |
27 | #include <opie2/odebug.h> | 27 | #include <opie2/odebug.h> |
28 | #include <opie2/oresource.h> | ||
28 | #include <opie2/otaskbarapplet.h> | 29 | #include <opie2/otaskbarapplet.h> |
29 | 30 | ||
30 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
31 | #include <qpe/qcopenvelope_qws.h> | 32 | #include <qpe/qcopenvelope_qws.h> |
32 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
33 | #include <qpe/resource.h> | ||
34 | 34 | ||
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | 36 | ||
37 | using namespace Opie::Core; | 37 | using namespace Opie::Core; |
38 | using namespace Opie::Ui; | 38 | using namespace Opie::Ui; |
39 | 39 | ||
40 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) | 40 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) |
41 | { | 41 | { |
42 | // If you want a sunken border around the clock do this: | 42 | // If you want a sunken border around the clock do this: |
43 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 43 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
44 | //setFont( QFont( "Helvetica", , QFont::Normal ) ); | 44 | //setFont( QFont( "Helvetica", , QFont::Normal ) ); |
45 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime() ) ); | 45 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime() ) ); |
46 | connect( qApp, SIGNAL( clockChanged(bool) ), | 46 | connect( qApp, SIGNAL( clockChanged(bool) ), |
47 | this, SLOT( slotClockChanged(bool) ) ); | 47 | this, SLOT( slotClockChanged(bool) ) ); |
48 | readConfig(); | 48 | readConfig(); |
49 | timerId = 0; | 49 | timerId = 0; |
50 | timerEvent( 0 ); | 50 | timerEvent( 0 ); |
51 | show(); | 51 | show(); |
52 | } | 52 | } |
53 | 53 | ||
54 | int LauncherClock::position() | 54 | int LauncherClock::position() |
55 | { | 55 | { |
56 | return 10; | 56 | return 10; |
57 | } | 57 | } |
58 | 58 | ||
59 | void LauncherClock::readConfig() { | 59 | void LauncherClock::readConfig() { |
60 | Config config( "qpe" ); | 60 | Config config( "qpe" ); |
61 | config.setGroup( "Time" ); | 61 | config.setGroup( "Time" ); |
62 | ampmFormat = config.readBoolEntry( "AMPM", TRUE ); | 62 | ampmFormat = config.readBoolEntry( "AMPM", TRUE ); |
63 | config.setGroup( "Date" ); | 63 | config.setGroup( "Date" ); |
64 | format = config.readNumEntry("ClockApplet",0); | 64 | format = config.readNumEntry("ClockApplet",0); |
65 | } | 65 | } |
66 | 66 | ||
67 | void LauncherClock::mousePressEvent( QMouseEvent * ) | 67 | void LauncherClock::mousePressEvent( QMouseEvent * ) |
68 | { | 68 | { |
69 | QPopupMenu *menu = new QPopupMenu(this); | 69 | QPopupMenu *menu = new QPopupMenu(this); |
70 | menu->insertItem(tr("Set time..."), 0); | 70 | menu->insertItem(tr("Set time..."), 0); |
71 | menu->insertSeparator(); | 71 | menu->insertSeparator(); |
72 | menu->insertItem(tr("Clock.."), 1); | 72 | menu->insertItem(tr("Clock.."), 1); |
73 | 73 | ||
74 | 74 | ||
75 | Config config( "Clock" ); | 75 | Config config( "Clock" ); |
76 | config.setGroup( "Daily Alarm" ); | 76 | config.setGroup( "Daily Alarm" ); |
77 | bool alarmOn = config.readBoolEntry("Enabled", FALSE); | 77 | bool alarmOn = config.readBoolEntry("Enabled", FALSE); |
78 | menu->insertItem(Resource::loadIconSet(alarmOn?"clockapplet/smallalarm":"clockapplet/smallalarm_off" ), | 78 | menu->insertItem( Opie::Core::OResource::loadPixmap( alarmOn ? "clockapplet/smallalarm" : "clockapplet/smallalarm_off", |
79 | tr("Alarm..."), 2); | 79 | Opie::Core::OResource::SmallIcon ), tr("Alarm..."), 2 ); |
80 | 80 | ||
81 | 81 | ||
82 | /* FIXME use OTaskBarApplet ### */ | 82 | /* FIXME use OTaskBarApplet ### */ |
83 | QPoint curPos = mapToGlobal( QPoint(0,0) ); | 83 | QPoint curPos = mapToGlobal( QPoint(0,0) ); |
84 | QSize sh = menu->sizeHint(); | 84 | QSize sh = menu->sizeHint(); |
85 | switch (menu->exec( curPos-QPoint((sh.width()-width())/2,sh.height()) )) { | 85 | switch (menu->exec( curPos-QPoint((sh.width()-width())/2,sh.height()) )) { |
86 | case 0: | 86 | case 0: |
87 | Global::execute( "systemtime" ); | 87 | Global::execute( "systemtime" ); |
88 | break; | 88 | break; |
89 | case 1: { | 89 | case 1: { |
90 | QCopEnvelope e("QPE/Application/clock", "showClock()" ); | 90 | QCopEnvelope e("QPE/Application/clock", "showClock()" ); |
91 | } | 91 | } |
92 | break; | 92 | break; |
93 | case 2: { | 93 | case 2: { |
94 | QCopEnvelope e("QPE/Application/clock", "editDailyAlarm()" ); | 94 | QCopEnvelope e("QPE/Application/clock", "editDailyAlarm()" ); |
95 | } | 95 | } |
96 | break; | 96 | break; |
97 | default: | 97 | default: |
98 | break; | 98 | break; |
99 | } | 99 | } |
100 | delete menu; | 100 | delete menu; |
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | void LauncherClock::timerEvent( QTimerEvent *e ) | 104 | void LauncherClock::timerEvent( QTimerEvent *e ) |
105 | { | 105 | { |
106 | if ( !e || e->timerId() == timerId ) { | 106 | if ( !e || e->timerId() == timerId ) { |
107 | killTimer( timerId ); | 107 | killTimer( timerId ); |
108 | changeTime(); | 108 | changeTime(); |
109 | QTime t = QTime::currentTime(); | 109 | QTime t = QTime::currentTime(); |
110 | int ms = (60 - t.second())*1000 - t.msec(); | 110 | int ms = (60 - t.second())*1000 - t.msec(); |
111 | timerId = startTimer( ms ); | 111 | timerId = startTimer( ms ); |
112 | } else { | 112 | } else { |
113 | QLabel::timerEvent( e ); | 113 | QLabel::timerEvent( e ); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | void LauncherClock::updateTime( void ) | 117 | void LauncherClock::updateTime( void ) |
118 | { | 118 | { |
119 | changeTime(); | 119 | changeTime(); |
120 | } | 120 | } |
121 | 121 | ||
122 | void LauncherClock::changeTime( void ) | 122 | void LauncherClock::changeTime( void ) |
123 | { | 123 | { |
124 | QTime tm = QDateTime::currentDateTime().time(); | 124 | QTime tm = QDateTime::currentDateTime().time(); |
125 | QString s; | 125 | QString s; |
126 | if( ampmFormat ) { | 126 | if( ampmFormat ) { |
127 | int hour = tm.hour(); | 127 | int hour = tm.hour(); |
128 | if (hour == 0) | 128 | if (hour == 0) |
129 | hour = 12; | 129 | hour = 12; |
130 | if (hour > 12) | 130 | if (hour > 12) |
131 | hour -= 12; | 131 | hour -= 12; |
132 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | 132 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), |
133 | (tm.hour() >= 12) ? "PM" : "AM" ); | 133 | (tm.hour() >= 12) ? "PM" : "AM" ); |
134 | } else | 134 | } else |
135 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | 135 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); |
136 | 136 | ||
137 | if (format==1) { | 137 | if (format==1) { |
138 | QDate dm = QDate::currentDate(); | 138 | QDate dm = QDate::currentDate(); |
139 | QString d; | 139 | QString d; |
140 | d.sprintf("%d/%d ", dm.day(), dm.month()); | 140 | d.sprintf("%d/%d ", dm.day(), dm.month()); |
141 | setText( d+s ); | 141 | setText( d+s ); |
142 | } else if (format==2) { | 142 | } else if (format==2) { |
143 | QDate dm = QDate::currentDate(); | 143 | QDate dm = QDate::currentDate(); |
144 | QString d; | 144 | QString d; |
145 | d.sprintf("%d/%d ", dm.month(), dm.day()); | 145 | d.sprintf("%d/%d ", dm.month(), dm.day()); |
146 | setText( d+s ); | 146 | setText( d+s ); |
147 | } else { | 147 | } else { |
148 | setText( s ); | 148 | setText( s ); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | void LauncherClock::slotClockChanged( bool ) | 152 | void LauncherClock::slotClockChanged( bool ) |
153 | { | 153 | { |
154 | readConfig(); | 154 | readConfig(); |
155 | updateTime(); | 155 | updateTime(); |
156 | } | 156 | } |
157 | 157 | ||
158 | 158 | ||
159 | EXPORT_OPIE_APPLET_v1( LauncherClock ) | 159 | EXPORT_OPIE_APPLET_v1( LauncherClock ) |
160 | 160 | ||
diff --git a/core/applets/clockapplet/clockapplet.pro b/core/applets/clockapplet/clockapplet.pro index 910f44b..b227b77 100644 --- a/core/applets/clockapplet/clockapplet.pro +++ b/core/applets/clockapplet/clockapplet.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt plugin warn_on | 2 | CONFIG += qt plugin warn_on |
3 | HEADERS = clock.h | 3 | HEADERS = clock.h |
4 | SOURCES = clock.cpp | 4 | SOURCES = clock.cpp |
5 | TARGET = clockapplet | 5 | TARGET = clockapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += .. | 8 | DEPENDPATH += .. |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include( $(OPIEDIR)/include.pro ) | 12 | include( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |
diff --git a/core/applets/clockapplet/config.in b/core/applets/clockapplet/config.in index 6c32f79..f934743 100644 --- a/core/applets/clockapplet/config.in +++ b/core/applets/clockapplet/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config CLOCKAPPLET | 1 | config CLOCKAPPLET |
2 | boolean "opie-clockapplet (Digital clock applet)" | 2 | boolean "opie-clockapplet (Digital clock applet)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE |
diff --git a/core/applets/clockapplet/opie-clockapplet.control b/core/applets/clockapplet/opie-clockapplet.control index 79d9fdd..32035d4 100644 --- a/core/applets/clockapplet/opie-clockapplet.control +++ b/core/applets/clockapplet/opie-clockapplet.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-clockapplet | 1 | Package: opie-clockapplet |
2 | Files: plugins/applets/libclockapplet.so* | 2 | Files: plugins/applets/libclockapplet.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applets | 4 | Section: opie/applets |
5 | Maintainer: Opie Team <opie@handhelds.org> | 5 | Maintainer: Opie Team <opie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal, libopiecore2 |
8 | Description: Clock applet | 8 | Description: Clock applet |
9 | Clock applet for the Opie environment taskbar. | 9 | Clock applet for the Opie environment taskbar. |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |