libkcal Library API Documentation

resourcelocalconfig.cpp

00001 /* 00002 This file is part of libkcal. 00003 00004 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 00005 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00020 Boston, MA 02111-1307, USA. 00021 */ 00022 00023 #include <typeinfo> 00024 00025 #include <qlabel.h> 00026 #include <qlayout.h> 00027 00028 #include <klocale.h> 00029 #include <kdebug.h> 00030 #include <kstandarddirs.h> 00031 00032 #include "vcaldrag.h" 00033 #include "vcalformat.h" 00034 #include "icalformat.h" 00035 00036 #include "resourcelocal.h" 00037 00038 #include "resourcelocalconfig.h" 00039 00040 using namespace KCal; 00041 00042 ResourceLocalConfig::ResourceLocalConfig( QWidget* parent, const char* name ) 00043 : KRES::ConfigWidget( parent, name ) 00044 { 00045 resize( 245, 115 ); 00046 QGridLayout *mainLayout = new QGridLayout( this, 2, 2 ); 00047 00048 QLabel *label = new QLabel( i18n( "Location:" ), this ); 00049 mURL = new KURLRequester( this ); 00050 mainLayout->addWidget( label, 1, 0 ); 00051 mainLayout->addWidget( mURL, 1, 1 ); 00052 00053 formatGroup = new QButtonGroup( 1, Horizontal, i18n( "Calendar Format" ), this ); 00054 // formatGroup->setExclusive( true ); 00055 00056 // formatGroup->setFrameStyle(QFrame::NoFrame); 00057 icalButton = new QRadioButton( i18n("iCalendar"), formatGroup ); 00058 vcalButton = new QRadioButton( i18n("vCalendar"), formatGroup ); 00059 00060 mainLayout->addWidget( formatGroup, 2, 1 ); 00061 } 00062 00063 void ResourceLocalConfig::loadSettings( KRES::Resource *resource ) 00064 { 00065 ResourceLocal* res = static_cast<ResourceLocal*>( resource ); 00066 if ( res ) { 00067 mURL->setURL( res->mURL.prettyURL() ); 00068 kdDebug(5800) << "Format typeid().name(): " << typeid( res->mFormat ).name() << endl; 00069 if ( typeid( *(res->mFormat) ) == typeid( ICalFormat ) ) 00070 formatGroup->setButton( 0 ); 00071 else if ( typeid( *(res->mFormat) ) == typeid( VCalFormat ) ) 00072 formatGroup->setButton( 1 ); 00073 else 00074 kdDebug(5800) << "ERROR: ResourceLocalConfig::loadSettings(): Unknown format type" << endl; 00075 } else 00076 kdDebug(5700) << "ERROR: ResourceLocalConfig::loadSettings(): no ResourceLocal, cast failed" << endl; 00077 } 00078 00079 void ResourceLocalConfig::saveSettings( KRES::Resource *resource ) 00080 { 00081 ResourceLocal* res = static_cast<ResourceLocal*>( resource ); 00082 if (res) { 00083 res->mURL = mURL->url(); 00084 00085 delete res->mFormat; 00086 if ( icalButton->isOn() ) { 00087 res->mFormat = new ICalFormat(); 00088 } else { 00089 res->mFormat = new VCalFormat(); 00090 } 00091 } else 00092 kdDebug(5700) << "ERROR: ResourceLocalConfig::saveSettings(): no ResourceLocal, cast failed" << endl; 00093 } 00094 00095 #include "resourcelocalconfig.moc"
KDE Logo
This file is part of the documentation for libkcal Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:49:12 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003