⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qtopiadesktopoverview.html

📁 qtopiaphone英文帮助,用于初学者和开发人员,初学者可以用来学习,开发人员可以用来资料查询.
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/edba/dist/qtopia/main-Sunday/qtopia/doc/qtopiadesktop.doc:1 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Qtopia Desktop and Syncing Framework</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>Qtopia Desktop and Syncing Framework</h1><p> <!-- toc --><ul><li><a href="#1"> Introduction</a><li><a href="#2"> Architecture and Plugins</a><li><a href="#3"> Synchronization Architecture and Algorithms</a><ul><li><a href="#3-1"> Data Conversion during Synchronization</a></ul><li><a href="#4"> Implementing a Plugin</a></ul><!-- endtoc --><p> <b>Warning:</b> The Qtopia Desktop synchronization framework is stillexperimental. Note that the API may be changed for the next Qtopiarelease.<p> <h2> Introduction</h2><a name="1"></a><p> Qtopia Desktop is the Qtopia application that runs on a end-usersdesktop. It provides the end-user with the following functionality:<ul><li> enter information into Qtopia<li> view Qtopia's information<li> synchronize information between Qtopia Desktop and the embedded device<li> synchronize information directly from 3rd party applictions and theembedded device<li> transfer documents<li> install applications on the embedded device from the internet or yourmachine<li> import and export data between 3rd party applications and Qtopia</ul><p> Qtopia Desktop can easily be extended by the developer to be able toextend the above functionality for their application's data. In fact,most existing functionality provided by Qtopia Desktop is provided byTrolltech using this architecture. Every icon seen on the left handcolumn of Qtopia Desktop is using the same architecture andAPIs that is exposed to any developer.<p> For historical reasons, you may see the name Palmtop Centerin function names or the code. This was an earlier name forQtopia Desktop.<p> <h2> Architecture and Plugins</h2><a name="2"></a><p> Qtopia Desktop has modular and flexible design allowing end-users to easilyinstall plugins to integrate Qtopia into their daily work environment.<p> Developers can access this architecture by writing a <em>plugin</em>for Qtopia Desktop. A plugin is written by implementing interfacesdefined by Qtopia Desktop.<p> The available interfaces allow the developer to:<ul><li> write their own visual plugin for entering information ortransfering documents -  <a href="plugininterface.html">PluginInterface</a><li> synchronize their data and files - <a href="syncappinterface.html">SyncAppInterface</a> and <a href="mergeinterface.html">MergeInterface</a><li> import external data to Qtopia - <a href="importinterface.html">ImportInterface</a><li> export Qtopia's data - <a href="exportinterface.html">ExportInterface</a> <i>not yet supported</i></ul><p> Qtopia Desktop provides each plugin with access to the <a href="centerinterface.html">CenterInterface</a>.The CenterInterface class allows each plugin to use the functionalityprovided by Qtopia Desktop.<p> When Qtopia Desktop starts up it scans for plugins and registers anyplugins that support the interfaces. Qtopia Desktop will look in thesubdirectory under the installed directory called lib. Plugininstallations should place their shared object libraries in the<installed directory>/lib<p> <h2> Synchronization Architecture and Algorithms</h2><a name="3"></a><p> Qtopia Desktop contains the algorithms for synchronization for anyplugin.<p> Qtopia Desktop handles synchronizing multiple plugins working on thesame application data.  So there can be multiple plugins thatsynchronize Contacts data such as Qtopia's Contacts and MyDesktop PIM Application's address book.<p> The sync algorithm remembers the last state of each plugin when it waslast synced. It then uses that information to determine what changeshave occured in each plugin. A master document is created by merging those changes. Each plugin is then given a list of changesthat it should apply so that its contents will be same as themaster document.<p> The diffs are performed at a field level, so a conflict is created ifthe user modifies the same field of the same record in multipleplugins or interfaces. The algorithm used for conflict resolution oftwo records depends on what the user has selected in theSettings->Sync dialog (currently, the user can choose from duplicatingrecords, or letting the pda or the desktop win).<p> This algorirthm requires two main methods for each plugin:<ul><li> each plugin to convert it's data to a generic record format definedby Qtopia Desktop - <a href="mergeinterface.html#data">MergeInterface::data</a>()<li> each plugin to apply the changes made during merging to itself -<a href="mergeinterface.html#applyChanges">MergeInterface::applyChanges</a>()</ul><p> Currently, the only architecture supported is synchronizing that data that needs to be merged together. Future versions willsupport plugins that simply wish to transfer a set of files and possiblydo manual operations on those files.<p> <h3> Data Conversion during Synchronization</h3><a name="3-1"></a><p> Qtopia Desktop requires each plugin to convert it's data between theplugin's internal representation of its data and a generic way todefine any data. Qtopia Desktop uses MergeML::Record as a genericstorage class for anyone's data.  MergeML::Record stores its data inan QMap&lt;int, QString&gt;, where the key refers to the type of field in the map.<p> For the core pims (Contacts, Tasks and <a href="calendar.html">Calendar</a>), the integervalues used in the QMap&lt;int, QString&gt; have been defined in their PIMlibrary classes. There are individual record classes for these datasets, which are Contact, Task and Event, respectively. These classesprovide convenience methods which convert to and from aQMap&lt;int,QString&gt; . Each class has a toMap() method and a constructor that takes the QMap&lt;int,QString&gt; in their constructor.<p> There are static templated methods provided in mergeml.h that help thedeveloper convert between a lists of QMap&lt;int,QString&gt; and a list ofthese PIM classes. They are MergeML::convertToML() andMergeML::convertFromML(). These templated methods will be helpfull for thedeveloper when implementing <a href="syncappinterface.html#load">SyncAppInterface::load</a>() and<a href="syncappinterface.html#save">SyncAppInterface::save</a>().<p> <h2> Implementing a Plugin</h2><a name="4"></a><p> Each plugin implementation needs to define some pure virtual methods definedin the plugin hierarchy. Each plugin must define the following methods:<pre>    QRESULT queryInterface( const <a href="quuid.html">QUuid</a>&amp;, QUnknownInterface** );    Q_REFCOUNT    QString name() const;    QString description() const;    QString version() const;    QString author() const;</pre> <p> The name() method and queryInterface() are the most important. Thedescription(), version() and author() methods are all purelyinformational and not currently displayed by Qtopia Desktop but maybein the future.<p> The PluginInterface::name() method defines the display name shown inthe plugin selection area on the left hand side of the screen. Thename() method is purely descriptive for all other interfaces.<p> The implementation of queryInterface() allows QtopiaDesktop determine what type of interface your plugin implements whenit registers your plugin at startup.<p> In the the interfaces .cpp file, the following code must be present<pre>Q_EXPORT_INTERFACE(){    Q_CREATE_INSTANCE( AddressBook )}  QRESULT AddressBook::queryInterface( const <a href="quuid.html">QUuid</a> &amp;uuid,    QUnknownInterface** iface ){    *iface = 0;    if ( uuid == IID_QUnknown )        *iface = (QUnknownInterface*) (PluginInterface*) this;    else if ( uuid == IID_QComponentInformation )        *iface = (QComponentInformationInterface*)(PluginInterface *) this;    else if ( uuid == IID_PalmtopCenterPlugin )        *iface = (PluginInterface*)this;    else if ( uuid == IID_SyncAppInterface )        *iface = (SyncAppInterface*)this;    else if ( uuid == IID_MergeInterface )        *iface = (MergeInterface*)this;    else        return QE_NOINTERFACE;    (*iface)-&gt;addRef();    return QS_OK;}</pre> <p> The exact implementation of the queryInterface() method depends onwhich interfaces your plugin is implementing. Each plugin shouldonly have one implementation of queryInterface. Each plugin canimplement more than one interface as shown above. (And multipleinterfaces can be implemented by the same class as shownabove). Every interface other than <a href="syncappinterface.html">SyncAppInterface</a> implements bothQUnknownInterface and QComponentInformationInterface and shouldreturn as such as shown above.<!-- eof --><p><address><hr><div align="center"><table width="100%" cellspacing="0" border="0"><tr><td>Copyright &copy; 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 + -