File indexing completed on 2025-01-05 03:53:41

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2018-07-30
0007  * Description : a plugin to export to Rajce web-service.
0008  *
0009  * SPDX-FileCopyrightText: 2018-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "rajceplugin.h"
0016 
0017 // Qt includes
0018 
0019 #include <QPointer>
0020 
0021 // KDE includes
0022 
0023 #include <klocalizedstring.h>
0024 
0025 // Local includes
0026 
0027 #include "rajcewindow.h"
0028 
0029 namespace DigikamGenericRajcePlugin
0030 {
0031 
0032 RajcePlugin::RajcePlugin(QObject* const parent)
0033     : DPluginGeneric(parent)
0034 {
0035 }
0036 
0037 RajcePlugin::~RajcePlugin()
0038 {
0039 }
0040 
0041 void RajcePlugin::cleanUp()
0042 {
0043     delete m_toolDlg;
0044 }
0045 
0046 QString RajcePlugin::name() const
0047 {
0048     return i18nc("@title", "Rajce");
0049 }
0050 
0051 QString RajcePlugin::iid() const
0052 {
0053     return QLatin1String(DPLUGIN_IID);
0054 }
0055 
0056 QIcon RajcePlugin::icon() const
0057 {
0058     return QIcon::fromTheme(QLatin1String("dk-rajce"));
0059 }
0060 
0061 QString RajcePlugin::description() const
0062 {
0063     return i18nc("@info", "A tool to export to Rajce web-service");
0064 }
0065 
0066 QString RajcePlugin::details() const
0067 {
0068     return i18nc("@info", "This tool allows users to export items to Rajce web-service.\n\n"
0069                  "See Rajce web site for details: %1",
0070                  QLatin1String("<a href='https://www.rajce.idnes.cz/'>https://www.rajce.idnes.cz/</a>"));
0071 }
0072 
0073 QString RajcePlugin::handbookSection() const
0074 {
0075     return QLatin1String("export_tools");
0076 }
0077 
0078 QString RajcePlugin::handbookChapter() const
0079 {
0080     return QLatin1String("rajce_export");
0081 }
0082 
0083 QList<DPluginAuthor> RajcePlugin::authors() const
0084 {
0085     return QList<DPluginAuthor>()
0086             << DPluginAuthor(QString::fromUtf8("Lukas Krejci"),
0087                              QString::fromUtf8("metlosh at gmail dot com"),
0088                              QString::fromUtf8("(C) 2011-2013"))
0089             ;
0090 }
0091 
0092 void RajcePlugin::setup(QObject* const parent)
0093 {
0094     DPluginAction* const ac = new DPluginAction(parent);
0095     ac->setIcon(icon());
0096     ac->setText(i18nc("@action", "Export to &Rajce..."));
0097     ac->setObjectName(QLatin1String("export_rajce"));
0098     ac->setActionCategory(DPluginAction::GenericExport);
0099     ac->setShortcut(Qt::CTRL | Qt::ALT | Qt::SHIFT | Qt::Key_J);
0100 
0101     connect(ac, SIGNAL(triggered(bool)),
0102             this, SLOT(slotRajce()));
0103 
0104     addAction(ac);
0105 }
0106 
0107 void RajcePlugin::slotRajce()
0108 {
0109     if (!reactivateToolDialog(m_toolDlg))
0110     {
0111         delete m_toolDlg;
0112         m_toolDlg = new RajceWindow(infoIface(sender()), nullptr);
0113         m_toolDlg->setPlugin(this);
0114         m_toolDlg->show();
0115     }
0116 }
0117 
0118 } // namespace DigikamGenericRajcePlugin
0119 
0120 #include "moc_rajceplugin.cpp"