← Back to team overview

qpdfview team mailing list archive

Save firstPage state to database

 

Hello Adam,


> > 2- I want to save firstPage state to database (indeed I wrote the patch)
>> but I don't understand the following part of preparePerFileSettings_v2()?
>> >
>> >     if(Settings::instance()->mainWindow().restorePerFileSettings())
>> >     {
>> >         query.exec("DELETE FROM perfilesettings_v2 WHERE filePath IN
>> (SELECT filePath FROM perfilesettings_v2 ORDER BY lastUsed DESC LIMIT -1
>> OFFSET 1000)");
>> >     }
>> >     else
>> >     {
>> >         query.exec("DELETE FROM perfilesettings_v2");
>> >     }
>
> It is our probably not very elegant way to keep only the 1000 least
> recently used entries of the per-file settings table (or completely
> clear it if the user disabled the option). The number 1000 is pretty
> arbitrary and was chosen conservatively and could propbably be improved.
>

Then is it a typo? It should be "perfilesettings_v1"? "perfilesettings_v2"
is a fresh table, If I'm right then what I did in the following patch [1]
seems better.

More elegant SQL to keep only the last N entries would of course also be
> welcome.

Maybe this thread [2] is what you want? also do you know if the message's
comment [3] about is correct or not?

[1] https://code.launchpad.net/~srazi/qpdfview/store-first-page-per-file
[2] http://stackoverflow.com/a/18677756
[3] http://stackoverflow.com/a/6745571

Best Regards,
Razi.

Follow ups