2
* Copyright 2010 Marco Martin <notmart@gmail.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Library General Public License as
6
* published by the Free Software Foundation; either version 2, or
7
* (at your option) any later version.
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 General Public License for more details
14
* You should have received a copy of the GNU 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.
22
#include "iconactioncollection.h"
25
IconActionCollection::IconActionCollection(Plasma::Applet *applet, QObject *parent)
27
m_immutability(Plasma::Mutable)
30
connect (applet, SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SLOT(immutabilityChanged(Plasma::ImmutabilityType)));
31
m_immutability = Plasma::Mutable;
35
IconActionCollection::~IconActionCollection()
39
void IconActionCollection::addAction(QAction *action)
42
m_actions.insert(action);
43
connect (action, SIGNAL(destroyed(QObject *)), this, SLOT(actionDestroyed(QObject *)));
44
action->setVisible(m_immutability == Plasma::Mutable);
45
action->setEnabled(m_immutability == Plasma::Mutable);
49
void IconActionCollection::removeAction(QAction *action)
51
m_actions.remove(action);
56
QList<QAction *> IconActionCollection::actions() const
58
return m_actions.toList();
63
void IconActionCollection::actionDestroyed(QObject *object)
65
m_actions.remove(static_cast<QAction *>(object));
68
void IconActionCollection::immutabilityChanged(Plasma::ImmutabilityType immutability)
70
m_immutability = immutability;
72
foreach (QAction *action, m_actions) {
73
action->setVisible(immutability == Plasma::Mutable);
74
action->setEnabled(immutability == Plasma::Mutable);
79
#include "iconactioncollection.moc"