[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: KDE3 Session Management
From: Torsten Foertsch <torsten.foertsch () gmx ! net>
Date: 2009-02-17 7:49:18
Message-ID: 200902170849.19036.torsten.foertsch () gmx ! net
[Download RAW message or body]
Hi,
I have registered for this list only a few minutes ago. Hence, I am not
sure if it is the right one for my question. If not please refer me to
the right place.
Also, I must say this is my first attempt in KDE programming and my C++
skills are quite low. I am a C and Perl programmer mainly.
That said, I have got a KDE3 application that creates a systray icon. It
doesn't have a KMainWindow. The main object of the application is a
KApplication.
Now I want to preserve some state over a shutdown/startup cycle. In the
docs to KApplication I have found the saveYourself function. But it is
marked as deprecated. Instead one should use KSessionManaged. Then
there comes this sentence:
> For purposes without KMainWindow, create an instance of
> KSessionManaged and reimplement the functions
> KSessionManaged::commitData() and/or KSessionManaged::saveState()
With my limited C++ wits I have translated that into: "create a class
that inherits from KSessionManaged and implement there commitData and
saveState." Is that correct?
So, I did the following (MyApp inherits from KApplication):
MySession::MySession(MyApp* app)
: KSessionManaged()
{
fprintf(stderr, "Session Constructor\n");
appInstance=app;
...
}
bool MySession::saveState(QSessionManager& sm)
{
KConfig* conf=appInstance->sessionConfig();
fprintf(stderr, "saveState\n");
conf->setGroup(QString::fromLatin1("Restore"));
conf->writeEntry(QString::fromLatin1("ExecMode"), execMode);
...
return true;
}
bool MySession::commitData(QSessionManager& sm) {
return true;
}
MySession::~MySession() {}
But it doesn't work. I see the constructor is called. But it seems
saveState is not. At least I don't see the printout even if stderr is
redirected to a file. And there is no file called "myapp_..." in
~/.kde/share/config/session.
How to make it work?
What would be the best way to go with future porting to KDE4 in mind?
Thanks,
Torsten
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic