📄 applnk.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/edba/dist/qtopia/main-Sunday/qtopia/src/libraries/qtopia/applnk.cpp:287 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>AppLnk 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>AppLnk Class Reference</h1><p>The AppLnk class represents an application available on the system.<a href="#details">More...</a><p><tt>#include <<a href="applnk-h.html">applnk.h</a>></tt><p>Inherited by <a href="doclnk.html">DocLnk</a>.<p><a href="applnk-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#AppLnk"><b>AppLnk</b></a> ()</div></li><li><div class=fn><a href="#AppLnk-2"><b>AppLnk</b></a> ( const QString & file )</div></li><li><div class=fn><a href="#AppLnk-3"><b>AppLnk</b></a> ( const AppLnk & copy )</div></li><li><div class=fn>virtual <a href="#~AppLnk"><b>~AppLnk</b></a> ()</div></li><li><div class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</div></li><li><div class=fn>QString <a href="#name"><b>name</b></a> () const</div></li><li><div class=fn>const QPixmap & <a href="#pixmap"><b>pixmap</b></a> () const</div></li><li><div class=fn>const QPixmap & <a href="#bigPixmap"><b>bigPixmap</b></a> () const</div></li><li><div class=fn>QString <a href="#icon"><b>icon</b></a> () const</div></li><li><div class=fn>virtual QString <a href="#exec"><b>exec</b></a> () const</div></li><li><div class=fn>QString <a href="#type"><b>type</b></a> () const</div></li><li><div class=fn>QString <a href="#rotation"><b>rotation</b></a> () const</div></li><li><div class=fn>QString <a href="#comment"><b>comment</b></a> () const</div></li><li><div class=fn>QString <a href="#file"><b>file</b></a> () const</div></li><li><div class=fn>QString <a href="#linkFile"><b>linkFile</b></a> () const</div></li><li><div class=fn>QStringList <a href="#mimeTypes"><b>mimeTypes</b></a> () const</div></li><li><div class=fn>QStringList <a href="#mimeTypeIcons"><b>mimeTypeIcons</b></a> () const</div></li><li><div class=fn>const QArray<int> & <a href="#categories"><b>categories</b></a> () const</div></li><li><div class=fn>int <a href="#id"><b>id</b></a> () const</div></li><li><div class=fn>bool <a href="#fileKnown"><b>fileKnown</b></a> () const</div></li><li><div class=fn>bool <a href="#linkFileKnown"><b>linkFileKnown</b></a> () const</div></li><li><div class=fn>void <a href="#execute-2"><b>execute</b></a> () const</div></li><li><div class=fn>void <a href="#execute"><b>execute</b></a> ( const QStringList & args ) const</div></li><li><div class=fn>void <a href="#removeFiles"><b>removeFiles</b></a> ()</div></li><li><div class=fn>void <a href="#removeLinkFile"><b>removeLinkFile</b></a> ()</div></li><li><div class=fn>void <a href="#setName"><b>setName</b></a> ( const QString & docname )</div></li><li><div class=fn>void <a href="#setExec"><b>setExec</b></a> ( const QString & exec )</div></li><li><div class=fn>void <a href="#setFile"><b>setFile</b></a> ( const QString & filename )</div></li><li><div class=fn>void <a href="#setLinkFile"><b>setLinkFile</b></a> ( const QString & filename )</div></li><li><div class=fn>void <a href="#setComment"><b>setComment</b></a> ( const QString & comment )</div></li><li><div class=fn>void <a href="#setType"><b>setType</b></a> ( const QString & type )</div></li><li><div class=fn>void <a href="#setIcon"><b>setIcon</b></a> ( const QString & iconname )</div></li><li><div class=fn>void <a href="#setCategories"><b>setCategories</b></a> ( const QArray<int> & c )</div></li><li><div class=fn>bool <a href="#writeLink"><b>writeLink</b></a> () const</div></li><li><div class=fn>void <a href="#setProperty"><b>setProperty</b></a> ( const QString & key, const QString & value )</div></li><li><div class=fn>QString <a href="#property"><b>property</b></a> ( const QString & key ) const</div></li><li><div class=fn>bool <a href="#setLocation"><b>setLocation</b></a> ( const QString & docPath )</div></li><li><div class=fn>bool <a href="#isDocLnk"><b>isDocLnk</b></a> () const</div></li><li><div class=fn>AppLnk & <a href="#operator-eq"><b>operator=</b></a> ( const AppLnk & copy )</div></li></ul><h2>Static Public Members</h2><ul><li><div class=fn>void <a href="#setSmallIconSize"><b>setSmallIconSize</b></a> ( int small )</div></li><li><div class=fn>void <a href="#setBigIconSize"><b>setBigIconSize</b></a> ( int big )</div></li><li><div class=fn>int <a href="#smallIconSize"><b>smallIconSize</b></a> ()</div></li><li><div class=fn>int <a href="#bigIconSize"><b>bigIconSize</b></a> ()</div></li></ul><h2>Protected Members</h2><ul><li><div class=fn>virtual void <a href="#invoke"><b>invoke</b></a> ( const QStringList & args ) const</div></li><li><div class=fn>bool <a href="#ensureLinkExists"><b>ensureLinkExists</b></a> () const</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2>The AppLnk class represents an application available on the system.<p> Every Qtopia application <em>app</em> has a corresponding <em>app.desktop</em>file. When one of these files is read its data is stored as anAppLnk object.<p> The AppLnk class introduces some Qtopia-specific concepts, andprovides a variety of functions, as described in the followingsections.<!-- toc --><ul><li><a href="#1"> Types</a><li><a href="#1-1"> Files and Links</a><li><a href="#1-2"> Functionality</a></ul><!-- endtoc --><p> <a name="Types"></a><h3> Types</h3><a name="1"></a><p> Every AppLnk object has a <em>type</em>. For applications, games andsettings the type is <tt>Application</tt>; for documents thetype is the document's MIME type.<p> <a name="files-and-links"></a><h3> Files and Links</h3><a name="1-1"></a><p> When you create an AppLnk (or more likely, a <a href="doclnk.html">DocLnk</a>), you don't deal directly with filenames in thefilesystem. Instead you do this:<pre> <a href="doclnk.html">DocLnk</a> d; d.<a href="#setType">setType</a>("text/plain"); d.<a href="#setName">setName</a>("My Nicely Named Document / Whatever"); // Yes, "/" is legal. </pre> At this point, the <a href="#file">file</a>() and <a href="#linkFile">linkFile</a>() are unknown. Normallythis is uninteresting, and the names become automatically known,and more importantly, becomes reserved, when you ask what they are:<p> <pre> QString fn = d.file(); </pre> This invents a filename, and creates the file on disk (an emptyreservation file) to prevent the name being used by anotherapplication.<p> In some circumstances, you don't want to create the file if itdoesn't already exist (e.g. in the Document tab, some of the <a href="doclnk.html">DocLnk</a> objects represented by icons are<a href="doclnk.html">DocLnk</a>'s created just for that view - they don't havecorresponding <tt>.desktop</tt> files. To avoid littering emptyreservation files around, we check in a few places to see whetherthe file really needs to exist).<p> <h3> Functionality</h3><a name="1-2"></a><p> AppLnk objects are created by calling the constructor with thename of a <em>.desktop</em> file. The object can be checked for validityusing <a href="#isValid">isValid</a>().<p> The following functions are used to set or retrieve informationabout the application:<center><table cellpadding="4" cellspacing="2" border="0"><tr bgcolor="#a2c511"> <th valign="top">Get Function <th valign="top">Set Function <th valign="top">Short Description<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#name">name</a>() <td valign="top"><a href="#setName">setName</a>() <td valign="top">application's name<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#pixmap">pixmap</a>() <td valign="top"><em>none</em> <td valign="top">application's icon<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#bigPixmap">bigPixmap</a>() <td valign="top"><em>none</em> <td valign="top">application's large icon<tr bgcolor="#d0d0d0"> <td valign="top"><em>none</em> <td valign="top">setIcon() <td valign="top">sets the icon's filename<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#type">type</a>() <td valign="top"><a href="#setType">setType</a>() <td valign="top">see <a href="#Types">Types</a> above<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#rotation">rotation</a>() <td valign="top"><em>none</em> <td valign="top">0, 90, 180 or 270 degrees<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#comment">comment</a>() <td valign="top"><a href="#setComment">setComment</a>() <td valign="top">text for the Details dialog<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#exec">exec</a>() <td valign="top"><a href="#setExec">setExec</a>() <td valign="top">executable's filename<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#file">file</a>() <td valign="top"><em>none</em> <td valign="top">document's filename<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#linkFile">linkFile</a>() <td valign="top"><a href="#setLinkFile">setLinkFile</a>() <td valign="top"><em>.desktop</em> filename<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#mimeTypes">mimeTypes</a>() <td valign="top"><em>none</em> <td valign="top">the mime types the application can view or edit<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#categories">categories</a>() <td valign="top"><a href="#setCategories">setCategories</a>() <td valign="top"><em>see the function descriptions</em><tr bgcolor="#f0f0f0"> <td valign="top"><a href="#fileKnown">fileKnown</a>() <td valign="top"><em>none</em> <td valign="top">see <a href="#files-and-links">Files and Links</a> above<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#linkFileKnown">linkFileKnown</a>() <td valign="top"><em>none</em> <td valign="top">see <a href="#files-and-links">Files and Links</a> above<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#property">property</a>() <td valign="top"><a href="#setProperty">setProperty</a>() <td valign="top">any AppLnk propertycan be retrieved or set (if writeable) using these</table></center><p> To save an AppLnk to disk use <a href="#writeLink">writeLink</a>(). To execute theapplication that the AppLnk object refers to, use <a href="#execute">execute</a>().<p> AppLnk's can be deleted from disk using <a href="#removeLinkFile">removeLinkFile</a>(). Toremove both the link and the application's executable use<a href="#removeFiles">removeFiles</a>().<p> Icon sizes can be globally changed (but only for AppLnk objectscreated after the calls) with <a href="#setSmallIconSize">setSmallIconSize</a>() and<a href="#setBigIconSize">setBigIconSize</a>().<p> <p>See also <a href="qtopiaemb.html">Qtopia Classes</a>.<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="AppLnk"></a>AppLnk::AppLnk ()</h3>Creates an invalid AppLnk.<p> <p>See also <a href="#isValid">isValid</a>().<h3 class=fn><a name="AppLnk-2"></a>AppLnk::AppLnk ( const QString & file )</h3>Loads <em>file</em> (e.g. <em>app.desktop</em>) as an AppLnk.<p> <p>See also <a href="#writeLink">writeLink</a>().<h3 class=fn><a name="AppLnk-3"></a>AppLnk::AppLnk ( const <a href="applnk.html">AppLnk</a> & copy )</h3>Copies <em>copy</em>.<h3 class=fn><a name="~AppLnk"></a>AppLnk::~AppLnk ()<tt> [virtual]</tt></h3>Destroys the AppLnk. Note that if the AppLnk is currently a memberof an <a href="applnkset.html">AppLnkSet</a>, this will produce a run-time warning.<p> <p>See also <a href="applnkset.html#add">AppLnkSet::add</a>() and <a href="applnkset.html#remove">AppLnkSet::remove</a>().<h3 class=fn>int <a name="bigIconSize"></a>AppLnk::bigIconSize ()<tt> [static]</tt></h3>Returns the size used for large icons.<p> <p>See also <a href="#setBigIconSize">setBigIconSize</a>() and <a href="#setIcon">setIcon</a>().<h3 class=fn>const QPixmap & <a name="bigPixmap"></a>AppLnk::bigPixmap () const</h3>Returns a large pixmap associated with the application.<p> <p>See also <a href="#pixmap">pixmap</a>() and <a href="#setIcon">setIcon</a>().<h3 class=fn>const QArray<int> & <a name="categories"></a>AppLnk::categories () const</h3><p> Returns a shallow copy of the <a href="categories.html">Categories</a> property.<p> See the CategoryWidget for more details.<p> <p>See also <a href="#setCategories">setCategories</a>().<h3 class=fn>QString <a name="comment"></a>AppLnk::comment () const</h3><p> Returns the Comment property.<p> <p>See also <a href="#setComment">setComment</a>().
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -