diff options
author | David Boddie <dboddie@trolltech.com> | 2009-03-30 16:11:04 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2009-03-30 16:12:49 (GMT) |
commit | e475c68f22732553caad350608f2539db7694979 (patch) | |
tree | 96fd1d68f82233d5411ff007dc058db7bb0d8385 | |
parent | b91da630b8b1d043bd8ebe52df6fd9c562564d89 (diff) | |
download | Qt-e475c68f22732553caad350608f2539db7694979.zip Qt-e475c68f22732553caad350608f2539db7694979.tar.gz Qt-e475c68f22732553caad350608f2539db7694979.tar.bz2 |
Doc: Added a code snippet to illustrate the opening of local files.
Task-number: 223087
Reviewed-by: TrustMe
-rw-r--r-- | doc/src/snippets/code/src_gui_util_qdesktopservices.cpp | 5 | ||||
-rw-r--r-- | src/gui/util/qdesktopservices.cpp | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp b/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp index a9c630b..5001984 100644 --- a/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp +++ b/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp @@ -11,7 +11,10 @@ public slots: QDesktopServices::setUrlHandler("help", helpInstance, "showHelp"); //! [0] - //! [1] mailto:user@foo.com?subject=Test&body=Just a test //! [1] + +//! [2] +QDesktopServices::openUrl(QUrl("file:///C:/Documents and Settings/All Users/Desktop", QUrl::TolerantMode)); +//! [2] diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 0fe1d69..84aa16e 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -157,6 +157,11 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler) If the URL is a reference to a local file (i.e., the URL scheme is "file") then it will be opened with a suitable application instead of a Web browser. + The following example opens a file on the Windows file system residing on a path + that contains spaces: + + \snippet doc/src/snippets/code/src_gui_util_qdesktopservices.cpp 2 + If a \c mailto 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 \c mailto links are handled by a Web browser. |