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. PDF open problem
Forum Updated to NodeBB v4.3 + New Features

PDF open problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
22 Posts 4 Posters 5.2k Views 1 Watching
  • 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.
  • F Offline
    F Offline
    f.lerdino
    wrote on last edited by
    #1

    After an ubuntu 16.04 upgrade. the openURL, doesn't work.

    QString homePath = QDir::homePath();
    QDesktopServices::openUrl(QUrl(homePath + "/... .pdf"));

    I have this error:

    Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE (.*?)}/ at /usr/bin/run-mailcap line 528.
    No protocol specified
    Failed to connect to Mir: Failed to connect to server socket: Aucun fichier ou dossier de ce type
    Unable to init server: Impossible de se connecter : Connexion refusée
    Cannot parse arguments: Impossible d'ouvrir l'affichage :
    Warning: program returned non-zero exit code #1
    Opening "/home/labotdd/doc3.pdf" with Document Viewer (application/pdf)
    No protocol specified
    Failed to connect to Mir: Failed to connect to server socket: Aucun fichier ou dossier de ce type
    Unable to init server: Impossible de se connecter : Connexion refusée
    Cannot parse arguments: Impossible d'ouvrir l'affichage :
    Running Firefox as root in a regular user's session is not supported. ($HOME is /home/labotdd which is owned by labotdd.)
    Running Firefox as root in a regular user's session is not supported. ($HOME is /home/labotdd which is owned by labotdd.)
    /usr/bin/xdg-open: 778: /usr/bin/xdg-open: iceweasel: not found
    /usr/bin/xdg-open: 778: /usr/bin/xdg-open: seamonkey: not found
    /usr/bin/xdg-open: 778: /usr/bin/xdg-open: mozilla: not found
    /usr/bin/xdg-open: 778: /usr/bin/xdg-open: epiphany: not found
    /usr/bin/xdg-open: 778: /usr/bin/xdg-open: konqueror: not found
    [17836:17836:0719/165325.163206:ERROR:zygote_host_impl_linux.cc(88)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
    /usr/bin/xdg-open: 778: /usr/bin/xdg-open: google-chrome: not found
    /usr/bin/xdg-open: 778: /usr/bin/xdg-open: www-browser: not found
    /usr/bin/xdg-open: 778: /usr/bin/xdg-open: links2: not found
    /usr/bin/xdg-open: 778: /usr/bin/xdg-open: elinks: not found
    /usr/bin/xdg-open: 778: /usr/bin/xdg-open: links: not found
    /usr/bin/xdg-open: 778: /usr/bin/xdg-open: lynx: not found
    /usr/bin/xdg-open: 778: /usr/bin/xdg-open: w3m: not found
    xdg-open: no method available for opening '/home/labotdd/doc3.pdf'

    Any body have a solution or another way to open an external PDF file?

    thanks

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      What happens if you just go and double click the pdf ?
      It seems that your upgrade broke something in the distro.

      1 Reply Last reply
      1
      • F Offline
        F Offline
        f.lerdino
        wrote on last edited by
        #3

        the file is normally opened...
        I also tried to use xdg-open mypdf.pdf and the pdf file has been opened

        mrjjM 1 Reply Last reply
        0
        • F f.lerdino

          the file is normally opened...
          I also tried to use xdg-open mypdf.pdf and the pdf file has been opened

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @f.lerdino
          What Qt is it ?
          Sounds like QDesktopServices broke with update then.
          ( not QDesktopServices faults but something changed in the system)

          JonBJ 1 Reply Last reply
          0
          • mrjjM mrjj

            @f.lerdino
            What Qt is it ?
            Sounds like QDesktopServices broke with update then.
            ( not QDesktopServices faults but something changed in the system)

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            @mrjj
            The final error reads:

            xdg-open: no method available for opening '/home/labotdd/doc3.pdf'

            I don't see how QDesktopServices per se can be blamed for that?

            @f-lerdino
            There are mentions of "root" in the trace. Just to check: you have no root-ness going on when you run the Qt app vs when you do it outside of Qt?

            I also tried to use xdg-open mypdf.pdf and the pdf file has been opened

            Please try with xdg-open /home/labotdd/doc3.pdf

            Also, FWIW, can you try from your Qt app with something other than a .pdf, if your code allows it?

            1 Reply Last reply
            1
            • F Offline
              F Offline
              f.lerdino
              wrote on last edited by
              #6

              for mrjj : I have 5.11.1 and ubuntu 16.04 -kernel 4.13.0.-45.
              for JonB: if I try ro run this 'xdg-open /home/labotdd/doc3.pdf the pdf' the file is opened whitout any problem.

              1 Reply Last reply
              0
              • F Offline
                F Offline
                f.lerdino
                wrote on last edited by
                #7

                @JonB said in PDF open problem:

                Also, FWIW, can you try from your Qt app with something other than a .pdf, if your code allows it?

                I have tried with a txt file and with it works....

                JonBJ 1 Reply Last reply
                0
                • F f.lerdino

                  @JonB said in PDF open problem:

                  Also, FWIW, can you try from your Qt app with something other than a .pdf, if your code allows it?

                  I have tried with a txt file and with it works....

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #8

                  @f.lerdino
                  Root-ness? Do you have anything root-y going on? By any chance, is your Qt app being run as/by root?

                  Is your Qt app a GUI one or command-line only? Are you running Unity or not/other?

                  1 Reply Last reply
                  1
                  • mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Hi
                    Also could you list what
                    xdg-mime query default application/pdf
                    returns ?

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      f.lerdino
                      wrote on last edited by
                      #10

                      @mrjj said in PDF open problem:

                      xdg-mime query default application/pdf

                      labotdd@D7050:/opt/Qt/Tools/QtCreator/bin$ xdg-mime query default application/pdf
                      evince.desktop

                      mrjjM JonBJ 3 Replies Last reply
                      0
                      • F f.lerdino

                        @mrjj said in PDF open problem:

                        xdg-mime query default application/pdf

                        labotdd@D7050:/opt/Qt/Tools/QtCreator/bin$ xdg-mime query default application/pdf
                        evince.desktop

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Ok. so that is not changed.
                        if u type evince in a shell ( normal user) it starts as normally ?

                        F 1 Reply Last reply
                        0
                        • F f.lerdino

                          @mrjj said in PDF open problem:

                          xdg-mime query default application/pdf

                          labotdd@D7050:/opt/Qt/Tools/QtCreator/bin$ xdg-mime query default application/pdf
                          evince.desktop

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by
                          #12

                          @f.lerdino
                          I really think this could be a root issue, which you have not answered. If I deliberately go

                          sudo xdg-open .....pdf
                          

                          I get messages like I see in yours:

                          No protocol specified
                          Unable to init server: Could not connect: Connection refused
                          Cannot parse arguments: Cannot open display: 
                          No protocol specified
                          Unable to init server: Could not connect: Connection refused
                          Cannot parse arguments: Cannot open display: 
                          Warning: program returned non-zero exit code #1
                          
                          1 Reply Last reply
                          1
                          • F f.lerdino

                            @mrjj said in PDF open problem:

                            xdg-mime query default application/pdf

                            labotdd@D7050:/opt/Qt/Tools/QtCreator/bin$ xdg-mime query default application/pdf
                            evince.desktop

                            JonBJ Offline
                            JonBJ Offline
                            JonB
                            wrote on last edited by
                            #13

                            @f.lerdino
                            I think this is not a Qt issue per se, but an Ubuntu 16.04 one. Try Googling for something like ubuntu 16.04 xdg-open. I think https://askubuntu.com/questions/779717/xdg-open-stopped-working-since-16-04-upgrade might be where you'll find what you need to do... ?

                            1 Reply Last reply
                            1
                            • mrjjM mrjj

                              Ok. so that is not changed.
                              if u type evince in a shell ( normal user) it starts as normally ?

                              F Offline
                              F Offline
                              f.lerdino
                              wrote on last edited by
                              #14

                              @mrjj
                              I have an old version of ubuntu and everything work. Something is changed after the ubuntu update. Of course I run my QT Program as root.

                              mrjjM 1 Reply Last reply
                              0
                              • F f.lerdino

                                @mrjj
                                I have an old version of ubuntu and everything work. Something is changed after the ubuntu update. Of course I run my QT Program as root.

                                mrjjM Offline
                                mrjjM Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                @f.lerdino
                                The link @JonB gives , suggest that
                                gvfs-info being deprecated.
                                so that might be your actual issue.
                                (some posts down)

                                1 Reply Last reply
                                0
                                • F Offline
                                  F Offline
                                  f.lerdino
                                  wrote on last edited by
                                  #16

                                  @JonB
                                  I use root to run my Qt program

                                  mrjjM JonBJ 2 Replies Last reply
                                  0
                                  • F f.lerdino

                                    @JonB
                                    I use root to run my Qt program

                                    mrjjM Offline
                                    mrjjM Offline
                                    mrjj
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #17

                                    @f.lerdino
                                    but does it work then if u dont run as root ?

                                    1 Reply Last reply
                                    1
                                    • F f.lerdino

                                      @JonB
                                      I use root to run my Qt program

                                      JonBJ Offline
                                      JonBJ Offline
                                      JonB
                                      wrote on last edited by JonB
                                      #18

                                      @f.lerdino

                                      I use root to run my Qt program

                                      Scary. Which is why I asked earlier.

                                      Given that the error messages you show are complaining as not being able to do stuff as root, I presume when you tested running the xdg-opens and said they worked you did so as root too?

                                      1 Reply Last reply
                                      0
                                      • F Offline
                                        F Offline
                                        f.lerdino
                                        wrote on last edited by
                                        #19

                                        @JonB said in PDF open problem:

                                        Given that the error messages you show are complaining as not being able to do stuff as root, I presume when you tested running the xdg-opens and said they worked you did so as root too?

                                        Yes I have tried as root...

                                        1 Reply Last reply
                                        0
                                        • F Offline
                                          F Offline
                                          f.lerdino
                                          wrote on last edited by
                                          #20

                                          Can I run as external program the pdf viewer + mypdffile in QT/Ubuntu?

                                          Thanks

                                          mrjjM 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