• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kalarm

  • sources
  • kde-4.12
  • kdepim
  • kalarm
prefdlg.cpp
Go to the documentation of this file.
1 /*
2  * prefdlg.cpp - program preferences dialog
3  * Program: kalarm
4  * Copyright © 2001-2012 by David Jarvie <djarvie@kde.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #include "kalarm.h"
22 
23 #include "alarmcalendar.h"
24 #ifdef USE_AKONADI
25 #include "collectionmodel.h"
26 #else
27 #include "alarmresources.h"
28 #endif
29 #include "alarmtimewidget.h"
30 #include "buttongroup.h"
31 #include "colourbutton.h"
32 #include "editdlg.h"
33 #include "editdlgtypes.h"
34 #include "fontcolour.h"
35 #include "functions.h"
36 #include "itembox.h"
37 #include "kalarmapp.h"
38 #include "kalocale.h"
39 #include "kamail.h"
40 #include "label.h"
41 #include "latecancel.h"
42 #include "mainwindow.h"
43 #include "messagebox.h"
44 #include "preferences.h"
45 #include "radiobutton.h"
46 #include "recurrenceedit.h"
47 #include "sounddlg.h"
48 #include "soundpicker.h"
49 #include "specialactions.h"
50 #include "stackedwidgets.h"
51 #include "timeedit.h"
52 #include "timespinbox.h"
53 #include "timezonecombo.h"
54 #include "traywindow.h"
55 #include "prefdlg_p.moc"
56 #include "prefdlg.moc"
57 
58 #include <kalarmcal/identities.h>
59 
60 #include <kholidays/holidays.h>
61 using namespace KHolidays;
62 
63 #include <kvbox.h>
64 #include <kglobal.h>
65 #include <klocale.h>
66 #include <kstandarddirs.h>
67 #include <kshell.h>
68 #include <klineedit.h>
69 #include <kaboutdata.h>
70 #include <kapplication.h>
71 #include <kiconloader.h>
72 #include <kcombobox.h>
73 #include <ktabwidget.h>
74 #include <kstandardguiitem.h>
75 #include <ksystemtimezone.h>
76 #include <kicon.h>
77 #ifdef Q_WS_X11
78 #include <kwindowinfo.h>
79 #include <kwindowsystem.h>
80 #endif
81 #include <ktoolinvocation.h>
82 #include <kdebug.h>
83 
84 #include <QLabel>
85 #include <QCheckBox>
86 #include <QRadioButton>
87 #include <QPushButton>
88 #include <QSpinBox>
89 #include <QGroupBox>
90 #include <QGridLayout>
91 #include <QHBoxLayout>
92 #include <QVBoxLayout>
93 #include <QStyle>
94 #include <QResizeEvent>
95 #include <QTimer>
96 
97 #ifdef USE_AKONADI
98 using namespace KCalCore;
99 #else
100 using namespace KCal;
101 #endif
102 using namespace KAlarmCal;
103 
104 static const char PREF_DIALOG_NAME[] = "PrefDialog";
105 
106 // Command strings for executing commands in different types of terminal windows.
107 // %t = window title parameter
108 // %c = command to execute in terminal
109 // %w = command to execute in terminal, with 'sleep 86400' appended
110 // %C = temporary command file to execute in terminal
111 // %W = temporary command file to execute in terminal, with 'sleep 86400' appended
112 static QString xtermCommands[] = {
113  QLatin1String("xterm -sb -hold -title %t -e %c"),
114  QLatin1String("konsole --noclose -p tabtitle=%t -e ${SHELL:-sh} -c %c"),
115  QLatin1String("gnome-terminal -t %t -e %W"),
116  QLatin1String("eterm --pause -T %t -e %C"), // some systems use eterm...
117  QLatin1String("Eterm --pause -T %t -e %C"), // while some use Eterm
118  QLatin1String("rxvt -title %t -e ${SHELL:-sh} -c %w"),
119  QString() // end of list indicator - don't change!
120 };
121 
122 
123 /*=============================================================================
124 = Class KAlarmPrefDlg
125 =============================================================================*/
126 
127 KAlarmPrefDlg* KAlarmPrefDlg::mInstance = 0;
128 
129 void KAlarmPrefDlg::display()
130 {
131  if (!mInstance)
132  {
133  mInstance = new KAlarmPrefDlg;
134  QSize s;
135  if (KAlarm::readConfigWindowSize(PREF_DIALOG_NAME, s))
136  mInstance->resize(s);
137  mInstance->show();
138  }
139  else
140  {
141 #ifdef Q_WS_X11
142  KWindowInfo info = KWindowSystem::windowInfo(mInstance->winId(), NET::WMGeometry | NET::WMDesktop);
143  KWindowSystem::setCurrentDesktop(info.desktop());
144 #endif
145  mInstance->setWindowState(mInstance->windowState() & ~Qt::WindowMinimized); // un-minimize it if necessary
146  mInstance->raise();
147  mInstance->activateWindow();
148  }
149 }
150 
151 KAlarmPrefDlg::KAlarmPrefDlg()
152  : KPageDialog(),
153  mShown(false)
154 {
155  setAttribute(Qt::WA_DeleteOnClose);
156  setObjectName(QLatin1String("PrefDlg")); // used by LikeBack
157  setCaption(i18nc("@title:window", "Configure"));
158  setButtons(Help | Default | Ok | Apply | Cancel);
159  setDefaultButton(Ok);
160  setFaceType(List);
161  showButtonSeparator(true);
162  mTabScrollGroup = new StackedScrollGroup(this, this);
163 
164  mMiscPage = new MiscPrefTab(mTabScrollGroup);
165  mMiscPageItem = new KPageWidgetItem(mMiscPage, i18nc("@title:tab General preferences", "General"));
166  mMiscPageItem->setHeader(i18nc("@title General preferences", "General"));
167  mMiscPageItem->setIcon(KIcon(DesktopIcon(QLatin1String("preferences-other"))));
168  addPage(mMiscPageItem);
169 
170  mTimePage = new TimePrefTab(mTabScrollGroup);
171  mTimePageItem = new KPageWidgetItem(mTimePage, i18nc("@title:tab", "Time & Date"));
172  mTimePageItem->setHeader(i18nc("@title", "Time and Date"));
173  mTimePageItem->setIcon(KIcon(DesktopIcon(QLatin1String("preferences-system-time"))));
174  addPage(mTimePageItem);
175 
176  mStorePage = new StorePrefTab(mTabScrollGroup);
177  mStorePageItem = new KPageWidgetItem(mStorePage, i18nc("@title:tab", "Storage"));
178  mStorePageItem->setHeader(i18nc("@title", "Alarm Storage"));
179  mStorePageItem->setIcon(KIcon(DesktopIcon(QLatin1String("system-file-manager"))));
180  addPage(mStorePageItem);
181 
182  mEmailPage = new EmailPrefTab(mTabScrollGroup);
183  mEmailPageItem = new KPageWidgetItem(mEmailPage, i18nc("@title:tab Email preferences", "Email"));
184  mEmailPageItem->setHeader(i18nc("@title", "Email Alarm Settings"));
185  mEmailPageItem->setIcon(KIcon(DesktopIcon(QLatin1String("internet-mail"))));
186  addPage(mEmailPageItem);
187 
188  mViewPage = new ViewPrefTab(mTabScrollGroup);
189  mViewPageItem = new KPageWidgetItem(mViewPage, i18nc("@title:tab", "View"));
190  mViewPageItem->setHeader(i18nc("@title", "View Settings"));
191  mViewPageItem->setIcon(KIcon(DesktopIcon(QLatin1String("preferences-desktop-theme"))));
192  addPage(mViewPageItem);
193 
194  mEditPage = new EditPrefTab(mTabScrollGroup);
195  mEditPageItem = new KPageWidgetItem(mEditPage, i18nc("@title:tab", "Edit"));
196  mEditPageItem->setHeader(i18nc("@title", "Default Alarm Edit Settings"));
197  mEditPageItem->setIcon(KIcon(DesktopIcon(QLatin1String("document-properties"))));
198  addPage(mEditPageItem);
199 
200  connect(this, SIGNAL(okClicked()), SLOT(slotOk()));
201  connect(this, SIGNAL(cancelClicked()), SLOT(slotCancel()));
202  connect(this, SIGNAL(applyClicked()), SLOT(slotApply()));
203  connect(this, SIGNAL(defaultClicked()), SLOT(slotDefault()));
204  connect(this, SIGNAL(helpClicked()), SLOT(slotHelp()));
205  restore(false);
206  adjustSize();
207 }
208 
209 KAlarmPrefDlg::~KAlarmPrefDlg()
210 {
211  mInstance = 0;
212 }
213 
214 void KAlarmPrefDlg::slotHelp()
215 {
216  KToolInvocation::invokeHelp(QLatin1String("preferences"));
217 }
218 
219 // Apply the preferences that are currently selected
220 void KAlarmPrefDlg::slotApply()
221 {
222  kDebug();
223  QString errmsg = mEmailPage->validate();
224  if (!errmsg.isEmpty())
225  {
226  setCurrentPage(mEmailPageItem);
227  if (KAMessageBox::warningYesNo(this, errmsg) != KMessageBox::Yes)
228  {
229  mValid = false;
230  return;
231  }
232  }
233  errmsg = mEditPage->validate();
234  if (!errmsg.isEmpty())
235  {
236  setCurrentPage(mEditPageItem);
237  KAMessageBox::sorry(this, errmsg);
238  mValid = false;
239  return;
240  }
241  mValid = true;
242  mEmailPage->apply(false);
243  mViewPage->apply(false);
244  mEditPage->apply(false);
245  mStorePage->apply(false);
246  mTimePage->apply(false);
247  mMiscPage->apply(false);
248  Preferences::self()->writeConfig();
249 }
250 
251 // Apply the preferences that are currently selected
252 void KAlarmPrefDlg::slotOk()
253 {
254  kDebug();
255  mValid = true;
256  slotApply();
257  if (mValid)
258  KDialog::accept();
259 }
260 
261 // Discard the current preferences and close the dialog
262 void KAlarmPrefDlg::slotCancel()
263 {
264  kDebug();
265  restore(false);
266  KDialog::reject();
267 }
268 
269 // Reset all controls to the application defaults
270 void KAlarmPrefDlg::slotDefault()
271 {
272  switch (KAMessageBox::questionYesNoCancel(this, i18nc("@info", "Reset all tabs to their default values, or only reset the current tab?"),
273  QString(),
274  KGuiItem(i18nc("@action:button Reset ALL tabs", "&All")),
275  KGuiItem(i18nc("@action:button Reset the CURRENT tab", "C&urrent"))))
276  {
277  case KMessageBox::Yes:
278  restore(true); // restore all tabs
279  break;
280  case KMessageBox::No:
281  Preferences::self()->useDefaults(true);
282  static_cast<PrefsTabBase*>(currentPage()->widget())->restore(true, false);
283  Preferences::self()->useDefaults(false);
284  break;
285  default:
286  break;
287  }
288 }
289 
290 // Discard the current preferences and use the present ones
291 void KAlarmPrefDlg::restore(bool defaults)
292 {
293  kDebug() << (defaults ? "defaults" : "");
294  if (defaults)
295  Preferences::self()->useDefaults(true);
296  mEmailPage->restore(defaults, true);
297  mViewPage->restore(defaults, true);
298  mEditPage->restore(defaults, true);
299  mStorePage->restore(defaults, true);
300  mTimePage->restore(defaults, true);
301  mMiscPage->restore(defaults, true);
302  if (defaults)
303  Preferences::self()->useDefaults(false);
304 }
305 
306 /******************************************************************************
307 * Return the minimum size for the dialog.
308 * If the minimum size would be too high to fit the desktop, the tab contents
309 * are made scrollable.
310 */
311 QSize KAlarmPrefDlg::minimumSizeHint() const
312 {
313  if (!mTabScrollGroup->sized())
314  {
315  QSize s = mTabScrollGroup->adjustSize();
316  if (s.isValid())
317  {
318  if (mTabScrollGroup->heightReduction())
319  {
320  s = QSize(s.width(), s.height() - mTabScrollGroup->heightReduction());
321  const_cast<KAlarmPrefDlg*>(this)->resize(s);
322  }
323  return s;
324  }
325  }
326  return KDialog::minimumSizeHint();
327 }
328 
329 void KAlarmPrefDlg::showEvent(QShowEvent* e)
330 {
331  KDialog::showEvent(e);
332  if (!mShown)
333  {
334  mTabScrollGroup->adjustSize(true);
335  mShown = true;
336  }
337 }
338 
339 /******************************************************************************
340 * Called when the dialog's size has changed.
341 * Records the new size in the config file.
342 */
343 void KAlarmPrefDlg::resizeEvent(QResizeEvent* re)
344 {
345  if (isVisible())
346  KAlarm::writeConfigWindowSize(PREF_DIALOG_NAME, re->size());
347  KPageDialog::resizeEvent(re);
348 }
349 
350 
351 /*=============================================================================
352 = Class PrefsTabBase
353 =============================================================================*/
354 int PrefsTabBase::mIndentWidth = 0;
355 
356 PrefsTabBase::PrefsTabBase(StackedScrollGroup* scrollGroup)
357  : StackedScrollWidget(scrollGroup),
358  mLabelsAligned(false)
359 {
360  mTopWidget = new KVBox(this);
361  mTopWidget->setMargin(0);
362  mTopWidget->setSpacing(KDialog::spacingHint());
363  setWidget(mTopWidget);
364  if (!mIndentWidth)
365  {
366  QRadioButton radio(this);
367  QStyleOptionButton opt;
368  opt.initFrom(&radio);
369  mIndentWidth = style()->subElementRect(QStyle::SE_RadioButtonIndicator, &opt).width();
370  }
371  mTopLayout = qobject_cast<QVBoxLayout*>(mTopWidget->layout());
372  Q_ASSERT(mTopLayout);
373 }
374 
375 void PrefsTabBase::apply(bool syncToDisc)
376 {
377  if (syncToDisc)
378  Preferences::self()->writeConfig();
379 }
380 
381 void PrefsTabBase::addAlignedLabel(QLabel* label)
382 {
383  mLabels += label;
384 }
385 
386 void PrefsTabBase::showEvent(QShowEvent*)
387 {
388  if (!mLabelsAligned)
389  {
390  int wid = 0;
391  int i;
392  int end = mLabels.count();
393  QList<int> xpos;
394  for (i = 0; i < end; ++i)
395  {
396  int x = mLabels[i]->mapTo(this, QPoint(0, 0)).x();
397  xpos += x;
398  int w = x + mLabels[i]->sizeHint().width();
399  if (w > wid)
400  wid = w;
401  }
402  for (i = 0; i < end; ++i)
403  {
404  mLabels[i]->setFixedWidth(wid - xpos[i]);
405  mLabels[i]->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
406  }
407  mLabelsAligned = true;
408  }
409 }
410 
411 
412 /*=============================================================================
413 = Class MiscPrefTab
414 =============================================================================*/
415 
416 MiscPrefTab::MiscPrefTab(StackedScrollGroup* scrollGroup)
417  : PrefsTabBase(scrollGroup)
418 {
419  QGroupBox* group = new QGroupBox(i18nc("@title:group", "Run Mode"), topWidget());
420  QVBoxLayout* vlayout = new QVBoxLayout(group);
421  vlayout->setMargin(KDialog::marginHint());
422  vlayout->setSpacing(KDialog::spacingHint());
423 
424  // Start at login
425  mAutoStart = new QCheckBox(i18nc("@option:check", "Start at login"), group);
426  connect(mAutoStart, SIGNAL(clicked()), SLOT(slotAutostartClicked()));
427  mAutoStart->setWhatsThis(i18nc("@info:whatsthis",
428  "<para>Automatically start <application>KAlarm</application> whenever you start KDE.</para>"
429  "<para>This option should always be checked unless you intend to discontinue use of <application>KAlarm</application>.</para>"));
430  vlayout->addWidget(mAutoStart, 0, Qt::AlignLeft);
431 
432  mQuitWarn = new QCheckBox(i18nc("@option:check", "Warn before quitting"), group);
433  mQuitWarn->setWhatsThis(i18nc("@info:whatsthis", "Check to display a warning prompt before quitting <application>KAlarm</application>."));
434  vlayout->addWidget(mQuitWarn, 0, Qt::AlignLeft);
435 
436  group->setFixedHeight(group->sizeHint().height());
437 
438  // Confirm alarm deletion?
439  KHBox* itemBox = new KHBox(topWidget()); // this is to allow left adjustment
440  itemBox->setMargin(0);
441  mConfirmAlarmDeletion = new QCheckBox(i18nc("@option:check", "Confirm alarm deletions"), itemBox);
442  mConfirmAlarmDeletion->setMinimumSize(mConfirmAlarmDeletion->sizeHint());
443  mConfirmAlarmDeletion->setWhatsThis(i18nc("@info:whatsthis", "Check to be prompted for confirmation each time you delete an alarm."));
444  itemBox->setStretchFactor(new QWidget(itemBox), 1); // left adjust the controls
445  itemBox->setFixedHeight(itemBox->sizeHint().height());
446 
447  // Default alarm deferral time
448  itemBox = new KHBox(topWidget()); // this is to allow left adjustment
449  KHBox* box = new KHBox(itemBox); // this is to control the QWhatsThis text display area
450  box->setSpacing(KDialog::spacingHint());
451  QLabel* label = new QLabel(i18nc("@label:spinbox", "Default defer time interval:"), box);
452  mDefaultDeferTime = new TimeSpinBox(1, 5999, box);
453  mDefaultDeferTime->setMinimumSize(mDefaultDeferTime->sizeHint());
454  box->setWhatsThis(i18nc("@info:whatsthis",
455  "Enter the default time interval (hours & minutes) to defer alarms, used by the Defer Alarm dialog."));
456  label->setBuddy(mDefaultDeferTime);
457  itemBox->setStretchFactor(new QWidget(itemBox), 1); // left adjust the controls
458  itemBox->setFixedHeight(itemBox->sizeHint().height());
459 
460  // Terminal window to use for command alarms
461  group = new QGroupBox(i18nc("@title:group", "Terminal for Command Alarms"), topWidget());
462  group->setWhatsThis(i18nc("@info:whatsthis", "Choose which application to use when a command alarm is executed in a terminal window"));
463  QGridLayout* grid = new QGridLayout(group);
464  grid->setMargin(KDialog::marginHint());
465  grid->setSpacing(KDialog::spacingHint());
466  int row = 0;
467 
468  mXtermType = new ButtonGroup(group);
469  int index = 0;
470  mXtermFirst = -1;
471  for (mXtermCount = 0; !xtermCommands[mXtermCount].isNull(); ++mXtermCount)
472  {
473  QString cmd = xtermCommands[mXtermCount];
474  QStringList args = KShell::splitArgs(cmd);
475  if (args.isEmpty() || KStandardDirs::findExe(args[0]).isEmpty())
476  continue;
477  QRadioButton* radio = new QRadioButton(args[0], group);
478  radio->setMinimumSize(radio->sizeHint());
479  mXtermType->addButton(radio, mXtermCount);
480  if (mXtermFirst < 0)
481  mXtermFirst = mXtermCount; // note the id of the first button
482  cmd.replace(QLatin1String("%t"), KGlobal::mainComponent().aboutData()->programName());
483  cmd.replace(QLatin1String("%c"), QLatin1String("<command>"));
484  cmd.replace(QLatin1String("%w"), QLatin1String("<command; sleep>"));
485  cmd.replace(QLatin1String("%C"), QLatin1String("[command]"));
486  cmd.replace(QLatin1String("%W"), QLatin1String("[command; sleep]"));
487  radio->setWhatsThis(
488  i18nc("@info:whatsthis", "Check to execute command alarms in a terminal window by <icode>%1</icode>", cmd));
489  grid->addWidget(radio, (row = index/3), index % 3, Qt::AlignLeft);
490  ++index;
491  }
492 
493  // QHBox used here doesn't allow the KLineEdit to expand!?
494  QHBoxLayout* hlayout = new QHBoxLayout();
495  hlayout->setSpacing(KDialog::spacingHint());
496  grid->addLayout(hlayout, row + 1, 0, 1, 3, Qt::AlignLeft);
497  QRadioButton* radio = new QRadioButton(i18nc("@option:radio Other terminal window command", "Other:"), group);
498  hlayout->addWidget(radio);
499  connect(radio, SIGNAL(toggled(bool)), SLOT(slotOtherTerminalToggled(bool)));
500  mXtermType->addButton(radio, mXtermCount);
501  if (mXtermFirst < 0)
502  mXtermFirst = mXtermCount; // note the id of the first button
503  mXtermCommand = new KLineEdit(group);
504  mXtermCommand->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
505  hlayout->addWidget(mXtermCommand);
506  QString wt =
507  i18nc("@info:whatsthis", "Enter the full command line needed to execute a command in your chosen terminal window. "
508  "By default the alarm's command string will be appended to what you enter here. "
509  "See the <application>KAlarm</application> Handbook for details of special codes to tailor the command line.");
510  radio->setWhatsThis(wt);
511  mXtermCommand->setWhatsThis(wt);
512 
513  topLayout()->addStretch(); // top adjust the widgets
514 }
515 
516 void MiscPrefTab::restore(bool defaults, bool)
517 {
518  mAutoStart->setChecked(defaults ? true : Preferences::autoStart());
519  mQuitWarn->setChecked(Preferences::quitWarn());
520  mConfirmAlarmDeletion->setChecked(Preferences::confirmAlarmDeletion());
521  mDefaultDeferTime->setValue(Preferences::defaultDeferTime());
522  QString xtermCmd = Preferences::cmdXTermCommand();
523  int id = mXtermFirst;
524  if (!xtermCmd.isEmpty())
525  {
526  for ( ; id < mXtermCount; ++id)
527  {
528  if (mXtermType->find(id) && xtermCmd == xtermCommands[id])
529  break;
530  }
531  }
532  mXtermType->setButton(id);
533  mXtermCommand->setEnabled(id == mXtermCount);
534  mXtermCommand->setText(id == mXtermCount ? xtermCmd : QString());
535 }
536 
537 void MiscPrefTab::apply(bool syncToDisc)
538 {
539  // First validate anything entered in Other X-terminal command
540  int xtermID = mXtermType->selectedId();
541  if (xtermID >= mXtermCount)
542  {
543  QString cmd = mXtermCommand->text();
544  if (cmd.isEmpty())
545  xtermID = -1; // 'Other' is only acceptable if it's non-blank
546  else
547  {
548  QStringList args = KShell::splitArgs(cmd);
549  cmd = args.isEmpty() ? QString() : args[0];
550  if (KStandardDirs::findExe(cmd).isEmpty())
551  {
552  mXtermCommand->setFocus();
553  if (KAMessageBox::warningContinueCancel(topWidget(), i18nc("@info", "Command to invoke terminal window not found: <command>%1</command>", cmd))
554  != KMessageBox::Continue)
555  return;
556  }
557  }
558  }
559  if (xtermID < 0)
560  {
561  xtermID = mXtermFirst;
562  mXtermType->setButton(mXtermFirst);
563  }
564 
565  if (mQuitWarn->isEnabled())
566  {
567  bool b = mQuitWarn->isChecked();
568  if (b != Preferences::quitWarn())
569  Preferences::setQuitWarn(b);
570  }
571  bool b = mAutoStart->isChecked();
572  if (b != Preferences::autoStart())
573  {
574  Preferences::setAutoStart(b);
575  Preferences::setAskAutoStart(true); // cancel any start-at-login prompt suppression
576  if (b)
577  Preferences::setNoAutoStart(false);
578  Preferences::setAutoStartChangedByUser(true); // prevent prompting the user on quit, about start-at-login
579  }
580  b = mConfirmAlarmDeletion->isChecked();
581  if (b != Preferences::confirmAlarmDeletion())
582  Preferences::setConfirmAlarmDeletion(b);
583  int i = mDefaultDeferTime->value();
584  if (i != Preferences::defaultDeferTime())
585  Preferences::setDefaultDeferTime(i);
586  QString text = (xtermID < mXtermCount) ? xtermCommands[xtermID] : mXtermCommand->text();
587  if (text != Preferences::cmdXTermCommand())
588  Preferences::setCmdXTermCommand(text);
589  PrefsTabBase::apply(syncToDisc);
590 }
591 
592 void MiscPrefTab::slotAutostartClicked()
593 {
594  if (!mAutoStart->isChecked()
595  && KAMessageBox::warningYesNo(topWidget(),
596  i18nc("@info", "You should not uncheck this option unless you intend to discontinue use of <application>KAlarm</application>"),
597  QString(), KStandardGuiItem::cont(), KStandardGuiItem::cancel()
598  ) != KMessageBox::Yes)
599  mAutoStart->setChecked(true);
600 }
601 
602 void MiscPrefTab::slotOtherTerminalToggled(bool on)
603 {
604  mXtermCommand->setEnabled(on);
605 }
606 
607 
608 /*=============================================================================
609 = Class TimePrefTab
610 =============================================================================*/
611 
612 TimePrefTab::TimePrefTab(StackedScrollGroup* scrollGroup)
613  : PrefsTabBase(scrollGroup)
614 {
615  // Default time zone
616  ItemBox* itemBox = new ItemBox(topWidget());
617  itemBox->setMargin(0);
618  KHBox* box = new KHBox(itemBox); // this is to control the QWhatsThis text display area
619  box->setMargin(0);
620  box->setSpacing(KDialog::spacingHint());
621  QLabel* label = new QLabel(i18nc("@label:listbox", "Time zone:"), box);
622  addAlignedLabel(label);
623 #if 1
624  mTimeZone = new TimeZoneCombo(box);
625  mTimeZone->setMaxVisibleItems(15);
626 #else
627  mTimeZone = new KComboBox(box);
628  mTimeZone->setMaxVisibleItems(15);
629  const KTimeZones::ZoneMap zones = KSystemTimeZones::zones();
630  for (KTimeZones::ZoneMap::ConstIterator it = zones.constBegin(); it != zones.constEnd(); ++it)
631  mTimeZone->addItem(it.key());
632 #endif
633  box->setWhatsThis(i18nc("@info:whatsthis",
634  "Select the time zone which <application>KAlarm</application> should use "
635  "as its default for displaying and entering dates and times."));
636  label->setBuddy(mTimeZone);
637  itemBox->leftAlign();
638  itemBox->setFixedHeight(box->sizeHint().height());
639 
640  // Holiday region
641  itemBox = new ItemBox(topWidget());
642  itemBox->setMargin(0);
643  box = new KHBox(itemBox); // this is to control the QWhatsThis text display area
644  box->setMargin(0);
645  box->setSpacing(KDialog::spacingHint());
646  label = new QLabel(i18nc("@label:listbox", "Holiday region:"), box);
647  addAlignedLabel(label);
648  mHolidays = new KComboBox(box);
649  mHolidays->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
650  itemBox->leftAlign();
651  label->setBuddy(mHolidays);
652  box->setWhatsThis(i18nc("@info:whatsthis",
653  "Select which holiday region to use"));
654 
655  QStringList regions = HolidayRegion::regionCodes();
656  QMap<QString, QString> regionsMap;
657  foreach (const QString& regionCode, regions)
658  {
659  QString name = HolidayRegion::name(regionCode);
660  QString languageName = KGlobal::locale()->languageCodeToName(HolidayRegion::languageCode(regionCode));
661  QString label = languageName.isEmpty() ? name : i18nc("Holiday region, region language", "%1 (%2)", name, languageName);
662  regionsMap.insert(label, regionCode);
663  }
664 
665  mHolidays->addItem(i18nc("No holiday region", "None"), QString());
666  for (QMapIterator<QString, QString> it(regionsMap); it.hasNext(); )
667  {
668  it.next();
669  mHolidays->addItem(it.key(), it.value());
670  }
671 
672  // Start-of-day time
673  itemBox = new ItemBox(topWidget());
674  itemBox->setMargin(0);
675  box = new KHBox(itemBox); // this is to control the QWhatsThis text display area
676  box->setMargin(0);
677  box->setSpacing(KDialog::spacingHint());
678  label = new QLabel(i18nc("@label:spinbox", "Start of day for date-only alarms:"), box);
679  addAlignedLabel(label);
680  mStartOfDay = new TimeEdit(box);
681  label->setBuddy(mStartOfDay);
682  box->setWhatsThis(i18nc("@info:whatsthis",
683  "<para>The earliest time of day at which a date-only alarm will be triggered.</para>"
684  "<para>%1</para>", TimeSpinBox::shiftWhatsThis()));
685  itemBox->leftAlign();
686  itemBox->setFixedHeight(box->sizeHint().height());
687 
688  // Working hours
689  QGroupBox* group = new QGroupBox(i18nc("@title:group", "Working Hours"), topWidget());
690  QBoxLayout* layout = new QVBoxLayout(group);
691  layout->setMargin(KDialog::marginHint());
692  layout->setSpacing(KDialog::spacingHint());
693 
694  QWidget* daybox = new QWidget(group); // this is to control the QWhatsThis text display area
695  layout->addWidget(daybox);
696  QGridLayout* wgrid = new QGridLayout(daybox);
697  wgrid->setSpacing(KDialog::spacingHint());
698  const KLocale* locale = KGlobal::locale();
699  for (int i = 0; i < 7; ++i)
700  {
701  int day = KAlarm::localeDayInWeek_to_weekDay(i);
702  mWorkDays[i] = new QCheckBox(KAlarm::weekDayName(day, locale), daybox);
703  wgrid->addWidget(mWorkDays[i], i/3, i%3, Qt::AlignLeft);
704  }
705  daybox->setFixedHeight(daybox->sizeHint().height());
706  daybox->setWhatsThis(i18nc("@info:whatsthis", "Check the days in the week which are work days"));
707 
708  itemBox = new ItemBox(group);
709  itemBox->setMargin(0);
710  layout->addWidget(itemBox);
711  box = new KHBox(itemBox); // this is to control the QWhatsThis text display area
712  box->setMargin(0);
713  box->setSpacing(KDialog::spacingHint());
714  label = new QLabel(i18nc("@label:spinbox", "Daily start time:"), box);
715  addAlignedLabel(label);
716  mWorkStart = new TimeEdit(box);
717  label->setBuddy(mWorkStart);
718  box->setWhatsThis(i18nc("@info:whatsthis",
719  "<para>Enter the start time of the working day.</para>"
720  "<para>%1</para>", TimeSpinBox::shiftWhatsThis()));
721  itemBox->leftAlign();
722 
723  itemBox = new ItemBox(group);
724  itemBox->setMargin(0);
725  layout->addWidget(itemBox);
726  box = new KHBox(itemBox); // this is to control the QWhatsThis text display area
727  box->setMargin(0);
728  box->setSpacing(KDialog::spacingHint());
729  label = new QLabel(i18nc("@label:spinbox", "Daily end time:"), box);
730  addAlignedLabel(label);
731  mWorkEnd = new TimeEdit(box);
732  label->setBuddy(mWorkEnd);
733  box->setWhatsThis(i18nc("@info:whatsthis",
734  "<para>Enter the end time of the working day.</para>"
735  "<para>%1</para>", TimeSpinBox::shiftWhatsThis()));
736  itemBox->leftAlign();
737  box->setFixedHeight(box->sizeHint().height());
738 
739  // KOrganizer event duration
740  group = new QGroupBox(i18nc("@title:group", "KOrganizer"), topWidget());
741  layout = new QVBoxLayout(group);
742  layout->setMargin(KDialog::marginHint());
743  layout->setSpacing(KDialog::spacingHint());
744 
745  itemBox = new ItemBox(group);
746  itemBox->setMargin(0);
747  layout->addWidget(itemBox);
748  box = new KHBox(itemBox); // this is to control the QWhatsThis text display area
749  box->setMargin(0);
750  box->setSpacing(KDialog::spacingHint());
751  label = new QLabel(i18nc("@label:spinbox", "KOrganizer event duration:"), box);
752  addAlignedLabel(label);
753  mKOrgEventDuration = new TimeSpinBox(0, 5999, box);
754  mKOrgEventDuration->setMinimumSize(mKOrgEventDuration->sizeHint());
755  box->setWhatsThis(i18nc("@info:whatsthis",
756  "<para>Enter the event duration in hours and minutes, for alarms which are copied to KOrganizer.</para>"
757  "<para>%1</para>", TimeSpinBox::shiftWhatsThis()));
758  label->setBuddy(mKOrgEventDuration);
759  itemBox->setStretchFactor(new QWidget(itemBox), 1); // left adjust the controls
760  itemBox->setFixedHeight(itemBox->sizeHint().height());
761 
762  topLayout()->addStretch(); // top adjust the widgets
763 }
764 
765 void TimePrefTab::restore(bool, bool)
766 {
767 #if 1
768  mTimeZone->setTimeZone(Preferences::timeZone());
769 #else
770  int tzindex = 0;
771  KTimeZone tz = Preferences::timeZone();
772  if (tz.isValid())
773  {
774  QString zone = tz.name();
775  int count = mTimeZone->count();
776  while (tzindex < count && mTimeZone->itemText(tzindex) != zone)
777  ++tzindex;
778  if (tzindex >= count)
779  tzindex = 0;
780  }
781  mTimeZone->setCurrentIndex(tzindex);
782 #endif
783  int i = Preferences::holidays().isValid() ? mHolidays->findData(Preferences::holidays().regionCode()) : 0;
784  mHolidays->setCurrentIndex(i);
785  mStartOfDay->setValue(Preferences::startOfDay());
786  mWorkStart->setValue(Preferences::workDayStart());
787  mWorkEnd->setValue(Preferences::workDayEnd());
788  QBitArray days = Preferences::workDays();
789  for (int i = 0; i < 7; ++i)
790  {
791  bool x = days.testBit(KAlarm::localeDayInWeek_to_weekDay(i) - 1);
792  mWorkDays[i]->setChecked(x);
793  }
794  mKOrgEventDuration->setValue(Preferences::kOrgEventDuration());
795 }
796 
797 void TimePrefTab::apply(bool syncToDisc)
798 {
799 #if 1
800  KTimeZone tz = mTimeZone->timeZone();
801  if (tz.isValid())
802  Preferences::setTimeZone(tz);
803 #else
804  KTimeZone tz = KSystemTimeZones::zone(mTimeZone->currentText());
805  if (tz.isValid() && tz != Preferences::timeZone())
806  Preferences::setTimeZone(tz);
807 #endif
808  QString hol = mHolidays->itemData(mHolidays->currentIndex()).toString();
809  if (hol != Preferences::holidays().regionCode())
810  Preferences::setHolidayRegion(hol);
811  int t = mStartOfDay->value();
812  QTime sodt(t/60, t%60, 0);
813  if (sodt != Preferences::startOfDay())
814  Preferences::setStartOfDay(sodt);
815  t = mWorkStart->value();
816  Preferences::setWorkDayStart(QTime(t/60, t%60, 0));
817  t = mWorkEnd->value();
818  Preferences::setWorkDayEnd(QTime(t/60, t%60, 0));
819  QBitArray workDays(7);
820  for (int i = 0; i < 7; ++i)
821  if (mWorkDays[i]->isChecked())
822  workDays.setBit(KAlarm::localeDayInWeek_to_weekDay(i) - 1, 1);
823  Preferences::setWorkDays(workDays);
824  Preferences::setKOrgEventDuration(mKOrgEventDuration->value());
825  t = mKOrgEventDuration->value();
826  if (t != Preferences::kOrgEventDuration())
827  Preferences::setKOrgEventDuration(t);
828  PrefsTabBase::apply(syncToDisc);
829 }
830 
831 
832 /*=============================================================================
833 = Class StorePrefTab
834 =============================================================================*/
835 
836 StorePrefTab::StorePrefTab(StackedScrollGroup* scrollGroup)
837  : PrefsTabBase(scrollGroup),
838  mCheckKeepChanges(false)
839 {
840  // Which resource to save to
841  QGroupBox* group = new QGroupBox(i18nc("@title:group", "New Alarms && Templates"), topWidget());
842  QButtonGroup* bgroup = new QButtonGroup(group);
843  QBoxLayout* layout = new QVBoxLayout(group);
844  layout->setMargin(KDialog::marginHint());
845  layout->setSpacing(KDialog::spacingHint());
846 
847  mDefaultResource = new QRadioButton(i18nc("@option:radio", "Store in default calendar"), group);
848  bgroup->addButton(mDefaultResource);
849  mDefaultResource->setWhatsThis(i18nc("@info:whatsthis", "Add all new alarms and alarm templates to the default calendars, without prompting."));
850  layout->addWidget(mDefaultResource, 0, Qt::AlignLeft);
851  mAskResource = new QRadioButton(i18nc("@option:radio", "Prompt for which calendar to store in"), group);
852  bgroup->addButton(mAskResource);
853  mAskResource->setWhatsThis(i18nc("@info:whatsthis",
854  "<para>When saving a new alarm or alarm template, prompt for which calendar to store it in, if there is more than one active calendar.</para>"
855  "<para>Note that archived alarms are always stored in the default archived alarm calendar.</para>"));
856  layout->addWidget(mAskResource, 0, Qt::AlignLeft);
857 
858  // Archived alarms
859  group = new QGroupBox(i18nc("@title:group", "Archived Alarms"), topWidget());
860  QGridLayout* grid = new QGridLayout(group);
861  grid->setMargin(KDialog::marginHint());
862  grid->setSpacing(KDialog::spacingHint());
863  grid->setColumnStretch(1, 1);
864  grid->setColumnMinimumWidth(0, indentWidth());
865  mKeepArchived = new QCheckBox(i18nc("@option:check", "Keep alarms after expiry"), group);
866  connect(mKeepArchived, SIGNAL(toggled(bool)), SLOT(slotArchivedToggled(bool)));
867  mKeepArchived->setWhatsThis(
868  i18nc("@info:whatsthis", "Check to archive alarms after expiry or deletion (except deleted alarms which were never triggered)."));
869  grid->addWidget(mKeepArchived, 0, 0, 1, 2, Qt::AlignLeft);
870 
871  KHBox* box = new KHBox(group);
872  box->setMargin(0);
873  box->setSpacing(KDialog::spacingHint());
874  mPurgeArchived = new QCheckBox(i18nc("@option:check", "Discard archived alarms after:"), box);
875  mPurgeArchived->setMinimumSize(mPurgeArchived->sizeHint());
876  connect(mPurgeArchived, SIGNAL(toggled(bool)), SLOT(slotArchivedToggled(bool)));
877  mPurgeAfter = new SpinBox(box);
878  mPurgeAfter->setMinimum(1);
879  mPurgeAfter->setSingleShiftStep(10);
880  mPurgeAfter->setMinimumSize(mPurgeAfter->sizeHint());
881  mPurgeAfterLabel = new QLabel(i18nc("@label Time unit for user-entered number", "days"), box);
882  mPurgeAfterLabel->setMinimumSize(mPurgeAfterLabel->sizeHint());
883  mPurgeAfterLabel->setBuddy(mPurgeAfter);
884  box->setWhatsThis(i18nc("@info:whatsthis", "Uncheck to store archived alarms indefinitely. Check to enter how long archived alarms should be stored."));
885  grid->addWidget(box, 1, 1, Qt::AlignLeft);
886 
887  mClearArchived = new QPushButton(i18nc("@action:button", "Clear Archived Alarms"), group);
888  mClearArchived->setFixedSize(mClearArchived->sizeHint());
889  connect(mClearArchived, SIGNAL(clicked()), SLOT(slotClearArchived()));
890 #ifdef USE_AKONADI
891  mClearArchived->setWhatsThis((CollectionControlModel::enabledCollections(CalEvent::ARCHIVED, false).count() <= 1)
892 #else
893  mClearArchived->setWhatsThis((AlarmResources::instance()->activeCount(CalEvent::ARCHIVED, false) <= 1)
894 #endif
895  ? i18nc("@info:whatsthis", "Delete all existing archived alarms.")
896  : i18nc("@info:whatsthis", "Delete all existing archived alarms (from the default archived alarm calendar only)."));
897  grid->addWidget(mClearArchived, 2, 1, Qt::AlignLeft);
898  group->setFixedHeight(group->sizeHint().height());
899 
900  topLayout()->addStretch(); // top adjust the widgets
901 }
902 
903 void StorePrefTab::restore(bool defaults, bool)
904 {
905  mCheckKeepChanges = defaults;
906  if (Preferences::askResource())
907  mAskResource->setChecked(true);
908  else
909  mDefaultResource->setChecked(true);
910  int keepDays = Preferences::archivedKeepDays();
911  if (!defaults)
912  mOldKeepArchived = keepDays;
913  setArchivedControls(keepDays);
914  mCheckKeepChanges = true;
915 }
916 
917 void StorePrefTab::apply(bool syncToDisc)
918 {
919  bool b = mAskResource->isChecked();
920  if (b != Preferences::askResource())
921  Preferences::setAskResource(mAskResource->isChecked());
922  int days = !mKeepArchived->isChecked() ? 0 : mPurgeArchived->isChecked() ? mPurgeAfter->value() : -1;
923  if (days != Preferences::archivedKeepDays())
924  Preferences::setArchivedKeepDays(days);
925  PrefsTabBase::apply(syncToDisc);
926 }
927 
928 void StorePrefTab::setArchivedControls(int purgeDays)
929 {
930  mKeepArchived->setChecked(purgeDays);
931  mPurgeArchived->setChecked(purgeDays > 0);
932  mPurgeAfter->setValue(purgeDays > 0 ? purgeDays : 0);
933  slotArchivedToggled(true);
934 }
935 
936 void StorePrefTab::slotArchivedToggled(bool)
937 {
938  bool keep = mKeepArchived->isChecked();
939  if (keep && !mOldKeepArchived && mCheckKeepChanges
940 #ifdef USE_AKONADI
941  && !CollectionControlModel::getStandard(CalEvent::ARCHIVED).isValid())
942 #else
943  && !AlarmResources::instance()->getStandardResource(CalEvent::ARCHIVED))
944 #endif
945  {
946  KAMessageBox::sorry(topWidget(),
947  i18nc("@info", "<para>A default calendar is required in order to archive alarms, but none is currently enabled.</para>"
948  "<para>If you wish to keep expired alarms, please first use the calendars view to select a default "
949  "archived alarms calendar.</para>"));
950  mKeepArchived->setChecked(false);
951  return;
952  }
953  mOldKeepArchived = keep;
954  mPurgeArchived->setEnabled(keep);
955  mPurgeAfter->setEnabled(keep && mPurgeArchived->isChecked());
956  mPurgeAfterLabel->setEnabled(keep);
957  mClearArchived->setEnabled(keep);
958 }
959 
960 void StorePrefTab::slotClearArchived()
961 {
962 #ifdef USE_AKONADI
963  bool single = CollectionControlModel::enabledCollections(CalEvent::ARCHIVED, false).count() <= 1;
964 #else
965  bool single = AlarmResources::instance()->activeCount(CalEvent::ARCHIVED, false) <= 1;
966 #endif
967  if (KAMessageBox::warningContinueCancel(topWidget(), single ? i18nc("@info", "Do you really want to delete all archived alarms?")
968  : i18nc("@info", "Do you really want to delete all alarms in the default archived alarm calendar?"))
969  != KMessageBox::Continue)
970  return;
971  theApp()->purgeAll();
972 }
973 
974 
975 /*=============================================================================
976 = Class EmailPrefTab
977 =============================================================================*/
978 
979 EmailPrefTab::EmailPrefTab(StackedScrollGroup* scrollGroup)
980  : PrefsTabBase(scrollGroup),
981  mAddressChanged(false),
982  mBccAddressChanged(false)
983 {
984  KHBox* box = new KHBox(topWidget());
985  box->setMargin(0);
986  box->setSpacing(2*KDialog::spacingHint());
987  new QLabel(i18nc("@label", "Email client:"), box);
988  mEmailClient = new ButtonGroup(box);
989  QString kmailOption = i18nc("@option:radio", "KMail");
990  QString sendmailOption = i18nc("@option:radio", "Sendmail");
991  mKMailButton = new RadioButton(kmailOption, box);
992  mKMailButton->setMinimumSize(mKMailButton->sizeHint());
993  mEmailClient->addButton(mKMailButton, Preferences::kmail);
994  mSendmailButton = new RadioButton(sendmailOption, box);
995  mSendmailButton->setMinimumSize(mSendmailButton->sizeHint());
996  mEmailClient->addButton(mSendmailButton, Preferences::sendmail);
997  connect(mEmailClient, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotEmailClientChanged(QAbstractButton*)));
998  box->setFixedHeight(box->sizeHint().height());
999  box->setWhatsThis(i18nc("@info:whatsthis",
1000  "<para>Choose how to send email when an email alarm is triggered."
1001  "<list><item><interface>%1</interface>: The email is sent automatically via <application>KMail</application>. <application>KMail</application> is started first if necessary.</item>"
1002  "<item><interface>%2</interface>: The email is sent automatically. This option will only work if "
1003  "your system is configured to use <application>sendmail</application> or a sendmail compatible mail transport agent.</item></list></para>",
1004  kmailOption, sendmailOption));
1005 
1006  box = new KHBox(topWidget()); // this is to allow left adjustment
1007  box->setMargin(0);
1008  mEmailCopyToKMail = new QCheckBox(i18nc("@option:check", "Copy sent emails into <application>KMail</application>'s <resource>%1</resource> folder", KAMail::i18n_sent_mail()), box);
1009  mEmailCopyToKMail->setWhatsThis(i18nc("@info:whatsthis", "After sending an email, store a copy in <application>KMail</application>'s <resource>%1</resource> folder", KAMail::i18n_sent_mail()));
1010  box->setStretchFactor(new QWidget(box), 1); // left adjust the controls
1011  box->setFixedHeight(box->sizeHint().height());
1012 
1013  box = new KHBox(topWidget()); // this is to allow left adjustment
1014  box->setMargin(0);
1015  mEmailQueuedNotify = new QCheckBox(i18nc("@option:check", "Notify when remote emails are queued"), box);
1016  mEmailQueuedNotify->setWhatsThis(
1017  i18nc("@info:whatsthis", "Display a notification message whenever an email alarm has queued an email for sending to a remote system. "
1018  "This could be useful if, for example, you have a dial-up connection, so that you can then ensure that the email is actually transmitted."));
1019  box->setStretchFactor(new QWidget(box), 1); // left adjust the controls
1020  box->setFixedHeight(box->sizeHint().height());
1021 
1022  // Your Email Address group box
1023  QGroupBox* group = new QGroupBox(i18nc("@title:group", "Your Email Address"), topWidget());
1024  QGridLayout* grid = new QGridLayout(group);
1025  grid->setMargin(KDialog::marginHint());
1026  grid->setSpacing(KDialog::spacingHint());
1027  grid->setColumnStretch(2, 1);
1028 
1029  // 'From' email address controls ...
1030  QLabel *label = new Label(i18nc("@label 'From' email address", "From:"), group);
1031  grid->addWidget(label, 1, 0);
1032  mFromAddressGroup = new ButtonGroup(group);
1033  connect(mFromAddressGroup, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotFromAddrChanged(QAbstractButton*)));
1034 
1035  // Line edit to enter a 'From' email address
1036  mFromAddrButton = new RadioButton(group);
1037  mFromAddressGroup->addButton(mFromAddrButton, Preferences::MAIL_FROM_ADDR);
1038  label->setBuddy(mFromAddrButton);
1039  grid->addWidget(mFromAddrButton, 1, 1);
1040  mEmailAddress = new KLineEdit(group);
1041  connect(mEmailAddress, SIGNAL(textChanged(QString)), SLOT(slotAddressChanged()));
1042  QString whatsThis = i18nc("@info:whatsthis", "Your email address, used to identify you as the sender when sending email alarms.");
1043  mFromAddrButton->setWhatsThis(whatsThis);
1044  mEmailAddress->setWhatsThis(whatsThis);
1045  mFromAddrButton->setFocusWidget(mEmailAddress);
1046  grid->addWidget(mEmailAddress, 1, 2);
1047 
1048  // 'From' email address to be taken from System Settings
1049  mFromCCentreButton = new RadioButton(i18nc("@option:radio", "Use address from System Settings"), group);
1050  mFromAddressGroup->addButton(mFromCCentreButton, Preferences::MAIL_FROM_SYS_SETTINGS);
1051  mFromCCentreButton->setWhatsThis(
1052  i18nc("@info:whatsthis", "Check to use the email address set in KDE System Settings, to identify you as the sender when sending email alarms."));
1053  grid->addWidget(mFromCCentreButton, 2, 1, 1, 2, Qt::AlignLeft);
1054 
1055  // 'From' email address to be picked from KMail's identities when the email alarm is configured
1056  mFromKMailButton = new RadioButton(i18nc("@option:radio", "Use <application>KMail</application> identities"), group);
1057  mFromAddressGroup->addButton(mFromKMailButton, Preferences::MAIL_FROM_KMAIL);
1058  mFromKMailButton->setWhatsThis(
1059  i18nc("@info:whatsthis", "Check to use <application>KMail</application>'s email identities to identify you as the sender when sending email alarms. "
1060  "For existing email alarms, <application>KMail</application>'s default identity will be used. "
1061  "For new email alarms, you will be able to pick which of <application>KMail</application>'s identities to use."));
1062  grid->addWidget(mFromKMailButton, 3, 1, 1, 2, Qt::AlignLeft);
1063 
1064  // 'Bcc' email address controls ...
1065  grid->setRowMinimumHeight(4, KDialog::spacingHint());
1066  label = new Label(i18nc("@label 'Bcc' email address", "Bcc:"), group);
1067  grid->addWidget(label, 5, 0);
1068  mBccAddressGroup = new ButtonGroup(group);
1069  connect(mBccAddressGroup, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotBccAddrChanged(QAbstractButton*)));
1070 
1071  // Line edit to enter a 'Bcc' email address
1072  mBccAddrButton = new RadioButton(group);
1073  mBccAddressGroup->addButton(mBccAddrButton, Preferences::MAIL_FROM_ADDR);
1074  label->setBuddy(mBccAddrButton);
1075  grid->addWidget(mBccAddrButton, 5, 1);
1076  mEmailBccAddress = new KLineEdit(group);
1077  whatsThis = i18nc("@info:whatsthis", "Your email address, used for blind copying email alarms to yourself. "
1078  "If you want blind copies to be sent to your account on the computer which <application>KAlarm</application> runs on, you can simply enter your user login name.");
1079  mBccAddrButton->setWhatsThis(whatsThis);
1080  mEmailBccAddress->setWhatsThis(whatsThis);
1081  mBccAddrButton->setFocusWidget(mEmailBccAddress);
1082  grid->addWidget(mEmailBccAddress, 5, 2);
1083 
1084  // 'Bcc' email address to be taken from System Settings
1085  mBccCCentreButton = new RadioButton(i18nc("@option:radio", "Use address from System Settings"), group);
1086  mBccAddressGroup->addButton(mBccCCentreButton, Preferences::MAIL_FROM_SYS_SETTINGS);
1087  mBccCCentreButton->setWhatsThis(
1088  i18nc("@info:whatsthis", "Check to use the email address set in KDE System Settings, for blind copying email alarms to yourself."));
1089  grid->addWidget(mBccCCentreButton, 6, 1, 1, 2, Qt::AlignLeft);
1090 
1091  group->setFixedHeight(group->sizeHint().height());
1092 
1093  topLayout()->addStretch(); // top adjust the widgets
1094 }
1095 
1096 void EmailPrefTab::restore(bool defaults, bool)
1097 {
1098  mEmailClient->setButton(Preferences::emailClient());
1099  mEmailCopyToKMail->setChecked(Preferences::emailCopyToKMail());
1100  setEmailAddress(Preferences::emailFrom(), Preferences::emailAddress());
1101  setEmailBccAddress((Preferences::emailBccFrom() == Preferences::MAIL_FROM_SYS_SETTINGS), Preferences::emailBccAddress());
1102  mEmailQueuedNotify->setChecked(Preferences::emailQueuedNotify());
1103  if (!defaults)
1104  mAddressChanged = mBccAddressChanged = false;
1105 }
1106 
1107 void EmailPrefTab::apply(bool syncToDisc)
1108 {
1109  int client = mEmailClient->selectedId();
1110  if (client >= 0 && static_cast<Preferences::MailClient>(client) != Preferences::emailClient())
1111  Preferences::setEmailClient(static_cast<Preferences::MailClient>(client));
1112  bool b = mEmailCopyToKMail->isChecked();
1113  if (b != Preferences::emailCopyToKMail())
1114  Preferences::setEmailCopyToKMail(b);
1115  int from = mFromAddressGroup->selectedId();
1116  QString text = mEmailAddress->text().trimmed();
1117  if ((from >= 0 && static_cast<Preferences::MailFrom>(from) != Preferences::emailFrom())
1118  || text != Preferences::emailAddress())
1119  Preferences::setEmailAddress(static_cast<Preferences::MailFrom>(from), text);
1120  b = (mBccAddressGroup->checkedButton() == mBccCCentreButton);
1121  Preferences::MailFrom bfrom = b ? Preferences::MAIL_FROM_SYS_SETTINGS : Preferences::MAIL_FROM_ADDR;;
1122  text = mEmailBccAddress->text().trimmed();
1123  if (bfrom != Preferences::emailBccFrom() || text != Preferences::emailBccAddress())
1124  Preferences::setEmailBccAddress(b, text);
1125  b = mEmailQueuedNotify->isChecked();
1126  if (b != Preferences::emailQueuedNotify())
1127  Preferences::setEmailQueuedNotify(mEmailQueuedNotify->isChecked());
1128  PrefsTabBase::apply(syncToDisc);
1129 }
1130 
1131 void EmailPrefTab::setEmailAddress(Preferences::MailFrom from, const QString& address)
1132 {
1133  mFromAddressGroup->setButton(from);
1134  mEmailAddress->setText(from == Preferences::MAIL_FROM_ADDR ? address.trimmed() : QString());
1135 }
1136 
1137 void EmailPrefTab::setEmailBccAddress(bool useSystemSettings, const QString& address)
1138 {
1139  mBccAddressGroup->setButton(useSystemSettings ? Preferences::MAIL_FROM_SYS_SETTINGS : Preferences::MAIL_FROM_ADDR);
1140  mEmailBccAddress->setText(useSystemSettings ? QString() : address.trimmed());
1141 }
1142 
1143 void EmailPrefTab::slotEmailClientChanged(QAbstractButton* button)
1144 {
1145  mEmailCopyToKMail->setEnabled(button == mSendmailButton);
1146 }
1147 
1148 void EmailPrefTab::slotFromAddrChanged(QAbstractButton* button)
1149 {
1150  mEmailAddress->setEnabled(button == mFromAddrButton);
1151  mAddressChanged = true;
1152 }
1153 
1154 void EmailPrefTab::slotBccAddrChanged(QAbstractButton* button)
1155 {
1156  mEmailBccAddress->setEnabled(button == mBccAddrButton);
1157  mBccAddressChanged = true;
1158 }
1159 
1160 QString EmailPrefTab::validate()
1161 {
1162  if (mAddressChanged)
1163  {
1164  mAddressChanged = false;
1165  QString errmsg = validateAddr(mFromAddressGroup, mEmailAddress, KAMail::i18n_NeedFromEmailAddress());
1166  if (!errmsg.isEmpty())
1167  return errmsg;
1168  }
1169  if (mBccAddressChanged)
1170  {
1171  mBccAddressChanged = false;
1172  return validateAddr(mBccAddressGroup, mEmailBccAddress, i18nc("@info/plain", "No valid 'Bcc' email address is specified."));
1173  }
1174  return QString();
1175 }
1176 
1177 QString EmailPrefTab::validateAddr(ButtonGroup* group, KLineEdit* addr, const QString& msg)
1178 {
1179  QString errmsg = i18nc("@info", "<para>%1</para><para>Are you sure you want to save your changes?</para>", msg);
1180  switch (group->selectedId())
1181  {
1182  case Preferences::MAIL_FROM_SYS_SETTINGS:
1183  if (!KAMail::controlCentreAddress().isEmpty())
1184  return QString();
1185  errmsg = i18nc("@info", "No email address is currently set in KDE System Settings. %1", errmsg);
1186  break;
1187  case Preferences::MAIL_FROM_KMAIL:
1188  if (Identities::identitiesExist())
1189  return QString();
1190  errmsg = i18nc("@info", "No <application>KMail</application> identities currently exist. %1", errmsg);
1191  break;
1192  case Preferences::MAIL_FROM_ADDR:
1193  if (!addr->text().trimmed().isEmpty())
1194  return QString();
1195  break;
1196  }
1197  return errmsg;
1198 }
1199 
1200 
1201 /*=============================================================================
1202 = Class EditPrefTab
1203 =============================================================================*/
1204 
1205 EditPrefTab::EditPrefTab(StackedScrollGroup* scrollGroup)
1206  : PrefsTabBase(scrollGroup)
1207 {
1208  KLocalizedString defsetting = ki18nc("@info:whatsthis", "The default setting for <interface>%1</interface> in the alarm edit dialog.");
1209 
1210  mTabs = new KTabWidget(topWidget());
1211  StackedGroupT<KVBox>* tabgroup = new StackedGroupT<KVBox>(mTabs);
1212  StackedWidgetT<KVBox>* topGeneral = new StackedWidgetT<KVBox>(tabgroup);
1213  topGeneral->setMargin(KDialog::marginHint()/2);
1214  topGeneral->setSpacing(KDialog::spacingHint());
1215  mTabGeneral = mTabs->addTab(topGeneral, i18nc("@title:tab", "General"));
1216  StackedWidgetT<KVBox>* topTypes = new StackedWidgetT<KVBox>(tabgroup);
1217  topTypes->setMargin(KDialog::marginHint()/2);
1218  topTypes->setSpacing(KDialog::spacingHint());
1219  mTabTypes = mTabs->addTab(topTypes, i18nc("@title:tab", "Alarm Types"));
1220  StackedWidgetT<KVBox>* topFontColour = new StackedWidgetT<KVBox>(tabgroup);
1221  topFontColour->setMargin(KDialog::marginHint()/2);
1222  topFontColour->setSpacing(KDialog::spacingHint());
1223  mTabFontColour = mTabs->addTab(topFontColour, i18nc("@title:tab", "Font && Color"));
1224 
1225  // MISCELLANEOUS
1226  // Show in KOrganizer
1227  mCopyToKOrganizer = new QCheckBox(EditAlarmDlg::i18n_chk_ShowInKOrganizer(), topGeneral);
1228  mCopyToKOrganizer->setMinimumSize(mCopyToKOrganizer->sizeHint());
1229  mCopyToKOrganizer->setWhatsThis(defsetting.subs(EditAlarmDlg::i18n_chk_ShowInKOrganizer()).toString());
1230 
1231  // Late cancellation
1232  KHBox* box = new KHBox(topGeneral);
1233  box->setMargin(0);
1234  box->setSpacing(KDialog::spacingHint());
1235  mLateCancel = new QCheckBox(LateCancelSelector::i18n_chk_CancelIfLate(), box);
1236  mLateCancel->setMinimumSize(mLateCancel->sizeHint());
1237  mLateCancel->setWhatsThis(defsetting.subs(LateCancelSelector::i18n_chk_CancelIfLate()).toString());
1238  box->setStretchFactor(new QWidget(box), 1); // left adjust the control
1239 
1240  // Recurrence
1241  QFrame* iBox = new QFrame(topGeneral); // this is to control the QWhatsThis text display area
1242  QHBoxLayout* hlayout = new QHBoxLayout(iBox);
1243  hlayout->setSpacing(KDialog::spacingHint());
1244  QLabel* label = new QLabel(i18nc("@label:listbox", "Recurrence:"), iBox);
1245  hlayout->addWidget(label);
1246  mRecurPeriod = new KComboBox(iBox);
1247  mRecurPeriod->addItem(RecurrenceEdit::i18n_combo_NoRecur());
1248  mRecurPeriod->addItem(RecurrenceEdit::i18n_combo_AtLogin());
1249  mRecurPeriod->addItem(RecurrenceEdit::i18n_combo_HourlyMinutely());
1250  mRecurPeriod->addItem(RecurrenceEdit::i18n_combo_Daily());
1251  mRecurPeriod->addItem(RecurrenceEdit::i18n_combo_Weekly());
1252  mRecurPeriod->addItem(RecurrenceEdit::i18n_combo_Monthly());
1253  mRecurPeriod->addItem(RecurrenceEdit::i18n_combo_Yearly());
1254  mRecurPeriod->setFixedSize(mRecurPeriod->sizeHint());
1255  hlayout->addWidget(mRecurPeriod);
1256  label->setBuddy(mRecurPeriod);
1257  iBox->setWhatsThis(i18nc("@info:whatsthis", "The default setting for the recurrence rule in the alarm edit dialog."));
1258  hlayout->addStretch(); // left adjust the control
1259 
1260  // How to handle February 29th in yearly recurrences
1261  KVBox* vbox = new KVBox(topGeneral); // this is to control the QWhatsThis text display area
1262  vbox->setMargin(0);
1263  vbox->setSpacing(KDialog::spacingHint());
1264  label = new QLabel(i18nc("@label", "In non-leap years, repeat yearly February 29th alarms on:"), vbox);
1265  label->setAlignment(Qt::AlignLeft);
1266  label->setWordWrap(true);
1267  KHBox* itemBox = new KHBox(vbox);
1268 // itemBox->setMargin(0);
1269  itemBox->setSpacing(2*KDialog::spacingHint());
1270  mFeb29 = new ButtonGroup(itemBox);
1271  QWidget* widget = new QWidget(itemBox);
1272  widget->setFixedWidth(3*KDialog::spacingHint());
1273  QRadioButton* radio = new QRadioButton(i18nc("@option:radio", "February 2&8th"), itemBox);
1274  radio->setMinimumSize(radio->sizeHint());
1275  mFeb29->addButton(radio, Preferences::Feb29_Feb28);
1276  radio = new QRadioButton(i18nc("@option:radio", "March &1st"), itemBox);
1277  radio->setMinimumSize(radio->sizeHint());
1278  mFeb29->addButton(radio, Preferences::Feb29_Mar1);
1279  radio = new QRadioButton(i18nc("@option:radio", "Do not repeat"), itemBox);
1280  radio->setMinimumSize(radio->sizeHint());
1281  mFeb29->addButton(radio, Preferences::Feb29_None);
1282  itemBox->setFixedHeight(itemBox->sizeHint().height());
1283  vbox->setWhatsThis(i18nc("@info:whatsthis",
1284  "For yearly recurrences, choose what date, if any, alarms due on February 29th should occur in non-leap years."
1285  "<note>The next scheduled occurrence of existing alarms is not re-evaluated when you change this setting.</note>"));
1286 
1287  QVBoxLayout* lay = qobject_cast<QVBoxLayout*>(topGeneral->layout());
1288  if (lay)
1289  lay->addStretch(); // top adjust the widgets
1290 
1291  // DISPLAY ALARMS
1292  QGroupBox* group = new QGroupBox(i18nc("@title:group", "Display Alarms"), topTypes);
1293  QVBoxLayout* vlayout = new QVBoxLayout(group);
1294  vlayout->setMargin(KDialog::marginHint());
1295  vlayout->setSpacing(KDialog::spacingHint());
1296 
1297  mConfirmAck = new QCheckBox(EditDisplayAlarmDlg::i18n_chk_ConfirmAck(), group);
1298  mConfirmAck->setMinimumSize(mConfirmAck->sizeHint());
1299  mConfirmAck->setWhatsThis(defsetting.subs(EditDisplayAlarmDlg::i18n_chk_ConfirmAck()).toString());
1300  vlayout->addWidget(mConfirmAck, 0, Qt::AlignLeft);
1301 
1302  mAutoClose = new QCheckBox(LateCancelSelector::i18n_chk_AutoCloseWinLC(), group);
1303  mAutoClose->setMinimumSize(mAutoClose->sizeHint());
1304  mAutoClose->setWhatsThis(defsetting.subs(LateCancelSelector::i18n_chk_AutoCloseWin()).toString());
1305  vlayout->addWidget(mAutoClose, 0, Qt::AlignLeft);
1306 
1307  box = new KHBox(group);
1308 // box->setMargin(0);
1309  box->setSpacing(KDialog::spacingHint());
1310  vlayout->addWidget(box);
1311  label = new QLabel(i18nc("@label:listbox", "Reminder units:"), box);
1312  mReminderUnits = new KComboBox(box);
1313  mReminderUnits->addItem(i18nc("@item:inlistbox", "Minutes"), TimePeriod::Minutes);
1314  mReminderUnits->addItem(i18nc("@item:inlistbox", "Hours/Minutes"), TimePeriod::HoursMinutes);
1315  mReminderUnits->setFixedSize(mReminderUnits->sizeHint());
1316  label->setBuddy(mReminderUnits);
1317  box->setWhatsThis(i18nc("@info:whatsthis", "The default units for the reminder in the alarm edit dialog, for alarms due soon."));
1318  box->setStretchFactor(new QWidget(box), 1); // left adjust the control
1319 
1320  mSpecialActionsButton = new SpecialActionsButton(true, box);
1321  mSpecialActionsButton->setFixedSize(mSpecialActionsButton->sizeHint());
1322 
1323  // SOUND
1324  QGroupBox* bbox = new QGroupBox(i18nc("@title:group Audio options group", "Sound"), topTypes);
1325  vlayout = new QVBoxLayout(bbox);
1326  vlayout->setMargin(KDialog::marginHint());
1327  vlayout->setSpacing(KDialog::spacingHint());
1328 
1329  hlayout = new QHBoxLayout();
1330  hlayout->setMargin(0);
1331  vlayout->addLayout(hlayout);
1332  mSound = new KComboBox(bbox);
1333  mSound->addItem(SoundPicker::i18n_combo_None()); // index 0
1334  mSound->addItem(SoundPicker::i18n_combo_Beep()); // index 1
1335  mSound->addItem(SoundPicker::i18n_combo_File()); // index 2
1336  if (theApp()->speechEnabled())
1337  mSound->addItem(SoundPicker::i18n_combo_Speak()); // index 3
1338  mSound->setMinimumSize(mSound->sizeHint());
1339  mSound->setWhatsThis(defsetting.subs(SoundPicker::i18n_label_Sound()).toString());
1340  hlayout->addWidget(mSound);
1341  hlayout->addStretch();
1342 
1343  mSoundRepeat = new QCheckBox(i18nc("@option:check", "Repeat sound file"), bbox);
1344  mSoundRepeat->setMinimumSize(mSoundRepeat->sizeHint());
1345  mSoundRepeat->setWhatsThis(
1346  i18nc("@info:whatsthis sound file 'Repeat' checkbox", "The default setting for sound file <interface>%1</interface> in the alarm edit dialog.", SoundWidget::i18n_chk_Repeat()));
1347  hlayout->addWidget(mSoundRepeat);
1348 
1349  box = new KHBox(bbox); // this is to control the QWhatsThis text display area
1350  box->setMargin(0);
1351  box->setSpacing(KDialog::spacingHint());
1352  mSoundFileLabel = new QLabel(i18nc("@label:textbox", "Sound file:"), box);
1353  mSoundFile = new KLineEdit(box);
1354  mSoundFileLabel->setBuddy(mSoundFile);
1355  mSoundFileBrowse = new QPushButton(box);
1356  mSoundFileBrowse->setIcon(KIcon(SmallIcon(QLatin1String("document-open"))));
1357  int size = mSoundFileBrowse->sizeHint().height();
1358  mSoundFileBrowse->setFixedSize(size, size);
1359  connect(mSoundFileBrowse, SIGNAL(clicked()), SLOT(slotBrowseSoundFile()));
1360  mSoundFileBrowse->setToolTip(i18nc("@info:tooltip", "Choose a sound file"));
1361  box->setWhatsThis(i18nc("@info:whatsthis", "Enter the default sound file to use in the alarm edit dialog."));
1362  box->setFixedHeight(box->sizeHint().height());
1363  vlayout->addWidget(box);
1364  bbox->setFixedHeight(bbox->sizeHint().height());
1365 
1366  // COMMAND ALARMS
1367  group = new QGroupBox(i18nc("@title:group", "Command Alarms"), topTypes);
1368  vlayout = new QVBoxLayout(group);
1369  vlayout->setMargin(KDialog::marginHint());
1370  vlayout->setSpacing(KDialog::spacingHint());
1371  hlayout = new QHBoxLayout();
1372  hlayout->setMargin(0);
1373  vlayout->addLayout(hlayout);
1374 
1375  mCmdScript = new QCheckBox(EditCommandAlarmDlg::i18n_chk_EnterScript(), group);
1376  mCmdScript->setMinimumSize(mCmdScript->sizeHint());
1377  mCmdScript->setWhatsThis(defsetting.subs(EditCommandAlarmDlg::i18n_chk_EnterScript()).toString());
1378  hlayout->addWidget(mCmdScript);
1379  hlayout->addStretch();
1380 
1381  mCmdXterm = new QCheckBox(EditCommandAlarmDlg::i18n_chk_ExecInTermWindow(), group);
1382  mCmdXterm->setMinimumSize(mCmdXterm->sizeHint());
1383  mCmdXterm->setWhatsThis(defsetting.subs(EditCommandAlarmDlg::i18n_radio_ExecInTermWindow()).toString());
1384  hlayout->addWidget(mCmdXterm);
1385 
1386  // EMAIL ALARMS
1387  group = new QGroupBox(i18nc("@title:group", "Email Alarms"), topTypes);
1388  vlayout = new QVBoxLayout(group);
1389  vlayout->setMargin(KDialog::marginHint());
1390  vlayout->setSpacing(KDialog::spacingHint());
1391 
1392  // BCC email to sender
1393  mEmailBcc = new QCheckBox(EditEmailAlarmDlg::i18n_chk_CopyEmailToSelf(), group);
1394  mEmailBcc->setMinimumSize(mEmailBcc->sizeHint());
1395  mEmailBcc->setWhatsThis(defsetting.subs(EditEmailAlarmDlg::i18n_chk_CopyEmailToSelf()).toString());
1396  vlayout->addWidget(mEmailBcc, 0, Qt::AlignLeft);
1397 
1398  lay = qobject_cast<QVBoxLayout*>(topTypes->layout());
1399  if (lay)
1400  lay->addStretch(); // top adjust the widgets
1401 
1402  // FONT / COLOUR TAB
1403  mFontChooser = new FontColourChooser(topFontColour, QStringList(), i18nc("@title:group", "Message Font && Color"), true);
1404 }
1405 
1406 void EditPrefTab::restore(bool, bool allTabs)
1407 {
1408  int index;
1409  if (allTabs || mTabs->currentIndex() == mTabGeneral)
1410  {
1411  mCopyToKOrganizer->setChecked(Preferences::defaultCopyToKOrganizer());
1412  mLateCancel->setChecked(Preferences::defaultLateCancel());
1413  switch (Preferences::defaultRecurPeriod())
1414  {
1415  case Preferences::Recur_Yearly: index = 6; break;
1416  case Preferences::Recur_Monthly: index = 5; break;
1417  case Preferences::Recur_Weekly: index = 4; break;
1418  case Preferences::Recur_Daily: index = 3; break;
1419  case Preferences::Recur_SubDaily: index = 2; break;
1420  case Preferences::Recur_Login: index = 1; break;
1421  case Preferences::Recur_None:
1422  default: index = 0; break;
1423  }
1424  mRecurPeriod->setCurrentIndex(index);
1425  mFeb29->setButton(Preferences::defaultFeb29Type());
1426  }
1427  if (allTabs || mTabs->currentIndex() == mTabTypes)
1428  {
1429  mConfirmAck->setChecked(Preferences::defaultConfirmAck());
1430  mAutoClose->setChecked(Preferences::defaultAutoClose());
1431  switch (Preferences::defaultReminderUnits())
1432  {
1433  case TimePeriod::Weeks: index = 3; break;
1434  case TimePeriod::Days: index = 2; break;
1435  default:
1436  case TimePeriod::HoursMinutes: index = 1; break;
1437  case TimePeriod::Minutes: index = 0; break;
1438  }
1439  mReminderUnits->setCurrentIndex(index);
1440  KAEvent::ExtraActionOptions opts(0);
1441  if (Preferences::defaultExecPreActionOnDeferral())
1442  opts |= KAEvent::ExecPreActOnDeferral;
1443  if (Preferences::defaultCancelOnPreActionError())
1444  opts |= KAEvent::CancelOnPreActError;
1445  if (Preferences::defaultDontShowPreActionError())
1446  opts |= KAEvent::DontShowPreActError;
1447  mSpecialActionsButton->setActions(Preferences::defaultPreAction(), Preferences::defaultPostAction(), opts);
1448  mSound->setCurrentIndex(soundIndex(Preferences::defaultSoundType()));
1449  mSoundFile->setText(Preferences::defaultSoundFile());
1450  mSoundRepeat->setChecked(Preferences::defaultSoundRepeat());
1451  mCmdScript->setChecked(Preferences::defaultCmdScript());
1452  mCmdXterm->setChecked(Preferences::defaultCmdLogType() == Preferences::Log_Terminal);
1453  mEmailBcc->setChecked(Preferences::defaultEmailBcc());
1454  }
1455  if (allTabs || mTabs->currentIndex() == mTabFontColour)
1456  {
1457  mFontChooser->setFgColour(Preferences::defaultFgColour());
1458  mFontChooser->setBgColour(Preferences::defaultBgColour());
1459  mFontChooser->setFont(Preferences::messageFont());
1460  }
1461 }
1462 
1463 void EditPrefTab::apply(bool syncToDisc)
1464 {
1465  bool b = mAutoClose->isChecked();
1466  if (b != Preferences::defaultAutoClose())
1467  Preferences::setDefaultAutoClose(b);
1468  b = mConfirmAck->isChecked();
1469  if (b != Preferences::defaultConfirmAck())
1470  Preferences::setDefaultConfirmAck(b);
1471  TimePeriod::Units units;
1472  switch (mReminderUnits->currentIndex())
1473  {
1474  case 3: units = TimePeriod::Weeks; break;
1475  case 2: units = TimePeriod::Days; break;
1476  default:
1477  case 1: units = TimePeriod::HoursMinutes; break;
1478  case 0: units = TimePeriod::Minutes; break;
1479  }
1480  if (units != Preferences::defaultReminderUnits())
1481  Preferences::setDefaultReminderUnits(units);
1482  QString text = mSpecialActionsButton->preAction();
1483  if (text != Preferences::defaultPreAction())
1484  Preferences::setDefaultPreAction(text);
1485  text = mSpecialActionsButton->postAction();
1486  if (text != Preferences::defaultPostAction())
1487  Preferences::setDefaultPostAction(text);
1488  KAEvent::ExtraActionOptions opts = mSpecialActionsButton->options();
1489  b = opts & KAEvent::ExecPreActOnDeferral;
1490  if (b != Preferences::defaultExecPreActionOnDeferral())
1491  Preferences::setDefaultExecPreActionOnDeferral(b);
1492  b = opts & KAEvent::CancelOnPreActError;
1493  if (b != Preferences::defaultCancelOnPreActionError())
1494  Preferences::setDefaultCancelOnPreActionError(b);
1495  b = opts & KAEvent::DontShowPreActError;
1496  if (b != Preferences::defaultDontShowPreActionError())
1497  Preferences::setDefaultDontShowPreActionError(b);
1498  Preferences::SoundType snd;
1499  switch (mSound->currentIndex())
1500  {
1501  case 3: snd = Preferences::Sound_Speak; break;
1502  case 2: snd = Preferences::Sound_File; break;
1503  case 1: snd = Preferences::Sound_Beep; break;
1504  case 0:
1505  default: snd = Preferences::Sound_None; break;
1506  }
1507  if (snd != Preferences::defaultSoundType())
1508  Preferences::setDefaultSoundType(snd);
1509  text = mSoundFile->text();
1510  if (text != Preferences::defaultSoundFile())
1511  Preferences::setDefaultSoundFile(text);
1512  b = mSoundRepeat->isChecked();
1513  if (b != Preferences::defaultSoundRepeat())
1514  Preferences::setDefaultSoundRepeat(b);
1515  b = mCmdScript->isChecked();
1516  if (b != Preferences::defaultCmdScript())
1517  Preferences::setDefaultCmdScript(b);
1518  Preferences::CmdLogType log = mCmdXterm->isChecked() ? Preferences::Log_Terminal : Preferences::Log_Discard;
1519  if (log != Preferences::defaultCmdLogType())
1520  Preferences::setDefaultCmdLogType(log);
1521  b = mEmailBcc->isChecked();
1522  if (b != Preferences::defaultEmailBcc())
1523  Preferences::setDefaultEmailBcc(b);
1524  b = mCopyToKOrganizer->isChecked();
1525  if (b != Preferences::defaultCopyToKOrganizer())
1526  Preferences::setDefaultCopyToKOrganizer(b);
1527  int i = mLateCancel->isChecked() ? 1 : 0;
1528  if (i != Preferences::defaultLateCancel())
1529  Preferences::setDefaultLateCancel(i);
1530  Preferences::RecurType period;
1531  switch (mRecurPeriod->currentIndex())
1532  {
1533  case 6: period = Preferences::Recur_Yearly; break;
1534  case 5: period = Preferences::Recur_Monthly; break;
1535  case 4: period = Preferences::Recur_Weekly; break;
1536  case 3: period = Preferences::Recur_Daily; break;
1537  case 2: period = Preferences::Recur_SubDaily; break;
1538  case 1: period = Preferences::Recur_Login; break;
1539  case 0:
1540  default: period = Preferences::Recur_None; break;
1541  }
1542  if (period != Preferences::defaultRecurPeriod())
1543  Preferences::setDefaultRecurPeriod(period);
1544  int feb29 = mFeb29->selectedId();
1545  if (feb29 >= 0 && static_cast<Preferences::Feb29Type>(feb29) != Preferences::defaultFeb29Type())
1546  Preferences::setDefaultFeb29Type(static_cast<Preferences::Feb29Type>(feb29));
1547  QColor colour = mFontChooser->fgColour();
1548  if (colour != Preferences::defaultFgColour())
1549  Preferences::setDefaultFgColour(colour);
1550  colour = mFontChooser->bgColour();
1551  if (colour != Preferences::defaultBgColour())
1552  Preferences::setDefaultBgColour(colour);
1553  QFont font = mFontChooser->font();
1554  if (font != Preferences::messageFont())
1555  Preferences::setMessageFont(font);
1556  PrefsTabBase::apply(syncToDisc);
1557 }
1558 
1559 void EditPrefTab::slotBrowseSoundFile()
1560 {
1561  QString defaultDir;
1562  QString url = SoundPicker::browseFile(defaultDir, mSoundFile->text());
1563  if (!url.isEmpty())
1564  mSoundFile->setText(url);
1565 }
1566 
1567 int EditPrefTab::soundIndex(Preferences::SoundType type)
1568 {
1569  switch (type)
1570  {
1571  case Preferences::Sound_Speak: return 3;
1572  case Preferences::Sound_File: return 2;
1573  case Preferences::Sound_Beep: return 1;
1574  case Preferences::Sound_None:
1575  default: return 0;
1576  }
1577 }
1578 
1579 QString EditPrefTab::validate()
1580 {
1581  if (mSound->currentIndex() == soundIndex(Preferences::Sound_File) && mSoundFile->text().isEmpty())
1582  {
1583  mSoundFile->setFocus();
1584  return i18nc("@info", "You must enter a sound file when <interface>%1</interface> is selected as the default sound type", SoundPicker::i18n_combo_File());;
1585  }
1586  return QString();
1587 }
1588 
1589 
1590 /*=============================================================================
1591 = Class ViewPrefTab
1592 =============================================================================*/
1593 
1594 ViewPrefTab::ViewPrefTab(StackedScrollGroup* scrollGroup)
1595  : PrefsTabBase(scrollGroup)
1596 {
1597  mTabs = new KTabWidget(topWidget());
1598  KVBox* topGeneral = new KVBox();
1599  topGeneral->setMargin(KDialog::marginHint()/2);
1600  topGeneral->setSpacing(KDialog::spacingHint());
1601  mTabGeneral = mTabs->addTab(topGeneral, i18nc("@title:tab", "General"));
1602  KVBox* topWindows = new KVBox();
1603  topWindows->setMargin(KDialog::marginHint()/2);
1604  topWindows->setSpacing(KDialog::spacingHint());
1605  mTabWindows = mTabs->addTab(topWindows, i18nc("@title:tab", "Alarm Windows"));
1606 
1607  // Run-in-system-tray group box
1608  mShowInSystemTray = new QGroupBox(i18nc("@option:check", "Show in system tray"), topGeneral);
1609  mShowInSystemTray->setCheckable(true);
1610  mShowInSystemTray->setWhatsThis(
1611  i18nc("@info:whatsthis", "<para>Check to show <application>KAlarm</application>'s icon in the system tray."
1612  " Showing it in the system tray provides easy access and a status indication.</para>"));
1613  QGridLayout* grid = new QGridLayout(mShowInSystemTray);
1614  grid->setMargin(KDialog::marginHint());
1615  grid->setSpacing(KDialog::spacingHint());
1616  grid->setColumnStretch(1, 1);
1617  grid->setColumnMinimumWidth(0, indentWidth());
1618 
1619  mAutoHideSystemTray = new ButtonGroup(mShowInSystemTray);
1620  connect(mAutoHideSystemTray, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotAutoHideSysTrayChanged(QAbstractButton*)));
1621 
1622  QRadioButton* radio = new QRadioButton(i18nc("@option:radio Always show KAlarm icon", "Always show"), mShowInSystemTray);
1623  mAutoHideSystemTray->addButton(radio, 0);
1624  radio->setWhatsThis(
1625  i18nc("@info:whatsthis",
1626  "Check to show <application>KAlarm</application>'s icon in the system tray "
1627  "regardless of whether alarms are due."));
1628  grid->addWidget(radio, 0, 0, 1, 2, Qt::AlignLeft);
1629 
1630  radio = new QRadioButton(i18nc("@option:radio", "Automatically hide if no active alarms"), mShowInSystemTray);
1631  mAutoHideSystemTray->addButton(radio, 1);
1632  radio->setWhatsThis(
1633  i18nc("@info:whatsthis",
1634  "Check to automatically hide <application>KAlarm</application>'s icon in "
1635  "the system tray if there are no active alarms. When hidden, the icon can "
1636  "always be made visible by use of the system tray option to show hidden icons."));
1637  grid->addWidget(radio, 1, 0, 1, 2, Qt::AlignLeft);
1638 
1639  QString text = i18nc("@info:whatsthis",
1640  "Check to automatically hide <application>KAlarm</application>'s icon in the "
1641  "system tray if no alarms are due within the specified time period. When hidden, "
1642  "the icon can always be made visible by use of the system tray option to show hidden icons.");
1643  radio = new QRadioButton(i18nc("@option:radio", "Automatically hide if no alarm due within time period:"), mShowInSystemTray);
1644  radio->setWhatsThis(text);
1645  mAutoHideSystemTray->addButton(radio, 2);
1646  grid->addWidget(radio, 2, 0, 1, 2, Qt::AlignLeft);
1647  mAutoHideSystemTrayPeriod = new TimePeriod(true, mShowInSystemTray);
1648  mAutoHideSystemTrayPeriod->setWhatsThis(text);
1649  mAutoHideSystemTrayPeriod->setMaximumWidth(mAutoHideSystemTrayPeriod->sizeHint().width());
1650  grid->addWidget(mAutoHideSystemTrayPeriod, 3, 1, 1, 1, Qt::AlignLeft);
1651  mShowInSystemTray->setMaximumHeight(mShowInSystemTray->sizeHint().height());
1652 
1653  // System tray tooltip group box
1654  QGroupBox* group = new QGroupBox(i18nc("@title:group", "System Tray Tooltip"), topGeneral);
1655  grid = new QGridLayout(group);
1656  grid->setMargin(KDialog::marginHint());
1657  grid->setSpacing(KDialog::spacingHint());
1658  grid->setColumnStretch(2, 1);
1659  grid->setColumnMinimumWidth(0, indentWidth());
1660  grid->setColumnMinimumWidth(1, indentWidth());
1661 
1662  mTooltipShowAlarms = new QCheckBox(i18nc("@option:check", "Show next &24 hours' alarms"), group);
1663  mTooltipShowAlarms->setMinimumSize(mTooltipShowAlarms->sizeHint());
1664  connect(mTooltipShowAlarms, SIGNAL(toggled(bool)), SLOT(slotTooltipAlarmsToggled(bool)));
1665  mTooltipShowAlarms->setWhatsThis(
1666  i18nc("@info:whatsthis", "Specify whether to include in the system tray tooltip, a summary of alarms due in the next 24 hours."));
1667  grid->addWidget(mTooltipShowAlarms, 0, 0, 1, 3, Qt::AlignLeft);
1668 
1669  KHBox* box = new KHBox(group);
1670  box->setMargin(0);
1671  box->setSpacing(KDialog::spacingHint());
1672  mTooltipMaxAlarms = new QCheckBox(i18nc("@option:check", "Maximum number of alarms to show:"), box);
1673  mTooltipMaxAlarms->setMinimumSize(mTooltipMaxAlarms->sizeHint());
1674  connect(mTooltipMaxAlarms, SIGNAL(toggled(bool)), SLOT(slotTooltipMaxToggled(bool)));
1675  mTooltipMaxAlarmCount = new SpinBox(1, 99, box);
1676  mTooltipMaxAlarmCount->setSingleShiftStep(5);
1677  mTooltipMaxAlarmCount->setMinimumSize(mTooltipMaxAlarmCount->sizeHint());
1678  box->setWhatsThis(
1679  i18nc("@info:whatsthis", "Uncheck to display all of the next 24 hours' alarms in the system tray tooltip. "
1680  "Check to enter an upper limit on the number to be displayed."));
1681  grid->addWidget(box, 1, 1, 1, 2, Qt::AlignLeft);
1682 
1683  mTooltipShowTime = new QCheckBox(MainWindow::i18n_chk_ShowAlarmTime(), group);
1684  mTooltipShowTime->setMinimumSize(mTooltipShowTime->sizeHint());
1685  connect(mTooltipShowTime, SIGNAL(toggled(bool)), SLOT(slotTooltipTimeToggled(bool)));
1686  mTooltipShowTime->setWhatsThis(i18nc("@info:whatsthis", "Specify whether to show in the system tray tooltip, the time at which each alarm is due."));
1687  grid->addWidget(mTooltipShowTime, 2, 1, 1, 2, Qt::AlignLeft);
1688 
1689  mTooltipShowTimeTo = new QCheckBox(MainWindow::i18n_chk_ShowTimeToAlarm(), group);
1690  mTooltipShowTimeTo->setMinimumSize(mTooltipShowTimeTo->sizeHint());
1691  connect(mTooltipShowTimeTo, SIGNAL(toggled(bool)), SLOT(slotTooltipTimeToToggled(bool)));
1692  mTooltipShowTimeTo->setWhatsThis(i18nc("@info:whatsthis", "Specify whether to show in the system tray tooltip, how long until each alarm is due."));
1693  grid->addWidget(mTooltipShowTimeTo, 3, 1, 1, 2, Qt::AlignLeft);
1694 
1695  box = new KHBox(group); // this is to control the QWhatsThis text display area
1696  box->setMargin(0);
1697  box->setSpacing(KDialog::spacingHint());
1698  mTooltipTimeToPrefixLabel = new QLabel(i18nc("@label:textbox", "Prefix:"), box);
1699  mTooltipTimeToPrefix = new KLineEdit(box);
1700  mTooltipTimeToPrefixLabel->setBuddy(mTooltipTimeToPrefix);
1701  box->setWhatsThis(i18nc("@info:whatsthis", "Enter the text to be displayed in front of the time until the alarm, in the system tray tooltip."));
1702  box->setFixedHeight(box->sizeHint().height());
1703  grid->addWidget(box, 4, 2, Qt::AlignLeft);
1704  group->setMaximumHeight(group->sizeHint().height());
1705 
1706  group = new QGroupBox(i18nc("@title:group", "Alarm List"), topGeneral);
1707  QHBoxLayout* hlayout = new QHBoxLayout(group);
1708  hlayout->setMargin(KDialog::marginHint());
1709  QVBoxLayout* colourLayout = new QVBoxLayout();
1710  colourLayout->setMargin(0);
1711  hlayout->addLayout(colourLayout);
1712 
1713  box = new KHBox(group); // to group widgets for QWhatsThis text
1714  box->setMargin(0);
1715  box->setSpacing(KDialog::spacingHint()/2);
1716  colourLayout->addWidget(box);
1717  QLabel* label1 = new QLabel(i18nc("@label:listbox", "Disabled alarm color:"), box);
1718  box->setStretchFactor(new QWidget(box), 0);
1719  mDisabledColour = new ColourButton(box);
1720  label1->setBuddy(mDisabledColour);
1721  box->setWhatsThis(i18nc("@info:whatsthis", "Choose the text color in the alarm list for disabled alarms."));
1722 
1723  box = new KHBox(group); // to group widgets for QWhatsThis text
1724  box->setMargin(0);
1725  box->setSpacing(KDialog::spacingHint()/2);
1726  colourLayout->addWidget(box);
1727  QLabel* label2 = new QLabel(i18nc("@label:listbox", "Archived alarm color:"), box);
1728  box->setStretchFactor(new QWidget(box), 0);
1729  mArchivedColour = new ColourButton(box);
1730  label2->setBuddy(mArchivedColour);
1731  box->setWhatsThis(i18nc("@info:whatsthis", "Choose the text color in the alarm list for archived alarms."));
1732  hlayout->addStretch();
1733 
1734  QVBoxLayout* lay = qobject_cast<QVBoxLayout*>(topGeneral->layout());
1735  if (lay)
1736  lay->addStretch(); // top adjust the widgets
1737 
1738  group = new QGroupBox(i18nc("@title:group", "Alarm Message Windows"), topWindows);
1739  grid = new QGridLayout(group);
1740  grid->setMargin(KDialog::marginHint());
1741  grid->setSpacing(KDialog::spacingHint());
1742  grid->setColumnStretch(1, 1);
1743  grid->setColumnMinimumWidth(0, indentWidth());
1744  mWindowPosition = new ButtonGroup(group);
1745  connect(mWindowPosition, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotWindowPosChanged(QAbstractButton*)));
1746 
1747  QString whatsthis = i18nc("@info:whatsthis",
1748  "<para>Choose how to reduce the chance of alarm messages being accidentally acknowledged:"
1749  "<list><item>Position alarm message windows as far as possible from the current mouse cursor location, or</item>"
1750  "<item>Position alarm message windows in the center of the screen, but disable buttons for a short time after the window is displayed.</item></list></para>");
1751  radio = new QRadioButton(i18nc("@option:radio", "Position windows far from mouse cursor"), group);
1752  mWindowPosition->addButton(radio, 0);
1753  radio->setWhatsThis(whatsthis);
1754  grid->addWidget(radio, 0, 0, 1, 2, Qt::AlignLeft);
1755  radio = new QRadioButton(i18nc("@option:radio", "Center windows, delay activating window buttons"), group);
1756  mWindowPosition->addButton(radio, 1);
1757  radio->setWhatsThis(whatsthis);
1758  grid->addWidget(radio, 1, 0, 1, 2, Qt::AlignLeft);
1759 
1760  KHBox* itemBox = new KHBox(group);
1761  itemBox->setMargin(0);
1762  box = new KHBox(itemBox); // this is to control the QWhatsThis text display area
1763  box->setMargin(0);
1764  box->setSpacing(KDialog::spacingHint());
1765  mWindowButtonDelayLabel = new QLabel(i18nc("@label:spinbox", "Button activation delay (seconds):"), box);
1766  mWindowButtonDelay = new QSpinBox(box);
1767  mWindowButtonDelay->setRange(1, 10);
1768  mWindowButtonDelayLabel->setBuddy(mWindowButtonDelay);
1769  box->setWhatsThis(i18nc("@info:whatsthis",
1770  "Enter how long its buttons should remain disabled after the alarm message window is shown."));
1771  itemBox->setStretchFactor(new QWidget(itemBox), 1); // left adjust the controls
1772  grid->addWidget(itemBox, 2, 1, Qt::AlignLeft);
1773 
1774  grid->setRowMinimumHeight(3, KDialog::spacingHint());
1775 
1776  mModalMessages = new QCheckBox(i18nc("@option:check", "Message windows have a title bar and take keyboard focus"), group);
1777  mModalMessages->setMinimumSize(mModalMessages->sizeHint());
1778  mModalMessages->setWhatsThis(i18nc("@info:whatsthis",
1779  "<para>Specify the characteristics of alarm message windows:"
1780  "<list><item>If checked, the window is a normal window with a title bar, which grabs keyboard input when it is displayed.</item>"
1781  "<item>If unchecked, the window does not interfere with your typing when "
1782  "it is displayed, but it has no title bar and cannot be moved or resized.</item></list></para>"));
1783  grid->addWidget(mModalMessages, 4, 0, 1, 2, Qt::AlignLeft);
1784 
1785  lay = qobject_cast<QVBoxLayout*>(topWindows->layout());
1786  if (lay)
1787  lay->addStretch(); // top adjust the widgets
1788 }
1789 
1790 void ViewPrefTab::restore(bool, bool allTabs)
1791 {
1792  if (allTabs || mTabs->currentIndex() == mTabGeneral)
1793  {
1794  mShowInSystemTray->setChecked(Preferences::showInSystemTray());
1795  int id;
1796  int mins = Preferences::autoHideSystemTray();
1797  switch (mins)
1798  {
1799  case -1: id = 1; break; // hide if no active alarms
1800  case 0: id = 0; break; // never hide
1801  default:
1802  {
1803  id = 2;
1804  int days = 0;
1805  int secs = 0;
1806  if (mins % 1440)
1807  secs = mins * 60;
1808  else
1809  days = mins / 1440;
1810  TimePeriod::Units units = secs ? TimePeriod::HoursMinutes
1811  : (days % 7) ? TimePeriod::Days : TimePeriod::Weeks;
1812  Duration duration((secs ? secs : days), (secs ? Duration::Seconds : Duration::Days));
1813  mAutoHideSystemTrayPeriod->setPeriod(duration, false, units);
1814  break;
1815  }
1816  }
1817  mAutoHideSystemTray->setButton(id);
1818  setTooltip(Preferences::tooltipAlarmCount(),
1819  Preferences::showTooltipAlarmTime(),
1820  Preferences::showTooltipTimeToAlarm(),
1821  Preferences::tooltipTimeToPrefix());
1822  mDisabledColour->setColor(Preferences::disabledColour());
1823  mArchivedColour->setColor(Preferences::archivedColour());
1824  }
1825  if (allTabs || mTabs->currentIndex() == mTabWindows)
1826  {
1827  mWindowPosition->setButton(Preferences::messageButtonDelay() ? 1 : 0);
1828  mWindowButtonDelay->setValue(Preferences::messageButtonDelay());
1829  mModalMessages->setChecked(Preferences::modalMessages());
1830  }
1831 }
1832 
1833 void ViewPrefTab::apply(bool syncToDisc)
1834 {
1835  QColor colour = mDisabledColour->color();
1836  if (colour != Preferences::disabledColour())
1837  Preferences::setDisabledColour(colour);
1838  colour = mArchivedColour->color();
1839  if (colour != Preferences::archivedColour())
1840  Preferences::setArchivedColour(colour);
1841  int n = mTooltipShowAlarms->isChecked() ? -1 : 0;
1842  if (n && mTooltipMaxAlarms->isChecked())
1843  n = mTooltipMaxAlarmCount->value();
1844  if (n != Preferences::tooltipAlarmCount())
1845  Preferences::setTooltipAlarmCount(n);
1846  bool b = mTooltipShowTime->isChecked();
1847  if (b != Preferences::showTooltipAlarmTime())
1848  Preferences::setShowTooltipAlarmTime(b);
1849  b = mTooltipShowTimeTo->isChecked();
1850  if (b != Preferences::showTooltipTimeToAlarm())
1851  Preferences::setShowTooltipTimeToAlarm(b);
1852  QString text = mTooltipTimeToPrefix->text();
1853  if (text != Preferences::tooltipTimeToPrefix())
1854  Preferences::setTooltipTimeToPrefix(text);
1855  b = mShowInSystemTray->isChecked();
1856  if (b != Preferences::showInSystemTray())
1857  Preferences::setShowInSystemTray(b);
1858  if (b)
1859  {
1860  switch (mAutoHideSystemTray->selectedId())
1861  {
1862  case 0: n = 0; break; // never hide
1863  case 1: n = -1; break; // hide if no active alarms
1864  case 2: // hide if no alarms due within period
1865  n = mAutoHideSystemTrayPeriod->period().asSeconds() / 60;
1866  break;
1867  }
1868  if (n != Preferences::autoHideSystemTray())
1869  Preferences::setAutoHideSystemTray(n);
1870  }
1871  n = mWindowPosition->selectedId();
1872  if (n)
1873  n = mWindowButtonDelay->value();
1874  if (n != Preferences::messageButtonDelay())
1875  Preferences::setMessageButtonDelay(n);
1876  b = mModalMessages->isChecked();
1877  if (b != Preferences::modalMessages())
1878  Preferences::setModalMessages(b);
1879  PrefsTabBase::apply(syncToDisc);
1880 }
1881 
1882 void ViewPrefTab::setTooltip(int maxAlarms, bool time, bool timeTo, const QString& prefix)
1883 {
1884  if (!timeTo)
1885  time = true; // ensure that at least one time option is ticked
1886 
1887  // Set the states of the controls without calling signal
1888  // handlers, since these could change the checkboxes' states.
1889  mTooltipShowAlarms->blockSignals(true);
1890  mTooltipShowTime->blockSignals(true);
1891  mTooltipShowTimeTo->blockSignals(true);
1892 
1893  mTooltipShowAlarms->setChecked(maxAlarms);
1894  mTooltipMaxAlarms->setChecked(maxAlarms > 0);
1895  mTooltipMaxAlarmCount->setValue(maxAlarms > 0 ? maxAlarms : 1);
1896  mTooltipShowTime->setChecked(time);
1897  mTooltipShowTimeTo->setChecked(timeTo);
1898  mTooltipTimeToPrefix->setText(prefix);
1899 
1900  mTooltipShowAlarms->blockSignals(false);
1901  mTooltipShowTime->blockSignals(false);
1902  mTooltipShowTimeTo->blockSignals(false);
1903 
1904  // Enable/disable controls according to their states
1905  slotTooltipTimeToToggled(timeTo);
1906  slotTooltipAlarmsToggled(maxAlarms);
1907 }
1908 
1909 void ViewPrefTab::slotTooltipAlarmsToggled(bool on)
1910 {
1911  mTooltipMaxAlarms->setEnabled(on);
1912  mTooltipMaxAlarmCount->setEnabled(on && mTooltipMaxAlarms->isChecked());
1913  mTooltipShowTime->setEnabled(on);
1914  mTooltipShowTimeTo->setEnabled(on);
1915  on = on && mTooltipShowTimeTo->isChecked();
1916  mTooltipTimeToPrefix->setEnabled(on);
1917  mTooltipTimeToPrefixLabel->setEnabled(on);
1918 }
1919 
1920 void ViewPrefTab::slotTooltipMaxToggled(bool on)
1921 {
1922  mTooltipMaxAlarmCount->setEnabled(on && mTooltipMaxAlarms->isEnabled());
1923 }
1924 
1925 void ViewPrefTab::slotTooltipTimeToggled(bool on)
1926 {
1927  if (!on && !mTooltipShowTimeTo->isChecked())
1928  mTooltipShowTimeTo->setChecked(true);
1929 }
1930 
1931 void ViewPrefTab::slotTooltipTimeToToggled(bool on)
1932 {
1933  if (!on && !mTooltipShowTime->isChecked())
1934  mTooltipShowTime->setChecked(true);
1935  on = on && mTooltipShowTimeTo->isEnabled();
1936  mTooltipTimeToPrefix->setEnabled(on);
1937  mTooltipTimeToPrefixLabel->setEnabled(on);
1938 }
1939 
1940 void ViewPrefTab::slotAutoHideSysTrayChanged(QAbstractButton* button)
1941 {
1942  mAutoHideSystemTrayPeriod->setEnabled(mAutoHideSystemTray->id(button) == 2);
1943 }
1944 
1945 void ViewPrefTab::slotWindowPosChanged(QAbstractButton* button)
1946 {
1947  bool enable = mWindowPosition->id(button);
1948  mWindowButtonDelay->setEnabled(enable);
1949  mWindowButtonDelayLabel->setEnabled(enable);
1950 }
1951 
1952 // vim: et sw=4:
PreferencesBase::Feb29_Feb28
Definition: kalarmconfig.h:25
PreferencesBase::defaultDeferTime
static int defaultDeferTime()
Get Default defer time interval.
Definition: kalarmconfig.h:367
PrefsTabBase::addAlignedLabel
void addAlignedLabel(QLabel *)
Definition: prefdlg.cpp:381
PreferencesBase::setMessageFont
static void setMessageFont(const QFont &v)
Set Message font.
Definition: kalarmconfig.h:216
PreferencesBase::defaultCmdLogType
static CmdLogType defaultCmdLogType()
Get Command output.
Definition: kalarmconfig.h:1267
Preferences::setEmailAddress
static void setEmailAddress(MailFrom, const QString &address)
Definition: preferences.cpp:237
KAMessageBox::questionYesNoCancel
static int questionYesNoCancel(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|WindowModal))
PreferencesBase::setDefaultCmdScript
static void setDefaultCmdScript(bool v)
Set Enter script.
Definition: kalarmconfig.h:1230
EmailPrefTab::restore
virtual void restore(bool defaults, bool allTabs)
Definition: prefdlg.cpp:1096
PreferencesBase::messageButtonDelay
static int messageButtonDelay()
Get Delay before message window buttons are enabled.
Definition: kalarmconfig.h:462
PreferencesBase::Recur_Login
Definition: kalarmconfig.h:24
Preferences::setCmdXTermCommand
static void setCmdXTermCommand(const QString &cmd)
Definition: preferences.cpp:286
KPageDialog
CollectionControlModel::getStandard
static Akonadi::Collection getStandard(CalEvent::Type, bool useDefault=false)
Return the standard collection for a specified mime type.
Definition: collectionmodel.cpp:991
buttongroup.h
TimePeriod::Days
PreferencesBase::defaultCopyToKOrganizer
static bool defaultCopyToKOrganizer()
Get Show in KOrganizer.
Definition: kalarmconfig.h:1093
RecurrenceEdit::i18n_combo_AtLogin
static QString i18n_combo_AtLogin()
Definition: recurrenceedit.cpp:82
KAlarmPrefDlg::slotApply
virtual void slotApply()
Definition: prefdlg.cpp:220
PreferencesBase::setDefaultCmdLogType
static void setDefaultCmdLogType(CmdLogType v)
Set Command output.
Definition: kalarmconfig.h:1257
KAMail::controlCentreAddress
static QString controlCentreAddress()
Definition: kamail.cpp:467
PreferencesBase::emailClient
static MailClient emailClient()
Get Email client.
Definition: kalarmconfig.h:610
Preferences::setStartOfDay
static void setStartOfDay(const QTime &)
Definition: preferences.cpp:172
KVBox
FontColourChooser
Definition: fontcolour.h:33
EditCommandAlarmDlg::i18n_chk_EnterScript
static QString i18n_chk_EnterScript()
Definition: editdlgtypes.cpp:724
EditDisplayAlarmDlg::i18n_chk_ConfirmAck
static QString i18n_chk_ConfirmAck()
Definition: editdlgtypes.cpp:108
TimePeriod::Units
Units
TimePeriod::period
KCal::Duration period() const
Preferences::MailFrom
MailFrom
Definition: preferences.h:40
PreferencesBase::setArchivedKeepDays
static void setArchivedKeepDays(int v)
Set Days to keep expired alarms.
Definition: kalarmconfig.h:909
EditEmailAlarmDlg::i18n_chk_CopyEmailToSelf
static QString i18n_chk_CopyEmailToSelf()
Definition: editdlgtypes.cpp:1027
EditPrefTab::restore
virtual void restore(bool defaults, bool allTabs)
Definition: prefdlg.cpp:1406
TimePeriod::setPeriod
void setPeriod(const KCal::Duration &period, bool dateOnly, Units defaultUnits)
Preferences::setWorkDayStart
static void setWorkDayStart(const QTime &t)
Definition: preferences.h:60
alarmtimewidget.h
StackedGroupT
PreferencesBase::setShowTooltipTimeToAlarm
static void setShowTooltipTimeToAlarm(bool v)
Set Show time to alarms in system tray tooltip.
Definition: kalarmconfig.h:542
KAlarm::weekDayName
QString weekDayName(int day, const KLocale *)
TimeSpinBox
StackedScrollGroup::adjustSize
QSize adjustSize(bool force=false)
PreferencesBase::defaultBgColour
static QColor defaultBgColour()
Get Background color.
Definition: kalarmconfig.h:199
PreferencesBase::Recur_None
Definition: kalarmconfig.h:24
PreferencesBase::Log_Discard
Definition: kalarmconfig.h:23
EditPrefTab
Definition: prefdlg_p.h:201
LateCancelSelector::i18n_chk_CancelIfLate
static QString i18n_chk_CancelIfLate()
Definition: latecancel.cpp:44
PrefsTabBase::topLayout
QVBoxLayout * topLayout() const
Definition: prefdlg_p.h:63
Preferences::setAutoStartChangedByUser
static void setAutoStartChangedByUser(bool c)
Definition: preferences.h:45
text
virtual QByteArray text(quint32 serialNumber) const =0
RadioButton
KAlarmPrefDlg::mStorePage
StorePrefTab * mStorePage
Definition: prefdlg.h:46
specialactions.h
KAlarmPrefDlg::mEditPageItem
KPageWidgetItem * mEditPageItem
Definition: prefdlg.h:54
Preferences::setConfirmAlarmDeletion
static void setConfirmAlarmDeletion(bool yes)
Definition: preferences.h:66
Preferences::setTimeZone
static void setTimeZone(const KTimeZone &)
Definition: preferences.cpp:139
PreferencesBase::setMessageButtonDelay
static void setMessageButtonDelay(int v)
Set Delay before message window buttons are enabled.
Definition: kalarmconfig.h:440
KAlarmPrefDlg::mEmailPage
EmailPrefTab * mEmailPage
Definition: prefdlg.h:48
FontColourChooser::fgColour
QColor fgColour() const
Definition: fontcolour.cpp:159
QWidget
TimePeriod::HoursMinutes
EmailPrefTab::validate
QString validate()
Definition: prefdlg.cpp:1160
TimePrefTab::apply
virtual void apply(bool syncToDisc)
Definition: prefdlg.cpp:797
PreferencesBase::RecurType
RecurType
Definition: kalarmconfig.h:24
KAlarm::localeDayInWeek_to_weekDay
int localeDayInWeek_to_weekDay(int index)
KAlarmPrefDlg::resizeEvent
virtual void resizeEvent(QResizeEvent *)
Definition: prefdlg.cpp:343
QPushButton
latecancel.h
editdlg.h
PreferencesBase::Feb29_None
Definition: kalarmconfig.h:25
PreferencesBase::defaultFeb29Type
static Feb29Type defaultFeb29Type()
Get In non-leap years, repeat yearly February 29th alarms on:
Definition: kalarmconfig.h:1377
PreferencesBase::Recur_Daily
Definition: kalarmconfig.h:24
KAMail::i18n_sent_mail
static QString i18n_sent_mail()
Definition: kamail.cpp:93
alarmcalendar.h
SoundPicker::i18n_label_Sound
static QString i18n_label_Sound()
Definition: soundpicker.cpp:50
PreferencesBase::kOrgEventDuration
static int kOrgEventDuration()
Get KOrganizer event duration.
Definition: kalarmconfig.h:953
TimePrefTab::restore
virtual void restore(bool defaults, bool allTabs)
Definition: prefdlg.cpp:765
PreferencesBase::autoHideSystemTray
static int autoHideSystemTray()
Get Auto-hide in system tray if no alarms due within period.
Definition: kalarmconfig.h:286
SoundWidget::i18n_chk_Repeat
static QString i18n_chk_Repeat()
Definition: sounddlg.cpp:54
FontColourChooser::font
QFont font() const
Definition: fontcolour.cpp:135
PreferencesBase::defaultPreAction
static QString defaultPreAction()
Get Pre-alarm action.
Definition: kalarmconfig.h:1431
Preferences::setEmailQueuedNotify
static void setEmailQueuedNotify(bool yes)
Definition: preferences.h:70
from
QString from() const
PreferencesBase::setDefaultSoundRepeat
static void setDefaultSoundRepeat(bool v)
Set Repeat sound file.
Definition: kalarmconfig.h:1203
Preferences::setWorkDayEnd
static void setWorkDayEnd(const QTime &t)
Definition: preferences.h:61
SoundPicker::i18n_combo_Speak
static QString i18n_combo_Speak()
Definition: soundpicker.cpp:53
Preferences::quitWarn
static bool quitWarn()
Definition: preferences.h:63
PrefsTabBase::indentWidth
static int indentWidth()
Definition: prefdlg_p.h:64
PreferencesBase::setArchivedColour
static void setArchivedColour(const QColor &v)
Set Archived alarm color.
Definition: kalarmconfig.h:880
Preferences::MAIL_FROM_ADDR
Definition: preferences.h:40
StackedScrollGroup
PreferencesBase::setTooltipAlarmCount
static void setTooltipAlarmCount(int v)
Set Number of alarms to show in system tray tooltip.
Definition: kalarmconfig.h:479
PreferencesBase::Recur_Monthly
Definition: kalarmconfig.h:24
Preferences::setAskAutoStart
static void setAskAutoStart(bool yes)
Definition: preferences.cpp:112
PreferencesBase::defaultSoundRepeat
static bool defaultSoundRepeat()
Get Repeat sound file.
Definition: kalarmconfig.h:1213
SoundPicker::browseFile
static QString browseFile(QString &initialDir, const QString &initialFile=QString())
Display a dialog to choose a sound file, initially highlighting initialFile if non-null.
Definition: soundpicker.cpp:321
PreferencesBase::setAutoStart
static void setAutoStart(bool v)
Set Start at login.
Definition: kalarmconfig.h:303
PreferencesBase::defaultSoundType
static SoundType defaultSoundType()
Get Sound.
Definition: kalarmconfig.h:1120
RecurrenceEdit::i18n_combo_NoRecur
static QString i18n_combo_NoRecur()
Definition: recurrenceedit.cpp:81
ButtonGroup::id
int id(QAbstractButton *button) const
PreferencesBase::messageFont
static QFont messageFont()
Get Message font.
Definition: kalarmconfig.h:228
kalocale.h
KAlarmPrefDlg::~KAlarmPrefDlg
~KAlarmPrefDlg()
Definition: prefdlg.cpp:209
PreferencesBase::kmail
Definition: kalarmconfig.h:21
PreferencesBase::Sound_None
Definition: kalarmconfig.h:22
PreferencesBase::archivedKeepDays
static int archivedKeepDays()
Get Days to keep expired alarms.
Definition: kalarmconfig.h:926
itembox.h
PrefsTabBase::topWidget
KVBox * topWidget() const
Definition: prefdlg_p.h:62
PreferencesBase::setDefaultSoundFile
static void setDefaultSoundFile(const QString &v)
Set Sound file.
Definition: kalarmconfig.h:1137
TimeZoneCombo::timeZone
KTimeZone timeZone() const
MiscPrefTab
Definition: prefdlg_p.h:79
PreferencesBase::showTooltipAlarmTime
static bool showTooltipAlarmTime()
Get Show alarm times in system tray tooltip.
Definition: kalarmconfig.h:525
PreferencesBase::setShowInSystemTray
static void setShowInSystemTray(bool v)
Set Show in system tray.
Definition: kalarmconfig.h:245
StackedScrollWidget::widget
QWidget * widget() const
TimeZoneCombo
EditPrefTab::apply
virtual void apply(bool syncToDisc)
Definition: prefdlg.cpp:1463
fontcolour.h
PreferencesBase::setTooltipTimeToPrefix
static void setTooltipTimeToPrefix(const QString &v)
Set Time-to-alarm prefix in system tray tooltip.
Definition: kalarmconfig.h:571
TimeEdit
kalarmapp.h
the KAlarm application object
PreferencesBase::defaultPostAction
static QString defaultPostAction()
Get Post-alarm action.
Definition: kalarmconfig.h:1539
KAlarmPrefDlg::mViewPageItem
KPageWidgetItem * mViewPageItem
Definition: prefdlg.h:56
ViewPrefTab::restore
virtual void restore(bool defaults, bool allTabs)
Definition: prefdlg.cpp:1790
PrefsTabBase::PrefsTabBase
PrefsTabBase(StackedScrollGroup *)
Definition: prefdlg.cpp:356
StorePrefTab::restore
virtual void restore(bool defaults, bool allTabs)
Definition: prefdlg.cpp:903
StackedScrollGroup::sized
bool sized() const
QRadioButton
RecurrenceEdit::i18n_combo_Daily
static QString i18n_combo_Daily()
Definition: recurrenceedit.cpp:84
Preferences::MAIL_FROM_KMAIL
Definition: preferences.h:40
PrefsTabBase::apply
virtual void apply(bool syncToDisc)=0
Definition: prefdlg.cpp:375
Preferences::startOfDay
static QTime startOfDay()
Definition: preferences.h:55
PreferencesBase::autoStart
static bool autoStart()
Get Start at login.
Definition: kalarmconfig.h:313
KAlarmPrefDlg::mEmailPageItem
KPageWidgetItem * mEmailPageItem
Definition: prefdlg.h:55
Preferences::cmdXTermCommand
static QString cmdXTermCommand()
Definition: preferences.cpp:281
TimeSpinBox::sizeHint
virtual QSize sizeHint() const
PreferencesBase::defaultAutoClose
static bool defaultAutoClose()
Get Auto-close window after late-cancellation time.
Definition: kalarmconfig.h:1039
Preferences::setHolidayRegion
static void setHolidayRegion(const QString &regionCode)
Definition: preferences.cpp:161
Preferences::useDefaults
virtual bool useDefaults(bool def)
Definition: preferences.h:89
Preferences::emailBccFrom
static MailFrom emailBccFrom()
Definition: preferences.cpp:250
FontColourChooser::setFgColour
void setFgColour(const QColor &)
Definition: fontcolour.cpp:181
Preferences::timeZone
static KTimeZone timeZone(bool reload=false)
Definition: preferences.cpp:122
TimePeriod
EmailPrefTab::EmailPrefTab
EmailPrefTab(StackedScrollGroup *)
Definition: prefdlg.cpp:979
PreferencesBase::showTooltipTimeToAlarm
static bool showTooltipTimeToAlarm()
Get Show time to alarms in system tray tooltip.
Definition: kalarmconfig.h:554
Label
colourbutton.h
KAlarmPrefDlg::display
static void display()
Definition: prefdlg.cpp:129
PreferencesBase::disabledColour
static QColor disabledColour()
Get Disabled alarm color.
Definition: kalarmconfig.h:863
PreferencesBase::setDefaultLateCancel
static void setDefaultLateCancel(int v)
Set Cancel if late (minutes)
Definition: kalarmconfig.h:997
ViewPrefTab::ViewPrefTab
ViewPrefTab(StackedScrollGroup *)
Definition: prefdlg.cpp:1594
mainwindow.h
main application window
RecurrenceEdit::i18n_combo_HourlyMinutely
static QString i18n_combo_HourlyMinutely()
Definition: recurrenceedit.cpp:83
MiscPrefTab::apply
virtual void apply(bool syncToDisc)
Definition: prefdlg.cpp:537
PreferencesBase::setDefaultConfirmAck
static void setDefaultConfirmAck(bool v)
Set Confirm acknowledgement.
Definition: kalarmconfig.h:1056
SoundPicker::i18n_combo_None
static QString i18n_combo_None()
Definition: soundpicker.cpp:51
SpecialActionsButton
Definition: specialactions.h:36
QGroupBox
KAlarmPrefDlg
Definition: prefdlg.h:36
KAlarmPrefDlg::slotOk
virtual void slotOk()
Definition: prefdlg.cpp:252
PreferencesBase::setModalMessages
static void setModalMessages(bool v)
Set Message windows have a title bar and take keyboard focus.
Definition: kalarmconfig.h:413
KAMail::i18n_NeedFromEmailAddress
static QString i18n_NeedFromEmailAddress()
Definition: kamail.cpp:90
ButtonGroup::selectedId
int selectedId() const
LateCancelSelector::i18n_chk_AutoCloseWin
static QString i18n_chk_AutoCloseWin()
Definition: latecancel.cpp:45
ButtonGroup::addButton
void addButton(QAbstractButton *button)
PreferencesBase::setEmailClient
static void setEmailClient(MailClient v)
Set Email client.
Definition: kalarmconfig.h:600
PreferencesBase::Log_Terminal
Definition: kalarmconfig.h:23
FontColourChooser::bgColour
QColor bgColour() const
Definition: fontcolour.cpp:154
messagebox.h
KAlarmPrefDlg::mMiscPage
MiscPrefTab * mMiscPage
Definition: prefdlg.h:44
PreferencesBase::setDefaultPostAction
static void setDefaultPostAction(const QString &v)
Set Post-alarm action.
Definition: kalarmconfig.h:1529
PreferencesBase::Feb29_Mar1
Definition: kalarmconfig.h:25
PreferencesBase::askResource
static bool askResource()
Get Prompt for which calendar to store in.
Definition: kalarmconfig.h:396
SpecialActionsButton::options
KAEvent::ExtraActionOptions options() const
Definition: specialactions.h:44
PrefsTabBase
Definition: prefdlg_p.h:52
FontColourChooser::setFont
void setFont(const QFont &, bool onlyFixed=false)
Definition: fontcolour.cpp:123
ColourButton
RecurrenceEdit::i18n_combo_Monthly
static QString i18n_combo_Monthly()
Definition: recurrenceedit.cpp:86
theApp
KAlarmApp * theApp()
Definition: kalarmapp.h:259
Preferences::emailCopyToKMail
static bool emailCopyToKMail()
Definition: preferences.h:67
MiscPrefTab::MiscPrefTab
MiscPrefTab(StackedScrollGroup *)
Definition: prefdlg.cpp:416
MiscPrefTab::restore
virtual void restore(bool defaults, bool allTabs)
Definition: prefdlg.cpp:516
KAlarmPrefDlg::mTimePageItem
KPageWidgetItem * mTimePageItem
Definition: prefdlg.h:52
PreferencesBase::setDefaultRecurPeriod
static void setDefaultRecurPeriod(RecurType v)
Set Recurrence period.
Definition: kalarmconfig.h:1338
PreferencesBase::defaultReminderUnits
static TimePeriod::Units defaultReminderUnits()
Get Reminder units.
Definition: kalarmconfig.h:1404
PreferencesBase::defaultExecPreActionOnDeferral
static bool defaultExecPreActionOnDeferral()
Get Execute pre-alarm action for deferred alarms.
Definition: kalarmconfig.h:1458
TimePrefTab
Definition: prefdlg_p.h:107
Preferences::workDayEnd
static QTime workDayEnd()
Definition: preferences.h:58
SpinBox2::value
int value() const
PreferencesBase::setDefaultFgColour
static void setDefaultFgColour(const QColor &v)
Set Foreground color.
Definition: kalarmconfig.h:162
PrefsTabBase::showEvent
virtual void showEvent(QShowEvent *)
Definition: prefdlg.cpp:386
SpinBox
KAlarmPrefDlg::mEditPage
EditPrefTab * mEditPage
Definition: prefdlg.h:47
PreferencesBase::setAskResource
static void setAskResource(bool v)
Set Prompt for which calendar to store in.
Definition: kalarmconfig.h:384
PreferencesBase::setDefaultExecPreActionOnDeferral
static void setDefaultExecPreActionOnDeferral(bool v)
Set Execute pre-alarm action for deferred alarms.
Definition: kalarmconfig.h:1448
PreferencesBase::setDefaultDeferTime
static void setDefaultDeferTime(int v)
Set Default defer time interval.
Definition: kalarmconfig.h:357
PreferencesBase::defaultDontShowPreActionError
static bool defaultDontShowPreActionError()
Get Do not notify pre-alarm action errors.
Definition: kalarmconfig.h:1512
editdlgtypes.h
preferences.h
RadioButton::setFocusWidget
void setFocusWidget(QWidget *widget, bool enable=true)
Preferences::setQuitWarn
static void setQuitWarn(bool yes)
Definition: preferences.h:64
StorePrefTab::StorePrefTab
StorePrefTab(StackedScrollGroup *)
Definition: prefdlg.cpp:836
ItemBox::leftAlign
void leftAlign()
TimeSpinBox::setValue
virtual void setValue(int minutes)
PreferencesBase::Sound_Speak
Definition: kalarmconfig.h:22
Preferences::holidays
static const KHolidays::HolidayRegion & holidays()
Definition: preferences.cpp:150
CollectionControlModel::enabledCollections
static Akonadi::Collection::List enabledCollections(CalEvent::Type, bool writable)
Return the enabled collections which contain a specified mime type.
Definition: collectionmodel.cpp:1227
StackedScrollWidget
PreferencesBase::archivedColour
static QColor archivedColour()
Get Archived alarm color.
Definition: kalarmconfig.h:892
PreferencesBase::defaultLateCancel
static int defaultLateCancel()
Get Cancel if late (minutes)
Definition: kalarmconfig.h:1012
ButtonGroup::find
QAbstractButton * find(int id) const
StorePrefTab
Definition: prefdlg_p.h:131
KAlarmPrefDlg::showEvent
virtual void showEvent(QShowEvent *)
Definition: prefdlg.cpp:329
Preferences::workDays
static QBitArray workDays()
Definition: preferences.cpp:187
PreferencesBase::setKOrgEventDuration
static void setKOrgEventDuration(int v)
Set KOrganizer event duration.
Definition: kalarmconfig.h:943
KAlarmPrefDlg::mViewPage
ViewPrefTab * mViewPage
Definition: prefdlg.h:49
collectionmodel.h
PreferencesBase::setDefaultPreAction
static void setDefaultPreAction(const QString &v)
Set Pre-alarm action.
Definition: kalarmconfig.h:1421
kamail.h
Preferences::setWorkDays
static void setWorkDays(const QBitArray &)
Definition: preferences.cpp:196
PreferencesBase::setDefaultSoundType
static void setDefaultSoundType(SoundType v)
Set Sound.
Definition: kalarmconfig.h:1110
KAMessageBox::warningContinueCancel
static int warningContinueCancel(QWidget *parent, ButtonCode defaultButton, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const QString &dontAskAgainName=QString())
PreferencesBase::Recur_Yearly
Definition: kalarmconfig.h:24
KLineEdit
TimePrefTab::TimePrefTab
TimePrefTab(StackedScrollGroup *)
Definition: prefdlg.cpp:612
PreferencesBase::SoundType
SoundType
Definition: kalarmconfig.h:22
traywindow.h
PreferencesBase::defaultConfirmAck
static bool defaultConfirmAck()
Get Confirm acknowledgement.
Definition: kalarmconfig.h:1066
Preferences::emailBccAddress
static QString emailBccAddress()
Definition: preferences.cpp:258
TimeZoneCombo::setTimeZone
void setTimeZone(const KTimeZone &tz)
SpecialActionsButton::setActions
void setActions(const QString &pre, const QString &post, KAEvent::ExtraActionOptions)
Definition: specialactions.cpp:63
KAlarmPrefDlg::slotHelp
virtual void slotHelp()
Definition: prefdlg.cpp:214
EditCommandAlarmDlg::i18n_radio_ExecInTermWindow
static QString i18n_radio_ExecInTermWindow()
Definition: editdlgtypes.cpp:725
KAMessageBox::warningYesNo
static int warningYesNo(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous|WindowModal))
sounddlg.h
Preferences::setEmailCopyToKMail
static void setEmailCopyToKMail(bool yes)
Definition: preferences.h:68
functions.h
miscellaneous functions
PreferencesBase::defaultCancelOnPreActionError
static bool defaultCancelOnPreActionError()
Get Cancel alarm on pre-alarm action error.
Definition: kalarmconfig.h:1485
KAMessageBox::sorry
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Options(Notify|WindowModal))
LateCancelSelector::i18n_chk_AutoCloseWinLC
static QString i18n_chk_AutoCloseWinLC()
Definition: latecancel.cpp:46
KAlarmPrefDlg::mStorePageItem
KPageWidgetItem * mStorePageItem
Definition: prefdlg.h:53
TimeEdit::setValue
virtual void setValue(int minutes)
KAlarmApp::purgeAll
void purgeAll()
Definition: kalarmapp.h:85
KAlarmPrefDlg::mTimePage
TimePrefTab * mTimePage
Definition: prefdlg.h:45
PreferencesBase::defaultFgColour
static QColor defaultFgColour()
Get Foreground color.
Definition: kalarmconfig.h:172
Preferences::emailAddress
static QString emailAddress()
Definition: preferences.cpp:227
EditPrefTab::EditPrefTab
EditPrefTab(StackedScrollGroup *)
Definition: prefdlg.cpp:1205
KAlarmPrefDlg::slotDefault
virtual void slotDefault()
Definition: prefdlg.cpp:270
PreferencesBase::defaultEmailBcc
static bool defaultEmailBcc()
Get Copy email to self.
Definition: kalarmconfig.h:1321
MainWindow::i18n_chk_ShowAlarmTime
static QString i18n_chk_ShowAlarmTime()
Definition: mainwindow.cpp:127
QSpinBox
kalarm.h
PreferencesBase::modalMessages
static bool modalMessages()
Get Message windows have a title bar and take keyboard focus.
Definition: kalarmconfig.h:423
StackedScrollGroup::heightReduction
int heightReduction() const
QLabel
PreferencesBase::tooltipAlarmCount
static int tooltipAlarmCount()
Get Number of alarms to show in system tray tooltip.
Definition: kalarmconfig.h:496
PreferencesBase::Sound_File
Definition: kalarmconfig.h:22
KAlarmPrefDlg::minimumSizeHint
virtual QSize minimumSizeHint() const
Definition: prefdlg.cpp:311
ViewPrefTab::apply
virtual void apply(bool syncToDisc)
Definition: prefdlg.cpp:1833
xtermCommands
static QString xtermCommands[]
Definition: prefdlg.cpp:112
KComboBox
PreferencesBase::setDefaultDontShowPreActionError
static void setDefaultDontShowPreActionError(bool v)
Set Do not notify pre-alarm action errors.
Definition: kalarmconfig.h:1502
PreferencesBase::setShowTooltipAlarmTime
static void setShowTooltipAlarmTime(bool v)
Set Show alarm times in system tray tooltip.
Definition: kalarmconfig.h:513
PreferencesBase::Sound_Beep
Definition: kalarmconfig.h:22
PreferencesBase::setAutoHideSystemTray
static void setAutoHideSystemTray(int v)
Set Auto-hide in system tray if no alarms due within period.
Definition: kalarmconfig.h:274
FontColourChooser::setBgColour
void setBgColour(const QColor &)
Definition: fontcolour.cpp:140
SoundPicker::i18n_combo_Beep
static QString i18n_combo_Beep()
Definition: soundpicker.cpp:52
Preferences::MAIL_FROM_SYS_SETTINGS
Definition: preferences.h:40
StorePrefTab::apply
virtual void apply(bool syncToDisc)
Definition: prefdlg.cpp:917
label.h
PreferencesBase::setDefaultCancelOnPreActionError
static void setDefaultCancelOnPreActionError(bool v)
Set Cancel alarm on pre-alarm action error.
Definition: kalarmconfig.h:1475
Preferences::setEmailBccAddress
static void setEmailBccAddress(bool useSystemSettings, const QString &address)
Definition: preferences.cpp:271
Preferences::self
static Preferences * self()
Definition: preferences.cpp:80
PreferencesBase::Recur_SubDaily
Definition: kalarmconfig.h:24
PreferencesBase::defaultSoundFile
static QString defaultSoundFile()
Get Sound file.
Definition: kalarmconfig.h:1147
soundpicker.h
PreferencesBase::showInSystemTray
static bool showInSystemTray()
Get Show in system tray.
Definition: kalarmconfig.h:257
KAlarmPrefDlg::slotCancel
virtual void slotCancel()
Definition: prefdlg.cpp:262
ButtonGroup::setButton
void setButton(int id)
TimePeriod::Weeks
KHBox
PreferencesBase::setDefaultBgColour
static void setDefaultBgColour(const QColor &v)
Set Background color.
Definition: kalarmconfig.h:189
TimeEdit::value
int value() const
EditAlarmDlg::i18n_chk_ShowInKOrganizer
static QString i18n_chk_ShowInKOrganizer()
Definition: editdlg.cpp:103
TimeSpinBox::shiftWhatsThis
static QString shiftWhatsThis()
TimePeriod::Minutes
RecurrenceEdit::i18n_combo_Yearly
static QString i18n_combo_Yearly()
Definition: recurrenceedit.cpp:87
PreferencesBase::setDefaultEmailBcc
static void setDefaultEmailBcc(bool v)
Set Copy email to self.
Definition: kalarmconfig.h:1311
PreferencesBase::Recur_Weekly
Definition: kalarmconfig.h:24
Preferences::confirmAlarmDeletion
static bool confirmAlarmDeletion()
Definition: preferences.h:65
SoundPicker::i18n_combo_File
static QString i18n_combo_File()
Definition: soundpicker.cpp:54
ViewPrefTab
Definition: prefdlg_p.h:242
PreferencesBase::defaultCmdScript
static bool defaultCmdScript()
Get Enter script.
Definition: kalarmconfig.h:1240
EditPrefTab::validate
QString validate()
Definition: prefdlg.cpp:1579
QCheckBox
RecurrenceEdit::i18n_combo_Weekly
static QString i18n_combo_Weekly()
Definition: recurrenceedit.cpp:85
QFrame
SpecialActionsButton::preAction
const QString & preAction() const
Definition: specialactions.h:42
PreferencesBase::sendmail
Definition: kalarmconfig.h:21
QButtonGroup
PreferencesBase::setDefaultReminderUnits
static void setDefaultReminderUnits(TimePeriod::Units v)
Set Reminder units.
Definition: kalarmconfig.h:1394
stackedwidgets.h
PreferencesBase::setDisabledColour
static void setDisabledColour(const QColor &v)
Set Disabled alarm color.
Definition: kalarmconfig.h:851
PreferencesBase::setNoAutoStart
static void setNoAutoStart(bool v)
Set Suppress autostart at login.
Definition: kalarmconfig.h:330
timezonecombo.h
PREF_DIALOG_NAME
static const char PREF_DIALOG_NAME[]
Definition: prefdlg.cpp:104
EditCommandAlarmDlg::i18n_chk_ExecInTermWindow
static QString i18n_chk_ExecInTermWindow()
Definition: editdlgtypes.cpp:726
timeedit.h
timespinbox.h
PreferencesBase::setDefaultCopyToKOrganizer
static void setDefaultCopyToKOrganizer(bool v)
Set Show in KOrganizer.
Definition: kalarmconfig.h:1083
SpecialActionsButton::postAction
const QString & postAction() const
Definition: specialactions.h:43
PreferencesBase::setDefaultAutoClose
static void setDefaultAutoClose(bool v)
Set Auto-close window after late-cancellation time.
Definition: kalarmconfig.h:1029
PreferencesBase::setDefaultFeb29Type
static void setDefaultFeb29Type(Feb29Type v)
Set In non-leap years, repeat yearly February 29th alarms on:
Definition: kalarmconfig.h:1365
PreferencesBase::defaultRecurPeriod
static RecurType defaultRecurPeriod()
Get Recurrence period.
Definition: kalarmconfig.h:1348
EmailPrefTab
Definition: prefdlg_p.h:160
PreferencesBase::tooltipTimeToPrefix
static QString tooltipTimeToPrefix()
Get Time-to-alarm prefix in system tray tooltip.
Definition: kalarmconfig.h:583
StackedWidgetT
Preferences::workDayStart
static QTime workDayStart()
Definition: preferences.h:57
radiobutton.h
PreferencesBase::CmdLogType
CmdLogType
Definition: kalarmconfig.h:23
MainWindow::i18n_chk_ShowTimeToAlarm
static QString i18n_chk_ShowTimeToAlarm()
Definition: mainwindow.cpp:129
KAlarmPrefDlg::mMiscPageItem
KPageWidgetItem * mMiscPageItem
Definition: prefdlg.h:51
QList
ItemBox
Preferences::emailQueuedNotify
static bool emailQueuedNotify()
Definition: preferences.h:69
Preferences::emailFrom
static MailFrom emailFrom()
Definition: preferences.cpp:214
EmailPrefTab::apply
virtual void apply(bool syncToDisc)
Definition: prefdlg.cpp:1107
recurrenceedit.h
ButtonGroup
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:59:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm

Skip menu "kalarm"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal