• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

KCal Library

resourcelocaldirconfig.cpp

00001 /*
00002   This file is part of the kcal library.
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 "resourcelocaldirconfig.h"
00023 #include "resourcelocaldir.h"
00024 #include "resourcelocaldir_p.h"
00025 
00026 #include <klocale.h>
00027 #include <kdebug.h>
00028 #include <kstandarddirs.h>
00029 #include <kurlrequester.h>
00030 #include <KMessageBox>
00031 
00032 #include <QtGui/QLabel>
00033 #include <QtGui/QLayout>
00034 #include <QtGui/QGridLayout>
00035 
00036 #include <typeinfo>
00037 
00038 #include "resourcelocaldirconfig.moc"
00039 
00040 using namespace KCal;
00041 
00046 //@cond PRIVATE
00047 class KCal::ResourceLocalDirConfig::Private
00048 {
00049   public:
00050     Private()
00051     {}
00052     KUrlRequester *mURL;
00053 };
00054 //@endcond
00055 
00056 ResourceLocalDirConfig::ResourceLocalDirConfig( QWidget *parent )
00057   : KRES::ConfigWidget( parent ), d( new KCal::ResourceLocalDirConfig::Private )
00058 {
00059   resize( 245, 115 );
00060   QGridLayout *mainLayout = new QGridLayout( this );
00061 
00062   QLabel *label = new QLabel( i18n( "Location:" ), this );
00063   d->mURL = new KUrlRequester( this );
00064   d->mURL->setMode( KFile::Directory | KFile::LocalOnly );
00065   mainLayout->addWidget( label, 1, 0 );
00066   mainLayout->addWidget( d->mURL, 1, 1 );
00067 }
00068 
00069 ResourceLocalDirConfig::~ResourceLocalDirConfig()
00070 {
00071   delete d;
00072 }
00073 
00074 void ResourceLocalDirConfig::loadSettings( KRES::Resource *resource )
00075 {
00076   ResourceLocalDir *res = static_cast<ResourceLocalDir*>( resource );
00077   if ( res ) {
00078     d->mURL->setUrl( res->d->mURL.prettyUrl() );
00079   } else {
00080     kDebug() << "ERROR: no ResourceLocalDir, cast failed";
00081   }
00082 }
00083 
00084 void ResourceLocalDirConfig::saveSettings( KRES::Resource *resource )
00085 {
00086   ResourceLocalDir *res = static_cast<ResourceLocalDir*>( resource );
00087   if (res) {
00088     res->d->mURL = d->mURL->url();
00089     if ( d->mURL->url().isEmpty() && !resource->readOnly() ) {
00090       KMessageBox::information(
00091         this,
00092         i18nc( "@info",  "No location specified.  The calendar will be invalid." ),
00093         QString(),
00094         "ResourceLocalDirUrl");
00095       resource->setReadOnly( true );
00096     }
00097   } else {
00098     kDebug() << "ERROR: no ResourceLocalDir, cast failed";
00099   }
00100 }

KCal Library

Skip menu "KCal Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal