Renamed KateSession* --> OldKateSession* (except KateSessionPanel). This is to ease the development and testing of the new KateSession/KateSessionManager code while at the same time preserve session functionality. The OldKateSession* code will be removed once the new code has been fully developed and tested.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/2/head
Michele Calgaro 9 years ago
parent 192b7af948
commit 2eb6191799

@ -75,7 +75,7 @@ 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_sessionManager = new KateSessionManager (TQT_TQOBJECT(this)); m_sessionManager = new OldKateSessionManager (TQT_TQOBJECT(this));
// application dcop interface // application dcop interface
m_obj = new KateAppDCOPIface (this); m_obj = new KateAppDCOPIface (this);
@ -147,7 +147,7 @@ void KateApp::restoreKate ()
// activate again correct session!!! // activate again correct session!!!
sessionConfig()->setGroup("General"); sessionConfig()->setGroup("General");
TQString lastSession (sessionConfig()->readEntry ("Last Session", "default.katesession")); TQString lastSession (sessionConfig()->readEntry ("Last Session", "default.katesession"));
sessionManager()->activateSession (new KateSession (sessionManager(), lastSession, ""), false, false, false); sessionManager()->activateSession (new OldKateSession (sessionManager(), lastSession, ""), false, false, false);
m_docManager->restoreDocumentList (sessionConfig()); m_docManager->restoreDocumentList (sessionConfig());
@ -294,7 +294,7 @@ KateDocManager *KateApp::documentManager ()
return m_docManager; return m_docManager;
} }
KateSessionManager *KateApp::sessionManager () OldKateSessionManager *KateApp::sessionManager ()
{ {
return m_sessionManager; return m_sessionManager;
} }

