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>
57 #include "resourcelocal.moc"
74 QString url = group.readPathEntry(
"CalendarURL", QString() );
75 d->mURL = KUrl( url );
77 QString format = group.readEntry(
"Format" );
78 if ( format ==
"ical" ) {
80 }
else if ( format ==
"vcal" ) {
81 d->mFormat =
new VCalFormat();
91 d->mURL = KUrl::fromPath( fileName );
101 group.writePathEntry(
"CalendarURL", d->mURL.prettyUrl() );
103 if (
typeid( *d->mFormat ) ==
typeid(
ICalFormat ) ) {
104 group.writeEntry(
"Format",
"ical" );
105 }
else if (
typeid( *d->mFormat ) ==
typeid( VCalFormat ) ) {
106 group.writeEntry(
"Format",
"vcal" );
108 kDebug() <<
"ERROR: Unknown format type";
112 void ResourceLocal::init()
119 connect( &d->mDirWatch, SIGNAL(dirty(QString)),
121 connect( &d->mDirWatch, SIGNAL(created(QString)),
123 connect( &d->mDirWatch, SIGNAL(deleted(QString)),
126 d->mLock =
new KABC::Lock( d->mURL.path() );
128 d->mDirWatch.addFile( d->mURL.path() );
129 d->mDirWatch.startScan();
134 d->mDirWatch.stopScan();
143 QFileInfo fi( d->mURL.path() );
144 return KDateTime( fi.lastModified() );
149 Q_UNUSED( syncCache );
152 if ( !KStandardDirs::exists( d->mURL.path() ) ) {
153 kDebug() <<
"File doesn't exist yet.";
157 success = calendar()->
load( d->mURL.path() );
168 Q_UNUSED( syncCache );
169 bool success = calendar()->
save( d->mURL.path() );
170 kDebug() <<
"Save of " << d->mURL.path() <<
"was " << success;
191 kDebug() <<
"trying to reload from a closed file";
196 kDebug() <<
"file not modified since last read.";
201 calendar()->
load( d->mURL.path() );
215 kDebug() <<
" Url:" << d->mURL.url();
220 return d->mURL.path();
230 d->mDirWatch.stopScan();
231 d->mDirWatch.removeFile( d->mURL.path() );
232 d->mURL = KUrl::fromPath( fileName );
233 d->mLock =
new KABC::Lock( d->mURL.path() );
234 d->mDirWatch.addFile( d->mURL.path() );
235 d->mDirWatch.startScan();
241 if ( key ==
"File" ) {
251 d->mURL == other.d->mURL &&
252 d->mLastModified == other.d->mLastModified;
258 if ( &other ==
this ) {
262 d->mURL = other.d->mURL;
263 d->mLastModified = other.d->mLastModified;
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue Dec 4 2012 14:36:42 by
doxygen 1.8.1.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.