• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

okteta

  • sources
  • kde-4.12
  • kdesdk
  • okteta
  • libs
  • kasten
  • core
  • io
abstractmodelsynchronizer.h
Go to the documentation of this file.
1 /*
2  This file is part of the Kasten Framework, made within the KDE community.
3 
4  Copyright 2007-2009,2012 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) version 3, or any
10  later version accepted by the membership of KDE e.V. (or its
11  successor approved by the membership of KDE e.V.), which shall
12  act as a proxy defined in Section 6 of version 3 of the license.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef ABSTRACTMODELSYNCHRONIZER_H
24 #define ABSTRACTMODELSYNCHRONIZER_H
25 
26 // lib
27 #include "kastencore_export.h"
28 #include "kastencore.h"
29 // Qt
30 #include <QtCore/QObject>
31 
32 class KUrl;
33 
34 
35 namespace Kasten2
36 {
37 
38 class AbstractLoadJob;
39 class AbstractConnectJob;
40 class AbstractSyncToRemoteJob;
41 class AbstractSyncFromRemoteJob;
42 class AbstractSyncWithRemoteJob;
43 class AbstractDocument;
44 
45 class AbstractModelSynchronizerPrivate;
46 
47 // TODO: better names? Active Translator?
48 // synchronizers are created by factory functions (like plugins)
49 
50 // TODO: should synchronizers set the document to readonly if remote is readonly? or who?
51 // TODO: should synchronizers offer to change writeflag at remote?
52 // TODO: allow synchronizers which can read-only, perhaps also write-only (usecase?)
53 
61 class KASTENCORE_EXPORT AbstractModelSynchronizer : public QObject
62 {
63  Q_OBJECT
64 
65  public:
66  enum ConnectOption // TODO: better names
67  {
68  SyncLocalAndRemote = 0,
69  ReplaceRemote = 1,
70  ReplaceLocal = 2
71  };
72  protected:
73  explicit AbstractModelSynchronizer( AbstractModelSynchronizerPrivate* d );
74 
75  public:
76  AbstractModelSynchronizer();
77 
78  virtual ~AbstractModelSynchronizer();
79 
80  public:
81  KUrl url() const;
82 
83  public: // API to be implemented
84  // TODO: makes this a job, too
85  // TODO: filesystem synchronizer (or: to-passive-storage) does not need this: subclass or interface?
86 // virtual void startOffering( AbstractDocument* document ) = 0;
87  // TODO: once the synchronizer is attached to a document, this function should not be called
88  // is there a way to ensure this?
89  virtual AbstractLoadJob* startLoad( const KUrl& url ) = 0;
91  // TODO: not in constructor? cannot be called twice, each synchronizer is attached to its document
92 // virtual AbstractDocument* createWorkingCopy( const KUrl& originUrl, int* success ) const = 0;
93 
95  // TODO: static? or by function? or another class? but
96 // virtual void copyTo( const KUrl& url, AbstractDocument* document, int* success ) const = 0;
97 
99  virtual AbstractSyncToRemoteJob* startSyncToRemote() = 0;
101  virtual AbstractSyncFromRemoteJob* startSyncFromRemote() = 0;
102  // TODO: better name for replace: overwrite?
104  virtual AbstractSyncWithRemoteJob* startSyncWithRemote( const KUrl& url, AbstractModelSynchronizer::ConnectOption option ) = 0;
105 
106  virtual AbstractConnectJob* startConnect( AbstractDocument* document,
107  const KUrl& url, AbstractModelSynchronizer::ConnectOption option ) = 0;
108 // virtual bool syncBiDirectly() = 0;
109 // virtual bool canSyncBiDirectly() const = 0;
110 // virtual bool deleteDocument();
111 
112  virtual AbstractDocument* document() const = 0;
113  virtual LocalSyncState localSyncState() const = 0;
114  virtual RemoteSyncState remoteSyncState() const = 0;
115 
116 
117  Q_SIGNALS:
118  void urlChanged( const KUrl& url );
119  // TODO: next two could be part of an interface? parameter quite specific
120  void dataPulled( int ) const;
121  void dataPushed( int ) const;
122 
123  // TODO: should be signal the diff? how to say then remote is in synch again?
124  // could be done by pairs of flags instead of notset = isnot
125  // TODO: this signal should be part of AbstractModel?
126  void localSyncStateChanged( Kasten2::LocalSyncState newState );
127  void remoteSyncStateChanged( Kasten2::RemoteSyncState newState );
128 
129  protected: // get
130  void setUrl( const KUrl& url );
131 
132  protected:
133  Q_DECLARE_PRIVATE( AbstractModelSynchronizer )
134  protected:
135  AbstractModelSynchronizerPrivate* const d_ptr;
136 };
137 
138 }
139 
140 #endif
Kasten2::LocalSyncState
LocalSyncState
Definition: kastencore.h:33
Kasten2::AbstractSyncToRemoteJob
Definition: abstractsynctoremotejob.h:37
Kasten2::AbstractConnectJob
Definition: abstractconnectjob.h:38
Kasten2::AbstractLoadJob
Definition: abstractloadjob.h:40
QObject
Kasten2::RemoteSyncState
RemoteSyncState
Definition: kastencore.h:39
kastencore_export.h
Kasten2::AbstractDocument
Definition: abstractdocument.h:43
kastencore.h
Kasten2::AbstractModelSynchronizer::ConnectOption
ConnectOption
Definition: abstractmodelsynchronizer.h:66
KASTENCORE_EXPORT
#define KASTENCORE_EXPORT
Definition: kastencore_export.h:36
Kasten2::AbstractModelSynchronizer
possible actions:
Definition: abstractmodelsynchronizer.h:61
Kasten2::AbstractSyncFromRemoteJob
Definition: abstractsyncfromremotejob.h:38
Kasten2::AbstractSyncWithRemoteJob
Definition: abstractsyncwithremotejob.h:38
Kasten2::AbstractModelSynchronizerPrivate
Definition: abstractmodelsynchronizer_p.h:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:06 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okteta

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

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal