summaryrefslogtreecommitdiffabout
path: root/kalarmd
authorzautrix <zautrix>2004-10-27 13:36:25 (UTC)
committer zautrix <zautrix>2004-10-27 13:36:25 (UTC)
commite099c37ac90e95c5a3110941aaae2be229bccb8e (patch) (unidiff)
treedad2ae54474767c4c5797e1780c4a3fee8c132e5 /kalarmd
parent2f3396d84d2f3c92e1e0e420d677892c1f9c0778 (diff)
downloadkdepimpi-e099c37ac90e95c5a3110941aaae2be229bccb8e.zip
kdepimpi-e099c37ac90e95c5a3110941aaae2be229bccb8e.tar.gz
kdepimpi-e099c37ac90e95c5a3110941aaae2be229bccb8e.tar.bz2
wn view enhancements
Diffstat (limited to 'kalarmd') (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/simplealarmdaemonapplet.cpp1
-rw-r--r--kalarmd/simplealarmdaemonapplet.h1
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp18
3 files changed, 10 insertions, 10 deletions
diff --git a/kalarmd/simplealarmdaemonapplet.cpp b/kalarmd/simplealarmdaemonapplet.cpp
index 7e8125d..94d8428 100644
--- a/kalarmd/simplealarmdaemonapplet.cpp
+++ b/kalarmd/simplealarmdaemonapplet.cpp
@@ -1,57 +1,58 @@
1#include "simplealarmdaemonapplet.h" 1#include "simplealarmdaemonapplet.h"
2 2
3#include "simplealarmdaemonimpl.h" 3#include "simplealarmdaemonimpl.h"
4 4
5#include <qcopchannel_qws.h> 5#include <qcopchannel_qws.h>
6#include <qlabel.h> 6#include <qlabel.h>
7#include <qapp.h> 7#include <qapp.h>
8#include <qpe/resource.h> 8#include <qpe/resource.h>
9SimpleAlarmDaemonApplet::SimpleAlarmDaemonApplet() 9SimpleAlarmDaemonApplet::SimpleAlarmDaemonApplet()
10 : mApplet( 0 ), ref( 0 ) 10 : mApplet( 0 ), ref( 0 )
11{ 11{
12 12
13} 13}
14 14
15SimpleAlarmDaemonApplet::~SimpleAlarmDaemonApplet() 15SimpleAlarmDaemonApplet::~SimpleAlarmDaemonApplet()
16{ 16{
17 delete mApplet; 17 delete mApplet;
18 mApplet = 0;
18} 19}
19 20
20 21
21QWidget *SimpleAlarmDaemonApplet::applet( QWidget *parent ) 22QWidget *SimpleAlarmDaemonApplet::applet( QWidget *parent )
22{ 23{
23 if ( !mApplet ) { 24 if ( !mApplet ) {
24 mApplet = new SimpleAlarmDaemonImpl( parent ); 25 mApplet = new SimpleAlarmDaemonImpl( parent );
25 if ( QApplication::desktop()->width() < 480 ) 26 if ( QApplication::desktop()->width() < 480 )
26 mApplet->setPixmap( Resource::loadPixmap( "ko16" ) ); 27 mApplet->setPixmap( Resource::loadPixmap( "ko16" ) );
27 else 28 else
28 mApplet->setPixmap( Resource::loadPixmap( "ko24" ) ); 29 mApplet->setPixmap( Resource::loadPixmap( "ko24" ) );
29 QCopChannel* c = new QCopChannel("koalarm",mApplet , "channel" ) ; 30 QCopChannel* c = new QCopChannel("koalarm",mApplet , "channel" ) ;
30 QObject::connect( c, SIGNAL (received ( const QCString &, const QByteArray & )),mApplet, SLOT(recieve( const QCString&, const QByteArray& ))); 31 QObject::connect( c, SIGNAL (received ( const QCString &, const QByteArray & )),mApplet, SLOT(recieve( const QCString&, const QByteArray& )));
31 mApplet->show(); 32 mApplet->show();
32 } 33 }
33 return mApplet; 34 return mApplet;
34} 35}
35 36
36int SimpleAlarmDaemonApplet::position() const 37int SimpleAlarmDaemonApplet::position() const
37{ 38{
38 return 7; 39 return 7;
39} 40}
40 41
41QRESULT SimpleAlarmDaemonApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 42QRESULT SimpleAlarmDaemonApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
42{ 43{
43 *iface = 0; 44 *iface = 0;
44 if ( uuid == IID_QUnknown ) 45 if ( uuid == IID_QUnknown )
45 *iface = this; 46 *iface = this;
46 else if ( uuid == IID_TaskbarApplet ) 47 else if ( uuid == IID_TaskbarApplet )
47 *iface = this; 48 *iface = this;
48 49
49 if ( *iface ) 50 if ( *iface )
50 (*iface)->addRef(); 51 (*iface)->addRef();
51 return QS_OK; 52 return QS_OK;
52} 53}
53 54
54Q_EXPORT_INTERFACE() 55Q_EXPORT_INTERFACE()
55{ 56{
56 Q_CREATE_INSTANCE( SimpleAlarmDaemonApplet ) 57 Q_CREATE_INSTANCE( SimpleAlarmDaemonApplet )
57} 58}
diff --git a/kalarmd/simplealarmdaemonapplet.h b/kalarmd/simplealarmdaemonapplet.h
index a4cbee4..1787bf3 100644
--- a/kalarmd/simplealarmdaemonapplet.h
+++ b/kalarmd/simplealarmdaemonapplet.h
@@ -1,26 +1,25 @@
1#ifndef SIMPLEALARMDAEMONAPPLET_H 1#ifndef SIMPLEALARMDAEMONAPPLET_H
2#define SIMPLEALARMDAEMONAPPLET_H 2#define SIMPLEALARMDAEMONAPPLET_H
3 3
4#include <qpe/taskbarappletinterface.h> 4#include <qpe/taskbarappletinterface.h>
5 5
6class SimpleAlarmDaemonImpl; 6class SimpleAlarmDaemonImpl;
7class ScreenshotApplet;
8 7
9class SimpleAlarmDaemonApplet : public TaskbarAppletInterface 8class SimpleAlarmDaemonApplet : public TaskbarAppletInterface
10{ 9{
11 public: 10 public:
12 SimpleAlarmDaemonApplet(); 11 SimpleAlarmDaemonApplet();
13 virtual ~SimpleAlarmDaemonApplet(); 12 virtual ~SimpleAlarmDaemonApplet();
14 13
15 QRESULT queryInterface( const QUuid&, QUnknownInterface** ); 14 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
16 Q_REFCOUNT 15 Q_REFCOUNT
17 16
18 virtual QWidget *applet( QWidget *parent ); 17 virtual QWidget *applet( QWidget *parent );
19 virtual int position() const; 18 virtual int position() const;
20 19
21 private: 20 private:
22 SimpleAlarmDaemonImpl *mApplet; 21 SimpleAlarmDaemonImpl *mApplet;
23 ulong ref; 22 ulong ref;
24}; 23};
25 24
26#endif 25#endif
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index 4ff6861..50c4605 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -1,241 +1,241 @@
1/* 1/*
2 This file is part of the KOrganizer alarm daemon. 2 This file is part of the KOrganizer alarm daemon.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include "simplealarmdaemonimpl.h" 24#include "simplealarmdaemonimpl.h"
25 25
26#include "alarmdialog.h" 26#include "alarmdialog.h"
27#include <qpopupmenu.h> 27#include <qpopupmenu.h>
28#include <qapp.h> 28#include <qapp.h>
29#include <qdir.h> 29#include <qdir.h>
30#include <qfile.h> 30#include <qfile.h>
31#include <qhbox.h> 31#include <qhbox.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qlineedit.h> 35#include <qlineedit.h>
36#include <qdialog.h> 36#include <qdialog.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qtextstream.h> 38#include <qtextstream.h>
39#include <qtopia/qcopenvelope_qws.h> 39#include <qtopia/qcopenvelope_qws.h>
40#include <qtopia/alarmserver.h> 40#include <qtopia/alarmserver.h>
41 41
42#include <stdlib.h> 42#include <stdlib.h>
43#include <stdio.h> 43#include <stdio.h>
44#include <unistd.h> 44#include <unistd.h>
45 45
46 46
47SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) 47SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent )
48 : QLabel( parent ) 48 : QLabel( parent )
49{ 49{
50 mAlarmDialog = new AlarmDialog( 0 ); 50 mAlarmDialog = new AlarmDialog( 0 );
51 mPopUp = new QPopupMenu( 0 ); 51 mPopUp = new QPopupMenu( this );
52 mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) ); 52 mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) );
53 mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) ); 53 mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) );
54 mPopUp->insertSeparator(); 54 mPopUp->insertSeparator();
55 mPopUp->insertItem( "What's Todo?", this, SLOT ( showTodo() ) ); 55 mPopUp->insertItem( "What's Todo?", this, SLOT ( showTodo() ) );
56 mPopUp->insertSeparator(); 56 mPopUp->insertSeparator();
57 mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) ); 57 mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) );
58 mPopUp->insertSeparator(); 58 mPopUp->insertSeparator();
59 mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) ); 59 mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) );
60 mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) ); 60 mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) );
61 mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) ); 61 mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) );
62 mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) ); 62 mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) );
63 mPopUp->insertSeparator(); 63 mPopUp->insertSeparator();
64 mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) ); 64 mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) );
65 mTimerPopUp = new QPopupMenu( mPopUp ); 65 mTimerPopUp = new QPopupMenu( this );
66 66
67 mBeepPopUp = new QPopupMenu( mPopUp ); 67 mBeepPopUp = new QPopupMenu( this );
68 mSoundPopUp = new QPopupMenu( mBeepPopUp ); 68 mSoundPopUp = new QPopupMenu( this );
69 mPausePopUp = new QPopupMenu( mBeepPopUp ); 69 mPausePopUp = new QPopupMenu( this );
70 QPopupMenu* savePopUp = new QPopupMenu( mBeepPopUp ); 70 QPopupMenu* savePopUp = new QPopupMenu( this );
71 savePopUp->insertItem( "Save", 0 ); 71 savePopUp->insertItem( "Save", 0 );
72 savePopUp->insertItem( "Load", 1 ); 72 savePopUp->insertItem( "Load", 1 );
73 mSoundPopUp->insertItem( "Buzzer", 0 ); 73 mSoundPopUp->insertItem( "Buzzer", 0 );
74 mSoundPopUp->insertItem( "Wav file", 1 ); 74 mSoundPopUp->insertItem( "Wav file", 1 );
75 mPausePopUp->insertItem( " 1 sec", 1 ); 75 mPausePopUp->insertItem( " 1 sec", 1 );
76 mPausePopUp->insertItem( " 2 sec", 2 ); 76 mPausePopUp->insertItem( " 2 sec", 2 );
77 mPausePopUp->insertItem( " 3 sec", 3 ); 77 mPausePopUp->insertItem( " 3 sec", 3 );
78 mPausePopUp->insertItem( " 5 sec", 5 ); 78 mPausePopUp->insertItem( " 5 sec", 5 );
79 mPausePopUp->insertItem( "10 sec", 10 ); 79 mPausePopUp->insertItem( "10 sec", 10 );
80 mPausePopUp->insertItem( "30 sec", 30 ); 80 mPausePopUp->insertItem( "30 sec", 30 );
81 mPausePopUp->insertItem( " 1 min", 60 ); 81 mPausePopUp->insertItem( " 1 min", 60 );
82 mPausePopUp->insertItem( " 5 min", 300 ); 82 mPausePopUp->insertItem( " 5 min", 300 );
83 mPausePopUp->insertItem( "10 min", 600 ); 83 mPausePopUp->insertItem( "10 min", 600 );
84 mSuspendPopUp = new QPopupMenu( mBeepPopUp ); 84 mSuspendPopUp = new QPopupMenu( this );
85 mSuspendPopUp->insertItem( "Off", 0 ); 85 mSuspendPopUp->insertItem( "Off", 0 );
86 mSuspendPopUp->insertItem( " 1x", 1 ); 86 mSuspendPopUp->insertItem( " 1x", 1 );
87 mSuspendPopUp->insertItem( " 2x", 2 ); 87 mSuspendPopUp->insertItem( " 2x", 2 );
88 mSuspendPopUp->insertItem( " 3x", 3 ); 88 mSuspendPopUp->insertItem( " 3x", 3 );
89 mSuspendPopUp->insertItem( " 5x", 5 ); 89 mSuspendPopUp->insertItem( " 5x", 5 );
90 mSuspendPopUp->insertItem( "10x", 10 ); 90 mSuspendPopUp->insertItem( "10x", 10 );
91 mSuspendPopUp->insertItem( "20x", 20 ); 91 mSuspendPopUp->insertItem( "20x", 20 );
92 mSuspendPopUp->insertItem( "30x", 30 ); 92 mSuspendPopUp->insertItem( "30x", 30 );
93 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); 93 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp );
94 mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); 94 mBeepPopUp->insertItem( "Beep interval",mPausePopUp );
95 mBeepPopUp->insertItem( "Replay",mSoundPopUp ); 95 mBeepPopUp->insertItem( "Replay",mSoundPopUp );
96 mBeepPopUp->insertItem( "Config",savePopUp ); 96 mBeepPopUp->insertItem( "Config",savePopUp );
97 mBeepPopUp->insertItem( "300", 300 ); 97 mBeepPopUp->insertItem( "300", 300 );
98 mBeepPopUp->insertItem( "180", 180 ); 98 mBeepPopUp->insertItem( "180", 180 );
99 mBeepPopUp->insertItem( "60", 60 ); 99 mBeepPopUp->insertItem( "60", 60 );
100 mBeepPopUp->insertItem( "30", 30 ); 100 mBeepPopUp->insertItem( "30", 30 );
101 mBeepPopUp->insertItem( "10", 10 ); 101 mBeepPopUp->insertItem( "10", 10 );
102 mBeepPopUp->insertItem( "3", 3 ); 102 mBeepPopUp->insertItem( "3", 3 );
103 mBeepPopUp->insertItem( "1", 1 ); 103 mBeepPopUp->insertItem( "1", 1 );
104 mBeepPopUp->insertItem( "Off", 0 ); 104 mBeepPopUp->insertItem( "Off", 0 );
105 mBeepPopUp->setCheckable( true ); 105 mBeepPopUp->setCheckable( true );
106 mPopUp->insertSeparator(); 106 mPopUp->insertSeparator();
107 mPopUp->insertItem( "Play beeps", mBeepPopUp ); 107 mPopUp->insertItem( "Play beeps", mBeepPopUp );
108 mPopUp->insertSeparator(); 108 mPopUp->insertSeparator();
109 mPopUp->insertItem( "Timer", mTimerPopUp ); 109 mPopUp->insertItem( "Timer", mTimerPopUp );
110 mPopUp->insertSeparator(); 110 mPopUp->insertSeparator();
111 mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); 111 mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) );
112 112
113 mPopUp->resize( mPopUp->sizeHint() ); 113 mPopUp->resize( mPopUp->sizeHint() );
114 mPlayBeeps = 60; 114 mPlayBeeps = 60;
115 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 115 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
116 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); 116 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) );
117 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); 117 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) );
118 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); 118 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) );
119 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); 119 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) );
120 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); 120 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) );
121 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); 121 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) );
122 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); 122 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) );
123 mTimerTime = 0; 123 mTimerTime = 0;
124 mCustomText = "Custom Text"; 124 mCustomText = "Custom Text";
125 mCustomMinutes = 7; 125 mCustomMinutes = 7;
126 mTimerPopupConf = 1; 126 mTimerPopupConf = 1;
127 fillTimerPopUp(); 127 fillTimerPopUp();
128 mPausePlay = 0; 128 mPausePlay = 0;
129 confPause( 1 ); 129 confPause( 1 );
130 mSuspend = 0; 130 mSuspend = 0;
131 confSuspend( 0 ); 131 confSuspend( 0 );
132 if ( QApplication::desktop()->width() < 480 ) { 132 if ( QApplication::desktop()->width() < 480 ) {
133 wavAlarm = false; 133 wavAlarm = false;
134 mSoundPopUp->setItemChecked ( 0, true ); 134 mSoundPopUp->setItemChecked ( 0, true );
135 } 135 }
136 else { 136 else {
137 wavAlarm = true; 137 wavAlarm = true;
138 mSoundPopUp->setItemChecked ( 1, true ); 138 mSoundPopUp->setItemChecked ( 1, true );
139 } 139 }
140 saveSlot( 1 ); 140 saveSlot( 1 );
141} 141}
142 142
143SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() 143SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl()
144{ 144{
145 delete mPopUp; 145 //delete mPopUp;
146 delete mAlarmDialog; 146 delete mAlarmDialog;
147} 147}
148void SimpleAlarmDaemonImpl::saveSlot( int load ) 148void SimpleAlarmDaemonImpl::saveSlot( int load )
149{ 149{
150 QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; 150 QString fileName = QDir::homeDirPath() +"/.kopialarmrc";
151 //qDebug("save %d ", load ); 151 //qDebug("save %d ", load );
152 QFile file( fileName ); 152 QFile file( fileName );
153 if ( load ) { 153 if ( load ) {
154 if( !QFile::exists( fileName) ) 154 if( !QFile::exists( fileName) )
155 return; 155 return;
156 if (!file.open( IO_ReadOnly ) ) { 156 if (!file.open( IO_ReadOnly ) ) {
157 return ; 157 return ;
158 } 158 }
159 QString line; 159 QString line;
160 bool ok; 160 bool ok;
161 int val; 161 int val;
162 int len; 162 int len;
163 while ( file.readLine( line, 1024 ) > 0 ) { 163 while ( file.readLine( line, 1024 ) > 0 ) {
164 //qDebug("read %s ", line.latin1()); 164 //qDebug("read %s ", line.latin1());
165 len = line.length(); 165 len = line.length();
166 if ( line.left(4 ) == "PPAU" ) { 166 if ( line.left(4 ) == "PPAU" ) {
167 val = line.mid( 4,len-5).toInt( &ok ); 167 val = line.mid( 4,len-5).toInt( &ok );
168 if ( ok ) { 168 if ( ok ) {
169 confPause( val ); 169 confPause( val );
170 } 170 }
171 } 171 }
172 if ( line.left(4 ) == "SUCO" ) { 172 if ( line.left(4 ) == "SUCO" ) {
173 val = line.mid( 4,len-5).toInt( &ok ); 173 val = line.mid( 4,len-5).toInt( &ok );
174 if ( ok ) 174 if ( ok )
175 confSuspend ( val ); 175 confSuspend ( val );
176 } 176 }
177 if ( line.left(4 ) == "WAAL" ) { 177 if ( line.left(4 ) == "WAAL" ) {
178 val = line.mid( 4,len-5).toInt( &ok ); 178 val = line.mid( 4,len-5).toInt( &ok );
179 if ( ok ) 179 if ( ok )
180 confSound( val ); 180 confSound( val );
181 181
182 } 182 }
183 if ( line.left(4 ) == "PLBE" ) { 183 if ( line.left(4 ) == "PLBE" ) {
184 val = line.mid( 4,len-5).toInt( &ok ); 184 val = line.mid( 4,len-5).toInt( &ok );
185 if ( ok ) 185 if ( ok )
186 slotPlayBeep( val ); 186 slotPlayBeep( val );
187 187
188 } 188 }
189 if ( line.left(4 ) == "CUTE" ) { 189 if ( line.left(4 ) == "CUTE" ) {
190 mCustomText = line.mid( 5,len-6); 190 mCustomText = line.mid( 5,len-6);
191 // qDebug("text ***%s*** ",mCustomText.latin1() ); 191 // qDebug("text ***%s*** ",mCustomText.latin1() );
192 192
193 } 193 }
194 if ( line.left(4 ) == "CUMI" ) { 194 if ( line.left(4 ) == "CUMI" ) {
195 val = line.mid( 4,len-5).toInt( &ok ); 195 val = line.mid( 4,len-5).toInt( &ok );
196 if ( ok ) 196 if ( ok )
197 mCustomMinutes = val; 197 mCustomMinutes = val;
198 198
199 } 199 }
200 if ( line.left(4 ) == "SUTI" ) { 200 if ( line.left(4 ) == "SUTI" ) {
201 val = line.mid( 4,len-5).toInt( &ok ); 201 val = line.mid( 4,len-5).toInt( &ok );
202 if ( ok ) 202 if ( ok )
203 mAlarmDialog->setSuspendTime( val );; 203 mAlarmDialog->setSuspendTime( val );;
204 204
205 } 205 }
206 } 206 }
207 file.close(); 207 file.close();
208 } else { 208 } else {
209 if (!file.open( IO_WriteOnly ) ) { 209 if (!file.open( IO_WriteOnly ) ) {
210 return; 210 return;
211 } 211 }
212 QString configString ; 212 QString configString ;
213 configString += "PPAU " + QString::number( mPausePlay ) + "\n"; 213 configString += "PPAU " + QString::number( mPausePlay ) + "\n";
214 configString += "SUCO " + QString::number( mSuspend ) + "\n"; 214 configString += "SUCO " + QString::number( mSuspend ) + "\n";
215 configString += "WAAL " + QString::number( wavAlarm ) + "\n"; 215 configString += "WAAL " + QString::number( wavAlarm ) + "\n";
216 configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; 216 configString += "PLBE " + QString::number( mPlayBeeps ) + "\n";
217 configString += "CUTE " + mCustomText + "\n"; 217 configString += "CUTE " + mCustomText + "\n";
218 configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; 218 configString += "CUMI " + QString::number( mCustomMinutes ) + "\n";
219 configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n"; 219 configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n";
220 QTextStream ts( &file ); 220 QTextStream ts( &file );
221 ts << configString ; 221 ts << configString ;
222 file.close(); 222 file.close();
223 } 223 }
224 224
225} 225}
226void SimpleAlarmDaemonImpl::confSuspend( int num ) 226void SimpleAlarmDaemonImpl::confSuspend( int num )
227{ 227{
228 mSuspendPopUp->setItemChecked ( mSuspend,false ); 228 mSuspendPopUp->setItemChecked ( mSuspend,false );
229 mSuspend = num; 229 mSuspend = num;
230 mSuspendPopUp->setItemChecked ( mSuspend,true ); 230 mSuspendPopUp->setItemChecked ( mSuspend,true );
231} 231}
232void SimpleAlarmDaemonImpl::confPause( int num ) 232void SimpleAlarmDaemonImpl::confPause( int num )
233{ 233{
234 mPausePopUp->setItemChecked ( mPausePlay,false ); 234 mPausePopUp->setItemChecked ( mPausePlay,false );
235 mPausePlay = num; 235 mPausePlay = num;
236 mPausePopUp->setItemChecked ( mPausePlay,true ); 236 mPausePopUp->setItemChecked ( mPausePlay,true );
237} 237}
238void SimpleAlarmDaemonImpl::confSound( int num ) 238void SimpleAlarmDaemonImpl::confSound( int num )
239{ 239{
240 if ( num == 0 ) { 240 if ( num == 0 ) {
241 wavAlarm = false; 241 wavAlarm = false;
@@ -471,137 +471,137 @@ void SimpleAlarmDaemonImpl::confTimer( int time )
471 lay.setSpacing(5); 471 lay.setSpacing(5);
472 lay.addWidget( &lab); 472 lay.addWidget( &lab);
473 dia.resize( 200, dia.sizeHint().height() ); 473 dia.resize( 200, dia.sizeHint().height() );
474 474
475 if ( !dia.exec() ) 475 if ( !dia.exec() )
476 return; 476 return;
477 477
478 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.latin1() ); 478 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.latin1() );
479 mTimerTime = 0; 479 mTimerTime = 0;
480 return; 480 return;
481 } 481 }
482 if ( mTimerTime ) 482 if ( mTimerTime )
483 return; 483 return;
484 if ( minutes == 1 ) { 484 if ( minutes == 1 ) {
485 return; 485 return;
486 } 486 }
487 QString mess = "timer_alarm"; 487 QString mess = "timer_alarm";
488 mess += ("Timer Alarm!\n"); 488 mess += ("Timer Alarm!\n");
489 if ( minutes == 22 ) 489 if ( minutes == 22 )
490 mess += ( "Pizza is ready"); 490 mess += ( "Pizza is ready");
491 else if ( minutes == 45 ) 491 else if ( minutes == 45 )
492 mess += ( "Please wake up!"); 492 mess += ( "Please wake up!");
493 else if ( minutes == 5 ) 493 else if ( minutes == 5 )
494 mess += ( "Tea is ready"); 494 mess += ( "Tea is ready");
495 else if ( minutes == 3 ) { 495 else if ( minutes == 3 ) {
496 mess += mCustomText; 496 mess += mCustomText;
497 minutes = mCustomMinutes ; 497 minutes = mCustomMinutes ;
498 } 498 }
499 else { 499 else {
500 if ( minutes == 2 ) { 500 if ( minutes == 2 ) {
501 // ask time 501 // ask time
502 QDialog dia ( 0, ("Customize Timer" ), true ); 502 QDialog dia ( 0, ("Customize Timer" ), true );
503 QLabel lab (("Message Text:"), &dia ); 503 QLabel lab (("Message Text:"), &dia );
504 dia.setCaption(("KO/Pi Timer" )); 504 dia.setCaption(("KO/Pi Timer" ));
505 QVBoxLayout lay( &dia ); 505 QVBoxLayout lay( &dia );
506 lay.setMargin(5); 506 lay.setMargin(5);
507 lay.setSpacing(5); 507 lay.setSpacing(5);
508 lay.addWidget( &lab); 508 lay.addWidget( &lab);
509 QLineEdit lEdit( mCustomText, &dia ); 509 QLineEdit lEdit( mCustomText, &dia );
510 lay.addWidget( &lEdit); 510 lay.addWidget( &lEdit);
511 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia ); 511 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia );
512 lay.addWidget( &lab2); 512 lay.addWidget( &lab2);
513 QHBox hbox ( &dia ); 513 QHBox hbox ( &dia );
514 QLabel lab3 (("h:"), &hbox ); 514 QLabel lab3 (("h:"), &hbox );
515 QSpinBox spinh( 0, 24, 1,& hbox ); 515 QSpinBox spinh( 0, 24, 1,& hbox );
516 QLabel lab4 ((" min:"), &hbox ); 516 QLabel lab4 ((" min:"), &hbox );
517 QSpinBox spinm( 0, 59, 1,&hbox ); 517 QSpinBox spinm( 0, 59, 1,&hbox );
518 spinh.setValue( mCustomMinutes/60 ); 518 spinh.setValue( mCustomMinutes/60 );
519 spinm.setValue( mCustomMinutes%60 ); 519 spinm.setValue( mCustomMinutes%60 );
520 lay.addWidget( &hbox); 520 lay.addWidget( &hbox);
521 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); 521 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() );
522 if ( !dia.exec() ) 522 if ( !dia.exec() )
523 return; 523 return;
524 mCustomText = lEdit.text(); 524 mCustomText = lEdit.text();
525 mCustomMinutes = spinh.value()*60+spinm.value(); 525 mCustomMinutes = spinh.value()*60+spinm.value();
526 if ( mCustomMinutes == 0 ) 526 if ( mCustomMinutes == 0 )
527 mCustomMinutes = 1; 527 mCustomMinutes = 1;
528 if ( mCustomMinutes > 1440 ) 528 if ( mCustomMinutes > 1440 )
529 mCustomMinutes = 1440; 529 mCustomMinutes = 1440;
530 mess += mCustomText; 530 mess += mCustomText;
531 minutes = mCustomMinutes; 531 minutes = mCustomMinutes;
532 } 532 }
533 else 533 else
534 mess+= QString::number ( minutes ) + ( " minutes are past!"); 534 mess+= QString::number ( minutes ) + ( " minutes are past!");
535 } 535 }
536 //minutes = 1; 536 //minutes = 1;
537 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); 537 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 );
538 timerMesssage = mess; 538 timerMesssage = mess;
539 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1()); 539 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1());
540 mTimerTime = 1; 540 mTimerTime = 1;
541} 541}
542 542
543void SimpleAlarmDaemonImpl::writeFile() 543void SimpleAlarmDaemonImpl::writeFile()
544{ 544{
545 QCopEnvelope e("QPE/Application/kopi", "-writeFile"); 545 QCopEnvelope e("QPE/Application/kopi", "-writeFile");
546} 546}
547void SimpleAlarmDaemonImpl::showWN() 547void SimpleAlarmDaemonImpl::showWN()
548{ 548{
549 QCopEnvelope e("QPE/Application/kopi", "-showWN"); 549 QCopEnvelope e("QPE/Application/kopi", "-showWN");
550} 550}
551void SimpleAlarmDaemonImpl::newTodo() 551void SimpleAlarmDaemonImpl::newTodo()
552{ 552{
553 QCopEnvelope e("QPE/Application/kopi", "-newTodo"); 553 QCopEnvelope e("QPE/Application/kopi", "-newTodo");
554} 554}
555 555
556void SimpleAlarmDaemonImpl::newEvent() 556void SimpleAlarmDaemonImpl::newEvent()
557{ 557{
558 QCopEnvelope e("QPE/Application/kopi", "-newEvent"); 558 QCopEnvelope e("QPE/Application/kopi", "-newEvent");
559 559
560} 560}
561void SimpleAlarmDaemonImpl::newMail() 561void SimpleAlarmDaemonImpl::newMail()
562{ 562{
563 QCopEnvelope e("QPE/Application/ompi", "newMail()"); 563 QCopEnvelope e("QPE/Application/ompi", "newMail()");
564} 564}
565void SimpleAlarmDaemonImpl::showAdd() 565void SimpleAlarmDaemonImpl::showAdd()
566{ 566{
567 QCopEnvelope e("QPE/Application/kapi", " "); 567 QCopEnvelope e("QPE/Application/kapi", "raise()");
568} 568}
569void SimpleAlarmDaemonImpl::ringSync() 569void SimpleAlarmDaemonImpl::ringSync()
570{ 570{
571 QCopEnvelope e("QPE/Application/kopi", "-ringSync"); 571 QCopEnvelope e("QPE/Application/kopi", "-ringSync");
572 572
573} 573}
574void SimpleAlarmDaemonImpl::newCountdown() 574void SimpleAlarmDaemonImpl::newCountdown()
575{ 575{
576 //recieve("cal_alarm", 10 ); 576 //recieve("cal_alarm", 10 );
577} 577}
578void SimpleAlarmDaemonImpl::simulate() 578void SimpleAlarmDaemonImpl::simulate()
579{ 579{
580 writeFile(); 580 writeFile();
581 QString filename = getenv("QPEDIR") ; 581 QString filename = getenv("QPEDIR") ;
582 filename += "/pics/kdepim/korganizer/koalarm.wav"; 582 filename += "/pics/kdepim/korganizer/koalarm.wav";
583 startAlarm("Alarm simulation", filename ); 583 startAlarm("Alarm simulation", filename );
584} 584}
585void SimpleAlarmDaemonImpl::showKO() 585void SimpleAlarmDaemonImpl::showKO()
586{ 586{
587 QCopEnvelope e("QPE/Application/kopi", "-showKO"); 587 QCopEnvelope e("QPE/Application/kopi", "-showKO");
588 588
589} 589}
590void SimpleAlarmDaemonImpl::showTodo() 590void SimpleAlarmDaemonImpl::showTodo()
591{ 591{
592 QCopEnvelope e("QPE/Application/kopi", "-showTodo"); 592 QCopEnvelope e("QPE/Application/kopi", "-showTodo");
593 593
594} 594}
595void SimpleAlarmDaemonImpl::writeJournal() 595void SimpleAlarmDaemonImpl::writeJournal()
596{ 596{
597 QCopEnvelope e("QPE/Application/kopi", "-showJournal"); 597 QCopEnvelope e("QPE/Application/kopi", "-showJournal");
598 598
599} 599}
600 600
601void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * ) 601void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * )
602{ 602{
603 603
604 mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() ))); 604 mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() )));
605 605
606} 606}
607 607