<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> <head> <title>kalarm: prefdlg.cpp Source File (kalarm)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org" r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org" r (n 0 s 0 v 0 l 0))' /> <meta name="trademark" content="KDE e.V." /> <meta name="description" content="K Desktop Environment Homepage, KDE.org" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="robots" content="all" /> <link rel="shortcut icon" href="../../favicon.ico" /> <link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" /> <style type="text/css"> <!-- hr { display: none; } #content h2 { margin-left: 0px; } table.mdTable { background-color: #f8f8f8; border: .2em solid #d7d7d7; } td.mdRow { padding: 8px 20px; } td.md { font-weight: bold; } td.mdname1 { font-weight: bold; color: #602020; } td.mdname { font-weight: bold; color: #602020; } --> </style> </head> <body> <div id="nav_header_top" align="right"> <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a> <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a> <span class="doNotDisplay">::</span> <img id="nav_header_logo_right" alt="" align="right" src="../../pimlogo.png" border="0" /> <div id="nav_header_title" align="left">KDE PIM API Reference</div> </div> <div id="nav_header_bottom" align="right"> <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span> <div id="nav_header_bottom_left" style="text-align: left;"> / <a href="../../">API Reference</a> / <a href=".">kalarm</a> </div> </div> <table id="main" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="top" class="menuheader" height="0"></td> <td id="contentcolumn" valign="top" rowspan="2" > <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;"> <h2><a name="content"></a>kalarm</h2> <!-- Generated by Doxygen 1.5.5 --> <h1>prefdlg.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * prefdlg.cpp - program preferences dialog</span> <a name="l00003"></a>00003 <span class="comment"> * Program: kalarm</span> <a name="l00004"></a>00004 <span class="comment"> * Copyright © 2001-2008 by David Jarvie <djarvie@kde.org></span> <a name="l00005"></a>00005 <span class="comment"> *</span> <a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span> <a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span> <a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span> <a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span> <a name="l00010"></a>00010 <span class="comment"> *</span> <a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span> <a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span> <a name="l00015"></a>00015 <span class="comment"> *</span> <a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License along</span> <a name="l00017"></a>00017 <span class="comment"> * with this program; if not, write to the Free Software Foundation, Inc.,</span> <a name="l00018"></a>00018 <span class="comment"> * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</span> <a name="l00019"></a>00019 <span class="comment"> */</span> <a name="l00020"></a>00020 <a name="l00021"></a>00021 <span class="preprocessor">#include "kalarm.h"</span> <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="preprocessor">#include <qobjectlist.h></span> <a name="l00024"></a>00024 <span class="preprocessor">#include <qlayout.h></span> <a name="l00025"></a>00025 <span class="preprocessor">#include <qbuttongroup.h></span> <a name="l00026"></a>00026 <span class="preprocessor">#include <qvbox.h></span> <a name="l00027"></a>00027 <span class="preprocessor">#include <qlineedit.h></span> <a name="l00028"></a>00028 <span class="preprocessor">#include <qcheckbox.h></span> <a name="l00029"></a>00029 <span class="preprocessor">#include <qradiobutton.h></span> <a name="l00030"></a>00030 <span class="preprocessor">#include <qpushbutton.h></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <qcombobox.h></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <qwhatsthis.h></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <qtooltip.h></span> <a name="l00034"></a>00034 <span class="preprocessor">#include <qstyle.h></span> <a name="l00035"></a>00035 <a name="l00036"></a>00036 <span class="preprocessor">#include <kglobal.h></span> <a name="l00037"></a>00037 <span class="preprocessor">#include <klocale.h></span> <a name="l00038"></a>00038 <span class="preprocessor">#include <kstandarddirs.h></span> <a name="l00039"></a>00039 <span class="preprocessor">#include <kshell.h></span> <a name="l00040"></a>00040 <span class="preprocessor">#include <kmessagebox.h></span> <a name="l00041"></a>00041 <span class="preprocessor">#include <kaboutdata.h></span> <a name="l00042"></a>00042 <span class="preprocessor">#include <kapplication.h></span> <a name="l00043"></a>00043 <span class="preprocessor">#include <kiconloader.h></span> <a name="l00044"></a>00044 <span class="preprocessor">#include <kcolorcombo.h></span> <a name="l00045"></a>00045 <span class="preprocessor">#include <kstdguiitem.h></span> <a name="l00046"></a>00046 <span class="preprocessor">#ifdef Q_WS_X11</span> <a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor">#include <kwin.h></span> <a name="l00048"></a>00048 <span class="preprocessor">#endif</span> <a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#include <kdebug.h></span> <a name="l00050"></a>00050 <a name="l00051"></a>00051 <span class="preprocessor">#include <kalarmd/kalarmd.h></span> <a name="l00052"></a>00052 <a name="l00053"></a>00053 <span class="preprocessor">#include "alarmcalendar.h"</span> <a name="l00054"></a>00054 <span class="preprocessor">#include "alarmtimewidget.h"</span> <a name="l00055"></a>00055 <span class="preprocessor">#include "daemon.h"</span> <a name="l00056"></a>00056 <span class="preprocessor">#include "editdlg.h"</span> <a name="l00057"></a>00057 <span class="preprocessor">#include "fontcolour.h"</span> <a name="l00058"></a>00058 <span class="preprocessor">#include "<a class="code" href="functions_8h.html" title="miscellaneous functions">functions.h</a>"</span> <a name="l00059"></a>00059 <span class="preprocessor">#include "<a class="code" href="kalarmapp_8h.html" title="the KAlarm application object">kalarmapp.h</a>"</span> <a name="l00060"></a>00060 <span class="preprocessor">#include "kamail.h"</span> <a name="l00061"></a>00061 <span class="preprocessor">#include "label.h"</span> <a name="l00062"></a>00062 <span class="preprocessor">#include "latecancel.h"</span> <a name="l00063"></a>00063 <span class="preprocessor">#include "<a class="code" href="mainwindow_8h.html" title="main application window">mainwindow.h</a>"</span> <a name="l00064"></a>00064 <span class="preprocessor">#include "preferences.h"</span> <a name="l00065"></a>00065 <span class="preprocessor">#include "radiobutton.h"</span> <a name="l00066"></a>00066 <span class="preprocessor">#include "recurrenceedit.h"</span> <a name="l00067"></a>00067 <span class="preprocessor">#ifndef WITHOUT_ARTS</span> <a name="l00068"></a>00068 <span class="preprocessor"></span><span class="preprocessor">#include "sounddlg.h"</span> <a name="l00069"></a>00069 <span class="preprocessor">#endif</span> <a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#include "soundpicker.h"</span> <a name="l00071"></a>00071 <span class="preprocessor">#include "specialactions.h"</span> <a name="l00072"></a>00072 <span class="preprocessor">#include "timeedit.h"</span> <a name="l00073"></a>00073 <span class="preprocessor">#include "timespinbox.h"</span> <a name="l00074"></a>00074 <span class="preprocessor">#include "traywindow.h"</span> <a name="l00075"></a>00075 <span class="preprocessor">#include "prefdlg.moc"</span> <a name="l00076"></a>00076 <a name="l00077"></a>00077 <span class="comment">// Command strings for executing commands in different types of terminal windows.</span> <a name="l00078"></a>00078 <span class="comment">// %t = window title parameter</span> <a name="l00079"></a>00079 <span class="comment">// %c = command to execute in terminal</span> <a name="l00080"></a>00080 <span class="comment">// %w = command to execute in terminal, with 'sleep 86400' appended</span> <a name="l00081"></a>00081 <span class="comment">// %C = temporary command file to execute in terminal</span> <a name="l00082"></a>00082 <span class="comment">// %W = temporary command file to execute in terminal, with 'sleep 86400' appended</span> <a name="l00083"></a>00083 <span class="keyword">static</span> QString xtermCommands[] = { <a name="l00084"></a>00084 QString::fromLatin1(<span class="stringliteral">"xterm -sb -hold -title %t -e %c"</span>), <a name="l00085"></a>00085 QString::fromLatin1(<span class="stringliteral">"konsole --noclose -T %t -e ${SHELL:-sh} -c %c"</span>), <a name="l00086"></a>00086 QString::fromLatin1(<span class="stringliteral">"gnome-terminal -t %t -e %W"</span>), <a name="l00087"></a>00087 QString::fromLatin1(<span class="stringliteral">"eterm --pause -T %t -e %C"</span>), <span class="comment">// some systems use eterm...</span> <a name="l00088"></a>00088 QString::fromLatin1(<span class="stringliteral">"Eterm --pause -T %t -e %C"</span>), <span class="comment">// while some use Eterm</span> <a name="l00089"></a>00089 QString::fromLatin1(<span class="stringliteral">"rxvt -title %t -e ${SHELL:-sh} -c %w"</span>), <a name="l00090"></a>00090 QString::null <span class="comment">// end of list indicator - don't change!</span> <a name="l00091"></a>00091 }; <a name="l00092"></a>00092 <a name="l00093"></a>00093 <a name="l00094"></a>00094 <span class="comment">/*=============================================================================</span> <a name="l00095"></a>00095 <span class="comment">= Class KAlarmPrefDlg</span> <a name="l00096"></a>00096 <span class="comment">=============================================================================*/</span> <a name="l00097"></a>00097 <a name="l00098"></a>00098 KAlarmPrefDlg* KAlarmPrefDlg::mInstance = 0; <a name="l00099"></a>00099 <a name="l00100"></a>00100 <span class="keywordtype">void</span> KAlarmPrefDlg::display() <a name="l00101"></a>00101 { <a name="l00102"></a>00102 <span class="keywordflow">if</span> (!mInstance) <a name="l00103"></a>00103 { <a name="l00104"></a>00104 mInstance = <span class="keyword">new</span> KAlarmPrefDlg; <a name="l00105"></a>00105 mInstance->show(); <a name="l00106"></a>00106 } <a name="l00107"></a>00107 <span class="keywordflow">else</span> <a name="l00108"></a>00108 { <a name="l00109"></a>00109 <span class="preprocessor">#ifdef Q_WS_X11</span> <a name="l00110"></a>00110 <span class="preprocessor"></span> KWin::WindowInfo info = KWin::windowInfo(mInstance->winId(), <span class="keyword">static_cast<</span><span class="keywordtype">unsigned</span> <span class="keywordtype">long</span><span class="keyword">></span>(NET::WMGeometry | NET::WMDesktop)); <a name="l00111"></a>00111 KWin::setCurrentDesktop(info.desktop()); <a name="l00112"></a>00112 <span class="preprocessor">#endif</span> <a name="l00113"></a>00113 <span class="preprocessor"></span> mInstance->showNormal(); <span class="comment">// un-minimise it if necessary</span> <a name="l00114"></a>00114 mInstance->raise(); <a name="l00115"></a>00115 mInstance->setActiveWindow(); <a name="l00116"></a>00116 } <a name="l00117"></a>00117 } <a name="l00118"></a>00118 <a name="l00119"></a>00119 KAlarmPrefDlg::KAlarmPrefDlg() <a name="l00120"></a>00120 : KDialogBase(IconList, i18n(<span class="stringliteral">"Preferences"</span>), Help | Default | Ok | Apply | Cancel, Ok, 0, <span class="stringliteral">"PrefDlg"</span>, false, true) <a name="l00121"></a>00121 { <a name="l00122"></a>00122 setWFlags(Qt::WDestructiveClose); <a name="l00123"></a>00123 setIconListAllVisible(<span class="keyword">true</span>); <a name="l00124"></a>00124 <a name="l00125"></a>00125 QVBox* frame = addVBoxPage(i18n(<span class="stringliteral">"General"</span>), i18n(<span class="stringliteral">"General"</span>), DesktopIcon(<span class="stringliteral">"misc"</span>)); <a name="l00126"></a>00126 mMiscPage = <span class="keyword">new</span> MiscPrefTab(frame); <a name="l00127"></a>00127 <a name="l00128"></a>00128 frame = addVBoxPage(i18n(<span class="stringliteral">"Email"</span>), i18n(<span class="stringliteral">"Email Alarm Settings"</span>), DesktopIcon(<span class="stringliteral">"mail_generic"</span>)); <a name="l00129"></a>00129 mEmailPage = <span class="keyword">new</span> EmailPrefTab(frame); <a name="l00130"></a>00130 <a name="l00131"></a>00131 frame = addVBoxPage(i18n(<span class="stringliteral">"View"</span>), i18n(<span class="stringliteral">"View Settings"</span>), DesktopIcon(<span class="stringliteral">"view_choose"</span>)); <a name="l00132"></a>00132 mViewPage = <span class="keyword">new</span> ViewPrefTab(frame); <a name="l00133"></a>00133 <a name="l00134"></a>00134 frame = addVBoxPage(i18n(<span class="stringliteral">"Font & Color"</span>), i18n(<span class="stringliteral">"Default Font and Color"</span>), DesktopIcon(<span class="stringliteral">"colorize"</span>)); <a name="l00135"></a>00135 mFontColourPage = <span class="keyword">new</span> FontColourPrefTab(frame); <a name="l00136"></a>00136 <a name="l00137"></a>00137 frame = addVBoxPage(i18n(<span class="stringliteral">"Edit"</span>), i18n(<span class="stringliteral">"Default Alarm Edit Settings"</span>), DesktopIcon(<span class="stringliteral">"edit"</span>)); <a name="l00138"></a>00138 mEditPage = <span class="keyword">new</span> EditPrefTab(frame); <a name="l00139"></a>00139 <a name="l00140"></a>00140 restore(); <a name="l00141"></a>00141 adjustSize(); <a name="l00142"></a>00142 } <a name="l00143"></a>00143 <a name="l00144"></a>00144 KAlarmPrefDlg::~KAlarmPrefDlg() <a name="l00145"></a>00145 { <a name="l00146"></a>00146 mInstance = 0; <a name="l00147"></a>00147 } <a name="l00148"></a>00148 <a name="l00149"></a>00149 <span class="comment">// Restore all defaults in the options...</span> <a name="l00150"></a>00150 <span class="keywordtype">void</span> KAlarmPrefDlg::slotDefault() <a name="l00151"></a>00151 { <a name="l00152"></a>00152 kdDebug(5950) << <span class="stringliteral">"KAlarmPrefDlg::slotDefault()"</span> << endl; <a name="l00153"></a>00153 mFontColourPage->setDefaults(); <a name="l00154"></a>00154 mEmailPage->setDefaults(); <a name="l00155"></a>00155 mViewPage->setDefaults(); <a name="l00156"></a>00156 mEditPage->setDefaults(); <a name="l00157"></a>00157 mMiscPage->setDefaults(); <a name="l00158"></a>00158 } <a name="l00159"></a>00159 <a name="l00160"></a>00160 <span class="keywordtype">void</span> KAlarmPrefDlg::slotHelp() <a name="l00161"></a>00161 { <a name="l00162"></a>00162 kapp->invokeHelp(<span class="stringliteral">"preferences"</span>); <a name="l00163"></a>00163 } <a name="l00164"></a>00164 <a name="l00165"></a>00165 <span class="comment">// Apply the preferences that are currently selected</span> <a name="l00166"></a>00166 <span class="keywordtype">void</span> KAlarmPrefDlg::slotApply() <a name="l00167"></a>00167 { <a name="l00168"></a>00168 kdDebug(5950) << <span class="stringliteral">"KAlarmPrefDlg::slotApply()"</span> << endl; <a name="l00169"></a>00169 QString errmsg = mEmailPage->validate(); <a name="l00170"></a>00170 <span class="keywordflow">if</span> (!errmsg.isEmpty()) <a name="l00171"></a>00171 { <a name="l00172"></a>00172 showPage(pageIndex(mEmailPage->parentWidget())); <a name="l00173"></a>00173 <span class="keywordflow">if</span> (KMessageBox::warningYesNo(<span class="keyword">this</span>, errmsg) != KMessageBox::Yes) <a name="l00174"></a>00174 { <a name="l00175"></a>00175 mValid = <span class="keyword">false</span>; <a name="l00176"></a>00176 <span class="keywordflow">return</span>; <a name="l00177"></a>00177 } <a name="l00178"></a>00178 } <a name="l00179"></a>00179 errmsg = mEditPage->validate(); <a name="l00180"></a>00180 <span class="keywordflow">if</span> (!errmsg.isEmpty()) <a name="l00181"></a>00181 { <a name="l00182"></a>00182 showPage(pageIndex(mEditPage->parentWidget())); <a name="l00183"></a>00183 KMessageBox::sorry(<span class="keyword">this</span>, errmsg); <a name="l00184"></a>00184 mValid = <span class="keyword">false</span>; <a name="l00185"></a>00185 <span class="keywordflow">return</span>; <a name="l00186"></a>00186 } <a name="l00187"></a>00187 mValid = <span class="keyword">true</span>; <a name="l00188"></a>00188 mFontColourPage->apply(<span class="keyword">false</span>); <a name="l00189"></a>00189 mEmailPage->apply(<span class="keyword">false</span>); <a name="l00190"></a>00190 mViewPage->apply(<span class="keyword">false</span>); <a name="l00191"></a>00191 mEditPage->apply(<span class="keyword">false</span>); <a name="l00192"></a>00192 mMiscPage->apply(<span class="keyword">false</span>); <a name="l00193"></a>00193 Preferences::syncToDisc(); <a name="l00194"></a>00194 } <a name="l00195"></a>00195 <a name="l00196"></a>00196 <span class="comment">// Apply the preferences that are currently selected</span> <a name="l00197"></a>00197 <span class="keywordtype">void</span> KAlarmPrefDlg::slotOk() <a name="l00198"></a>00198 { <a name="l00199"></a>00199 kdDebug(5950) << <span class="stringliteral">"KAlarmPrefDlg::slotOk()"</span> << endl; <a name="l00200"></a>00200 mValid = <span class="keyword">true</span>; <a name="l00201"></a>00201 slotApply(); <a name="l00202"></a>00202 <span class="keywordflow">if</span> (mValid) <a name="l00203"></a>00203 KDialogBase::slotOk(); <a name="l00204"></a>00204 } <a name="l00205"></a>00205 <a name="l00206"></a>00206 <span class="comment">// Discard the current preferences and close the dialogue</span> <a name="l00207"></a>00207 <span class="keywordtype">void</span> KAlarmPrefDlg::slotCancel() <a name="l00208"></a>00208 { <a name="l00209"></a>00209 kdDebug(5950) << <span class="stringliteral">"KAlarmPrefDlg::slotCancel()"</span> << endl; <a name="l00210"></a>00210 restore(); <a name="l00211"></a>00211 KDialogBase::slotCancel(); <a name="l00212"></a>00212 } <a name="l00213"></a>00213 <a name="l00214"></a>00214 <span class="comment">// Discard the current preferences and use the present ones</span> <a name="l00215"></a>00215 <span class="keywordtype">void</span> KAlarmPrefDlg::restore() <a name="l00216"></a>00216 { <a name="l00217"></a>00217 kdDebug(5950) << <span class="stringliteral">"KAlarmPrefDlg::restore()"</span> << endl; <a name="l00218"></a>00218 mFontColourPage->restore(); <a name="l00219"></a>00219 mEmailPage->restore(); <a name="l00220"></a>00220 mViewPage->restore(); <a name="l00221"></a>00221 mEditPage->restore(); <a name="l00222"></a>00222 mMiscPage->restore(); <a name="l00223"></a>00223 } <a name="l00224"></a>00224 <a name="l00225"></a>00225 <a name="l00226"></a>00226 <span class="comment">/*=============================================================================</span> <a name="l00227"></a>00227 <span class="comment">= Class PrefsTabBase</span> <a name="l00228"></a>00228 <span class="comment">=============================================================================*/</span> <a name="l00229"></a>00229 <span class="keywordtype">int</span> PrefsTabBase::mIndentWidth = 0; <a name="l00230"></a>00230 <a name="l00231"></a>00231 PrefsTabBase::PrefsTabBase(QVBox* frame) <a name="l00232"></a>00232 : QWidget(frame), <a name="l00233"></a>00233 mPage(frame) <a name="l00234"></a>00234 { <a name="l00235"></a>00235 <span class="keywordflow">if</span> (!mIndentWidth) <a name="l00236"></a>00236 mIndentWidth = 3 * KDialog::spacingHint(); <a name="l00237"></a>00237 } <a name="l00238"></a>00238 <a name="l00239"></a>00239 <span class="keywordtype">void</span> PrefsTabBase::apply(<span class="keywordtype">bool</span> syncToDisc) <a name="l00240"></a>00240 { <a name="l00241"></a>00241 Preferences::save(syncToDisc); <a name="l00242"></a>00242 } <a name="l00243"></a>00243 <a name="l00244"></a>00244 <a name="l00245"></a>00245 <a name="l00246"></a>00246 <span class="comment">/*=============================================================================</span> <a name="l00247"></a>00247 <span class="comment">= Class MiscPrefTab</span> <a name="l00248"></a>00248 <span class="comment">=============================================================================*/</span> <a name="l00249"></a>00249 <a name="l00250"></a>00250 MiscPrefTab::MiscPrefTab(QVBox* frame) <a name="l00251"></a>00251 : PrefsTabBase(frame) <a name="l00252"></a>00252 { <a name="l00253"></a>00253 <span class="comment">// Get alignment to use in QGridLayout (AlignAuto doesn't work correctly there)</span> <a name="l00254"></a>00254 <span class="keywordtype">int</span> alignment = QApplication::reverseLayout() ? Qt::AlignRight : Qt::AlignLeft; <a name="l00255"></a>00255 <a name="l00256"></a>00256 QGroupBox* group = <span class="keyword">new</span> QButtonGroup(i18n(<span class="stringliteral">"Run Mode"</span>), mPage, <span class="stringliteral">"modeGroup"</span>); <a name="l00257"></a>00257 QGridLayout* grid = <span class="keyword">new</span> QGridLayout(group, 6, 2, KDialog::marginHint(), KDialog::spacingHint()); <a name="l00258"></a>00258 grid->setColStretch(2, 1); <a name="l00259"></a>00259 grid->addColSpacing(0, indentWidth()); <a name="l00260"></a>00260 grid->addColSpacing(1, indentWidth()); <a name="l00261"></a>00261 grid->addRowSpacing(0, fontMetrics().lineSpacing()/2); <a name="l00262"></a>00262 <a name="l00263"></a>00263 <span class="comment">// Run-on-demand radio button</span> <a name="l00264"></a>00264 mRunOnDemand = <span class="keyword">new</span> QRadioButton(i18n(<span class="stringliteral">"&Run only on demand"</span>), group, <span class="stringliteral">"runDemand"</span>); <a name="l00265"></a>00265 mRunOnDemand->setFixedSize(mRunOnDemand->sizeHint()); <a name="l00266"></a>00266 connect(mRunOnDemand, SIGNAL(toggled(<span class="keywordtype">bool</span>)), SLOT(slotRunModeToggled(<span class="keywordtype">bool</span>))); <a name="l00267"></a>00267 QWhatsThis::add(mRunOnDemand, <a name="l00268"></a>00268 i18n(<span class="stringliteral">"Check to run KAlarm only when required.\n\n"</span> <a name="l00269"></a>00269 <span class="stringliteral">"Notes:\n"</span> <a name="l00270"></a>00270 <span class="stringliteral">"1. Alarms are displayed even when KAlarm is not running, since alarm monitoring is done by the alarm daemon.\n"</span> <a name="l00271"></a>00271 <span class="stringliteral">"2. With this option selected, the system tray icon can be displayed or hidden independently of KAlarm."</span>)); <a name="l00272"></a>00272 grid->addMultiCellWidget(mRunOnDemand, 1, 1, 0, 2, alignment); <a name="l00273"></a>00273 <a name="l00274"></a>00274 <span class="comment">// Run-in-system-tray radio button</span> <a name="l00275"></a>00275 mRunInSystemTray = <span class="keyword">new</span> QRadioButton(i18n(<span class="stringliteral">"Run continuously in system &tray"</span>), group, <span class="stringliteral">"runTray"</span>); <a name="l00276"></a>00276 mRunInSystemTray->setFixedSize(mRunInSystemTray->sizeHint()); <a name="l00277"></a>00277 connect(mRunInSystemTray, SIGNAL(toggled(<span class="keywordtype">bool</span>)), SLOT(slotRunModeToggled(<span class="keywordtype">bool</span>))); <a name="l00278"></a>00278 QWhatsThis::add(mRunInSystemTray, <a name="l00279"></a>00279 i18n(<span class="stringliteral">"Check to run KAlarm continuously in the KDE system tray.\n\n"</span> <a name="l00280"></a>00280 <span class="stringliteral">"Notes:\n"</span> <a name="l00281"></a>00281 <span class="stringliteral">"1. With this option selected, closing the system tray icon will quit KAlarm.\n"</span> <a name="l00282"></a>00282 <span class="stringliteral">"2. You do not need to select this option in order for alarms to be displayed, since alarm monitoring is done by the alarm daemon."</span> <a name="l00283"></a>00283 <span class="stringliteral">" Running in the system tray simply provides easy access and a status indication."</span>)); <a name="l00284"></a>00284 grid->addMultiCellWidget(mRunInSystemTray, 2, 2, 0, 2, alignment); <a name="l00285"></a>00285 <a name="l00286"></a>00286 <span class="comment">// Run continuously options</span> <a name="l00287"></a>00287 mDisableAlarmsIfStopped = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"Disa&ble alarms while not running"</span>), group, <span class="stringliteral">"disableAl"</span>); <a name="l00288"></a>00288 mDisableAlarmsIfStopped->setFixedSize(mDisableAlarmsIfStopped->sizeHint()); <a name="l00289"></a>00289 connect(mDisableAlarmsIfStopped, SIGNAL(toggled(<span class="keywordtype">bool</span>)), SLOT(slotDisableIfStoppedToggled(<span class="keywordtype">bool</span>))); <a name="l00290"></a>00290 QWhatsThis::add(mDisableAlarmsIfStopped, <a name="l00291"></a>00291 i18n(<span class="stringliteral">"Check to disable alarms whenever KAlarm is not running. Alarms will only appear while the system tray icon is visible."</span>)); <a name="l00292"></a>00292 grid->addMultiCellWidget(mDisableAlarmsIfStopped, 3, 3, 1, 2, alignment); <a name="l00293"></a>00293 <a name="l00294"></a>00294 mQuitWarn = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"Warn before &quitting"</span>), group, <span class="stringliteral">"disableAl"</span>); <a name="l00295"></a>00295 mQuitWarn->setFixedSize(mQuitWarn->sizeHint()); <a name="l00296"></a>00296 QWhatsThis::add(mQuitWarn, <a name="l00297"></a>00297 i18n(<span class="stringliteral">"Check to display a warning prompt before quitting KAlarm."</span>)); <a name="l00298"></a>00298 grid->addWidget(mQuitWarn, 4, 2, alignment); <a name="l00299"></a>00299 <a name="l00300"></a>00300 mAutostartTrayIcon = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"Autostart at &login"</span>), group, <span class="stringliteral">"autoTray"</span>); <a name="l00301"></a>00301 <span class="preprocessor">#ifdef AUTOSTART_BY_KALARMD</span> <a name="l00302"></a>00302 <span class="preprocessor"></span> connect(mAutostartTrayIcon, SIGNAL(toggled(<span class="keywordtype">bool</span>)), SLOT(slotAutostartToggled(<span class="keywordtype">bool</span>))); <a name="l00303"></a>00303 <span class="preprocessor">#endif</span> <a name="l00304"></a>00304 <span class="preprocessor"></span> grid->addMultiCellWidget(mAutostartTrayIcon, 5, 5, 0, 2, alignment); <a name="l00305"></a>00305 <a name="l00306"></a>00306 <span class="comment">// Autostart alarm daemon</span> <a name="l00307"></a>00307 mAutostartDaemon = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"Start alarm monitoring at lo&gin"</span>), group, <span class="stringliteral">"startDaemon"</span>); <a name="l00308"></a>00308 mAutostartDaemon->setFixedSize(mAutostartDaemon->sizeHint()); <a name="l00309"></a>00309 connect(mAutostartDaemon, SIGNAL(clicked()), SLOT(slotAutostartDaemonClicked())); <a name="l00310"></a>00310 QWhatsThis::add(mAutostartDaemon, <a name="l00311"></a>00311 i18n(<span class="stringliteral">"Automatically start alarm monitoring whenever you start KDE, by running the alarm daemon (%1).\n\n"</span> <a name="l00312"></a>00312 <span class="stringliteral">"This option should always be checked unless you intend to discontinue use of KAlarm."</span>) <a name="l00313"></a>00313 .arg(QString::fromLatin1(DAEMON_APP_NAME))); <a name="l00314"></a>00314 grid->addMultiCellWidget(mAutostartDaemon, 6, 6, 0, 2, alignment); <a name="l00315"></a>00315 <a name="l00316"></a>00316 group->setFixedHeight(group->sizeHint().height()); <a name="l00317"></a>00317 <a name="l00318"></a>00318 <span class="comment">// Start-of-day time</span> <a name="l00319"></a>00319 QHBox* itemBox = <span class="keyword">new</span> QHBox(mPage); <a name="l00320"></a>00320 QHBox* box = <span class="keyword">new</span> QHBox(itemBox); <span class="comment">// this is to control the QWhatsThis text display area</span> <a name="l00321"></a>00321 box->setSpacing(KDialog::spacingHint()); <a name="l00322"></a>00322 QLabel* label = <span class="keyword">new</span> QLabel(i18n(<span class="stringliteral">"&Start of day for date-only alarms:"</span>), box); <a name="l00323"></a>00323 mStartOfDay = <span class="keyword">new</span> TimeEdit(box); <a name="l00324"></a>00324 mStartOfDay->setFixedSize(mStartOfDay->sizeHint()); <a name="l00325"></a>00325 label->setBuddy(mStartOfDay); <a name="l00326"></a>00326 <span class="keyword">static</span> <span class="keyword">const</span> QString startOfDayText = i18n(<span class="stringliteral">"The earliest time of day at which a date-only alarm (i.e. "</span> <a name="l00327"></a>00327 <span class="stringliteral">"an alarm with \"any time\" specified) will be triggered."</span>); <a name="l00328"></a>00328 QWhatsThis::add(box, QString(<span class="stringliteral">"%1\n\n%2"</span>).arg(startOfDayText).arg(TimeSpinBox::shiftWhatsThis())); <a name="l00329"></a>00329 itemBox->setStretchFactor(<span class="keyword">new</span> QWidget(itemBox), 1); <span class="comment">// left adjust the controls</span> <a name="l00330"></a>00330 itemBox->setFixedHeight(box->sizeHint().height()); <a name="l00331"></a>00331 <a name="l00332"></a>00332 <span class="comment">// Confirm alarm deletion?</span> <a name="l00333"></a>00333 itemBox = <span class="keyword">new</span> QHBox(mPage); <span class="comment">// this is to allow left adjustment</span> <a name="l00334"></a>00334 mConfirmAlarmDeletion = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"Con&firm alarm deletions"</span>), itemBox, <span class="stringliteral">"confirmDeletion"</span>); <a name="l00335"></a>00335 mConfirmAlarmDeletion->setMinimumSize(mConfirmAlarmDeletion->sizeHint()); <a name="l00336"></a>00336 QWhatsThis::add(mConfirmAlarmDeletion, <a name="l00337"></a>00337 i18n(<span class="stringliteral">"Check to be prompted for confirmation each time you delete an alarm."</span>)); <a name="l00338"></a>00338 itemBox->setStretchFactor(<span class="keyword">new</span> QWidget(itemBox), 1); <span class="comment">// left adjust the controls</span> <a name="l00339"></a>00339 itemBox->setFixedHeight(itemBox->sizeHint().height()); <a name="l00340"></a>00340 <a name="l00341"></a>00341 <span class="comment">// Expired alarms</span> <a name="l00342"></a>00342 group = <span class="keyword">new</span> QGroupBox(i18n(<span class="stringliteral">"Expired Alarms"</span>), mPage); <a name="l00343"></a>00343 grid = <span class="keyword">new</span> QGridLayout(group, 2, 2, KDialog::marginHint(), KDialog::spacingHint()); <a name="l00344"></a>00344 grid->setColStretch(1, 1); <a name="l00345"></a>00345 grid->addColSpacing(0, indentWidth()); <a name="l00346"></a>00346 grid->addRowSpacing(0, fontMetrics().lineSpacing()/2); <a name="l00347"></a>00347 mKeepExpired = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"Keep alarms after e&xpiry"</span>), group, <span class="stringliteral">"keepExpired"</span>); <a name="l00348"></a>00348 mKeepExpired->setFixedSize(mKeepExpired->sizeHint()); <a name="l00349"></a>00349 connect(mKeepExpired, SIGNAL(toggled(<span class="keywordtype">bool</span>)), SLOT(slotExpiredToggled(<span class="keywordtype">bool</span>))); <a name="l00350"></a>00350 QWhatsThis::add(mKeepExpired, <a name="l00351"></a>00351 i18n(<span class="stringliteral">"Check to store alarms after expiry or deletion (except deleted alarms which were never triggered)."</span>)); <a name="l00352"></a>00352 grid->addMultiCellWidget(mKeepExpired, 1, 1, 0, 1, alignment); <a name="l00353"></a>00353 <a name="l00354"></a>00354 box = <span class="keyword">new</span> QHBox(group); <a name="l00355"></a>00355 box->setSpacing(KDialog::spacingHint()); <a name="l00356"></a>00356 mPurgeExpired = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"Discard ex&pired alarms after:"</span>), box, <span class="stringliteral">"purgeExpired"</span>); <a name="l00357"></a>00357 mPurgeExpired->setMinimumSize(mPurgeExpired->sizeHint()); <a name="l00358"></a>00358 connect(mPurgeExpired, SIGNAL(toggled(<span class="keywordtype">bool</span>)), SLOT(slotExpiredToggled(<span class="keywordtype">bool</span>))); <a name="l00359"></a>00359 mPurgeAfter = <span class="keyword">new</span> SpinBox(box); <a name="l00360"></a>00360 mPurgeAfter->setMinValue(1); <a name="l00361"></a>00361 mPurgeAfter->setLineShiftStep(10); <a name="l00362"></a>00362 mPurgeAfter->setMinimumSize(mPurgeAfter->sizeHint()); <a name="l00363"></a>00363 mPurgeAfterLabel = <span class="keyword">new</span> QLabel(i18n(<span class="stringliteral">"da&ys"</span>), box); <a name="l00364"></a>00364 mPurgeAfterLabel->setMinimumSize(mPurgeAfterLabel->sizeHint()); <a name="l00365"></a>00365 mPurgeAfterLabel->setBuddy(mPurgeAfter); <a name="l00366"></a>00366 QWhatsThis::add(box, <a name="l00367"></a>00367 i18n(<span class="stringliteral">"Uncheck to store expired alarms indefinitely. Check to enter how long expired alarms should be stored."</span>)); <a name="l00368"></a>00368 grid->addWidget(box, 2, 1, alignment); <a name="l00369"></a>00369 <a name="l00370"></a>00370 mClearExpired = <span class="keyword">new</span> QPushButton(i18n(<span class="stringliteral">"Clear Expired Alar&ms"</span>), group); <a name="l00371"></a>00371 mClearExpired->setFixedSize(mClearExpired->sizeHint()); <a name="l00372"></a>00372 connect(mClearExpired, SIGNAL(clicked()), SLOT(slotClearExpired())); <a name="l00373"></a>00373 QWhatsThis::add(mClearExpired, <a name="l00374"></a>00374 i18n(<span class="stringliteral">"Delete all existing expired alarms."</span>)); <a name="l00375"></a>00375 grid->addWidget(mClearExpired, 3, 1, alignment); <a name="l00376"></a>00376 group->setFixedHeight(group->sizeHint().height()); <a name="l00377"></a>00377 <a name="l00378"></a>00378 <span class="comment">// Terminal window to use for command alarms</span> <a name="l00379"></a>00379 group = <span class="keyword">new</span> QGroupBox(i18n(<span class="stringliteral">"Terminal for Command Alarms"</span>), mPage); <a name="l00380"></a>00380 QWhatsThis::add(group, <a name="l00381"></a>00381 i18n(<span class="stringliteral">"Choose which application to use when a command alarm is executed in a terminal window"</span>)); <a name="l00382"></a>00382 grid = <span class="keyword">new</span> QGridLayout(group, 1, 3, KDialog::marginHint(), KDialog::spacingHint()); <a name="l00383"></a>00383 grid->addRowSpacing(0, fontMetrics().lineSpacing()/2); <a name="l00384"></a>00384 <span class="keywordtype">int</span> row = 0; <a name="l00385"></a>00385 <a name="l00386"></a>00386 mXtermType = <span class="keyword">new</span> QButtonGroup(group); <a name="l00387"></a>00387 mXtermType->hide(); <a name="l00388"></a>00388 QString whatsThis = i18n(<span class="stringliteral">"The parameter is a command line, e.g. 'xterm -e'"</span>, <span class="stringliteral">"Check to execute command alarms in a terminal window by '%1'"</span>); <a name="l00389"></a>00389 <span class="keywordtype">int</span> index = 0; <a name="l00390"></a>00390 mXtermFirst = -1; <a name="l00391"></a>00391 <span class="keywordflow">for</span> (mXtermCount = 0; !xtermCommands[mXtermCount].isNull(); ++mXtermCount) <a name="l00392"></a>00392 { <a name="l00393"></a>00393 QString cmd = xtermCommands[mXtermCount]; <a name="l00394"></a>00394 QStringList args = KShell::splitArgs(cmd); <a name="l00395"></a>00395 <span class="keywordflow">if</span> (args.isEmpty() || KStandardDirs::findExe(args[0]).isEmpty()) <a name="l00396"></a>00396 <span class="keywordflow">continue</span>; <a name="l00397"></a>00397 QRadioButton* radio = <span class="keyword">new</span> QRadioButton(args[0], group); <a name="l00398"></a>00398 radio->setMinimumSize(radio->sizeHint()); <a name="l00399"></a>00399 mXtermType->insert(radio, mXtermCount); <a name="l00400"></a>00400 <span class="keywordflow">if</span> (mXtermFirst < 0) <a name="l00401"></a>00401 mXtermFirst = mXtermCount; <span class="comment">// note the id of the first button</span> <a name="l00402"></a>00402 cmd.replace(<span class="stringliteral">"%t"</span>, kapp->aboutData()->programName()); <a name="l00403"></a>00403 cmd.replace(<span class="stringliteral">"%c"</span>, <span class="stringliteral">"<command>"</span>); <a name="l00404"></a>00404 cmd.replace(<span class="stringliteral">"%w"</span>, <span class="stringliteral">"<command; sleep>"</span>); <a name="l00405"></a>00405 cmd.replace(<span class="stringliteral">"%C"</span>, <span class="stringliteral">"[command]"</span>); <a name="l00406"></a>00406 cmd.replace(<span class="stringliteral">"%W"</span>, <span class="stringliteral">"[command; sleep]"</span>); <a name="l00407"></a>00407 QWhatsThis::add(radio, whatsThis.arg(cmd)); <a name="l00408"></a>00408 grid->addWidget(radio, (row = index/3 + 1), index % 3, Qt::AlignAuto); <a name="l00409"></a>00409 ++index; <a name="l00410"></a>00410 } <a name="l00411"></a>00411 <a name="l00412"></a>00412 box = <span class="keyword">new</span> QHBox(group); <a name="l00413"></a>00413 grid->addMultiCellWidget(box, row + 1, row + 1, 0, 2, Qt::AlignAuto); <a name="l00414"></a>00414 QRadioButton* radio = <span class="keyword">new</span> QRadioButton(i18n(<span class="stringliteral">"Other:"</span>), box); <a name="l00415"></a>00415 radio->setFixedSize(radio->sizeHint()); <a name="l00416"></a>00416 connect(radio, SIGNAL(toggled(<span class="keywordtype">bool</span>)), SLOT(slotOtherTerminalToggled(<span class="keywordtype">bool</span>))); <a name="l00417"></a>00417 mXtermType->insert(radio, mXtermCount); <a name="l00418"></a>00418 <span class="keywordflow">if</span> (mXtermFirst < 0) <a name="l00419"></a>00419 mXtermFirst = mXtermCount; <span class="comment">// note the id of the first button</span> <a name="l00420"></a>00420 mXtermCommand = <span class="keyword">new</span> QLineEdit(box); <a name="l00421"></a>00421 QWhatsThis::add(box, <a name="l00422"></a>00422 i18n(<span class="stringliteral">"Enter the full command line needed to execute a command in your chosen terminal window. "</span> <a name="l00423"></a>00423 <span class="stringliteral">"By default the alarm's command string will be appended to what you enter here. "</span> <a name="l00424"></a>00424 <span class="stringliteral">"See the KAlarm Handbook for details of special codes to tailor the command line."</span>)); <a name="l00425"></a>00425 <a name="l00426"></a>00426 mPage->setStretchFactor(<span class="keyword">new</span> QWidget(mPage), 1); <span class="comment">// top adjust the widgets</span> <a name="l00427"></a>00427 } <a name="l00428"></a>00428 <a name="l00429"></a>00429 <span class="keywordtype">void</span> MiscPrefTab::restore() <a name="l00430"></a>00430 { <a name="l00431"></a>00431 mAutostartDaemon->setChecked(Daemon::autoStart()); <a name="l00432"></a>00432 <span class="keywordtype">bool</span> systray = Preferences::mRunInSystemTray; <a name="l00433"></a>00433 mRunInSystemTray->setChecked(systray); <a name="l00434"></a>00434 mRunOnDemand->setChecked(!systray); <a name="l00435"></a>00435 mDisableAlarmsIfStopped->setChecked(Preferences::mDisableAlarmsIfStopped); <a name="l00436"></a>00436 mQuitWarn->setChecked(Preferences::quitWarn()); <a name="l00437"></a>00437 mAutostartTrayIcon->setChecked(Preferences::mAutostartTrayIcon); <a name="l00438"></a>00438 mConfirmAlarmDeletion->setChecked(Preferences::confirmAlarmDeletion()); <a name="l00439"></a>00439 mStartOfDay->setValue(Preferences::mStartOfDay); <a name="l00440"></a>00440 setExpiredControls(Preferences::mExpiredKeepDays); <a name="l00441"></a>00441 QString xtermCmd = Preferences::cmdXTermCommand(); <a name="l00442"></a>00442 <span class="keywordtype">int</span> <span class="keywordtype">id</span> = mXtermFirst; <a name="l00443"></a>00443 <span class="keywordflow">if</span> (!xtermCmd.isEmpty()) <a name="l00444"></a>00444 { <a name="l00445"></a>00445 <span class="keywordflow">for</span> ( ; <span class="keywordtype">id</span> < mXtermCount; ++id) <a name="l00446"></a>00446 { <a name="l00447"></a>00447 <span class="keywordflow">if</span> (mXtermType->find(<span class="keywordtype">id</span>) && xtermCmd == xtermCommands[id]) <a name="l00448"></a>00448 <span class="keywordflow">break</span>; <a name="l00449"></a>00449 } <a name="l00450"></a>00450 } <a name="l00451"></a>00451 mXtermType->setButton(<span class="keywordtype">id</span>); <a name="l00452"></a>00452 mXtermCommand->setEnabled(<span class="keywordtype">id</span> == mXtermCount); <a name="l00453"></a>00453 mXtermCommand->setText(<span class="keywordtype">id</span> == mXtermCount ? xtermCmd : <span class="stringliteral">""</span>); <a name="l00454"></a>00454 slotDisableIfStoppedToggled(<span class="keyword">true</span>); <a name="l00455"></a>00455 } <a name="l00456"></a>00456 <a name="l00457"></a>00457 <span class="keywordtype">void</span> MiscPrefTab::apply(<span class="keywordtype">bool</span> syncToDisc) <a name="l00458"></a>00458 { <a name="l00459"></a>00459 <span class="comment">// First validate anything entered in Other X-terminal command</span> <a name="l00460"></a>00460 <span class="keywordtype">int</span> xtermID = mXtermType->selectedId(); <a name="l00461"></a>00461 <span class="keywordflow">if</span> (xtermID >= mXtermCount) <a name="l00462"></a>00462 { <a name="l00463"></a>00463 QString cmd = mXtermCommand->text(); <a name="l00464"></a>00464 <span class="keywordflow">if</span> (cmd.isEmpty()) <a name="l00465"></a>00465 xtermID = -1; <span class="comment">// 'Other' is only acceptable if it's non-blank</span> <a name="l00466"></a>00466 <span class="keywordflow">else</span> <a name="l00467"></a>00467 { <a name="l00468"></a>00468 QStringList args = KShell::splitArgs(cmd); <a name="l00469"></a>00469 cmd = args.isEmpty() ? QString::null : args[0]; <a name="l00470"></a>00470 <span class="keywordflow">if</span> (KStandardDirs::findExe(cmd).isEmpty()) <a name="l00471"></a>00471 { <a name="l00472"></a>00472 mXtermCommand->setFocus(); <a name="l00473"></a>00473 <span class="keywordflow">if</span> (KMessageBox::warningContinueCancel(<span class="keyword">this</span>, i18n(<span class="stringliteral">"Command to invoke terminal window not found:\n%1"</span>).arg(cmd)) <a name="l00474"></a>00474 != KMessageBox::Continue) <a name="l00475"></a>00475 <span class="keywordflow">return</span>; <a name="l00476"></a>00476 } <a name="l00477"></a>00477 } <a name="l00478"></a>00478 } <a name="l00479"></a>00479 <span class="keywordflow">if</span> (xtermID < 0) <a name="l00480"></a>00480 { <a name="l00481"></a>00481 xtermID = mXtermFirst; <a name="l00482"></a>00482 mXtermType->setButton(mXtermFirst); <a name="l00483"></a>00483 } <a name="l00484"></a>00484 <a name="l00485"></a>00485 <span class="keywordtype">bool</span> systray = mRunInSystemTray->isChecked(); <a name="l00486"></a>00486 Preferences::mRunInSystemTray = systray; <a name="l00487"></a>00487 Preferences::mDisableAlarmsIfStopped = mDisableAlarmsIfStopped->isChecked(); <a name="l00488"></a>00488 <span class="keywordflow">if</span> (mQuitWarn->isEnabled()) <a name="l00489"></a>00489 Preferences::setQuitWarn(mQuitWarn->isChecked()); <a name="l00490"></a>00490 Preferences::mAutostartTrayIcon = mAutostartTrayIcon->isChecked(); <a name="l00491"></a>00491 <span class="preprocessor">#ifdef AUTOSTART_BY_KALARMD</span> <a name="l00492"></a>00492 <span class="preprocessor"></span> <span class="keywordtype">bool</span> newAutostartDaemon = mAutostartDaemon->isChecked() || Preferences::mAutostartTrayIcon; <a name="l00493"></a>00493 <span class="preprocessor">#else</span> <a name="l00494"></a>00494 <span class="preprocessor"></span> <span class="keywordtype">bool</span> newAutostartDaemon = mAutostartDaemon->isChecked(); <a name="l00495"></a>00495 <span class="preprocessor">#endif</span> <a name="l00496"></a>00496 <span class="preprocessor"></span> <span class="keywordflow">if</span> (newAutostartDaemon != Daemon::autoStart()) <a name="l00497"></a>00497 Daemon::enableAutoStart(newAutostartDaemon); <a name="l00498"></a>00498 Preferences::setConfirmAlarmDeletion(mConfirmAlarmDeletion->isChecked()); <a name="l00499"></a>00499 <span class="keywordtype">int</span> sod = mStartOfDay->value(); <a name="l00500"></a>00500 Preferences::mStartOfDay.setHMS(sod/60, sod%60, 0); <a name="l00501"></a>00501 Preferences::mExpiredKeepDays = !mKeepExpired->isChecked() ? 0 <a name="l00502"></a>00502 : mPurgeExpired->isChecked() ? mPurgeAfter->value() : -1; <a name="l00503"></a>00503 Preferences::mCmdXTermCommand = (xtermID < mXtermCount) ? xtermCommands[xtermID] : mXtermCommand->text(); <a name="l00504"></a>00504 PrefsTabBase::apply(syncToDisc); <a name="l00505"></a>00505 } <a name="l00506"></a>00506 <a name="l00507"></a>00507 <span class="keywordtype">void</span> MiscPrefTab::setDefaults() <a name="l00508"></a>00508 { <a name="l00509"></a>00509 mAutostartDaemon->setChecked(<span class="keyword">true</span>); <a name="l00510"></a>00510 <span class="keywordtype">bool</span> systray = Preferences::default_runInSystemTray; <a name="l00511"></a>00511 mRunInSystemTray->setChecked(systray); <a name="l00512"></a>00512 mRunOnDemand->setChecked(!systray); <a name="l00513"></a>00513 mDisableAlarmsIfStopped->setChecked(Preferences::default_disableAlarmsIfStopped); <a name="l00514"></a>00514 mQuitWarn->setChecked(Preferences::default_quitWarn); <a name="l00515"></a>00515 mAutostartTrayIcon->setChecked(Preferences::default_autostartTrayIcon); <a name="l00516"></a>00516 mConfirmAlarmDeletion->setChecked(Preferences::default_confirmAlarmDeletion); <a name="l00517"></a>00517 mStartOfDay->setValue(Preferences::default_startOfDay); <a name="l00518"></a>00518 setExpiredControls(Preferences::default_expiredKeepDays); <a name="l00519"></a>00519 mXtermType->setButton(mXtermFirst); <a name="l00520"></a>00520 mXtermCommand->setEnabled(<span class="keyword">false</span>); <a name="l00521"></a>00521 slotDisableIfStoppedToggled(<span class="keyword">true</span>); <a name="l00522"></a>00522 } <a name="l00523"></a>00523 <a name="l00524"></a>00524 <span class="keywordtype">void</span> MiscPrefTab::slotAutostartDaemonClicked() <a name="l00525"></a>00525 { <a name="l00526"></a>00526 <span class="keywordflow">if</span> (!mAutostartDaemon->isChecked() <a name="l00527"></a>00527 && KMessageBox::warningYesNo(<span class="keyword">this</span>, <a name="l00528"></a>00528 i18n(<span class="stringliteral">"You should not uncheck this option unless you intend to discontinue use of KAlarm"</span>), <a name="l00529"></a>00529 QString::null, KStdGuiItem::cont(), KStdGuiItem::cancel() <a name="l00530"></a>00530 ) != KMessageBox::Yes) <a name="l00531"></a>00531 mAutostartDaemon->setChecked(<span class="keyword">true</span>); <a name="l00532"></a>00532 } <a name="l00533"></a>00533 <a name="l00534"></a>00534 <span class="keywordtype">void</span> MiscPrefTab::slotRunModeToggled(<span class="keywordtype">bool</span>) <a name="l00535"></a>00535 { <a name="l00536"></a>00536 <span class="keywordtype">bool</span> systray = mRunInSystemTray->isOn(); <a name="l00537"></a>00537 mAutostartTrayIcon->setText(systray ? i18n(<span class="stringliteral">"Autostart at &login"</span>) : i18n(<span class="stringliteral">"Autostart system tray &icon at login"</span>)); <a name="l00538"></a>00538 QWhatsThis::add(mAutostartTrayIcon, (systray ? i18n(<span class="stringliteral">"Check to run KAlarm whenever you start KDE."</span>) <a name="l00539"></a>00539 : i18n(<span class="stringliteral">"Check to display the system tray icon whenever you start KDE."</span>))); <a name="l00540"></a>00540 mDisableAlarmsIfStopped->setEnabled(systray); <a name="l00541"></a>00541 slotDisableIfStoppedToggled(<span class="keyword">true</span>); <a name="l00542"></a>00542 } <a name="l00543"></a>00543 <a name="l00544"></a>00544 <span class="comment">/******************************************************************************</span> <a name="l00545"></a>00545 <span class="comment">* If autostart at login is selected, the daemon must be autostarted so that it</span> <a name="l00546"></a>00546 <span class="comment">* can autostart KAlarm, in which case disable the daemon autostart option.</span> <a name="l00547"></a>00547 <span class="comment">*/</span> <a name="l00548"></a>00548 <span class="keywordtype">void</span> MiscPrefTab::slotAutostartToggled(<span class="keywordtype">bool</span>) <a name="l00549"></a>00549 { <a name="l00550"></a>00550 <span class="preprocessor">#ifdef AUTOSTART_BY_KALARMD</span> <a name="l00551"></a>00551 <span class="preprocessor"></span> mAutostartDaemon->setEnabled(!mAutostartTrayIcon->isChecked()); <a name="l00552"></a>00552 <span class="preprocessor">#endif</span> <a name="l00553"></a>00553 <span class="preprocessor"></span>} <a name="l00554"></a>00554 <a name="l00555"></a>00555 <span class="keywordtype">void</span> MiscPrefTab::slotDisableIfStoppedToggled(<span class="keywordtype">bool</span>) <a name="l00556"></a>00556 { <a name="l00557"></a>00557 <span class="keywordtype">bool</span> enable = mDisableAlarmsIfStopped->isEnabled() && mDisableAlarmsIfStopped->isChecked(); <a name="l00558"></a>00558 mQuitWarn->setEnabled(enable); <a name="l00559"></a>00559 } <a name="l00560"></a>00560 <a name="l00561"></a>00561 <span class="keywordtype">void</span> MiscPrefTab::setExpiredControls(<span class="keywordtype">int</span> purgeDays) <a name="l00562"></a>00562 { <a name="l00563"></a>00563 mKeepExpired->setChecked(purgeDays); <a name="l00564"></a>00564 mPurgeExpired->setChecked(purgeDays > 0); <a name="l00565"></a>00565 mPurgeAfter->setValue(purgeDays > 0 ? purgeDays : 0); <a name="l00566"></a>00566 slotExpiredToggled(<span class="keyword">true</span>); <a name="l00567"></a>00567 } <a name="l00568"></a>00568 <a name="l00569"></a>00569 <span class="keywordtype">void</span> MiscPrefTab::slotExpiredToggled(<span class="keywordtype">bool</span>) <a name="l00570"></a>00570 { <a name="l00571"></a>00571 <span class="keywordtype">bool</span> keep = mKeepExpired->isChecked(); <a name="l00572"></a>00572 <span class="keywordtype">bool</span> after = keep && mPurgeExpired->isChecked(); <a name="l00573"></a>00573 mPurgeExpired->setEnabled(keep); <a name="l00574"></a>00574 mPurgeAfter->setEnabled(after); <a name="l00575"></a>00575 mPurgeAfterLabel->setEnabled(keep); <a name="l00576"></a>00576 mClearExpired->setEnabled(keep); <a name="l00577"></a>00577 } <a name="l00578"></a>00578 <a name="l00579"></a>00579 <span class="keywordtype">void</span> MiscPrefTab::slotClearExpired() <a name="l00580"></a>00580 { <a name="l00581"></a>00581 <a class="code" href="classAlarmCalendar.html" title="Provides read and write access to calendar files.">AlarmCalendar</a>* cal = AlarmCalendar::expiredCalendarOpen(); <a name="l00582"></a>00582 <span class="keywordflow">if</span> (cal) <a name="l00583"></a>00583 cal-><a class="code" href="classAlarmCalendar.html#0b04b6242bd1913ced298094fbc5d65c">purgeAll</a>(); <a name="l00584"></a>00584 } <a name="l00585"></a>00585 <a name="l00586"></a>00586 <span class="keywordtype">void</span> MiscPrefTab::slotOtherTerminalToggled(<span class="keywordtype">bool</span> on) <a name="l00587"></a>00587 { <a name="l00588"></a>00588 mXtermCommand->setEnabled(on); <a name="l00589"></a>00589 } <a name="l00590"></a>00590 <a name="l00591"></a>00591 <a name="l00592"></a>00592 <span class="comment">/*=============================================================================</span> <a name="l00593"></a>00593 <span class="comment">= Class EmailPrefTab</span> <a name="l00594"></a>00594 <span class="comment">=============================================================================*/</span> <a name="l00595"></a>00595 <a name="l00596"></a>00596 EmailPrefTab::EmailPrefTab(QVBox* frame) <a name="l00597"></a>00597 : PrefsTabBase(frame), <a name="l00598"></a>00598 mAddressChanged(false), <a name="l00599"></a>00599 mBccAddressChanged(false) <a name="l00600"></a>00600 { <a name="l00601"></a>00601 QHBox* box = <span class="keyword">new</span> QHBox(mPage); <a name="l00602"></a>00602 box->setSpacing(2*KDialog::spacingHint()); <a name="l00603"></a>00603 QLabel* label = <span class="keyword">new</span> QLabel(i18n(<span class="stringliteral">"Email client:"</span>), box); <a name="l00604"></a>00604 mEmailClient = <span class="keyword">new</span> ButtonGroup(box); <a name="l00605"></a>00605 mEmailClient->hide(); <a name="l00606"></a>00606 RadioButton* radio = <span class="keyword">new</span> RadioButton(i18n(<span class="stringliteral">"&KMail"</span>), box, <span class="stringliteral">"kmail"</span>); <a name="l00607"></a>00607 radio->setMinimumSize(radio->sizeHint()); <a name="l00608"></a>00608 mEmailClient->insert(radio, Preferences::KMAIL); <a name="l00609"></a>00609 radio = <span class="keyword">new</span> RadioButton(i18n(<span class="stringliteral">"&Sendmail"</span>), box, <span class="stringliteral">"sendmail"</span>); <a name="l00610"></a>00610 radio->setMinimumSize(radio->sizeHint()); <a name="l00611"></a>00611 mEmailClient->insert(radio, Preferences::SENDMAIL); <a name="l00612"></a>00612 connect(mEmailClient, SIGNAL(buttonSet(<span class="keywordtype">int</span>)), SLOT(slotEmailClientChanged(<span class="keywordtype">int</span>))); <a name="l00613"></a>00613 box->setFixedHeight(box->sizeHint().height()); <a name="l00614"></a>00614 QWhatsThis::add(box, <a name="l00615"></a>00615 i18n(<span class="stringliteral">"Choose how to send email when an email alarm is triggered.\n"</span> <a name="l00616"></a>00616 <span class="stringliteral">"KMail: The email is sent automatically via KMail. KMail is started first if necessary.\n"</span> <a name="l00617"></a>00617 <span class="stringliteral">"Sendmail: The email is sent automatically. This option will only work if "</span> <a name="l00618"></a>00618 <span class="stringliteral">"your system is configured to use sendmail or a sendmail compatible mail transport agent."</span>)); <a name="l00619"></a>00619 <a name="l00620"></a>00620 box = <span class="keyword">new</span> QHBox(mPage); <span class="comment">// this is to allow left adjustment</span> <a name="l00621"></a>00621 mEmailCopyToKMail = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"Co&py sent emails into KMail's %1 folder"</span>).arg(KAMail::i18n_sent_mail()), box); <a name="l00622"></a>00622 mEmailCopyToKMail->setFixedSize(mEmailCopyToKMail->sizeHint()); <a name="l00623"></a>00623 QWhatsThis::add(mEmailCopyToKMail, <a name="l00624"></a>00624 i18n(<span class="stringliteral">"After sending an email, store a copy in KMail's %1 folder"</span>).arg(KAMail::i18n_sent_mail())); <a name="l00625"></a>00625 box->setStretchFactor(<span class="keyword">new</span> QWidget(box), 1); <span class="comment">// left adjust the controls</span> <a name="l00626"></a>00626 box->setFixedHeight(box->sizeHint().height()); <a name="l00627"></a>00627 <a name="l00628"></a>00628 <span class="comment">// Your Email Address group box</span> <a name="l00629"></a>00629 QGroupBox* group = <span class="keyword">new</span> QGroupBox(i18n(<span class="stringliteral">"Your Email Address"</span>), mPage); <a name="l00630"></a>00630 QGridLayout* grid = <span class="keyword">new</span> QGridLayout(group, 6, 3, KDialog::marginHint(), KDialog::spacingHint()); <a name="l00631"></a>00631 grid->addRowSpacing(0, fontMetrics().lineSpacing()/2); <a name="l00632"></a>00632 grid->setColStretch(1, 1); <a name="l00633"></a>00633 <a name="l00634"></a>00634 <span class="comment">// 'From' email address controls ...</span> <a name="l00635"></a>00635 label = <span class="keyword">new</span> Label(EditAlarmDlg::i18n_f_EmailFrom(), group); <a name="l00636"></a>00636 label->setFixedSize(label->sizeHint()); <a name="l00637"></a>00637 grid->addWidget(label, 1, 0); <a name="l00638"></a>00638 mFromAddressGroup = <span class="keyword">new</span> ButtonGroup(group); <a name="l00639"></a>00639 mFromAddressGroup->hide(); <a name="l00640"></a>00640 connect(mFromAddressGroup, SIGNAL(buttonSet(<span class="keywordtype">int</span>)), SLOT(slotFromAddrChanged(<span class="keywordtype">int</span>))); <a name="l00641"></a>00641 <a name="l00642"></a>00642 <span class="comment">// Line edit to enter a 'From' email address</span> <a name="l00643"></a>00643 radio = <span class="keyword">new</span> RadioButton(group); <a name="l00644"></a>00644 mFromAddressGroup->insert(radio, Preferences::MAIL_FROM_ADDR); <a name="l00645"></a>00645 radio->setFixedSize(radio->sizeHint()); <a name="l00646"></a>00646 label->setBuddy(radio); <a name="l00647"></a>00647 grid->addWidget(radio, 1, 1); <a name="l00648"></a>00648 mEmailAddress = <span class="keyword">new</span> QLineEdit(group); <a name="l00649"></a>00649 connect(mEmailAddress, SIGNAL(textChanged(<span class="keyword">const</span> QString&)), SLOT(slotAddressChanged())); <a name="l00650"></a>00650 QString whatsThis = i18n(<span class="stringliteral">"Your email address, used to identify you as the sender when sending email alarms."</span>); <a name="l00651"></a>00651 QWhatsThis::add(radio, whatsThis); <a name="l00652"></a>00652 QWhatsThis::add(mEmailAddress, whatsThis); <a name="l00653"></a>00653 radio->setFocusWidget(mEmailAddress); <a name="l00654"></a>00654 grid->addWidget(mEmailAddress, 1, 2); <a name="l00655"></a>00655 <a name="l00656"></a>00656 <span class="comment">// 'From' email address to be taken from Control Centre</span> <a name="l00657"></a>00657 radio = <span class="keyword">new</span> RadioButton(i18n(<span class="stringliteral">"&Use address from Control Center"</span>), group); <a name="l00658"></a>00658 radio->setFixedSize(radio->sizeHint()); <a name="l00659"></a>00659 mFromAddressGroup->insert(radio, Preferences::MAIL_FROM_CONTROL_CENTRE); <a name="l00660"></a>00660 QWhatsThis::add(radio, <a name="l00661"></a>00661 i18n(<span class="stringliteral">"Check to use the email address set in the KDE Control Center, to identify you as the sender when sending email alarms."</span>)); <a name="l00662"></a>00662 grid->addMultiCellWidget(radio, 2, 2, 1, 2, Qt::AlignAuto); <a name="l00663"></a>00663 <a name="l00664"></a>00664 <span class="comment">// 'From' email address to be picked from KMail's identities when the email alarm is configured</span> <a name="l00665"></a>00665 radio = <span class="keyword">new</span> RadioButton(i18n(<span class="stringliteral">"Use KMail &identities"</span>), group); <a name="l00666"></a>00666 radio->setFixedSize(radio->sizeHint()); <a name="l00667"></a>00667 mFromAddressGroup->insert(radio, Preferences::MAIL_FROM_KMAIL); <a name="l00668"></a>00668 QWhatsThis::add(radio, <a name="l00669"></a>00669 i18n(<span class="stringliteral">"Check to use KMail's email identities to identify you as the sender when sending email alarms. "</span> <a name="l00670"></a>00670 <span class="stringliteral">"For existing email alarms, KMail's default identity will be used. "</span> <a name="l00671"></a>00671 <span class="stringliteral">"For new email alarms, you will be able to pick which of KMail's identities to use."</span>)); <a name="l00672"></a>00672 grid->addMultiCellWidget(radio, 3, 3, 1, 2, Qt::AlignAuto); <a name="l00673"></a>00673 <a name="l00674"></a>00674 <span class="comment">// 'Bcc' email address controls ...</span> <a name="l00675"></a>00675 grid->addRowSpacing(4, KDialog::spacingHint()); <a name="l00676"></a>00676 label = <span class="keyword">new</span> Label(i18n(<span class="stringliteral">"'Bcc' email address"</span>, <span class="stringliteral">"&Bcc:"</span>), group); <a name="l00677"></a>00677 label->setFixedSize(label->sizeHint()); <a name="l00678"></a>00678 grid->addWidget(label, 5, 0); <a name="l00679"></a>00679 mBccAddressGroup = <span class="keyword">new</span> ButtonGroup(group); <a name="l00680"></a>00680 mBccAddressGroup->hide(); <a name="l00681"></a>00681 connect(mBccAddressGroup, SIGNAL(buttonSet(<span class="keywordtype">int</span>)), SLOT(slotBccAddrChanged(<span class="keywordtype">int</span>))); <a name="l00682"></a>00682 <a name="l00683"></a>00683 <span class="comment">// Line edit to enter a 'Bcc' email address</span> <a name="l00684"></a>00684 radio = <span class="keyword">new</span> RadioButton(group); <a name="l00685"></a>00685 radio->setFixedSize(radio->sizeHint()); <a name="l00686"></a>00686 mBccAddressGroup->insert(radio, Preferences::MAIL_FROM_ADDR); <a name="l00687"></a>00687 label->setBuddy(radio); <a name="l00688"></a>00688 grid->addWidget(radio, 5, 1); <a name="l00689"></a>00689 mEmailBccAddress = <span class="keyword">new</span> QLineEdit(group); <a name="l00690"></a>00690 whatsThis = i18n(<span class="stringliteral">"Your email address, used for blind copying email alarms to yourself. "</span> <a name="l00691"></a>00691 <span class="stringliteral">"If you want blind copies to be sent to your account on the computer which KAlarm runs on, you can simply enter your user login name."</span>); <a name="l00692"></a>00692 QWhatsThis::add(radio, whatsThis); <a name="l00693"></a>00693 QWhatsThis::add(mEmailBccAddress, whatsThis); <a name="l00694"></a>00694 radio->setFocusWidget(mEmailBccAddress); <a name="l00695"></a>00695 grid->addWidget(mEmailBccAddress, 5, 2); <a name="l00696"></a>00696 <a name="l00697"></a>00697 <span class="comment">// 'Bcc' email address to be taken from Control Centre</span> <a name="l00698"></a>00698 radio = <span class="keyword">new</span> RadioButton(i18n(<span class="stringliteral">"Us&e address from Control Center"</span>), group); <a name="l00699"></a>00699 radio->setFixedSize(radio->sizeHint()); <a name="l00700"></a>00700 mBccAddressGroup->insert(radio, Preferences::MAIL_FROM_CONTROL_CENTRE); <a name="l00701"></a>00701 QWhatsThis::add(radio, <a name="l00702"></a>00702 i18n(<span class="stringliteral">"Check to use the email address set in the KDE Control Center, for blind copying email alarms to yourself."</span>)); <a name="l00703"></a>00703 grid->addMultiCellWidget(radio, 6, 6, 1, 2, Qt::AlignAuto); <a name="l00704"></a>00704 <a name="l00705"></a>00705 group->setFixedHeight(group->sizeHint().height()); <a name="l00706"></a>00706 <a name="l00707"></a>00707 box = <span class="keyword">new</span> QHBox(mPage); <span class="comment">// this is to allow left adjustment</span> <a name="l00708"></a>00708 mEmailQueuedNotify = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"&Notify when remote emails are queued"</span>), box); <a name="l00709"></a>00709 mEmailQueuedNotify->setFixedSize(mEmailQueuedNotify->sizeHint()); <a name="l00710"></a>00710 QWhatsThis::add(mEmailQueuedNotify, <a name="l00711"></a>00711 i18n(<span class="stringliteral">"Display a notification message whenever an email alarm has queued an email for sending to a remote system. "</span> <a name="l00712"></a>00712 <span class="stringliteral">"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."</span>)); <a name="l00713"></a>00713 box->setStretchFactor(<span class="keyword">new</span> QWidget(box), 1); <span class="comment">// left adjust the controls</span> <a name="l00714"></a>00714 box->setFixedHeight(box->sizeHint().height()); <a name="l00715"></a>00715 <a name="l00716"></a>00716 mPage->setStretchFactor(<span class="keyword">new</span> QWidget(mPage), 1); <span class="comment">// top adjust the widgets</span> <a name="l00717"></a>00717 } <a name="l00718"></a>00718 <a name="l00719"></a>00719 <span class="keywordtype">void</span> EmailPrefTab::restore() <a name="l00720"></a>00720 { <a name="l00721"></a>00721 mEmailClient->setButton(Preferences::mEmailClient); <a name="l00722"></a>00722 mEmailCopyToKMail->setChecked(Preferences::emailCopyToKMail()); <a name="l00723"></a>00723 setEmailAddress(Preferences::mEmailFrom, Preferences::mEmailAddress); <a name="l00724"></a>00724 setEmailBccAddress((Preferences::mEmailBccFrom == Preferences::MAIL_FROM_CONTROL_CENTRE), Preferences::mEmailBccAddress); <a name="l00725"></a>00725 mEmailQueuedNotify->setChecked(Preferences::emailQueuedNotify()); <a name="l00726"></a>00726 mAddressChanged = mBccAddressChanged = <span class="keyword">false</span>; <a name="l00727"></a>00727 } <a name="l00728"></a>00728 <a name="l00729"></a>00729 <span class="keywordtype">void</span> EmailPrefTab::apply(<span class="keywordtype">bool</span> syncToDisc) <a name="l00730"></a>00730 { <a name="l00731"></a>00731 <span class="keywordtype">int</span> client = mEmailClient->id(mEmailClient->selected()); <a name="l00732"></a>00732 Preferences::mEmailClient = (client >= 0) ? Preferences::MailClient(client) : Preferences::default_emailClient; <a name="l00733"></a>00733 Preferences::mEmailCopyToKMail = mEmailCopyToKMail->isChecked(); <a name="l00734"></a>00734 Preferences::setEmailAddress(static_cast<Preferences::MailFrom>(mFromAddressGroup->selectedId()), mEmailAddress->text().stripWhiteSpace()); <a name="l00735"></a>00735 Preferences::setEmailBccAddress((mBccAddressGroup->selectedId() == Preferences::MAIL_FROM_CONTROL_CENTRE), mEmailBccAddress->text().stripWhiteSpace()); <a name="l00736"></a>00736 Preferences::setEmailQueuedNotify(mEmailQueuedNotify->isChecked()); <a name="l00737"></a>00737 PrefsTabBase::apply(syncToDisc); <a name="l00738"></a>00738 } <a name="l00739"></a>00739 <a name="l00740"></a>00740 <span class="keywordtype">void</span> EmailPrefTab::setDefaults() <a name="l00741"></a>00741 { <a name="l00742"></a>00742 mEmailClient->setButton(Preferences::default_emailClient); <a name="l00743"></a>00743 setEmailAddress(Preferences::default_emailFrom(), Preferences::default_emailAddress); <a name="l00744"></a>00744 setEmailBccAddress((Preferences::default_emailBccFrom == Preferences::MAIL_FROM_CONTROL_CENTRE), Preferences::default_emailBccAddress); <a name="l00745"></a>00745 mEmailQueuedNotify->setChecked(Preferences::default_emailQueuedNotify); <a name="l00746"></a>00746 } <a name="l00747"></a>00747 <a name="l00748"></a>00748 <span class="keywordtype">void</span> EmailPrefTab::setEmailAddress(Preferences::MailFrom from, <span class="keyword">const</span> QString& address) <a name="l00749"></a>00749 { <a name="l00750"></a>00750 mFromAddressGroup->setButton(from); <a name="l00751"></a>00751 mEmailAddress->setText(from == Preferences::MAIL_FROM_ADDR ? address.stripWhiteSpace() : QString()); <a name="l00752"></a>00752 } <a name="l00753"></a>00753 <a name="l00754"></a>00754 <span class="keywordtype">void</span> EmailPrefTab::setEmailBccAddress(<span class="keywordtype">bool</span> useControlCentre, <span class="keyword">const</span> QString& address) <a name="l00755"></a>00755 { <a name="l00756"></a>00756 mBccAddressGroup->setButton(useControlCentre ? Preferences::MAIL_FROM_CONTROL_CENTRE : Preferences::MAIL_FROM_ADDR); <a name="l00757"></a>00757 mEmailBccAddress->setText(useControlCentre ? QString() : address.stripWhiteSpace()); <a name="l00758"></a>00758 } <a name="l00759"></a>00759 <a name="l00760"></a>00760 <span class="keywordtype">void</span> EmailPrefTab::slotEmailClientChanged(<span class="keywordtype">int</span> <span class="keywordtype">id</span>) <a name="l00761"></a>00761 { <a name="l00762"></a>00762 mEmailCopyToKMail->setEnabled(<span class="keywordtype">id</span> == Preferences::SENDMAIL); <a name="l00763"></a>00763 } <a name="l00764"></a>00764 <a name="l00765"></a>00765 <span class="keywordtype">void</span> EmailPrefTab::slotFromAddrChanged(<span class="keywordtype">int</span> <span class="keywordtype">id</span>) <a name="l00766"></a>00766 { <a name="l00767"></a>00767 mEmailAddress->setEnabled(<span class="keywordtype">id</span> == Preferences::MAIL_FROM_ADDR); <a name="l00768"></a>00768 mAddressChanged = <span class="keyword">true</span>; <a name="l00769"></a>00769 } <a name="l00770"></a>00770 <a name="l00771"></a>00771 <span class="keywordtype">void</span> EmailPrefTab::slotBccAddrChanged(<span class="keywordtype">int</span> <span class="keywordtype">id</span>) <a name="l00772"></a>00772 { <a name="l00773"></a>00773 mEmailBccAddress->setEnabled(<span class="keywordtype">id</span> == Preferences::MAIL_FROM_ADDR); <a name="l00774"></a>00774 mBccAddressChanged = <span class="keyword">true</span>; <a name="l00775"></a>00775 } <a name="l00776"></a>00776 <a name="l00777"></a>00777 QString EmailPrefTab::validate() <a name="l00778"></a>00778 { <a name="l00779"></a>00779 <span class="keywordflow">if</span> (mAddressChanged) <a name="l00780"></a>00780 { <a name="l00781"></a>00781 mAddressChanged = <span class="keyword">false</span>; <a name="l00782"></a>00782 QString errmsg = validateAddr(mFromAddressGroup, mEmailAddress, KAMail::i18n_NeedFromEmailAddress()); <a name="l00783"></a>00783 <span class="keywordflow">if</span> (!errmsg.isEmpty()) <a name="l00784"></a>00784 <span class="keywordflow">return</span> errmsg; <a name="l00785"></a>00785 } <a name="l00786"></a>00786 <span class="keywordflow">if</span> (mBccAddressChanged) <a name="l00787"></a>00787 { <a name="l00788"></a>00788 mBccAddressChanged = <span class="keyword">false</span>; <a name="l00789"></a>00789 <span class="keywordflow">return</span> validateAddr(mBccAddressGroup, mEmailBccAddress, i18n(<span class="stringliteral">"No valid 'Bcc' email address is specified."</span>)); <a name="l00790"></a>00790 } <a name="l00791"></a>00791 <span class="keywordflow">return</span> QString::null; <a name="l00792"></a>00792 } <a name="l00793"></a>00793 <a name="l00794"></a>00794 QString EmailPrefTab::validateAddr(ButtonGroup* group, QLineEdit* addr, <span class="keyword">const</span> QString& msg) <a name="l00795"></a>00795 { <a name="l00796"></a>00796 QString errmsg = i18n(<span class="stringliteral">"%1\nAre you sure you want to save your changes?"</span>).arg(msg); <a name="l00797"></a>00797 <span class="keywordflow">switch</span> (group->selectedId()) <a name="l00798"></a>00798 { <a name="l00799"></a>00799 <span class="keywordflow">case</span> Preferences::MAIL_FROM_CONTROL_CENTRE: <a name="l00800"></a>00800 <span class="keywordflow">if</span> (!KAMail::controlCentreAddress().isEmpty()) <a name="l00801"></a>00801 <span class="keywordflow">return</span> QString::null; <a name="l00802"></a>00802 errmsg = i18n(<span class="stringliteral">"No email address is currently set in the KDE Control Center. %1"</span>).arg(errmsg); <a name="l00803"></a>00803 <span class="keywordflow">break</span>; <a name="l00804"></a>00804 <span class="keywordflow">case</span> Preferences::MAIL_FROM_KMAIL: <a name="l00805"></a>00805 <span class="keywordflow">if</span> (KAMail::identitiesExist()) <a name="l00806"></a>00806 <span class="keywordflow">return</span> QString::null; <a name="l00807"></a>00807 errmsg = i18n(<span class="stringliteral">"No KMail identities currently exist. %1"</span>).arg(errmsg); <a name="l00808"></a>00808 <span class="keywordflow">break</span>; <a name="l00809"></a>00809 <span class="keywordflow">case</span> Preferences::MAIL_FROM_ADDR: <a name="l00810"></a>00810 <span class="keywordflow">if</span> (!addr->text().stripWhiteSpace().isEmpty()) <a name="l00811"></a>00811 <span class="keywordflow">return</span> QString::null; <a name="l00812"></a>00812 <span class="keywordflow">break</span>; <a name="l00813"></a>00813 } <a name="l00814"></a>00814 <span class="keywordflow">return</span> errmsg; <a name="l00815"></a>00815 } <a name="l00816"></a>00816 <a name="l00817"></a>00817 <a name="l00818"></a>00818 <span class="comment">/*=============================================================================</span> <a name="l00819"></a>00819 <span class="comment">= Class FontColourPrefTab</span> <a name="l00820"></a>00820 <span class="comment">=============================================================================*/</span> <a name="l00821"></a>00821 <a name="l00822"></a>00822 FontColourPrefTab::FontColourPrefTab(QVBox* frame) <a name="l00823"></a>00823 : PrefsTabBase(frame) <a name="l00824"></a>00824 { <a name="l00825"></a>00825 mFontChooser = <span class="keyword">new</span> FontColourChooser(mPage, 0, <span class="keyword">false</span>, QStringList(), i18n(<span class="stringliteral">"Message Font && Color"</span>), <span class="keyword">true</span>, <span class="keyword">false</span>); <a name="l00826"></a>00826 <a name="l00827"></a>00827 QHBox* layoutBox = <span class="keyword">new</span> QHBox(mPage); <a name="l00828"></a>00828 QHBox* box = <span class="keyword">new</span> QHBox(layoutBox); <span class="comment">// to group widgets for QWhatsThis text</span> <a name="l00829"></a>00829 box->setSpacing(KDialog::spacingHint()); <a name="l00830"></a>00830 QLabel* label1 = <span class="keyword">new</span> QLabel(i18n(<span class="stringliteral">"Di&sabled alarm color:"</span>), box); <a name="l00831"></a>00831 <span class="comment">// label1->setMinimumSize(label1->sizeHint());</span> <a name="l00832"></a>00832 box->setStretchFactor(<span class="keyword">new</span> QWidget(box), 1); <a name="l00833"></a>00833 mDisabledColour = <span class="keyword">new</span> KColorCombo(box); <a name="l00834"></a>00834 mDisabledColour->setMinimumSize(mDisabledColour->sizeHint()); <a name="l00835"></a>00835 label1->setBuddy(mDisabledColour); <a name="l00836"></a>00836 QWhatsThis::add(box, <a name="l00837"></a>00837 i18n(<span class="stringliteral">"Choose the text color in the alarm list for disabled alarms."</span>)); <a name="l00838"></a>00838 layoutBox->setStretchFactor(<span class="keyword">new</span> QWidget(layoutBox), 1); <span class="comment">// left adjust the controls</span> <a name="l00839"></a>00839 layoutBox->setFixedHeight(layoutBox->sizeHint().height()); <a name="l00840"></a>00840 <a name="l00841"></a>00841 layoutBox = <span class="keyword">new</span> QHBox(mPage); <a name="l00842"></a>00842 box = <span class="keyword">new</span> QHBox(layoutBox); <span class="comment">// to group widgets for QWhatsThis text</span> <a name="l00843"></a>00843 box->setSpacing(KDialog::spacingHint()); <a name="l00844"></a>00844 QLabel* label2 = <span class="keyword">new</span> QLabel(i18n(<span class="stringliteral">"E&xpired alarm color:"</span>), box); <a name="l00845"></a>00845 <span class="comment">// label2->setMinimumSize(label2->sizeHint());</span> <a name="l00846"></a>00846 box->setStretchFactor(<span class="keyword">new</span> QWidget(box), 1); <a name="l00847"></a>00847 mExpiredColour = <span class="keyword">new</span> KColorCombo(box); <a name="l00848"></a>00848 mExpiredColour->setMinimumSize(mExpiredColour->sizeHint()); <a name="l00849"></a>00849 label2->setBuddy(mExpiredColour); <a name="l00850"></a>00850 QWhatsThis::add(box, <a name="l00851"></a>00851 i18n(<span class="stringliteral">"Choose the text color in the alarm list for expired alarms."</span>)); <a name="l00852"></a>00852 layoutBox->setStretchFactor(<span class="keyword">new</span> QWidget(layoutBox), 1); <span class="comment">// left adjust the controls</span> <a name="l00853"></a>00853 layoutBox->setFixedHeight(layoutBox->sizeHint().height()); <a name="l00854"></a>00854 <a name="l00855"></a>00855 <span class="comment">// Line up the two sets of colour controls</span> <a name="l00856"></a>00856 QSize size = label1->sizeHint(); <a name="l00857"></a>00857 QSize size2 = label2->sizeHint(); <a name="l00858"></a>00858 <span class="keywordflow">if</span> (size2.width() > size.width()) <a name="l00859"></a>00859 size.setWidth(size2.width()); <a name="l00860"></a>00860 label1->setFixedSize(size); <a name="l00861"></a>00861 label2->setFixedSize(size); <a name="l00862"></a>00862 <a name="l00863"></a>00863 mPage->setStretchFactor(<span class="keyword">new</span> QWidget(mPage), 1); <span class="comment">// top adjust the widgets</span> <a name="l00864"></a>00864 } <a name="l00865"></a>00865 <a name="l00866"></a>00866 <span class="keywordtype">void</span> FontColourPrefTab::restore() <a name="l00867"></a>00867 { <a name="l00868"></a>00868 mFontChooser->setBgColour(Preferences::mDefaultBgColour); <a name="l00869"></a>00869 mFontChooser->setColours(Preferences::mMessageColours); <a name="l00870"></a>00870 mFontChooser->setFont(Preferences::mMessageFont); <a name="l00871"></a>00871 mDisabledColour->setColor(Preferences::mDisabledColour); <a name="l00872"></a>00872 mExpiredColour->setColor(Preferences::mExpiredColour); <a name="l00873"></a>00873 } <a name="l00874"></a>00874 <a name="l00875"></a>00875 <span class="keywordtype">void</span> FontColourPrefTab::apply(<span class="keywordtype">bool</span> syncToDisc) <a name="l00876"></a>00876 { <a name="l00877"></a>00877 Preferences::mDefaultBgColour = mFontChooser->bgColour(); <a name="l00878"></a>00878 Preferences::mMessageColours = mFontChooser->colours(); <a name="l00879"></a>00879 Preferences::mMessageFont = mFontChooser->font(); <a name="l00880"></a>00880 Preferences::mDisabledColour = mDisabledColour->color(); <a name="l00881"></a>00881 Preferences::mExpiredColour = mExpiredColour->color(); <a name="l00882"></a>00882 PrefsTabBase::apply(syncToDisc); <a name="l00883"></a>00883 } <a name="l00884"></a>00884 <a name="l00885"></a>00885 <span class="keywordtype">void</span> FontColourPrefTab::setDefaults() <a name="l00886"></a>00886 { <a name="l00887"></a>00887 mFontChooser->setBgColour(Preferences::default_defaultBgColour); <a name="l00888"></a>00888 mFontChooser->setColours(Preferences::default_messageColours); <a name="l00889"></a>00889 mFontChooser->setFont(Preferences::default_messageFont()); <a name="l00890"></a>00890 mDisabledColour->setColor(Preferences::default_disabledColour); <a name="l00891"></a>00891 mExpiredColour->setColor(Preferences::default_expiredColour); <a name="l00892"></a>00892 } <a name="l00893"></a>00893 <a name="l00894"></a>00894 <a name="l00895"></a>00895 <span class="comment">/*=============================================================================</span> <a name="l00896"></a>00896 <span class="comment">= Class EditPrefTab</span> <a name="l00897"></a>00897 <span class="comment">=============================================================================*/</span> <a name="l00898"></a>00898 <a name="l00899"></a>00899 EditPrefTab::EditPrefTab(QVBox* frame) <a name="l00900"></a>00900 : PrefsTabBase(frame) <a name="l00901"></a>00901 { <a name="l00902"></a>00902 <span class="comment">// Get alignment to use in QLabel::setAlignment(alignment | Qt::WordBreak)</span> <a name="l00903"></a>00903 <span class="comment">// (AlignAuto doesn't work correctly there)</span> <a name="l00904"></a>00904 <span class="keywordtype">int</span> alignment = QApplication::reverseLayout() ? Qt::AlignRight : Qt::AlignLeft; <a name="l00905"></a>00905 <a name="l00906"></a>00906 <span class="keywordtype">int</span> groupTopMargin = fontMetrics().lineSpacing()/2; <a name="l00907"></a>00907 QString defsetting = i18n(<span class="stringliteral">"The default setting for \"%1\" in the alarm edit dialog."</span>); <a name="l00908"></a>00908 QString soundSetting = i18n(<span class="stringliteral">"Check to select %1 as the default setting for \"%2\" in the alarm edit dialog."</span>); <a name="l00909"></a>00909 <a name="l00910"></a>00910 <span class="comment">// DISPLAY ALARMS</span> <a name="l00911"></a>00911 QGroupBox* group = <span class="keyword">new</span> QGroupBox(i18n(<span class="stringliteral">"Display Alarms"</span>), mPage); <a name="l00912"></a>00912 QBoxLayout* layout = <span class="keyword">new</span> QVBoxLayout(group, KDialog::marginHint(), KDialog::spacingHint()); <a name="l00913"></a>00913 layout->addSpacing(groupTopMargin); <a name="l00914"></a>00914 <a name="l00915"></a>00915 mConfirmAck = <span class="keyword">new</span> QCheckBox(EditAlarmDlg::i18n_k_ConfirmAck(), group, <span class="stringliteral">"defConfAck"</span>); <a name="l00916"></a>00916 mConfirmAck->setMinimumSize(mConfirmAck->sizeHint()); <a name="l00917"></a>00917 QWhatsThis::add(mConfirmAck, defsetting.arg(EditAlarmDlg::i18n_ConfirmAck())); <a name="l00918"></a>00918 layout->addWidget(mConfirmAck, 0, Qt::AlignAuto); <a name="l00919"></a>00919 <a name="l00920"></a>00920 mAutoClose = <span class="keyword">new</span> QCheckBox(LateCancelSelector::i18n_i_AutoCloseWinLC(), group, <span class="stringliteral">"defAutoClose"</span>); <a name="l00921"></a>00921 mAutoClose->setMinimumSize(mAutoClose->sizeHint()); <a name="l00922"></a>00922 QWhatsThis::add(mAutoClose, defsetting.arg(LateCancelSelector::i18n_AutoCloseWin())); <a name="l00923"></a>00923 layout->addWidget(mAutoClose, 0, Qt::AlignAuto); <a name="l00924"></a>00924 <a name="l00925"></a>00925 QHBox* box = <span class="keyword">new</span> QHBox(group); <a name="l00926"></a>00926 box->setSpacing(KDialog::spacingHint()); <a name="l00927"></a>00927 layout->addWidget(box); <a name="l00928"></a>00928 QLabel* label = <span class="keyword">new</span> QLabel(i18n(<span class="stringliteral">"Reminder &units:"</span>), box); <a name="l00929"></a>00929 label->setFixedSize(label->sizeHint()); <a name="l00930"></a>00930 mReminderUnits = <span class="keyword">new</span> QComboBox(box, <span class="stringliteral">"defWarnUnits"</span>); <a name="l00931"></a>00931 mReminderUnits->insertItem(TimePeriod::i18n_Minutes(), TimePeriod::MINUTES); <a name="l00932"></a>00932 mReminderUnits->insertItem(TimePeriod::i18n_Hours_Mins(), TimePeriod::HOURS_MINUTES); <a name="l00933"></a>00933 mReminderUnits->insertItem(TimePeriod::i18n_Days(), TimePeriod::DAYS); <a name="l00934"></a>00934 mReminderUnits->insertItem(TimePeriod::i18n_Weeks(), TimePeriod::WEEKS); <a name="l00935"></a>00935 mReminderUnits->setFixedSize(mReminderUnits->sizeHint()); <a name="l00936"></a>00936 label->setBuddy(mReminderUnits); <a name="l00937"></a>00937 QWhatsThis::add(box, <a name="l00938"></a>00938 i18n(<span class="stringliteral">"The default units for the reminder in the alarm edit dialog."</span>)); <a name="l00939"></a>00939 box->setStretchFactor(<span class="keyword">new</span> QWidget(box), 1); <span class="comment">// left adjust the control</span> <a name="l00940"></a>00940 <a name="l00941"></a>00941 mSpecialActionsButton = <span class="keyword">new</span> SpecialActionsButton(EditAlarmDlg::i18n_SpecialActions(), box); <a name="l00942"></a>00942 mSpecialActionsButton->setFixedSize(mSpecialActionsButton->sizeHint()); <a name="l00943"></a>00943 <a name="l00944"></a>00944 <span class="comment">// SOUND</span> <a name="l00945"></a>00945 QButtonGroup* bgroup = <span class="keyword">new</span> QButtonGroup(SoundPicker::i18n_Sound(), mPage, <span class="stringliteral">"soundGroup"</span>); <a name="l00946"></a>00946 layout = <span class="keyword">new</span> QVBoxLayout(bgroup, KDialog::marginHint(), KDialog::spacingHint()); <a name="l00947"></a>00947 layout->addSpacing(groupTopMargin); <a name="l00948"></a>00948 <a name="l00949"></a>00949 QBoxLayout* hlayout = <span class="keyword">new</span> QHBoxLayout(layout, KDialog::spacingHint()); <a name="l00950"></a>00950 mSound = <span class="keyword">new</span> QComboBox(<span class="keyword">false</span>, bgroup, <span class="stringliteral">"defSound"</span>); <a name="l00951"></a>00951 mSound->insertItem(SoundPicker::i18n_None()); <span class="comment">// index 0</span> <a name="l00952"></a>00952 mSound->insertItem(SoundPicker::i18n_Beep()); <span class="comment">// index 1</span> <a name="l00953"></a>00953 mSound->insertItem(SoundPicker::i18n_File()); <span class="comment">// index 2</span> <a name="l00954"></a>00954 <span class="keywordflow">if</span> (theApp()->speechEnabled()) <a name="l00955"></a>00955 mSound->insertItem(SoundPicker::i18n_Speak()); <span class="comment">// index 3</span> <a name="l00956"></a>00956 mSound->setMinimumSize(mSound->sizeHint()); <a name="l00957"></a>00957 QWhatsThis::add(mSound, defsetting.arg(SoundPicker::i18n_Sound())); <a name="l00958"></a>00958 hlayout->addWidget(mSound); <a name="l00959"></a>00959 hlayout->addStretch(1); <a name="l00960"></a>00960 <a name="l00961"></a>00961 <span class="preprocessor">#ifndef WITHOUT_ARTS</span> <a name="l00962"></a>00962 <span class="preprocessor"></span> mSoundRepeat = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"Repea&t sound file"</span>), bgroup, <span class="stringliteral">"defRepeatSound"</span>); <a name="l00963"></a>00963 mSoundRepeat->setMinimumSize(mSoundRepeat->sizeHint()); <a name="l00964"></a>00964 QWhatsThis::add(mSoundRepeat, i18n(<span class="stringliteral">"sound file \"Repeat\" checkbox"</span>, <span class="stringliteral">"The default setting for sound file \"%1\" in the alarm edit dialog."</span>).arg(SoundDlg::i18n_Repeat())); <a name="l00965"></a>00965 hlayout->addWidget(mSoundRepeat); <a name="l00966"></a>00966 <span class="preprocessor">#endif</span> <a name="l00967"></a>00967 <span class="preprocessor"></span> <a name="l00968"></a>00968 box = <span class="keyword">new</span> QHBox(bgroup); <span class="comment">// this is to control the QWhatsThis text display area</span> <a name="l00969"></a>00969 box->setSpacing(KDialog::spacingHint()); <a name="l00970"></a>00970 mSoundFileLabel = <span class="keyword">new</span> QLabel(i18n(<span class="stringliteral">"Sound &file:"</span>), box); <a name="l00971"></a>00971 mSoundFileLabel->setFixedSize(mSoundFileLabel->sizeHint()); <a name="l00972"></a>00972 mSoundFile = <span class="keyword">new</span> QLineEdit(box); <a name="l00973"></a>00973 mSoundFileLabel->setBuddy(mSoundFile); <a name="l00974"></a>00974 mSoundFileBrowse = <span class="keyword">new</span> QPushButton(box); <a name="l00975"></a>00975 mSoundFileBrowse->setPixmap(SmallIcon(<span class="stringliteral">"fileopen"</span>)); <a name="l00976"></a>00976 mSoundFileBrowse->setFixedSize(mSoundFileBrowse->sizeHint()); <a name="l00977"></a>00977 connect(mSoundFileBrowse, SIGNAL(clicked()), SLOT(slotBrowseSoundFile())); <a name="l00978"></a>00978 QToolTip::add(mSoundFileBrowse, i18n(<span class="stringliteral">"Choose a sound file"</span>)); <a name="l00979"></a>00979 QWhatsThis::add(box, <a name="l00980"></a>00980 i18n(<span class="stringliteral">"Enter the default sound file to use in the alarm edit dialog."</span>)); <a name="l00981"></a>00981 box->setFixedHeight(box->sizeHint().height()); <a name="l00982"></a>00982 layout->addWidget(box); <a name="l00983"></a>00983 bgroup->setFixedHeight(bgroup->sizeHint().height()); <a name="l00984"></a>00984 <a name="l00985"></a>00985 <span class="comment">// COMMAND ALARMS</span> <a name="l00986"></a>00986 group = <span class="keyword">new</span> QGroupBox(i18n(<span class="stringliteral">"Command Alarms"</span>), mPage); <a name="l00987"></a>00987 layout = <span class="keyword">new</span> QVBoxLayout(group, KDialog::marginHint(), KDialog::spacingHint()); <a name="l00988"></a>00988 layout->addSpacing(groupTopMargin); <a name="l00989"></a>00989 layout = <span class="keyword">new</span> QHBoxLayout(layout, KDialog::spacingHint()); <a name="l00990"></a>00990 <a name="l00991"></a>00991 mCmdScript = <span class="keyword">new</span> QCheckBox(EditAlarmDlg::i18n_p_EnterScript(), group, <span class="stringliteral">"defCmdScript"</span>); <a name="l00992"></a>00992 mCmdScript->setMinimumSize(mCmdScript->sizeHint()); <a name="l00993"></a>00993 QWhatsThis::add(mCmdScript, defsetting.arg(EditAlarmDlg::i18n_EnterScript())); <a name="l00994"></a>00994 layout->addWidget(mCmdScript); <a name="l00995"></a>00995 layout->addStretch(); <a name="l00996"></a>00996 <a name="l00997"></a>00997 mCmdXterm = <span class="keyword">new</span> QCheckBox(EditAlarmDlg::i18n_w_ExecInTermWindow(), group, <span class="stringliteral">"defCmdXterm"</span>); <a name="l00998"></a>00998 mCmdXterm->setMinimumSize(mCmdXterm->sizeHint()); <a name="l00999"></a>00999 QWhatsThis::add(mCmdXterm, defsetting.arg(EditAlarmDlg::i18n_ExecInTermWindow())); <a name="l01000"></a>01000 layout->addWidget(mCmdXterm); <a name="l01001"></a>01001 <a name="l01002"></a>01002 <span class="comment">// EMAIL ALARMS</span> <a name="l01003"></a>01003 group = <span class="keyword">new</span> QGroupBox(i18n(<span class="stringliteral">"Email Alarms"</span>), mPage); <a name="l01004"></a>01004 layout = <span class="keyword">new</span> QVBoxLayout(group, KDialog::marginHint(), KDialog::spacingHint()); <a name="l01005"></a>01005 layout->addSpacing(groupTopMargin); <a name="l01006"></a>01006 <a name="l01007"></a>01007 <span class="comment">// BCC email to sender</span> <a name="l01008"></a>01008 mEmailBcc = <span class="keyword">new</span> QCheckBox(EditAlarmDlg::i18n_e_CopyEmailToSelf(), group, <span class="stringliteral">"defEmailBcc"</span>); <a name="l01009"></a>01009 mEmailBcc->setMinimumSize(mEmailBcc->sizeHint()); <a name="l01010"></a>01010 QWhatsThis::add(mEmailBcc, defsetting.arg(EditAlarmDlg::i18n_CopyEmailToSelf())); <a name="l01011"></a>01011 layout->addWidget(mEmailBcc, 0, Qt::AlignAuto); <a name="l01012"></a>01012 <a name="l01013"></a>01013 <span class="comment">// MISCELLANEOUS</span> <a name="l01014"></a>01014 <span class="comment">// Show in KOrganizer</span> <a name="l01015"></a>01015 mCopyToKOrganizer = <span class="keyword">new</span> QCheckBox(EditAlarmDlg::i18n_g_ShowInKOrganizer(), mPage, <span class="stringliteral">"defShowKorg"</span>); <a name="l01016"></a>01016 mCopyToKOrganizer->setMinimumSize(mCopyToKOrganizer->sizeHint()); <a name="l01017"></a>01017 QWhatsThis::add(mCopyToKOrganizer, defsetting.arg(EditAlarmDlg::i18n_ShowInKOrganizer())); <a name="l01018"></a>01018 <a name="l01019"></a>01019 <span class="comment">// Late cancellation</span> <a name="l01020"></a>01020 box = <span class="keyword">new</span> QHBox(mPage); <a name="l01021"></a>01021 box->setSpacing(KDialog::spacingHint()); <a name="l01022"></a>01022 mLateCancel = <span class="keyword">new</span> QCheckBox(LateCancelSelector::i18n_n_CancelIfLate(), box, <span class="stringliteral">"defCancelLate"</span>); <a name="l01023"></a>01023 mLateCancel->setMinimumSize(mLateCancel->sizeHint()); <a name="l01024"></a>01024 QWhatsThis::add(mLateCancel, defsetting.arg(LateCancelSelector::i18n_CancelIfLate())); <a name="l01025"></a>01025 box->setStretchFactor(<span class="keyword">new</span> QWidget(box), 1); <span class="comment">// left adjust the control</span> <a name="l01026"></a>01026 <a name="l01027"></a>01027 <span class="comment">// Recurrence</span> <a name="l01028"></a>01028 QHBox* itemBox = <span class="keyword">new</span> QHBox(box); <span class="comment">// this is to control the QWhatsThis text display area</span> <a name="l01029"></a>01029 itemBox->setSpacing(KDialog::spacingHint()); <a name="l01030"></a>01030 label = <span class="keyword">new</span> QLabel(i18n(<span class="stringliteral">"&Recurrence:"</span>), itemBox); <a name="l01031"></a>01031 label->setFixedSize(label->sizeHint()); <a name="l01032"></a>01032 mRecurPeriod = <span class="keyword">new</span> QComboBox(itemBox, <span class="stringliteral">"defRecur"</span>); <a name="l01033"></a>01033 mRecurPeriod->insertItem(RecurrenceEdit::i18n_NoRecur()); <a name="l01034"></a>01034 mRecurPeriod->insertItem(RecurrenceEdit::i18n_AtLogin()); <a name="l01035"></a>01035 mRecurPeriod->insertItem(RecurrenceEdit::i18n_HourlyMinutely()); <a name="l01036"></a>01036 mRecurPeriod->insertItem(RecurrenceEdit::i18n_Daily()); <a name="l01037"></a>01037 mRecurPeriod->insertItem(RecurrenceEdit::i18n_Weekly()); <a name="l01038"></a>01038 mRecurPeriod->insertItem(RecurrenceEdit::i18n_Monthly()); <a name="l01039"></a>01039 mRecurPeriod->insertItem(RecurrenceEdit::i18n_Yearly()); <a name="l01040"></a>01040 mRecurPeriod->setFixedSize(mRecurPeriod->sizeHint()); <a name="l01041"></a>01041 label->setBuddy(mRecurPeriod); <a name="l01042"></a>01042 QWhatsThis::add(itemBox, <a name="l01043"></a>01043 i18n(<span class="stringliteral">"The default setting for the recurrence rule in the alarm edit dialog."</span>)); <a name="l01044"></a>01044 box->setFixedHeight(itemBox->sizeHint().height()); <a name="l01045"></a>01045 <a name="l01046"></a>01046 <span class="comment">// How to handle February 29th in yearly recurrences</span> <a name="l01047"></a>01047 QVBox* vbox = <span class="keyword">new</span> QVBox(mPage); <span class="comment">// this is to control the QWhatsThis text display area</span> <a name="l01048"></a>01048 vbox->setSpacing(KDialog::spacingHint()); <a name="l01049"></a>01049 label = <span class="keyword">new</span> QLabel(i18n(<span class="stringliteral">"In non-leap years, repeat yearly February 29th alarms on:"</span>), vbox); <a name="l01050"></a>01050 label->setAlignment(alignment | Qt::WordBreak); <a name="l01051"></a>01051 itemBox = <span class="keyword">new</span> QHBox(vbox); <a name="l01052"></a>01052 itemBox->setSpacing(2*KDialog::spacingHint()); <a name="l01053"></a>01053 mFeb29 = <span class="keyword">new</span> QButtonGroup(itemBox); <a name="l01054"></a>01054 mFeb29->hide(); <a name="l01055"></a>01055 QWidget* widget = <span class="keyword">new</span> QWidget(itemBox); <a name="l01056"></a>01056 widget->setFixedWidth(3*KDialog::spacingHint()); <a name="l01057"></a>01057 QRadioButton* radio = <span class="keyword">new</span> QRadioButton(i18n(<span class="stringliteral">"February 2&8th"</span>), itemBox); <a name="l01058"></a>01058 radio->setMinimumSize(radio->sizeHint()); <a name="l01059"></a>01059 mFeb29->insert(radio, KARecurrence::FEB29_FEB28); <a name="l01060"></a>01060 radio = <span class="keyword">new</span> QRadioButton(i18n(<span class="stringliteral">"March &1st"</span>), itemBox); <a name="l01061"></a>01061 radio->setMinimumSize(radio->sizeHint()); <a name="l01062"></a>01062 mFeb29->insert(radio, KARecurrence::FEB29_MAR1); <a name="l01063"></a>01063 radio = <span class="keyword">new</span> QRadioButton(i18n(<span class="stringliteral">"Do &not repeat"</span>), itemBox); <a name="l01064"></a>01064 radio->setMinimumSize(radio->sizeHint()); <a name="l01065"></a>01065 mFeb29->insert(radio, KARecurrence::FEB29_FEB29); <a name="l01066"></a>01066 itemBox->setFixedHeight(itemBox->sizeHint().height()); <a name="l01067"></a>01067 QWhatsThis::add(vbox, <a name="l01068"></a>01068 i18n(<span class="stringliteral">"For yearly recurrences, choose what date, if any, alarms due on February 29th should occur in non-leap years.\n"</span> <a name="l01069"></a>01069 <span class="stringliteral">"Note that the next scheduled occurrence of existing alarms is not re-evaluated when you change this setting."</span>)); <a name="l01070"></a>01070 <a name="l01071"></a>01071 mPage->setStretchFactor(<span class="keyword">new</span> QWidget(mPage), 1); <span class="comment">// top adjust the widgets</span> <a name="l01072"></a>01072 } <a name="l01073"></a>01073 <a name="l01074"></a>01074 <span class="keywordtype">void</span> EditPrefTab::restore() <a name="l01075"></a>01075 { <a name="l01076"></a>01076 mAutoClose->setChecked(Preferences::mDefaultAutoClose); <a name="l01077"></a>01077 mConfirmAck->setChecked(Preferences::mDefaultConfirmAck); <a name="l01078"></a>01078 mReminderUnits->setCurrentItem(Preferences::mDefaultReminderUnits); <a name="l01079"></a>01079 mSpecialActionsButton->setActions(Preferences::mDefaultPreAction, Preferences::mDefaultPostAction); <a name="l01080"></a>01080 mSound->setCurrentItem(soundIndex(Preferences::mDefaultSoundType)); <a name="l01081"></a>01081 mSoundFile->setText(Preferences::mDefaultSoundFile); <a name="l01082"></a>01082 <span class="preprocessor">#ifndef WITHOUT_ARTS</span> <a name="l01083"></a>01083 <span class="preprocessor"></span> mSoundRepeat->setChecked(Preferences::mDefaultSoundRepeat); <a name="l01084"></a>01084 <span class="preprocessor">#endif</span> <a name="l01085"></a>01085 <span class="preprocessor"></span> mCmdScript->setChecked(Preferences::mDefaultCmdScript); <a name="l01086"></a>01086 mCmdXterm->setChecked(Preferences::mDefaultCmdLogType == EditAlarmDlg::EXEC_IN_TERMINAL); <a name="l01087"></a>01087 mEmailBcc->setChecked(Preferences::mDefaultEmailBcc); <a name="l01088"></a>01088 mCopyToKOrganizer->setChecked(Preferences::mDefaultCopyToKOrganizer); <a name="l01089"></a>01089 mLateCancel->setChecked(Preferences::mDefaultLateCancel); <a name="l01090"></a>01090 mRecurPeriod->setCurrentItem(recurIndex(Preferences::mDefaultRecurPeriod)); <a name="l01091"></a>01091 mFeb29->setButton(Preferences::mDefaultFeb29Type); <a name="l01092"></a>01092 } <a name="l01093"></a>01093 <a name="l01094"></a>01094 <span class="keywordtype">void</span> EditPrefTab::apply(<span class="keywordtype">bool</span> syncToDisc) <a name="l01095"></a>01095 { <a name="l01096"></a>01096 Preferences::mDefaultAutoClose = mAutoClose->isChecked(); <a name="l01097"></a>01097 Preferences::mDefaultConfirmAck = mConfirmAck->isChecked(); <a name="l01098"></a>01098 Preferences::mDefaultReminderUnits = <span class="keyword">static_cast<</span>TimePeriod::Units<span class="keyword">></span>(mReminderUnits->currentItem()); <a name="l01099"></a>01099 Preferences::mDefaultPreAction = mSpecialActionsButton->preAction(); <a name="l01100"></a>01100 Preferences::mDefaultPostAction = mSpecialActionsButton->postAction(); <a name="l01101"></a>01101 <span class="keywordflow">switch</span> (mSound->currentItem()) <a name="l01102"></a>01102 { <a name="l01103"></a>01103 <span class="keywordflow">case</span> 3: Preferences::mDefaultSoundType = SoundPicker::SPEAK; <span class="keywordflow">break</span>; <a name="l01104"></a>01104 <span class="keywordflow">case</span> 2: Preferences::mDefaultSoundType = SoundPicker::PLAY_FILE; <span class="keywordflow">break</span>; <a name="l01105"></a>01105 <span class="keywordflow">case</span> 1: Preferences::mDefaultSoundType = SoundPicker::BEEP; <span class="keywordflow">break</span>; <a name="l01106"></a>01106 <span class="keywordflow">case</span> 0: <a name="l01107"></a>01107 <span class="keywordflow">default</span>: Preferences::mDefaultSoundType = SoundPicker::NONE; <span class="keywordflow">break</span>; <a name="l01108"></a>01108 } <a name="l01109"></a>01109 Preferences::mDefaultSoundFile = mSoundFile->text(); <a name="l01110"></a>01110 <span class="preprocessor">#ifndef WITHOUT_ARTS</span> <a name="l01111"></a>01111 <span class="preprocessor"></span> Preferences::mDefaultSoundRepeat = mSoundRepeat->isChecked(); <a name="l01112"></a>01112 <span class="preprocessor">#endif</span> <a name="l01113"></a>01113 <span class="preprocessor"></span> Preferences::mDefaultCmdScript = mCmdScript->isChecked(); <a name="l01114"></a>01114 Preferences::mDefaultCmdLogType = (mCmdXterm->isChecked() ? EditAlarmDlg::EXEC_IN_TERMINAL : EditAlarmDlg::DISCARD_OUTPUT); <a name="l01115"></a>01115 Preferences::mDefaultEmailBcc = mEmailBcc->isChecked(); <a name="l01116"></a>01116 Preferences::mDefaultCopyToKOrganizer = mCopyToKOrganizer->isChecked(); <a name="l01117"></a>01117 Preferences::mDefaultLateCancel = mLateCancel->isChecked() ? 1 : 0; <a name="l01118"></a>01118 <span class="keywordflow">switch</span> (mRecurPeriod->currentItem()) <a name="l01119"></a>01119 { <a name="l01120"></a>01120 <span class="keywordflow">case</span> 6: Preferences::mDefaultRecurPeriod = RecurrenceEdit::ANNUAL; <span class="keywordflow">break</span>; <a name="l01121"></a>01121 <span class="keywordflow">case</span> 5: Preferences::mDefaultRecurPeriod = RecurrenceEdit::MONTHLY; <span class="keywordflow">break</span>; <a name="l01122"></a>01122 <span class="keywordflow">case</span> 4: Preferences::mDefaultRecurPeriod = RecurrenceEdit::WEEKLY; <span class="keywordflow">break</span>; <a name="l01123"></a>01123 <span class="keywordflow">case</span> 3: Preferences::mDefaultRecurPeriod = RecurrenceEdit::DAILY; <span class="keywordflow">break</span>; <a name="l01124"></a>01124 <span class="keywordflow">case</span> 2: Preferences::mDefaultRecurPeriod = RecurrenceEdit::SUBDAILY; <span class="keywordflow">break</span>; <a name="l01125"></a>01125 <span class="keywordflow">case</span> 1: Preferences::mDefaultRecurPeriod = RecurrenceEdit::AT_LOGIN; <span class="keywordflow">break</span>; <a name="l01126"></a>01126 <span class="keywordflow">case</span> 0: <a name="l01127"></a>01127 <span class="keywordflow">default</span>: Preferences::mDefaultRecurPeriod = RecurrenceEdit::NO_RECUR; <span class="keywordflow">break</span>; <a name="l01128"></a>01128 } <a name="l01129"></a>01129 <span class="keywordtype">int</span> feb29 = mFeb29->selectedId(); <a name="l01130"></a>01130 Preferences::mDefaultFeb29Type = (feb29 >= 0) ? static_cast<KARecurrence::Feb29Type>(feb29) : Preferences::default_defaultFeb29Type; <a name="l01131"></a>01131 PrefsTabBase::apply(syncToDisc); <a name="l01132"></a>01132 } <a name="l01133"></a>01133 <a name="l01134"></a>01134 <span class="keywordtype">void</span> EditPrefTab::setDefaults() <a name="l01135"></a>01135 { <a name="l01136"></a>01136 mAutoClose->setChecked(Preferences::default_defaultAutoClose); <a name="l01137"></a>01137 mConfirmAck->setChecked(Preferences::default_defaultConfirmAck); <a name="l01138"></a>01138 mReminderUnits->setCurrentItem(Preferences::default_defaultReminderUnits); <a name="l01139"></a>01139 mSpecialActionsButton->setActions(Preferences::default_defaultPreAction, Preferences::default_defaultPostAction); <a name="l01140"></a>01140 mSound->setCurrentItem(soundIndex(Preferences::default_defaultSoundType)); <a name="l01141"></a>01141 mSoundFile->setText(Preferences::default_defaultSoundFile); <a name="l01142"></a>01142 <span class="preprocessor">#ifndef WITHOUT_ARTS</span> <a name="l01143"></a>01143 <span class="preprocessor"></span> mSoundRepeat->setChecked(Preferences::default_defaultSoundRepeat); <a name="l01144"></a>01144 <span class="preprocessor">#endif</span> <a name="l01145"></a>01145 <span class="preprocessor"></span> mCmdScript->setChecked(Preferences::default_defaultCmdScript); <a name="l01146"></a>01146 mCmdXterm->setChecked(Preferences::default_defaultCmdLogType == EditAlarmDlg::EXEC_IN_TERMINAL); <a name="l01147"></a>01147 mEmailBcc->setChecked(Preferences::default_defaultEmailBcc); <a name="l01148"></a>01148 mCopyToKOrganizer->setChecked(Preferences::default_defaultCopyToKOrganizer); <a name="l01149"></a>01149 mLateCancel->setChecked(Preferences::default_defaultLateCancel); <a name="l01150"></a>01150 mRecurPeriod->setCurrentItem(recurIndex(Preferences::default_defaultRecurPeriod)); <a name="l01151"></a>01151 mFeb29->setButton(Preferences::default_defaultFeb29Type); <a name="l01152"></a>01152 } <a name="l01153"></a>01153 <a name="l01154"></a>01154 <span class="keywordtype">void</span> EditPrefTab::slotBrowseSoundFile() <a name="l01155"></a>01155 { <a name="l01156"></a>01156 QString defaultDir; <a name="l01157"></a>01157 QString url = SoundPicker::browseFile(defaultDir, mSoundFile->text()); <a name="l01158"></a>01158 <span class="keywordflow">if</span> (!url.isEmpty()) <a name="l01159"></a>01159 mSoundFile->setText(url); <a name="l01160"></a>01160 } <a name="l01161"></a>01161 <a name="l01162"></a>01162 <span class="keywordtype">int</span> EditPrefTab::soundIndex(SoundPicker::Type type) <a name="l01163"></a>01163 { <a name="l01164"></a>01164 <span class="keywordflow">switch</span> (type) <a name="l01165"></a>01165 { <a name="l01166"></a>01166 <span class="keywordflow">case</span> SoundPicker::SPEAK: <span class="keywordflow">return</span> 3; <a name="l01167"></a>01167 <span class="keywordflow">case</span> SoundPicker::PLAY_FILE: <span class="keywordflow">return</span> 2; <a name="l01168"></a>01168 <span class="keywordflow">case</span> SoundPicker::BEEP: <span class="keywordflow">return</span> 1; <a name="l01169"></a>01169 <span class="keywordflow">case</span> SoundPicker::NONE: <a name="l01170"></a>01170 <span class="keywordflow">default</span>: <span class="keywordflow">return</span> 0; <a name="l01171"></a>01171 } <a name="l01172"></a>01172 } <a name="l01173"></a>01173 <a name="l01174"></a>01174 <span class="keywordtype">int</span> EditPrefTab::recurIndex(RecurrenceEdit::RepeatType type) <a name="l01175"></a>01175 { <a name="l01176"></a>01176 <span class="keywordflow">switch</span> (type) <a name="l01177"></a>01177 { <a name="l01178"></a>01178 <span class="keywordflow">case</span> RecurrenceEdit::ANNUAL: <span class="keywordflow">return</span> 6; <a name="l01179"></a>01179 <span class="keywordflow">case</span> RecurrenceEdit::MONTHLY: <span class="keywordflow">return</span> 5; <a name="l01180"></a>01180 <span class="keywordflow">case</span> RecurrenceEdit::WEEKLY: <span class="keywordflow">return</span> 4; <a name="l01181"></a>01181 <span class="keywordflow">case</span> RecurrenceEdit::DAILY: <span class="keywordflow">return</span> 3; <a name="l01182"></a>01182 <span class="keywordflow">case</span> RecurrenceEdit::SUBDAILY: <span class="keywordflow">return</span> 2; <a name="l01183"></a>01183 <span class="keywordflow">case</span> RecurrenceEdit::AT_LOGIN: <span class="keywordflow">return</span> 1; <a name="l01184"></a>01184 <span class="keywordflow">case</span> RecurrenceEdit::NO_RECUR: <a name="l01185"></a>01185 <span class="keywordflow">default</span>: <span class="keywordflow">return</span> 0; <a name="l01186"></a>01186 } <a name="l01187"></a>01187 } <a name="l01188"></a>01188 <a name="l01189"></a>01189 QString EditPrefTab::validate() <a name="l01190"></a>01190 { <a name="l01191"></a>01191 <span class="keywordflow">if</span> (mSound->currentItem() == SoundPicker::PLAY_FILE && mSoundFile->text().isEmpty()) <a name="l01192"></a>01192 { <a name="l01193"></a>01193 mSoundFile->setFocus(); <a name="l01194"></a>01194 <span class="keywordflow">return</span> i18n(<span class="stringliteral">"You must enter a sound file when %1 is selected as the default sound type"</span>).arg(SoundPicker::i18n_File());; <a name="l01195"></a>01195 } <a name="l01196"></a>01196 <span class="keywordflow">return</span> QString::null; <a name="l01197"></a>01197 } <a name="l01198"></a>01198 <a name="l01199"></a>01199 <a name="l01200"></a>01200 <span class="comment">/*=============================================================================</span> <a name="l01201"></a>01201 <span class="comment">= Class ViewPrefTab</span> <a name="l01202"></a>01202 <span class="comment">=============================================================================*/</span> <a name="l01203"></a>01203 <a name="l01204"></a>01204 ViewPrefTab::ViewPrefTab(QVBox* frame) <a name="l01205"></a>01205 : PrefsTabBase(frame) <a name="l01206"></a>01206 { <a name="l01207"></a>01207 QGroupBox* group = <span class="keyword">new</span> QGroupBox(i18n(<span class="stringliteral">"System Tray Tooltip"</span>), mPage); <a name="l01208"></a>01208 QGridLayout* grid = <span class="keyword">new</span> QGridLayout(group, 5, 3, KDialog::marginHint(), KDialog::spacingHint()); <a name="l01209"></a>01209 grid->setColStretch(2, 1); <a name="l01210"></a>01210 grid->addColSpacing(0, indentWidth()); <a name="l01211"></a>01211 grid->addColSpacing(1, indentWidth()); <a name="l01212"></a>01212 grid->addRowSpacing(0, fontMetrics().lineSpacing()/2); <a name="l01213"></a>01213 <a name="l01214"></a>01214 mTooltipShowAlarms = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"Show next &24 hours' alarms"</span>), group, <span class="stringliteral">"tooltipShow"</span>); <a name="l01215"></a>01215 mTooltipShowAlarms->setMinimumSize(mTooltipShowAlarms->sizeHint()); <a name="l01216"></a>01216 connect(mTooltipShowAlarms, SIGNAL(toggled(<span class="keywordtype">bool</span>)), SLOT(slotTooltipAlarmsToggled(<span class="keywordtype">bool</span>))); <a name="l01217"></a>01217 QWhatsThis::add(mTooltipShowAlarms, <a name="l01218"></a>01218 i18n(<span class="stringliteral">"Specify whether to include in the system tray tooltip, a summary of alarms due in the next 24 hours"</span>)); <a name="l01219"></a>01219 grid->addMultiCellWidget(mTooltipShowAlarms, 1, 1, 0, 2, Qt::AlignAuto); <a name="l01220"></a>01220 <a name="l01221"></a>01221 QHBox* box = <span class="keyword">new</span> QHBox(group); <a name="l01222"></a>01222 box->setSpacing(KDialog::spacingHint()); <a name="l01223"></a>01223 mTooltipMaxAlarms = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"Ma&ximum number of alarms to show:"</span>), box, <span class="stringliteral">"tooltipMax"</span>); <a name="l01224"></a>01224 mTooltipMaxAlarms->setMinimumSize(mTooltipMaxAlarms->sizeHint()); <a name="l01225"></a>01225 connect(mTooltipMaxAlarms, SIGNAL(toggled(<span class="keywordtype">bool</span>)), SLOT(slotTooltipMaxToggled(<span class="keywordtype">bool</span>))); <a name="l01226"></a>01226 mTooltipMaxAlarmCount = <span class="keyword">new</span> SpinBox(1, 99, 1, box); <a name="l01227"></a>01227 mTooltipMaxAlarmCount->setLineShiftStep(5); <a name="l01228"></a>01228 mTooltipMaxAlarmCount->setMinimumSize(mTooltipMaxAlarmCount->sizeHint()); <a name="l01229"></a>01229 QWhatsThis::add(box, <a name="l01230"></a>01230 i18n(<span class="stringliteral">"Uncheck to display all of the next 24 hours' alarms in the system tray tooltip. "</span> <a name="l01231"></a>01231 <span class="stringliteral">"Check to enter an upper limit on the number to be displayed."</span>)); <a name="l01232"></a>01232 grid->addMultiCellWidget(box, 2, 2, 1, 2, Qt::AlignAuto); <a name="l01233"></a>01233 <a name="l01234"></a>01234 mTooltipShowTime = <span class="keyword">new</span> QCheckBox(MainWindow::i18n_m_ShowAlarmTime(), group, <span class="stringliteral">"tooltipTime"</span>); <a name="l01235"></a>01235 mTooltipShowTime->setMinimumSize(mTooltipShowTime->sizeHint()); <a name="l01236"></a>01236 connect(mTooltipShowTime, SIGNAL(toggled(<span class="keywordtype">bool</span>)), SLOT(slotTooltipTimeToggled(<span class="keywordtype">bool</span>))); <a name="l01237"></a>01237 QWhatsThis::add(mTooltipShowTime, <a name="l01238"></a>01238 i18n(<span class="stringliteral">"Specify whether to show in the system tray tooltip, the time at which each alarm is due"</span>)); <a name="l01239"></a>01239 grid->addMultiCellWidget(mTooltipShowTime, 3, 3, 1, 2, Qt::AlignAuto); <a name="l01240"></a>01240 <a name="l01241"></a>01241 mTooltipShowTimeTo = <span class="keyword">new</span> QCheckBox(MainWindow::i18n_l_ShowTimeToAlarm(), group, <span class="stringliteral">"tooltipTimeTo"</span>); <a name="l01242"></a>01242 mTooltipShowTimeTo->setMinimumSize(mTooltipShowTimeTo->sizeHint()); <a name="l01243"></a>01243 connect(mTooltipShowTimeTo, SIGNAL(toggled(<span class="keywordtype">bool</span>)), SLOT(slotTooltipTimeToToggled(<span class="keywordtype">bool</span>))); <a name="l01244"></a>01244 QWhatsThis::add(mTooltipShowTimeTo, <a name="l01245"></a>01245 i18n(<span class="stringliteral">"Specify whether to show in the system tray tooltip, how long until each alarm is due"</span>)); <a name="l01246"></a>01246 grid->addMultiCellWidget(mTooltipShowTimeTo, 4, 4, 1, 2, Qt::AlignAuto); <a name="l01247"></a>01247 <a name="l01248"></a>01248 box = <span class="keyword">new</span> QHBox(group); <span class="comment">// this is to control the QWhatsThis text display area</span> <a name="l01249"></a>01249 box->setSpacing(KDialog::spacingHint()); <a name="l01250"></a>01250 mTooltipTimeToPrefixLabel = <span class="keyword">new</span> QLabel(i18n(<span class="stringliteral">"&Prefix:"</span>), box); <a name="l01251"></a>01251 mTooltipTimeToPrefixLabel->setFixedSize(mTooltipTimeToPrefixLabel->sizeHint()); <a name="l01252"></a>01252 mTooltipTimeToPrefix = <span class="keyword">new</span> QLineEdit(box); <a name="l01253"></a>01253 mTooltipTimeToPrefixLabel->setBuddy(mTooltipTimeToPrefix); <a name="l01254"></a>01254 QWhatsThis::add(box, <a name="l01255"></a>01255 i18n(<span class="stringliteral">"Enter the text to be displayed in front of the time until the alarm, in the system tray tooltip"</span>)); <a name="l01256"></a>01256 box->setFixedHeight(box->sizeHint().height()); <a name="l01257"></a>01257 grid->addWidget(box, 5, 2, Qt::AlignAuto); <a name="l01258"></a>01258 group->setMaximumHeight(group->sizeHint().height()); <a name="l01259"></a>01259 <a name="l01260"></a>01260 mModalMessages = <span class="keyword">new</span> QCheckBox(i18n(<span class="stringliteral">"Message &windows have a title bar and take keyboard focus"</span>), mPage, <span class="stringliteral">"modalMsg"</span>); <a name="l01261"></a>01261 mModalMessages->setMinimumSize(mModalMessages->sizeHint()); <a name="l01262"></a>01262 QWhatsThis::add(mModalMessages, <a name="l01263"></a>01263 i18n(<span class="stringliteral">"Specify the characteristics of alarm message windows:\n"</span> <a name="l01264"></a>01264 <span class="stringliteral">"- If checked, the window is a normal window with a title bar, which grabs keyboard input when it is displayed.\n"</span> <a name="l01265"></a>01265 <span class="stringliteral">"- If unchecked, the window does not interfere with your typing when "</span> <a name="l01266"></a>01266 <span class="stringliteral">"it is displayed, but it has no title bar and cannot be moved or resized."</span>)); <a name="l01267"></a>01267 <a name="l01268"></a>01268 QHBox* itemBox = <span class="keyword">new</span> QHBox(mPage); <span class="comment">// this is to control the QWhatsThis text display area</span> <a name="l01269"></a>01269 box = <span class="keyword">new</span> QHBox(itemBox); <a name="l01270"></a>01270 box->setSpacing(KDialog::spacingHint()); <a name="l01271"></a>01271 QLabel* label = <span class="keyword">new</span> QLabel(i18n(<span class="stringliteral">"System tray icon &update interval:"</span>), box); <a name="l01272"></a>01272 mDaemonTrayCheckInterval = <span class="keyword">new</span> SpinBox(1, 9999, 1, box, <span class="stringliteral">"daemonCheck"</span>); <a name="l01273"></a>01273 mDaemonTrayCheckInterval->setLineShiftStep(10); <a name="l01274"></a>01274 mDaemonTrayCheckInterval->setMinimumSize(mDaemonTrayCheckInterval->sizeHint()); <a name="l01275"></a>01275 label->setBuddy(mDaemonTrayCheckInterval); <a name="l01276"></a>01276 label = <span class="keyword">new</span> QLabel(i18n(<span class="stringliteral">"seconds"</span>), box); <a name="l01277"></a>01277 QWhatsThis::add(box, <a name="l01278"></a>01278 i18n(<span class="stringliteral">"How often to update the system tray icon to indicate whether or not the Alarm Daemon is monitoring alarms."</span>)); <a name="l01279"></a>01279 itemBox->setStretchFactor(<span class="keyword">new</span> QWidget(itemBox), 1); <span class="comment">// left adjust the controls</span> <a name="l01280"></a>01280 itemBox->setFixedHeight(box->sizeHint().height()); <a name="l01281"></a>01281 <a name="l01282"></a>01282 mPage->setStretchFactor(<span class="keyword">new</span> QWidget(mPage), 1); <span class="comment">// top adjust the widgets</span> <a name="l01283"></a>01283 } <a name="l01284"></a>01284 <a name="l01285"></a>01285 <span class="keywordtype">void</span> ViewPrefTab::restore() <a name="l01286"></a>01286 { <a name="l01287"></a>01287 setTooltip(Preferences::mTooltipAlarmCount, <a name="l01288"></a>01288 Preferences::mShowTooltipAlarmTime, <a name="l01289"></a>01289 Preferences::mShowTooltipTimeToAlarm, <a name="l01290"></a>01290 Preferences::mTooltipTimeToPrefix); <a name="l01291"></a>01291 mModalMessages->setChecked(Preferences::mModalMessages); <a name="l01292"></a>01292 mDaemonTrayCheckInterval->setValue(Preferences::mDaemonTrayCheckInterval); <a name="l01293"></a>01293 } <a name="l01294"></a>01294 <a name="l01295"></a>01295 <span class="keywordtype">void</span> ViewPrefTab::apply(<span class="keywordtype">bool</span> syncToDisc) <a name="l01296"></a>01296 { <a name="l01297"></a>01297 <span class="keywordtype">int</span> n = mTooltipShowAlarms->isChecked() ? -1 : 0; <a name="l01298"></a>01298 <span class="keywordflow">if</span> (n && mTooltipMaxAlarms->isChecked()) <a name="l01299"></a>01299 n = mTooltipMaxAlarmCount->value(); <a name="l01300"></a>01300 Preferences::mTooltipAlarmCount = n; <a name="l01301"></a>01301 Preferences::mShowTooltipAlarmTime = mTooltipShowTime->isChecked(); <a name="l01302"></a>01302 Preferences::mShowTooltipTimeToAlarm = mTooltipShowTimeTo->isChecked(); <a name="l01303"></a>01303 Preferences::mTooltipTimeToPrefix = mTooltipTimeToPrefix->text(); <a name="l01304"></a>01304 Preferences::mModalMessages = mModalMessages->isChecked(); <a name="l01305"></a>01305 Preferences::mDaemonTrayCheckInterval = mDaemonTrayCheckInterval->value(); <a name="l01306"></a>01306 PrefsTabBase::apply(syncToDisc); <a name="l01307"></a>01307 } <a name="l01308"></a>01308 <a name="l01309"></a>01309 <span class="keywordtype">void</span> ViewPrefTab::setDefaults() <a name="l01310"></a>01310 { <a name="l01311"></a>01311 setTooltip(Preferences::default_tooltipAlarmCount, <a name="l01312"></a>01312 Preferences::default_showTooltipAlarmTime, <a name="l01313"></a>01313 Preferences::default_showTooltipTimeToAlarm, <a name="l01314"></a>01314 Preferences::default_tooltipTimeToPrefix); <a name="l01315"></a>01315 mModalMessages->setChecked(Preferences::default_modalMessages); <a name="l01316"></a>01316 mDaemonTrayCheckInterval->setValue(Preferences::default_daemonTrayCheckInterval); <a name="l01317"></a>01317 } <a name="l01318"></a>01318 <a name="l01319"></a>01319 <span class="keywordtype">void</span> ViewPrefTab::setTooltip(<span class="keywordtype">int</span> maxAlarms, <span class="keywordtype">bool</span> time, <span class="keywordtype">bool</span> timeTo, <span class="keyword">const</span> QString& prefix) <a name="l01320"></a>01320 { <a name="l01321"></a>01321 <span class="keywordflow">if</span> (!timeTo) <a name="l01322"></a>01322 time = <span class="keyword">true</span>; <span class="comment">// ensure that at least one time option is ticked</span> <a name="l01323"></a>01323 <a name="l01324"></a>01324 <span class="comment">// Set the states of the controls without calling signal</span> <a name="l01325"></a>01325 <span class="comment">// handlers, since these could change the checkboxes' states.</span> <a name="l01326"></a>01326 mTooltipShowAlarms->blockSignals(<span class="keyword">true</span>); <a name="l01327"></a>01327 mTooltipShowTime->blockSignals(<span class="keyword">true</span>); <a name="l01328"></a>01328 mTooltipShowTimeTo->blockSignals(<span class="keyword">true</span>); <a name="l01329"></a>01329 <a name="l01330"></a>01330 mTooltipShowAlarms->setChecked(maxAlarms); <a name="l01331"></a>01331 mTooltipMaxAlarms->setChecked(maxAlarms > 0); <a name="l01332"></a>01332 mTooltipMaxAlarmCount->setValue(maxAlarms > 0 ? maxAlarms : 1); <a name="l01333"></a>01333 mTooltipShowTime->setChecked(time); <a name="l01334"></a>01334 mTooltipShowTimeTo->setChecked(timeTo); <a name="l01335"></a>01335 mTooltipTimeToPrefix->setText(prefix); <a name="l01336"></a>01336 <a name="l01337"></a>01337 mTooltipShowAlarms->blockSignals(<span class="keyword">false</span>); <a name="l01338"></a>01338 mTooltipShowTime->blockSignals(<span class="keyword">false</span>); <a name="l01339"></a>01339 mTooltipShowTimeTo->blockSignals(<span class="keyword">false</span>); <a name="l01340"></a>01340 <a name="l01341"></a>01341 <span class="comment">// Enable/disable controls according to their states</span> <a name="l01342"></a>01342 slotTooltipTimeToToggled(timeTo); <a name="l01343"></a>01343 slotTooltipAlarmsToggled(maxAlarms); <a name="l01344"></a>01344 } <a name="l01345"></a>01345 <a name="l01346"></a>01346 <span class="keywordtype">void</span> ViewPrefTab::slotTooltipAlarmsToggled(<span class="keywordtype">bool</span> on) <a name="l01347"></a>01347 { <a name="l01348"></a>01348 mTooltipMaxAlarms->setEnabled(on); <a name="l01349"></a>01349 mTooltipMaxAlarmCount->setEnabled(on && mTooltipMaxAlarms->isChecked()); <a name="l01350"></a>01350 mTooltipShowTime->setEnabled(on); <a name="l01351"></a>01351 mTooltipShowTimeTo->setEnabled(on); <a name="l01352"></a>01352 on = on && mTooltipShowTimeTo->isChecked(); <a name="l01353"></a>01353 mTooltipTimeToPrefix->setEnabled(on); <a name="l01354"></a>01354 mTooltipTimeToPrefixLabel->setEnabled(on); <a name="l01355"></a>01355 } <a name="l01356"></a>01356 <a name="l01357"></a>01357 <span class="keywordtype">void</span> ViewPrefTab::slotTooltipMaxToggled(<span class="keywordtype">bool</span> on) <a name="l01358"></a>01358 { <a name="l01359"></a>01359 mTooltipMaxAlarmCount->setEnabled(on && mTooltipMaxAlarms->isEnabled()); <a name="l01360"></a>01360 } <a name="l01361"></a>01361 <a name="l01362"></a>01362 <span class="keywordtype">void</span> ViewPrefTab::slotTooltipTimeToggled(<span class="keywordtype">bool</span> on) <a name="l01363"></a>01363 { <a name="l01364"></a>01364 <span class="keywordflow">if</span> (!on && !mTooltipShowTimeTo->isChecked()) <a name="l01365"></a>01365 mTooltipShowTimeTo->setChecked(<span class="keyword">true</span>); <a name="l01366"></a>01366 } <a name="l01367"></a>01367 <a name="l01368"></a>01368 <span class="keywordtype">void</span> ViewPrefTab::slotTooltipTimeToToggled(<span class="keywordtype">bool</span> on) <a name="l01369"></a>01369 { <a name="l01370"></a>01370 <span class="keywordflow">if</span> (!on && !mTooltipShowTime->isChecked()) <a name="l01371"></a>01371 mTooltipShowTime->setChecked(<span class="keyword">true</span>); <a name="l01372"></a>01372 on = on && mTooltipShowTimeTo->isEnabled(); <a name="l01373"></a>01373 mTooltipTimeToPrefix->setEnabled(on); <a name="l01374"></a>01374 mTooltipTimeToPrefixLabel->setEnabled(on); <a name="l01375"></a>01375 } </pre></div></div> </div></div> </td> </tr> <tr> <td valign="top" id="leftmenu" width="25%"> <a name="navigation"></a> <div class="menu_box"><h2>kalarm</h2> <div class="nav_list"> <ul><li><a href="index.html">Main Page</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="functions.html">Class Members</a></li></ul> <!-- <h2>Class Picker</h2> <div style="text-align: center;"> <form name="guideform"> <select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value"> <option value="annotated.html">-- Choose --</option> <option value="classAlarmCalendar.html">alarmcalendar</option>, <option value="classKAEvent.html">kaevent</option>, <option value="classKAlarmIface.html">kalarmiface</option>, <option value="classMainWindowBase.html">mainwindowbase</option>, <option value="classMessageWin.html">messagewin</option>, <option value="classPickFileRadio.html">pickfileradio</option>, <option value="classStartOfDayTimer.html">startofdaytimer</option>, </select> </form> </div> --> </div></div> <div class="menu_box"><h2>API Dox</h2> <div class="nav_list"> <ul> <li><a href="../../akregator/html/index.html">akregator</a></li><li> <a href="../../akregator/src/html/index.html">src</a></li><li> <a href="../../akregator/src/librss/html/index.html">librss</a></li><li><a href="../../certmanager/html/index.html">certmanager</a></li><li> <a href="../../certmanager/lib/html/index.html">lib</a></li><li><a href="../../kaddressbook/html/index.html">kaddressbook</a></li><li><a href="../../kalarm/html/index.html">kalarm</a></li><li> <a href="../../kalarm/lib/html/index.html">lib</a></li><li><a href="../../kandy/html/index.html">kandy</a></li><li><a href="../../karm/html/index.html">karm</a></li><li><a href="../../kdgantt/html/index.html">kdgantt</a></li><li><a href="../../kgantt/html/index.html">kgantt</a></li><li><a href="../../kioslaves/html/index.html">kioslaves</a></li><li> <a href="../../kioslaves/imap4/html/index.html">imap4</a></li><li> <a href="../../kioslaves/mbox/html/index.html">mbox</a></li><li><a href="../../kitchensync/html/index.html">kitchensync</a></li><li><a href="../../kmail/html/index.html">kmail</a></li><li><a href="../../knotes/html/index.html">knotes</a></li><li><a href="../../konsolekalendar/html/index.html">konsolekalendar</a></li><li><a href="../../kontact/html/index.html">kontact</a></li><li><a href="../../korganizer/html/index.html">korganizer</a></li><li><a href="../../kpilot/html/index.html">kpilot</a></li><li> <a href="../../kpilot/kpilot/html/index.html">kpilot</a></li><li> <a href="../../kpilot/lib/html/index.html">lib</a></li><li><a href="../../libemailfunctions/html/index.html">libemailfunctions</a></li><li><a href="../../libkcal/html/index.html">libkcal</a></li><li><a href="../../libkdepim/html/index.html">libkdepim</a></li><li><a href="../../libkholidays/html/index.html">libkholidays</a></li><li><a href="../../libkmime/html/index.html">libkmime</a></li><li><a href="../../libkpgp/html/index.html">libkpgp</a></li><li><a href="../../libkpimidentities/html/index.html">libkpimidentities</a></li> </ul></div></div> </td> </tr> </table> <span class="doNotDisplay"> <a href="http://www.kde.org/" accesskey="8">KDE Home</a> | <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> | <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a> </span> <div style="height: 8px"></div> <div id="footer"> <div id="footer_left"> Maintained by <a href="mailto:groot@kde.org">Adriaan de Groot</a> and <a href="mailto:winter@kde.org">Allen Winter</a>. <br/> KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> | <a href="http://www.kde.org/contact/impressum.php">Legal</a> </div> <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div> </div> <!-- WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL BE BLOCKED INSTANTLY AND PERMANENTLY! <a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a> WARNING END --> </body> </html>