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

kalarm

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

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