We now definitely has std::as_const available and Qt has started nagging
about converting to std::as_const.
Implementation is the same for both functions, and qAsConst was a
stop-gap measure until std::as_const was sufficiently available.
But some of the sidebar and welcomescreen things seems a bit like a hack
and trying to workaround features in other component, so hit it a bit
more with a hammer to behave.
The welcome screen's minimum size is quite large. This change allows
the window to be smaller than the welcome screen when the welcome screen
is not visible.
BUG: 478577
Before and after screenshot:
![Before and after screenshot](/uploads/71f685c89a7324444b89e1abd0592b80/image.png)
In around 2/3rd of the cases, we don't check that currentIndex of tabs
is less than the number of tabs, because it is not needed.
It is also not needed in the other cases, so remove that.
In certain usecases, especially for non-linux desktop builds, the
advantage of of dbus is often limited. Provide a way to disable
building with dbus.
Note that this also disables the related functionalities of having a
second okular launch open the document in the first okular.
This also disables the unit tests that tests those features.
When the second instance is launched it receives an activation token per environment variable
We need to pass that token to the first instance so that it can use it to raise itself
Also properly use startup ids for this on X11 instead of relying on forceActiveWindow, which is a hack
With this MR, the sidebar can now be (if not locked):
* docked to the left or right side
* undocked and floated as an independent window
* closed with the close button in the header
BUG: 455013
Better enforce them now, so that the work to port doesn't increase over
time
Not a super fan of this for regular applications, but oh well the ship
has sailed
There's always at least one tab since an okularpart is created at startup.
The supported minetypes are always read from this so fileFormats is never called.
Okular's current default window size is very small, due to a bug which
will be fixed by
https://invent.kde.org/frameworks/kxmlgui/-/merge_requests/53. Once that
is fixed, its default window size will become huge due to the current
sizeHint value, which basically says "take up 75% of the screen space".
This may be somewhat excessive.
This commit reduces the sizeHint to a saner default size while still
being big enough to show all toolbar buttons.
f9841b0f8a and e0f45add55
They break the windows build, which shows there's something defenitely
fishy going on with the current code, but oh well, someone with more
time needs to figure out a proper solution
It was causing problems (Windows build fails) now that we enabled -Wweak-vtables (and
probably before didn't work that much before, guessing that's why we had that if (doc)
in openFile)
This is the simplest solution, invokeMethod is not great but we already
use it, so it's not too terrible
The openDocument function was unused so remove it.
The other two solutions are:
* Make KDocumentViewer be part of okularcore and then link the
okularcore to the okular binary, not nice
* Make another dynamic library that just contains the KDocumentViewer
class, but i'd rather not add yet another library we have to install
and take care of
And by that it means giving the focus to the pageview which is most of
the fimes what we want. One could argue that if i had the focus on the
searchbar we should restore the focus there, but that makes not much
sense to me, since each tab is it's own world, at most one could say,
let's remember where the focus was in that tab the last time it was
focused and restore it there, but it seems a bit convoluted.
To be able of setting the focus to the pageview from the shell we need
to set up some focus proxies, so that part->widget (which is the sidebar)
ends up giving the focus to the pageview, which is what makes sense if
someone says "you part, set yourself the focus"
BUGS: 428257
Only if you're on a new enough KIO, we need
a1acb7744455b57dc972b3073f6e1dce0d49d965
and
7bf4d793a5ac54280c45660dbd04de4fa99dc994
present since 5.73 to make the UI usable
BUGS: 422574