Disabled the old session manager and switched permanently to the new one. Lot of functionality still missing.

It is possible to switch sessions from the session panel (either by the activate pushbutton or by executing a listview item).
Kate's session settings are currently not yet supported (last session is saved and restored by default).

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/2/head
Michele Calgaro 10 years ago
parent de91a161b1
commit 099c8a8821

@ -75,7 +75,6 @@ KateApp::KateApp (TDECmdLineArgs *args)
m_pluginManager = new KatePluginManager (TQT_TQOBJECT(this)); m_pluginManager = new KatePluginManager (TQT_TQOBJECT(this));
// session manager up // session manager up
m_oldSessionManager = new OldKateSessionManager (TQT_TQOBJECT(this));
m_sessionManager = KateSessionManager::self(); m_sessionManager = KateSessionManager::self();
// application dcop interface // application dcop interface
@ -109,7 +108,6 @@ KateApp::~KateApp ()
delete m_obj; // cu dcop interface delete m_obj; // cu dcop interface
delete m_pluginManager; // cu plugin manager delete m_pluginManager; // cu plugin manager
delete m_sessionManager; // delete session manager delete m_sessionManager; // delete session manager
delete m_oldSessionManager; // delete session manager
delete m_docManager; // delete document manager. Do this now, or we crash delete m_docManager; // delete document manager. Do this now, or we crash
} }
@ -142,10 +140,8 @@ void KateApp::restoreKate ()
// restore the nice files ;) we need it // restore the nice files ;) we need it
Kate::Document::setOpenErrorDialogsActivated(false); Kate::Document::setOpenErrorDialogsActivated(false);
// activate again correct session!!! // restore last session
sessionConfig()->setGroup("General"); sessionManager()->restoreLastSession();
TQString lastSession (sessionConfig()->readEntry ("Last Session", "default.katesession"));
oldSessionManager()->activateSession (new OldKateSession (oldSessionManager(), lastSession, ""), false, false, false);
m_docManager->restoreDocumentList(sessionConfig()); m_docManager->restoreDocumentList(sessionConfig());
Kate::Document::setOpenErrorDialogsActivated(true); Kate::Document::setOpenErrorDialogsActivated(true);
@ -154,7 +150,7 @@ void KateApp::restoreKate ()
for (int n=1; TDEMainWindow::canBeRestored(n); n++) for (int n=1; TDEMainWindow::canBeRestored(n); n++)
newMainWindow(sessionConfig(), TQString ("%1").arg(n)); newMainWindow(sessionConfig(), TQString ("%1").arg(n));
// oh, no mainwindow, create one, should not happen, but make sure ;) // no mainwindow, create one, should not happen, but make sure ;)
if (mainWindows() == 0) if (mainWindows() == 0)
newMainWindow (); newMainWindow ();
@ -167,17 +163,24 @@ bool KateApp::startupKate ()
// user specified session to open // user specified session to open
if (m_args->isSet ("start")) if (m_args->isSet ("start"))
{ {
oldSessionManager()->activateSession (oldSessionManager()->giveSession (TQString::fromLocal8Bit(m_args->getOption("start"))), false, false); // MIKE fixme: need to handle this functionality
sessionManager()->activateSession(
sessionManager()->getSessionIdFromName(TQString::fromLocal8Bit(m_args->getOption("start"))));
} }
else else
{ {
// MIKE: for the time being just open last session.
// FIXME: need to add support for startup session options
sessionManager()->restoreLastSession();
// MIKE fixme: need to handle this functionality
// let the user choose session if possible // let the user choose session if possible
if (!oldSessionManager()->chooseSession ()) /*if (!oldSessionManager()->chooseSession ())
{ {
// we will exit kate now, notify the rest of the world we are done // we will exit kate now, notify the rest of the world we are done
TDEStartupInfo::appStarted (startupId()); TDEStartupInfo::appStarted (startupId());
return false; return false;
} }*/
} }
// oh, no mainwindow, create one, should not happen, but make sure ;) // oh, no mainwindow, create one, should not happen, but make sure ;)
@ -269,7 +272,8 @@ void KateApp::shutdownKate (KateMainWindow *win)
if (!win->queryClose_internal()) if (!win->queryClose_internal())
return; return;
oldSessionManager()->saveActiveSession(true, true); // Save current session here to make sure all GUI elements are saved correctly
sessionManager()->saveActiveSession();
// detach the dcopClient // detach the dcopClient
dcopClient()->detach(); dcopClient()->detach();
@ -291,11 +295,6 @@ KateDocManager *KateApp::documentManager ()
return m_docManager; return m_docManager;
} }
OldKateSessionManager *KateApp::oldSessionManager ()
{
return m_oldSessionManager;
}
KateSessionManager* KateApp::sessionManager() KateSessionManager* KateApp::sessionManager()
{ {
return m_sessionManager; return m_sessionManager;

@ -26,7 +26,6 @@
#include <tqvaluelist.h> #include <tqvaluelist.h>
class OldKateSessionManager;
class KateSessionManager; class KateSessionManager;
class KateAppDCOPIface; class KateAppDCOPIface;
@ -129,7 +128,6 @@ class KDE_EXPORT KateApp : public TDEApplication
* accessor to session manager * accessor to session manager
* @return session manager instance * @return session manager instance
*/ */
OldKateSessionManager *oldSessionManager ();
KateSessionManager *sessionManager(); KateSessionManager *sessionManager();
/** /**
@ -224,7 +222,6 @@ class KDE_EXPORT KateApp : public TDEApplication
/** /**
* session manager * session manager
*/ */
OldKateSessionManager *m_oldSessionManager;
KateSessionManager *m_sessionManager; KateSessionManager *m_sessionManager;

@ -91,14 +91,15 @@ bool KateAppDCOPIface::openInput (TQString text)
bool KateAppDCOPIface::activateSession(TQString session) bool KateAppDCOPIface::activateSession(TQString session)
{ {
m_app->oldSessionManager()->activateSession (m_app->oldSessionManager()->giveSession (session)); // MIKE: to fix
// m_app->sessionManager()->activateSession (m_app->oldSessionManager()->giveSession (session));
return true; return true;
} }
const TQString& KateAppDCOPIface::session() const const TQString& KateAppDCOPIface::session() const
{ {
return m_app->oldSessionManager()->activeSession()->sessionName(); return m_app->sessionManager()->getActiveSessionName();
} }
// kate: space-indent on; indent-width 2; replace-tabs on; // kate: space-indent on; indent-width 2; replace-tabs on;

@ -305,8 +305,9 @@ void KateMainWindow::setupActions()
slotWindowActivated (); slotWindowActivated ();
// MIKE to fix and enable again
// session actions // session actions
new TDEAction(i18n("Menu entry Session->New", "&New"), "list-add", 0, TQT_TQOBJECT(OldKateSessionManager::self()), TQT_SLOT(sessionNew()), actionCollection(), "sessions_new"); /* new TDEAction(i18n("Menu entry Session->New", "&New"), "list-add", 0, TQT_TQOBJECT(OldKateSessionManager::self()), TQT_SLOT(sessionNew()), actionCollection(), "sessions_new");
new TDEAction(i18n("&Open..."), "document-open", 0, TQT_TQOBJECT(OldKateSessionManager::self()), TQT_SLOT(sessionOpen()), actionCollection(), "sessions_open"); new TDEAction(i18n("&Open..."), "document-open", 0, TQT_TQOBJECT(OldKateSessionManager::self()), TQT_SLOT(sessionOpen()), actionCollection(), "sessions_open");
new TDEAction(i18n("&Save"), "document-save", 0, TQT_TQOBJECT(OldKateSessionManager::self()), TQT_SLOT(sessionSave()), actionCollection(), "sessions_save"); new TDEAction(i18n("&Save"), "document-save", 0, TQT_TQOBJECT(OldKateSessionManager::self()), TQT_SLOT(sessionSave()), actionCollection(), "sessions_save");
new TDEAction(i18n("Save &As..."), "document-save-as", 0, TQT_TQOBJECT(OldKateSessionManager::self()), TQT_SLOT(sessionSaveAs()), actionCollection(), "sessions_save_as"); new TDEAction(i18n("Save &As..."), "document-save-as", 0, TQT_TQOBJECT(OldKateSessionManager::self()), TQT_SLOT(sessionSaveAs()), actionCollection(), "sessions_save_as");
@ -314,6 +315,7 @@ void KateMainWindow::setupActions()
// quick open menu ;) // quick open menu ;)
new OldKateSessionsAction (i18n("&Quick Open"), actionCollection(), "sessions_list"); new OldKateSessionsAction (i18n("&Quick Open"), actionCollection(), "sessions_list");
*/
} }
KateTabWidget *KateMainWindow::tabWidget () KateTabWidget *KateMainWindow::tabWidget ()
@ -370,7 +372,7 @@ bool KateMainWindow::queryClose()
// and save docs if we really close down ! // and save docs if we really close down !
if ( queryClose_internal () ) if ( queryClose_internal () )
{ {
KateApp::self()->oldSessionManager()->saveActiveSession(true, true); KateApp::self()->sessionManager()->saveActiveSession();
// detach the dcopClient // detach the dcopClient
KateApp::self()->dcopClient()->detach(); KateApp::self()->dcopClient()->detach();
@ -824,7 +826,7 @@ void KateMainWindow::updateCaption (Kate::Document *doc)
c = m_viewManager->activeView()->getDoc()->url().prettyURL(); c = m_viewManager->activeView()->getDoc()->url().prettyURL();
} }
TQString sessName = KateApp::self()->oldSessionManager()->activeSession()->sessionName(); TQString sessName = KateApp::self()->sessionManager()->getActiveSessionName();
if ( !sessName.isEmpty() ) if ( !sessName.isEmpty() )
sessName = TQString("%1: ").arg( sessName ); sessName = TQString("%1: ").arg( sessName );
@ -855,10 +857,8 @@ void KateMainWindow::readProperties(TDEConfig *config)
void KateMainWindow::saveGlobalProperties( TDEConfig* sessionConfig ) void KateMainWindow::saveGlobalProperties( TDEConfig* sessionConfig )
{ {
KateDocManager::self()->saveDocumentList (sessionConfig); // MIKE do we still need this code here?
// KateDocManager::self()->saveDocumentList (sessionConfig);
sessionConfig->setGroup("General");
sessionConfig->writeEntry ("Last Session", KateApp::self()->oldSessionManager()->activeSession()->sessionFileRelative());
} }
// kate: space-indent on; indent-width 2; replace-tabs on; // kate: space-indent on; indent-width 2; replace-tabs on;

