Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QDesktopServices and Networkpath

    General and Desktop
    2
    5
    2429
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      Knacktus last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H
        hpollak last edited by

        See "Stackoverflow":http://stackoverflow.com/questions/2773773/make-sure-a-href-local-file-is-opened-outside-of-browser

        1 Reply Last reply Reply Quote 0
        • K
          Knacktus last edited by

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

          1 Reply Last reply Reply Quote 0
          • H
            hpollak last edited by

            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!

            1 Reply Last reply Reply Quote 0
            • K
              Knacktus last edited by

              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

              1 Reply Last reply Reply Quote 0
              • First post
                Last post