Remove this line
[kdeaccessibility.git] / ksayit / src / contextmenuhandler.h
blob073cd029dc5a2cf4b3945ccb559953c4b9bcaa1d
1 //
2 // C++ Interface: %{MODULE}
3 //
4 // Description:
5 //
6 //
7 // Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR}
8 //
9 // Copyright: See COPYING file that comes with this distribution
12 #ifndef CONTEXTMENUHANDLER_H
13 #define CONTEXTMENUHANDLER_H
15 // Qt includes
16 #include <QtCore/QObject>
17 #include <QtXml>
19 // KDE includes
20 #include <kactioncollection.h>
21 #include <kaction.h>
22 #include <kmenu.h>
24 //forward declarations
25 class ContextMenuHandler;
26 class ListViewInterface;
28 /**
29 @author Robert Vogl
31 class ContextActionHandler : public QXmlDefaultHandler
33 public:
34 ContextActionHandler(ContextMenuHandler *menuhandler = 0);
35 ~ContextActionHandler();
37 // Reimplementations from base class
38 bool startElement( const QString &namespaceURI,
39 const QString &localName,
40 const QString &qName,
41 const QXmlAttributes &atts );
43 // Reimplementations from base class
44 bool endElement( const QString &namespaceURI,
45 const QString &localName,
46 const QString &qName );
48 // Reimplementations from base class
49 bool characters( const QString &ch );
51 void setSearchID( const QString xmlID );
53 private:
54 ContextMenuHandler *m_menuhandler;
55 QString m_subName;
56 QString m_actionName;
57 QString m_qty;
58 KMenu *m_popup;
59 bool m_hit;
60 QString m_searchID;
64 /**
65 @author Robert Vogl
67 class ContextMenuHandler : public QObject
69 Q_OBJECT
70 public:
71 ContextMenuHandler(QObject *parent = 0, const char *name = 0);
73 ~ContextMenuHandler();
75 /**
76 * \param item The selected TreeView item.
77 * \returns A pointer to the popup-menu.
79 KMenu* getPopupMenu(ListViewInterface *item);
81 /**
82 * \returns A pointer to the Submenu as a child of the parent
83 * \p parent.
85 KMenu* SubMenuFactory(KMenu *parent);
87 /**
88 * Creates an action sufficiant to the given name.
89 * It checks if the action is allowed or not and returns
90 * a disabled or enabled action.
91 * \param actionName The name of the action as defined in the
92 * namespace \p ContextMenu.xml.
93 * \param qty The maximum allowed quantity of the same action for the
94 * given element.
95 * \returns A Pointer to the action.
97 KAction* ActionFactory( const QString &actionName, const QString &qty );
99 /**
100 * Creates a Popup context menu for the given item and stores a
101 * pointer to it in \p m_MenuList.
103 void registerPopupMenu(ListViewInterface *item);
106 * Sets wether the content of the item is editable or not.
108 void setItemEditable( bool editable );
110 private: // Methods
111 void initActions();
112 bool parseXmlFile(const QString &xmlID);
114 public: // Attributes
115 KMenu* m_popupmenu;
117 private:
118 KActionCollection* m_ac;
119 // Basic actions
120 KAction* renameItem;
121 KAction* deleteItem;
122 // Actions to create new items
123 KAction* newBookInfo;
124 KAction* newChapter;
125 KAction* newKeywordSet;
126 KAction* newKeyword;
127 KAction* newAbstract;
128 KAction* newAuthorGroup;
129 KAction* newAuthor;
130 KAction* newDate;
131 KAction* newReleaseInfo;
132 KAction* newTitle;
133 KAction* newParagraph;
134 KAction* newSection_1;
135 KAction* newSection_2;
136 KAction* newSection_3;
137 KAction* newSection_4;
138 KAction* newSection_5;
140 // mixed stuff
141 QString m_XmlFilePath;
142 ListViewInterface* m_item;
143 QObject* m_DocTreeView;
147 #endif