author | zecke <zecke> | 2004-05-06 21:14:26 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-05-06 21:14:26 (UTC) |
commit | a6f2e9cf92a4f7dc91696394e1fe41d7c7bb372f (patch) (unidiff) | |
tree | 092e72540b7f595e02bb9d6bde3f372a37db80c8 /core/applets | |
parent | 49588c7322679fe3dadf7aaad058d7df76e0d8d3 (diff) | |
download | opie-a6f2e9cf92a4f7dc91696394e1fe41d7c7bb372f.zip opie-a6f2e9cf92a4f7dc91696394e1fe41d7c7bb372f.tar.gz opie-a6f2e9cf92a4f7dc91696394e1fe41d7c7bb372f.tar.bz2 |
Obey styleguide and show popups as in Qtopia
-rw-r--r-- | core/applets/clockapplet/clock.cpp | 46 | ||||
-rw-r--r-- | core/applets/clockapplet/clock.h | 2 |
2 files changed, 42 insertions, 6 deletions
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp index 7d396e7..d7d326d 100644 --- a/core/applets/clockapplet/clock.cpp +++ b/core/applets/clockapplet/clock.cpp | |||
@@ -1,4 +1,5 @@ | |||
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 | ** | 4 | ** |
4 | ** This file is part of Qtopia Environment. | 5 | ** This file is part of Qtopia Environment. |
@@ -18,4 +19,6 @@ | |||
18 | ** | 19 | ** |
19 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | // merged in the StyleFix. Applets should raise Popup! | ||
22 | // by zecke@handhelds.org 6th of may 2004 | ||
20 | 23 | ||
21 | #include "clock.h" | 24 | #include "clock.h" |
@@ -24,7 +27,11 @@ | |||
24 | #include <opie2/odebug.h> | 27 | #include <opie2/odebug.h> |
25 | #include <opie2/otaskbarapplet.h> | 28 | #include <opie2/otaskbarapplet.h> |
29 | |||
26 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 31 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
33 | #include <qpe/resource.h> | ||
34 | |||
35 | #include <qpopupmenu.h> | ||
29 | 36 | ||
30 | using namespace Opie::Core; | 37 | using namespace Opie::Core; |
@@ -58,9 +65,38 @@ void LauncherClock::readConfig() { | |||
58 | } | 65 | } |
59 | 66 | ||
60 | void LauncherClock::mouseReleaseEvent( QMouseEvent * ) | 67 | void LauncherClock::mousePressEvent( QMouseEvent * ) |
61 | { | 68 | { |
62 | QCString setTimeApp; | 69 | QPopupMenu *menu = new QPopupMenu(this); |
63 | setTimeApp="systemtime"; | 70 | menu->insertItem(tr("Set time..."), 0); |
64 | QCopEnvelope e("QPE/Application/"+setTimeApp, "raise()"); | 71 | menu->insertSeparator(); |
72 | menu->insertItem(tr("Clock.."), 1); | ||
73 | |||
74 | |||
75 | Config config( "Clock" ); | ||
76 | config.setGroup( "Daily Alarm" ); | ||
77 | bool alarmOn = config.readBoolEntry("Enabled", FALSE); | ||
78 | menu->insertItem(Resource::loadIconSet(alarmOn?"clockapplet/smallalarm":"clockapplet/smallalarm_off" ), | ||
79 | tr("Alarm..."), 2); | ||
80 | |||
81 | |||
82 | /* FIXME use OTaskBarApplet ### */ | ||
83 | QPoint curPos = mapToGlobal( QPoint(0,0) ); | ||
84 | QSize sh = menu->sizeHint(); | ||
85 | switch (menu->exec( curPos-QPoint((sh.width()-width())/2,sh.height()) )) { | ||
86 | case 0: | ||
87 | Global::execute( "systemtime" ); | ||
88 | break; | ||
89 | case 1: { | ||
90 | QCopEnvelope e("QPE/Application/clock", "showClock()" ); | ||
91 | } | ||
92 | break; | ||
93 | case 2: { | ||
94 | QCopEnvelope e("QPE/Application/clock", "editDailyAlarm()" ); | ||
95 | } | ||
96 | break; | ||
97 | default: | ||
98 | break; | ||
99 | } | ||
100 | delete menu; | ||
65 | } | 101 | } |
66 | 102 | ||
@@ -114,5 +150,5 @@ void LauncherClock::changeTime( void ) | |||
114 | } | 150 | } |
115 | 151 | ||
116 | void LauncherClock::slotClockChanged( bool pm ) | 152 | void LauncherClock::slotClockChanged( bool ) |
117 | { | 153 | { |
118 | readConfig(); | 154 | readConfig(); |
diff --git a/core/applets/clockapplet/clock.h b/core/applets/clockapplet/clock.h index 996fb56..43639bb 100644 --- a/core/applets/clockapplet/clock.h +++ b/core/applets/clockapplet/clock.h | |||
@@ -37,5 +37,5 @@ protected slots: | |||
37 | 37 | ||
38 | protected: | 38 | protected: |
39 | void mouseReleaseEvent( QMouseEvent * ); | 39 | void mousePressEvent( QMouseEvent * ); |
40 | void timerEvent( QTimerEvent * ); | 40 | void timerEvent( QTimerEvent * ); |
41 | void changeTime( void ); | 41 | void changeTime( void ); |