-rw-r--r-- | korganizer/koagendaview.cpp | 32 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 34 |
2 files changed, 31 insertions, 35 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 5508210..f287216 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -106,73 +106,85 @@ void TimeLabels::setCellHeight(int height) | |||
106 | is redrawn. Unfortunately, this is not called by default paintEvent() method. | 106 | is redrawn. Unfortunately, this is not called by default paintEvent() method. |
107 | */ | 107 | */ |
108 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | 108 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) |
109 | { | 109 | { |
110 | 110 | ||
111 | // if ( globalFlagBlockAgenda ) | 111 | // if ( globalFlagBlockAgenda ) |
112 | // return; | 112 | // return; |
113 | // bug: the parameters cx, cy, cw, ch are the areas that need to be | 113 | // bug: the parameters cx, cy, cw, ch are the areas that need to be |
114 | // redrawn, not the area of the widget. unfortunately, this | 114 | // redrawn, not the area of the widget. unfortunately, this |
115 | // code assumes the latter... | 115 | // code assumes the latter... |
116 | 116 | ||
117 | // now, for a workaround... | 117 | // now, for a workaround... |
118 | // these two assignments fix the weird redraw bug | 118 | // these two assignments fix the weird redraw bug |
119 | cx = contentsX() + 2; | 119 | cx = contentsX() + 2; |
120 | cw = contentsWidth() - 2; | 120 | cw = contentsWidth() - 2; |
121 | // end of workaround | 121 | // end of workaround |
122 | 122 | ||
123 | int cell = ((int)(cy/mCellHeight)); | 123 | int cell = ((int)(cy/mCellHeight)); |
124 | int y = cell * mCellHeight; | 124 | int y = cell * mCellHeight; |
125 | QFontMetrics fm = fontMetrics(); | 125 | QFontMetrics fm = fontMetrics(); |
126 | QString hour; | 126 | QString hour; |
127 | QString suffix; | 127 | QString suffix; |
128 | QString fullTime; | 128 | QString fullTime; |
129 | int tW = fm.width("24:00i"); | 129 | int tW = fm.width("24:00i"); |
130 | int timeHeight = fm.height(); | ||
131 | if ( timeHeight > mCellHeight ) | ||
132 | timeHeight = mCellHeight-1; | ||
133 | int borderWidth = 5; | ||
134 | QFont nFont = p->font(); | ||
135 | QFont sFont = nFont; | ||
136 | sFont.setPointSize( sFont.pointSize()/2+2 ); | ||
137 | if (!KGlobal::locale()->use12Clock()) | ||
138 | suffix = "00"; | ||
139 | QFontMetrics fmS( sFont ); | ||
140 | int sHei = fmS.height(); | ||
130 | 141 | ||
131 | while (y < cy + ch) { | 142 | while (y < cy + ch) { |
132 | p->drawLine(cx,y,cx+tW,y); | 143 | p->drawLine(cx,y,cx+tW,y); |
133 | hour.setNum(cell); | 144 | hour.setNum(cell); |
134 | suffix = "am"; | ||
135 | 145 | ||
136 | // handle 24h and am/pm time formats | 146 | // handle 24h and am/pm time formats |
137 | if (KGlobal::locale()->use12Clock()) { | 147 | if (KGlobal::locale()->use12Clock()) { |
138 | if (cell > 11) suffix = "pm"; | 148 | if (cell > 11) suffix = "pm"; |
149 | else | ||
150 | suffix = "am"; | ||
139 | if (cell == 0) hour.setNum(12); | 151 | if (cell == 0) hour.setNum(12); |
140 | if (cell > 12) hour.setNum(cell - 12); | 152 | if (cell > 12) hour.setNum(cell - 12); |
141 | } else { | ||
142 | suffix = ":00"; | ||
143 | } | 153 | } |
144 | 154 | ||
145 | // create string in format of "XX:XX" or "XXpm/am" | 155 | // create string in format of "XX:XX" or "XXpm/am" |
146 | fullTime = hour + suffix; | 156 | fullTime = hour;// + suffix; |
147 | 157 | ||
148 | // center and draw the time label | 158 | // center and draw the time label |
149 | int timeWidth = fm.width(fullTime+"i"); | 159 | int timeWidth = fm.width(fullTime+"i"); |
150 | int offset = this->width() - timeWidth; | 160 | int tw2 = fm.width(suffix); |
151 | int borderWidth = 5; | 161 | int offset = this->width() - timeWidth - tw2; |
152 | int timeHeight = fm.height(); | 162 | p->setFont( nFont ); |
153 | timeHeight = timeHeight + 2 - ( timeHeight / 4 ); | 163 | p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime); |
154 | p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime); | 164 | p->setFont( sFont ); |
165 | offset += timeWidth; | ||
166 | p->drawText(cx - borderWidth + offset, y+ sHei, suffix); | ||
155 | 167 | ||
156 | // increment indices | 168 | // increment indices |
157 | y += mCellHeight; | 169 | y += mCellHeight; |
158 | cell++; | 170 | cell++; |
159 | } | 171 | } |
160 | } | 172 | } |
161 | 173 | ||
162 | /** | 174 | /** |
163 | Calculates the minimum width. | 175 | Calculates the minimum width. |
164 | */ | 176 | */ |
165 | int TimeLabels::minimumWidth() const | 177 | int TimeLabels::minimumWidth() const |
166 | { | 178 | { |
167 | QFontMetrics fm = fontMetrics(); | 179 | QFontMetrics fm = fontMetrics(); |
168 | 180 | ||
169 | //TODO: calculate this value | 181 | //TODO: calculate this value |
170 | int borderWidth = 4; | 182 | int borderWidth = 4; |
171 | 183 | ||
172 | // the maximum width possible | 184 | // the maximum width possible |
173 | int width = fm.width("88:88x") + borderWidth; | 185 | int width = fm.width("88:88x") + borderWidth; |
174 | 186 | ||
175 | return width; | 187 | return width; |
176 | } | 188 | } |
177 | 189 | ||
178 | /** updates widget's internal state */ | 190 | /** updates widget's internal state */ |
@@ -859,50 +871,48 @@ DateList KOAgendaView::selectedDates() | |||
859 | 871 | ||
860 | return selected; | 872 | return selected; |
861 | } | 873 | } |
862 | 874 | ||
863 | 875 | ||
864 | void KOAgendaView::updateView() | 876 | void KOAgendaView::updateView() |
865 | { | 877 | { |
866 | if ( mBlockUpdating ) | 878 | if ( mBlockUpdating ) |
867 | return; | 879 | return; |
868 | // kdDebug() << "KOAgendaView::updateView()" << endl; | 880 | // kdDebug() << "KOAgendaView::updateView()" << endl; |
869 | fillAgenda(); | 881 | fillAgenda(); |
870 | 882 | ||
871 | } | 883 | } |
872 | 884 | ||
873 | 885 | ||
874 | /* | 886 | /* |
875 | Update configuration settings for the agenda view. This method is not | 887 | Update configuration settings for the agenda view. This method is not |
876 | complete. | 888 | complete. |
877 | */ | 889 | */ |
878 | void KOAgendaView::updateConfig() | 890 | void KOAgendaView::updateConfig() |
879 | { | 891 | { |
880 | if ( mBlockUpdating ) | 892 | if ( mBlockUpdating ) |
881 | return; | 893 | return; |
882 | 894 | ||
883 | |||
884 | |||
885 | // update config for children | 895 | // update config for children |
886 | mTimeLabels->updateConfig(); | 896 | mTimeLabels->updateConfig(); |
887 | mAgenda->storePosition(); | 897 | mAgenda->storePosition(); |
888 | mAgenda->updateConfig(); | 898 | mAgenda->updateConfig(); |
889 | mAllDayAgenda->updateConfig(); | 899 | mAllDayAgenda->updateConfig(); |
890 | // widget synchronization | 900 | // widget synchronization |
891 | //TODO: find a better way, maybe signal/slot | 901 | //TODO: find a better way, maybe signal/slot |
892 | mTimeLabels->positionChanged(); | 902 | mTimeLabels->positionChanged(); |
893 | 903 | ||
894 | // for some reason, this needs to be called explicitly | 904 | // for some reason, this needs to be called explicitly |
895 | mTimeLabels->repaint(); | 905 | mTimeLabels->repaint(); |
896 | 906 | ||
897 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 907 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
898 | 908 | ||
899 | // ToolTips displaying summary of events | 909 | // ToolTips displaying summary of events |
900 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 910 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
901 | ->mEnableToolTips); | 911 | ->mEnableToolTips); |
902 | 912 | ||
903 | //setHolidayMasks(); | 913 | //setHolidayMasks(); |
904 | 914 | ||
905 | //createDayLabels(); called by via updateView(); | 915 | //createDayLabels(); called by via updateView(); |
906 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 916 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
907 | updateView(); | 917 | updateView(); |
908 | mAgenda->restorePosition(); | 918 | mAgenda->restorePosition(); |
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 4ee5292..cf0d4ae 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -207,145 +207,131 @@ void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) | |||
207 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | 207 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
208 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); | 208 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); |
209 | alarmLayout->addWidget(mAlarmSoundButton); | 209 | alarmLayout->addWidget(mAlarmSoundButton); |
210 | 210 | ||
211 | mAlarmProgramButton = new QPushButton(parent); | 211 | mAlarmProgramButton = new QPushButton(parent); |
212 | mAlarmProgramButton->setPixmap(SmallIcon("run")); | 212 | mAlarmProgramButton->setPixmap(SmallIcon("run")); |
213 | mAlarmProgramButton->setToggleButton(true); | 213 | mAlarmProgramButton->setToggleButton(true); |
214 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | 214 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
215 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); | 215 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); |
216 | alarmLayout->addWidget(mAlarmProgramButton); | 216 | alarmLayout->addWidget(mAlarmProgramButton); |
217 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); | 217 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); |
218 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); | 218 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); |
219 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 219 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
220 | // mAlarmSoundButton->hide(); | 220 | // mAlarmSoundButton->hide(); |
221 | // mAlarmProgramButton->hide(); | 221 | // mAlarmProgramButton->hide(); |
222 | // } | 222 | // } |
223 | } | 223 | } |
224 | 224 | ||
225 | void KOEditorGeneral::pickAlarmSound() | 225 | void KOEditorGeneral::pickAlarmSound() |
226 | { | 226 | { |
227 | 227 | ||
228 | qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); | 228 | qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); |
229 | //QString prefix = mAlarmSound; | 229 | //QString prefix = mAlarmSound; |
230 | if (!mAlarmSoundButton->isOn()) { | 230 | if (!mAlarmSoundButton->isOn()) { |
231 | //mAlarmSound = ""; | 231 | mAlarmSoundButton->setOn(true); |
232 | QToolTip::remove(mAlarmSoundButton); | 232 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
233 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | ||
234 | mAlarmProgramButton->setOn(true); | ||
235 | mAlarmSoundButton->setOn(false); | ||
236 | pickAlarmProgram(); | ||
237 | } else { | 233 | } else { |
238 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, | 234 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, |
239 | i18n("*.wav|Wav Files"), 0)); | 235 | i18n("*.wav|Wav Files"), 0)); |
240 | if (!fileName.isEmpty()) { | 236 | if (!fileName.isEmpty()) { |
241 | mAlarmSound = fileName; | 237 | mAlarmSound = fileName; |
242 | QToolTip::remove(mAlarmSoundButton); | 238 | QToolTip::remove(mAlarmSoundButton); |
243 | QString dispStr = i18n("Playing '%1'").arg(fileName); | 239 | QString dispStr = i18n("Playing '%1'").arg(fileName); |
244 | QToolTip::add(mAlarmSoundButton, dispStr); | 240 | QToolTip::add(mAlarmSoundButton, dispStr); |
245 | mAlarmProgramButton->setOn(false); | 241 | mAlarmProgramButton->setOn(false); |
246 | mAlarmSoundButton->setOn(true); | 242 | mAlarmSoundButton->setOn(true); |
247 | } else { | 243 | } else { |
248 | mAlarmProgramButton->setOn(true); | 244 | mAlarmProgramButton->setOn(true); |
249 | mAlarmSoundButton->setOn(false); | 245 | mAlarmSoundButton->setOn(false); |
250 | 246 | ||
251 | } | 247 | } |
252 | } | 248 | } |
253 | 249 | #if 0 | |
254 | if (mAlarmProgramButton->isOn()) | 250 | if (mAlarmProgramButton->isOn()) |
255 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 251 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
256 | if ( mAlarmSoundButton->isOn()) | 252 | if ( mAlarmSoundButton->isOn()) |
257 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 253 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
254 | #endif | ||
258 | } | 255 | } |
259 | 256 | ||
260 | void KOEditorGeneral::pickAlarmProgram() | 257 | void KOEditorGeneral::pickAlarmProgram() |
261 | { | 258 | { |
262 | if (!mAlarmProgramButton->isOn()) { | 259 | if (!mAlarmProgramButton->isOn()) { |
263 | //mAlarmProgram = ""; | 260 | mAlarmProgramButton->setOn(true); |
264 | QToolTip::remove(mAlarmProgramButton); | 261 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
265 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | ||
266 | mAlarmProgramButton->setOn(false); | ||
267 | mAlarmSoundButton->setOn(true); | ||
268 | pickAlarmSound(); | ||
269 | } else { | 262 | } else { |
270 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); | 263 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); |
271 | if (!fileName.isEmpty()) { | 264 | if (!fileName.isEmpty()) { |
272 | mAlarmProgram = fileName; | 265 | mAlarmProgram = fileName; |
273 | QToolTip::remove(mAlarmProgramButton); | 266 | QToolTip::remove(mAlarmProgramButton); |
274 | QString dispStr = i18n("Running '%1'").arg(fileName); | 267 | QString dispStr = i18n("Running '%1'").arg(fileName); |
275 | QToolTip::add(mAlarmProgramButton, dispStr); | 268 | QToolTip::add(mAlarmProgramButton, dispStr); |
276 | mAlarmSoundButton->setOn(false); | 269 | mAlarmSoundButton->setOn(false); |
277 | mAlarmProgramButton->setOn(true); | 270 | mAlarmProgramButton->setOn(true); |
278 | } else { | 271 | } else { |
279 | mAlarmProgramButton->setOn(false); | 272 | mAlarmProgramButton->setOn(false); |
280 | mAlarmSoundButton->setOn(true); | 273 | mAlarmSoundButton->setOn(true); |
281 | } | 274 | } |
282 | } | 275 | } |
276 | #if 0 | ||
283 | if (mAlarmProgramButton->isOn()) | 277 | if (mAlarmProgramButton->isOn()) |
284 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 278 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
285 | if ( mAlarmSoundButton->isOn()) | 279 | if ( mAlarmSoundButton->isOn()) |
286 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 280 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
281 | #endif | ||
287 | } | 282 | } |
288 | 283 | ||
289 | 284 | ||
290 | QString KOEditorGeneral::getFittingPath( const QString s ) | 285 | QString KOEditorGeneral::getFittingPath( const QString s ) |
291 | { | 286 | { |
292 | int maxlen = 50; | 287 | int maxlen = 50; |
293 | if ( QApplication::desktop()->width() < 640 ) { | 288 | if ( QApplication::desktop()->width() < 640 ) { |
294 | if ( QApplication::desktop()->width() < 320 ) | 289 | if ( QApplication::desktop()->width() < 320 ) |
295 | maxlen = 22; | 290 | maxlen = 22; |
296 | else | 291 | else |
297 | maxlen = 35; | 292 | maxlen = 35; |
298 | } | 293 | } |
299 | if ( s.length() > maxlen ) { | 294 | if ( s.length() > maxlen ) { |
300 | return "..."+s.right(maxlen -3); | 295 | return "..."+s.right(maxlen -3); |
301 | } | 296 | } |
302 | return s; | 297 | return s; |
303 | } | 298 | } |
304 | 299 | ||
305 | void KOEditorGeneral::enableAlarmEdit(bool enable) | 300 | void KOEditorGeneral::enableAlarmEdit(bool enable) |
306 | { | 301 | { |
307 | if ( enable ) { | 302 | if ( enable ) { |
308 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { | 303 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { |
309 | mAlarmSoundButton->setOn( true ); | 304 | mAlarmSoundButton->setOn( true ); |
310 | if ( mAlarmSound.isEmpty() ) | 305 | if ( mAlarmSound.isEmpty() ) |
311 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 306 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
312 | else { | 307 | else { |
313 | if ( ! QFile::exists( mAlarmSound ) ) | 308 | if ( ! QFile::exists( mAlarmSound ) ) |
314 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 309 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
315 | } | 310 | } |
316 | } | 311 | } |
317 | if (mAlarmProgramButton->isOn()) | ||
318 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | ||
319 | if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) | ||
320 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | ||
321 | } | ||
322 | else { | ||
323 | ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); | ||
324 | //((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Edit item: ") + mSummaryEdit->currentText()); | ||
325 | |||
326 | |||
327 | } | 312 | } |
313 | ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); | ||
328 | mAlarmTimeEdit->setEnabled(enable); | 314 | mAlarmTimeEdit->setEnabled(enable); |
329 | mAlarmSoundButton->setEnabled(enable); | 315 | mAlarmSoundButton->setEnabled(enable); |
330 | mAlarmProgramButton->setEnabled(enable); | 316 | mAlarmProgramButton->setEnabled(enable); |
331 | mAlarmIncrCombo->setEnabled(enable); | 317 | mAlarmIncrCombo->setEnabled(enable); |
332 | } | 318 | } |
333 | 319 | ||
334 | void KOEditorGeneral::disableAlarmEdit(bool disable) | 320 | void KOEditorGeneral::disableAlarmEdit(bool disable) |
335 | { | 321 | { |
336 | enableAlarmEdit( !disable ); | 322 | enableAlarmEdit( !disable ); |
337 | } | 323 | } |
338 | 324 | ||
339 | void KOEditorGeneral::enableAlarm( bool enable ) | 325 | void KOEditorGeneral::enableAlarm( bool enable ) |
340 | { | 326 | { |
341 | enableAlarmEdit( enable ); | 327 | enableAlarmEdit( enable ); |
342 | } | 328 | } |
343 | 329 | ||
344 | void KOEditorGeneral::alarmDisable(bool disable) | 330 | void KOEditorGeneral::alarmDisable(bool disable) |
345 | { | 331 | { |
346 | if (!disable) { | 332 | if (!disable) { |
347 | //mAlarmBell->setEnabled(true); | 333 | //mAlarmBell->setEnabled(true); |
348 | mAlarmButton->setEnabled(true); | 334 | mAlarmButton->setEnabled(true); |
349 | } else { | 335 | } else { |
350 | //mAlarmBell->setEnabled(false); | 336 | //mAlarmBell->setEnabled(false); |
351 | mAlarmButton->setEnabled(false); | 337 | mAlarmButton->setEnabled(false); |
@@ -379,49 +365,49 @@ void KOEditorGeneral::setDefaults(bool allDay) | |||
379 | alarmTime = 15; | 365 | alarmTime = 15; |
380 | } else { | 366 | } else { |
381 | alarmTime = a[index]; | 367 | alarmTime = a[index]; |
382 | } | 368 | } |
383 | mAlarmButton ->setChecked( false ); | 369 | mAlarmButton ->setChecked( false ); |
384 | mAlarmTimeEdit->setValue(alarmTime); | 370 | mAlarmTimeEdit->setValue(alarmTime); |
385 | mAlarmIncrCombo->setCurrentItem(0); | 371 | mAlarmIncrCombo->setCurrentItem(0); |
386 | enableAlarmEdit( false ); | 372 | enableAlarmEdit( false ); |
387 | //alarmDisable (false); | 373 | //alarmDisable (false); |
388 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); | 374 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); |
389 | mCancelBox->setChecked( false ); | 375 | mCancelBox->setChecked( false ); |
390 | mSummaryEdit->setEditText(""); | 376 | mSummaryEdit->setEditText(""); |
391 | mLocationEdit->setEditText(""); | 377 | mLocationEdit->setEditText(""); |
392 | mDescriptionEdit->setText(""); | 378 | mDescriptionEdit->setText(""); |
393 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 379 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
394 | setCategories(""); | 380 | setCategories(""); |
395 | } | 381 | } |
396 | void KOEditorGeneral::setSecrecy( int num ) | 382 | void KOEditorGeneral::setSecrecy( int num ) |
397 | { | 383 | { |
398 | mSecrecyCombo->setCurrentItem(num); | 384 | mSecrecyCombo->setCurrentItem(num); |
399 | } | 385 | } |
400 | void KOEditorGeneral::readIncidence(Incidence *event) | 386 | void KOEditorGeneral::readIncidence(Incidence *event) |
401 | { | 387 | { |
402 | 388 | ||
403 | mAlarmMessage = i18n("Edit") +" "+event->summary(); | 389 | mAlarmMessage = event->summary(); |
404 | mAlarmIncrCombo->setCurrentItem(0); | 390 | mAlarmIncrCombo->setCurrentItem(0); |
405 | mSummaryEdit->setEditText(event->summary()); | 391 | mSummaryEdit->setEditText(event->summary()); |
406 | mLocationEdit->setEditText(event->location()); | 392 | mLocationEdit->setEditText(event->location()); |
407 | mDescriptionEdit->setText(event->description()); | 393 | mDescriptionEdit->setText(event->description()); |
408 | 394 | ||
409 | #if 0 | 395 | #if 0 |
410 | // organizer information | 396 | // organizer information |
411 | mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); | 397 | mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); |
412 | #endif | 398 | #endif |
413 | 399 | ||
414 | enableAlarmEdit( event->isAlarmEnabled() ); | 400 | enableAlarmEdit( event->isAlarmEnabled() ); |
415 | //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); | 401 | //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); |
416 | if(!event->isAlarmEnabled()) { | 402 | if(!event->isAlarmEnabled()) { |
417 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. | 403 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. |
418 | int alarmTime; | 404 | int alarmTime; |
419 | int a[] = { 1,5,10,15,30,60,180, 1440 }; | 405 | int a[] = { 1,5,10,15,30,60,180, 1440 }; |
420 | int index = KOPrefs::instance()->mAlarmTime; | 406 | int index = KOPrefs::instance()->mAlarmTime; |
421 | if (index < 0 || index > 7) { | 407 | if (index < 0 || index > 7) { |
422 | alarmTime = 15; | 408 | alarmTime = 15; |
423 | } else { | 409 | } else { |
424 | alarmTime = a[index]; | 410 | alarmTime = a[index]; |
425 | } | 411 | } |
426 | mAlarmTimeEdit->setValue(alarmTime); | 412 | mAlarmTimeEdit->setValue(alarmTime); |
427 | } | 413 | } |