Re: Check file is modified?
You can't check if it's closed if you open it with QDesktopServices.
However, if the file is open, the big majority of applications sees that the file is already open and asks the user if they should update the file with the modified one, on disk.
Re: Check file is modified?
Asking programs as word and so on. By I need that word asking, and when i finishing work with word, my program check was file modified, if yes - show QMessageBox and ask - want i to save the data. If i pressing yes, when program my modified *doc file have to update to database
Re: Check file is modified?
Then you should check the last modification date of the file. You can save it in the database, along with the file and query for it later.
Re: Check file is modified?
but how can I start and check when I finished the work with file?
Re: Check file is modified?
Maybe QFileSystemWatcher can help you? If you're using Qt Commercial with Windows it's also an option to control Word through its COM interface.
Re: Check file is modified?
mamyte03, I take it you are not only interested in seeing when or if the file was actually modified, but when the work on it is done (work = file is open in Word). Is that right?
So you essentially need to know when the file gets closes in Word. I fear this can only be done going pretty low-level, either COM or via the Windows API. ASFAIK Qt doesn't provide this functionality to communicate with other applications.
However, there might be a trick that could work. Word normally marks files that are worked on as read-only, so you will only be able to open the file in read-only mode, as long as the file is open in word. That, in combination with checking the last modified date, should probably give you the information you need.