QDesktopServices and Networkpath



  • Hi guys,

    I want to use QDesktopServices.openUrl() to open webpages with flash-content, pdf-docs, etc. which are stored in a network-attached storage. The path to the ressources looks like this:

    //nas01/dir/doc.pdf

    embedded in html

    @
    <a href="//nas01/dir/doc.pdf">MyDocumentation</a>
    @

    Opening this url with QDesktopServices.openUrl() doesn't work. However, if I connect this network location to a local drive (e.g. Z:) it does work as expected.

    @
    <a href="Z:\dir\doc.pdf">MyDocumentation</a>
    @

    The problem is, I can't expect the user to map the drive manually.

    Any hints are highly appreciated, cheers,

    Jan





  • But when I paste an network path in IE it works as expected. It just doesn't work with QDesktopServices ....



  • IE is a Browser!!! (try to leave http:// and it will still work but its a thing of the Browser to add it)

    IE is not HTML!



  • Hmmm, okay, I'm not sure if I get it ... so one more example of what I'm doing (I might not have been very clear in my top post, sorry for that ...):

    I've got a html document on //nas01/dir/index.html. I open this html with QWebkit:

    @
    def _init_web_viewer(self):
    self.web_viewer = QtWebKit.QWebView()
    self.web_viewer.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
    self.web_viewer.linkClicked.connect(self.open_in_external_browser)
    self.web_viewer.load(//nas01/dir/index.html)

    def open_in_external_browser(self, url):
        QDesktopServices.openUrl(url)
    

    @

    Now I want that all links in this index.html are opened with the standard applications, e.g. IE (for flash content, I know there're ways to enable this in QWebKit, but I can't use those), Adobe Reader, Word, Outlook, ...

    My html looks like this:

    @
    <!DOCTYPE html>
    <html>
    <head>
    <title>My App</title>
    </head>
    <body>

    <a href="flash_content.html">FlashStuff</a>
    <a href="doc.pdf">MyDocumentation</a>
    <a href="stuff/stuff_doc.pdf">Stuff Documentation</a>

    </body>
    </html>
    @

    All files are located at the nas //nas01/dir/ and subdirs.

    When I replace the locations in the index.html by absolute paths pointing to a mapped drive, e.g. Z:\dir\doc.pdf where //nas01 is mounted at Z:, it does work as expected. Unfortunately I can't do that in my production environment.

    Cheers,

    Jan


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.