kpilot

vcal-setupbase.cc

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor, Boston,
00023 ** MA 02110-1301, 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 <qcheckbox.h>
00033 #include <qbuttongroup.h>
00034 #include <qcombobox.h>
00035 
00036 #include <kurlrequester.h>
00037 
00038 #include "korganizerConduit.h"
00039 #include "vcalconduitSettings.h"
00040 #include "vcal-setupbase.h"
00041 
00042 VCalWidgetSetupBase::VCalWidgetSetupBase(QWidget *w, const char *n) :
00043     ConduitConfigBase(w,n),
00044     fConfigWidget(new VCalWidget(w))
00045 {
00046     FUNCTIONSETUP;
00047     fWidget=fConfigWidget;
00048 
00049     fConfigWidget->fCalendarFile->setMode(KFile::File);
00050     fConfigWidget->fCalendarFile->setFilter(CSL1("*.vcs *.ics|ICalendars\n*.*|All Files (*.*)"));
00051 
00052 #define CM(a,b) connect(fConfigWidget->a,b,this,SLOT(modified()));
00053     CM(fSyncDestination,SIGNAL(clicked(int)));
00054     CM(fCalendarFile,SIGNAL(textChanged(const QString &)));
00055     CM(fArchive,SIGNAL(toggled(bool)));
00056     CM(fConflictResolution,SIGNAL(activated(int)));
00057 #undef CM
00058 }
00059 
00060 VCalWidgetSetupBase::~VCalWidgetSetupBase()
00061 {
00062     FUNCTIONSETUP;
00063 }
00064 
00065 /* virtual */ void VCalWidgetSetupBase::commit()
00066 {
00067     FUNCTIONSETUP;
00068     config()->readConfig();
00069 
00070     // General page
00071 #ifdef DEBUG
00072     DEBUGKPILOT << fname << ": Selected type="
00073         << fConfigWidget->fSyncDestination->selected()
00074         << " with id="
00075         << fConfigWidget->fSyncDestination->id(fConfigWidget->fSyncDestination->selected())
00076         << endl;
00077 #endif
00078     config()->setCalendarType( fConfigWidget->fSyncDestination->id(
00079             fConfigWidget->fSyncDestination->selected()));
00080     config()->setCalendarFile( fConfigWidget->fCalendarFile->url());
00081 
00082     config()->setSyncArchived( fConfigWidget->fArchive->isChecked() );
00083 
00084     // Conflicts page
00085     config()->setConflictResolution(
00086         fConfigWidget->fConflictResolution->currentItem()+SyncAction::eCROffset);
00087 
00088     config()->writeConfig();
00089     unmodified();
00090 }
00091 
00092 /* virtual */ void VCalWidgetSetupBase::load()
00093 {
00094     FUNCTIONSETUP;
00095     config()->readConfig();
00096 
00097     // General page
00098     fConfigWidget->fSyncDestination->setButton( config()->calendarType());
00099     fConfigWidget->fCalendarFile->setURL( config()->calendarFile() );
00100 
00101     fConfigWidget->fArchive->setChecked( config()->syncArchived() );
00102 
00103     // Conflicts page
00104     fConfigWidget->fConflictResolution->setCurrentItem(
00105         config()->conflictResolution() - SyncAction::eCROffset);
00106 
00107     config()->writeConfig();
00108     unmodified();
00109 }
00110