diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-04-14 11:52:10 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-04-14 11:52:10 +0900 |
commit | 9146504fdd78c192f4287aeb0fe9e6587b2edf2b (patch) | |
tree | df1655ba76d3bbc75d9967d0442e3e11f5c8c9f9 /kicker | |
parent | 57dadda273bfb1598324a0cd94e97a4a64b01bea (diff) | |
download | tdebase-9146504fdd78c192f4287aeb0fe9e6587b2edf2b.tar.gz tdebase-9146504fdd78c192f4287aeb0fe9e6587b2edf2b.zip |
kicker's kate session menu extension: add support for new R14.1.0 style
Kate's session and make sure they are ordered accordingly to the order
in Kate.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'kicker')
-rw-r--r-- | kicker/menuext/kate/katesessionmenu.cpp | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/kicker/menuext/kate/katesessionmenu.cpp b/kicker/menuext/kate/katesessionmenu.cpp index 854f4ce31..711d0968d 100644 --- a/kicker/menuext/kate/katesessionmenu.cpp +++ b/kicker/menuext/kate/katesessionmenu.cpp @@ -76,15 +76,39 @@ void KateSessionMenu::initialize() insertSeparator(); - TQStringList list = TDEGlobal::dirs()->findAllResources( "data", "kate/sessions/*.katesession", false, true); - for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) + TQString configFile = locateLocal("data", "kate/sessions") + "/sessions.list"; + if (TDEGlobal::dirs()->exists(configFile)) { - KSimpleConfig config( *it, true ); - config.setGroup( "General" ); - m_sessions.append( config.readEntry( "Name" ) ); + // Read new style configuration (from TDE R14.1.0) + KSimpleConfig *config = new KSimpleConfig(configFile, true); + config->setGroup("Sessions list"); + int sessionsCount = config->readNumEntry("Sessions count", 0); + for (int i = 0; i < sessionsCount; ++i) + { + TQString urlStr = config->readEntry(TQString("URL_%1").arg(i)); + if (!urlStr.isEmpty() && TDEGlobal::dirs()->exists(urlStr)) + { + // Filter out empty URLs or non existing sessions + KSimpleConfig *sessionConfig = new KSimpleConfig(urlStr, true); + sessionConfig->setGroup("General"); + // Session general properties + TQString sessionName = sessionConfig->readEntry("Name", i18n("Unnamed")); + m_sessions.append( sessionName ); + } + } + } + else + { + TQStringList list = TDEGlobal::dirs()->findAllResources( "data", "kate/sessions/*.katesession", false, true); + for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) + { + KSimpleConfig config( *it, true ); + config.setGroup( "General" ); + m_sessions.append( config.readEntry( "Name" ) ); + } + m_sessions.sort(); } - m_sessions.sort(); for ( TQStringList::ConstIterator it1 = m_sessions.begin(); it1 != m_sessions.end(); ++it1 ) { |