Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 1973

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<class name="QDesktopServices" doc="/**
&lt;p&gt;The &lt;a href=&quot;QDesktopServices.html#QDesktopServices()&quot;&gt;&lt;tt&gt;QDesktopServices&lt;/tt&gt;&lt;/a&gt; class provides methods for accessing common desktop services.&lt;/p&gt;
&lt;p&gt;Many desktop environments provide services that can be used by applications to perform common tasks, such as opening a web page, in a way that is both consistent and takes into account the user's application preferences.&lt;/p&gt;
&lt;p&gt;This class contains functions that provide simple interfaces to these services that indicate whether they succeeded or failed.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;QDesktopServices.html#openUrl(com.trolltech.qt.core.QUrl)&quot;&gt;&lt;tt&gt;openUrl&lt;/tt&gt;&lt;/a&gt; function is used to open files located at arbitrary URLs in external applications. For URLs that correspond to resources on the local filing system (where the URL scheme is &amp;quot;file&amp;quot;), a suitable application will be used to open the file; otherwise, a web browser will be used to fetch and display the file.&lt;/p&gt;
&lt;p&gt;The user's desktop settings control whether certain executable file types are opened for browsing, or if they are executed instead. Some desktop environments are configured to prevent users from executing files obtained from non-local URLs, or to ask the user's permission before doing so.&lt;/p&gt;
&lt;a name=&quot;url-handlers&quot;&gt;&lt;/a&gt;
&lt;h3&gt;URL Handlers&lt;/h3&gt;
&lt;p&gt;The behavior of the &lt;a href=&quot;QDesktopServices.html#openUrl(com.trolltech.qt.core.QUrl)&quot;&gt;&lt;tt&gt;openUrl&lt;/tt&gt;&lt;/a&gt; function can be customized for individual URL schemes to allow applications to override the default handling behavior for certain types of URLs.&lt;/p&gt;
&lt;p&gt;The dispatch mechanism allows only one custom handler to be used for each URL scheme; this is set using the setUrlHandler() function. Each handler is implemented as a slot which accepts only a single &lt;a href=&quot;%2E%2E/core/QUrl.html&quot;&gt;&lt;tt&gt;QUrl&lt;/tt&gt;&lt;/a&gt; argument.&lt;/p&gt;
&lt;p&gt;The existing handlers for each scheme can be removed with the &lt;a href=&quot;QDesktopServices.html#unsetUrlHandler(java.lang.String)&quot;&gt;&lt;tt&gt;unsetUrlHandler&lt;/tt&gt;&lt;/a&gt; function. This returns the handling behavior for the given scheme to the default behavior.&lt;/p&gt;
&lt;p&gt;This system makes it easy to implement a help system, for example. Help could be provided in labels and text browsers using &lt;b&gt;help://myapplication/mytopic&lt;/b&gt; URLs, and by registering a handler it becomes possible to display the help text inside the application:&lt;/p&gt;
&lt;pre&gt;    class MyHelpHandler : public QObject
    {
        Q_OBJECT
    public:
        ...
    public slots:
        void showHelp(const QUrl &amp;amp;url);
    };

    QDesktopServices::setUrlHandler(&amp;quot;help&amp;quot;, helpInstance, &amp;quot;showHelp&amp;quot;);&lt;/pre&gt;
&lt;p&gt;If inside the handler you decide that you can't open the requested URL, you can just call QDesktopServices::openUrl() again with the same argument, and it will try to open the URL using the appropriate mechanism for the user's desktop environment.&lt;/p&gt;

@see &lt;a href=&quot;QSystemTrayIcon.html&quot;&gt;&lt;tt&gt;QSystemTrayIcon&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;%2E%2E/core/QProcess.html&quot;&gt;&lt;tt&gt;QProcess&lt;/tt&gt;&lt;/a&gt; */">
    <method name="public QDesktopServices()"/>
    <method name="public static boolean openUrl(com.trolltech.qt.core.QUrl url)" doc="/**
&lt;p&gt;Opens the given &lt;tt&gt;url&lt;/tt&gt; in the appropriate web browser for the user's desktop environment, and returns true if successful; otherwise returns false.&lt;/p&gt;
&lt;p&gt;If the URL is a reference to a local file (i.e&amp;#x2e; the URL scheme is &amp;quot;file&amp;quot;) then it will be opened with a suitable application instead of a web browser.&lt;/p&gt;
&lt;p&gt;If a &lt;tt&gt;mailto&lt;/tt&gt; URL is specified, the user's e-mail client will be used to open a composer window containing the options specified in the URL, similar to the way &lt;tt&gt;mailto&lt;/tt&gt; links are handled by a web browser.&lt;/p&gt;
&lt;p&gt;For example, the following URL contains a recipient (&lt;tt&gt;user@foo.com&lt;/tt&gt;), a subject (&lt;tt&gt;Test&lt;/tt&gt;), and a message body (&lt;tt&gt;Just a test&lt;/tt&gt;):&lt;/p&gt;
&lt;pre&gt;    mailto:user@foo.com?subject=Test&amp;amp;body=Just a test&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Warning:&lt;/b&gt; Although many e-mail clients can send attachments and are Unicode-aware, the user may have configured their client without these features. Also, certain e-mail clients (e.g&amp;#x2e;, Lotus Notes) have problems with long URLs.&lt;/p&gt;

@see &lt;tt&gt;setUrlHandler&lt;/tt&gt; */"/>
    <method name="public native static void unsetUrlHandler(java.lang.String scheme)" doc="/**
&lt;p&gt;Removes a previously set url handler for the specified &lt;tt&gt;scheme&lt;/tt&gt;.&lt;/p&gt;
 */"/>
</class>