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

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 Box 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 "boxplugin.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 "boxwindow.h"
0028 
0029 namespace DigikamGenericBoxPlugin
0030 {
0031 
0032 BoxPlugin::BoxPlugin(QObject* const parent)
0033     : DPluginGeneric(parent)
0034 {
0035 }
0036 
0037 BoxPlugin::~BoxPlugin()
0038 {
0039 }
0040 
0041 void BoxPlugin::cleanUp()
0042 {
0043     delete m_toolDlg;
0044 }
0045 
0046 QString BoxPlugin::name() const
0047 {
0048     return i18nc("@title", "Box");
0049 }
0050 
0051 QString BoxPlugin::iid() const
0052 {
0053     return QLatin1String(DPLUGIN_IID);
0054 }
0055 
0056 QIcon BoxPlugin::icon() const
0057 {
0058     return QIcon::fromTheme(QLatin1String("dk-box"));
0059 }
0060 
0061 QString BoxPlugin::description() const
0062 {
0063     return i18nc("@info", "A tool to export to Box web-service");
0064 }
0065 
0066 QString BoxPlugin::details() const
0067 {
0068     return i18nc("@info", "This tool allows users to export items to Box web-service.\n\n"
0069                 "See Box web site for details: %1", QLatin1String("<a href='https://box.com/'>https://box.com/</a>"));
0070 }
0071 
0072 QString BoxPlugin::handbookSection() const
0073 {
0074     return QLatin1String("export_tools");
0075 }
0076 
0077 QString BoxPlugin::handbookChapter() const
0078 {
0079     return QLatin1String("box_export");
0080 }
0081 
0082 QList<DPluginAuthor> BoxPlugin::authors() const
0083 {
0084     return QList<DPluginAuthor>()
0085             << DPluginAuthor(QString::fromUtf8("Tarek Talaat"),
0086                              QString::fromUtf8("tarektalaat93 at gmail dot com"),
0087                              QString::fromUtf8("(C) 2018"))
0088             ;
0089 }
0090 
0091 void BoxPlugin::setup(QObject* const parent)
0092 {
0093     DPluginAction* const ac = new DPluginAction(parent);
0094     ac->setIcon(icon());
0095     ac->setText(i18nc("@action", "Export to &Box..."));
0096     ac->setObjectName(QLatin1String("export_box"));
0097     ac->setActionCategory(DPluginAction::GenericExport);
0098     ac->setShortcut(Qt::CTRL | Qt::ALT | Qt::SHIFT | Qt::Key_B);
0099 
0100     connect(ac, SIGNAL(triggered(bool)),
0101             this, SLOT(slotBox()));
0102 
0103     addAction(ac);
0104 }
0105 
0106 void BoxPlugin::slotBox()
0107 {
0108     if (!reactivateToolDialog(m_toolDlg))
0109     {
0110         delete m_toolDlg;
0111         m_toolDlg = new BOXWindow(infoIface(sender()), nullptr);
0112         m_toolDlg->setPlugin(this);
0113         m_toolDlg->show();
0114     }
0115 }
0116 
0117 } // namespace DigikamGenericBoxPlugin
0118 
0119 #include "moc_boxplugin.cpp"