Bug 66813 - Tools / SQL dialog is modal
Summary: Tools / SQL dialog is modal
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Dialog
  Show dependency treegraph
 
Reported: 2013-07-11 09:51 UTC by Lionel Elie Mamane
Modified: 2023-01-20 03:24 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lionel Elie Mamane 2013-07-11 09:51:18 UTC
The dialog opened by Tools/SQL has IMHO no good reason to be modal.

That dialog is implemented by dbaccess/source/ui/dlg/directsql.{src,cxx}.

I tried just replacing "ModalDialog" by "Dialog", but that makes a syntax error in directsql.src

@caolan: any hint?
Comment 1 Caolán McNamara 2013-07-11 10:20:06 UTC
Try "ModelessDialog" (and make that same change in the .cxx/,hxx for the baseclass of the dialog
Comment 2 Lionel Elie Mamane 2013-07-11 18:56:25 UTC
(In reply to comment #1)
> Try "ModelessDialog" (and make that same change in the .cxx/,hxx for the
> baseclass of the dialog

That compiles, but as soon as the Base window gets focus, the dialog window grabs focus, so in practice it is as-if it were modal.
Comment 3 Alex Thurgood 2015-01-03 17:41:16 UTC Comment hidden (no-value)
Comment 4 QA Administrators 2016-01-17 20:04:55 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2017-03-06 14:32:46 UTC Comment hidden (obsolete)
Comment 6 Julien Nabet 2020-12-28 20:06:39 UTC
Since directsql has been welded, see https://cgit.freedesktop.org/libreoffice/core/commit/?id=573562e72a5fd85b75006fbc8869c73903a6e504

author	Caolán McNamara <caolanm@redhat.com>	2019-09-15 20:18:38 +0100
committer	Caolán McNamara <caolanm@redhat.com>	2019-09-17 10:04:38 +0200
commit 573562e72a5fd85b75006fbc8869c73903a6e504 (patch)
tree 866cfff40b7974ab4a9541214a93c104c10f593b
parent a944d4c2aacafdac78eabd7fb0f8909a66d935eb (diff)
weld DirectSQLDialog

I tried to reproduce this and it's still modal at least for gtk3 (I don't reproduce this with gen rendering).
However, when moving cursor outside direct sql dialog, the cursor is in a "waiting state".

I don't know why there's this "waiting state" or why with gen rendering it's not modal but perhaps they're both hints.
Comment 7 Caolán McNamara 2021-01-18 11:51:43 UTC
The "waiting state" is set in dbaccess/source/ui/app/AppControllerGen.cxx in OApplicationController::openDialog the ctor of the a WO weld::WaitObject and persists until its dtor.

This is currently meant to be a modal dialog and it should have it modal bit set (https://gerrit.libreoffice.org/c/core/+/109540 to do that). In contemporary code if we wanted it to be a modeless dialog we'd unset its modal bit and instead of call Dialog::run we'd have to call runAsync instead.
Comment 8 Commit Notification 2021-01-18 14:03:58 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/67194f944861a76cccf6a432beb3dbe8983416ef

Related: tdf#66813 this dialog should be modal

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Julien Nabet 2021-01-18 20:10:49 UTC
(In reply to Caolán McNamara from comment #7)
> The "waiting state" is set in dbaccess/source/ui/app/AppControllerGen.cxx in
> OApplicationController::openDialog the ctor of the a WO weld::WaitObject and
> persists until its dtor.
I understand why there's this behavior and where it's located but I don't understand what's the purpose of this "waiting state", just showing it's modal? If yes why here and not on other modal dialogs?

 
> This is currently meant to be a modal dialog and it should have it modal bit
> set (https://gerrit.libreoffice.org/c/core/+/109540 to do that). In
> contemporary code if we wanted it to be a modeless dialog we'd unset its
> modal bit and instead of call Dialog::run we'd have to call runAsync instead.
With the last patch, the behavior is indeed now the same between gtk3, gen and kf5.

Now should it be modal or not?
Personally, I don't have strong opinion here.

Robert/Alex: as expert Base users, any thoughts here?
Comment 10 Caolán McNamara 2021-01-19 09:21:19 UTC
FWIW the WaitObject is there since

commit 85afff9c65f3b312c1d39f15b89536b9d33beba0
Author: Jens-Heiner Rechtien <hr@openoffice.org>
Date:   Mon Aug 2 14:28:39 2004 +0000
    INTEGRATION: CWS insight01 (1.1.2); FILE ADDED

which is somewhat unhelpful. Typically a WaitObject is used when some slow task is underway to indicate its "doing something". The use in OApplicationController::refreshTables follows that pattern and that one makes sense. Doing the "busy" while a dialog is open indeed unusual. Maybe its a cut and paste from the other function, or maybe the "busy" period should only exist until the "execute" of the dialog, though the dialog setup surely isn't so special vs all other dialogs that it needs a "busy" pre-execute period.
Comment 11 Lionel Elie Mamane 2021-01-19 09:56:13 UTC
From a UX perspective, non-modal would be much better. There might be technical challenges to make it non-modal, but I never took the time to dig into it. Mainly, as far as I understand, we open _one_ connection to the database, which allows to do _one_ SQL command concurrently (unless we use asynchronous APIs, which we don't). So, during execution of an SQL command, basically nothing else can happen within (the same odb file in) Base. The modality of the dialog might just be a work-around for (older versions of) Base not handling that correctly.

The "busy" signal is good, during execution of the SQL command _only_ (that is between the click on "Execute" button in the dialog and having the result of the command), _not_ during the whole time that the dialog is merely open.

If someone wants to look into it, I would recommend:

1) Make the dialog non-modal
2) For best UX, change the "busy" signal to be only while command is being executed.
3) Test it.
3.1) Execute a SQL command in the "Tools/SQL" dialog. Wait for the result. Do not close the dialog, but use the Base UI (e.g. double-click on a query or on a table). Should work well. Go back to dialog. Execute another SQL command.
3.2) Try to run a long-standing SQL command in the "Tools/SQL" dialog, then try with the mouse in the UI to force execution of another SQL command (easiest is double-click on a query or on a table).
4) What happens in 3.2? The best would be that the UI just waits for the dialog command to finish, then does the requested thing. What might happen instead is that the SQL command from the dialog is aborted.
Comment 12 Lionel Elie Mamane 2021-01-19 09:58:44 UTC
I meant "long-running SQL command", not "long-standing". A few ideas for that:

