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

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 Flickr 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 "flickrplugin.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 "flickrwindow.h"
0028 
0029 namespace DigikamGenericFlickrPlugin
0030 {
0031 
0032 FlickrPlugin::FlickrPlugin(QObject* const parent)
0033     : DPluginGeneric(parent)
0034 {
0035 }
0036 
0037 FlickrPlugin::~FlickrPlugin()
0038 {
0039 }
0040 
0041 void FlickrPlugin::cleanUp()
0042 {
0043     delete m_toolDlg;
0044 }
0045 
0046 QString FlickrPlugin::name() const
0047 {
0048     return i18nc("@title", "Flickr");
0049 }
0050 
0051 QString FlickrPlugin::iid() const
0052 {
0053     return QLatin1String(DPLUGIN_IID);
0054 }
0055 
0056 QIcon FlickrPlugin::icon() const
0057 {
0058     return QIcon::fromTheme(QLatin1String("dk-flickr"));
0059 }
0060 
0061 QString FlickrPlugin::description() const
0062 {
0063     return i18nc("@info", "A tool to export to Flickr web-service");
0064 }
0065 
0066 QString FlickrPlugin::details() const
0067 {
0068     return i18nc("@info", "This tool allows users to export items to Flickr web-service.\n\n"
0069                  "See Flickr web site for details: %1",
0070                  QLatin1String("<a href='https://www.flickr.com/'>https://www.flickr.com/</a>"));
0071 }
0072 
0073 QString FlickrPlugin::handbookSection() const
0074 {
0075     return QLatin1String("export_tools");
0076 }
0077 
0078 QString FlickrPlugin::handbookChapter() const
0079 {
0080     return QLatin1String("flickr_export");
0081 }
0082 
0083 QList<DPluginAuthor> FlickrPlugin::authors() const
0084 {
0085     return QList<DPluginAuthor>()
0086             << DPluginAuthor(QString::fromUtf8("Vardhman Jain"),
0087                              QString::fromUtf8("vardhman at gmail dot com"),
0088                              QString::fromUtf8("(C) 2005-2008"))
0089             << DPluginAuthor(QString::fromUtf8("Luka Renko"),
0090                              QString::fromUtf8("lure at kubuntu dot org"),
0091                              QString::fromUtf8("(C) 2009"))
0092             << DPluginAuthor(QString::fromUtf8("Shourya Singh Gupta"),
0093                              QString::fromUtf8("shouryasgupta at gmail dot com"),
0094                              QString::fromUtf8("(C) 2015"))
0095             << DPluginAuthor(QString::fromUtf8("Maik Qualmann"),
0096                              QString::fromUtf8("metzpinguin at gmail dot com"),
0097                              QString::fromUtf8("(C) 2017-2021"))
0098             << DPluginAuthor(QString::fromUtf8("Gilles Caulier"),
0099                              QString::fromUtf8("caulier dot gilles at gmail dot com"),
0100                              QString::fromUtf8("(C) 2008-2021"))
0101             ;
0102 }
0103 
0104 void FlickrPlugin::setup(QObject* const parent)
0105 {
0106     DPluginAction* const ac = new DPluginAction(parent);
0107     ac->setIcon(icon());
0108     ac->setText(i18nc("@action", "Export to &Flickr..."));
0109     ac->setObjectName(QLatin1String("export_flickr"));
0110     ac->setActionCategory(DPluginAction::GenericExport);
0111     ac->setShortcut(Qt::CTRL | Qt::ALT | Qt::SHIFT | Qt::Key_R);
0112 
0113     connect(ac, SIGNAL(triggered(bool)),
0114             this, SLOT(slotFlickr()));
0115 
0116     addAction(ac);
0117 }
0118 
0119 void FlickrPlugin::slotFlickr()
0120 {
0121     if (!reactivateToolDialog(m_toolDlg))
0122     {
0123         delete m_toolDlg;
0124         m_toolDlg = new FlickrWindow(infoIface(sender()), nullptr);
0125         m_toolDlg->setPlugin(this);
0126         m_toolDlg->show();
0127     }
0128 }
0129 
0130 } // namespace DigikamGenericFlickrPlugin
0131 
0132 #include "moc_flickrplugin.cpp"