summaryrefslogtreecommitdiffabout
path: root/kmicromail/koprefsdialog.cpp
Unidiff
Diffstat (limited to 'kmicromail/koprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/koprefsdialog.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp
index 4af4a8c..40347cc 100644
--- a/kmicromail/koprefsdialog.cpp
+++ b/kmicromail/koprefsdialog.cpp
@@ -1,267 +1,271 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#include <kdialog.h> 23#include <kdialog.h>
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qvbox.h> 34#include <qvbox.h>
35#include <qhbox.h> 35#include <qhbox.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44 44
45#include <kcolorbutton.h> 45#include <kcolorbutton.h>
46#include <kdebug.h> 46#include <kdebug.h>
47#include <klocale.h> 47#include <klocale.h>
48#include <kglobal.h> 48#include <kglobal.h>
49#include <kfontdialog.h> 49#include <kfontdialog.h>
50#include <kfiledialog.h> 50#include <kfiledialog.h>
51#include <kmessagebox.h> 51#include <kmessagebox.h>
52#include <kcolordialog.h> 52#include <kcolordialog.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54#include <kemailsettings.h> 54#include <kemailsettings.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56 56
57#include <klineedit.h> 57#include <klineedit.h>
58 58
59 59
60#include "koprefs.h" 60#include "koprefs.h"
61 61
62#include "koprefsdialog.h" 62#include "koprefsdialog.h"
63//#include <kprefswidget.h> 63//#include <kprefswidget.h>
64 64
65 65
66KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 66KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
67 KPrefsDialog(KOPrefs::instance(),parent,name,true) 67 KPrefsDialog(KOPrefs::instance(),parent,name,true)
68{ 68{
69 69
70 setCaption( i18n("Settings - some need a restart (nr)")); 70 setCaption( i18n("Settings - some need a restart (nr)"));
71 setupGlobalTab(); 71 setupGlobalTab();
72 setupMainTab(); 72 setupMainTab();
73 setupMailTab();; 73 setupMailTab();;
74 setupFontsTab(); 74 setupFontsTab();
75 readConfig(); 75 readConfig();
76#ifndef DESKTOP_VERSION
77 if ( QApplication::desktop()->height() == 480 )
78 hideButtons();
79#endif
76 80
77#if 0 81#if 0
78 82
79 setupMainTab(); 83 setupMainTab();
80 setupLocaleTab(); 84 setupLocaleTab();
81 setupTimeZoneTab(); 85 setupTimeZoneTab();
82 setupTimeTab(); 86 setupTimeTab();
83 setupLocaleDateTab(); 87 setupLocaleDateTab();
84 setupFontsTab(); 88 setupFontsTab();
85 setupColorsTab(); 89 setupColorsTab();
86 setupViewsTab(); 90 setupViewsTab();
87 //setupSyncTab(); 91 //setupSyncTab();
88 //setupSyncAlgTab(); 92 //setupSyncAlgTab();
89 //setupPrinterTab(); 93 //setupPrinterTab();
90 //setupGroupSchedulingTab(); 94 //setupGroupSchedulingTab();
91 //setupGroupAutomationTab(); 95 //setupGroupAutomationTab();
92#endif 96#endif
93} 97}
94 98
95#include "kpimglobalprefs.h" 99#include "kpimglobalprefs.h"
96 100
97KOPrefsDialog::~KOPrefsDialog() 101KOPrefsDialog::~KOPrefsDialog()
98{ 102{
99} 103}
100void KOPrefsDialog::setupGlobalTab() 104void KOPrefsDialog::setupGlobalTab()
101{ 105{
102 QFrame *topFrame = addPage(i18n("Global"),0,0); 106 QFrame *topFrame = addPage(i18n("Global"),0,0);
103 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); 107 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" );
104 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 108 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
105 topLayout->addWidget( kdelibcfg ); 109 topLayout->addWidget( kdelibcfg );
106 110
107 111
108} 112}
109void KOPrefsDialog::setupMainTab() 113void KOPrefsDialog::setupMainTab()
110{ 114{
111 QFrame *topFrame = addPage(i18n("General"),0,0); 115 QFrame *topFrame = addPage(i18n("General"),0,0);
112 116
113 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 117 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
114 topLayout->setSpacing(spacingHint()); 118 topLayout->setSpacing(spacingHint());
115 topLayout->setMargin(marginHint()); 119 topLayout->setMargin(marginHint());
116 120
117 121
118 mNameEdit = new QLineEdit(topFrame); 122 mNameEdit = new QLineEdit(topFrame);
119 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 123 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
120 topLayout->addWidget(mNameLabel,0,0); 124 topLayout->addWidget(mNameLabel,0,0);
121 topLayout->addWidget(mNameEdit,0,1); 125 topLayout->addWidget(mNameEdit,0,1);
122 126
123 mEmailEdit = new QLineEdit(topFrame); 127 mEmailEdit = new QLineEdit(topFrame);
124 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 128 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
125 topLayout->addWidget(mEmailLabel,1,0); 129 topLayout->addWidget(mEmailLabel,1,0);
126 topLayout->addWidget(mEmailEdit,1,1); 130 topLayout->addWidget(mEmailEdit,1,1);
127 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame); 131 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame);
128 topLayout->addMultiCellWidget(lab,2,2,0,1); 132 topLayout->addMultiCellWidget(lab,2,2,0,1);
129 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"), 133 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"),
130 &(KOPrefs::instance()->mUseKapi),topFrame); 134 &(KOPrefs::instance()->mUseKapi),topFrame);
131 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1); 135 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1);
132} 136}
133 137
134void KOPrefsDialog::setupMailTab() 138void KOPrefsDialog::setupMailTab()
135{ 139{
136 QFrame *topFrame = addPage(i18n("Mail"),0,0); 140 QFrame *topFrame = addPage(i18n("Mail"),0,0);
137 141
138 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 142 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
139 topLayout->setSpacing(spacingHint()); 143 topLayout->setSpacing(spacingHint());
140 topLayout->setMargin(marginHint()); 144 topLayout->setMargin(marginHint());
141 145
142 KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"), 146 KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"),
143 &(KOPrefs::instance()->mViewAsHtml),topFrame); 147 &(KOPrefs::instance()->mViewAsHtml),topFrame);
144 topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); 148 topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1);
145 149
146 150
147 ttt = addWidBool(i18n("Send mails later"), 151 ttt = addWidBool(i18n("Send mails later"),
148 &(KOPrefs::instance()->mSendLater),topFrame); 152 &(KOPrefs::instance()->mSendLater),topFrame);
149 topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); 153 topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1);
150 ttt = addWidBool(i18n("Show \"To\" field in list view"), 154 ttt = addWidBool(i18n("Show \"To\" field in list view"),
151 &(KOPrefs::instance()->mShowToField),topFrame); 155 &(KOPrefs::instance()->mShowToField),topFrame);
152 topLayout->addMultiCellWidget(ttt->checkBox(),2,2,0,1); 156 topLayout->addMultiCellWidget(ttt->checkBox(),2,2,0,1);
153 157
154 int iii =3; 158 int iii =3;
155 ttt = addWidBool(i18n("Show info fields at startup"), 159 ttt = addWidBool(i18n("Show info fields at startup"),
156 &(KOPrefs::instance()->mShowInfoStart),topFrame); 160 &(KOPrefs::instance()->mShowInfoStart),topFrame);
157 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); 161 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
158 ++iii; 162 ++iii;
159 ttt = addWidBool(i18n("Show \"Subject\" info field"), 163 ttt = addWidBool(i18n("Show \"Subject\" info field"),
160 &(KOPrefs::instance()->mShowInfoSub),topFrame); 164 &(KOPrefs::instance()->mShowInfoSub),topFrame);
161 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); 165 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
162 ++iii; 166 ++iii;
163 ttt = addWidBool(i18n("Show \"From\" info field"), 167 ttt = addWidBool(i18n("Show \"From\" info field"),
164 &(KOPrefs::instance()->mShowInfoFrom),topFrame); 168 &(KOPrefs::instance()->mShowInfoFrom),topFrame);
165 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); 169 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
166 ++iii; 170 ++iii;
167 ttt = addWidBool(i18n("Show \"To\" info field"), 171 ttt = addWidBool(i18n("Show \"To\" info field"),
168 &(KOPrefs::instance()->mShowInfoTo),topFrame); 172 &(KOPrefs::instance()->mShowInfoTo),topFrame);
169 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); 173 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
170 ++iii; 174 ++iii;
171 175
172 /* 176 /*
173 mCodecEdit = new QLineEdit(topFrame); 177 mCodecEdit = new QLineEdit(topFrame);
174 topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1); 178 topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1);
175 topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1); 179 topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1);
176 topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1); 180 topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1);
177 */ 181 */
178} 182}
179void KOPrefsDialog::setupFontsTab() 183void KOPrefsDialog::setupFontsTab()
180{ 184{
181 185
182 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 186 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
183 // DesktopIcon("fonts",KIcon::SizeMedium)); 187 // DesktopIcon("fonts",KIcon::SizeMedium));
184 188
185 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 189 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
186 topLayout->setSpacing(1); 190 topLayout->setSpacing(1);
187 topLayout->setMargin(3); 191 topLayout->setMargin(3);
188 KPrefsDialogWidFont * tVFont; 192 KPrefsDialogWidFont * tVFont;
189 int i = 0; 193 int i = 0;
190 KPrefsDialogWidFont *timeLabelsFont = 194 KPrefsDialogWidFont *timeLabelsFont =
191 addWidFont(i18n("OK"),i18n("Application(nr)"), 195 addWidFont(i18n("OK"),i18n("Application(nr)"),
192 &(KOPrefs::instance()->mAppFont),topFrame); 196 &(KOPrefs::instance()->mAppFont),topFrame);
193 topLayout->addWidget(timeLabelsFont->label(),i,0); 197 topLayout->addWidget(timeLabelsFont->label(),i,0);
194 topLayout->addWidget(timeLabelsFont->preview(),i,1); 198 topLayout->addWidget(timeLabelsFont->preview(),i,1);
195 topLayout->addWidget(timeLabelsFont->button(),i,2); 199 topLayout->addWidget(timeLabelsFont->button(),i,2);
196 ++i; 200 ++i;
197 201
198 202
199 timeLabelsFont = 203 timeLabelsFont =
200 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), 204 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"),
201 &(KOPrefs::instance()->mComposeFont),topFrame); 205 &(KOPrefs::instance()->mComposeFont),topFrame);
202 topLayout->addWidget(timeLabelsFont->label(),i,0); 206 topLayout->addWidget(timeLabelsFont->label(),i,0);
203 topLayout->addWidget(timeLabelsFont->preview(),i,1); 207 topLayout->addWidget(timeLabelsFont->preview(),i,1);
204 topLayout->addWidget(timeLabelsFont->button(),i,2); 208 topLayout->addWidget(timeLabelsFont->button(),i,2);
205 ++i; 209 ++i;
206 210
207 KPrefsDialogWidFont *timeBarFont = 211 KPrefsDialogWidFont *timeBarFont =
208 addWidFont(i18n("Hello"),i18n("Read mail:"), 212 addWidFont(i18n("Hello"),i18n("Read mail:"),
209 &(KOPrefs::instance()->mReadFont),topFrame); 213 &(KOPrefs::instance()->mReadFont),topFrame);
210 topLayout->addWidget(timeBarFont->label(),i,0); 214 topLayout->addWidget(timeBarFont->label(),i,0);
211 topLayout->addWidget(timeBarFont->preview(),i,1); 215 topLayout->addWidget(timeBarFont->preview(),i,1);
212 topLayout->addWidget(timeBarFont->button(),i,2); 216 topLayout->addWidget(timeBarFont->button(),i,2);
213 ++i; 217 ++i;
214 218
215 topLayout->setColStretch(1,1); 219 topLayout->setColStretch(1,1);
216 topLayout->setRowStretch(4,1); 220 topLayout->setRowStretch(4,1);
217 221
218} 222}
219void KOPrefsDialog::usrReadConfig() 223void KOPrefsDialog::usrReadConfig()
220{ 224{
221 225
222 mNameEdit->setText(KOPrefs::instance()->mName); 226 mNameEdit->setText(KOPrefs::instance()->mName);
223 mEmailEdit->setText(KOPrefs::instance()->mEmail); 227 mEmailEdit->setText(KOPrefs::instance()->mEmail);
224 //mCodecEdit->setText(KOPrefs::instance()->mSendCodec); 228 //mCodecEdit->setText(KOPrefs::instance()->mSendCodec);
225 kdelibcfg->readConfig(); 229 kdelibcfg->readConfig();
226} 230}
227void KOPrefsDialog::usrWriteConfig() 231void KOPrefsDialog::usrWriteConfig()
228{ 232{
229 KOPrefs::instance()->mName = mNameEdit->text(); 233 KOPrefs::instance()->mName = mNameEdit->text();
230 KOPrefs::instance()->mEmail = mEmailEdit->text(); 234 KOPrefs::instance()->mEmail = mEmailEdit->text();
231 //KOPrefs::instance()->mSendCodec = mCodecEdit->text(); 235 //KOPrefs::instance()->mSendCodec = mCodecEdit->text();
232 kdelibcfg->writeConfig(); 236 kdelibcfg->writeConfig();
233 237
234 238
235} 239}
236 240
237#if 0 241#if 0
238void KOPrefsDialog::setupLocaleDateTab() 242void KOPrefsDialog::setupLocaleDateTab()
239{ 243{
240QFrame *topFrame = addPage(i18n("Date Format"),0,0); 244QFrame *topFrame = addPage(i18n("Date Format"),0,0);
241 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 245 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
242 topLayout->setSpacing(spacingHint()); 246 topLayout->setSpacing(spacingHint());
243 topLayout->setMargin(marginHint()); 247 topLayout->setMargin(marginHint());
244 int iii = 0; 248 int iii = 0;
245 249
246 250
247 KPrefsWidRadios *syncPrefsGroup = 251 KPrefsWidRadios *syncPrefsGroup =
248 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 252 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
249 QString format; 253 QString format;
250 if ( QApplication::desktop()->width() < 480 ) 254 if ( QApplication::desktop()->width() < 480 )
251 format = "(%d.%m.%Y)"; 255 format = "(%d.%m.%Y)";
252 else 256 else
253 format = "(%d.%m.%Y|%A %d %B %Y)"; 257 format = "(%d.%m.%Y|%A %d %B %Y)";
254 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 258 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
255 if ( QApplication::desktop()->width() < 480 ) 259 if ( QApplication::desktop()->width() < 480 )
256 format = "(%m.%d.%Y)"; 260 format = "(%m.%d.%Y)";
257 else 261 else
258 format = "(%m.%d.%Y|%A %B %d %Y)"; 262 format = "(%m.%d.%Y|%A %B %d %Y)";
259 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 263 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
260 if ( QApplication::desktop()->width() < 480 ) 264 if ( QApplication::desktop()->width() < 480 )
261 format = "(%Y-%m-%d)"; 265 format = "(%Y-%m-%d)";
262 else 266 else
263 format = "(%Y-%m-%d|%A %Y %B %d)"; 267 format = "(%Y-%m-%d|%A %Y %B %d)";
264 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 268 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
265 syncPrefsGroup->addRadio(i18n("User defined")); 269 syncPrefsGroup->addRadio(i18n("User defined"));
266 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 270 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
267 ++iii; 271 ++iii;