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. My app's stored files' shape are as unknown files
Forum Updated to NodeBB v4.3 + New Features

My app's stored files' shape are as unknown files

Scheduled Pinned Locked Moved Unsolved General and Desktop
21 Posts 4 Posters 7.0k 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.
  • tomyT Offline
    tomyT Offline
    tomy
    wrote on last edited by
    #1

    Here is the program and below is the screenshot of the issue.

    0_1503319716705_1.PNG

    There are 2 MS Office files (a MS Word and a MS Excel) and 4 my spreadsheet files.
    The spreadsheet app works well up to now, but as you see, the files created using it are not shown as ordinary programs' specific files. They work if I double click on them and open by the spreadsheet app but the shape of the files, as they are shown above, are like unknown files. :(
    How to change it please?

    I've read most of the program's code but didn't see that part that determines the shape of the stored files. I would be grateful if you tell me how I can solve that issue.

    S 1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      If you cold post your project is a friendlier place (pastebin, github, bitbucket) it would be helpful.

      My first guess is that you simply forgot to add the extension (.csv, .xls, .xlsx, .doc)?

      EDIT:

      I misunderstood your question. File association is platform specific, not something Qt handles. in Windows it's a key set in the registry. You can use QSettings to set it

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • tomyT tomy

        Here is the program and below is the screenshot of the issue.

        0_1503319716705_1.PNG

        There are 2 MS Office files (a MS Word and a MS Excel) and 4 my spreadsheet files.
        The spreadsheet app works well up to now, but as you see, the files created using it are not shown as ordinary programs' specific files. They work if I double click on them and open by the spreadsheet app but the shape of the files, as they are shown above, are like unknown files. :(
        How to change it please?

        I've read most of the program's code but didn't see that part that determines the shape of the stored files. I would be grateful if you tell me how I can solve that issue.

        S Offline
        S Offline
        Stoyan
        wrote on last edited by Stoyan
        #3

        @tomy
        The files that your application creates are with extension ".sp". This extension is not associated with any Office application. That's why its icon look that way. You can change extension on files to ".xls" for example. Or you can associate this type of files always to open with MS Excel.

        tomyT 1 Reply Last reply
        3
        • S Stoyan

          @tomy
          The files that your application creates are with extension ".sp". This extension is not associated with any Office application. That's why its icon look that way. You can change extension on files to ".xls" for example. Or you can associate this type of files always to open with MS Excel.

          tomyT Offline
          tomyT Offline
          tomy
          wrote on last edited by tomy
          #4

          @Stoyan
          I appreciate your answer but I didn't want that! That is, I don't want Excel to open my files. If I wanted it so what is the spreadsheet app for!?

          I want they are opened by no app except for the spreadsheet app because those files are of it. And it's very natural I think.

          Let me please ask my question some other way. Why when we install any app and store its files, those files have a specific shape and will be open by default by that app, but although I have made an installer for that app and installed it on my Windows 7 machine it doesn't do that? No, it does all the things except for putting some specific shape on its stored files. :(
          I hope I could convey what I wanted.
          I want to make my app work like any other app after being installed on a target machine.

          jsulmJ 1 Reply Last reply
          0
          • tomyT tomy

            @Stoyan
            I appreciate your answer but I didn't want that! That is, I don't want Excel to open my files. If I wanted it so what is the spreadsheet app for!?

            I want they are opened by no app except for the spreadsheet app because those files are of it. And it's very natural I think.

            Let me please ask my question some other way. Why when we install any app and store its files, those files have a specific shape and will be open by default by that app, but although I have made an installer for that app and installed it on my Windows 7 machine it doesn't do that? No, it does all the things except for putting some specific shape on its stored files. :(
            I hope I could convey what I wanted.
            I want to make my app work like any other app after being installed on a target machine.

            jsulmJ Online
            jsulmJ Online
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @tomy Did you read what VRonin wrote? You need to register you app for this file type. This is not done automatically.
            This is out of scope of Qt. For Windows see https://msdn.microsoft.com/de-de/library/windows/desktop/hh127451(v=vs.85).aspx

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            VRoninV 1 Reply Last reply
            1
            • jsulmJ jsulm

              @tomy Did you read what VRonin wrote? You need to register you app for this file type. This is not done automatically.
              This is out of scope of Qt. For Windows see https://msdn.microsoft.com/de-de/library/windows/desktop/hh127451(v=vs.85).aspx

              VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              @jsulm Don't agree with your link. HKEY_CLASSES_ROOT is not the right place for modern windows

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              jsulmJ 1 Reply Last reply
              0
              • VRoninV VRonin

                @jsulm Don't agree with your link. HKEY_CLASSES_ROOT is not the right place for modern windows

                jsulmJ Online
                jsulmJ Online
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @VRonin @tomy You're right - the description is outdated. Should be easy to find out the correct description.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • tomyT Offline
                  tomyT Offline
                  tomy
                  wrote on last edited by tomy
                  #8

                  Thank guys, I read the link's answer, although I couldn't find the .sp extension in the registery.
                  Anyway, I know by modifying the registery I might be able to do something, but it's not what that should be done! I don't what to change my registery as for the time when I install a software (an app) I don't change the registery but it itself (I think) does that.

                  My purpose is when someone installs the app, the app itself make those changes and the user sees a specific shape (related to that app) on the stored files and work with them, just like any other program.
                  Have you done this task before? How to do that on a win 7 x64 machine please? It may be beyond the scope of Qt but it's needed for Qt programmers I think.

                  jsulmJ S 3 Replies Last reply
                  0
                  • tomyT tomy

                    Thank guys, I read the link's answer, although I couldn't find the .sp extension in the registery.
                    Anyway, I know by modifying the registery I might be able to do something, but it's not what that should be done! I don't what to change my registery as for the time when I install a software (an app) I don't change the registery but it itself (I think) does that.

                    My purpose is when someone installs the app, the app itself make those changes and the user sees a specific shape (related to that app) on the stored files and work with them, just like any other program.
                    Have you done this task before? How to do that on a win 7 x64 machine please? It may be beyond the scope of Qt but it's needed for Qt programmers I think.

                    jsulmJ Online
                    jsulmJ Online
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @tomy "I couldn't find the .sp extension in the registery" - that's the point, you have to put it there.
                    "I don't what to change my registery" - if you want to register your app for a file type you have to do it this way. This is how it works on Windows.
                    "I don't change the registery but it itself (I think) does that" - sorry, but how and why would registry change itself?! If you're installing your app then it is your job to register it (either do it in the installer or in the app), neither Windows nor its registry can know what file type your app is going to use.
                    "the app itself make those changes" - yes, but you're writing your app, so you need to implement it.
                    Please refer to Microsoft documentation: https://msdn.microsoft.com/de-de/library/windows/desktop/ee872121(v=vs.85).aspx

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    tomyT 1 Reply Last reply
                    2
                    • tomyT tomy

                      Thank guys, I read the link's answer, although I couldn't find the .sp extension in the registery.
                      Anyway, I know by modifying the registery I might be able to do something, but it's not what that should be done! I don't what to change my registery as for the time when I install a software (an app) I don't change the registery but it itself (I think) does that.

                      My purpose is when someone installs the app, the app itself make those changes and the user sees a specific shape (related to that app) on the stored files and work with them, just like any other program.
                      Have you done this task before? How to do that on a win 7 x64 machine please? It may be beyond the scope of Qt but it's needed for Qt programmers I think.

                      S Offline
                      S Offline
                      Stoyan
                      wrote on last edited by
                      #10

                      @tomy
                      When you install a software YOU don't change registry but the installer DO change it. The developer who creates this installer take care to make any necessary changes in registry in background. In this case as developer you have to take care for this.

                      tomyT 1 Reply Last reply
                      1
                      • tomyT tomy

                        Thank guys, I read the link's answer, although I couldn't find the .sp extension in the registery.
                        Anyway, I know by modifying the registery I might be able to do something, but it's not what that should be done! I don't what to change my registery as for the time when I install a software (an app) I don't change the registery but it itself (I think) does that.

                        My purpose is when someone installs the app, the app itself make those changes and the user sees a specific shape (related to that app) on the stored files and work with them, just like any other program.
                        Have you done this task before? How to do that on a win 7 x64 machine please? It may be beyond the scope of Qt but it's needed for Qt programmers I think.

                        jsulmJ Online
                        jsulmJ Online
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @tomy said in My app's stored files' shape are as unknown files:

                        My purpose is when someone installs the app

                        Looks like you misunderstood me and I misunderstood your last reply :-) My point was from the beginning that your app or its installer modifies the registry, not the user.

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @tomy "I couldn't find the .sp extension in the registery" - that's the point, you have to put it there.
                          "I don't what to change my registery" - if you want to register your app for a file type you have to do it this way. This is how it works on Windows.
                          "I don't change the registery but it itself (I think) does that" - sorry, but how and why would registry change itself?! If you're installing your app then it is your job to register it (either do it in the installer or in the app), neither Windows nor its registry can know what file type your app is going to use.
                          "the app itself make those changes" - yes, but you're writing your app, so you need to implement it.
                          Please refer to Microsoft documentation: https://msdn.microsoft.com/de-de/library/windows/desktop/ee872121(v=vs.85).aspx

                          tomyT Offline
                          tomyT Offline
                          tomy
                          wrote on last edited by
                          #12

                          @jsulm

                          "I don't change the registery but it itself (I think) does that" - sorry, but how and why would registry change itself?!

                          Ow I din't mean either the rigestery or Windows, I meant the app! :)

                          (either do it in the installer or in the app),

                          Yes, this is what I'm looking for. My installer is Qt Installer Framework. And I also have the source code. Which one should I use and how? Is there any step-by-step tut on this case, please?

                          Please refer to Microsoft documentation: https://msdn.microsoft.com/de-de/library/windows/desktop/ee872121(v=vs.85).aspx

                          Do you now think I should follow this thread? And don't change the code for that purpose?

                          1 Reply Last reply
                          0
                          • S Stoyan

                            @tomy
                            When you install a software YOU don't change registry but the installer DO change it. The developer who creates this installer take care to make any necessary changes in registry in background. In this case as developer you have to take care for this.

                            tomyT Offline
                            tomyT Offline
                            tomy
                            wrote on last edited by tomy
                            #13

                            @Stoyan

                            When you install a software YOU don't change registry but the installer DO change it. The developer who creates this installer take care to make any necessary changes in registry in background. In this case as developer you have to take care for this.

                            You're right, but how? By modifying the code or using the installer (Qt Installer Framework)?

                            jsulmJ S 2 Replies Last reply
                            0
                            • tomyT tomy

                              @Stoyan

                              When you install a software YOU don't change registry but the installer DO change it. The developer who creates this installer take care to make any necessary changes in registry in background. In this case as developer you have to take care for this.

                              You're right, but how? By modifying the code or using the installer (Qt Installer Framework)?

                              jsulmJ Online
                              jsulmJ Online
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by jsulm
                              #14

                              @tomy Both is possible. I don't know what you prefer. If you want to do it in your app you can do it using QSettings.
                              Never used Qt Online Installer, so cannot say whether it is possible there.

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              1
                              • tomyT tomy

                                @Stoyan

                                When you install a software YOU don't change registry but the installer DO change it. The developer who creates this installer take care to make any necessary changes in registry in background. In this case as developer you have to take care for this.

                                You're right, but how? By modifying the code or using the installer (Qt Installer Framework)?

                                S Offline
                                S Offline
                                Stoyan
                                wrote on last edited by
                                #15

                                @tomy
                                If you use installer, this is one time job. After initial settings you can't change them again if for some reason they are changed.
                                In a lots of apps this is realized as settings "Associate" in the app. Benefits here is that you can change these settings any time.

                                1 Reply Last reply
                                1
                                • tomyT Offline
                                  tomyT Offline
                                  tomy
                                  wrote on last edited by tomy
                                  #16

                                  Thank you.
                                  So both of you recommend that I use settings or QSetting. I guess it's a Qt class that I can use it in the code so that it applies changes to the registery when the app is being installed on a Windows machine (of a user).
                                  Have I understood correctly? If so, so I should be familiar with such a class and try to figure out where and how in the code I use it. correct?

                                  jsulmJ 1 Reply Last reply
                                  0
                                  • tomyT tomy

                                    Thank you.
                                    So both of you recommend that I use settings or QSetting. I guess it's a Qt class that I can use it in the code so that it applies changes to the registery when the app is being installed on a Windows machine (of a user).
                                    Have I understood correctly? If so, so I should be familiar with such a class and try to figure out where and how in the code I use it. correct?

                                    jsulmJ Online
                                    jsulmJ Online
                                    jsulm
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #17

                                    @tomy You would use QSettings in your app but not when it is installed. The idea would be to check at start-up whether your file type is registered or not and if not register it.
                                    Yes, QSettings is a Qt class, take a look at its documentation.
                                    But it is worth checking whether Qt Installer Framework supports this use case as it is is actually something the installer should take care.

                                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    tomyT 1 Reply Last reply
                                    3
                                    • jsulmJ jsulm

                                      @tomy You would use QSettings in your app but not when it is installed. The idea would be to check at start-up whether your file type is registered or not and if not register it.
                                      Yes, QSettings is a Qt class, take a look at its documentation.
                                      But it is worth checking whether Qt Installer Framework supports this use case as it is is actually something the installer should take care.

                                      tomyT Offline
                                      tomyT Offline
                                      tomy
                                      wrote on last edited by tomy
                                      #18

                                      @jsulm

                                      You would use QSettings in your app but not when it is installed.

                                      Yes, I know that. If I'm able to change the code so that the app is the way I need, I also can uninstall the previous app and install this new version, or I send it to a friend and they install it on their Windows machine too.

                                      The idea would be to check at start-up whether your file type is registered or not and if not register it.

                                      I don't understand this part.

                                      Yes, QSettings is a Qt class, take a look at its documentation.
                                      But it is worth checking whether Qt Installer Framework supports this use case as it is is actually something the installer should take care.

                                      So the first step is to check if Qt Installer Framework supports that or not. And if yes, I use the class QSettings in the code of the app and finally create an new installer and install it.

                                      OK, these are too new for me. I've never done these. How to check Qt Installer Framework for that? If Qt Installer Framework supports that, I then should try to use that QSettings class and probably give it an icon to put on the stored files.
                                      The process sounds by no way easy! :(
                                      Isn't there any straightforward tut on this case?
                                      And have you programmers ever done this? You have done absolutely I think. What is your experience in this case, please?

                                      1 Reply Last reply
                                      0
                                      • VRoninV Offline
                                        VRoninV Offline
                                        VRonin
                                        wrote on last edited by
                                        #19

                                        using QtIF: https://forum.qt.io/topic/68083/qt-installer-framework-create-registry-key/2

                                        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                                        ~Napoleon Bonaparte

                                        On a crusade to banish setIndexWidget() from the holy land of Qt

                                        1 Reply Last reply
                                        2
                                        • tomyT Offline
                                          tomyT Offline
                                          tomy
                                          wrote on last edited by
                                          #20

                                          Good. I edited the package.xml file. And also changed all @component.addOperation to @component.addElevatedOperation in the installscript file. There are three operations all for creating shortcuts.
                                          Now I seemingly should add this line of code into the code:

                                          addElevatedOperation("GlobalConfig", "SystemScope", "Company", "App", "key", "value")
                                          

                                          I searched for that and found this. It shows no detail on how to use the arguments and where in the code, what header or .cpp file, to use it! :(

                                          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