@ -26,7 +26,7 @@
#include <tqvaluelist.h> #include <tqvaluelist.h>
class KateSessionManager; class OldKateSessionManager;
class KateAppDCOPIface; class KateAppDCOPIface;
namespace Kate { namespace Kate {
@ -128,7 +128,7 @@ class KDE_EXPORT KateApp : public TDEApplication
* accessor to session manager * accessor to session manager
* @return session manager instance * @return session manager instance
*/ */
KateSessionManager *sessionManager (); OldKateSessionManager *sessionManager ();
/** /**
* window management * window management
@ -222,7 +222,7 @@ class KDE_EXPORT KateApp : public TDEApplication
/** /**
* session manager * session manager
*/ */
KateSessionManager *m_sessionManager; OldKateSessionManager *m_sessionManager;
/** /**
* known main windows * known main windows

@ -306,14 +306,14 @@ void KateMainWindow::setupActions()
slotWindowActivated (); slotWindowActivated ();
// session actions // session actions
new TDEAction(i18n("Menu entry Session->New", "&New"), "list-add", 0, TQT_TQOBJECT(KateSessionManager::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(KateSessionManager::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(KateSessionManager::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(KateSessionManager::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");
new TDEAction(i18n("&Manage..."), "view_choose", 0, TQT_TQOBJECT(KateSessionManager::self()), TQT_SLOT(sessionManage()), actionCollection(), "sessions_manage"); new TDEAction(i18n("&Manage..."), "view_choose", 0, TQT_TQOBJECT(OldKateSessionManager::self()), TQT_SLOT(sessionManage()), actionCollection(), "sessions_manage");
// quick open menu ;) // quick open menu ;)
new KateSessionsAction (i18n("&Quick Open"), actionCollection(), "sessions_list"); new OldKateSessionsAction (i18n("&Quick Open"), actionCollection(), "sessions_list");
} }
KateTabWidget *KateMainWindow::tabWidget () KateTabWidget *KateMainWindow::tabWidget ()

@ -48,12 +48,12 @@
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
bool operator<( const KateSession::Ptr& a, const KateSession::Ptr& b ) bool operator<( const OldKateSession::Ptr& a, const OldKateSession::Ptr& b )
{ {
return a->sessionName().lower() < b->sessionName().lower(); return a->sessionName().lower() < b->sessionName().lower();
} }
KateSession::KateSession (KateSessionManager *manager, const TQString &fileName, const TQString &name) OldKateSession::OldKateSession (OldKateSessionManager *manager, const TQString &fileName, const TQString &name)
: m_sessionFileRel (fileName) : m_sessionFileRel (fileName)
, m_sessionName (name) , m_sessionName (name)
, m_documents (0) , m_documents (0)
@ -64,7 +64,7 @@ KateSession::KateSession (KateSessionManager *manager, const TQString &fileName,
init (); init ();
} }
void KateSession::init () void OldKateSession::init ()
{ {
// given file exists, use it to load some stuff ;) // given file exists, use it to load some stuff ;)
if (!m_sessionFileRel.isEmpty() && TDEGlobal::dirs()->exists(sessionFile ())) if (!m_sessionFileRel.isEmpty() && TDEGlobal::dirs()->exists(sessionFile ()))
@ -113,18 +113,18 @@ void KateSession::init ()
} }
} }
KateSession::~KateSession () OldKateSession::~OldKateSession ()
{ {
delete m_readConfig; delete m_readConfig;
delete m_writeConfig; delete m_writeConfig;
} }
TQString KateSession::sessionFile () const TQString OldKateSession::sessionFile () const
{ {
return m_manager->sessionsDir() + "/" + m_sessionFileRel; return m_manager->sessionsDir() + "/" + m_sessionFileRel;
} }
bool KateSession::create (const TQString &name, bool force) bool OldKateSession::create (const TQString &name, bool force)
{ {
if (!force && (name.isEmpty() || !m_sessionFileRel.isEmpty())) if (!force && (name.isEmpty() || !m_sessionFileRel.isEmpty()))
return false; return false;
@ -162,7 +162,7 @@ bool KateSession::create (const TQString &name, bool force)
return true; return true;
} }
bool KateSession::rename (const TQString &name) bool OldKateSession::rename (const TQString &name)
{ {
if (name.isEmpty () || m_sessionFileRel.isEmpty() || m_sessionFileRel == "default.katesession") if (name.isEmpty () || m_sessionFileRel.isEmpty() || m_sessionFileRel == "default.katesession")
return false; return false;
@ -177,7 +177,7 @@ bool KateSession::rename (const TQString &name)
return true; return true;
} }
TDEConfig *KateSession::configRead () TDEConfig *OldKateSession::configRead ()
{ {
if (m_sessionFileRel.isEmpty()) if (m_sessionFileRel.isEmpty())
return 0; return 0;
@ -188,7 +188,7 @@ TDEConfig *KateSession::configRead ()
return m_readConfig = new KSimpleConfig (sessionFile (), true); return m_readConfig = new KSimpleConfig (sessionFile (), true);
} }
TDEConfig *KateSession::configWrite () TDEConfig *OldKateSession::configWrite ()
{ {
if (m_sessionFileRel.isEmpty()) if (m_sessionFileRel.isEmpty())
return 0; return 0;
@ -203,10 +203,10 @@ TDEConfig *KateSession::configWrite ()
return m_writeConfig; return m_writeConfig;
} }
KateSessionManager::KateSessionManager (TQObject *parent) OldKateSessionManager::OldKateSessionManager (TQObject *parent)
: TQObject (parent) : TQObject (parent)
, m_sessionsDir (locateLocal( "data", "kate/sessions")) , m_sessionsDir (locateLocal( "data", "kate/sessions"))
, m_activeSession (new KateSession (this, "", "")) , m_activeSession (new OldKateSession (this, "", ""))
{ {
kdDebug() << "LOCAL SESSION DIR: " << m_sessionsDir << endl; kdDebug() << "LOCAL SESSION DIR: " << m_sessionsDir << endl;
@ -214,21 +214,21 @@ KateSessionManager::KateSessionManager (TQObject *parent)
TDEGlobal::dirs()->makeDir (m_sessionsDir); TDEGlobal::dirs()->makeDir (m_sessionsDir);
} }
KateSessionManager::~KateSessionManager() OldKateSessionManager::~OldKateSessionManager()
{ {
} }
KateSessionManager *KateSessionManager::self() OldKateSessionManager *OldKateSessionManager::self()
{ {
return KateApp::self()->sessionManager (); return KateApp::self()->sessionManager ();
} }
void KateSessionManager::dirty (const TQString &) void OldKateSessionManager::dirty (const TQString &)
{ {
updateSessionList (); updateSessionList ();
} }
void KateSessionManager::updateSessionList () void OldKateSessionManager::updateSessionList ()
{ {
m_sessionList.clear (); m_sessionList.clear ();
@ -238,7 +238,7 @@ void KateSessionManager::updateSessionList ()
bool foundDefault = false; bool foundDefault = false;
for (unsigned int i=0; i < dir.count(); ++i) for (unsigned int i=0; i < dir.count(); ++i)
{ {
KateSession *session = new KateSession (this, dir[i], ""); OldKateSession *session = new OldKateSession (this, dir[i], "");
m_sessionList.append (session); m_sessionList.append (session);
kdDebug () << "FOUND SESSION: " << session->sessionName() << " FILE: " << session->sessionFile() << endl; kdDebug () << "FOUND SESSION: " << session->sessionName() << " FILE: " << session->sessionFile() << endl;
@ -249,12 +249,12 @@ void KateSessionManager::updateSessionList ()
// add default session, if not there // add default session, if not there
if (!foundDefault) if (!foundDefault)
m_sessionList.append (new KateSession (this, "default.katesession", i18n("Default Session"))); m_sessionList.append (new OldKateSession (this, "default.katesession", i18n("Default Session")));
qHeapSort(m_sessionList); qHeapSort(m_sessionList);
} }
void KateSessionManager::activateSession (KateSession::Ptr session, bool closeLast, bool saveLast, bool loadNew) void OldKateSessionManager::activateSession (OldKateSession::Ptr session, bool closeLast, bool saveLast, bool loadNew)
{ {
// don't reload. // don't reload.
// ### comparing the pointers directly is b0rk3d :( // ### comparing the pointers directly is b0rk3d :(
@ -342,18 +342,18 @@ void KateSessionManager::activateSession (KateSession::Ptr session, bool closeLa
} }
} }
KateSession::Ptr KateSessionManager::createSession (const TQString &name) OldKateSession::Ptr OldKateSessionManager::createSession (const TQString &name)
{ {
KateSession::Ptr s = new KateSession (this, "", ""); OldKateSession::Ptr s = new OldKateSession (this, "", "");
s->create (name); s->create (name);
return s; return s;
} }
KateSession::Ptr KateSessionManager::giveSession (const TQString &name) OldKateSession::Ptr OldKateSessionManager::giveSession (const TQString &name)
{ {
if (name.isEmpty()) if (name.isEmpty())
return new KateSession (this, "", ""); return new OldKateSession (this, "", "");
updateSessionList(); updateSessionList();
@ -366,7 +366,7 @@ KateSession::Ptr KateSessionManager::giveSession (const TQString &name)
return createSession (name); return createSession (name);
} }
bool KateSessionManager::saveActiveSession (bool tryAsk, bool rememberAsLast) bool OldKateSessionManager::saveActiveSession (bool tryAsk, bool rememberAsLast)
{ {
if (tryAsk) if (tryAsk)
{ {
@ -437,7 +437,7 @@ bool KateSessionManager::saveActiveSession (bool tryAsk, bool rememberAsLast)
return true; return true;
} }
bool KateSessionManager::chooseSession () bool OldKateSessionManager::chooseSession ()
{ {
bool success = true; bool success = true;
@ -452,18 +452,18 @@ bool KateSessionManager::chooseSession ()
// uhh, just open last used session, show no chooser // uhh, just open last used session, show no chooser
if (sesStart == "last") if (sesStart == "last")
{ {
activateSession (new KateSession (this, lastSession, ""), false, false); activateSession (new OldKateSession (this, lastSession, ""), false, false);
return success; return success;
} }
// start with empty new session // start with empty new session
if (sesStart == "new") if (sesStart == "new")
{ {
activateSession (new KateSession (this, "", ""), false, false); activateSession (new OldKateSession (this, "", ""), false, false);
return success; return success;
} }
KateSessionChooser *chooser = new KateSessionChooser (0, lastSession); OldKateSessionChooser *chooser = new OldKateSessionChooser (0, lastSession);
bool retry = true; bool retry = true;
int res = 0; int res = 0;
@ -473,9 +473,9 @@ bool KateSessionManager::chooseSession ()
switch (res) switch (res)
{ {
case KateSessionChooser::resultOpen: case OldKateSessionChooser::resultOpen:
{ {
KateSession::Ptr s = chooser->selectedSession (); OldKateSession::Ptr s = chooser->selectedSession ();
if (!s) if (!s)
{ {
@ -489,13 +489,13 @@ bool KateSessionManager::chooseSession ()
} }
// exit the app lateron // exit the app lateron
case KateSessionChooser::resultQuit: case OldKateSessionChooser::resultQuit:
success = false; success = false;
retry = false; retry = false;
break; break;
default: default:
activateSession (new KateSession (this, "", ""), false, false); activateSession (new OldKateSession (this, "", ""), false, false);
retry = false; retry = false;
break; break;
} }
@ -506,9 +506,9 @@ bool KateSessionManager::chooseSession ()
{ {
c->setGroup("General"); c->setGroup("General");
if (res == KateSessionChooser::resultOpen) if (res == OldKateSessionChooser::resultOpen)
c->writeEntry ("Startup Session", "last"); c->writeEntry ("Startup Session", "last");
else if (res == KateSessionChooser::resultNew) else if (res == OldKateSessionChooser::resultNew)
c->writeEntry ("Startup Session", "new"); c->writeEntry ("Startup Session", "new");
c->sync (); c->sync ();
@ -519,24 +519,24 @@ bool KateSessionManager::chooseSession ()
return success; return success;
} }
void KateSessionManager::sessionNew () void OldKateSessionManager::sessionNew ()
{ {
activateSession (new KateSession (this, "", "")); activateSession (new OldKateSession (this, "", ""));
} }
void KateSessionManager::sessionOpen () void OldKateSessionManager::sessionOpen ()
{ {
KateSessionOpenDialog *chooser = new KateSessionOpenDialog (0); OldKateSessionOpenDialog *chooser = new OldKateSessionOpenDialog (0);
int res = chooser->exec (); int res = chooser->exec ();
if (res == KateSessionOpenDialog::resultCancel) if (res == OldKateSessionOpenDialog::resultCancel)
{ {
delete chooser; delete chooser;
return; return;
} }
KateSession::Ptr s = chooser->selectedSession (); OldKateSession::Ptr s = chooser->selectedSession ();
if (s) if (s)
activateSession (s); activateSession (s);
@ -544,7 +544,7 @@ void KateSessionManager::sessionOpen ()
delete chooser; delete chooser;
} }
void KateSessionManager::sessionSave () void OldKateSessionManager::sessionSave ()
{ {
// if the active session is valid, just save it :) // if the active session is valid, just save it :)
if (saveActiveSession ()) if (saveActiveSession ())
@ -566,7 +566,7 @@ void KateSessionManager::sessionSave ()
saveActiveSession (); saveActiveSession ();
} }
void KateSessionManager::sessionSaveAs () void OldKateSessionManager::sessionSaveAs ()
{ {
bool ok = false; bool ok = false;
TQString name = KInputDialog::getText (i18n("Specify New Name for Current Session"), i18n("Session name:"), "", &ok); TQString name = KInputDialog::getText (i18n("Specify New Name for Current Session"), i18n("Session name:"), "", &ok);
@ -585,9 +585,9 @@ void KateSessionManager::sessionSaveAs ()
} }
void KateSessionManager::sessionManage () void OldKateSessionManager::sessionManage ()
{ {
KateSessionManageDialog *dlg = new KateSessionManageDialog (0); OldKateSessionManageDialog *dlg = new OldKateSessionManageDialog (0);
dlg->exec (); dlg->exec ();
@ -596,10 +596,10 @@ void KateSessionManager::sessionManage ()
//BEGIN CHOOSER DIALOG //BEGIN CHOOSER DIALOG
class KateSessionChooserItem : public TQListViewItem class OldKateSessionChooserItem : public TQListViewItem
{ {
public: public:
KateSessionChooserItem (TDEListView *lv, KateSession::Ptr s) OldKateSessionChooserItem (TDEListView *lv, OldKateSession::Ptr s)
: TQListViewItem (lv, s->sessionName()) : TQListViewItem (lv, s->sessionName())
, session (s) , session (s)
{ {
@ -608,10 +608,10 @@ class KateSessionChooserItem : public TQListViewItem
setText (1, docs); setText (1, docs);
} }
KateSession::Ptr session; OldKateSession::Ptr session;
}; };
KateSessionChooser::KateSessionChooser (TQWidget *parent, const TQString &lastSession) OldKateSessionChooser::OldKateSessionChooser (TQWidget *parent, const TQString &lastSession)
: KDialogBase ( parent : KDialogBase ( parent
, "" , ""
, true , true
@ -648,10 +648,10 @@ KateSessionChooser::KateSessionChooser (TQWidget *parent, const TQString &lastSe
connect (m_sessions, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(selectionChanged())); connect (m_sessions, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(selectionChanged()));
connect (m_sessions, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(slotUser2())); connect (m_sessions, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(slotUser2()));
KateSessionList &slist (KateSessionManager::self()->sessionList()); OldKateSessionList &slist (OldKateSessionManager::self()->sessionList());
for (unsigned int i=0; i < slist.count(); ++i) for (unsigned int i=0; i < slist.count(); ++i)
{ {
KateSessionChooserItem *item = new KateSessionChooserItem (m_sessions, slist[i]); OldKateSessionChooserItem *item = new OldKateSessionChooserItem (m_sessions, slist[i]);
if (slist[i]->sessionFileRelative() == lastSession) if (slist[i]->sessionFileRelative() == lastSession)
m_sessions->setSelected (item, true); m_sessions->setSelected (item, true);
@ -665,13 +665,13 @@ KateSessionChooser::KateSessionChooser (TQWidget *parent, const TQString &lastSe
selectionChanged (); selectionChanged ();
} }
KateSessionChooser::~KateSessionChooser () OldKateSessionChooser::~OldKateSessionChooser ()
{ {
} }
KateSession::Ptr KateSessionChooser::selectedSession () OldKateSession::Ptr OldKateSessionChooser::selectedSession ()
{ {
KateSessionChooserItem *item = (KateSessionChooserItem *) m_sessions->selectedItem (); OldKateSessionChooserItem *item = (OldKateSessionChooserItem *) m_sessions->selectedItem ();
if (!item) if (!item)
return 0; return 0;
@ -679,27 +679,27 @@ KateSession::Ptr KateSessionChooser::selectedSession ()
return item->session; return item->session;
} }
bool KateSessionChooser::reopenLastSession () bool OldKateSessionChooser::reopenLastSession ()
{ {
return m_useLast->isChecked (); return m_useLast->isChecked ();
} }
void KateSessionChooser::slotUser2 () void OldKateSessionChooser::slotUser2 ()
{ {
done (resultOpen); done (resultOpen);
} }
void KateSessionChooser::slotUser3 () void OldKateSessionChooser::slotUser3 ()
{ {
done (resultNew); done (resultNew);
} }
void KateSessionChooser::slotUser1 () void OldKateSessionChooser::slotUser1 ()
{ {
done (resultQuit); done (resultQuit);
} }
void KateSessionChooser::selectionChanged () void OldKateSessionChooser::selectionChanged ()
{ {
enableButton (KDialogBase::User2, m_sessions->selectedItem ()); enableButton (KDialogBase::User2, m_sessions->selectedItem ());
} }
@ -708,7 +708,7 @@ void KateSessionChooser::selectionChanged ()
//BEGIN OPEN DIALOG //BEGIN OPEN DIALOG
KateSessionOpenDialog::KateSessionOpenDialog (TQWidget *parent) OldKateSessionOpenDialog::OldKateSessionOpenDialog (TQWidget *parent)
: KDialogBase ( parent : KDialogBase ( parent
, "" , ""
, true , true
@ -737,22 +737,22 @@ KateSessionOpenDialog::KateSessionOpenDialog (TQWidget *parent)
connect (m_sessions, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(slotUser2())); connect (m_sessions, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(slotUser2()));
KateSessionList &slist (KateSessionManager::self()->sessionList()); OldKateSessionList &slist (OldKateSessionManager::self()->sessionList());
for (unsigned int i=0; i < slist.count(); ++i) for (unsigned int i=0; i < slist.count(); ++i)
{ {
new KateSessionChooserItem (m_sessions, slist[i]); new OldKateSessionChooserItem (m_sessions, slist[i]);
} }
setResult (resultCancel); setResult (resultCancel);
} }
KateSessionOpenDialog::~KateSessionOpenDialog () OldKateSessionOpenDialog::~OldKateSessionOpenDialog ()
{ {
} }
KateSession::Ptr KateSessionOpenDialog::selectedSession () OldKateSession::Ptr OldKateSessionOpenDialog::selectedSession ()
{ {
KateSessionChooserItem *item = (KateSessionChooserItem *) m_sessions->selectedItem (); OldKateSessionChooserItem *item = (OldKateSessionChooserItem *) m_sessions->selectedItem ();
if (!item) if (!item)
return 0; return 0;
@ -760,12 +760,12 @@ KateSession::Ptr KateSessionOpenDialog::selectedSession ()
return item->session; return item->session;
} }
void KateSessionOpenDialog::slotUser1 () void OldKateSessionOpenDialog::slotUser1 ()
{ {
done (resultCancel); done (resultCancel);
} }
void KateSessionOpenDialog::slotUser2 () void OldKateSessionOpenDialog::slotUser2 ()
{ {
done (resultOk); done (resultOk);
} }
@ -774,7 +774,7 @@ void KateSessionOpenDialog::slotUser2 ()
//BEGIN MANAGE DIALOG //BEGIN MANAGE DIALOG
KateSessionManageDialog::KateSessionManageDialog (TQWidget *parent) OldKateSessionManageDialog::OldKateSessionManageDialog (TQWidget *parent)
: KDialogBase ( parent : KDialogBase ( parent
, "" , ""
, true , true
@ -821,27 +821,27 @@ KateSessionManageDialog::KateSessionManageDialog (TQWidget *parent)
selectionChanged (); selectionChanged ();
} }
KateSessionManageDialog::~KateSessionManageDialog () OldKateSessionManageDialog::~OldKateSessionManageDialog ()
{ {
} }
void KateSessionManageDialog::slotUser1 () void OldKateSessionManageDialog::slotUser1 ()
{ {
done (0); done (0);
} }
void KateSessionManageDialog::selectionChanged () void OldKateSessionManageDialog::selectionChanged ()
{ {
KateSessionChooserItem *item = (KateSessionChooserItem *) m_sessions->selectedItem (); OldKateSessionChooserItem *item = (OldKateSessionChooserItem *) m_sessions->selectedItem ();
m_rename->setEnabled (item && item->session->sessionFileRelative() != "default.katesession"); m_rename->setEnabled (item && item->session->sessionFileRelative() != "default.katesession");
m_del->setEnabled (item && item->session->sessionFileRelative() != "default.katesession"); m_del->setEnabled (item && item->session->sessionFileRelative() != "default.katesession");
} }
void KateSessionManageDialog::rename () void OldKateSessionManageDialog::rename ()
{ {
KateSessionChooserItem *item = (KateSessionChooserItem *) m_sessions->selectedItem (); OldKateSessionChooserItem *item = (OldKateSessionChooserItem *) m_sessions->selectedItem ();
if (!item || item->session->sessionFileRelative() == "default.katesession") if (!item || item->session->sessionFileRelative() == "default.katesession")
return; return;
@ -862,43 +862,43 @@ void KateSessionManageDialog::rename ()
updateSessionList (); updateSessionList ();
} }
void KateSessionManageDialog::del () void OldKateSessionManageDialog::del ()
{ {
KateSessionChooserItem *item = (KateSessionChooserItem *) m_sessions->selectedItem (); OldKateSessionChooserItem *item = (OldKateSessionChooserItem *) m_sessions->selectedItem ();
if (!item || item->session->sessionFileRelative() == "default.katesession") if (!item || item->session->sessionFileRelative() == "default.katesession")
return; return;
TQFile::remove (item->session->sessionFile()); TQFile::remove (item->session->sessionFile());
KateSessionManager::self()->updateSessionList (); OldKateSessionManager::self()->updateSessionList ();
updateSessionList (); updateSessionList ();
} }
void KateSessionManageDialog::updateSessionList () void OldKateSessionManageDialog::updateSessionList ()
{ {
m_sessions->clear (); m_sessions->clear ();
KateSessionList &slist (KateSessionManager::self()->sessionList()); OldKateSessionList &slist (OldKateSessionManager::self()->sessionList());
for (unsigned int i=0; i < slist.count(); ++i) for (unsigned int i=0; i < slist.count(); ++i)
{ {
new KateSessionChooserItem (m_sessions, slist[i]); new OldKateSessionChooserItem (m_sessions, slist[i]);
} }
} }
//END MANAGE DIALOG //END MANAGE DIALOG
KateSessionsAction::KateSessionsAction(const TQString& text, TQObject* parent, const char* name ) OldKateSessionsAction::OldKateSessionsAction(const TQString& text, TQObject* parent, const char* name )
: TDEActionMenu(text, parent, name) : TDEActionMenu(text, parent, name)
{ {
connect(popupMenu(),TQT_SIGNAL(aboutToShow()),this,TQT_SLOT(slotAboutToShow())); connect(popupMenu(),TQT_SIGNAL(aboutToShow()),this,TQT_SLOT(slotAboutToShow()));
} }
void KateSessionsAction::slotAboutToShow() void OldKateSessionsAction::slotAboutToShow()
{ {
popupMenu()->clear (); popupMenu()->clear ();
KateSessionList &slist (KateSessionManager::self()->sessionList()); OldKateSessionList &slist (OldKateSessionManager::self()->sessionList());
for (unsigned int i=0; i < slist.count(); ++i) for (unsigned int i=0; i < slist.count(); ++i)
{ {
popupMenu()->insertItem ( popupMenu()->insertItem (
@ -908,13 +908,13 @@ void KateSessionsAction::slotAboutToShow()
} }
} }
void KateSessionsAction::openSession (int i) void OldKateSessionsAction::openSession (int i)
{ {
KateSessionList &slist (KateSessionManager::self()->sessionList()); OldKateSessionList &slist (OldKateSessionManager::self()->sessionList());
if ((uint)i >= slist.count()) if ((uint)i >= slist.count())
return; return;
KateSessionManager::self()->activateSession(slist[(uint)i]); OldKateSessionManager::self()->activateSession(slist[(uint)i]);
} }
// kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off; // kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off;

@ -29,7 +29,7 @@
#include <tqobject.h> #include <tqobject.h>
#include <tqvaluelist.h> #include <tqvaluelist.h>
class KateSessionManager; class OldKateSessionManager;
class KDirWatch; class KDirWatch;
class TDEListView; class TDEListView;
@ -37,13 +37,13 @@ class KPushButton;
class TQCheckBox; class TQCheckBox;
class KateSession : public TDEShared class OldKateSession : public TDEShared
{ {
public: public:
/** /**
* Define a Shared-Pointer type * Define a Shared-Pointer type
*/ */
typedef TDESharedPtr<KateSession> Ptr; typedef TDESharedPtr<OldKateSession> Ptr;
public: public:
/** /**
@ -52,7 +52,7 @@ class KateSession : public TDEShared
* @param name session name * @param name session name
* @param manager pointer to the manager * @param manager pointer to the manager
*/ */
KateSession (KateSessionManager *manager, const TQString &fileName, const TQString &name); OldKateSession (OldKateSessionManager *manager, const TQString &fileName, const TQString &name);
/** /**
* init the session object, after construction or create * init the session object, after construction or create
@ -62,7 +62,7 @@ class KateSession : public TDEShared
/** /**
* destruct me * destruct me
*/ */
~KateSession (); ~OldKateSession ();
/** /**
* session filename, absolute, calculated out of relative filename + session dir * session filename, absolute, calculated out of relative filename + session dir
@ -143,9 +143,9 @@ class KateSession : public TDEShared
unsigned int m_documents; unsigned int m_documents;
/** /**
* KateSessionMananger * OldKateSessionMananger
*/ */
KateSessionManager *m_manager; OldKateSessionManager *m_manager;
/** /**
* simpleconfig to read from * simpleconfig to read from
@ -158,27 +158,27 @@ class KateSession : public TDEShared
KSimpleConfig *m_writeConfig; KSimpleConfig *m_writeConfig;
}; };
typedef TQValueList<KateSession::Ptr> KateSessionList; typedef TQValueList<OldKateSession::Ptr> OldKateSessionList;
class KateSessionManager : public TQObject class OldKateSessionManager : public TQObject
{ {
Q_OBJECT Q_OBJECT
public: public:
KateSessionManager(TQObject *parent); OldKateSessionManager(TQObject *parent);
~KateSessionManager(); ~OldKateSessionManager();
/** /**
* allow access to this :) * allow access to this :)
* @return instance of the session manager * @return instance of the session manager
*/ */
static KateSessionManager *self(); static OldKateSessionManager *self();
/** /**
* allow access to the session list * allow access to the session list
* kept up to date by watching the dir * kept up to date by watching the dir
*/ */
inline KateSessionList & sessionList () { updateSessionList (); return m_sessionList; } inline OldKateSessionList & sessionList () { updateSessionList (); return m_sessionList; }
/** /**
* activate a session * activate a session
@ -189,20 +189,20 @@ class KateSessionManager : public TQObject
* @param saveLast try to save last session or not? * @param saveLast try to save last session or not?
* @param loadNew load new session stuff? * @param loadNew load new session stuff?
*/ */
void activateSession (KateSession::Ptr session, bool closeLast = true, bool saveLast = true, bool loadNew = true); void activateSession (OldKateSession::Ptr session, bool closeLast = true, bool saveLast = true, bool loadNew = true);
/** /**
* create a new session * create a new session
* @param name session name * @param name session name
*/ */
KateSession::Ptr createSession (const TQString &name); OldKateSession::Ptr createSession (const TQString &name);
/** /**
* return session with given name * return session with given name
* if no existing session matches, create new one with this name * if no existing session matches, create new one with this name
* @param name session name * @param name session name
*/ */
KateSession::Ptr giveSession (const TQString &name); OldKateSession::Ptr giveSession (const TQString &name);
/** /**
* save current session * save current session
@ -218,7 +218,7 @@ class KateSessionManager : public TQObject
* sessionFile == empty means we have no session around for this instance of kate * sessionFile == empty means we have no session around for this instance of kate
* @return session active atm * @return session active atm
*/ */
inline KateSession::Ptr activeSession () { return m_activeSession; } inline OldKateSession::Ptr activeSession () { return m_activeSession; }
/** /**
* session dir * session dir
@ -277,23 +277,23 @@ class KateSessionManager : public TQObject
/** /**
* list of current available sessions * list of current available sessions
*/ */
KateSessionList m_sessionList; OldKateSessionList m_sessionList;
/** /**
* current active session * current active session
*/ */
KateSession::Ptr m_activeSession; OldKateSession::Ptr m_activeSession;
}; };
class KateSessionChooser : public KDialogBase class OldKateSessionChooser : public KDialogBase
{ {
Q_OBJECT Q_OBJECT
public: public:
KateSessionChooser (TQWidget *parent, const TQString &lastSession); OldKateSessionChooser (TQWidget *parent, const TQString &lastSession);
~KateSessionChooser (); ~OldKateSessionChooser ();
KateSession::Ptr selectedSession (); OldKateSession::Ptr selectedSession ();
bool reopenLastSession (); bool reopenLastSession ();
@ -330,15 +330,15 @@ class KateSessionChooser : public KDialogBase
TQCheckBox *m_useLast; TQCheckBox *m_useLast;
}; };
class KateSessionOpenDialog : public KDialogBase class OldKateSessionOpenDialog : public KDialogBase
{ {
Q_OBJECT Q_OBJECT
public: public:
KateSessionOpenDialog (TQWidget *parent); OldKateSessionOpenDialog (TQWidget *parent);
~KateSessionOpenDialog (); ~OldKateSessionOpenDialog ();
KateSession::Ptr selectedSession (); OldKateSession::Ptr selectedSession ();
enum { enum {
resultOk, resultOk,
@ -360,13 +360,13 @@ class KateSessionOpenDialog : public KDialogBase
TDEListView *m_sessions; TDEListView *m_sessions;
}; };
class KateSessionManageDialog : public KDialogBase class OldKateSessionManageDialog : public KDialogBase
{ {
Q_OBJECT Q_OBJECT
public: public:
KateSessionManageDialog (TQWidget *parent); OldKateSessionManageDialog (TQWidget *parent);
~KateSessionManageDialog (); ~OldKateSessionManageDialog ();
protected slots: protected slots:
/** /**
@ -401,13 +401,13 @@ class KateSessionManageDialog : public KDialogBase
KPushButton *m_del; KPushButton *m_del;
}; };
class KateSessionsAction : public TDEActionMenu class OldKateSessionsAction : public TDEActionMenu
{ {
Q_OBJECT Q_OBJECT
public: public:
KateSessionsAction(const TQString& text, TQObject* parent = 0, const char* name = 0); OldKateSessionsAction(const TQString& text, TQObject* parent = 0, const char* name = 0);
~KateSessionsAction (){;}; ~OldKateSessionsAction (){;};
public slots: public slots:
void slotAboutToShow(); void slotAboutToShow();

@ -46,7 +46,7 @@ void KateSessionPanelToolBarParent::resizeEvent (TQResizeEvent*)
KateSessionPanel::KateSessionPanel(KateMainWindow *mainWindow, KateViewManager *viewManager, KateSessionPanel::KateSessionPanel(KateMainWindow *mainWindow, KateViewManager *viewManager,
TQWidget *parent, const char *name) TQWidget *parent, const char *name)
: TQVBox(parent, name), m_mainWin(mainWindow), m_viewManager(viewManager), : TQVBox(parent, name), m_mainWin(mainWindow), m_viewManager(viewManager),
m_sessionManager(KateSessionManager::self()), m_actionCollection(new TDEActionCollection(this)) m_sessionManager(OldKateSessionManager::self()), m_actionCollection(new TDEActionCollection(this))
{ {
// Toolbar // Toolbar
setup_toolbar(); setup_toolbar();

@ -33,7 +33,7 @@
class KateMainWindow; class KateMainWindow;
class KateViewManager; class KateViewManager;
class KateSessionManager; class OldKateSessionManager;
class TDEActionCollection; class TDEActionCollection;
@ -80,7 +80,7 @@ class KateSessionPanel : public TQVBox
KateMainWindow *m_mainWin; KateMainWindow *m_mainWin;
KateViewManager *m_viewManager; KateViewManager *m_viewManager;
KateSessionManager *m_sessionManager; OldKateSessionManager *m_sessionManager;
TDEActionCollection *m_actionCollection; TDEActionCollection *m_actionCollection;
TDEToolBar *m_toolbar; TDEToolBar *m_toolbar;

@ -114,7 +114,7 @@ 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);
KateSession::Ptr as = KateSessionManager::self()->activeSession (); OldKateSession::Ptr as = OldKateSessionManager::self()->activeSession ();
if ( as->configRead() && as->configRead()->hasGroup( vgroup ) ) if ( as->configRead() && as->configRead()->hasGroup( vgroup ) )
{ {
as->configRead()->setGroup( vgroup ); as->configRead()->setGroup( vgroup );

Loading…
Cancel
Save