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

kjots

kjotsentry.h

Go to the documentation of this file.
00001 //
00002 //  kjots
00003 //
00004 //  Copyright (C) 1997 Christoph Neerfeld <Christoph.Neerfeld@home.ivm.de>
00005 //  Copyright (C) 2002, 2003 Aaron J. Seigo <aseigo@kde.org>
00006 //  Copyright (C) 2003 Stanislav Kljuhhin <crz@hot.ee>
00007 //  Copyright (C) 2005-2006 Jaison Lee <lee.jaison@gmail.com>
00008 //
00009 //  This program is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU General Public License as published by
00011 //  the Free Software Foundation; either version 2 of the License, or
00012 //  (at your option) any later version.
00013 //
00014 //  This program is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 //  GNU General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU General Public License
00020 //  along with this program; if not, write to the Free Software
00021 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00022 //
00023 
00024 #ifndef __KJOTSENTRY_H
00025 #define __KJOTSENTRY_H
00026 
00027 
00028 #include <QTreeWidgetItem>
00029 #include <QTextDocument>
00030 #include <QTextCursor>
00031 #include <QSet>
00032 
00033 //
00034 // class KJotsEntry
00035 //
00036 
00037 class KJotsPage;
00038 class QDomDocument;
00039 class QDomElement;
00040 class KJotsBook;
00041 
00042 class KJotsEntry : public QObject, public QTreeWidgetItem
00043 {
00044     Q_OBJECT
00045     public:
00046         KJotsEntry();
00047 
00048     public:
00049         virtual void setTitle(const QString&);
00050         QString title() { return text(0); }
00051         virtual void rename() = 0;
00052         virtual void generateXml( QDomDocument&, QDomElement& );
00053         virtual void parseXml( QDomElement&, bool );
00054         virtual void generateHtml( KJotsEntry*, bool, QTextCursor* ) = 0;
00055         virtual QString generateText( void ) = 0;
00056         virtual void generatePrintData ( QTextCursor * ) = 0;
00057 
00058         quint64 id() const { return m_id; }
00059 
00060         KJotsBook *parentBook();
00061         KJotsBook *topLevelBook();
00062 
00063         bool isBook() const { return m_isBook; }
00064         bool isPage() const { return !m_isBook; }
00065 
00066     protected:
00067         void setId(quint64);
00068         bool m_isBook; 
00069         
00070     private:
00071         quint64 m_id; 
00072         static QSet<quint64> all_ids;
00073 };
00074 
00075 //
00076 // class KjotsBook
00077 //
00078 
00079 class KJotsBook : public KJotsEntry
00080 {
00081 friend class KJotsEntry;
00082 
00083     Q_OBJECT
00084     public:
00085         KJotsBook ();
00086         ~KJotsBook();
00087 
00088         bool openBook(const QString&);
00089         void saveBook();
00090         void deleteBook();
00091         void rename();
00092         KJotsPage* addPage(void);
00093         void generateXml( QDomDocument&, QDomElement& );
00094         void parseXml( QDomElement&, bool );
00095         void generateHtml( KJotsEntry*, bool, QTextCursor* );
00096         QString generateText( void );
00097         void generatePrintData ( QTextCursor * );
00098 
00099         bool shouldBeOpened ( void ) const { return m_shouldBeOpened; }
00100 
00101         void setDirty(bool);
00102         bool dirty();
00103         QString fileName() const { return m_fileName; }
00104 
00105         QList<KJotsEntry*> contents ( void );
00106         QList<KJotsEntry*> children ( void );
00107 
00108         static KJotsBook *createNewBook( void );
00109 
00110     private:
00111         QString getToc();
00112 
00113         bool m_open, m_shouldBeOpened;
00114         QString m_fileName;
00115         bool m_dirty; 
00116 };
00117 
00118 //
00119 // class KJotsPage
00120 //
00121 class KJotsPage : public KJotsEntry
00122 {
00123     Q_OBJECT
00124     public:
00125         KJotsPage();
00126         ~KJotsPage();
00127 
00128     public:
00129         QTextDocument *body ( void ) { return &document; }
00130         void setCursor ( const QTextCursor &c ) { cursor = c; }
00131         QTextCursor& getCursor ( void ) { return cursor; }
00132         void rename();
00133 
00134         void generateXml( QDomDocument&, QDomElement& );
00135         void parseXml( QDomElement&, bool );
00136         void generateHtml( KJotsEntry*, bool, QTextCursor* );
00137         QString generateText( void );
00138         void generatePrintData ( QTextCursor * );
00139 
00140         static KJotsPage *createNewPage( int );
00141 
00142     protected slots:
00143         void documentModified(bool);
00144 
00145     private:
00146         QTextDocument document;
00147         QTextCursor cursor;
00148 };
00149 
00150 #endif // __KJOTSENTRY_H
00151 /* ex: set tabstop=4 softtabstop=4 shiftwidth=4 expandtab: */
00152 /* kate: tab-indents off; replace-tabs on; tab-width 4; remove-trailing-space on; encoding utf-8;*/

kjots

Skip menu "kjots"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdeutils

Skip menu "kdeutils"
  • ark
  • kcalc
  • kcharselect
  • kdelirc
  • kdessh
  • kdf
  • kfloppy
  • kgpg
  • kjots
  • klaptopdaemon
  • kmilo
  • ksim
  • ktimer
  • kwallet
  • superkaramba
Generated for kdeutils by doxygen 1.5.4
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