PostgreSQL: SELECT pg_sleep(60); -- replace 60 by another amount in seconds at will

MySQL: SELECT sleep(60);
Comment 13 Commit Notification 2021-01-19 10:37:00 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/14e18c13e9a618e5a9c72f00a6913633acb21573

Related: tdf#66813 this dialog should be modal

It will be available in 7.0.5.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2021-01-19 10:38:14 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/380597b1f7bad62164f36db5c9d2edf4cee52c26

Related: tdf#66813 this dialog should be modal

It will be available in 7.1.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Alex Thurgood 2021-01-19 11:58:46 UTC
(In reply to Julien Nabet from comment #9)


> Now should it be modal or not?
> Personally, I don't have strong opinion here.
> 
> Robert/Alex: as expert Base users, any thoughts here?

Personally, for me, it should be non-modal. If I've understood correctly, that would allow the user to enter SQL commands and see the results of those commands, e.g. updates, directly by refreshing or opening a table grid view controller, which would make the whole thing a much more useful tool than in the current production release.
Comment 16 Alex Thurgood 2021-01-19 12:08:32 UTC
(In reply to Lionel Elie Mamane from comment #11)


> 3.2) Try to run a long-standing SQL command in the "Tools/SQL" dialog, then
> try with the mouse in the UI to force execution of another SQL command
> (easiest is double-click on a query or on a table).
> 4) What happens in 3.2? The best would be that the UI just waits for the
> dialog command to finish, then does the requested thing. What might happen
> instead is that the SQL command from the dialog is aborted.


I just had a thought for why the dialog may have been made modal in the first place.

Is there by any chance any requirement to release/get a mutex from any other active component of the database connection or have some other form of synchronisation ? 

For example, say I have a Form saved outside of the ODB file, pointing to a DB instance and opened for input, and I have my SQL dialog open within an ODB container pointing to the same DB instance at the same time - which one takes precedence if I execute 2 SQL operations at the same or pseudo-same time ?
Comment 17 QA Administrators 2023-01-20 03:24:59 UTC
Dear Lionel Elie Mamane,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug