summaryrefslogtreecommitdiffabout
path: root/kmicromail/koprefsdialog.cpp
Unidiff
Diffstat (limited to 'kmicromail/koprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/koprefsdialog.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp
index 7d7bd2a..598d12f 100644
--- a/kmicromail/koprefsdialog.cpp
+++ b/kmicromail/koprefsdialog.cpp
@@ -31,99 +31,110 @@
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 64
64 65
65KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 66KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
66 KPrefsDialog(KOPrefs::instance(),parent,name,true) 67 KPrefsDialog(KOPrefs::instance(),parent,name,true)
67{ 68{
68 69
69 setCaption( i18n("Settings - some need a restart (nr)")); 70 setCaption( i18n("Settings - some need a restart (nr)"));
71 setupGlobalTab();
70 setupMainTab(); 72 setupMainTab();
71 setupMailTab();; 73 setupMailTab();;
72 setupFontsTab(); 74 setupFontsTab();
73 readConfig(); 75 readConfig();
74 76
75#if 0 77#if 0
76 78
77 setupMainTab(); 79 setupMainTab();
78 setupLocaleTab(); 80 setupLocaleTab();
79 setupTimeZoneTab(); 81 setupTimeZoneTab();
80 setupTimeTab(); 82 setupTimeTab();
81 setupLocaleDateTab(); 83 setupLocaleDateTab();
82 setupFontsTab(); 84 setupFontsTab();
83 setupColorsTab(); 85 setupColorsTab();
84 setupViewsTab(); 86 setupViewsTab();
85 //setupSyncTab(); 87 //setupSyncTab();
86 //setupSyncAlgTab(); 88 //setupSyncAlgTab();
87 //setupPrinterTab(); 89 //setupPrinterTab();
88 //setupGroupSchedulingTab(); 90 //setupGroupSchedulingTab();
89 //setupGroupAutomationTab(); 91 //setupGroupAutomationTab();
90#endif 92#endif
91} 93}
92 94
95#include "kpimglobalprefs.h"
93 96
94KOPrefsDialog::~KOPrefsDialog() 97KOPrefsDialog::~KOPrefsDialog()
95{ 98{
96} 99}
97 100void KOPrefsDialog::setupGlobalTab()
101{
102 QFrame *topFrame = addPage(i18n("Global"),0,0);
103 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" );
104 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
105 topLayout->addWidget( kdelibcfg );
106
107
108}
98void KOPrefsDialog::setupMainTab() 109void KOPrefsDialog::setupMainTab()
99{ 110{
100 QFrame *topFrame = addPage(i18n("General"),0,0); 111 QFrame *topFrame = addPage(i18n("General"),0,0);
101 112
102 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 113 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
103 topLayout->setSpacing(spacingHint()); 114 topLayout->setSpacing(spacingHint());
104 topLayout->setMargin(marginHint()); 115 topLayout->setMargin(marginHint());
105 116
106 117
107 mNameEdit = new QLineEdit(topFrame); 118 mNameEdit = new QLineEdit(topFrame);
108 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 119 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
109 topLayout->addWidget(mNameLabel,0,0); 120 topLayout->addWidget(mNameLabel,0,0);
110 topLayout->addWidget(mNameEdit,0,1); 121 topLayout->addWidget(mNameEdit,0,1);
111 122
112 mEmailEdit = new QLineEdit(topFrame); 123 mEmailEdit = new QLineEdit(topFrame);
113 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 124 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
114 topLayout->addWidget(mEmailLabel,1,0); 125 topLayout->addWidget(mEmailLabel,1,0);
115 topLayout->addWidget(mEmailEdit,1,1); 126 topLayout->addWidget(mEmailEdit,1,1);
116 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame); 127 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame);
117 topLayout->addMultiCellWidget(lab,2,2,0,1); 128 topLayout->addMultiCellWidget(lab,2,2,0,1);
118 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"), 129 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"),
119 &(KOPrefs::instance()->mUseKapi),topFrame); 130 &(KOPrefs::instance()->mUseKapi),topFrame);
120 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1); 131 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1);
121} 132}
122 133
123void KOPrefsDialog::setupMailTab() 134void KOPrefsDialog::setupMailTab()
124{ 135{
125 QFrame *topFrame = addPage(i18n("Mail"),0,0); 136 QFrame *topFrame = addPage(i18n("Mail"),0,0);
126 137
127 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 138 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
128 topLayout->setSpacing(spacingHint()); 139 topLayout->setSpacing(spacingHint());
129 topLayout->setMargin(marginHint()); 140 topLayout->setMargin(marginHint());
@@ -152,73 +163,74 @@ void KOPrefsDialog::setupFontsTab()
152 int i = 0; 163 int i = 0;
153 KPrefsDialogWidFont *timeLabelsFont = 164 KPrefsDialogWidFont *timeLabelsFont =
154 addWidFont(i18n("OK"),i18n("Application(nr)"), 165 addWidFont(i18n("OK"),i18n("Application(nr)"),
155 &(KOPrefs::instance()->mAppFont),topFrame); 166 &(KOPrefs::instance()->mAppFont),topFrame);
156 topLayout->addWidget(timeLabelsFont->label(),i,0); 167 topLayout->addWidget(timeLabelsFont->label(),i,0);
157 topLayout->addWidget(timeLabelsFont->preview(),i,1); 168 topLayout->addWidget(timeLabelsFont->preview(),i,1);
158 topLayout->addWidget(timeLabelsFont->button(),i,2); 169 topLayout->addWidget(timeLabelsFont->button(),i,2);
159 ++i; 170 ++i;
160 171
161 172
162 timeLabelsFont = 173 timeLabelsFont =
163 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), 174 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"),
164 &(KOPrefs::instance()->mComposeFont),topFrame); 175 &(KOPrefs::instance()->mComposeFont),topFrame);
165 topLayout->addWidget(timeLabelsFont->label(),i,0); 176 topLayout->addWidget(timeLabelsFont->label(),i,0);
166 topLayout->addWidget(timeLabelsFont->preview(),i,1); 177 topLayout->addWidget(timeLabelsFont->preview(),i,1);
167 topLayout->addWidget(timeLabelsFont->button(),i,2); 178 topLayout->addWidget(timeLabelsFont->button(),i,2);
168 ++i; 179 ++i;
169 180
170 KPrefsDialogWidFont *timeBarFont = 181 KPrefsDialogWidFont *timeBarFont =
171 addWidFont(i18n("Hello"),i18n("Read mail:"), 182 addWidFont(i18n("Hello"),i18n("Read mail:"),
172 &(KOPrefs::instance()->mReadFont),topFrame); 183 &(KOPrefs::instance()->mReadFont),topFrame);
173 topLayout->addWidget(timeBarFont->label(),i,0); 184 topLayout->addWidget(timeBarFont->label(),i,0);
174 topLayout->addWidget(timeBarFont->preview(),i,1); 185 topLayout->addWidget(timeBarFont->preview(),i,1);
175 topLayout->addWidget(timeBarFont->button(),i,2); 186 topLayout->addWidget(timeBarFont->button(),i,2);
176 ++i; 187 ++i;
177 188
178 topLayout->setColStretch(1,1); 189 topLayout->setColStretch(1,1);
179 topLayout->setRowStretch(4,1); 190 topLayout->setRowStretch(4,1);
180 191
181} 192}
182void KOPrefsDialog::usrReadConfig() 193void KOPrefsDialog::usrReadConfig()
183{ 194{
184 qDebug("read "); 195
185 mNameEdit->setText(KOPrefs::instance()->mName); 196 mNameEdit->setText(KOPrefs::instance()->mName);
186 mEmailEdit->setText(KOPrefs::instance()->mEmail); 197 mEmailEdit->setText(KOPrefs::instance()->mEmail);
198 kdelibcfg->readConfig();
187} 199}
188void KOPrefsDialog::usrWriteConfig() 200void KOPrefsDialog::usrWriteConfig()
189{ 201{
190 qDebug("write ");
191 KOPrefs::instance()->mName = mNameEdit->text(); 202 KOPrefs::instance()->mName = mNameEdit->text();
192 KOPrefs::instance()->mEmail = mEmailEdit->text(); 203 KOPrefs::instance()->mEmail = mEmailEdit->text();
204 kdelibcfg->writeConfig();
193 205
194 206
195} 207}
196 208
197#if 0 209#if 0
198void KOPrefsDialog::setupLocaleDateTab() 210void KOPrefsDialog::setupLocaleDateTab()
199{ 211{
200QFrame *topFrame = addPage(i18n("Date Format"),0,0); 212QFrame *topFrame = addPage(i18n("Date Format"),0,0);
201 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 213 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
202 topLayout->setSpacing(spacingHint()); 214 topLayout->setSpacing(spacingHint());
203 topLayout->setMargin(marginHint()); 215 topLayout->setMargin(marginHint());
204 int iii = 0; 216 int iii = 0;
205 217
206 218
207 KPrefsWidRadios *syncPrefsGroup = 219 KPrefsWidRadios *syncPrefsGroup =
208 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 220 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
209 QString format; 221 QString format;
210 if ( QApplication::desktop()->width() < 480 ) 222 if ( QApplication::desktop()->width() < 480 )
211 format = "(%d.%m.%Y)"; 223 format = "(%d.%m.%Y)";
212 else 224 else
213 format = "(%d.%m.%Y|%A %d %B %Y)"; 225 format = "(%d.%m.%Y|%A %d %B %Y)";
214 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 226 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
215 if ( QApplication::desktop()->width() < 480 ) 227 if ( QApplication::desktop()->width() < 480 )
216 format = "(%m.%d.%Y)"; 228 format = "(%m.%d.%Y)";
217 else 229 else
218 format = "(%m.%d.%Y|%A %B %d %Y)"; 230 format = "(%m.%d.%Y|%A %B %d %Y)";
219 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 231 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
220 if ( QApplication::desktop()->width() < 480 ) 232 if ( QApplication::desktop()->width() < 480 )
221 format = "(%Y-%m-%d)"; 233 format = "(%Y-%m-%d)";
222 else 234 else
223 format = "(%Y-%m-%d|%A %Y %B %d)"; 235 format = "(%Y-%m-%d|%A %Y %B %d)";
224 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 236 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));