File indexing completed on 2025-01-19 03:52:56

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2019-03-27
0007  * Description : a plugin to export items to a local storage.
0008  *
0009  * SPDX-FileCopyrightText: 2018-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2019-2020 by Maik Qualmann <metzpinguin at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "fcplugin.h"
0017 
0018 // Qt includes
0019 
0020 #include <QPointer>
0021 
0022 // KDE includes
0023 
0024 #include <klocalizedstring.h>
0025 
0026 // Local includes
0027 
0028 #include "fcexportwindow.h"
0029 
0030 namespace DigikamGenericFileCopyPlugin
0031 {
0032 
0033 FCPlugin::FCPlugin(QObject* const parent)
0034     : DPluginGeneric(parent)
0035 {
0036 }
0037 
0038 FCPlugin::~FCPlugin()
0039 {
0040 }
0041 
0042 void FCPlugin::cleanUp()
0043 {
0044     delete m_toolDlgExport;
0045 }
0046 
0047 QString FCPlugin::name() const
0048 {
0049     return i18nc("@title", "File Copy");
0050 }
0051 
0052 QString FCPlugin::iid() const
0053 {
0054     return QLatin1String(DPLUGIN_IID);
0055 }
0056 
0057 QIcon FCPlugin::icon() const
0058 {
0059     return QIcon::fromTheme(QLatin1String("drive-removable-media"));
0060 }
0061 
0062 QString FCPlugin::description() const
0063 {
0064     return i18nc("@info", "A tool to export items to a local storage");
0065 }
0066 
0067 QString FCPlugin::details() const
0068 {
0069     return i18nc("@info", "This tool allows users to export items to a local storage.");
0070 }
0071 
0072 QString FCPlugin::handbookSection() const
0073 {
0074     return QLatin1String("export_tools");
0075 }
0076 
0077 QString FCPlugin::handbookChapter() const
0078 {
0079     return QLatin1String("file_copy");
0080 }
0081 
0082 QList<DPluginAuthor> FCPlugin::authors() const
0083 {
0084     return QList<DPluginAuthor>()
0085             << DPluginAuthor(QString::fromUtf8("Johannes Wienke"),
0086                              QString::fromUtf8("languitar at semipol dot de"),
0087                              QString::fromUtf8("(C) 2009"))
0088             << DPluginAuthor(QString::fromUtf8("Maik Qualmann"),
0089                              QString::fromUtf8("metzpinguin at gmail dot com"),
0090                              QString::fromUtf8("(C) 2017-2021"))
0091             << DPluginAuthor(QString::fromUtf8("Marcel Mathis"),
0092                              QString::fromUtf8("maeseee at gmail dot com"),
0093                              QString::fromUtf8("(C) 2020"))
0094             << DPluginAuthor(QString::fromUtf8("Gilles Caulier"),
0095                              QString::fromUtf8("caulier dot gilles at gmail dot com"),
0096                              QString::fromUtf8("(C) 2010-2021"))
0097             ;
0098 }
0099 
0100 void FCPlugin::setup(QObject* const parent)
0101 {
0102     DPluginAction* const ac = new DPluginAction(parent);
0103     ac->setIcon(icon());
0104     ac->setText(i18nc("@action", "Export to local storage..."));
0105     ac->setObjectName(QLatin1String("export_filecopy"));
0106     ac->setActionCategory(DPluginAction::GenericExport);
0107     ac->setShortcut(Qt::CTRL | Qt::ALT | Qt::SHIFT | Qt::Key_L);
0108 
0109     connect(ac, SIGNAL(triggered(bool)),
0110             this, SLOT(slotFileCopyExport()));
0111 
0112     addAction(ac);
0113 }
0114 
0115 void FCPlugin::slotFileCopyExport()
0116 {
0117     if (!reactivateToolDialog(m_toolDlgExport))
0118     {
0119         delete m_toolDlgExport;
0120         m_toolDlgExport = new FCExportWindow(infoIface(sender()), nullptr);
0121         m_toolDlgExport->setPlugin(this);
0122         m_toolDlgExport->show();
0123     }
0124 }
0125 
0126 } // namespace DigikamGenericFileCopyPlugin
0127 
0128 #include "moc_fcplugin.cpp"