[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdebase/kate/app
From: Dominik Haumann <dhdev () gmx ! de>
Date: 2005-08-31 21:00:28
Message-ID: 1125522028.486185.15554.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 455558 by dhaumann:
backport cullmann's commit r453898: make session save work, remove dirwatch, and other fixes
* session save works (testet)
* hope no other probs
CCMAIL: kwrite-devel@kde.org
M +20 -14 katesession.cpp
M +6 -6 katesession.h
--- branches/KDE/3.5/kdebase/kate/app/katesession.cpp #455557:455558
@@ -55,15 +55,20 @@
, m_readConfig (0)
, m_writeConfig (0)
{
+ init ();
+}
+
+void KateSession::init ()
+{
// given file exists, use it to load some stuff ;)
- if (!fileName.isEmpty() && KGlobal::dirs()->exists(sessionFile ()))
+ if (!m_sessionFileRel.isEmpty() && KGlobal::dirs()->exists(sessionFile ()))
{
KSimpleConfig config (sessionFile (), true);
if (m_sessionName.isEmpty())
{
// get the name out of the file
- if (fileName == "default.katesession")
+ if (m_sessionFileRel == "default.katesession")
m_sessionName = i18n("Default Session");
else
{
@@ -80,12 +85,12 @@
}
// filename not empty, create the file
- if (!fileName.isEmpty())
+ if (!m_sessionFileRel.isEmpty())
{
// uhh, no name given
if (m_sessionName.isEmpty())
{
- if (fileName == "default.katesession")
+ if (m_sessionFileRel == "default.katesession")
m_sessionName = i18n("Default Session");
else
m_sessionName = i18n("Session (%1)").arg(QTime::currentTime().toString(Qt::LocalDate));
@@ -115,6 +120,12 @@
if (!force && (name.isEmpty() || !m_sessionFileRel.isEmpty()))
return false;
+ delete m_writeConfig;
+ m_writeConfig = 0;
+
+ delete m_readConfig;
+ m_readConfig = 0;
+
m_sessionName = name;
// get a usable filename
@@ -124,7 +135,7 @@
{
tname.setNum (s++);
KMD5 md5 (tname);
- m_sessionFileRel = md5.hexDigest() + ".katesession";
+ m_sessionFileRel = QString ("%1.katesession").arg (md5.hexDigest().data());
if (!KGlobal::dirs()->exists(sessionFile ()))
break;
@@ -136,6 +147,9 @@
config.writeEntry ("Name", m_sessionName);
config.sync ();
+ // reinit ourselfs ;)
+ init ();
+
return true;
}
@@ -183,20 +197,12 @@
KateSessionManager::KateSessionManager (QObject *parent)
: QObject (parent)
, m_sessionsDir (locateLocal( "data", "kate/sessions"))
- , m_dirWatch (new KDirWatch (this))
, m_activeSession (new KateSession (this, "", ""))
{
kdDebug() << "LOCAL SESSION DIR: " << m_sessionsDir << endl;
// create dir if needed
KGlobal::dirs()->makeDir (m_sessionsDir);
-
- // add this dir to the watch
- connect (m_dirWatch, SIGNAL(dirty (const QString &)), this, SLOT(dirty (const QString &)));
- m_dirWatch->addDir (m_sessionsDir);
-
- // initial setup of the sessions list
- updateSessionList ();
}
KateSessionManager::~KateSessionManager()
@@ -549,7 +555,7 @@
return;
}
- activeSession()->create (name);
+ activeSession()->create (name, true);
saveActiveSession ();
}
--- branches/KDE/3.5/kdebase/kate/app/katesession.h #455557:455558
@@ -55,6 +55,11 @@
KateSession (KateSessionManager *manager, const QString &fileName, const QString &name);
/**
+ * init the session object, after construction or create
+ */
+ void init ();
+
+ /**
* destruct me
*/
~KateSession ();
@@ -173,7 +178,7 @@
* allow access to the session list
* kept up to date by watching the dir
*/
- inline KateSessionList & sessionList () { return m_sessionList; }
+ inline KateSessionList & sessionList () { updateSessionList (); return m_sessionList; }
/**
* activate a session
@@ -270,11 +275,6 @@
QString m_sessionsDir;
/**
- * dirwatch object to keep track of this dir
- */
- KDirWatch *m_dirWatch;
-
- /**
* list of current available sessions
*/
KateSessionList m_sessionList;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic