20 #ifndef __KATE_DOCMANAGER_H__
21 #define __KATE_DOCMANAGER_H__
24 #include "../interfaces/documentmanager.h"
26 #include <kate/document.h>
28 #include <tqdatetime.h>
29 #include <tqguardedptr.h>
30 #include <tqptrlist.h>
32 #include <tqptrdict.h>
33 #include <tqintdict.h>
37 namespace KParts {
class Factory; }
42 class KateDocumentInfo
46 : modifiedOnDisc (false),
47 modifiedOnDiscReason (0)
52 unsigned char modifiedOnDiscReason;
55 typedef TQPair<KURL,TQDateTime> TPair;
57 class KateDocManager :
public TQObject
62 KateDocManager (TQObject *parent);
65 static KateDocManager *
self ();
69 Kate::Document *createDoc ();
70 void deleteDoc (Kate::Document *doc);
72 Kate::Document *document (uint n);
74 Kate::Document *activeDocument ();
75 void setActiveDocument (Kate::Document *doc);
77 Kate::Document *firstDocument ();
78 Kate::Document *nextDocument ();
81 Kate::Document *documentWithID (uint
id);
83 const KateDocumentInfo *documentInfo (Kate::Document *doc);
85 int findDocument (Kate::Document *doc);
87 int findDocument (KURL url);
89 Kate::Document *findDocumentByUrl( KURL url );
91 bool isOpen(KURL url);
95 TQPtrList<Kate::Document> &documentList () {
return m_docList; };
97 Kate::Document *openURL(
const KURL&,
const TQString &encoding=TQString::null,uint *
id =0,
bool isTempFile=
false);
99 bool closeDocument(
class Kate::Document *,
bool closeURL=
true);
100 bool closeDocument(uint);
101 bool closeDocumentWithID(uint);
102 bool closeAllDocuments(
bool closeURL=
true);
104 TQPtrList<Kate::Document> modifiedDocumentList();
105 bool queryCloseDocuments(KateMainWindow *w);
107 void saveDocumentList (
class TDEConfig *config);
108 void restoreDocumentList (
class TDEConfig *config);
110 DCOPObject *dcopObject () {
return m_dcop; };
112 inline bool getSaveMetaInfos() {
return m_saveMetaInfos; };
113 inline void setSaveMetaInfos(
bool b) { m_saveMetaInfos = b; };
115 inline int getDaysMetaInfos() {
return m_daysMetaInfos; };
116 inline void setDaysMetaInfos(
int i) { m_daysMetaInfos = i; };
126 void documentCreated (Kate::Document *doc);
127 void documentDeleted (uint documentNumber);
128 void documentChanged ();
129 void initialDocumentReplaced ();
132 void slotModifiedOnDisc (Kate::Document *doc,
bool b,
unsigned char reason);
133 void slotModChanged(Kate::Document *doc);
136 bool loadMetaInfos(Kate::Document *doc,
const KURL &url);
137 void saveMetaInfos(Kate::Document *doc);
138 bool computeUrlMD5(
const KURL &url, TQCString &result);
141 TQPtrList<Kate::Document> m_docList;
142 TQIntDict<Kate::Document> m_docDict;
143 TQPtrDict<KateDocumentInfo> m_docInfos;
144 TQMap<uint,TPair> m_tempFiles;
145 TQGuardedPtr<Kate::Document> m_currentDoc;
146 TDEConfig *m_metaInfos;
147 bool m_saveMetaInfos;
152 KParts::Factory *m_factory;
This interface provides access to the Kate Document Manager.
DocumentManager * documentManager()
Returns the document manager object.