katedocmanager.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __KATE_DOCMANAGER_H__
00021 #define __KATE_DOCMANAGER_H__
00022
00023 #include "katemain.h"
00024 #include "../interfaces/documentmanager.h"
00025
00026 #include <kate/document.h>
00027
00028 #include <qguardedptr.h>
00029 #include <qptrlist.h>
00030 #include <qobject.h>
00031 #include <qptrdict.h>
00032 #include <qintdict.h>
00033
00034 namespace KParts { class Factory; }
00035
00036 class KConfig;
00037 class DCOPObject;
00038
00039 class KateDocumentInfo
00040 {
00041 public:
00042 KateDocumentInfo ()
00043 : modifiedOnDisc (false),
00044 modifiedOnDiscReason (0)
00045 {
00046 }
00047
00048 bool modifiedOnDisc;
00049 unsigned char modifiedOnDiscReason;
00050 };
00051
00052 class KateDocManager : public QObject
00053 {
00054 Q_OBJECT
00055
00056 public:
00057 KateDocManager (QObject *parent);
00058 ~KateDocManager ();
00059
00060 static KateDocManager *self ();
00061
00062 Kate::DocumentManager *documentManager () { return m_documentManager; };
00063
00064 Kate::Document *createDoc ();
00065 void deleteDoc (Kate::Document *doc);
00066
00067 Kate::Document *document (uint n);
00068
00069 Kate::Document *activeDocument ();
00070 void setActiveDocument (Kate::Document *doc);
00071
00072 Kate::Document *firstDocument ();
00073 Kate::Document *nextDocument ();
00074
00075
00076 Kate::Document *documentWithID (uint id);
00077
00078 const KateDocumentInfo *documentInfo (Kate::Document *doc);
00079
00080 int findDocument (Kate::Document *doc);
00082 int findDocument (KURL url);
00083
00084 Kate::Document *findDocumentByUrl( KURL url );
00085
00086 bool isOpen(KURL url);
00087
00088 uint documents ();
00089
00090 QPtrList<Kate::Document> &documentList () { return m_docList; };
00091
00092 Kate::Document *openURL(const KURL&,const QString &encoding=QString::null,uint *id =0);
00093
00094 bool closeDocument(class Kate::Document *,bool closeURL=true);
00095 bool closeDocument(uint);
00096 bool closeDocumentWithID(uint);
00097 bool closeAllDocuments(bool closeURL=true);
00098
00099 QPtrList<Kate::Document> modifiedDocumentList();
00100 bool queryCloseDocuments(KateMainWindow *w);
00101
00102 void saveDocumentList (class KConfig *config);
00103 void restoreDocumentList (class KConfig *config);
00104
00105 DCOPObject *dcopObject () { return m_dcop; };
00106
00107 inline bool getSaveMetaInfos() { return m_saveMetaInfos; };
00108 inline void setSaveMetaInfos(bool b) { m_saveMetaInfos = b; };
00109
00110 inline int getDaysMetaInfos() { return m_daysMetaInfos; };
00111 inline void setDaysMetaInfos(int i) { m_daysMetaInfos = i; };
00112
00113 public slots:
00118 void saveAll();
00119
00120 signals:
00121 void documentCreated (Kate::Document *doc);
00122 void documentDeleted (uint documentNumber);
00123 void documentChanged ();
00124 void initialDocumentReplaced ();
00125
00126 private slots:
00127 void slotModifiedOnDisc (Kate::Document *doc, bool b, unsigned char reason);
00128 void slotModChanged(Kate::Document *doc);
00129
00130 private:
00131 bool loadMetaInfos(Kate::Document *doc, const KURL &url);
00132 void saveMetaInfos(Kate::Document *doc);
00133 bool computeUrlMD5(const KURL &url, QCString &result);
00134
00135 Kate::DocumentManager *m_documentManager;
00136 QPtrList<Kate::Document> m_docList;
00137 QIntDict<Kate::Document> m_docDict;
00138 QPtrDict<KateDocumentInfo> m_docInfos;
00139 QGuardedPtr<Kate::Document> m_currentDoc;
00140 KConfig *m_metaInfos;
00141 bool m_saveMetaInfos;
00142 int m_daysMetaInfos;
00143
00144 DCOPObject *m_dcop;
00145
00146 KParts::Factory *m_factory;
00147
00148 };
00149
00150 #endif
00151
This file is part of the documentation for kate Library Version 3.4.0.