File indexing completed on 2025-03-09 03:57:05

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-08-08
0007  * Description : a token class
0008  *
0009  * SPDX-FileCopyrightText: 2009-2012 by Andi Clemens <andi dot clemens at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "token.h"
0016 
0017 // Qt includes
0018 
0019 #include <QAction>
0020 
0021 namespace Digikam
0022 {
0023 
0024 Token::Token(const QString& id, const QString& description)
0025     : QObject(nullptr),
0026       m_id(id),
0027       m_description(description)
0028 {
0029     m_action = new QAction(this);
0030     m_action->setText(id);
0031     m_action->setToolTip(description);
0032 
0033     connect(m_action, SIGNAL(triggered()), this, SLOT(slotTriggered()));
0034 }
0035 
0036 Token::~Token()
0037 {
0038     delete m_action;
0039 }
0040 
0041 void Token::slotTriggered()
0042 {
0043     Q_EMIT signalTokenTriggered(m_id);
0044 }
0045 
0046 } // namespace Digikam
0047 
0048 #include "moc_token.cpp"