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

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 Facebook 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 "fbplugin.h"
0016 
0017 // Qt includes
0018 
0019 #include <QPointer>
0020 #include <QMessageBox>
0021 
0022 // KDE includes
0023 
0024 #include <klocalizedstring.h>
0025 
0026 // Local includes
0027 
0028 #include "fbwindow.h"
0029 
0030 namespace DigikamGenericFaceBookPlugin
0031 {
0032 
0033 FbPlugin::FbPlugin(QObject* const parent)
0034     : DPluginGeneric(parent)
0035 {
0036 }
0037 
0038 FbPlugin::~FbPlugin()
0039 {
0040 }
0041 
0042 void FbPlugin::cleanUp()
0043 {
0044     delete m_toolDlg;
0045 }
0046 
0047 QString FbPlugin::name() const
0048 {
0049     return i18n("Facebook");
0050 }
0051 
0052 QString FbPlugin::iid() const
0053 {
0054     return QLatin1String(DPLUGIN_IID);
0055 }
0056 
0057 QIcon FbPlugin::icon() const
0058 {
0059     return QIcon::fromTheme(QLatin1String("dk-facebook"));
0060 }
0061 
0062 QString FbPlugin::description() const
0063 {
0064     return i18n("A tool to export to Facebook web-service");
0065 }
0066 
0067 QString FbPlugin::details() const
0068 {
0069     return i18n("<p>This tool allows users to export items to Facebook web-service.</p>"
0070                 "<p>See Facebook web site for details: <a href='https://www.facebook.com/'>https://www.facebook.com/</a></p>");
0071 }
0072 
0073 QString FbPlugin::handbookSection() const
0074 {
0075     return QLatin1String("export_tools");
0076 }
0077 
0078 QString FbPlugin::handbookChapter() const
0079 {
0080     return QLatin1String("face_book");
0081 }
0082 
0083 QList<DPluginAuthor> FbPlugin::authors() const
0084 {
0085     return QList<DPluginAuthor>()
0086             << DPluginAuthor(QString::fromUtf8("Luka Renko"),
0087                              QString::fromUtf8("lure at kubuntu dot org"),
0088                              QString::fromUtf8("(C) 2009"))
0089             << DPluginAuthor(QString::fromUtf8("Vardhman Jain"),
0090                              QString::fromUtf8("vardhman at gmail dot com"),
0091                              QString::fromUtf8("(C) 2005-2008"))
0092             << DPluginAuthor(QString::fromUtf8("Maik Qualmann"),
0093                              QString::fromUtf8("metzpinguin at gmail dot com"),
0094                              QString::fromUtf8("(C) 2017-2021"))
0095             << DPluginAuthor(QString::fromUtf8("Gilles Caulier"),
0096                              QString::fromUtf8("caulier dot gilles at gmail dot com"),
0097                              QString::fromUtf8("(C) 2012-2021"))
0098             ;
0099 }
0100 
0101 void FbPlugin::setup(QObject* const parent)
0102 {
0103     DPluginAction* const ac = new DPluginAction(parent);
0104     ac->setIcon(icon());
0105     ac->setText(i18nc("@action", "Export to &Facebook..."));
0106     ac->setObjectName(QLatin1String("export_facebook"));
0107     ac->setActionCategory(DPluginAction::GenericExport);
0108     ac->setShortcut(Qt::CTRL | Qt::ALT | Qt::SHIFT | Qt::Key_F);
0109 
0110     connect(ac, SIGNAL(triggered(bool)),
0111             this, SLOT(slotFaceBook()));
0112 
0113     addAction(ac);
0114 }
0115 
0116 void FbPlugin::slotFaceBook()
0117 {
0118     if (!reactivateToolDialog(m_toolDlg))
0119     {
0120         QPointer<QMessageBox> msgBox = new QMessageBox(QMessageBox::Information, i18nc("@title:window", "Facebook"),
0121                  i18n("<p>Currently, as an open source project, we are unable to meet "
0122                       "the Facebook requirements for reactivating this plugin.</p>"
0123                       "<p>For more information look here: "
0124                       "<a href='https://bugs.kde.org/show_bug.cgi?id=182838'>"
0125                       "KDE Bugtracking System</a></p>"));
0126 
0127         msgBox->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
0128         msgBox->exec();
0129         delete msgBox;
0130 
0131         delete m_toolDlg;
0132         m_toolDlg = new FbWindow(infoIface(sender()), nullptr);
0133         m_toolDlg->setPlugin(this);
0134         m_toolDlg->show();
0135     }
0136 }
0137 
0138 } // namespace DigikamGenericFaceBookPlugin
0139 
0140 #include "moc_fbplugin.cpp"