summaryrefslogtreecommitdiff
path: root/core
Unidiff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clockapplet/clock.cpp46
-rw-r--r--core/applets/clockapplet/clock.h2
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,5 +1,6 @@
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.
5** 6**
@@ -17,15 +18,21 @@
17** not clear to you. 18** not clear to you.
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"
22 25
23/* OPIE */ 26/* OPIE */
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
30using namespace Opie::Core; 37using namespace Opie::Core;
31using namespace Opie::Ui; 38using namespace Opie::Ui;
@@ -57,11 +64,40 @@ void LauncherClock::readConfig() {
57 format = config.readNumEntry("ClockApplet",0); 64 format = config.readNumEntry("ClockApplet",0);
58} 65}
59 66
60void LauncherClock::mouseReleaseEvent( QMouseEvent * ) 67void 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
67 103
@@ -113,7 +149,7 @@ void LauncherClock::changeTime( void )
113 } 149 }
114} 150}
115 151
116void LauncherClock::slotClockChanged( bool pm ) 152void LauncherClock::slotClockChanged( bool )
117{ 153{
118 readConfig(); 154 readConfig();
119 updateTime(); 155 updateTime();
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
@@ -36,7 +36,7 @@ protected slots:
36 void slotClockChanged( bool pm ); 36 void slotClockChanged( bool pm );
37 37
38protected: 38protected:
39 void mouseReleaseEvent( QMouseEvent * ); 39 void mousePressEvent( QMouseEvent * );
40 void timerEvent( QTimerEvent * ); 40 void timerEvent( QTimerEvent * );
41 void changeTime( void ); 41 void changeTime( void );
42 void readConfig(); 42 void readConfig();