-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot save text opened in external application (Windows) #2402
Comments
Oh, you were the first to complain... it seems this new feature is not very used, or nobody cared in Windows. Yes, in Linux it works without problem, but I've checked the code and it isn't obvious. In theory, the file is closed before calling the external application. I guess not everything is done synchronously. Aha, so this is the problem:
So Qt tried to outsmart me... (when I say close, it's close). Ok, I'll have to find an alternate way. |
According to Qt documentation: > Reopening a QTemporaryFile after calling close() is safe. For as long as > the QTemporaryFile object itself is not destroyed, the unique temporary > file will exist and be kept open internally by QTemporaryFile. Keeping the file open by DB4S means that later it cannot be opened by the external application in Windows, since it is locked. See issue #2402
@chrisjlocke I'd figured out how to close the file before the external application is launched. I haven't tested in Windows. You know the proceedings 😉 |
Works perfectly! *This is also a bug-bear. If there are dirty changes, it would be so nice if DB4S would say, "Hang on - you didn't click 'Apply' - you OK with losing those four hours you spent typing into that cell?' 😉 |
I felt, it wasn't well polished. I accept your suggestion. Is this wording acceptable?
I was surprised nobody seemed to care about this 😄 Yes, I agree. Then it might make sense to add a Cancel button to the cell editor, to avoid any prompting. |
After having removed the Cancel and Apply buttons and replaced them by an OK button, I wonder if it make sense to have to click OK and then Apply in the Cell editor. Why not leaving the Cancel and Apply buttons in the dialog, and when clicking Apply saving the data directly in the cell. Clicking Cancel will, of course, throw the data away and not touch anything. The wording could be mostly the same as in the current revision:
The implementation is equally simple in both case. @chrisjlocke, what do you reckon? |
Thanks for implementing this so quickly. I haven't followed your last message - got a bit lost with the OK's and Apply's, so will download the nightly and have a look.... 👍 |
Oh, I might be expressing myself very badly 😉 I did not push anything I was just asking for your opinion. Nevertheless, I think that this last proposal is the best one, so I'll push it and wait for your impression |
And not to the cell editor. This will avoid a redundant click to Apply, when the user has just pressed Apply instead of Cancel in the dialog. See issue #2402
According to Qt documentation: > Reopening a QTemporaryFile after calling close() is safe. For as long as > the QTemporaryFile object itself is not destroyed, the unique temporary > file will exist and be kept open internally by QTemporaryFile. Keeping the file open by DB4S means that later it cannot be opened by the external application in Windows, since it is locked. See issue #2402
I've added d8ca11f to |
Thanks for the changes. Yes, this works well. Clicking 'apply' applies the changes straight into the cell. ❤️ |
Haven't used this feature before, but it appears when in the 'Edit Database Cell' dock, there is a button to edit the text in an external application (eg, Notepad, if on Windows).
However, it wasn't possible to save this text within Notepad - the file was locked (I assume by DB4S...)
Screencast: https://streamable.com/5bbtoj
So I clicked the button, edited the file, but when you save it, Notepad can't. I saved the file elsewhere, but obviously, DB4S couldn't use this file.
I assume this will work on other OS's, that don't lock the files so strongly as Windows.
This was with the latest nightly.
The text was updated successfully, but these errors were encountered: