summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-25 13:36:57 (UTC)
committer zautrix <zautrix>2005-04-25 13:36:57 (UTC)
commit3978688cbe832e2b72c8048b96c9a7c43ce11bc9 (patch) (unidiff)
tree8c459ecc1bb64b5ff67433461618492cbcc2ac4a
parent119181e56ffd7987ae57749bde85935e29482955 (diff)
downloadkdepimpi-3978688cbe832e2b72c8048b96c9a7c43ce11bc9.zip
kdepimpi-3978688cbe832e2b72c8048b96c9a7c43ce11bc9.tar.gz
kdepimpi-3978688cbe832e2b72c8048b96c9a7c43ce11bc9.tar.bz2
alarm fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index c747dfd..37e7d0d 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -35,50 +35,50 @@
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qdialog.h> 38#include <qdialog.h>
39#define protected public 39#define protected public
40#include <qspinbox.h> 40#include <qspinbox.h>
41#undef protected 41#undef protected
42#include <qtextstream.h> 42#include <qtextstream.h>
43#include <qtopia/qcopenvelope_qws.h> 43#include <qtopia/qcopenvelope_qws.h>
44#include <qtopia/alarmserver.h> 44#include <qtopia/alarmserver.h>
45 45
46#include <stdlib.h> 46#include <stdlib.h>
47#include <stdio.h> 47#include <stdio.h>
48#include <unistd.h> 48#include <unistd.h>
49 49
50 50
51SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) 51SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent )
52 : QLabel( parent ) 52 : QLabel( parent )
53{ 53{
54 mAlarmDialog = new AlarmDialog( 0 ); 54 mAlarmDialog = new AlarmDialog( 0 );
55 mPopUp = new QPopupMenu( this ); 55 mPopUp = new QPopupMenu( this );
56 mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) ); 56 mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) );
57 mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) ); 57 mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) );
58 mPopUp->insertSeparator(); 58 mPopUp->insertSeparator();
59 //mPopUp->insertItem( "Todo List", this, SLOT ( showTodo() ) ); 59 mPopUp->insertItem( "Todo List", this, SLOT ( showTodo() ) );
60 //mPopUp->insertSeparator(); 60 mPopUp->insertSeparator();
61 mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) ); 61 mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) );
62 mPopUp->insertSeparator(); 62 mPopUp->insertSeparator();
63 mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) ); 63 mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) );
64 mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) ); 64 mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) );
65 mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) ); 65 mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) );
66 mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) ); 66 mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) );
67 mPopUp->insertSeparator(); 67 mPopUp->insertSeparator();
68 mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) ); 68 mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) );
69 mTimerPopUp = new QPopupMenu( this ); 69 mTimerPopUp = new QPopupMenu( this );
70 QFont fon = mTimerPopUp->font(); 70 QFont fon = mTimerPopUp->font();
71 fon.setPointSize( fon.pointSize() *3/2 ); 71 fon.setPointSize( fon.pointSize() *3/2 );
72 mTimerPopUp->setFont( fon ); 72 mTimerPopUp->setFont( fon );
73 mPopUp->setFont( fon ); 73 mPopUp->setFont( fon );
74 mBeepPopUp = new QPopupMenu( this ); 74 mBeepPopUp = new QPopupMenu( this );
75 mSoundPopUp = new QPopupMenu( this ); 75 mSoundPopUp = new QPopupMenu( this );
76 mPausePopUp = new QPopupMenu( this ); 76 mPausePopUp = new QPopupMenu( this );
77 QPopupMenu* savePopUp = new QPopupMenu( this ); 77 QPopupMenu* savePopUp = new QPopupMenu( this );
78 savePopUp->insertItem( "Save", 0 ); 78 savePopUp->insertItem( "Save", 0 );
79 savePopUp->insertItem( "Load", 1 ); 79 savePopUp->insertItem( "Load", 1 );
80 mSoundPopUp->insertItem( "Buzzer", 0 ); 80 mSoundPopUp->insertItem( "Buzzer", 0 );
81 mSoundPopUp->insertItem( "Wav file", 1 ); 81 mSoundPopUp->insertItem( "Wav file", 1 );
82 mPausePopUp->insertItem( " 1 sec", 1 ); 82 mPausePopUp->insertItem( " 1 sec", 1 );
83 mPausePopUp->insertItem( " 2 sec", 2 ); 83 mPausePopUp->insertItem( " 2 sec", 2 );
84 mPausePopUp->insertItem( " 3 sec", 3 ); 84 mPausePopUp->insertItem( " 3 sec", 3 );
@@ -88,55 +88,57 @@ SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent )
88 mPausePopUp->insertItem( " 1 min", 60 ); 88 mPausePopUp->insertItem( " 1 min", 60 );
89 mPausePopUp->insertItem( " 5 min", 300 ); 89 mPausePopUp->insertItem( " 5 min", 300 );
90 mPausePopUp->insertItem( "10 min", 600 ); 90 mPausePopUp->insertItem( "10 min", 600 );
91 mSuspendPopUp = new QPopupMenu( this ); 91 mSuspendPopUp = new QPopupMenu( this );
92 mSuspendPopUp->insertItem( "Off", 0 ); 92 mSuspendPopUp->insertItem( "Off", 0 );
93 mSuspendPopUp->insertItem( " 1x", 1 ); 93 mSuspendPopUp->insertItem( " 1x", 1 );
94 mSuspendPopUp->insertItem( " 2x", 2 ); 94 mSuspendPopUp->insertItem( " 2x", 2 );
95 mSuspendPopUp->insertItem( " 3x", 3 ); 95 mSuspendPopUp->insertItem( " 3x", 3 );
96 mSuspendPopUp->insertItem( " 5x", 5 ); 96 mSuspendPopUp->insertItem( " 5x", 5 );
97 mSuspendPopUp->insertItem( "10x", 10 ); 97 mSuspendPopUp->insertItem( "10x", 10 );
98 mSuspendPopUp->insertItem( "20x", 20 ); 98 mSuspendPopUp->insertItem( "20x", 20 );
99 mSuspendPopUp->insertItem( "30x", 30 ); 99 mSuspendPopUp->insertItem( "30x", 30 );
100 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); 100 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp );
101 mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); 101 mBeepPopUp->insertItem( "Beep interval",mPausePopUp );
102 mBeepPopUp->insertItem( "Replay",mSoundPopUp ); 102 mBeepPopUp->insertItem( "Replay",mSoundPopUp );
103 mBeepPopUp->insertItem( "Config",savePopUp ); 103 mBeepPopUp->insertItem( "Config",savePopUp );
104 mBeepPopUp->insertItem( "300", 300 ); 104 mBeepPopUp->insertItem( "300", 300 );
105 mBeepPopUp->insertItem( "180", 180 ); 105 mBeepPopUp->insertItem( "180", 180 );
106 mBeepPopUp->insertItem( "60", 60 ); 106 mBeepPopUp->insertItem( "60", 60 );
107 mBeepPopUp->insertItem( "30", 30 ); 107 mBeepPopUp->insertItem( "30", 30 );
108 mBeepPopUp->insertItem( "10", 10 ); 108 mBeepPopUp->insertItem( "10", 10 );
109 mBeepPopUp->insertItem( "3", 3 ); 109 mBeepPopUp->insertItem( "3", 3 );
110 mBeepPopUp->insertItem( "1", 1 ); 110 mBeepPopUp->insertItem( "1", 1 );
111 mBeepPopUp->insertItem( "Off", 0 ); 111 mBeepPopUp->insertItem( "Off", 0 );
112 mBeepPopUp->insertSeparator();
113 mBeepPopUp->insertItem( "Simulate", 1000 );
112 mBeepPopUp->setCheckable( true ); 114 mBeepPopUp->setCheckable( true );
113 mPopUp->insertSeparator(); 115 mPopUp->insertSeparator();
114 mPopUp->insertItem( "Play beeps", mBeepPopUp ); 116 mPopUp->insertItem( "Play beeps", mBeepPopUp );
115 mPopUp->insertSeparator(); 117 mPopUp->insertSeparator();
116 mPopUp->insertItem( "Timer", mTimerPopUp ); 118 mPopUp->insertItem( "Timer", mTimerPopUp );
117 mPopUp->insertSeparator(); 119 //mPopUp->insertSeparator();
118 mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); 120 //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) );
119 121
120 mPopUp->resize( mPopUp->sizeHint() ); 122 mPopUp->resize( mPopUp->sizeHint() );
121 mPlayBeeps = 60; 123 mPlayBeeps = 60;
122 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 124 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
123 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); 125 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) );
124 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); 126 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) );
125 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); 127 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) );
126 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); 128 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) );
127 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); 129 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) );
128 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); 130 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) );
129 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); 131 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) );
130 mTimerTime = 0; 132 mTimerTime = 0;
131 mCustomText = "Custom Text"; 133 mCustomText = "Custom Text";
132 mCustomMinutes = 7; 134 mCustomMinutes = 7;
133 mTimerPopupConf = 1; 135 mTimerPopupConf = 1;
134 fillTimerPopUp(); 136 fillTimerPopUp();
135 mPausePlay = 0; 137 mPausePlay = 0;
136 confPause( 1 ); 138 confPause( 1 );
137 mSuspend = 0; 139 mSuspend = 0;
138 confSuspend( 0 ); 140 confSuspend( 0 );
139 if ( QApplication::desktop()->width() < 480 ) { 141 if ( QApplication::desktop()->width() < 480 ) {
140 wavAlarm = false; 142 wavAlarm = false;
141 mSoundPopUp->setItemChecked ( 0, true ); 143 mSoundPopUp->setItemChecked ( 0, true );
142 } 144 }
@@ -235,48 +237,52 @@ void SimpleAlarmDaemonImpl::confSuspend( int num )
235 mSuspendPopUp->setItemChecked ( mSuspend,false ); 237 mSuspendPopUp->setItemChecked ( mSuspend,false );
236 mSuspend = num; 238 mSuspend = num;
237 mSuspendPopUp->setItemChecked ( mSuspend,true ); 239 mSuspendPopUp->setItemChecked ( mSuspend,true );
238} 240}
239void SimpleAlarmDaemonImpl::confPause( int num ) 241void SimpleAlarmDaemonImpl::confPause( int num )
240{ 242{
241 mPausePopUp->setItemChecked ( mPausePlay,false ); 243 mPausePopUp->setItemChecked ( mPausePlay,false );
242 mPausePlay = num; 244 mPausePlay = num;
243 mPausePopUp->setItemChecked ( mPausePlay,true ); 245 mPausePopUp->setItemChecked ( mPausePlay,true );
244} 246}
245void SimpleAlarmDaemonImpl::confSound( int num ) 247void SimpleAlarmDaemonImpl::confSound( int num )
246{ 248{
247 if ( num == 0 ) { 249 if ( num == 0 ) {
248 wavAlarm = false; 250 wavAlarm = false;
249 mSoundPopUp->setItemChecked ( 0, true ); 251 mSoundPopUp->setItemChecked ( 0, true );
250 mSoundPopUp->setItemChecked ( 1, false ); 252 mSoundPopUp->setItemChecked ( 1, false );
251 } else { 253 } else {
252 wavAlarm = true; 254 wavAlarm = true;
253 mSoundPopUp->setItemChecked ( 0, false ); 255 mSoundPopUp->setItemChecked ( 0, false );
254 mSoundPopUp->setItemChecked ( 1, true ); 256 mSoundPopUp->setItemChecked ( 1, true );
255 } 257 }
256} 258}
257void SimpleAlarmDaemonImpl::slotPlayBeep( int num ) 259void SimpleAlarmDaemonImpl::slotPlayBeep( int num )
258{ 260{
261 if ( num == 1000 ) {
262 simulate();
263 return;
264 }
259 mBeepPopUp->setItemChecked ( mPlayBeeps,false ); 265 mBeepPopUp->setItemChecked ( mPlayBeeps,false );
260 mPlayBeeps = num; 266 mPlayBeeps = num;
261 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 267 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
262} 268}
263 269
264void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& ) 270void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& )
265{ 271{
266 //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data()); 272 //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data());
267 QString mess = msg; 273 QString mess = msg;
268 mAlarmMessage = mess.mid( 9 ); 274 mAlarmMessage = mess.mid( 9 );
269 QString filename = getenv("QPEDIR") ; 275 QString filename = getenv("QPEDIR") ;
270 filename += "/pics/kdepim/korganizer/koalarm.wav"; 276 filename += "/pics/kdepim/korganizer/koalarm.wav";
271 QString tempfilename; 277 QString tempfilename;
272 if ( mess.left( 13 ) == "suspend_alarm") { 278 if ( mess.left( 13 ) == "suspend_alarm") {
273 bool error = false; 279 bool error = false;
274 int len = mess.mid( 13 ).find("+++"); 280 int len = mess.mid( 13 ).find("+++");
275 if ( len < 2 ) 281 if ( len < 2 )
276 error = true; 282 error = true;
277 else { 283 else {
278 tempfilename = mess.mid( 13, len ); 284 tempfilename = mess.mid( 13, len );
279 if ( !QFile::exists( tempfilename ) ) 285 if ( !QFile::exists( tempfilename ) )
280 error = true; 286 error = true;
281 } 287 }
282 if ( ! error ) { 288 if ( ! error ) {