summaryrefslogtreecommitdiffstats
path: root/src/projectsession.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /src/projectsession.h
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/projectsession.h')
-rw-r--r--src/projectsession.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/projectsession.h b/src/projectsession.h
new file mode 100644
index 00000000..60c0b732
--- /dev/null
+++ b/src/projectsession.h
@@ -0,0 +1,89 @@
+/***************************************************************************
+ projectsession.h - description
+ -------------------
+ begin : 30 Nov 2002
+ copyright : (C) 2002 by Falk Brettschneider
+ email : falk@kdevelop.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef _PROJECTSESSION_H_
+#define _PROJECTSESSION_H_
+
+#include <qobject.h>
+#include <qdom.h>
+#include <qdict.h>
+#include <qvaluelist.h>
+
+class QWidget;
+class KURL;
+class KDevPlugin;
+
+/**
+ * This class stores and restores the last situation before the certain project
+ * was closed.
+ * Session stuff that is not related to a certain project doesn't belong to here;
+ * it must be saved in a program session which likely is "kdeveloprc".
+ **/
+class ProjectSession : public QObject
+{
+ Q_OBJECT
+// methods
+public:
+ ProjectSession();
+ virtual ~ProjectSession();
+
+ /** Opens the .kdevses file and saves the project session in XML format to it. */
+ bool saveToFile(const QString& fileName, const QValueList<KDevPlugin*> plugins );
+
+ /** Opens the .kdevses file and loads the project session from it. */
+ bool restoreFromFile(const QString& fileName, const QValueList<KDevPlugin*> plugins );
+
+signals:
+ void sig_restoreMainWindowProperties(const QDomElement* el);
+ void sig_saveMainWindowProperties(QDomElement* el);
+
+ void sig_restoreAdditionalViewProperties(const QString& viewName, const QDomElement* el);
+ void sig_saveAdditionalViewProperties(const QString& viewName, QDomElement* el);
+
+private slots:
+ /**
+ * This slot loads one document from _docDataList and sets a timer to load the next
+ */
+ void loadDocument();
+
+private:
+ /** Restores the part of the project session that concerns to the documents (files). */
+ void recreateDocs(QDomElement& el);
+ /** recreates views and their properties of a certain document. */
+ void recreateViews(KURL& url, QDomElement docEl, bool activate);
+ /** setup a valid XML file. */
+ void initXMLTree();
+
+// attributes
+private:
+ /** the XML document object controlling the XML tree. */
+ QDomDocument domdoc;
+
+ struct DocumentData
+ {
+ DocumentData() : line(0) {}
+ KURL url;
+ int line;
+ QString type;
+ bool activate;
+ QString encoding;
+ };
+
+ QValueList<DocumentData> _docDataList;
+
+};
+
+#endif // _PROJECTSESSION_H_