kpilot Library API Documentation

vcal-setup.cc

00001 /* vcal-setup.cc                        KPilot
00002 **
00003 ** Copyright (C) 2002-2003 Reinhold Kainhofer
00004 ** Copyright (C) 2001 by Dan Pilone
00005 **
00006 ** This file defines the setup dialog for the vcal-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 
00033 #include <qtabwidget.h>
00034 #include <qcheckbox.h>
00035 #include <qbuttongroup.h>
00036 #include <qcombobox.h>
00037 
00038 #include <kconfig.h>
00039 #include <kurlrequester.h>
00040 
00041 #include "korganizerConduit.h"
00042 #include "vcal-factorybase.h"
00043 #include "vcal-setup.h"
00044 
00045 
00046 VCalWidgetSetupBase::VCalWidgetSetupBase(QWidget *w, const char *n) :
00047     ConduitConfigBase(w,n),
00048     fConfigWidget(new VCalWidget(w))
00049 {
00050     FUNCTIONSETUP;
00051     fWidget=fConfigWidget;
00052 
00053     fConfigWidget->fCalendarFile->setMode( KFile::File | KFile::LocalOnly );
00054     fConfigWidget->fCalendarFile->setFilter("*.vcs *.ics|ICalendars\n*.*|All Files (*.*)");
00055 
00056 #define CM(a,b) connect(fConfigWidget->a,b,this,SLOT(modified()));
00057     CM(fSyncDestination,SIGNAL(clicked(int)));
00058     CM(fCalendarFile,SIGNAL(textChanged(const QString &)));
00059     CM(fArchive,SIGNAL(toggled(bool)));
00060     CM(fConflictResolution,SIGNAL(activated(int)));
00061 #undef CM
00062 }
00063 
00064 VCalWidgetSetupBase::~VCalWidgetSetupBase()
00065 {
00066     FUNCTIONSETUP;
00067 }
00068 
00069 /* virtual */ void VCalWidgetSetupBase::commit(KConfig *fConfig)
00070 {
00071     FUNCTIONSETUP;
00072     if (!fConfig) return;
00073     KConfigGroupSaver s(fConfig,configGroup());
00074     // General page
00075     fConfig->writeEntry(VCalConduitFactoryBase::calendarType,
00076         fConfigWidget->fSyncDestination->id(
00077             fConfigWidget->fSyncDestination->selected()));
00078     fConfig->writePathEntry(VCalConduitFactoryBase::calendarFile,
00079         fConfigWidget->fCalendarFile->url());
00080 
00081     fConfig->writeEntry(VCalConduitFactoryBase::archive,
00082         fConfigWidget->fArchive->isChecked());
00083 
00084     // Conflicts page
00085     fConfig->writeEntry(VCalConduitFactoryBase::conflictResolution,
00086         fConfigWidget->fConflictResolution->currentItem()+SyncAction::eCROffset);
00087 
00088     unmodified();
00089 }
00090 
00091 /* virtual */ void VCalWidgetSetupBase::load(KConfig *fConfig)
00092 {
00093     FUNCTIONSETUP;
00094 
00095     if (!fConfig) return;
00096     KConfigGroupSaver s(fConfig, configGroup());
00097 
00098     // General page
00099     fConfigWidget->fSyncDestination->setButton(
00100         fConfig->readNumEntry(VCalConduitFactoryBase::calendarType, 0));
00101     fConfigWidget->fCalendarFile->setURL( fConfig->readPathEntry(
00102         VCalConduitFactoryBase::calendarFile,
00103                 CSL1("$HOME/.kde/share/apps/korganizer/calendar.ics")));
00104 
00105     fConfigWidget->fArchive->setChecked(
00106         fConfig->readBoolEntry(VCalConduitFactoryBase::archive, true));
00107 
00108     // Conflicts page
00109     fConfigWidget->fConflictResolution->setCurrentItem(
00110         fConfig->readNumEntry(VCalConduitFactoryBase::conflictResolution,
00111         SyncAction::eUseGlobalSetting)-SyncAction::eCROffset);
00112 
00113     unmodified();
00114 }
00115 
00116 VCalWidgetSetup::VCalWidgetSetup(QWidget *w, const char *n) :
00117     VCalWidgetSetupBase(w,n)
00118 {
00119     UIDialog::addAboutPage(fConfigWidget->tabWidget, VCalConduitFactoryBase::about());
00120     fConfigWidget->fSyncDestination->setTitle(i18n("Calendar Destination"));
00121     fConduitName=i18n("Calendar");
00122     fGroupName=VCalConduitFactoryBase::getGroup();
00123 
00124 }
00125 
00126 /* static */ ConduitConfigBase *VCalWidgetSetup::create(QWidget *w,const char *n)
00127 {
00128     return new VCalWidgetSetup(w,n);
00129 }
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 Sat May 1 11:36:50 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003