2 // C++ Interface: %{MODULE}
7 // Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR}
9 // Copyright: See COPYING file that comes with this distribution
12 #ifndef CONTEXTMENUHANDLER_H
13 #define CONTEXTMENUHANDLER_H
16 #include <QtCore/QObject>
20 #include <kactioncollection.h>
24 //forward declarations
25 class ContextMenuHandler
;
26 class ListViewInterface
;
31 class ContextActionHandler
: public QXmlDefaultHandler
34 ContextActionHandler(ContextMenuHandler
*menuhandler
= 0);
35 ~ContextActionHandler();
37 // Reimplementations from base class
38 bool startElement( const QString
&namespaceURI
,
39 const QString
&localName
,
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
);
54 ContextMenuHandler
*m_menuhandler
;
67 class ContextMenuHandler
: public QObject
71 ContextMenuHandler(QObject
*parent
= 0, const char *name
= 0);
73 ~ContextMenuHandler();
76 * \param item The selected TreeView item.
77 * \returns A pointer to the popup-menu.
79 KMenu
* getPopupMenu(ListViewInterface
*item
);
82 * \returns A pointer to the Submenu as a child of the parent
85 KMenu
* SubMenuFactory(KMenu
*parent
);
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
95 * \returns A Pointer to the action.
97 KAction
* ActionFactory( const QString
&actionName
, const QString
&qty
);
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
);
112 bool parseXmlFile(const QString
&xmlID
);
114 public: // Attributes
118 KActionCollection
* m_ac
;
122 // Actions to create new items
123 KAction
* newBookInfo
;
125 KAction
* newKeywordSet
;
127 KAction
* newAbstract
;
128 KAction
* newAuthorGroup
;
131 KAction
* newReleaseInfo
;
133 KAction
* newParagraph
;
134 KAction
* newSection_1
;
135 KAction
* newSection_2
;
136 KAction
* newSection_3
;
137 KAction
* newSection_4
;
138 KAction
* newSection_5
;
141 QString m_XmlFilePath
;
142 ListViewInterface
* m_item
;
143 QObject
* m_DocTreeView
;