user interface for attach & detach

Andreas Naumann Andreas-Naumann at gmx.net
Sat Jun 25 22:54:26 BST 2022


Am 04.05.22 um 00:48 schrieb Albert Astals Cid:
> El dissabte, 30 d’abril de 2022, a les 21:28:09 (CEST), Andreas Naumann va escriure:
>> I am working on the detach and re-attach of a tab in okular.
>>
>> The current implementation in MR 616
>> (https://invent.kde.org/graphics/okular/-/merge_requests/616) allows to
>> detach a tab into a new okular instance. If tabs are enabled, an
>> existing tab can be moved to another instance.
>>
>> However, if exactly one file is open, then we do not see the tab bar,
>> but only one window. That raises the question, how can a user move that
>> instance/file to another instance?
>>
>> Until now I have the following workflows / user interfaces in mind:
>>
>>     (1) Drag the window (at the title) with the single file above another
>> instance: From my perspective, this feels most intuitive.
>>     (2) Drag the "page" (click with the mouse somewhere next to the text)
>> and move into another window: This feels also intuitive, but is in
>> conflict with the page movement of a zoomed page.
>>     (3) Insert some button/icon in the toolbar: How should that button
>> look like and intuitively like "attach some where else".
>>     (4) Use a shortcut, to show other okular instances in a dialog: That
>> feels less intuitive. In particular, it is inconsistent with the
>> detaching from a multi-tab.
>>
>> I implemented the interface (1), but have some trouble with Qt. The
>> basic idea was to overload the member function "Shell::moveEvent", check
>> if the main window was moved on top of another okular window and if so,
>> than open the file in the other instance and close the single-file-window.
>> This approach has one big drawback: the function moveEvent is also
>> called, when the new window starts. Thus, if one detaches, or creates a
>> new okular instance, which (by possibility or accident) starts above
>> another window, it will be closed and attached to that.
>>
>> Finally I have two questions:
>>
>> 1. Which interface/workflow would you prefer?
> Alternative suggestion:
>   * Add a sub-option to "Always show tabs" [even if there's only one document open] in the configuration. It's what konsole and firefox do. And then people that like dragging tabs around can enable that and be happy dragging the tags.
>
> What do you think?

That is the way, I implemented the feature now. If the option "Keep tab"
is enabled, we keep the tab box even if there is only one open file.

The user interface works two fold now:
   1. simple drag and drop: If the mouse leaves the window, a "drag"
action is started. Thus a user can simply drop the file in any other
application (which supports drag'n drop). This is like a "copy
operation". Even if you drop the file onto another okular instance, we
keep it open at the source.
   2. drag while pressing "shift". That detaches the file from the
current okular instance and removes. This is like a "move operation". I
chose the shift key, because it is similar to the behavior of dolphin.
There "shift & drag" means move the file to the destination.

Regards,
Andreas

>
> Cheers,
>    Albert
>
>> 2. Do you have any other suggestion for the implementation of (1)?
>>
>> All best,
>> Andreas
>>
>>
>>
>
>
>


More information about the Okular-devel mailing list