• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kate

katedocmanager.h

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, 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 #include <qmap.h>
00034 #include <qpair.h>
00035 
00036 namespace KParts { class Factory; }
00037 
00038 class KConfig;
00039 class DCOPObject;
00040 
00041 class KateDocumentInfo
00042 {
00043   public:
00044     KateDocumentInfo ()
00045      : modifiedOnDisc (false),
00046        modifiedOnDiscReason (0)
00047     {
00048     }
00049 
00050     bool modifiedOnDisc;
00051     unsigned char modifiedOnDiscReason;
00052 };
00053 
00054 typedef QPair<KURL,QDateTime> TPair;
00055 
00056 class KateDocManager : public QObject
00057 {
00058   Q_OBJECT
00059 
00060   public:
00061     KateDocManager (QObject *parent);
00062     ~KateDocManager ();
00063 
00064     static KateDocManager *self ();
00065 
00066     Kate::DocumentManager *documentManager () { return m_documentManager; };
00067 
00068     Kate::Document *createDoc ();
00069     void deleteDoc (Kate::Document *doc);
00070 
00071     Kate::Document *document (uint n);
00072 
00073     Kate::Document *activeDocument ();
00074     void setActiveDocument (Kate::Document *doc);
00075 
00076     Kate::Document *firstDocument ();
00077     Kate::Document *nextDocument ();
00078 
00079     // search document with right documentNumber()
00080     Kate::Document *documentWithID (uint id);
00081 
00082     const KateDocumentInfo *documentInfo (Kate::Document *doc);
00083 
00084     int findDocument (Kate::Document *doc);
00086     int findDocument (KURL url);
00087     // Anders: The above is not currently stable ?
00088     Kate::Document *findDocumentByUrl( KURL url );
00089 
00090     bool isOpen(KURL url);
00091 
00092     uint documents ();
00093 
00094     QPtrList<Kate::Document> &documentList () { return m_docList; };
00095 
00096     Kate::Document *openURL(const KURL&,const QString &encoding=QString::null,uint *id =0,bool isTempFile=false);
00097 
00098     bool closeDocument(class Kate::Document *,bool closeURL=true);
00099     bool closeDocument(uint);
00100     bool closeDocumentWithID(uint);
00101     bool closeAllDocuments(bool closeURL=true);
00102 
00103     QPtrList<Kate::Document> modifiedDocumentList();
00104     bool queryCloseDocuments(KateMainWindow *w);
00105 
00106     void saveDocumentList (class KConfig *config);
00107     void restoreDocumentList (class KConfig *config);
00108 
00109     DCOPObject *dcopObject () { return m_dcop; };
00110 
00111     inline bool getSaveMetaInfos() { return m_saveMetaInfos; };
00112     inline void setSaveMetaInfos(bool b) { m_saveMetaInfos = b; };
00113 
00114     inline int getDaysMetaInfos() { return m_daysMetaInfos; };
00115     inline void setDaysMetaInfos(int i) { m_daysMetaInfos = i; };
00116 
00117   public slots:
00122     void saveAll();
00123 
00124   signals:
00125     void documentCreated (Kate::Document *doc);
00126     void documentDeleted (uint documentNumber);
00127     void documentChanged ();
00128     void initialDocumentReplaced ();
00129 
00130   private slots:
00131     void slotModifiedOnDisc (Kate::Document *doc, bool b, unsigned char reason);
00132     void slotModChanged(Kate::Document *doc);
00133 
00134   private:
00135     bool loadMetaInfos(Kate::Document *doc, const KURL &url);
00136     void saveMetaInfos(Kate::Document *doc);
00137     bool computeUrlMD5(const KURL &url, QCString &result);
00138 
00139     Kate::DocumentManager *m_documentManager;
00140     QPtrList<Kate::Document> m_docList;
00141     QIntDict<Kate::Document> m_docDict;
00142     QPtrDict<KateDocumentInfo> m_docInfos;
00143     QMap<uint,TPair> m_tempFiles;
00144     QGuardedPtr<Kate::Document> m_currentDoc;
00145     KConfig *m_metaInfos;
00146     bool m_saveMetaInfos;
00147     int m_daysMetaInfos;
00148 
00149     DCOPObject *m_dcop;
00150 
00151     KParts::Factory *m_factory;
00152 
00153 };
00154 
00155 #endif
00156 // kate: space-indent on; indent-width 2; replace-tabs on;

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kate
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal