kate Library API Documentation

katedocmanager.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
00003    Copyright (C) 2002 Joseph Wenninger <jowenn@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
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     Kate::DocumentManager *documentManager () { return m_documentManager; };
00061 
00062     Kate::Document *createDoc ();
00063     void deleteDoc (Kate::Document *doc);
00064 
00065     Kate::Document *document (uint n);
00066 
00067     Kate::Document *activeDocument ();
00068     void setActiveDocument (Kate::Document *doc);
00069 
00070     Kate::Document *firstDocument ();
00071     Kate::Document *nextDocument ();
00072 
00073     // search document with right documentNumber()
00074     Kate::Document *documentWithID (uint id);
00075 
00076     const KateDocumentInfo *documentInfo (Kate::Document *doc);
00077 
00078     int findDocument (Kate::Document *doc);
00080     int findDocument (KURL url);
00081     // Anders: The above is not currently stable ?
00082     Kate::Document *findDocumentByUrl( KURL url );
00083 
00084     bool isOpen(KURL url);
00085 
00086     uint documents ();
00087 
00088     QPtrList<Kate::Document> &documentList () { return m_docList; };
00089 
00090     Kate::Document *openURL(const KURL&,const QString &encoding=QString::null,uint *id =0);
00091     
00092     bool closeDocument(class Kate::Document *);
00093     bool closeDocument(uint);
00094     bool closeDocumentWithID(uint);
00095     bool closeAllDocuments();
00096     
00097     bool queryCloseDocuments(KateMainWindow *w);
00098 
00099     void saveDocumentList (class KConfig *config);
00100     void restoreDocumentList (class KConfig *config);
00101 
00102     DCOPObject *dcopObject () { return m_dcop; };
00103 
00104     inline bool getSaveMetaInfos() { return m_saveMetaInfos; };
00105     inline void setSaveMetaInfos(bool b) { m_saveMetaInfos = b; };
00106 
00107     inline int getDaysMetaInfos() { return m_daysMetaInfos; };
00108     inline void setDaysMetaInfos(int i) { m_daysMetaInfos = i; };
00109 
00110   signals:
00111     void documentCreated (Kate::Document *doc);
00112     void documentDeleted (uint documentNumber);
00113     void documentChanged ();
00114     void initialDocumentReplaced ();
00115 
00116   private slots:
00117     void slotModifiedOnDisc (Kate::Document *doc, bool b, unsigned char reason);
00118     void slotModChanged(Kate::Document *doc);
00119 
00120   private:
00121     bool loadMetaInfos(Kate::Document *doc, const KURL &url);
00122     void saveMetaInfos(Kate::Document *doc);
00123     bool computeUrlMD5(const KURL &url, QCString &result);
00124 
00125     Kate::DocumentManager *m_documentManager;
00126     QPtrList<Kate::Document> m_docList;
00127     QIntDict<Kate::Document> m_docDict;
00128     QPtrDict<KateDocumentInfo> m_docInfos;
00129     QGuardedPtr<Kate::Document> m_currentDoc;
00130     KConfig *m_metaInfos;
00131     bool m_saveMetaInfos;
00132     int m_daysMetaInfos;
00133 
00134     DCOPObject *m_dcop;
00135     
00136     KParts::Factory *m_factory;
00137 };
00138 
00139 #endif
KDE Logo
This file is part of the documentation for kate Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Apr 5 03:59:28 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003