KCal Library
Go to the documentation of this file.
32 #include "resourcelocal_p.h"
33 #include "resourcelocalconfig.h"
48 #include <QtCore/QString>
53 #include <kdirwatch.h>
54 #include <kstandarddirs.h>
55 #include <kconfiggroup.h>
73 QString url = group.readPathEntry(
"CalendarURL", QString() );
74 d->mURL = KUrl( url );
76 QString format = group.readEntry(
"Format" );
77 if ( format ==
"ical" ) {
79 }
else if ( format ==
"vcal" ) {
80 d->mFormat =
new VCalFormat();
90 d->mURL = KUrl::fromPath( fileName );
99 ResourceCalendar::writeConfig( group );
100 group.writePathEntry(
"CalendarURL", d->mURL.prettyUrl() );
102 if (
typeid( *d->mFormat ) ==
typeid(
ICalFormat ) ) {
103 group.writeEntry(
"Format",
"ical" );
104 }
else if (
typeid( *d->mFormat ) ==
typeid( VCalFormat ) ) {
105 group.writeEntry(
"Format",
"vcal" );
107 kDebug() <<
"ERROR: Unknown format type";
111 void ResourceLocal::init()
118 connect( &d->mDirWatch, SIGNAL(dirty(QString)),
120 connect( &d->mDirWatch, SIGNAL(created(QString)),
122 connect( &d->mDirWatch, SIGNAL(deleted(QString)),
125 d->mLock =
new KABC::Lock( d->mURL.path() );
127 d->mDirWatch.addFile( d->mURL.path() );
128 d->mDirWatch.startScan();
133 d->mDirWatch.stopScan();
142 QFileInfo fi( d->mURL.path() );
143 return KDateTime( fi.lastModified() );
148 Q_UNUSED( syncCache );
151 if ( !KStandardDirs::exists( d->mURL.path() ) ) {
152 kDebug() <<
"File doesn't exist yet.";
156 success = calendar()->
load( d->mURL.path() );
167 Q_UNUSED( syncCache );
168 bool success = calendar()->
save( d->mURL.path() );
169 kDebug() <<
"Save of " << d->mURL.path() <<
"was " << success;
190 kDebug() <<
"trying to reload from a closed file";
195 kDebug() <<
"file not modified since last read.";
200 calendar()->
load( d->mURL.path() );
214 kDebug() <<
" Url:" << d->mURL.url();
219 return d->mURL.path();
229 d->mDirWatch.stopScan();
230 d->mDirWatch.removeFile( d->mURL.path() );
231 d->mURL = KUrl::fromPath( fileName );
232 d->mLock =
new KABC::Lock( d->mURL.path() );
233 d->mDirWatch.addFile( d->mURL.path() );
234 d->mDirWatch.startScan();
240 if ( key ==
"File" ) {
250 d->mURL == other.d->mURL &&
251 d->mLastModified == other.d->mLastModified;
257 if ( &other ==
this ) {
261 d->mURL = other.d->mURL;
262 d->mLastModified = other.d->mLastModified;
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:29:16 by
doxygen 1.8.3.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.