[okular] [Bug 402017] Cannot save PDF when loaded file has been deleted

David Hurka bugzilla_noreply at kde.org
Fri Jul 24 13:33:36 BST 2020


https://bugs.kde.org/show_bug.cgi?id=402017

--- Comment #38 from David Hurka <david.hurka at mailbox.org> ---
There exists this code in part.cpp:

> if (m_document->canSaveChanges()) {
>     [...]
> } else {
>     // If the generators doesn't support saving changes, we will
>     // just copy the original file.
>     if (isDocumentArchive) {
>         [...]
>     } else {
>         // duh, our local file disappeared...
>         if (!QFile::exists(localFilePath())) {

So if we make all generators access a local copy, we might either move the
problem or solve a second problem at the same time. I vote for the second
option. ;)

Since there is Generator::loadDocumentFromData(QIODevice ...), it should be 
flexible to implement reading from a local copy. But since
SaveInterface::save() exists only in QString version, we either need to use
real temp files (QTemporaryFile?), or redefine this parameter to be ignored and
write to the previously given QIODevice instead. I vote for the first option.
;)

With always accessing a local copy, we probably won’t need swapBackingFile()
anymore. swapBackingFile() also exists only in QString version.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list