Reply to topic

[SOLVED] I don't get started with KMainWindow::readProperties()

User avatar urwald
Registered Member
Posts
30
Karma
0
OS
Hello.

I'm trying to implement session management for a small program (KRadioRipper). However, it doesn't work :-(

(I'm using KDE 4.1.3 on openSUSE 11.1)

The main window of KRadioRipper is a class that inherits from KXmlGui window (which inherits from KMainWindow). The documentation of KMainWindow says, that when implementing session management, we should not rely on Qt solutions (QSessionManager and so on...), but instead just reimplement queryClose(), saveSettings() and readSettings() from KMainWindow. This way, KMainWindow will take care of the session management.

So I've done this:

  • In main.cpp, I set a unique name for my mainwindow object.
  • In my mainwindow class (inherited from KXmlGui), I reimplement:
    • queryClose (to save files) -> works fine
    • saveSettings() (to save the actual state) -> works also fine. A file for KRadioRipper is generated in the directory which stores the values which are important to restore the session.
    • readSettings() is reimplemented, but it is never called.

And I don't understand why readSettings() is never called. (I've tried this with putting in readSettings() code that shows a message box -> it is really never called).

Should not KMainWindow call readSettings() automatically? Or do I have to do this manually??? Or did I forget to initialize the session management somehow? Or did I forget something else?

Can you help me?

Last edited by urwald on Mon Dec 29, 2008 9:00 pm, edited 1 time in total.


urwald, proud to be a member of KDE forums since 2008-Oct.
User avatar anda_skoa
KDE Developer
Posts
783
Karma
4
OS


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
User avatar urwald
Registered Member
Posts
30
Karma
0
OS
Thank you very much. Now I understand how this is working...

And a happy new year!!!

Cheers.

Tim


urwald, proud to be a member of KDE forums since 2008-Oct.

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], farid, Google [Bot], Majestic-12 [Bot], MSN [Bot], Sogou [Bot], Yahoo [Bot]