diff options
author | Timothy Pearson <[email protected]> | 2013-02-17 02:06:43 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-02-17 02:06:43 -0600 |
commit | 10251f9a2a51f37c2a42833c1d05cd5a8fdf6bb5 (patch) | |
tree | 7ff76e953c38b426d2ff3a7841e2b75332e85b5a /tderesources/groupwise/tdeabc_resourcegroupwise.h | |
parent | 4535df08c5c3c40e38d2bddd7cda8c41be27fd0f (diff) | |
download | tdepim-10251f9a2a51f37c2a42833c1d05cd5a8fdf6bb5.tar.gz tdepim-10251f9a2a51f37c2a42833c1d05cd5a8fdf6bb5.zip |
Fix FTBFS
Diffstat (limited to 'tderesources/groupwise/tdeabc_resourcegroupwise.h')
-rw-r--r-- | tderesources/groupwise/tdeabc_resourcegroupwise.h | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/tderesources/groupwise/tdeabc_resourcegroupwise.h b/tderesources/groupwise/tdeabc_resourcegroupwise.h new file mode 100644 index 000000000..0c7533eef --- /dev/null +++ b/tderesources/groupwise/tdeabc_resourcegroupwise.h @@ -0,0 +1,169 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <[email protected]> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +#ifndef KABC_RESOURCEGROUPWISE_H +#define KABC_RESOURCEGROUPWISE_H + +#include "soap/groupwiseserver.h" + +#include <kabcresourcecached.h> +#include <tdepimmacros.h> + +#include <libtdepim/progressmanager.h> + +#include <tdeio/job.h> + +class TDEConfig; + +class GroupwiseServer; + +namespace KABC { + +class GroupwisePrefs; + +class KDE_EXPORT ResourceGroupwise : public ResourceCached +{ + friend class ResourceGroupwiseConfig; + + Q_OBJECT + + + public: + ResourceGroupwise( const TDEConfig * ); + ResourceGroupwise( const KURL &url, + const TQString &user, const TQString &password, + const TQStringList &readAddressBooks, + const TQString &writeAddressBook ); + ~ResourceGroupwise(); + + void readConfig( const TDEConfig * ); + void writeConfig( TDEConfig * ); + + void readAddressBooks(); + void writeAddressBooks(); + + void retrieveAddressBooks(); + + GroupwisePrefs *prefs() const { return mPrefs; } + + GroupWise::AddressBook::List addressBooks() const { return mAddressBooks; } + + bool doOpen(); + void doClose(); + + Ticket *requestSaveTicket(); + void releaseSaveTicket( Ticket* ); + + bool load(); + bool asyncLoad(); + bool save( Ticket * ); + bool asyncSave( Ticket * ); + enum SABState { Error, Stale, InSync, RefreshNeeded }; + + /** + * Clears the cached data, in memory and on disk + */ + void clearCache(); + protected: + enum ResourceState { Start, FetchingSAB, SABUptodate, FetchingUAB, Uptodate }; + enum BookType { System, User }; + enum AccessMode { Fetch, Update }; + void init(); + void initGroupwise(); + + /* STATE CHANGING METHODS */ + /** + * Begin asynchronously fetching the system address book , replacing the cached copy + */ + void fetchAddressBooks( const BookType booktype ); + /** + * Asynchronously update the system address book + */ + void updateSystemAddressBook(); + /** + * Wrap up the load sequence + */ + void loadCompleted(); + + /** HELPER METHODS **/ + /** + * Check to see if a local download of the SAB already exists + */ + SABState systemAddressBookState(); + /** + * Check if the resource is configured to download the SAB + */ + bool shouldFetchSystemAddressBook(); + /** + * Check if the resource is configured to download personal address + * books + */ + bool shouldFetchUserAddressBooks(); + + /** + * Create a URL for a single addressbook access. + * To fetch an address book completely, use mode = Fetch + * To just update an addressbook, use mode = Update and give the ast sequence number already held + * If Update is given without a sequence number, the mode falls back to Fetch + */ + KURL createAccessUrl( BookType bookType, AccessMode mode, unsigned long lastSequenceNumber = 0, unsigned long lastPORebuildTime = 0 ); + + /** + * Persist the last known delta info. Call after the SAB is up to date. + */ + void storeDeltaInfo(); + + /** + * Check if the application which has loaded this resource is whitelisted + * to load the System Address Book (time-consuming) + */ + bool appIsWhiteListedForSAB(); + + private slots: + /** STATE CHANGING SLOTS **/ + void fetchSABResult( TDEIO::Job * ); + void fetchUABResult( TDEIO::Job * ); + void updateSABResult( TDEIO::Job * ); + /** DATA PROCESSING SLOTS **/ + void slotReadJobData( TDEIO::Job *, const TQByteArray & ); + void slotUpdateJobData( TDEIO::Job *, const TQByteArray & ); + /** HELPER TQT_SLOT **/ + void slotJobPercent( TDEIO::Job *job, unsigned long percent ); + + void cancelLoad(); + private: + GroupwisePrefs *mPrefs; + GroupWise::AddressBook::List mAddressBooks; + + GroupwiseServer *mServer; + + TDEIO::TransferJob *mJob; + KPIM::ProgressItem *mProgress; + KPIM::ProgressItem *mSABProgress; + KPIM::ProgressItem *mUABProgress; + TQString mJobData; + ResourceState mState; + unsigned long mServerFirstSequence, mServerLastSequence, mServerLastPORebuildTime; + + bool mLimitedMode; +}; + +} + +#endif |