📄 syncappinterface.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/edba/dist/qtopia/main-Sunday/qtopia/src/qtopiadesktop/doc/syncapp.doc:2 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>SyncAppInterface Class</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td width="200" align="left" valign="top"><a href="index.html"><img height="27" width="472" src="dochead.png" border="0"></a><br><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" align="center" size=32>Qtopia</font> <a href="index.html">Home</a> - <a href="qtopiaclasses.html">Classes</a> - <a href="qtopiaannotated.html">Annotated</a> - <a href="qtopiafunctions.html">Functions</a> - <a href="qtindex.html">Qt Embedded</a></td><td align="right" valign="top"> <table border="0" cellpadding="0" cellspacing="0" width="137"> <tr> <td><a href="http://www.trolltech.com/company/about/trolls.html"><img height="100" width="100" src="face.png" border="0"></a></td> <td><img height="100" width="100" src="qtlogo.png" align="top" border="0"></td> </tr> </table></td></tr></table><h1 align=center>SyncAppInterface Class Reference</h1><p>The SyncAppInterface class provides an interface for loadingand saving data of a Qtopia application.<a href="#details">More...</a><p><tt>#include <<a href="syncapp-h.html">interfaces/syncapp.h</a>></tt><p><a href="syncappinterface-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn>virtual void <a href="#start"><b>start</b></a> ( CenterInterface * ) = 0</div></li><li><div class=fn>enum <a href="#MergeAction-enum"><b>MergeAction</b></a> { AutoMerge, ManualMerge, Conflicting }</div></li><li><div class=fn>virtual MergeAction <a href="#merge"><b>merge</b></a> ( const MergeML::Change & rec1, const MergeML::Change & rec2, QValueList<MergeML::Change> & manualMergeOut ) = 0</div></li><li><div class=fn>virtual bool <a href="#mergeChangeChange"><b>mergeChangeChange</b></a> () const = 0</div></li><li><div class=fn>virtual void <a href="#done"><b>done</b></a> () = 0</div></li><li><div class=fn>virtual QValueList<MergeML::Record> <a href="#load"><b>load</b></a> ( const QString & dataset, const QString & filename ) const = 0</div></li><li><div class=fn>virtual void <a href="#save"><b>save</b></a> ( const QString & dataset, const QString & filename, const QValueList<MergeML::Record> & ) = 0</div></li><li><div class=fn>enum <a href="#FileLocation-enum"><b>FileLocation</b></a> { Settings, Application, InvalidFileLocation }</div></li><li><div class=fn>virtual QPair<QString, FileLocation> <a href="#fileForDataSet"><b>fileForDataSet</b></a> ( const QString & dataSet ) const = 0</div></li><li><div class=fn>virtual QMap<int, int> <a href="#uniqueness"><b>uniqueness</b></a> ( const QString & dataSet ) const = 0</div></li><li><div class=fn>virtual QString <a href="#keyName"><b>keyName</b></a> ( const QString & dataset, int key ) const = 0</div></li><li><div class=fn>virtual int <a href="#key"><b>key</b></a> ( const QString & dataset, const QString & keyString ) const = 0</div></li><li><div class=fn>virtual QString <a href="#palmtopApplicationName"><b>palmtopApplicationName</b></a> () const = 0</div></li><li><div class=fn>virtual QString <a href="#name"><b>name</b></a> () const = 0</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2> The SyncAppInterface class provides an interface for loadingand saving data of a Qtopia application.<p> For every Qtopia application that should be synced with a QtopiaDesktop component, there has to be exactly one SyncAppInterfaceimplementation capable of reading and saving the Qtopia applicationsnative file format. Qtopia Desktop by default implementsSyncAppInterfaces for the "Contacts", "Calendar" and "Todo List"Qtopia applications.<p> The most important functions in this interface are <a href="#load">load</a>() and <a href="#save">save</a>()which load/save native Qtopia application data from/to afile. Both work on a QValueList of MergeML::Records which thenative applications data is converted to/from.<p> The SyncAppInterface also provides to methods to map integerrepresentations of data keys to their name and vice versa. <a href="#keyName">keyName</a>()returns the name of a key for a given integer representation while<a href="#key">key</a>() returns the integer representing a key of a given name.<p> The <a href="#palmtopApplicationName">palmtopApplicationName</a>() method returns the name of the Qtopiaapplication whose native application data this interface is capableof loading/saving.<p> The <a href="#uniqueness">uniqueness</a>() method returns a mapping of keys and theiruniqueness used in the syncing process.<p> The fileForSyncApp() method returns the name and location of thefile used by the Qtopia application to store application data on theQtopia device.<p> <p> <p>See also <a href="plugininterface.html">PluginInterface</a>, <a href="mergeinterface.html">MergeInterface</a>, <a href="centerinterface.html">CenterInterface</a>, <a href="importinterface.html">ImportInterface</a>, <a href="exportinterface.html">ExportInterface</a> and <a href="qtopiadesktop.html">Qtopia Desktop Classes</a>.<hr><h2>Member Type Documentation</h2><h3 class=fn><a name="FileLocation-enum"></a>SyncAppInterface::FileLocation</h3> <p> This enum describes the location of the file on the device. <ul><li><tt>SyncAppInterface::Settings</tt> - the file exists in the Settings directory.<li><tt>SyncAppInterface::Application</tt> - the file exists in the Application directory.<li><tt>SyncAppInterface::InvalidFileLocation</tt> - there is no file to store or fetch.</ul><h3 class=fn><a name="MergeAction-enum"></a>SyncAppInterface::MergeAction</h3> <p> This enum describes how Qtopia Desktop should handle merges.<ul><li><tt>SyncAppInterface::AutoMerge</tt> - means Qtopia Desktop should do the merge<li><tt>SyncAppInterface::ManualMerge</tt> - means your plugin handled the merge in the <a href="#merge">merge</a>() method<li><tt>SyncAppInterface::Conflicting</tt> - means your plugin did the merge and detected a conflict</ul><hr><h2>Member Function Documentation</h2><h3 class=fn>void <a name="done"></a>SyncAppInterface::done ()<tt> [pure virtual]</tt></h3> <p> This method is called after synchronization is done for your plugin.If you need to do any form of postprocessing after synchronization, you can safely do itin this method.<h3 class=fn>QPair<QString, FileLocation> <a name="fileForDataSet"></a>SyncAppInterface::fileForDataSet ( const QString & dataSet ) const<tt> [pure virtual]</tt></h3> <p> Returns a QPair of the filename and the location used to store datain <em>dataSet</em> format.<h3 class=fn>int <a name="key"></a>SyncAppInterface::key ( const QString & dataset, const QString & keyString ) const<tt> [pure virtual]</tt></h3> <p> Returns the integer representing the key named <em>keyString</em> of dataformat <em>dataset</em>.<h3 class=fn>QString <a name="keyName"></a>SyncAppInterface::keyName ( const QString & dataset, int key ) const<tt> [pure virtual]</tt></h3> <p> Returns the name of the key represented by the integer <em>key</em> ofdata format <em>dataset</em>.<h3 class=fn>QValueList<MergeML::Record> <a name="load"></a>SyncAppInterface::load ( const QString & dataset, const QString & filename ) const<tt> [pure virtual]</tt></h3> <p> This function is called by Qtopia Desktop to read a dataset from afile. It is passed the filename of the file to load in <em>filename</em>and the name of the data format in <em>dataset</em>.<p> It returns a list of MergeML::Records.<h3 class=fn><a href="syncappinterface.html#MergeAction-enum">MergeAction</a> <a name="merge"></a>SyncAppInterface::merge ( const MergeML::Change & rec1, const MergeML::Change & rec2, QValueList<MergeML::Change> & manualMergeOut )<tt> [pure virtual]</tt></h3> <p> Reimplement this method if you need to handle special cases during synchronization which cannot be automaticallyhandled by Qtopia Desktop. Note that all merges will be passed to this method. Return SyncAppInterface::AutoMerge where you wantQtopia Desktop to handle the merges.<p> <em>rec1</em> and <em>rec2</em> is the two records that needs to be merged together. The results of the merge should be writtento <em>manualMergeOut</em>.<p> If you discover a conflict you should return SyncAppInterface::Conflicting after adding your changes to <em>manualMergeOut</em>,otherwise if you did the merge and no conflicts were detected return SyncAppInterface::ManualMerge<p> <h3 class=fn>bool <a name="mergeChangeChange"></a>SyncAppInterface::mergeChangeChange () const<tt> [pure virtual]</tt></h3> <p> Return false in this method if you do not want Qtopia Desktop to attempt merging twochanged records into one change.<h3 class=fn>QString <a name="name"></a>SyncAppInterface::name () const<tt> [pure virtual]</tt></h3> <p> Returns the name of this dataset.<h3 class=fn>QString <a name="palmtopApplicationName"></a>SyncAppInterface::palmtopApplicationName () const<tt> [pure virtual]</tt></h3> <p> Returns the name of the Qtopia Desktop component associated withthis dataset.<h3 class=fn>void <a name="save"></a>SyncAppInterface::save ( const QString & dataset, const QString & filename, const QValueList<MergeML::Record> & )<tt> [pure virtual]</tt></h3> <p> This function is called by Qtopia Desktop to save a list ofMergeML::Records to a file with filename <em>filename</em> in data format<em>dataset</em>.<h3 class=fn>void <a name="start"></a>SyncAppInterface::start ( <a href="centerinterface.html">CenterInterface</a> * )<tt> [pure virtual]</tt></h3> <p> This method is called before synchronization is being started for your plugin.If you need to do any form of preprocessing before synchronization, you can safely do itin this method.<h3 class=fn>QMap<int, int> <a name="uniqueness"></a>SyncAppInterface::uniqueness ( const QString & dataSet ) const<tt> [pure virtual]</tt></h3> <p> Returns a QMap of uniqueness values for keys of data format <em>dataSet</em>.<!-- eof --><hr><p>This file is part of the <a href="../index.html">Qtopia</a> platform,copyright © 1995-2004<a href="http://www.trolltech.com/">Trolltech</a>, all rights reserved.<p><address><hr><div align="center"><table width="100%" cellspacing="0" border="0"><tr><td>Copyright © 2001-2004 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align="right"><div align="right">Qtopia version 2.0.0</div></table></div></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -