Commit 06036923 authored by Sergey Vidyuk's avatar Sergey Vidyuk Committed by Kevin Funk
Browse files

Init sessionString plasma datasource val properly

Kdevelop sessionrc content is changed and SessionPrettyContents contains
both seesion name and session content now. Update sessionString value
initialization and remove outdated code in the plasma applet datasource.

REVIEW: 114535
BUG: 328952
parent 22e02a8d
......@@ -73,8 +73,7 @@ void KDevelopSessionsEngine::updateSessions()
Session session;
session.hash = QFileInfo( *it ).dir().dirName();
session.name = cfg.group( "" ).readEntry( "SessionName", "" );
session.contents = cfg.group( "" ).readEntry( "SessionPrettyContents", "" );
session.sessionString = makeSessionString( session );
session.description = cfg.group( "" ).readEntry( "SessionPrettyContents", "" );
sessions.insert(session.hash, session);
}
......@@ -92,8 +91,7 @@ void KDevelopSessionsEngine::updateSessions()
m_currentSessions.insert( session.hash, session );
setData( session.hash, "sessionName", session.name );
setData( session.hash, "sessionContents", session.contents );
setData( session.hash, "sessionString", session.sessionString );
setData( session.hash, "sessionString", session.description );
}
else
{
......@@ -110,20 +108,15 @@ void KDevelopSessionsEngine::updateSessions()
setData( session.hash, "sessionName", session.name );
}
if ( session.contents != oldSession.contents )
if ( session.description != oldSession.description )
{
oldSession.contents = session.contents;
oldSession.description = session.description;
modified = true;
setData( session.hash, "sessionContents", session.contents );
setData( session.hash, "sessionString", session.description );
}
if ( modified )
{
oldSession.sessionString = makeSessionString( session );
setData( session.hash, "sessionString", oldSession.sessionString );
m_currentSessions.insert( oldSession.hash, oldSession );
}
}
}
......@@ -143,14 +136,6 @@ void KDevelopSessionsEngine::updateSessions()
}
}
QString KDevelopSessionsEngine::makeSessionString(const Session& session)
{
if ( !session.name.isEmpty() )
return QString( "%1: %2" ).arg( session.name ).arg( session.contents );
else
return session.contents;
}
K_EXPORT_PLASMA_DATAENGINE(kdevelopsessionsengine, KDevelopSessionsEngine)
#include "kdevelopsessionsengine.moc"
......@@ -26,8 +26,7 @@ struct Session
{
QString hash;
QString name;
QString contents;
QString sessionString;
QString description;
};
class KDirWatch;
......@@ -47,8 +46,6 @@ public:
void updateSessions();
private:
QString makeSessionString(const Session& session);
QHash<QString, Session> m_currentSessions;
KDirWatch *m_dirWatch;
......
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