Remove "Quit" from Mac OS X app's dock-menu
Hi, I am building a Qt application on Mac OS X using Qt-4.7.
In my application there is a Dock Menu, I want to remove the "Quit" option from it.
How can I achieve this?
Thanks in advance.
I don't know exactly and I never tried myself, but I would expect that it is added by Mac OS X. Why do you try to annoy the users of your application in the first place? I would expect that menu entry to be available for any application.
I am making an update application for existing application, so during the update process I don't want the user to quit as it can corrupt the software, that is why I want to hide the "quit" option from dock-menu.
I think the proper solution would be to make sure that there is a rollback path in case the update is interrupted, then simply catch the closeEvent for your application and make sure that it cleans up after itself properly if there is an interruption. This also can lead you down the path of recovery in the case that the install should fail for some other reason (perhaps the user's laptop battery dies in the middle of the install, or something along those lines.)
Hi, thanks for the suggestion, but the problem is that there is a zip/unzip process while updating.
So while extracting if the user quits at that time, some part of extraction is already done and it would be difficult to know what data has been extracted. Also the extraction replaces the existing files. This is the reason why I am wanting the "quit" option to be hidden from the user.
I think your program is working bad. You have to unzip the data to a temp folder, and then apply it (i.e., overwrite files). Catch the close event, as already suggested, that is the only chance you have to interact with an user. And remember that a user could also kill immediately your application, so you are going to have a "crash" in any case. Be prepared to it.
@fluca1978 : Ya you are write, but the problem is, the zip file that I am downloading is around 70Mb and after unzipping its around 450-500Mb, so that unzipping in a temp folder and then copying it to original location would take a lot of time. Would you like to suggest any other possiblity?
If possible, extract only parts out of the zip and replace them. However, consider that a lot of upgrading tools require a lot of space on the hard drive in order to act properly. For instance, an ubuntu updater asks for 1.5 GB in the /var partition, so I don't see a real problem in asking the user to have such free space on its computer.
I am not talking about space, I am talking about the time it will take.
- Download 70Mb zip from internet.
- extract it in a temp folder.
- Copy around 500Mb files in the original location.
This all process would take a long time.
First of all, are you sure all the data need to be replaced? Instead of copy, doing an rsync could speed up data substitution in the case some of it is already up to date.
Second, there is no good solution to your upgrade system, you cannot ask the user to wait for a long process even removing the quit option from the menu, because the battery (for instance) could empty its charge....
So you have to do the copy in sub-steps, each one recoverable in case of failure. That is the only way to ensure you can apply all the configuration at once or replay it if interrupted.
You don't need to copy the data from the temp folder to the final destination if both are on the same disk, a move/rename is sufficient in this case.