• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kpilot

dataproxy.h

Go to the documentation of this file.
00001 #ifndef DATAPROXY_H
00002 #define DATAPROXY_H
00003 /* dataproxy.h          KPilot
00004 **
00005 ** Copyright (C) 2007 by Bertjan Broeksema <b.broeksema@kdemail.net>
00006 ** Copyright (C) 2007 by Jason "vanRijn" Kasper <vr@movingparts.net>
00007 */
00008 
00009 /*
00010 ** This program is free software; you can redistribute it and/or modify
00011 ** it under the terms of the GNU Lesser General Public License as published by
00012 ** the Free Software Foundation; either version 2.1 of the License, or
00013 ** (at your option) any later version.
00014 **
00015 ** This program is distributed in the hope that it will be useful,
00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00018 ** GNU Lesser General Public License for more details.
00019 **
00020 ** You should have received a copy of the GNU Lesser General Public License
00021 ** along with this program in a file called COPYING; if not, write to
00022 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00023 ** MA 02110-1301, USA.
00024 */
00025 
00026 /*
00027 ** Bug reports and questions can be sent to kde-pim@kde.org
00028 */
00029 
00030 #include "cudcounter.h"
00031 
00032 #include <QMap>
00033 #include <QStringList>
00034 #include <QPair>
00035 
00036 #include "kpilot_export.h"
00037 
00038 class Record;
00039 
00040 class KPILOT_EXPORT DataProxy {
00041 public:
00042     enum Mode {
00043         All=1,
00044         Modified=2
00045     };
00046     
00047     DataProxy();
00048     
00049     virtual ~DataProxy();
00050 
00055     QString create( Record *record );
00056 
00061     void remove( const QString &id );
00062 
00067     void update( const QString &id, Record *record );
00068 
00072     QList<QString> ids() const;
00073 
00078     const CUDCounter* counter() const;
00079 
00083     void setEndcount();
00084 
00089     virtual void syncFinished() {}
00090 
00095     void setIterateMode( const Mode m = All );
00096     
00101     unsigned int recordCount() const;
00102     
00106     Record* find( const QString &id ) const;
00107     
00111     void resetIterator();
00112     
00117     bool hasNext() const;
00118 
00123     Record* next();
00124     
00128     bool commit();
00129     
00133     bool rollback();
00134     
00140     QMap<QString, QString> changedIds();
00141     
00149     virtual void setCategory( Record* rec, const QString& category ) = 0;
00150 
00158     virtual void addCategory( Record* rec, const QString& category ) = 0;
00159 
00164     virtual bool isOpen() const = 0;
00165 
00170     virtual void loadAllRecords() = 0;
00171     
00175     virtual bool createDataStore() = 0;
00176 
00177 protected: // Functions
00181     virtual QString generateUniqueId() = 0;
00182     
00192     virtual bool _commit() { return true; };
00193     
00198     bool _rollback() { return true; };
00199     
00207     virtual bool commitCreate( Record *rec ) = 0;
00208     
00216     virtual bool commitUpdate( Record *rec ) = 0;
00217     
00224     virtual bool commitDelete( Record *rec ) = 0;
00225 
00226 protected: // Members
00227     Mode fMode;
00228     CUDCounter fCounter;
00229     QMap<QString, Record*> fRecords;
00230     QMapIterator<QString, Record*> fIterator;
00231     
00232     // These are kept for rollback.
00237     QMap<QString, bool> fCreated;
00238     
00242     QMap<QString, Record*> fOldRecords;
00243     
00248     QMap<QString, bool> fUpdated;
00249     
00253     QMap<QString, Record*> fDeletedRecords;
00254     
00259     QMap<QString, bool> fDeleted;
00260     
00264     QMap<QString, QString> fChangedIds;
00265 };
00266 #endif

kpilot

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

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal