• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • workspace API Reference
  • KDE Home
  • Contact Us
 

liblancelot

  • sources
  • kde-4.14
  • workspace
  • kdeplasma-addons
  • libs
  • lancelot
  • models
ActionTreeModelProxy.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007, 2008, 2009, 2010 Ivan Cukic <ivan.cukic(at)kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser/Library General Public License version 2,
6  * or (at your option) any later version, as published by the Free
7  * Software Foundation
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser/Library General Public License for more details
13  *
14  * You should have received a copy of the GNU Lesser/Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #include "ActionTreeModelProxy.h"
21 
22 namespace Lancelot
23 {
24 
25 class ActionTreeModelProxy::Private {
26 public:
27  ActionListModel * model;
28  QString selfTitle;
29  QIcon selfIcon;
30 };
31 
32 ActionTreeModelProxy::ActionTreeModelProxy(ActionListModel * model, QString title, QIcon icon)
33  : d(new Private())
34 {
35  d->model = model;
36  d->selfTitle = title;
37  d->selfIcon = icon;
38 
39  connect(model, SIGNAL(itemActivated(int)),
40  this, SIGNAL(itemActivated(int)));
41  connect(model, SIGNAL(itemInserted(int)),
42  this, SIGNAL(itemInserted(int)));
43  connect(model, SIGNAL(itemAltered(int)),
44  this, SIGNAL(itemAltered(int)));
45  connect(model, SIGNAL(itemDeleted(int)),
46  this, SIGNAL(itemDeleted(int)));
47  connect(model, SIGNAL(updated()),
48  this, SIGNAL(updated()));
49 }
50 
51 ActionTreeModelProxy::~ActionTreeModelProxy()
52 {
53  delete d;
54 }
55 
56 ActionListModel * ActionTreeModelProxy::model() const
57 {
58  return d->model;
59 }
60 
61 // ActionTreeModel
62 ActionTreeModel * ActionTreeModelProxy::child(int index)
63 {
64  Q_UNUSED(index);
65  return NULL;
66 }
67 
68 QString ActionTreeModelProxy::selfTitle() const
69 {
70  return d->selfTitle;
71 }
72 
73 QIcon ActionTreeModelProxy::selfIcon() const
74 {
75  return d->selfIcon;
76 }
77 
78 // ActionListModel
79 QString ActionTreeModelProxy::title(int index) const
80 {
81  return d->model->title(index);
82 }
83 
84 bool ActionTreeModelProxy::hasContextActions(int index) const
85 {
86  return d->model->hasContextActions(index);
87 }
88 
89 void ActionTreeModelProxy::setContextActions(int index, Lancelot::PopupMenu * menu)
90 {
91  d->model->setContextActions(index, menu);
92 }
93 
94 void ActionTreeModelProxy::contextActivate(int index, QAction * context)
95 {
96  d->model->contextActivate(index, context);
97 }
98 
99 QString ActionTreeModelProxy::description(int index) const
100 {
101  return d->model->description(index);
102 }
103 
104 QIcon ActionTreeModelProxy::icon(int index) const
105 {
106  return d->model->icon(index);
107 }
108 
109 bool ActionTreeModelProxy::isCategory(int index) const
110 {
111  return d->model->isCategory(index);
112 }
113 
114 int ActionTreeModelProxy::size() const
115 {
116  return d->model->size();
117 }
118 
119 void ActionTreeModelProxy::activate(int index)
120 {
121  d->model->activated(index);
122 }
123 
124 QMimeData * ActionTreeModelProxy::mimeData(int index) const
125 {
126  return d->model->mimeData(index);
127 }
128 
129 void ActionTreeModelProxy::setDropActions(int index,
130  Qt::DropActions & actions, Qt::DropAction & defaultAction)
131 {
132  d->model->setDropActions(index, actions, defaultAction);
133 }
134 
135 bool ActionTreeModelProxy::dataDropAvailable(int where, const QMimeData * mimeData)
136 {
137  return d->model->dataDropAvailable(where, mimeData);
138 }
139 
140 void ActionTreeModelProxy::dataDropped(int where, const QMimeData * mimeData)
141 {
142  d->model->dataDropped(where, mimeData);
143 }
144 
145 void ActionTreeModelProxy::dataDragFinished(int index, Qt::DropAction action)
146 {
147  d->model->dataDragFinished(index, action);
148 }
149 
150 } // namespace Lancelot
151 
Lancelot::ActionTreeModelProxy::itemInserted
void itemInserted(int index)
Lancelot::ActionTreeModelProxy::description
L_Override QString description(int index) const
Definition: ActionTreeModelProxy.cpp:99
Lancelot::ActionListModel::ActionListModel
ActionListModel()
Creates a new instance of ActionListModel.
Definition: ActionListModel.cpp:26
Lancelot::ActionTreeModelProxy::itemDeleted
void itemDeleted(int index)
Lancelot::ActionListModel
This class represents a list data model.
Definition: ActionListModel.h:37
Lancelot::ActionTreeModelProxy::~ActionTreeModelProxy
~ActionTreeModelProxy()
Definition: ActionTreeModelProxy.cpp:51
Lancelot::ActionTreeModelProxy::title
L_Override QString title(int index) const
Definition: ActionTreeModelProxy.cpp:79
Lancelot::ActionTreeModelProxy::setContextActions
L_Override void setContextActions(int index, Lancelot::PopupMenu *menu)
Adds actions ofr the specifies item to menu.
Definition: ActionTreeModelProxy.cpp:89
Lancelot::ActionTreeModelProxy::itemActivated
void itemActivated(int index)
Lancelot::ActionTreeModelProxy::dataDropped
L_Override void dataDropped(int where, const QMimeData *mimeData)
Invoked when the data is dropped into the model.
Definition: ActionTreeModelProxy.cpp:140
Lancelot::ActionTreeModelProxy::model
ActionListModel * model() const
Definition: ActionTreeModelProxy.cpp:56
QMimeData
Lancelot::ActionTreeModelProxy::itemAltered
void itemAltered(int index)
Lancelot::ActionTreeModelProxy::dataDragFinished
L_Override void dataDragFinished(int index, Qt::DropAction action)
This function is invoked when a data is dropped.
Definition: ActionTreeModelProxy.cpp:145
Lancelot::ActionTreeModelProxy::mimeData
L_Override QMimeData * mimeData(int index) const
Definition: ActionTreeModelProxy.cpp:124
Lancelot::ActionTreeModelProxy::hasContextActions
L_Override bool hasContextActions(int index) const
Definition: ActionTreeModelProxy.cpp:84
ActionTreeModelProxy.h
Lancelot::ActionTreeModelProxy::child
L_Override ActionTreeModel * child(int index)
Definition: ActionTreeModelProxy.cpp:62
Lancelot::ActionTreeModelProxy::selfTitle
L_Override QString selfTitle() const
Definition: ActionTreeModelProxy.cpp:68
QString
Lancelot::ActionTreeModelProxy::dataDropAvailable
L_Override bool dataDropAvailable(int where, const QMimeData *mimeData)
Definition: ActionTreeModelProxy.cpp:135
Lancelot::ActionTreeModel
Definition: ActionTreeModel.h:30
Lancelot::PopupMenu
The popup menu class.
Definition: PopupMenu.h:37
Lancelot::ActionTreeModelProxy::setDropActions
L_Override void setDropActions(int index, Qt::DropActions &actions, Qt::DropAction &defaultAction)
Definition: ActionTreeModelProxy.cpp:129
Lancelot::ActionTreeModelProxy::contextActivate
L_Override void contextActivate(int index, QAction *context)
Method for handling context menu actions.
Definition: ActionTreeModelProxy.cpp:94
Qt::DropActions
typedef DropActions
Lancelot::ActionTreeModelProxy::size
L_Override int size() const
Definition: ActionTreeModelProxy.cpp:114
QAction
Lancelot::ActionTreeModelProxy::isCategory
L_Override bool isCategory(int index) const
Definition: ActionTreeModelProxy.cpp:109
Lancelot::ActionTreeModelProxy::activate
L_Override void activate(int index)
Models should reimplement this function.
Definition: ActionTreeModelProxy.cpp:119
Lancelot::ActionTreeModelProxy::icon
L_Override QIcon icon(int index) const
Definition: ActionTreeModelProxy.cpp:104
Lancelot::ActionTreeModelProxy::updated
void updated()
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Lancelot::ActionTreeModelProxy::ActionTreeModelProxy
ActionTreeModelProxy(ActionListModel *model, QString title=QString(), QIcon icon=QIcon())
Definition: ActionTreeModelProxy.cpp:32
Lancelot::ActionTreeModelProxy::selfIcon
L_Override QIcon selfIcon() const
Definition: ActionTreeModelProxy.cpp:73
QIcon
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:43:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

liblancelot

Skip menu "liblancelot"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

workspace API Reference

Skip menu "workspace API Reference"
  • kdeplasma-addons
  •       GroupingDesktop
  •     liblancelot

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal