Re: comments

Frank Osterfeld <[email protected]> Mon, 15 Mar 2004 11:42:52 +0100
Newsgroups gmane.comp.kde.devel.knowit
Message-ID <[email protected]>
* Michal Rudolf [Montag, 15.03.2004 10:55]:

> >1. Something for the TODO list:
> >support for storing/restoring sessions.
>
> Can you be more specific, please?

If you exit KDE, normally the current sessions are stored and restored when 
KDE is started next time. That means, files are reloaded and the state the 
app was in before gets restored as complete as possible.
Knowit just opens with an empty file and that's it (only if "load last file on 
startup" is unchecked, of course).
I don't know what has to be stored in detail, I will look at some other apps 
what they save.  

In KDE, there is a session specific config object, I think it's name is 
KApplication(?)::sessionConfig or similar where you can store the current 
state. 
In a KPart, there are template methods savePreferences(KConfig*), 
readPreferences(KConfig*) which are called automatically by the environment.
I think this evening I will try to learn more about all this config/session 
stuff and how to implement it in a "clean" way (next step in learning 
KDE ;-) ).

> >2. backup
> >If the backup flag is set, the file gets backed up when opened (at the end
> > of Knowit::open() ).
> >Shouldn't it get backed up before being overwritten the file (in
> >Knowit::save() )?
>
> I decided to backup original, as soon as it is opened, so in case of any
> programming error you at least have last version. Previously backup was
> saved on every save, but I decided that this is not that good - if original
> is damaged by programming bug, probably on the next save backup would be
> damaged as well.

Ok, that sounds reasonable, especially if you use autosave. 
I once had such a situation, my central .kno-file (I use one for everything) 
was suddenly empty and had size 0 and autosave (or did I press save in that 
moment for any stupid reason?) overwrote the intact backup as well.
The last backup was a month old...
Unfortunately I have no idea how this happened (and if it was a KnowIt bug or 
not), otherwise I would try to reproduce it and send a bug report.

Regards,

Frank


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click