• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

KCal Library

  • sources
  • kde-4.12
  • kdepimlibs
  • kcal
resourcelocaldirconfig.cpp
1 /*
2  This file is part of the kcal library.
3 
4  Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include "resourcelocaldirconfig.h"
23 #include "resourcelocaldir.h"
24 #include "resourcelocaldir_p.h"
25 
26 #include <klocalizedstring.h>
27 #include <kdebug.h>
28 #include <kstandarddirs.h>
29 #include <kurlrequester.h>
30 #include <KMessageBox>
31 
32 #include <QLabel>
33 #include <QLayout>
34 #include <QGridLayout>
35 
36 #include <typeinfo>
37 
38 
39 using namespace KCal;
40 
45 //@cond PRIVATE
46 class KCal::ResourceLocalDirConfig::Private
47 {
48  public:
49  Private()
50  {}
51  KUrlRequester *mURL;
52 };
53 //@endcond
54 
55 ResourceLocalDirConfig::ResourceLocalDirConfig( QWidget *parent )
56  : KRES::ConfigWidget( parent ), d( new KCal::ResourceLocalDirConfig::Private )
57 {
58  resize( 245, 115 );
59  QGridLayout *mainLayout = new QGridLayout( this );
60 
61  QLabel *label = new QLabel( i18n( "Location:" ), this );
62  d->mURL = new KUrlRequester( this );
63  d->mURL->setMode( KFile::Directory | KFile::LocalOnly );
64  mainLayout->addWidget( label, 1, 0 );
65  mainLayout->addWidget( d->mURL, 1, 1 );
66 }
67 
68 ResourceLocalDirConfig::~ResourceLocalDirConfig()
69 {
70  delete d;
71 }
72 
73 void ResourceLocalDirConfig::loadSettings( KRES::Resource *resource )
74 {
75  ResourceLocalDir *res = static_cast<ResourceLocalDir*>( resource );
76  if ( res ) {
77  d->mURL->setUrl( res->d->mURL.prettyUrl() );
78  } else {
79  kDebug() << "ERROR: no ResourceLocalDir, cast failed";
80  }
81 }
82 
83 void ResourceLocalDirConfig::saveSettings( KRES::Resource *resource )
84 {
85  ResourceLocalDir *res = static_cast<ResourceLocalDir*>( resource );
86  if (res) {
87  res->d->mURL = d->mURL->url();
88  if ( d->mURL->url().isEmpty() && !resource->readOnly() ) {
89  KMessageBox::information(
90  this,
91  i18nc( "@info", "No location specified. The calendar will be invalid." ),
92  QString(),
93  "ResourceLocalDirUrl");
94  resource->setReadOnly( true );
95  }
96  } else {
97  kDebug() << "ERROR: no ResourceLocalDir, cast failed";
98  }
99 }
KCal::ResourceLocalDirConfig
Configuration widget for local dir resource.
Definition: resourcelocaldirconfig.h:39
KRES::Resource
KRES::Resource::readOnly
virtual bool readOnly() const
KCal::ResourceLocalDirConfig::ResourceLocalDirConfig
ResourceLocalDirConfig(QWidget *parent=0)
Private class that helps to provide binary compatibility between releases.
Definition: resourcelocaldirconfig.cpp:55
KRES::Resource::setReadOnly
virtual void setReadOnly(bool value)
KCal::ResourceLocalDir
This class provides a calendar stored as a file per incidence in a directory.
Definition: resourcelocaldir.h:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCal Library

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

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal