Commit 32e3eb65 authored by Ivan Shapovalov's avatar Ivan Shapovalov
Browse files

Re-add "SessionPrettyContents" field in the sessionrc.

It is actually used (at least) in the org.kde.kdevelopsessions plasma
applet.
Reported by Sergey Vidyuk.

CCBUG: 328952
parent b70e59cb
......@@ -42,6 +42,7 @@ namespace KDevelop
{
const QString Session::cfgSessionNameEntry = "SessionName";
const QString Session::cfgSessionDescriptionEntry = "SessionPrettyContents";
const QString Session::cfgSessionProjectsEntry = "Open Projects";
const QString Session::cfgSessionOptionsGroup = "General Options";
......@@ -72,13 +73,13 @@ public:
void updateDescription()
{
info.description = generateDescription( info );
buildDescription( info );
emit q->sessionUpdated( q );
}
static QString generatePrettyContents( const SessionInfo& info );
static QString generateDescription( const SessionInfo& info );
static void buildDescription( SessionInfo& info );
};
Session::Session( const QString& id, QObject* parent )
......@@ -201,6 +202,15 @@ QString SessionPrivate::generateDescription( const SessionInfo& info )
return description;
}
void SessionPrivate::buildDescription( SessionInfo& info )
{
QString description = generateDescription( info );
info.description = description;
info.config->group( QString() ).writeEntry( Session::cfgSessionDescriptionEntry, description );
info.config->sync();
}
SessionInfo Session::parse( const QString& id, bool mkdir )
{
SessionInfo ret;
......@@ -223,12 +233,9 @@ SessionInfo Session::parse( const QString& id, bool mkdir )
KConfigGroup cfgRootGroup = ret.config->group( QString() );
KConfigGroup cfgOptionsGroup = ret.config->group( cfgSessionOptionsGroup );
// cruft cleaning
cfgRootGroup.deleteEntry( "SessionPrettyContents" );
ret.name = cfgRootGroup.readEntry( cfgSessionNameEntry, QString() );
ret.projects = cfgOptionsGroup.readEntry( cfgSessionProjectsEntry, QStringList() );
ret.description = SessionPrivate::generateDescription( ret );
SessionPrivate::buildDescription( ret );
return ret;
}
......
......@@ -45,7 +45,7 @@ class KDEVPLATFORMSHELL_EXPORT Session : public ISession
Q_OBJECT
public:
static const QString cfgSessionNameEntry;
static const QString cfgSessionDescriptionEntry;
static const QString cfgSessionProjectsEntry;
static const QString cfgSessionOptionsGroup;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment