From e1481e0a7c066357dfb67136f331b5f069d94f3c Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 17 Feb 2010 02:48:30 +0000 Subject: Added abandoned KDE3 version of knowit git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knowit@1091582 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/notes.h | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 src/notes.h (limited to 'src/notes.h') diff --git a/src/notes.h b/src/notes.h new file mode 100644 index 0000000..e91c7e1 --- /dev/null +++ b/src/notes.h @@ -0,0 +1,106 @@ +/*************************************************************************** + notes.h - description + ------------------- + begin : sob lis 16 2002 + copyright : (C) 2002-2004 by Micha³ Rudolf + email : mrudolf@kdewebdev.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef KNOWIT_NOTES_H +#define KNOWIT_NOTES_H + +#include +#include +#include +#include +#include +class QTextStream; +class QListViewItem; +class KURL; + +class TNote; + +class TNoteLink +{ +public: + enum {DescriptionLink, LinkDescription, LinkOnly, DescriptionOnly}; + QString link; + QString description; + TNoteLink() {} + TNoteLink(const QString& s) {link = s;} + TNoteLink(const QString& s1, const QString& s2) {link = s1; description = s2;} + int operator==(const TNoteLink& N) const {return link == N.link && + description == N.description;} + int operator!=(const TNoteLink& N) const {return link != N.link || + description != N.description;} + void save(QTextStream& ts) const; + void open() const; + void openWith() const; + QString text(int fmt = DescriptionLink) const; + QPixmap icon() const; + bool isLocalReference() const; +}; + + +class TNotesCollection : public QPtrDict { +public: + QPixmap Pixmaps[4]; + TNotesCollection(); + ~TNotesCollection(); + void addNote(QListViewItem* item); + void addNote(QListViewItem* item, const QString& s); + void removeNote(QListViewItem* item); + bool changeNote(QListViewItem* item, const QString& s); + void clearNotes(); + void updateNotesView(); + bool modified; + bool autoUpdate; + const QString& text(QListViewItem* item); +}; + + +class TNote { +private: + QValueList links; + TNotesCollection* collection; + bool saveHTMLBuf(QTextStream& ts, QValueVector& depths, + int flags = SaveAll); + bool saveHTMLTocEntry(QTextStream& ts, QValueVector& depths, int flags); +public: + typedef enum {Empty, Text, EmptyParent, TextParent} State; + enum {SaveCurrent = 0, SaveSubnotes = 0x0001, SaveAll = 0x0002, UseUTF8 = 0x0040, + Enumerate = 0x0080, AddRule = 0x0100, Style = 0x0200, TOC = 0x0400}; + QListViewItem* item; + QString text; + bool isEmpty(); + bool contains(const QString& sought, bool case_sensitive = false); + bool change(const QString& s); + void destroy(); + void updateView(); + State state(); + void open(QTextStream& ts); + void save(QTextStream& ts, bool current = false); + bool saveHTML(const KURL& fname, const QString& origname, const QString& style, + int flags = SaveAll); + void addLink(const QString& s); + void addLink(const TNoteLink& l); + int linkCount() const; + const TNoteLink& link(int i) const; + void removeLink(int i); + void modifyLink(int i, const QString& s); + void modifyLink(int i, TNoteLink& l); + void modifyLinkDescription(int i, const QString& s); + TNote(QListViewItem* i, TNotesCollection* coll); + TNote(QListViewItem* i, TNotesCollection* coll, const QString& s); + ~TNote(); +}; +#endif + -- cgit v1.2.1