@ -50,6 +50,7 @@
// FIXME general: need to keep doc list and current session's m_documents in synchro // FIXME general: need to keep doc list and current session's m_documents in synchro
// all the time (doc open, doc closed, doc renamed) // all the time (doc open, doc closed, doc renamed)
// FIXME add code to handle the various options in Configure Kate -> Application -> Sessions
// String constants // String constants
namespace namespace
@ -63,6 +64,7 @@ namespace
const char *KS_OPENDOC = "Open Documents"; const char *KS_OPENDOC = "Open Documents";
const char *KS_READONLY = "ReadOnly"; const char *KS_READONLY = "ReadOnly";
const char *KS_UNNAMED = "Unnamed"; const char *KS_UNNAMED = "Unnamed";
const char *KS_OPEN_MAINWINDOWS = "Open MainWindows";
// Kate session manager // Kate session manager
const char *KSM_DIR = "kate/sessions"; const char *KSM_DIR = "kate/sessions";
@ -162,14 +164,14 @@ void KateSession::setReadOnly(bool readOnly)
} }
//------------------------------------ //------------------------------------
void KateSession::save(bool saveDocList) void KateSession::save(bool saveGUIInfo)
{ {
if (m_readOnly) if (m_readOnly)
return; return;
// create a new session filename if needed
if (!m_isFullName) if (!m_isFullName)
{ {
// create a new session filename
int s = time(0); int s = time(0);
TQCString tname; TQCString tname;
TQString tmpName; TQString tmpName;
@ -187,6 +189,7 @@ void KateSession::save(bool saveDocList)
} }
} }
// save session config info
if (!m_config) if (!m_config)
{ {
m_config = new KSimpleConfig(m_filename); m_config = new KSimpleConfig(m_filename);
@ -210,9 +213,20 @@ void KateSession::save(bool saveDocList)
{ {
m_config->writeEntry(TQString("URL_%1").arg(i), m_documents[i]); m_config->writeEntry(TQString("URL_%1").arg(i), m_documents[i]);
} }
if (saveDocList)
// save GUI elements info
if (saveGUIInfo)
{ {
KateDocManager::self()->saveDocumentList(m_config); KateDocManager::self()->saveDocumentList(m_config);
// save main windows info
int mwCount = KateApp::self()->mainWindows();
m_config->setGroup(KS_OPEN_MAINWINDOWS);
m_config->writeEntry(KS_COUNT, mwCount);
for (int i=0; i<mwCount; ++i)
{
m_config->setGroup(TQString("MainWindow%1").arg(i));
KateApp::self()->mainWindow(i)->saveProperties(m_config);
}
} }
m_config->sync(); m_config->sync();
@ -220,13 +234,36 @@ void KateSession::save(bool saveDocList)
//------------------------------------ //------------------------------------
void KateSession::activate() void KateSession::activate()
{
if (KateDocManager::self()->documents() > 0)
{ {
KateDocManager::self()->closeAllDocuments(); KateDocManager::self()->closeAllDocuments();
}
Kate::Document::setOpenErrorDialogsActivated(false); Kate::Document::setOpenErrorDialogsActivated(false);
if (m_config) if (m_config)
{ {
KateApp::self()->documentManager()->restoreDocumentList(m_config); KateApp::self()->documentManager()->restoreDocumentList(m_config);
} }
// load main windows info, if it exists
if (m_config && m_config->hasGroup(KS_OPEN_MAINWINDOWS))
{
m_config->setGroup(KS_OPEN_MAINWINDOWS);
int mwCount = m_config->readUnsignedNumEntry(KS_COUNT, 1);
for (int i=0; i<mwCount; ++i)
{
if (i >= KateApp::self()->mainWindows())
{
KateApp::self()->newMainWindow(m_config, TQString("MainWindow%1").arg(i));
}
else
{
m_config->setGroup(TQString("MainWindow%1").arg(i));
KateApp::self()->mainWindow(i)->readProperties(m_config);
}
}
}
Kate::Document::setOpenErrorDialogsActivated(true); Kate::Document::setOpenErrorDialogsActivated(true);
} }
@ -246,7 +283,7 @@ KateSessionManager* KateSessionManager::self()
//------------------------------------ //------------------------------------
KateSessionManager::KateSessionManager() : KateSessionManager::KateSessionManager() :
m_baseDir(locateLocal("data", KSM_DIR)+"/"), m_configFile(m_baseDir + KSM_FILE), m_baseDir(locateLocal("data", KSM_DIR)+"/"), m_configFile(m_baseDir + KSM_FILE),
m_sessionsCount(0), m_activeSessionId(-1), m_sessions(), m_config(NULL) m_sessionsCount(0), m_activeSessionId(0), m_firstActivation(true), m_sessions(), m_config(NULL)
{ {
m_sessions.setAutoDelete(true); m_sessions.setAutoDelete(true);
@ -256,7 +293,8 @@ KateSessionManager::KateSessionManager() :
m_config = new KSimpleConfig(m_configFile); m_config = new KSimpleConfig(m_configFile);
m_config->setGroup(KSM_SESSIONS_LIST); m_config->setGroup(KSM_SESSIONS_LIST);
m_sessionsCount = m_config->readNumEntry(KSM_SESSIONS_COUNT, 0); m_sessionsCount = m_config->readNumEntry(KSM_SESSIONS_COUNT, 0);
m_activeSessionId = m_config->readNumEntry(KSM_ACTIVE_SESSION_ID, -1); //FIXME : if m_sessionsCount == 0, create session list from existing session files
m_activeSessionId = m_config->readNumEntry(KSM_ACTIVE_SESSION_ID, 0);
for (int i=0; i<m_sessionsCount; ++i) for (int i=0; i<m_sessionsCount; ++i)
{ {
TQString urlStr = m_config->readEntry(TQString("URL_%1").arg(i)); TQString urlStr = m_config->readEntry(TQString("URL_%1").arg(i));
@ -278,11 +316,18 @@ KateSessionManager::KateSessionManager() :
} }
} }
m_sessionsCount = static_cast<int>(m_sessions.count()); m_sessionsCount = static_cast<int>(m_sessions.count());
if (m_sessionsCount == 0) // In the worst case, there is no valid session at all
{
m_sessions.append(new KateSession(TQString::null, m_baseDir, false));
++m_sessionsCount;
}
if (m_activeSessionId < 0 || m_activeSessionId >= m_sessionsCount) if (m_activeSessionId < 0 || m_activeSessionId >= m_sessionsCount)
{ {
m_activeSessionId = 0; // Invalid active session was detected. Use first in the list m_activeSessionId = 0; // Invalid active session was detected. Use first in the list
} }
m_sessions[m_activeSessionId]->activate(); //NOTE do not activate any session in the KateSessionManager costructor
// since Kate's main window may not be ready yet. The initial session
// will be activated by KateApp::startupKate() or void KateApp::restoreKate()
} }
//------------------------------------ //------------------------------------
@ -316,34 +361,71 @@ void KateSessionManager::saveConfig()
for (int i=0; i<m_sessionsCount; ++i) for (int i=0; i<m_sessionsCount; ++i)
{ {
// Save the session first, to make sure a new session has an associated file // Save the session first, to make sure a new session has an associated file
m_sessions[i]->save(i == m_activeSessionId); m_sessions[i]->save(false);
m_config->writeEntry(TQString("URL_%1").arg(i), m_sessions[i]->getSessionFilename()); m_config->writeEntry(TQString("URL_%1").arg(i), m_sessions[i]->getSessionFilename());
} }
m_config->sync(); m_config->sync();
} }
//------------------------------------
int KateSessionManager::getSessionIdFromName(const TQString &name)
{
if (name.isEmpty())
return KateSessionManager::INVALID_SESSION;
for (int i=0; i<m_sessionsCount; ++i)
{
if (m_sessions[i]->getSessionName() == name)
return i;
}
return KateSessionManager::INVALID_SESSION;
}
//------------------------------------ //------------------------------------
bool KateSessionManager::activateSession(int sessionId, bool saveCurr) bool KateSessionManager::activateSession(int sessionId, bool saveCurr)
{ {
if (sessionId == m_activeSessionId) if (sessionId < 0)
{
return false;
}
if (!m_firstActivation && sessionId == m_activeSessionId)
{ {
return true; return true;
} }
// First check if all documents can be closed safely if (!m_firstActivation)
{
// Do this only if a session has already been activated earlier,
if (KateApp::self()->activeMainWindow()) if (KateApp::self()->activeMainWindow())
{ {
// First check if all documents can be closed safely
if (!KateApp::self()->activeMainWindow()->queryClose_internal()) if (!KateApp::self()->activeMainWindow()->queryClose_internal())
return false; return false;
} }
if (saveCurr)
{
m_sessions[m_activeSessionId]->save(true); m_sessions[m_activeSessionId]->save(true);
}
}
m_sessions[sessionId]->activate(); m_sessions[sessionId]->activate();
m_activeSessionId = sessionId; m_activeSessionId = sessionId;
m_firstActivation = false;
return true; return true;
} }
//------------------------------------
bool KateSessionManager::restoreLastSession()
{
if (!m_firstActivation)
{
return false;
}
// NOTE: m_activeSessionId contains the id of the last active session
return activateSession(m_activeSessionId, false);
}
@ -525,7 +607,7 @@ OldKateSessionManager::~OldKateSessionManager()
OldKateSessionManager *OldKateSessionManager::self() OldKateSessionManager *OldKateSessionManager::self()
{ {
return KateApp::self()->oldSessionManager (); return (OldKateSessionManager*)KateApp::self()->sessionManager();
} }
void OldKateSessionManager::dirty (const TQString &) void OldKateSessionManager::dirty (const TQString &)

