You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdesdk/kbugbuster/tderesources/kcalresource.h

125 lines
2.7 KiB

/*
This file is part of KBugBuster.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KCALRESOURCE_H
#define KCALRESOURCE_H
#include <tqptrlist.h>
#include <tqstring.h>
#include <tqdatetime.h>
#include <kurl.h>
#include <tdeconfig.h>
#include <kdirwatch.h>
#include <incidence.h>
#include <calendarlocal.h>
#include <icalformat.h>
#include <resourcecached.h>
#include <bugsystem.h>
namespace TDEIO {
class FileCopyJob;
class Job;
}
namespace KBB {
class ResourcePrefs;
}
/**
This class provides a calendar stored as a remote file.
*/
class KCalResource : public KCal::ResourceCached
{
Q_OBJECT
friend class KCalResourceConfig;
public:
/**
Reload policy.
@see setReloadPolicy(), reloadPolicy()
*/
enum { ReloadNever, ReloadOnStartup, ReloadOnceADay, ReloadAlways };
/**
Create resource from configuration information stored in TDEConfig object.
*/
KCalResource( const TDEConfig * );
~KCalResource();
void readConfig( const TDEConfig *config );
void writeConfig( TDEConfig *config );
KBB::ResourcePrefs *prefs();
/**
Return name of file used as cache for remote file.
*/
TQString cacheFile();
KABC::Lock *lock();
bool isSaving();
void dump() const;
protected slots:
void slotBugListAvailable( const Package &, const TQString &,
const Bug::List &bugs );
void slotLoadJobResult( TDEIO::Job * );
void slotSaveJobResult( TDEIO::Job * );
protected:
bool doOpen();
void doClose();
bool doLoad();
bool doSave();
private:
void init();
KBB::ResourcePrefs *mPrefs;
KURL mDownloadUrl;
KURL mUploadUrl;
int mReloadPolicy;
KCal::ICalFormat mFormat;
bool mOpen;
TDEIO::FileCopyJob *mDownloadJob;
TDEIO::FileCopyJob *mUploadJob;
KABC::Lock *mLock;
class Private;
Private *d;
};
#endif