Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDesktopServices and Networkpath

QDesktopServices and Networkpath

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.7k Views
  • 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 Offline
    K Offline
    Knacktus
    wrote on last edited by
    #1

    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
    0
    • H Offline
      H Offline
      hpollak
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Knacktus
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hpollak
          wrote on last edited by
          #4

          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
          0
          • K Offline
            K Offline
            Knacktus
            wrote on last edited by
            #5

            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
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved