summaryrefslogtreecommitdiffstats
path: root/quanta/parts/kafka/htmldocumentproperties.h
blob: 62a64659a875c185674970c3d8e6b95a8d90b1ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/***************************************************************************
                     htmldocumentproperties.h
                             -------------------

    copyright            : (C) 2003, 2004 - Nicolas Deschildre
    email                : ndeschildre@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 HTMLDOCUMENTPROPERTIES_H
#define HTMLDOCUMENTPROPERTIES_H

class Node;
class NodeModifsSet;
class AttributeItem;
class EditableTree;

#include <qptrlist.h>

#include "tagattributeitems.h"
#include "htmldocumentpropertiesui.h"

class NodeLinkedViewItem : public AttributeItem
{
public:
	NodeLinkedViewItem(EditableTree *listView, const QString& title, const QString& title2);
	virtual ~NodeLinkedViewItem();

	Node *node;
	bool dirty, deleted;
};

/**
 * The HTML Document properties dialog.
 * TODO: Use KDialogBase so it looks more consistent with the rest of the dialogs
 */
class htmlDocumentProperties : public htmlDocumentPropertiesui
{
	Q_OBJECT
public:
        /**
         * @param forceInsertionOfBasicNodes Force the insertion of the basic Nodes (HTML, BODY, HEAD, ...) if pressing OK
         * without having made any changes.
         */
	htmlDocumentProperties( QWidget* parent = 0, bool forceInsertionOfBasicNodes = false, 
          const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
	~htmlDocumentProperties();
	
protected slots:	
	virtual void aboutToClose() {}

private slots:
	virtual void accept();
        virtual void reject();
	virtual void newMetaItem();
	virtual void deleteCurrentMetaItem();
	virtual void newCSSRule();
	virtual void editCSSRule();
	virtual void deleteCurrentCSSRule();

	virtual void titleChanged(const QString &);
	virtual void metaChanged(QListViewItem * );
	virtual void CSSChanged(QListViewItem * );
	virtual void linkChanged( const QString& );

private:
	/**
	 * If we want to add a new Node, we must first create the basics (if necessary) i.e. html, body
	 * head nodes, and moving if necessary all the existing Nodes.
	 * @param modifs The changes are logged for the undo/redo system.
	 */
	void addBasicNodes(NodeModifsSet *modifs);
	//must be called after addBasicnodes
	void addBasicCssNodes(NodeModifsSet *modifs);
	void loadMetaNode(Node *node);
	void loadCSS(Node *node);

	QPtrList<NodeLinkedViewItem> CSSList, metaList;
	Node *titleNode, *htmlNode, *headNode, *linkNode, *bodyNode, *doctypeNode, *CSSNode, *xmlNode;
	bool titleDirty, linkDirty, m_forceInsertionOfBasicNodes;
};

#endif