libkcal

resourcelocaldirconfig.cpp

Go to the documentation of this file.
00001 /*
00002     This file is part of libkcal.
00003 
00004     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library 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 GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #include <typeinfo>
00023 
00024 #include <qlabel.h>
00025 #include <qlayout.h>
00026 
00027 #include <klocale.h>
00028 #include <kdebug.h>
00029 #include <kstandarddirs.h>
00030 
00031 #include "vcaldrag.h"
00032 #include "vcalformat.h"
00033 #include "icalformat.h"
00034 
00035 #include "resourcelocaldir.h"
00036 
00037 #include "resourcelocaldirconfig.h"
00038 
00039 using namespace KCal;
00040 
00041 ResourceLocalDirConfig::ResourceLocalDirConfig( QWidget* parent,  const char* name )
00042     : KRES::ConfigWidget( parent, name )
00043 {
00044   resize( 245, 115 ); 
00045   QGridLayout *mainLayout = new QGridLayout( this, 2, 2 );
00046 
00047   QLabel *label = new QLabel( i18n( "Location:" ), this );
00048   mURL = new KURLRequester( this );
00049   mURL->setMode( KFile::Directory | KFile::LocalOnly );
00050   mainLayout->addWidget( label, 1, 0 );
00051   mainLayout->addWidget( mURL, 1, 1 );
00052 }
00053 
00054 void ResourceLocalDirConfig::loadSettings( KRES::Resource *resource )
00055 {
00056   ResourceLocalDir* res = static_cast<ResourceLocalDir*>( resource );
00057   if ( res ) {
00058     mURL->setURL( res->mURL.prettyURL() );
00059   } else
00060     kdDebug(5700) << "ERROR: ResourceLocalDirConfig::loadSettings(): no ResourceLocalDir, cast failed" << endl;
00061 }
00062 
00063 void ResourceLocalDirConfig::saveSettings( KRES::Resource *resource )
00064 {
00065   ResourceLocalDir* res = static_cast<ResourceLocalDir*>( resource );
00066   if (res) {
00067     res->mURL = mURL->url();
00068   } else
00069     kdDebug(5700) << "ERROR: ResourceLocalDirConfig::saveSettings(): no ResourceLocalDir, cast failed" << endl;
00070 }
00071 
00072 #include "resourcelocaldirconfig.moc"