Diffstat (limited to 'kalarmd/simplealarmdaemonimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kalarmd/simplealarmdaemonimpl.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp index 15eff28..74a53cb 100644 --- a/kalarmd/simplealarmdaemonimpl.cpp +++ b/kalarmd/simplealarmdaemonimpl.cpp | |||
@@ -1,294 +1,294 @@ | |||
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 <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 Q3PopupMenu( 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 Q3PopupMenu( this ); |
70 | 70 | ||
71 | mBeepPopUp = new QPopupMenu( this ); | 71 | mBeepPopUp = new Q3PopupMenu( this ); |
72 | mSoundPopUp = new QPopupMenu( this ); | 72 | mSoundPopUp = new Q3PopupMenu( this ); |
73 | mPausePopUp = new QPopupMenu( this ); | 73 | mPausePopUp = new Q3PopupMenu( this ); |
74 | mFontsizePopup = new QPopupMenu( this ); | 74 | mFontsizePopup = new Q3PopupMenu( this ); |
75 | mFontsizePopup->insertItem( "10", 10 ); | 75 | mFontsizePopup->insertItem( "10", 10 ); |
76 | mFontsizePopup->insertItem( "12", 12 ); | 76 | mFontsizePopup->insertItem( "12", 12 ); |
77 | mFontsizePopup->insertItem( "14", 14 ); | 77 | mFontsizePopup->insertItem( "14", 14 ); |
78 | mFontsizePopup->insertItem( "16", 16 ); | 78 | mFontsizePopup->insertItem( "16", 16 ); |
79 | mFontsizePopup->insertItem( "18", 18 ); | 79 | mFontsizePopup->insertItem( "18", 18 ); |
80 | mFontsizePopup->insertItem( "20", 20 ); | 80 | mFontsizePopup->insertItem( "20", 20 ); |
81 | mFontsizePopup->insertItem( "22", 22 ); | 81 | mFontsizePopup->insertItem( "22", 22 ); |
82 | mFontsizePopup->insertItem( "24", 24 ); | 82 | mFontsizePopup->insertItem( "24", 24 ); |
83 | mFontsizePopup->insertItem( "26", 26 ); | 83 | mFontsizePopup->insertItem( "26", 26 ); |
84 | mFontsizePopup->insertItem( "28", 28 ); | 84 | mFontsizePopup->insertItem( "28", 28 ); |
85 | mFontsizePopup->insertItem( "30", 30 ); | 85 | mFontsizePopup->insertItem( "30", 30 ); |
86 | mFontsizePopup->insertItem( "32", 32 ); | 86 | mFontsizePopup->insertItem( "32", 32 ); |
87 | mFontsizePopup->insertItem( "36", 36 ); | 87 | mFontsizePopup->insertItem( "36", 36 ); |
88 | QPopupMenu* savePopUp = new QPopupMenu( this ); | 88 | QPopupMenu* savePopUp = new Q3PopupMenu( this ); |
89 | savePopUp->insertItem( "Save", 0 ); | 89 | savePopUp->insertItem( "Save", 0 ); |
90 | savePopUp->insertItem( "Load", 1 ); | 90 | savePopUp->insertItem( "Load", 1 ); |
91 | mSoundPopUp->insertItem( "Buzzer", 0 ); | 91 | mSoundPopUp->insertItem( "Buzzer", 0 ); |
92 | mSoundPopUp->insertItem( "Wav file", 1 ); | 92 | mSoundPopUp->insertItem( "Wav file", 1 ); |
93 | mPausePopUp->insertItem( " 1 sec", 1 ); | 93 | mPausePopUp->insertItem( " 1 sec", 1 ); |
94 | mPausePopUp->insertItem( " 2 sec", 2 ); | 94 | mPausePopUp->insertItem( " 2 sec", 2 ); |
95 | mPausePopUp->insertItem( " 3 sec", 3 ); | 95 | mPausePopUp->insertItem( " 3 sec", 3 ); |
96 | mPausePopUp->insertItem( " 5 sec", 5 ); | 96 | mPausePopUp->insertItem( " 5 sec", 5 ); |
97 | mPausePopUp->insertItem( "10 sec", 10 ); | 97 | mPausePopUp->insertItem( "10 sec", 10 ); |
98 | mPausePopUp->insertItem( "15 sec", 15 ); | 98 | mPausePopUp->insertItem( "15 sec", 15 ); |
99 | mPausePopUp->insertItem( "30 sec", 30 ); | 99 | mPausePopUp->insertItem( "30 sec", 30 ); |
100 | mPausePopUp->insertItem( " 1 min", 60 ); | 100 | mPausePopUp->insertItem( " 1 min", 60 ); |
101 | mPausePopUp->insertItem( " 5 min", 300 ); | 101 | mPausePopUp->insertItem( " 5 min", 300 ); |
102 | mSuspendPopUp = new QPopupMenu( this ); | 102 | mSuspendPopUp = new Q3PopupMenu( this ); |
103 | mSuspendPopUp->insertItem( "Off", 0 ); | 103 | mSuspendPopUp->insertItem( "Off", 0 ); |
104 | mSuspendPopUp->insertItem( " 1x", 1 ); | 104 | mSuspendPopUp->insertItem( " 1x", 1 ); |
105 | mSuspendPopUp->insertItem( " 2x", 2 ); | 105 | mSuspendPopUp->insertItem( " 2x", 2 ); |
106 | mSuspendPopUp->insertItem( " 3x", 3 ); | 106 | mSuspendPopUp->insertItem( " 3x", 3 ); |
107 | mSuspendPopUp->insertItem( " 5x", 5 ); | 107 | mSuspendPopUp->insertItem( " 5x", 5 ); |
108 | mSuspendPopUp->insertItem( "10x", 10 ); | 108 | mSuspendPopUp->insertItem( "10x", 10 ); |
109 | mSuspendPopUp->insertItem( "20x", 20 ); | 109 | mSuspendPopUp->insertItem( "20x", 20 ); |
110 | mSuspendPopUp->insertItem( "30x", 30 ); | 110 | mSuspendPopUp->insertItem( "30x", 30 ); |
111 | mBeepPopUp->insertItem( "Config",savePopUp ); | 111 | mBeepPopUp->insertItem( "Config",savePopUp ); |
112 | mBeepPopUp->insertItem( "Replay",mSoundPopUp ); | 112 | mBeepPopUp->insertItem( "Replay",mSoundPopUp ); |
113 | mBeepPopUp->insertItem( "Font Size",mFontsizePopup ); | 113 | mBeepPopUp->insertItem( "Font Size",mFontsizePopup ); |
114 | mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); | 114 | mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); |
115 | mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); | 115 | mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); |
116 | mBeepPopUp->insertItem( "100", 100 ); | 116 | mBeepPopUp->insertItem( "100", 100 ); |
117 | mBeepPopUp->insertItem( "50", 50 ); | 117 | mBeepPopUp->insertItem( "50", 50 ); |
118 | mBeepPopUp->insertItem( "25", 25 ); | 118 | mBeepPopUp->insertItem( "25", 25 ); |
119 | mBeepPopUp->insertItem( "17", 17 ); | 119 | mBeepPopUp->insertItem( "17", 17 ); |
120 | mBeepPopUp->insertItem( "10", 10 ); | 120 | mBeepPopUp->insertItem( "10", 10 ); |
121 | mBeepPopUp->insertItem( "3", 3 ); | 121 | mBeepPopUp->insertItem( "3", 3 ); |
122 | mBeepPopUp->insertItem( "1", 1 ); | 122 | mBeepPopUp->insertItem( "1", 1 ); |
123 | mBeepPopUp->insertItem( "Off", 0 ); | 123 | mBeepPopUp->insertItem( "Off", 0 ); |
124 | mBeepPopUp->insertSeparator(); | 124 | mBeepPopUp->insertSeparator(); |
125 | mBeepPopUp->insertItem( "Simulate", 1000 ); | 125 | mBeepPopUp->insertItem( "Simulate", 1000 ); |
126 | mBeepPopUp->setCheckable( true ); | 126 | mBeepPopUp->setCheckable( true ); |
127 | mPopUp->insertSeparator(); | 127 | mPopUp->insertSeparator(); |
128 | mPopUp->insertItem( "Play beeps", mBeepPopUp ); | 128 | mPopUp->insertItem( "Play beeps", mBeepPopUp ); |
129 | mPopUp->insertSeparator(); | 129 | mPopUp->insertSeparator(); |
130 | mPopUp->insertItem( "Timer", mTimerPopUp ); | 130 | mPopUp->insertItem( "Timer", mTimerPopUp ); |
131 | //mPopUp->insertSeparator(); | 131 | //mPopUp->insertSeparator(); |
132 | //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); | 132 | //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); |
133 | 133 | ||
134 | mPopUp->resize( mPopUp->sizeHint() ); | 134 | mPopUp->resize( mPopUp->sizeHint() ); |
135 | mPlayBeeps = 60; | 135 | mPlayBeeps = 60; |
136 | mBeepPopUp->setItemChecked ( mPlayBeeps, true ); | 136 | mBeepPopUp->setItemChecked ( mPlayBeeps, true ); |
137 | connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); | 137 | connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); |
138 | connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); | 138 | connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); |
139 | connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); | 139 | connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); |
140 | connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); | 140 | connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); |
141 | connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); | 141 | connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); |
142 | connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); | 142 | connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); |
143 | connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); | 143 | connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); |
144 | connect ( mFontsizePopup, SIGNAL( activated ( int ) ), this, SLOT (confFontSize( int ) ) ); | 144 | connect ( mFontsizePopup, SIGNAL( activated ( int ) ), this, SLOT (confFontSize( int ) ) ); |
145 | mTimerTime = 0; | 145 | mTimerTime = 0; |
146 | mCustomText = "Custom Text"; | 146 | mCustomText = "Custom Text"; |
147 | mCustomMinutes = 7; | 147 | mCustomMinutes = 7; |
148 | mTimerPopupConf = 1; | 148 | mTimerPopupConf = 1; |
149 | fillTimerPopUp(); | 149 | fillTimerPopUp(); |
150 | mPausePlay = 0; | 150 | mPausePlay = 0; |
151 | confPause( 1 ); | 151 | confPause( 1 ); |
152 | mSuspend = 0; | 152 | mSuspend = 0; |
153 | confSuspend( 0 ); | 153 | confSuspend( 0 ); |
154 | if ( QApplication::desktop()->width() < 480 ) { | 154 | if ( QApplication::desktop()->width() < 480 ) { |
155 | wavAlarm = false; | 155 | wavAlarm = false; |
156 | mSoundPopUp->setItemChecked ( 0, true ); | 156 | mSoundPopUp->setItemChecked ( 0, true ); |
157 | } | 157 | } |
158 | else { | 158 | else { |
159 | wavAlarm = true; | 159 | wavAlarm = true; |
160 | mSoundPopUp->setItemChecked ( 1, true ); | 160 | mSoundPopUp->setItemChecked ( 1, true ); |
161 | } | 161 | } |
162 | mTimerStartLabel = new QLabel( 0, 0, WType_Popup ); | 162 | mTimerStartLabel = new QLabel( 0, 0, WType_Popup ); |
163 | //mTimerStartLabel->setCaption( "Timer started!"); | 163 | //mTimerStartLabel->setCaption( "Timer started!"); |
164 | mTimerStartLabel->setAlignment ( Qt::AlignCenter ) ; | 164 | mTimerStartLabel->setAlignment ( Qt::AlignCenter ) ; |
165 | saveSlot( 1 ); | 165 | saveSlot( 1 ); |
166 | 166 | ||
167 | 167 | ||
168 | 168 | ||
169 | } | 169 | } |
170 | 170 | ||
171 | SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() | 171 | SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() |
172 | { | 172 | { |
173 | //delete mPopUp; | 173 | //delete mPopUp; |
174 | delete mAlarmDialog; | 174 | delete mAlarmDialog; |
175 | delete mTimerStartLabel; | 175 | delete mTimerStartLabel; |
176 | } | 176 | } |
177 | 177 | ||
178 | void SimpleAlarmDaemonImpl::saveSlot( int load ) | 178 | void SimpleAlarmDaemonImpl::saveSlot( int load ) |
179 | { | 179 | { |
180 | QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; | 180 | QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; |
181 | //qDebug("save %d ", load ); | 181 | //qDebug("save %d ", load ); |
182 | QFile file( fileName ); | 182 | QFile file( fileName ); |
183 | if ( load ) { | 183 | if ( load ) { |
184 | mPopupFontSize = mTimerPopUp->font().pointSize(); | 184 | mPopupFontSize = mTimerPopUp->font().pointSize(); |
185 | confFontSize( mPopupFontSize ); | 185 | confFontSize( mPopupFontSize ); |
186 | if( !QFile::exists( fileName) ) | 186 | if( !QFile::exists( fileName) ) |
187 | return; | 187 | return; |
188 | if (!file.open( IO_ReadOnly ) ) { | 188 | if (!file.open( IO_ReadOnly ) ) { |
189 | return ; | 189 | return ; |
190 | } | 190 | } |
191 | QString line; | 191 | QString line; |
192 | bool ok; | 192 | bool ok; |
193 | int val; | 193 | int val; |
194 | int len; | 194 | int len; |
195 | while ( file.readLine( line, 1024 ) > 0 ) { | 195 | while ( file.readLine( line, 1024 ) > 0 ) { |
196 | //qDebug("read %s ", line.latin1()); | 196 | //qDebug("read %s ", line.latin1()); |
197 | len = line.length(); | 197 | len = line.length(); |
198 | if ( line.left(4 ) == "PPAU" ) { | 198 | if ( line.left(4 ) == "PPAU" ) { |
199 | val = line.mid( 4,len-5).toInt( &ok ); | 199 | val = line.mid( 4,len-5).toInt( &ok ); |
200 | if ( ok ) { | 200 | if ( ok ) { |
201 | confPause( val ); | 201 | confPause( val ); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | if ( line.left(4 ) == "POFO" ) { | 204 | if ( line.left(4 ) == "POFO" ) { |
205 | val = line.mid( 4,len-5).toInt( &ok ); | 205 | val = line.mid( 4,len-5).toInt( &ok ); |
206 | if ( ok ) { | 206 | if ( ok ) { |
207 | confFontSize( val ); | 207 | confFontSize( val ); |
208 | } | 208 | } |
209 | } | 209 | } |
210 | if ( line.left(4 ) == "SUCO" ) { | 210 | if ( line.left(4 ) == "SUCO" ) { |
211 | val = line.mid( 4,len-5).toInt( &ok ); | 211 | val = line.mid( 4,len-5).toInt( &ok ); |
212 | if ( ok ) | 212 | if ( ok ) |
213 | confSuspend ( val ); | 213 | confSuspend ( val ); |
214 | } | 214 | } |
215 | if ( line.left(4 ) == "WAAL" ) { | 215 | if ( line.left(4 ) == "WAAL" ) { |
216 | val = line.mid( 4,len-5).toInt( &ok ); | 216 | val = line.mid( 4,len-5).toInt( &ok ); |
217 | if ( ok ) | 217 | if ( ok ) |
218 | confSound( val ); | 218 | confSound( val ); |
219 | 219 | ||
220 | } | 220 | } |
221 | if ( line.left(4 ) == "PLBE" ) { | 221 | if ( line.left(4 ) == "PLBE" ) { |
222 | val = line.mid( 4,len-5).toInt( &ok ); | 222 | val = line.mid( 4,len-5).toInt( &ok ); |
223 | if ( ok ) | 223 | if ( ok ) |
224 | slotPlayBeep( val ); | 224 | slotPlayBeep( val ); |
225 | 225 | ||
226 | } | 226 | } |
227 | if ( line.left(4 ) == "CUTE" ) { | 227 | if ( line.left(4 ) == "CUTE" ) { |
228 | mCustomText = line.mid( 5,len-6); | 228 | mCustomText = line.mid( 5,len-6); |
229 | // qDebug("text ***%s*** ",mCustomText.latin1() ); | 229 | // qDebug("text ***%s*** ",mCustomText.latin1() ); |
230 | 230 | ||
231 | } | 231 | } |
232 | if ( line.left(4 ) == "CUMI" ) { | 232 | if ( line.left(4 ) == "CUMI" ) { |
233 | val = line.mid( 4,len-5).toInt( &ok ); | 233 | val = line.mid( 4,len-5).toInt( &ok ); |
234 | if ( ok ) | 234 | if ( ok ) |
235 | mCustomMinutes = val; | 235 | mCustomMinutes = val; |
236 | 236 | ||
237 | } | 237 | } |
238 | if ( line.left(4 ) == "SUTI" ) { | 238 | if ( line.left(4 ) == "SUTI" ) { |
239 | val = line.mid( 4,len-5).toInt( &ok ); | 239 | val = line.mid( 4,len-5).toInt( &ok ); |
240 | if ( ok ) | 240 | if ( ok ) |
241 | mAlarmDialog->setSuspendTime( val );; | 241 | mAlarmDialog->setSuspendTime( val );; |
242 | 242 | ||
243 | } | 243 | } |
244 | } | 244 | } |
245 | file.close(); | 245 | file.close(); |
246 | } else { | 246 | } else { |
247 | if (!file.open( IO_WriteOnly ) ) { | 247 | if (!file.open( IO_WriteOnly ) ) { |
248 | return; | 248 | return; |
249 | } | 249 | } |
250 | QString configString ; | 250 | QString configString ; |
251 | configString += "PPAU " + QString::number( mPausePlay ) + "\n"; | 251 | configString += "PPAU " + QString::number( mPausePlay ) + "\n"; |
252 | configString += "SUCO " + QString::number( mSuspend ) + "\n"; | 252 | configString += "SUCO " + QString::number( mSuspend ) + "\n"; |
253 | configString += "POFO " + QString::number( mPopupFontSize ) + "\n"; | 253 | configString += "POFO " + QString::number( mPopupFontSize ) + "\n"; |
254 | configString += "WAAL " + QString::number( wavAlarm ) + "\n"; | 254 | configString += "WAAL " + QString::number( wavAlarm ) + "\n"; |
255 | configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; | 255 | configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; |
256 | configString += "CUTE " + mCustomText + "\n"; | 256 | configString += "CUTE " + mCustomText + "\n"; |
257 | configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; | 257 | configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; |
258 | configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n"; | 258 | configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n"; |
259 | QTextStream ts( &file ); | 259 | QTextStream ts( &file ); |
260 | ts << configString ; | 260 | ts << configString ; |
261 | file.close(); | 261 | file.close(); |
262 | } | 262 | } |
263 | 263 | ||
264 | } | 264 | } |
265 | void SimpleAlarmDaemonImpl::confSuspend( int num ) | 265 | void SimpleAlarmDaemonImpl::confSuspend( int num ) |
266 | { | 266 | { |
267 | mSuspendPopUp->setItemChecked ( mSuspend,false ); | 267 | mSuspendPopUp->setItemChecked ( mSuspend,false ); |
268 | mSuspend = num; | 268 | mSuspend = num; |
269 | mSuspendPopUp->setItemChecked ( mSuspend,true ); | 269 | mSuspendPopUp->setItemChecked ( mSuspend,true ); |
270 | } | 270 | } |
271 | void SimpleAlarmDaemonImpl::confPause( int num ) | 271 | void SimpleAlarmDaemonImpl::confPause( int num ) |
272 | { | 272 | { |
273 | mPausePopUp->setItemChecked ( mPausePlay,false ); | 273 | mPausePopUp->setItemChecked ( mPausePlay,false ); |
274 | mPausePlay = num; | 274 | mPausePlay = num; |
275 | mPausePopUp->setItemChecked ( mPausePlay,true ); | 275 | mPausePopUp->setItemChecked ( mPausePlay,true ); |
276 | } | 276 | } |
277 | void SimpleAlarmDaemonImpl::confSound( int num ) | 277 | void SimpleAlarmDaemonImpl::confSound( int num ) |
278 | { | 278 | { |
279 | if ( num == 0 ) { | 279 | if ( num == 0 ) { |
280 | wavAlarm = false; | 280 | wavAlarm = false; |
281 | mSoundPopUp->setItemChecked ( 0, true ); | 281 | mSoundPopUp->setItemChecked ( 0, true ); |
282 | mSoundPopUp->setItemChecked ( 1, false ); | 282 | mSoundPopUp->setItemChecked ( 1, false ); |
283 | } else { | 283 | } else { |
284 | wavAlarm = true; | 284 | wavAlarm = true; |
285 | mSoundPopUp->setItemChecked ( 0, false ); | 285 | mSoundPopUp->setItemChecked ( 0, false ); |
286 | mSoundPopUp->setItemChecked ( 1, true ); | 286 | mSoundPopUp->setItemChecked ( 1, true ); |
287 | } | 287 | } |
288 | } | 288 | } |
289 | void SimpleAlarmDaemonImpl::slotPlayBeep( int num ) | 289 | void SimpleAlarmDaemonImpl::slotPlayBeep( int num ) |
290 | { | 290 | { |
291 | if ( num == 1000 ) { | 291 | if ( num == 1000 ) { |
292 | simulate(); | 292 | simulate(); |
293 | return; | 293 | return; |
294 | } | 294 | } |