author | zautrix <zautrix> | 2005-10-29 00:21:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-29 00:21:37 (UTC) |
commit | acd1c021e6ddef4285b3220d7515a3917416b92f (patch) (unidiff) | |
tree | 3409f47cc4a9a0b6ffb53313e9a3b4a1d82f70ce /kalarmd/simplealarmdaemonimpl.cpp | |
parent | 7a90e619147e06e5f4d4facef98364f78a4a04ef (diff) | |
download | kdepimpi-acd1c021e6ddef4285b3220d7515a3917416b92f.zip kdepimpi-acd1c021e6ddef4285b3220d7515a3917416b92f.tar.gz kdepimpi-acd1c021e6ddef4285b3220d7515a3917416b92f.tar.bz2 |
fix
Diffstat (limited to 'kalarmd/simplealarmdaemonimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kalarmd/simplealarmdaemonimpl.cpp | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp index 82873e1..2742610 100644 --- a/kalarmd/simplealarmdaemonimpl.cpp +++ b/kalarmd/simplealarmdaemonimpl.cpp | |||
@@ -22,261 +22,273 @@ | |||
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 <qdatetime.h> | 34 | #include <qdatetime.h> |
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 | ||
51 | SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) | 51 | SimpleAlarmDaemonImpl::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 | |
71 | int points = (fon.pointSize()*4)/3; | ||
72 | fon.setPointSize( points ); | ||
73 | mTimerPopUp->setFont( fon ); | ||
74 | mPopUp->setFont( fon ); | ||
75 | mBeepPopUp = new QPopupMenu( this ); | 71 | mBeepPopUp = new QPopupMenu( this ); |
76 | mSoundPopUp = new QPopupMenu( this ); | 72 | mSoundPopUp = new QPopupMenu( this ); |
77 | mPausePopUp = new QPopupMenu( this ); | 73 | mPausePopUp = new QPopupMenu( this ); |
74 | mFontsizePopup = new QPopupMenu( this ); | ||
75 | mFontsizePopup->insertItem( "10", 10 ); | ||
76 | mFontsizePopup->insertItem( "12", 12 ); | ||
77 | mFontsizePopup->insertItem( "14", 14 ); | ||
78 | mFontsizePopup->insertItem( "16", 16 ); | ||
79 | mFontsizePopup->insertItem( "18", 18 ); | ||
80 | mFontsizePopup->insertItem( "24", 24 ); | ||
78 | QPopupMenu* savePopUp = new QPopupMenu( this ); | 81 | QPopupMenu* savePopUp = new QPopupMenu( this ); |
79 | savePopUp->insertItem( "Save", 0 ); | 82 | savePopUp->insertItem( "Save", 0 ); |
80 | savePopUp->insertItem( "Load", 1 ); | 83 | savePopUp->insertItem( "Load", 1 ); |
81 | mSoundPopUp->insertItem( "Buzzer", 0 ); | 84 | mSoundPopUp->insertItem( "Buzzer", 0 ); |
82 | mSoundPopUp->insertItem( "Wav file", 1 ); | 85 | mSoundPopUp->insertItem( "Wav file", 1 ); |
83 | mPausePopUp->insertItem( " 1 sec", 1 ); | 86 | mPausePopUp->insertItem( " 1 sec", 1 ); |
84 | mPausePopUp->insertItem( " 2 sec", 2 ); | 87 | mPausePopUp->insertItem( " 2 sec", 2 ); |
85 | mPausePopUp->insertItem( " 3 sec", 3 ); | 88 | mPausePopUp->insertItem( " 3 sec", 3 ); |
86 | mPausePopUp->insertItem( " 5 sec", 5 ); | 89 | mPausePopUp->insertItem( " 5 sec", 5 ); |
87 | mPausePopUp->insertItem( "10 sec", 10 ); | 90 | mPausePopUp->insertItem( "10 sec", 10 ); |
88 | mPausePopUp->insertItem( "30 sec", 30 ); | 91 | mPausePopUp->insertItem( "30 sec", 30 ); |
89 | mPausePopUp->insertItem( " 1 min", 60 ); | 92 | mPausePopUp->insertItem( " 1 min", 60 ); |
90 | mPausePopUp->insertItem( " 5 min", 300 ); | 93 | mPausePopUp->insertItem( " 5 min", 300 ); |
91 | mPausePopUp->insertItem( "10 min", 600 ); | 94 | mPausePopUp->insertItem( "10 min", 600 ); |
92 | mSuspendPopUp = new QPopupMenu( this ); | 95 | mSuspendPopUp = new QPopupMenu( this ); |
93 | mSuspendPopUp->insertItem( "Off", 0 ); | 96 | mSuspendPopUp->insertItem( "Off", 0 ); |
94 | mSuspendPopUp->insertItem( " 1x", 1 ); | 97 | mSuspendPopUp->insertItem( " 1x", 1 ); |
95 | mSuspendPopUp->insertItem( " 2x", 2 ); | 98 | mSuspendPopUp->insertItem( " 2x", 2 ); |
96 | mSuspendPopUp->insertItem( " 3x", 3 ); | 99 | mSuspendPopUp->insertItem( " 3x", 3 ); |
97 | mSuspendPopUp->insertItem( " 5x", 5 ); | 100 | mSuspendPopUp->insertItem( " 5x", 5 ); |
98 | mSuspendPopUp->insertItem( "10x", 10 ); | 101 | mSuspendPopUp->insertItem( "10x", 10 ); |
99 | mSuspendPopUp->insertItem( "20x", 20 ); | 102 | mSuspendPopUp->insertItem( "20x", 20 ); |
100 | mSuspendPopUp->insertItem( "30x", 30 ); | 103 | mSuspendPopUp->insertItem( "30x", 30 ); |
101 | mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); | 104 | mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); |
102 | mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); | 105 | mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); |
103 | mBeepPopUp->insertItem( "Replay",mSoundPopUp ); | 106 | mBeepPopUp->insertItem( "Replay",mSoundPopUp ); |
107 | mBeepPopUp->insertItem( "Font Size",mFontsizePopup ); | ||
104 | mBeepPopUp->insertItem( "Config",savePopUp ); | 108 | mBeepPopUp->insertItem( "Config",savePopUp ); |
105 | mBeepPopUp->insertItem( "300", 300 ); | 109 | mBeepPopUp->insertItem( "300", 300 ); |
106 | mBeepPopUp->insertItem( "180", 180 ); | 110 | mBeepPopUp->insertItem( "180", 180 ); |
107 | mBeepPopUp->insertItem( "60", 60 ); | 111 | mBeepPopUp->insertItem( "60", 60 ); |
108 | mBeepPopUp->insertItem( "30", 30 ); | 112 | mBeepPopUp->insertItem( "30", 30 ); |
109 | mBeepPopUp->insertItem( "10", 10 ); | 113 | mBeepPopUp->insertItem( "10", 10 ); |
110 | mBeepPopUp->insertItem( "3", 3 ); | 114 | mBeepPopUp->insertItem( "3", 3 ); |
111 | mBeepPopUp->insertItem( "1", 1 ); | 115 | mBeepPopUp->insertItem( "1", 1 ); |
112 | mBeepPopUp->insertItem( "Off", 0 ); | 116 | mBeepPopUp->insertItem( "Off", 0 ); |
113 | mBeepPopUp->insertSeparator(); | 117 | mBeepPopUp->insertSeparator(); |
114 | mBeepPopUp->insertItem( "Simulate", 1000 ); | 118 | mBeepPopUp->insertItem( "Simulate", 1000 ); |
115 | mBeepPopUp->setCheckable( true ); | 119 | mBeepPopUp->setCheckable( true ); |
116 | mPopUp->insertSeparator(); | 120 | mPopUp->insertSeparator(); |
117 | mPopUp->insertItem( "Play beeps", mBeepPopUp ); | 121 | mPopUp->insertItem( "Play beeps", mBeepPopUp ); |
118 | mPopUp->insertSeparator(); | 122 | mPopUp->insertSeparator(); |
119 | mPopUp->insertItem( "Timer", mTimerPopUp ); | 123 | mPopUp->insertItem( "Timer", mTimerPopUp ); |
120 | //mPopUp->insertSeparator(); | 124 | //mPopUp->insertSeparator(); |
121 | //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); | 125 | //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); |
122 | 126 | ||
123 | mPopUp->resize( mPopUp->sizeHint() ); | 127 | mPopUp->resize( mPopUp->sizeHint() ); |
124 | mPlayBeeps = 60; | 128 | mPlayBeeps = 60; |
125 | mBeepPopUp->setItemChecked ( mPlayBeeps, true ); | 129 | mBeepPopUp->setItemChecked ( mPlayBeeps, true ); |
126 | connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); | 130 | connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); |
127 | connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); | 131 | connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); |
128 | connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); | 132 | connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); |
129 | connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); | 133 | connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); |
130 | connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); | 134 | connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); |
131 | connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); | 135 | connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); |
132 | connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); | 136 | connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); |
137 | connect ( mFontsizePopup, SIGNAL( activated ( int ) ), this, SLOT (confFontSize( int ) ) ); | ||
133 | mTimerTime = 0; | 138 | mTimerTime = 0; |
134 | mCustomText = "Custom Text"; | 139 | mCustomText = "Custom Text"; |
135 | mCustomMinutes = 7; | 140 | mCustomMinutes = 7; |
136 | mTimerPopupConf = 1; | 141 | mTimerPopupConf = 1; |
137 | fillTimerPopUp(); | 142 | fillTimerPopUp(); |
138 | mPausePlay = 0; | 143 | mPausePlay = 0; |
139 | confPause( 1 ); | 144 | confPause( 1 ); |
140 | mSuspend = 0; | 145 | mSuspend = 0; |
141 | confSuspend( 0 ); | 146 | confSuspend( 0 ); |
142 | if ( QApplication::desktop()->width() < 480 ) { | 147 | if ( QApplication::desktop()->width() < 480 ) { |
143 | wavAlarm = false; | 148 | wavAlarm = false; |
144 | mSoundPopUp->setItemChecked ( 0, true ); | 149 | mSoundPopUp->setItemChecked ( 0, true ); |
145 | } | 150 | } |
146 | else { | 151 | else { |
147 | wavAlarm = true; | 152 | wavAlarm = true; |
148 | mSoundPopUp->setItemChecked ( 1, true ); | 153 | mSoundPopUp->setItemChecked ( 1, true ); |
149 | } | 154 | } |
150 | saveSlot( 1 ); | ||
151 | mTimerStartLabel = new QLabel( 0, 0, WType_Popup ); | 155 | mTimerStartLabel = new QLabel( 0, 0, WType_Popup ); |
152 | //mTimerStartLabel->setCaption( "Timer started!"); | 156 | //mTimerStartLabel->setCaption( "Timer started!"); |
153 | mTimerStartLabel->setAlignment ( Qt::AlignCenter ) ; | 157 | mTimerStartLabel->setAlignment ( Qt::AlignCenter ) ; |
154 | fon = mTimerPopUp->font(); | 158 | saveSlot( 1 ); |
155 | fon.setBold( true ); | 159 | |
156 | points = (fon.pointSize()*2); | 160 | |
157 | fon.setPointSize( points ); | 161 | |
158 | mTimerStartLabel->setFont( fon ); | ||
159 | } | 162 | } |
160 | 163 | ||
161 | SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() | 164 | SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() |
162 | { | 165 | { |
163 | //delete mPopUp; | 166 | //delete mPopUp; |
164 | delete mAlarmDialog; | 167 | delete mAlarmDialog; |
165 | delete mTimerStartLabel; | 168 | delete mTimerStartLabel; |
166 | } | 169 | } |
167 | 170 | ||
168 | void SimpleAlarmDaemonImpl::saveSlot( int load ) | 171 | void SimpleAlarmDaemonImpl::saveSlot( int load ) |
169 | { | 172 | { |
170 | QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; | 173 | QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; |
171 | //qDebug("save %d ", load ); | 174 | //qDebug("save %d ", load ); |
172 | QFile file( fileName ); | 175 | QFile file( fileName ); |
173 | if ( load ) { | 176 | if ( load ) { |
177 | mPopupFontSize = mTimerPopUp->font().pointSize(); | ||
178 | confFontSize( mPopupFontSize ); | ||
174 | if( !QFile::exists( fileName) ) | 179 | if( !QFile::exists( fileName) ) |
175 | return; | 180 | return; |
176 | if (!file.open( IO_ReadOnly ) ) { | 181 | if (!file.open( IO_ReadOnly ) ) { |
177 | return ; | 182 | return ; |
178 | } | 183 | } |
179 | QString line; | 184 | QString line; |
180 | bool ok; | 185 | bool ok; |
181 | int val; | 186 | int val; |
182 | int len; | 187 | int len; |
183 | while ( file.readLine( line, 1024 ) > 0 ) { | 188 | while ( file.readLine( line, 1024 ) > 0 ) { |
184 | //qDebug("read %s ", line.latin1()); | 189 | //qDebug("read %s ", line.latin1()); |
185 | len = line.length(); | 190 | len = line.length(); |
186 | if ( line.left(4 ) == "PPAU" ) { | 191 | if ( line.left(4 ) == "PPAU" ) { |
187 | val = line.mid( 4,len-5).toInt( &ok ); | 192 | val = line.mid( 4,len-5).toInt( &ok ); |
188 | if ( ok ) { | 193 | if ( ok ) { |
189 | confPause( val ); | 194 | confPause( val ); |
190 | } | 195 | } |
191 | } | 196 | } |
197 | if ( line.left(4 ) == "POFO" ) { | ||
198 | val = line.mid( 4,len-5).toInt( &ok ); | ||
199 | if ( ok ) { | ||
200 | confFontSize( val ); | ||
201 | } | ||
202 | } | ||
192 | if ( line.left(4 ) == "SUCO" ) { | 203 | if ( line.left(4 ) == "SUCO" ) { |
193 | val = line.mid( 4,len-5).toInt( &ok ); | 204 | val = line.mid( 4,len-5).toInt( &ok ); |
194 | if ( ok ) | 205 | if ( ok ) |
195 | confSuspend ( val ); | 206 | confSuspend ( val ); |
196 | } | 207 | } |
197 | if ( line.left(4 ) == "WAAL" ) { | 208 | if ( line.left(4 ) == "WAAL" ) { |
198 | val = line.mid( 4,len-5).toInt( &ok ); | 209 | val = line.mid( 4,len-5).toInt( &ok ); |
199 | if ( ok ) | 210 | if ( ok ) |
200 | confSound( val ); | 211 | confSound( val ); |
201 | 212 | ||
202 | } | 213 | } |
203 | if ( line.left(4 ) == "PLBE" ) { | 214 | if ( line.left(4 ) == "PLBE" ) { |
204 | val = line.mid( 4,len-5).toInt( &ok ); | 215 | val = line.mid( 4,len-5).toInt( &ok ); |
205 | if ( ok ) | 216 | if ( ok ) |
206 | slotPlayBeep( val ); | 217 | slotPlayBeep( val ); |
207 | 218 | ||
208 | } | 219 | } |
209 | if ( line.left(4 ) == "CUTE" ) { | 220 | if ( line.left(4 ) == "CUTE" ) { |
210 | mCustomText = line.mid( 5,len-6); | 221 | mCustomText = line.mid( 5,len-6); |
211 | // qDebug("text ***%s*** ",mCustomText.latin1() ); | 222 | // qDebug("text ***%s*** ",mCustomText.latin1() ); |
212 | 223 | ||
213 | } | 224 | } |
214 | if ( line.left(4 ) == "CUMI" ) { | 225 | if ( line.left(4 ) == "CUMI" ) { |
215 | val = line.mid( 4,len-5).toInt( &ok ); | 226 | val = line.mid( 4,len-5).toInt( &ok ); |
216 | if ( ok ) | 227 | if ( ok ) |
217 | mCustomMinutes = val; | 228 | mCustomMinutes = val; |
218 | 229 | ||
219 | } | 230 | } |
220 | if ( line.left(4 ) == "SUTI" ) { | 231 | if ( line.left(4 ) == "SUTI" ) { |
221 | val = line.mid( 4,len-5).toInt( &ok ); | 232 | val = line.mid( 4,len-5).toInt( &ok ); |
222 | if ( ok ) | 233 | if ( ok ) |
223 | mAlarmDialog->setSuspendTime( val );; | 234 | mAlarmDialog->setSuspendTime( val );; |
224 | 235 | ||
225 | } | 236 | } |
226 | } | 237 | } |
227 | file.close(); | 238 | file.close(); |
228 | } else { | 239 | } else { |
229 | if (!file.open( IO_WriteOnly ) ) { | 240 | if (!file.open( IO_WriteOnly ) ) { |
230 | return; | 241 | return; |
231 | } | 242 | } |
232 | QString configString ; | 243 | QString configString ; |
233 | configString += "PPAU " + QString::number( mPausePlay ) + "\n"; | 244 | configString += "PPAU " + QString::number( mPausePlay ) + "\n"; |
234 | configString += "SUCO " + QString::number( mSuspend ) + "\n"; | 245 | configString += "SUCO " + QString::number( mSuspend ) + "\n"; |
246 | configString += "POFO " + QString::number( mPopupFontSize ) + "\n"; | ||
235 | configString += "WAAL " + QString::number( wavAlarm ) + "\n"; | 247 | configString += "WAAL " + QString::number( wavAlarm ) + "\n"; |
236 | configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; | 248 | configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; |
237 | configString += "CUTE " + mCustomText + "\n"; | 249 | configString += "CUTE " + mCustomText + "\n"; |
238 | configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; | 250 | configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; |
239 | configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n"; | 251 | configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n"; |
240 | QTextStream ts( &file ); | 252 | QTextStream ts( &file ); |
241 | ts << configString ; | 253 | ts << configString ; |
242 | file.close(); | 254 | file.close(); |
243 | } | 255 | } |
244 | 256 | ||
245 | } | 257 | } |
246 | void SimpleAlarmDaemonImpl::confSuspend( int num ) | 258 | void SimpleAlarmDaemonImpl::confSuspend( int num ) |
247 | { | 259 | { |
248 | mSuspendPopUp->setItemChecked ( mSuspend,false ); | 260 | mSuspendPopUp->setItemChecked ( mSuspend,false ); |
249 | mSuspend = num; | 261 | mSuspend = num; |
250 | mSuspendPopUp->setItemChecked ( mSuspend,true ); | 262 | mSuspendPopUp->setItemChecked ( mSuspend,true ); |
251 | } | 263 | } |
252 | void SimpleAlarmDaemonImpl::confPause( int num ) | 264 | void SimpleAlarmDaemonImpl::confPause( int num ) |
253 | { | 265 | { |
254 | mPausePopUp->setItemChecked ( mPausePlay,false ); | 266 | mPausePopUp->setItemChecked ( mPausePlay,false ); |
255 | mPausePlay = num; | 267 | mPausePlay = num; |
256 | mPausePopUp->setItemChecked ( mPausePlay,true ); | 268 | mPausePopUp->setItemChecked ( mPausePlay,true ); |
257 | } | 269 | } |
258 | void SimpleAlarmDaemonImpl::confSound( int num ) | 270 | void SimpleAlarmDaemonImpl::confSound( int num ) |
259 | { | 271 | { |
260 | if ( num == 0 ) { | 272 | if ( num == 0 ) { |
261 | wavAlarm = false; | 273 | wavAlarm = false; |
262 | mSoundPopUp->setItemChecked ( 0, true ); | 274 | mSoundPopUp->setItemChecked ( 0, true ); |
263 | mSoundPopUp->setItemChecked ( 1, false ); | 275 | mSoundPopUp->setItemChecked ( 1, false ); |
264 | } else { | 276 | } else { |
265 | wavAlarm = true; | 277 | wavAlarm = true; |
266 | mSoundPopUp->setItemChecked ( 0, false ); | 278 | mSoundPopUp->setItemChecked ( 0, false ); |
267 | mSoundPopUp->setItemChecked ( 1, true ); | 279 | mSoundPopUp->setItemChecked ( 1, true ); |
268 | } | 280 | } |
269 | } | 281 | } |
270 | void SimpleAlarmDaemonImpl::slotPlayBeep( int num ) | 282 | void SimpleAlarmDaemonImpl::slotPlayBeep( int num ) |
271 | { | 283 | { |
272 | if ( num == 1000 ) { | 284 | if ( num == 1000 ) { |
273 | simulate(); | 285 | simulate(); |
274 | return; | 286 | return; |
275 | } | 287 | } |
276 | mBeepPopUp->setItemChecked ( mPlayBeeps,false ); | 288 | mBeepPopUp->setItemChecked ( mPlayBeeps,false ); |
277 | mPlayBeeps = num; | 289 | mPlayBeeps = num; |
278 | mBeepPopUp->setItemChecked ( mPlayBeeps, true ); | 290 | mBeepPopUp->setItemChecked ( mPlayBeeps, true ); |
279 | } | 291 | } |
280 | 292 | ||
281 | void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& ) | 293 | void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& ) |
282 | { | 294 | { |
@@ -586,96 +598,110 @@ void SimpleAlarmDaemonImpl::confTimer( int time ) | |||
586 | spinh.setValue( mCustomMinutes/60 ); | 598 | spinh.setValue( mCustomMinutes/60 ); |
587 | spinm.setValue( mCustomMinutes%60 ); | 599 | spinm.setValue( mCustomMinutes%60 ); |
588 | QPushButton ok ( "Start timer", &dia); | 600 | QPushButton ok ( "Start timer", &dia); |
589 | ok.setDefault( true ); | 601 | ok.setDefault( true ); |
590 | ok.setFont( fo ); | 602 | ok.setFont( fo ); |
591 | spinh.setFocus(); | 603 | spinh.setFocus(); |
592 | lay.addWidget( &ok); | 604 | lay.addWidget( &ok); |
593 | connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); | 605 | connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); |
594 | dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); | 606 | dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); |
595 | 607 | ||
596 | if ( !dia.exec() ) | 608 | if ( !dia.exec() ) |
597 | return; | 609 | return; |
598 | mCustomText = lEdit.text(); | 610 | mCustomText = lEdit.text(); |
599 | mCustomMinutes = spinh.value()*60+spinm.value(); | 611 | mCustomMinutes = spinh.value()*60+spinm.value(); |
600 | if ( mCustomMinutes == 0 ) | 612 | if ( mCustomMinutes == 0 ) |
601 | mCustomMinutes = 1; | 613 | mCustomMinutes = 1; |
602 | if ( mCustomMinutes > 1440 ) | 614 | if ( mCustomMinutes > 1440 ) |
603 | mCustomMinutes = 1440; | 615 | mCustomMinutes = 1440; |
604 | mess += mCustomText; | 616 | mess += mCustomText; |
605 | disp = mCustomText; | 617 | disp = mCustomText; |
606 | minutes = mCustomMinutes; | 618 | minutes = mCustomMinutes; |
607 | mRunningTimerText = mCustomText.stripWhiteSpace (); | 619 | mRunningTimerText = mCustomText.stripWhiteSpace (); |
608 | int in = mRunningTimerText.find( " " ); | 620 | int in = mRunningTimerText.find( " " ); |
609 | mRunningTimerText = mRunningTimerText.left ( in ); | 621 | mRunningTimerText = mRunningTimerText.left ( in ); |
610 | } | 622 | } |
611 | else { | 623 | else { |
612 | mess += mTimerPopUp->text( minutes ); | 624 | mess += mTimerPopUp->text( minutes ); |
613 | disp = mTimerPopUp->text( minutes ); | 625 | disp = mTimerPopUp->text( minutes ); |
614 | mRunningTimerText = mTimerPopUp->text( minutes ); | 626 | mRunningTimerText = mTimerPopUp->text( minutes ); |
615 | minutes -= 10; | 627 | minutes -= 10; |
616 | } | 628 | } |
617 | } | 629 | } |
618 | //minutes = 1; | 630 | //minutes = 1; |
619 | 631 | ||
620 | mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); | 632 | mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); |
621 | timerMesssage = mess; | 633 | timerMesssage = mess; |
622 | AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8()); | 634 | AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8()); |
623 | mTimerStartLabel->setText( disp + "\n\nTimer started!" ); | 635 | mTimerStartLabel->setText( disp + "\n\nTimer started!" ); |
624 | int w = mTimerStartLabel->sizeHint().width()+20; | 636 | int w = mTimerStartLabel->sizeHint().width()+20; |
625 | int h = mTimerStartLabel->sizeHint().height()+40 ; | 637 | int h = mTimerStartLabel->sizeHint().height()+40 ; |
626 | int dw = QApplication::desktop()->width(); | 638 | int dw = QApplication::desktop()->width(); |
627 | int dh = QApplication::desktop()->height(); | 639 | int dh = QApplication::desktop()->height(); |
628 | mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 640 | mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
629 | mTimerStartLabel->show(); | 641 | mTimerStartLabel->show(); |
630 | QTimer::singleShot( 5000, mTimerStartLabel, SLOT ( hide() ) ); | 642 | QTimer::singleShot( 5000, mTimerStartLabel, SLOT ( hide() ) ); |
631 | mTimerTime = 1; | 643 | mTimerTime = 1; |
632 | } | 644 | } |
633 | 645 | ||
646 | void SimpleAlarmDaemonImpl::confFontSize( int size ) | ||
647 | { | ||
648 | |||
649 | mFontsizePopup->setItemChecked( mPopupFontSize, false ); | ||
650 | mPopupFontSize = size; | ||
651 | mFontsizePopup->setItemChecked( mPopupFontSize, true ); | ||
652 | QFont fon = mTimerPopUp->font(); | ||
653 | fon.setPointSize( mPopupFontSize ); | ||
654 | mTimerPopUp->setFont( fon ); | ||
655 | mPopUp->setFont( fon ); | ||
656 | fon.setBold( true ); | ||
657 | fon.setPointSize( mPopupFontSize * 2 ); | ||
658 | mTimerStartLabel->setFont( fon ); | ||
659 | } | ||
634 | void SimpleAlarmDaemonImpl::writeFile() | 660 | void SimpleAlarmDaemonImpl::writeFile() |
635 | { | 661 | { |
636 | QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 662 | QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
637 | //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); | 663 | //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); |
638 | } | 664 | } |
639 | void SimpleAlarmDaemonImpl::showWN() | 665 | void SimpleAlarmDaemonImpl::showWN() |
640 | { | 666 | { |
641 | QCopEnvelope e("QPE/Application/kopi", "-showWN"); | 667 | QCopEnvelope e("QPE/Application/kopi", "-showWN"); |
642 | } | 668 | } |
643 | void SimpleAlarmDaemonImpl::newTodo() | 669 | void SimpleAlarmDaemonImpl::newTodo() |
644 | { | 670 | { |
645 | QCopEnvelope e("QPE/Application/kopi", "-newTodo"); | 671 | QCopEnvelope e("QPE/Application/kopi", "-newTodo"); |
646 | } | 672 | } |
647 | 673 | ||
648 | void SimpleAlarmDaemonImpl::newEvent() | 674 | void SimpleAlarmDaemonImpl::newEvent() |
649 | { | 675 | { |
650 | QCopEnvelope e("QPE/Application/kopi", "-newEvent"); | 676 | QCopEnvelope e("QPE/Application/kopi", "-newEvent"); |
651 | 677 | ||
652 | } | 678 | } |
653 | void SimpleAlarmDaemonImpl::newMail() | 679 | void SimpleAlarmDaemonImpl::newMail() |
654 | { | 680 | { |
655 | QCopEnvelope e("QPE/Application/ompi", "newMail()"); | 681 | QCopEnvelope e("QPE/Application/ompi", "newMail()"); |
656 | } | 682 | } |
657 | void SimpleAlarmDaemonImpl::showAdd() | 683 | void SimpleAlarmDaemonImpl::showAdd() |
658 | { | 684 | { |
659 | QCopEnvelope e("QPE/Application/kapi", "raise()"); | 685 | QCopEnvelope e("QPE/Application/kapi", "raise()"); |
660 | } | 686 | } |
661 | void SimpleAlarmDaemonImpl::ringSync() | 687 | void SimpleAlarmDaemonImpl::ringSync() |
662 | { | 688 | { |
663 | QCopEnvelope e("QPE/Application/kopi", "-ringSync"); | 689 | QCopEnvelope e("QPE/Application/kopi", "-ringSync"); |
664 | 690 | ||
665 | } | 691 | } |
666 | void SimpleAlarmDaemonImpl::newCountdown() | 692 | void SimpleAlarmDaemonImpl::newCountdown() |
667 | { | 693 | { |
668 | //recieve("cal_alarm", 10 ); | 694 | //recieve("cal_alarm", 10 ); |
669 | } | 695 | } |
670 | void SimpleAlarmDaemonImpl::simulate() | 696 | void SimpleAlarmDaemonImpl::simulate() |
671 | { | 697 | { |
672 | QTimer::singleShot( 2000, this, SLOT ( writeFile() ) ); | 698 | QTimer::singleShot( 2000, this, SLOT ( writeFile() ) ); |
673 | QString filename = getenv("QPEDIR") ; | 699 | QString filename = getenv("QPEDIR") ; |
674 | filename += "/pics/kdepim/korganizer/koalarm.wav"; | 700 | filename += "/pics/kdepim/korganizer/koalarm.wav"; |
675 | startAlarm("Alarm simulation", filename ); | 701 | startAlarm("Alarm simulation", filename ); |
676 | } | 702 | } |
677 | void SimpleAlarmDaemonImpl::showKO() | 703 | void SimpleAlarmDaemonImpl::showKO() |
678 | { | 704 | { |
679 | QCopEnvelope e("QPE/Application/kopi", "-showKO"); | 705 | QCopEnvelope e("QPE/Application/kopi", "-showKO"); |
680 | // testing only | 706 | // testing only |
681 | //QCopEnvelope e("QPE/Application/kopi", "nextView()"); | 707 | //QCopEnvelope e("QPE/Application/kopi", "nextView()"); |