8#include "kpeople_debug.h"
9#include "personactionsmodel_p.h"
10#include "persondata.h"
15class PersonActionsPrivate
18 PersonActionsPrivate()
29using namespace KPeople;
31PersonActionsModel::PersonActionsModel(
QObject *parent)
33 , d_ptr(new PersonActionsPrivate)
37PersonActionsModel::~PersonActionsModel()
45 roles[IconNameRole] =
"iconName";
46 roles[ActionRole] =
"action";
47 roles[ActionTypeRole] =
"actionType";
51void PersonActionsModel::setPersonUri(
const QString &
id)
73 Q_EMIT personChanged();
76void PersonActionsModel::resetActions()
81 d->actions = KPeople::actionsForPerson(d->id,
this);
85QString PersonActionsModel::personUri()
const
87 Q_D(
const PersonActions);
93 Q_D(
const PersonActions);
101 return d->actions[index.
row()]->text();
103 return d->actions[index.
row()]->icon();
105 return d->actions[index.
row()]->toolTip();
107 return d->actions[index.
row()]->icon().name();
111 return d->actions[index.
row()]->property(
"actionType");
117int PersonActionsModel::rowCount(
const QModelIndex &parent)
const
119 Q_D(
const PersonActions);
121 return parent.
isValid() ? 0 : d->actions.size();
124void PersonActionsModel::triggerAction(
int row)
const
126 Q_D(
const PersonActions);
127 if (d->actions.count() >= row) {
128 qWarning() <<
"no action in row" << row <<
". Actions available:" << d->actions.count();
131 d->actions[row]->trigger();
136 Q_D(
const PersonActions);
140#include "moc_personactionsmodel_p.cpp"
Allows to query the information about a given person.
void dataChanged()
One of the contact sources has changed.
virtual QHash< int, QByteArray > roleNames() const const
bool isValid() const const
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
QVariant fromValue(T &&value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:03 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.