File indexing completed on 2024-05-12 05:46:53

0001 /*
0002     This file is part of KNewStuff2.
0003     Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
0004 
0005     This library is free software; you can redistribute it and/or
0006     modify it under the terms of the GNU Lesser General Public
0007     License as published by the Free Software Foundation; either
0008     version 2.1 of the License, or (at your option) any later version.
0009 
0010     This library is distributed in the hope that it will be useful,
0011     but WITHOUT ANY WARRANTY; without even the implied warranty of
0012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013     Lesser General Public License for more details.
0014 
0015     You should have received a copy of the GNU Lesser General Public
0016     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0017 */
0018 
0019 #include "knewstuffaction.h"
0020 
0021 #include <QAction>
0022 #include <klocalizedstring.h>
0023 #include <kactioncollection.h>
0024 
0025 using namespace KNS3;
0026 
0027 QAction *KNS3::standardAction(const QString &what,
0028                               const QObject *receiver,
0029                               const char *slot, KActionCollection *parent,
0030                               const char *name)
0031 {
0032     QAction *action = new QAction(what, parent);
0033     parent->addAction(QLatin1String(name), action);
0034     action->setIcon(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")));
0035     QObject::connect(action, SIGNAL(triggered(bool)), receiver, slot);
0036 
0037     return action;
0038 }
0039 
0040 QAction *KNS3::standardActionUpload(const QString &what,
0041                                     const QObject *receiver,
0042                                     const char *slot, KActionCollection *parent,
0043                                     const char *name)
0044 {
0045     QAction *action = new QAction(what, parent);
0046     parent->addAction(QLatin1String(name), action);
0047     // FIXME: Get a specific upload icon!
0048     action->setIcon(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")));
0049     QObject::connect(action, SIGNAL(triggered(bool)), receiver, slot);
0050 
0051     return action;
0052 }