abbrowser-setup.cc
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "options.h"
00031
00032 #include <qtabwidget.h>
00033 #include <qcheckbox.h>
00034 #include <qcombobox.h>
00035 #include <qbuttongroup.h>
00036
00037 #include <kconfig.h>
00038 #include <kurlrequester.h>
00039
00040 #include "kaddressbookConduit.h"
00041 #include "abbrowser-factory.h"
00042 #include "abbrowser-setup.h"
00043
00044 AbbrowserWidgetSetup::AbbrowserWidgetSetup(QWidget *w, const char *n) :
00045 ConduitConfigBase(w,n),
00046 fConfigWidget(new AbbrowserWidget(w))
00047 {
00048 FUNCTIONSETUP;
00049
00050 fConduitName=i18n("Addressbook");
00051 UIDialog::addAboutPage(fConfigWidget->tabWidget,AbbrowserConduitFactory::about());
00052 fWidget=fConfigWidget;
00053 #define CM(a,b) connect(fConfigWidget->a,b,this,SLOT(modified()));
00054 CM(fSyncDestination,SIGNAL(clicked(int)));
00055 CM(fAbookFile,SIGNAL(textChanged(const QString &)));
00056 CM(fArchive,SIGNAL(toggled(bool)));
00057 CM(fConflictResolution,SIGNAL(activated(int)));
00058 CM(fOtherPhone,SIGNAL(activated(int)));
00059 CM(fAddress,SIGNAL(activated(int)));
00060 CM(fFax,SIGNAL(activated(int)));
00061 CM(fCustom0,SIGNAL(activated(int)));
00062 CM(fCustom1,SIGNAL(activated(int)));
00063 CM(fCustom2,SIGNAL(activated(int)));
00064 CM(fCustom3,SIGNAL(activated(int)));
00065 CM(fCustomDate, SIGNAL(activated(int)));
00066 CM(fCustomDate, SIGNAL(textChanged(const QString&)));
00067 #undef CM
00068 }
00069
00070 AbbrowserWidgetSetup::~AbbrowserWidgetSetup()
00071 {
00072 FUNCTIONSETUP;
00073 }
00074
00075 void AbbrowserWidgetSetup::commit(KConfig *fConfig)
00076 {
00077 FUNCTIONSETUP;
00078
00079 if (!fConfig) return;
00080 KConfigGroupSaver s(fConfig,AbbrowserConduitFactory::group());
00081
00082
00083 fConfig->writeEntry(AbbrowserConduitFactory::fAbookType,
00084 fConfigWidget->fSyncDestination->id(
00085 fConfigWidget->fSyncDestination->selected()));
00086 fConfig->writePathEntry(AbbrowserConduitFactory::fAbookFile,
00087 fConfigWidget->fAbookFile->url());
00088 fConfig->writeEntry(AbbrowserConduitFactory::fArchive,
00089 fConfigWidget->fArchive->isChecked());
00090
00091
00092 fConfig->writeEntry(AbbrowserConduitFactory::fResolution,
00093 fConfigWidget->fConflictResolution->currentItem()+SyncAction::eCROffset);
00094
00095
00096 fConfig->writeEntry(AbbrowserConduitFactory::fOtherField,
00097 fConfigWidget->fOtherPhone->currentItem());
00098 fConfig->writeEntry(AbbrowserConduitFactory::fStreetType,
00099 fConfigWidget->fAddress->currentItem());
00100 fConfig->writeEntry(AbbrowserConduitFactory::fFaxType,
00101 fConfigWidget->fFax->currentItem());
00102
00103
00104 fConfig->writeEntry(AbbrowserConduitFactory::custom(0),
00105 fConfigWidget->fCustom0->currentItem());
00106 fConfig->writeEntry(AbbrowserConduitFactory::custom(1),
00107 fConfigWidget->fCustom1->currentItem());
00108 fConfig->writeEntry(AbbrowserConduitFactory::custom(2),
00109 fConfigWidget->fCustom2->currentItem());
00110 fConfig->writeEntry(AbbrowserConduitFactory::custom(3),
00111 fConfigWidget->fCustom3->currentItem());
00112 int fmtindex=fConfigWidget->fCustomDate->currentItem();
00113 if (fmtindex==0)
00114 {
00115
00116 fConfig->writeEntry(AbbrowserConduitFactory::fCustomFmt, QString::null);
00117 }
00118 else
00119 {
00120 fConfig->writeEntry(AbbrowserConduitFactory::fCustomFmt, fConfigWidget->fCustomDate->currentText());
00121 }
00122
00123 unmodified();
00124 }
00125
00126 void AbbrowserWidgetSetup::load(KConfig *fConfig)
00127 {
00128 FUNCTIONSETUP;
00129
00130 if (!fConfig) return;
00131 KConfigGroupSaver s(fConfig, AbbrowserConduitFactory::group());
00132
00133
00134 fConfigWidget->fSyncDestination->setButton(
00135 fConfig->readNumEntry(AbbrowserConduitFactory::fAbookType, 0));
00136 fConfigWidget->fAbookFile->setURL(
00137 fConfig->readPathEntry(AbbrowserConduitFactory::fAbookFile));
00138 fConfigWidget->fArchive->setChecked(
00139 fConfig->readBoolEntry(AbbrowserConduitFactory::fArchive, true));
00140
00141
00142 fConfigWidget->fConflictResolution->setCurrentItem(
00143 fConfig->readNumEntry(AbbrowserConduitFactory::fResolution,
00144 SyncAction::eUseGlobalSetting)-SyncAction::eCROffset);
00145
00146
00147 fConfigWidget->fOtherPhone->setCurrentItem(
00148 fConfig->readNumEntry(AbbrowserConduitFactory::fOtherField, 0));
00149 fConfigWidget->fAddress->setCurrentItem(
00150 fConfig->readNumEntry(AbbrowserConduitFactory::fStreetType, 0));
00151 fConfigWidget->fFax->setCurrentItem(
00152 fConfig->readNumEntry(AbbrowserConduitFactory::fFaxType, 0));
00153
00154
00155 fConfigWidget->fCustom0->setCurrentItem(
00156 fConfig->readNumEntry(AbbrowserConduitFactory::custom(0)));
00157 fConfigWidget->fCustom1->setCurrentItem(
00158 fConfig->readNumEntry(AbbrowserConduitFactory::custom(1)));
00159 fConfigWidget->fCustom2->setCurrentItem(
00160 fConfig->readNumEntry(AbbrowserConduitFactory::custom(2)));
00161 fConfigWidget->fCustom3->setCurrentItem(
00162 fConfig->readNumEntry(AbbrowserConduitFactory::custom(3)));
00163 QString datefmt=fConfig->readEntry(AbbrowserConduitFactory::fCustomFmt);
00164 if (datefmt.isEmpty())
00165 {
00166 fConfigWidget->fCustomDate->setCurrentItem(0);
00167 }
00168 else
00169 {
00170 fConfigWidget->fCustomDate->setCurrentText(datefmt);
00171 }
00172
00173 unmodified();
00174 }
00175
00176 ConduitConfigBase *AbbrowserWidgetSetup::create(QWidget *w, const char *n)
00177 {
00178 return new AbbrowserWidgetSetup(w,n);
00179 }
00180
This file is part of the documentation for kpilot Library Version 3.2.2.