@ -31,6 +31,8 @@
#include <tqvaluelist.h> #include <tqvaluelist.h>
#include <tqstringlist.h> #include <tqstringlist.h>
class KateViewSpace;
class OldKateSessionManager; // Michele - to be removed with OldKateSession class OldKateSessionManager; // Michele - to be removed with OldKateSession
class KDirWatch; class KDirWatch;
@ -85,9 +87,9 @@ class KateSession
/** /**
* Save session info * Save session info
* @param saveDocList if true, save also the information about the documents currently open * @param saveGUIInfo if true, save also the information about the GUI elements
*/ */
void save(bool saveDocList); void save(bool saveGUIInfo);
/** /**
* Activate the session * Activate the session
@ -95,6 +97,14 @@ class KateSession
void activate(); void activate();
private: private:
friend class KateViewSpace;
/**
* @return the session config object
*/
TDEConfig* getConfig() { return m_config; }
TQString m_sessionName; TQString m_sessionName;
TQString m_filename; TQString m_filename;
bool m_isFullName; // true -> m_filename is a full filename bool m_isFullName; // true -> m_filename is a full filename
@ -112,6 +122,11 @@ class KateSessionManager
{ {
public: public:
enum
{
INVALID_SESSION = -1
};
/** /**
* get a pointer to the unique KateSessionManager instance. * get a pointer to the unique KateSessionManager instance.
* If the manager does not exist yet, create it. * If the manager does not exist yet, create it.
@ -133,6 +148,11 @@ class KateSessionManager
*/ */
int getActiveSessionId() const { return m_activeSessionId; } int getActiveSessionId() const { return m_activeSessionId; }
/**
* @return the active session name
*/
const TQString& getActiveSessionName() /*FIXME const*/ { return m_sessions[m_activeSessionId]->getSessionName(); }
/** /**
* @return a reference to the active session * @return a reference to the active session
*/ */
@ -143,6 +163,15 @@ class KateSessionManager
*/ */
TQPtrList<KateSession>& getSessionsList() { return m_sessions; } TQPtrList<KateSession>& getSessionsList() { return m_sessions; }
/**
* Returns the session id of the first session whose name matches the
* provided one
* @param name the session name to look for
* @return the session id of the matching session if it is found,
* otherwise KateSessionManager::INVALID_SESSION.
*/
int getSessionIdFromName(const TQString &name);
/** /**
* Activates the selected session. * Activates the selected session.
* @param sessionId the id of the session to activate * @param sessionId the id of the session to activate
@ -151,6 +180,18 @@ class KateSessionManager
*/ */
bool activateSession(int sessionId, bool saveCurr = true); bool activateSession(int sessionId, bool saveCurr = true);
/**
* Restore the last saved session. Can only be used before
* any other session has been activated, i.e. on Kate's startup
* @return whether the session was activated or not
*/
bool restoreLastSession();
/**
* Saves the active session
*/
void saveActiveSession() { m_sessions[m_activeSessionId]->save(true); }
private: private:
KateSessionManager(); KateSessionManager();
@ -158,6 +199,7 @@ class KateSessionManager
TQString m_configFile; // file where the session list config is stored TQString m_configFile; // file where the session list config is stored
int m_sessionsCount; // number of sessions int m_sessionsCount; // number of sessions
int m_activeSessionId; // index of the active session int m_activeSessionId; // index of the active session
bool m_firstActivation; // true until at least one session has been activated
TQPtrList<KateSession> m_sessions; // session list TQPtrList<KateSession> m_sessions; // session list
KSimpleConfig *m_config; // session manager config KSimpleConfig *m_config; // session manager config
@ -431,7 +473,8 @@ class OldKateSessionChooser : public KDialogBase
bool reopenLastSession (); bool reopenLastSession ();
enum { enum
{
resultQuit = TQDialog::Rejected, resultQuit = TQDialog::Rejected,
resultOpen, resultOpen,
resultNew, resultNew,
@ -474,7 +517,8 @@ class OldKateSessionOpenDialog : public KDialogBase
OldKateSession::Ptr selectedSession (); OldKateSession::Ptr selectedSession ();
enum { enum
{
resultOk, resultOk,
resultCancel resultCancel
}; };

@ -62,7 +62,8 @@ KateSessionPanel::KateSessionPanel(KateMainWindow *mainWindow, KateViewManager *
m_listview->setColumnAlignment(2, TQt::AlignCenter); m_listview->setColumnAlignment(2, TQt::AlignCenter);
m_listview->setMinimumWidth(m_listview->sizeHint().width()); m_listview->setMinimumWidth(m_listview->sizeHint().width());
m_listview->setSorting(-1); m_listview->setSorting(-1);
//m_listview->setRootIsDecorated(true); // to enable after inserting doc list //m_listview->setRootIsDecorated(true); // MIKE to enable after inserting doc list
connect(m_listview, TQT_SIGNAL(executed(TQListViewItem*)), TQT_SLOT(itemExecuted(TQListViewItem*)));
TQPtrList<KateSession>& sessions = m_sessionManager->getSessionsList(); TQPtrList<KateSession>& sessions = m_sessionManager->getSessionsList();
for (int idx = sessions.count()-1; idx >= 0; --idx) for (int idx = sessions.count()-1; idx >= 0; --idx)
@ -210,3 +211,16 @@ void KateSessionPanel::sessionMoveDown()
{ {
//TODO //TODO
} }
void KateSessionPanel::itemExecuted(TQListViewItem *item)
{
if (!item)
return;
// First level items are sessions. Executing one, will switch to that session
if (!item->parent())
{
sessionActivate();
return;
}
}

@ -74,6 +74,7 @@ class KateSessionPanel : public TQVBox
void sessionToggleReadOnly(); void sessionToggleReadOnly();
void sessionMoveUp(); void sessionMoveUp();
void sessionMoveDown(); void sessionMoveDown();
void itemExecuted(TQListViewItem *item);
private: private:
void setup_toolbar(); void setup_toolbar();

@ -114,11 +114,12 @@ void KateViewSpace::addView(Kate::View* v, bool show)
{ {
TQString vgroup = TQString("%1 %2").arg(m_group).arg(fn); TQString vgroup = TQString("%1 %2").arg(m_group).arg(fn);
OldKateSession::Ptr as = OldKateSessionManager::self()->activeSession (); KateSession *as = KateSessionManager::self()->getActiveSession();
if ( as->configRead() && as->configRead()->hasGroup( vgroup ) ) TDEConfig *asCfg = as->getConfig();
if (asCfg && asCfg->hasGroup(vgroup))
{ {
as->configRead()->setGroup( vgroup ); asCfg->setGroup(vgroup);
v->readSessionConfig ( as->configRead() ); v->readSessionConfig(asCfg);
} }
} }
} }

Loading…
Cancel
Save