kpilot Library API Documentation

abbrowser-setup.cc

00001 /* abbrowser-setup.cc KPilot 00002 ** 00003 ** Copyright (C) 2001 by Dan Pilone 00004 ** Copyright (C) 2002-2003 Reinhold Kainhofer 00005 ** 00006 ** This file defines the setup dialog for the abbrowser-conduit plugin. 00007 */ 00008 00009 /* 00010 ** This program is free software; you can redistribute it and/or modify 00011 ** it under the terms of the GNU General Public License as published by 00012 ** the Free Software Foundation; either version 2 of the License, or 00013 ** (at your option) any later version. 00014 ** 00015 ** This program is distributed in the hope that it will be useful, 00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 ** GNU General Public License for more details. 00019 ** 00020 ** You should have received a copy of the GNU General Public License 00021 ** along with this program in a file called COPYING; if not, write to 00022 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00023 ** MA 02111-1307, USA. 00024 */ 00025 00026 /* 00027 ** Bug reports and questions can be sent to kde-pim@kde.org 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 /* virtual */ void AbbrowserWidgetSetup::commit(KConfig *fConfig) 00076 { 00077 FUNCTIONSETUP; 00078 00079 if (!fConfig) return; 00080 KConfigGroupSaver s(fConfig,AbbrowserConduitFactory::group()); 00081 00082 // General page 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 // Conflicts page 00092 fConfig->writeEntry(AbbrowserConduitFactory::fResolution, 00093 fConfigWidget->fConflictResolution->currentItem()+SyncAction::eCROffset); 00094 00095 // Fields page 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 // Custom fields page 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 // "Locale Settings" was chosen 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 /* virtual */ void AbbrowserWidgetSetup::load(KConfig *fConfig) 00127 { 00128 FUNCTIONSETUP; 00129 00130 if (!fConfig) return; 00131 KConfigGroupSaver s(fConfig, AbbrowserConduitFactory::group()); 00132 00133 // General page 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 // Conflicts page 00142 fConfigWidget->fConflictResolution->setCurrentItem( 00143 fConfig->readNumEntry(AbbrowserConduitFactory::fResolution, 00144 SyncAction::eUseGlobalSetting)-SyncAction::eCROffset); 00145 00146 // Fields page 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 // Custom fields page 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 /* static */ ConduitConfigBase *AbbrowserWidgetSetup::create(QWidget *w, const char *n) 00177 { 00178 return new AbbrowserWidgetSetup(w,n); 00179 } 00180
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:57:48 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003