summaryrefslogtreecommitdiffstats
path: root/khotkeys/kcontrol/actions_listview_widget.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /khotkeys/kcontrol/actions_listview_widget.h
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'khotkeys/kcontrol/actions_listview_widget.h')
-rw-r--r--khotkeys/kcontrol/actions_listview_widget.h151
1 files changed, 151 insertions, 0 deletions
diff --git a/khotkeys/kcontrol/actions_listview_widget.h b/khotkeys/kcontrol/actions_listview_widget.h
new file mode 100644
index 000000000..4b0d937a3
--- /dev/null
+++ b/khotkeys/kcontrol/actions_listview_widget.h
@@ -0,0 +1,151 @@
+/****************************************************************************
+
+ KHotKeys
+
+ Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
+
+ Distributed under the terms of the GNU General Public License version 2.
+
+****************************************************************************/
+
+#ifndef _ACTIONS_LISTVIEW_WIDGET_H_
+#define _ACTIONS_LISTVIEW_WIDGET_H_
+
+#include <khlistview.h>
+
+#include <action_data.h>
+
+#include <actions_listview_widget_ui.h>
+
+class QDragObject;
+
+namespace KHotKeys
+{
+
+class Action_listview_item;
+class Action_data_base;
+
+class Actions_listview_widget
+ : public Actions_listview_widget_ui
+ {
+ Q_OBJECT
+ public:
+ Actions_listview_widget( QWidget* parent_P = NULL, const char* name_P = NULL );
+ Action_listview_item* current_action() const;
+ void set_current_action( Action_listview_item* item );
+ Action_data_base* current_action_data() const;
+ void set_action_data( Action_data_base* data_P, bool recent_action_P = false );
+ void action_name_changed( const QString& name_P );
+ void clear();
+ void build_up();
+ void new_action( Action_data_base* data_P );
+ void delete_action();
+ private:
+ Action_listview_item* create_item( QListViewItem* parent_P, QListViewItem* after_P, Action_data_base* data_P );
+ void build_up_recursively( Action_data_group* parent_P,
+ Action_listview_item* item_parent_P );
+ Action_listview_item* recent_item;
+ Action_listview_item* saved_current_item;
+ private slots:
+ void item_moved( QListViewItem* item_P, QListViewItem* was_after_P, QListViewItem* after_P );
+ void current_changed( QListViewItem* item_P );
+ signals:
+ void current_action_changed();
+ };
+
+class Actions_listview
+ : public KHListView
+ {
+ Q_OBJECT
+ public:
+ Actions_listview( QWidget* parent_P = NULL, const char* name_P = NULL );
+ Actions_listview_widget* widget();
+ private:
+ Actions_listview_widget* _widget;
+ };
+
+// CHECKME a jak to bude s parent itemu, kdyz Action_data uz maji vlastni parent ?
+class Action_listview_item
+ : public QListViewItem
+ {
+ public:
+ virtual QString text( int column_P ) const;
+ Action_data_base* data() const;
+ void set_data( Action_data_base* data_P );
+ Action_listview_item( QListView* parent_P, QListViewItem* after_P,
+ Action_data_base* data_P );
+ Action_listview_item( QListViewItem* parent_P, QListViewItem* after_P,
+ Action_data_base* data_P );
+ protected:
+ Action_data_base* _data; // CHECKME doesn't own !!!
+ };
+
+//***************************************************************************
+// Inline
+//***************************************************************************
+
+// Actions_listview_widget
+
+inline
+Action_listview_item* Actions_listview_widget::current_action() const
+ {
+ return saved_current_item;
+ }
+
+inline
+Action_data_base* Actions_listview_widget::current_action_data() const
+ {
+ return current_action() != NULL ? current_action()->data() : NULL;
+ }
+
+inline
+void Actions_listview_widget::clear()
+ {
+ actions_listview->clear();
+ recent_item = 0;
+ saved_current_item = 0;
+ }
+
+// Actions_listview
+
+inline
+Actions_listview_widget* Actions_listview::widget()
+ {
+ return _widget;
+ }
+
+// Action_listview_item
+
+inline
+Action_listview_item::Action_listview_item( QListView* parent_P, QListViewItem* after_P,
+ Action_data_base* data_P )
+ : QListViewItem( parent_P, after_P ), _data( data_P )
+ {
+ if( dynamic_cast< Action_data_group* >( data_P ))
+ setExpandable( true );
+ }
+
+inline
+Action_listview_item::Action_listview_item( QListViewItem* parent_P, QListViewItem* after_P,
+ Action_data_base* data_P )
+ : QListViewItem( parent_P, after_P ), _data( data_P )
+ {
+ if( dynamic_cast< Action_data_group* >( data_P ))
+ setExpandable( true );
+ }
+
+inline
+Action_data_base* Action_listview_item::data() const
+ {
+ return _data;
+ }
+
+inline
+void Action_listview_item::set_data( Action_data_base* data_P )
+ {
+ _data = data_P;
+ }
+
+} // namespace KHotKeys
+
+#endif