My app's stored files' shape are as unknown files
-
Here is the program and below is the screenshot of the issue.
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.
-
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
-
@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. -
@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. -
@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 -
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. -
@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 -
@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. -
@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.
-
"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?
-
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)?
-
@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. -
Thank you.
So both of you recommend that I usesettings
orQSetting
. 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? -
@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. -
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? -
-
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! :(