libkcal Library API Documentation

resourceremoteconfig.cpp

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., 59 Temple Place - Suite 330,
00019     Boston, MA 02111-1307, 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 "resourceremote.h"
00036 
00037 #include "resourceremoteconfig.h"
00038 
00039 using namespace KCal;
00040 
00041 ResourceRemoteConfig::ResourceRemoteConfig( 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   // FIXME: Post 3.2: i18n("Download from:") ( bug 67330 )
00048   QLabel *label = new QLabel( i18n( "Download URL:" ), this );
00049 
00050   mDownloadUrl = new KURLRequester( this );
00051   mDownloadUrl->setMode( KFile::File );
00052   mainLayout->addWidget( label, 1, 0 );
00053   mainLayout->addWidget( mDownloadUrl, 1, 1 );
00054 
00055   // FIXME: Post 3.2: i18n("Upload to:") ( bug 67330 )
00056   label = new QLabel( i18n( "Upload URL:" ), this );
00057   mUploadUrl = new KURLRequester( this );
00058   mUploadUrl->setMode( KFile::File );
00059   mainLayout->addWidget( label, 2, 0 );
00060   mainLayout->addWidget( mUploadUrl, 2, 1 );
00061 
00062   mReloadGroup = new QButtonGroup( 1, Horizontal, i18n("Reload"), this );
00063   mainLayout->addMultiCellWidget( mReloadGroup, 3, 3, 0, 1 );
00064   new QRadioButton( i18n("Never"), mReloadGroup );
00065   new QRadioButton( i18n("On startup"), mReloadGroup );
00066   new QRadioButton( i18n("Once a day"), mReloadGroup );
00067   new QRadioButton( i18n("Always"), mReloadGroup );
00068 }
00069 
00070 void ResourceRemoteConfig::loadSettings( KRES::Resource *resource )
00071 {
00072   ResourceRemote *res = static_cast<ResourceRemote *>( resource );
00073   if ( res ) {
00074     mDownloadUrl->setURL( res->downloadUrl().url() );
00075     mUploadUrl->setURL( res->uploadUrl().url() );
00076     kdDebug() << "ANOTER RELOAD POLICY: " << res->reloadPolicy() << endl;
00077     mReloadGroup->setButton( res->reloadPolicy() );
00078   } else {
00079     kdError(5700) << "ResourceRemoteConfig::loadSettings(): no ResourceRemote, cast failed" << endl;
00080   }
00081 }
00082 
00083 void ResourceRemoteConfig::saveSettings( KRES::Resource *resource )
00084 {
00085   ResourceRemote* res = static_cast<ResourceRemote*>( resource );
00086   if ( res ) {
00087     res->setDownloadUrl( KURL( mDownloadUrl->url() ) );
00088     res->setUploadUrl( KURL( mUploadUrl->url() ) );
00089     res->setReloadPolicy( mReloadGroup->selectedId() );
00090   } else {
00091     kdError(5700) << "ResourceRemoteConfig::saveSettings(): no ResourceRemote, cast failed" << endl;
00092   }
00093 }
00094 
00095 #include "resourceremoteconfig.moc"
KDE Logo
This file is part of the documentation for libkcal Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:36:23 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003