If a generator can open multiple mime types that match the same file, avoid showing a backend chooser dialog with multiple instances of the same
backend
REVIEW: 129791
BUG: 374650
If a generator can open multiple mime types that match the same file, avoid showing a backend chooser dialog with multiple instances of the same
backend
REVIEW: 129791
BUG: 374650
Stopping on the first inherit match can prevent finding a perfect match, and thus we might enter a competition of inherit matches from other generators.
Example: spectre supports application/postscript and image/x-eps. When opening an eps the app/ps is an inherit match, but so is text/plain from the txt generator. Thanks to stable_sort() the txt generator is deterministically selected from the above two inherit matches. Unless we continue and find the perfect match, which is spectre:image/x-eps.
REVIEW: 129610
Try fixing mainshelltest: one more passes now
QUrl is not automatically exposed to DBus so the DBus call would fail.
Changed the parameter to QString instead so that DBus invocation works.
mainshelltest: set QStandardPaths to test mode
Parse command line flags with a single dash as a long option
Unlike KCmdLineArgs QCommandLineParser treats options starting with a
single minus as multiple short options by default.
Previously okular -unique would fail with the following error:
Unknown options: u, n, i, q, u, e.
Also changed mainshelltest to use two dashes in case this behaviour
should change in the future.
mainshelltest failures have been reduced from 15 to 4 by this commit.
Fix docdata saving and added a warning message if it fails
If the ~/.local/okular/docdata directory didn't exist previously
creating the docdata file would fail as there are missing paths.
It seems that KStandardDirs used to create the okular/docdata directory
automatically, with QStandardPaths we have to create it manually.
mainshelltest is down to one failed test now
Fix final test case in mainshelltest
as we call QProcess::terminate the exit code will not be 0
REVIEW: 126192
Process the operations of the rendition link independently of whether
there is a JS script or not. Most of the time the JS script won't be
executed correctly anyway, since Okular is missing most of the JS API,
so we should fall back on the given operations.
BUGS: 324167
FIXED-IN: KDE Applications 15.08.0
Allows us to not use a dummy printer for knowing page size
Which is nice since it won't block because Qt4 QPrinter is a bit weird sometimes
BUGS: 334708
FIXED-IN: KDE Applications 15.08
Allows us to not use a dummy printer for knowing page size
Which is nice since it won't block because Qt4 QPrinter is a bit weird sometimes
BUGS: 334708
FIXED-IN: KDE Applications 15.08
This commit fixes the error message "<url> is not a local file" when processing
source references. 'giveAbsolutePath(QString)' returns a local file name, so we
create the corresponding url using 'QUrl::fromLocalFile'.
The old auto_ptr was used for simple RAII. None of the auto_ptr flaws
were apparent in that context, but given that that class is actively
deprecated and that compilers warn about its use, it's better to switch
to its drop-in replacement.
My reason for not using QScopedPointer is that the C++11 version works
well enough, Okular is being built in C++11 mode anyway, unique_ptr
works on the KF5-minimal-mandated-compilers according to their docs, and
therefore there's no point in using something with a different API
(QScopedPointer) just because its name begins with a Q.
REVIEW: 124027
Somehow i ended up commiting a partial patch and not what was in reviewboard, this amends the previous commit to be what i really wanted to commit
Sorry for the mess :/
This way dvi and any other potential user gets it for free
The diff is huge, but the synctex files are just moves.
And the code in core/ is also mostly just a move from the generator_pdf.cpp code
Acked by Luigi
REVIEW: 120311
Use a QString to serialize the command line options other than urls to open so it can be easily passed around to every place that opens a new shell or tab or overrides the content in a unique instance.
BUGS: 334100
FIXED-IN: 4.14.0
REVIEW: 119595
We use
m_pageController
as guard for closing down instead of
d->m_generator || d->m_closingLoop
since m_pageController is the first thing we set to 0 on closeDocument
It's straighforward implementation. Every single place, where there were call for (or with) TilesManager, now has a DocumentObserver as companion. The m_tiledManager reference in PagePrivate was changed to QMap<DocumentObserver, TilesManager>.
REVIEW: 113986
Includes some fixes from Albert:
* kscreen cmake fixes
Don't make libkscreen mandatory, give the proper version we need
* Fix the @since
* Kill Resolution and use a QSizeF
I first thought QSizeF didn't make sense, but well what's a dpi if not a number of pixels in width and some others in height?
* Remove unwanted const
* Remove unneeded utils.h includes
* Fix comments on realDPIXY()
* Make it compile in non X11
REVIEW: 111829
It's useless as it will be reset anyway on the close down procedure
and it will cause a crash if you are unlucky.
Reason:
* In the document observers qset pageview comes before
* We are closing and notifySetup with an empty vector
* pageview empties its vector in notifySetip
* part sees the notifySetup and resets the search
* resetting the search calls another notifySetup with the non empty page vector
that will be deleted asap when we go back to the first notifySetup
There are another billion ways to fix this:
* Don't allow nested notifySetup
* Clear the running searches before sending the first notifySetup
* Empty the pagesVector before sending the first notifySetup
* etc
But i feel this is the less invasive one (even if it may not be the most technically correct)
BUGS: 329582
FIXED-IN: 4.12.1
REVIEW: 114060
This patch introduces viewport transitions for undo/redo actions on annotations and forms. When an annotation/form action is undone/redone but the associated annotation/form is not currently visible, the viewport is updated to center on the undo/redo action. If the annotation/form is visible, the viewport is not updated.
The viewport transitions for the Find action have also been updated to this same algorithm. Previously the viewport was moved to center on each matching search term even if the search term was already visible in the viewport. This lead to unnecessary viewport transitions if the search term matched several items in a single paragraph for example.
These proposed changes to the viewport transition behavior are consistent with the find and undo behavior of many existing applications including Kate, Open Office, and Foxit PDF Reader.
Prefer the backends that declare explicit support for a mime over the ones that get the support by inheritance
In the fictionbook case it was happening that application/x-fictionbook+xml inherits text plain
so when we ask for the fictionbook backend, we get both
the one that says
MimeType=application/x-fictionbook+xml;
and the one that says
MimeType=text/plain;
and then it happens that the second has bigger X-KDE-Priority
By prefering the ones that explicitely declare support for a mime we "fix" this
OTOH we may want to explore showing the backend selector if there's more than one by default
FIXED-IN: 4.11.0
Cherry-picked from a556126816
The patch de-singletons the PageController class.
The PageController is now per-document and it gets deleted when the
document is closed.
As consequence of this, the RotationJob's done signal will not be
delivered if the document has been closed, and thus this fixes the
crash.
Sometimes annotations created on tiles mode were not shown immediately.
What requestPixmaps do is given a PixmapRequest, change its
normalizedRect attribute so the rect is tile aligned. However
refreshPixmaps was creating a PixmapRequest with the rect already tile
aligned and then delivering the PixmapRequest to requestPixmaps, which
would trye to take the requested rectangle and change it so it is also
tile aligned. Since the PixmapRequest delivered by refreshPixmaps was
already aligned, the requested rectangle was inflated by the tile
alignment procedure. After that the generated request becomes bigger
than the defined threshold and is discarded. This patch actually
removes the tile alignment logic from refreshPixmaps and let only the
requestPixmaps handle this.
They must not be swapped, because generators already swap them on their
own, and swapping them twice results in distorted pixmaps.
BUG: 318829
FIXED-IN: 4.10.3
Just use the pointer as id :-)
This is BIC and SIC, increase the soversion now to makes sure we don't forget in the future
Patch based in an earlier patch by Bogdan Cristea <cristeab@gmail.com>
REVIEW: 109115
It was only used to return 1, that was then used in
CHMGenerator::textPage, that code still looks a bit fishy, but that was already there, it's just now that looks a bit more fishier
1) Fixed underflow when memoryDiff > memoryToFree
2) Use current viewport's page number instead of any visible page as
page from which distances are calculated
3) Renamed currentVieport to visibleRect, because the currentVieport is
a different thing
The new class TileNode represents a node in the tree structure
whereas Tile is just a data structure to store the pixmap and tile rect
and is used outside tiles manager.
The miss counter was taken away. Now the algorithm relies on the
distance between the tiles and the viewport.
Also the visibleRect() and setVisibleRect() methods were removed from
TilesManager since we now pass this information to
TilesManager::cleanupPixmapMemory()
Will make it easier to make separate apps based on the core in the future
Note this will most probably break your settings if you are not running a very up to date kdelibs (4.9 or 4.10)
so be careful on updating
REVIEW: 104947
Some requests may take a while to process in a highly zoomed region.
Since those requests are not yet finished, other requests to the same
region are likely to be made (specially if the user is scrolling fast)
and the generator will have to render the same region repeatedly.
Also when changing zoom rapidly some pixmaps can arrive at the tiles
manager when another request has already been posted. This pixmap is not
necessary anymore and should be discarded (the tiles manager will get a
new pixmap anyway).
The visible region was set in the PixmapRequest only a tiles manager was
available. Because of that the generator could check if it was supposed
to used tiles by simply checking if its normalized rect was null.
However is good to know the visible region even when a tiles manager is
not present. This way if the request is big enough to start a tiles
manager we already know the visible region and can change the
PixmapRequest accordingly.
Previously it was cleaned in FIFO order
I also moved the pixmap selection logic in a separate function, that
will be needed in the next patches.
Note: This behaviour is yet not optimal for the thumbnails panel,
because it is allowed to be at a page different than the current
viewport
It actually serves three purposes:
a) Make sure all the values are there (this should be always true, but doesn't hurt making sure) because if SwapFree was there but SwapTotal was not, it'd be a mess
b) add up things in order so we don't underflow, currently the code did process stuff as it came in the file, and it happens that SwapTotal appears before SwapFree in /proc/meminfo so it actually did "MemFree:" + "Buffers:" + "Cached:" - "SwapTotal:" + "SwapFree:", which can underflow if "MemFree:" + "Buffers:" + "Cached:" < "SwapTotal:"
c) Do not underflow at all, so if "MemFree:" + "Buffers:" + "Cached:" + "SwapFree:" < "SwapTotal:" we return 0 correctly not a zillion of free memory
Aurélien you might want to update gwenviews copy of this code (there's a few other bugfixes we did a while ago you didn't update either)
CCMAIL: agateau@kde.org
BUGS: 291129
The only affected generator is poppler (because it's the only one with
saving support).
Since version 0.20, Poppler can save annotations to PDF. If the user is
using an older version, this patch warns him that annotations are not
saved.
This patch makes sure that the file saved in the .okular file keeps
the original filename (and, in particular, the extension) even if the
user is re-exporting a .okular archive as .okular archive. Before this
patch, the file boundled in the .okular archive would be named like the
.okular file it was exported from (eg foo.okular instead of foo.pdf).
Note: Okular had no problems in reopening it, but advanced users
unpacking the ZIP file obtained a .okular file which is actually a
native file, and not an okular archive.
1) If the user had previously annotated the document with an old okular
version and the document contains existing annotations and no /Encrypt
(ie the case where annotation changes are no longer saved locally), make
Document::saveDocumentInfo write the original unmodified local
annotations back to XML, so that it seems that the original file was not
changed. If the user makes annotation changes, code from previous
patches already asks him to save them to a different document on close.
2) Ask "Save changes?" if the user has modified annotations in a .okular
archive.
BUG: 300197
3) Turned a "sorry" message in a "information" (with dontshowthisagain),
because now we also have the "Save changes?" prompt to inform the user.
4) Suppressed all annotation-related message boxes on document opening
This patch turns Okular into a ReadWritePart. Annotation editing is always
disabled if we're loaded as ReadOnlyPart, no matter the document type.
REVIEW: 105020
The only affected generator is poppler. Note that:
Document has /Encrypt <=iff=> SaveInterface supportsOption(SaveChanges) is false
This patch enforces the following behavior (and warns the user the first time
he edits an annotation).
- If the document has /Encrypt, warn that "Save as" is not available, but it's
possible to export as okular archive. New annotations will be automatically
saved to XML as usual.
Note that the previous patch already made all existing annotations uneditable,
because there's no way to save them.
- If the document has no /Encrypt and there are existing external annotations,
warn that changes won't be saved automatically. The user needs to "Save as" or
changes will be lost.
- If the document has no /Encrypt and there aren't existing external
annotations, don't show any warning. New annotations will be automatically saved
to XML as usual and to file if "Save as" is pressed.
Modification and removal of *external* annotations are disabled by this
patch. Note that this change doesn't remove any functionality, because they
have never been implemented (AnnotationProxy is defined by the previous
patch).
The #if0'd blocks will be enabled by a future patch that provides fallback
behavior for generators that don't support saving changes.
I did not have time to finish the poppler work and even if this will probably be good for using the poppler work, this adds new API and I don't want to commit to this since having a proper look at making it work
Sorry i failed to fulfill my promise
and implement it in the pdf generator, others welcome to implement the function
for other generators
svn path=/trunk/KDE/kdegraphics/okular/; revision=1114944
Luigi's mail says
********
The attached patch changes a bit the handling of document informations
and the informations shown in the info page.
- document path is added to the information and a button allows you to
toggle between to file name (default) and the complete path;
- the number of the page is added to the information set by
documentInfo() and not by the properties dialog (so the latter will not
modify datas);
- the order of the information shown is the fixed now (see
orderedProperties).
*********
Then there are a few things of my own since some const here and there and adding three values to Key enum
Also it fixes wish 208999
BUGS: 208999
svn path=/trunk/KDE/kdegraphics/okular/; revision=1049872
This allows a resolution, if set, of that named destination when opening a document.
CCBUG: 192032
svn path=/trunk/KDE/kdegraphics/okular/; revision=967542
(fixes potential crash because of references to potentially non-existing pages in the next open document)
svn path=/trunk/KDE/kdegraphics/okular/; revision=923020
fix crash when activating some of the toc items in the testcase of #176513 (still it would be nice to know why they are "void" items"...)
svn path=/trunk/KDE/kdegraphics/okular/; revision=890803