korganizer Library API Documentation

resourceimportdialog.cpp

00001 /* 00002 This file is part of KOrganizer. 00003 00004 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 00020 As a special exception, permission is given to link this program 00021 with any edition of Qt, and distribute the resulting executable, 00022 without including the source code for Qt in the source distribution. 00023 */ 00024 00025 #include "resourceimportdialog.h" 00026 00027 #include "kocore.h" 00028 #include "koprefs.h" 00029 00030 #include <libkcal/calendarresources.h> 00031 #include <libkcal/resourcelocal.h> 00032 #include <libkcal/resourceremote.h> 00033 00034 #include <klocale.h> 00035 00036 #include <qlabel.h> 00037 #include <qlayout.h> 00038 00039 ResourceImportDialog::ResourceImportDialog( const QString &url, 00040 QWidget *parent ) 00041 : KDialogBase( Plain, i18n("Import Calendar"), Ok | Cancel, Ok, parent, 00042 0, true, true ), 00043 mUrl( url ) 00044 { 00045 QFrame *topFrame = plainPage(); 00046 QVBoxLayout *topLayout = new QVBoxLayout( topFrame, 0, spacingHint() ); 00047 00048 QString txt = i18n("Do you want to add the calendar at '%1' to KOrganizer") 00049 .arg( mUrl ); 00050 00051 topLayout->addWidget( new QLabel( txt, topFrame ) ); 00052 } 00053 00054 ResourceImportDialog::~ResourceImportDialog() 00055 { 00056 } 00057 00058 void ResourceImportDialog::slotOk() 00059 { 00060 kdDebug() << "Adding resource for url '" << mUrl << "'" << endl; 00061 00062 KCal::CalendarResources *cr = KOCore::self()->calendarResources(); 00063 00064 KCal::CalendarResourceManager *manager = cr->resourceManager(); 00065 00066 KCal::ResourceCalendar *resource = 0; 00067 00068 KURL url( mUrl ); 00069 kdDebug() << "URL: " << url.url() << endl; 00070 if ( url.isLocalFile() ) { 00071 kdDebug() << "Local Resource" << endl; 00072 resource = new KCal::ResourceLocal( mUrl ); 00073 resource->setTimeZoneId( KOPrefs::instance()->mTimeZoneId ); 00074 } else { 00075 kdDebug() << "Remote Resource" << endl; 00076 // resource = new KCal::ResourceRemote( url ); 00077 } 00078 00079 if ( resource ) { 00080 resource->setResourceName( mUrl ); 00081 manager->add( resource ); 00082 } 00083 00084 accept(); 00085 } 00086 00087 #include "resourceimportdialog.moc"
KDE Logo
This file is part of the documentation for korganizer Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:58:14 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003