• 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
  • kasten
  • core
  • io
  • filesystem
bytearrayrawfilesynchronizer.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the Okteta Kasten module, made within the KDE community.
3 
4  Copyright 2007-2008 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 #include "bytearrayrawfilesynchronizer.h"
24 
25 // lib
26 #include "bytearrayrawfileloadjob.h"
27 #include "bytearrayrawfileconnectjob.h"
28 #include "bytearrayrawfilewritejob.h"
29 #include "bytearrayrawfilereloadjob.h"
30 #include "bytearrayrawfilewritetojob.h"
31 #include "bytearraydocument.h"
32 // Okteta core
33 #include <piecetablebytearraymodel.h>
34 // KDE
35 #include <KUrl>
36 
37 
38 namespace Kasten2
39 {
40 
41 ByteArrayRawFileSynchronizer::ByteArrayRawFileSynchronizer()
42  : mDocument( 0 )
43 {
44  connect( this, SIGNAL(urlChanged(KUrl)), SLOT(onUrlChange(KUrl)) );
45 }
46 
47 AbstractDocument* ByteArrayRawFileSynchronizer::document() const { return mDocument; }
48 
49 LocalSyncState ByteArrayRawFileSynchronizer::localSyncState() const
50 {
51  return mDocument ?
52  (mDocument->content()->isModified() ? LocalHasChanges : LocalInSync) : LocalInSync;
53 }
54 
55 void ByteArrayRawFileSynchronizer::setDocument( ByteArrayDocument* document )
56 {
57  mDocument = document;
58  if( mDocument )
59  connect( mDocument->content(), SIGNAL(modifiedChanged(bool)),
60  SLOT(onModelModified(bool)) );
61 }
62 
63 void ByteArrayRawFileSynchronizer::startOffering( AbstractDocument* document ) { Q_UNUSED(document) }
64 
65 AbstractLoadJob *ByteArrayRawFileSynchronizer::startLoad( const KUrl &url )
66 {
67  return new ByteArrayRawFileLoadJob( this, url );
68 }
69 
70 AbstractSyncToRemoteJob *ByteArrayRawFileSynchronizer::startSyncToRemote()
71 {
72  return new ByteArrayRawFileWriteJob( this );
73 }
74 
75 AbstractSyncFromRemoteJob *ByteArrayRawFileSynchronizer::startSyncFromRemote()
76 {
77  return new ByteArrayRawFileReloadJob( this );
78 }
79 
80 AbstractSyncWithRemoteJob *ByteArrayRawFileSynchronizer::startSyncWithRemote( const KUrl &url, AbstractModelSynchronizer::ConnectOption option )
81 {
82  return new ByteArrayRawFileWriteToJob( this, url, option );
83 }
84 
85 AbstractConnectJob *ByteArrayRawFileSynchronizer::startConnect( AbstractDocument* document,
86  const KUrl& url, AbstractModelSynchronizer::ConnectOption option )
87 {
88  return new ByteArrayRawFileConnectJob( this, document, url, option );
89 }
90 
91 void ByteArrayRawFileSynchronizer::onUrlChange( const KUrl &url )
92 {
93  mDocument->setTitle( url.fileName() );
94 }
95 
96 void ByteArrayRawFileSynchronizer::onModelModified( bool isModified )
97 {
98  emit localSyncStateChanged( (isModified ? LocalHasChanges : LocalInSync) );
99 }
100 
101 }
Kasten2::LocalSyncState
LocalSyncState
Definition: kastencore.h:33
bytearrayrawfilesynchronizer.h
Kasten2::ByteArrayDocument::setTitle
void setTitle(const QString &title)
Definition: bytearraydocument.cpp:76
Kasten2::ByteArrayRawFileSynchronizer::startSyncFromRemote
virtual AbstractSyncFromRemoteJob * startSyncFromRemote()
overwrite local with remote (reload)
Definition: bytearrayrawfilesynchronizer.cpp:75
bytearrayrawfileconnectjob.h
Kasten2::ByteArrayRawFileSynchronizer::startOffering
virtual void startOffering(AbstractDocument *document)
Definition: bytearrayrawfilesynchronizer.cpp:63
Kasten2::AbstractSyncToRemoteJob
Definition: abstractsynctoremotejob.h:37
bytearrayrawfileloadjob.h
Kasten2::AbstractConnectJob
Definition: abstractconnectjob.h:38
Kasten2::AbstractLoadJob
Definition: abstractloadjob.h:40
bytearrayrawfilewritejob.h
Kasten2::ByteArrayRawFileSynchronizer::startSyncWithRemote
virtual AbstractSyncWithRemoteJob * startSyncWithRemote(const KUrl &url, AbstractModelSynchronizer::ConnectOption option)
changes the
Definition: bytearrayrawfilesynchronizer.cpp:80
Kasten2::AbstractModelSynchronizer::localSyncStateChanged
void localSyncStateChanged(Kasten2::LocalSyncState newState)
piecetablebytearraymodel.h
Kasten2::LocalInSync
Definition: kastencore.h:35
Kasten2::ByteArrayRawFileSynchronizer::ByteArrayRawFileLoadJob
friend class ByteArrayRawFileLoadJob
Definition: bytearrayrawfilesynchronizer.h:41
Kasten2::ByteArrayRawFileSynchronizer::document
virtual AbstractDocument * document() const
Definition: bytearrayrawfilesynchronizer.cpp:47
Kasten2::ByteArrayRawFileSynchronizer::setDocument
void setDocument(ByteArrayDocument *document)
Definition: bytearrayrawfilesynchronizer.cpp:55
Kasten2::ByteArrayRawFileSynchronizer::localSyncState
virtual LocalSyncState localSyncState() const
Definition: bytearrayrawfilesynchronizer.cpp:49
Kasten2::ByteArrayRawFileSynchronizer::startSyncToRemote
virtual AbstractSyncToRemoteJob * startSyncToRemote()
overwrite remote with local (save)
Definition: bytearrayrawfilesynchronizer.cpp:70
Kasten2::ByteArrayRawFileWriteJob
Definition: bytearrayrawfilewritejob.h:36
Kasten2::ByteArrayRawFileSynchronizer::startLoad
virtual AbstractLoadJob * startLoad(const KUrl &url)
Definition: bytearrayrawfilesynchronizer.cpp:65
bytearrayrawfilewritetojob.h
Kasten2::AbstractModelSynchronizer::urlChanged
void urlChanged(const KUrl &url)
Kasten2::ByteArrayDocument::content
virtual Okteta::AbstractByteArrayModel * content() const
Definition: bytearraydocument.cpp:61
bytearrayrawfilereloadjob.h
Okteta::AbstractByteArrayModel::isModified
virtual bool isModified() const =0
Kasten2::AbstractDocument
Definition: abstractdocument.h:43
Kasten2::ByteArrayRawFileWriteToJob
Definition: bytearrayrawfilewritetojob.h:36
Kasten2::ByteArrayRawFileSynchronizer::startConnect
virtual AbstractConnectJob * startConnect(AbstractDocument *document, const KUrl &url, AbstractModelSynchronizer::ConnectOption option)
Definition: bytearrayrawfilesynchronizer.cpp:85
Kasten2::AbstractModelSynchronizer::ConnectOption
ConnectOption
Definition: abstractmodelsynchronizer.h:66
Kasten2::ByteArrayRawFileSynchronizer::ByteArrayRawFileConnectJob
friend class ByteArrayRawFileConnectJob
Definition: bytearrayrawfilesynchronizer.h:42
Kasten2::ByteArrayDocument
Definition: bytearraydocument.h:54
Kasten2::ByteArrayRawFileReloadJob
Definition: bytearrayrawfilereloadjob.h:36
Kasten2::AbstractSyncFromRemoteJob
Definition: abstractsyncfromremotejob.h:38
bytearraydocument.h
Kasten2::AbstractSyncWithRemoteJob
Definition: abstractsyncwithremotejob.h:38
Kasten2::LocalHasChanges
Definition: kastencore.h:36
Kasten2::ByteArrayRawFileSynchronizer::ByteArrayRawFileSynchronizer
ByteArrayRawFileSynchronizer()
Definition: bytearrayrawfilesynchronizer.cpp:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:07 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