File indexing completed on 2025-01-05 03:53:37
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 MediaWiki 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 "mediawikiplugin.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 "mediawikiwindow.h" 0028 0029 namespace DigikamGenericMediaWikiPlugin 0030 { 0031 0032 MediaWikiPlugin::MediaWikiPlugin(QObject* const parent) 0033 : DPluginGeneric(parent) 0034 { 0035 } 0036 0037 MediaWikiPlugin::~MediaWikiPlugin() 0038 { 0039 } 0040 0041 void MediaWikiPlugin::cleanUp() 0042 { 0043 delete m_toolDlg; 0044 } 0045 0046 QString MediaWikiPlugin::name() const 0047 { 0048 return i18nc("@title", "MediaWiki"); 0049 } 0050 0051 QString MediaWikiPlugin::iid() const 0052 { 0053 return QLatin1String(DPLUGIN_IID); 0054 } 0055 0056 QIcon MediaWikiPlugin::icon() const 0057 { 0058 return QIcon::fromTheme(QLatin1String("dk-mediawiki")); 0059 } 0060 0061 QString MediaWikiPlugin::description() const 0062 { 0063 return i18nc("@info", "A tool to export to MediaWiki web-service"); 0064 } 0065 0066 QString MediaWikiPlugin::details() const 0067 { 0068 return i18nc("@info", "This tool allows users to export items to MediaWiki web-service.\n\n" 0069 "See MediaWiki web site for details: %1", 0070 QLatin1String("<a href='https://www.mediawiki.org/'>https://www.mediawiki.org/</a>")); 0071 } 0072 0073 QString MediaWikiPlugin::handbookSection() const 0074 { 0075 return QLatin1String("export_tools"); 0076 } 0077 0078 QString MediaWikiPlugin::handbookChapter() const 0079 { 0080 return QLatin1String("media_wiki"); 0081 } 0082 0083 QList<DPluginAuthor> MediaWikiPlugin::authors() const 0084 { 0085 return QList<DPluginAuthor>() 0086 << DPluginAuthor(QString::fromUtf8("Alexandre Mendes"), 0087 QString::fromUtf8("alex dot mendes1988 at gmail dot com"), 0088 QString::fromUtf8("(C) 2011")) 0089 << DPluginAuthor(QString::fromUtf8("Guillaume Hormiere"), 0090 QString::fromUtf8("hormiere dot guillaume at gmail dot com"), 0091 QString::fromUtf8("(C) 2011-2012")) 0092 << DPluginAuthor(QString::fromUtf8("Peter Potrowl"), 0093 QString::fromUtf8("peter dot potrowl at gmail dot com"), 0094 QString::fromUtf8("(C) 2013")) 0095 << DPluginAuthor(QString::fromUtf8("Gilles Caulier"), 0096 QString::fromUtf8("caulier dot gilles at gmail dot com"), 0097 QString::fromUtf8("(C) 2011-2021")) 0098 ; 0099 } 0100 0101 void MediaWikiPlugin::setup(QObject* const parent) 0102 { 0103 DPluginAction* const ac = new DPluginAction(parent); 0104 ac->setIcon(icon()); 0105 ac->setText(i18nc("@action", "Export to MediaWiki...")); 0106 ac->setObjectName(QLatin1String("export_MediaWiki")); 0107 ac->setActionCategory(DPluginAction::GenericExport); 0108 0109 connect(ac, SIGNAL(triggered(bool)), 0110 this, SLOT(slotMediaWiki())); 0111 0112 addAction(ac); 0113 } 0114 0115 void MediaWikiPlugin::slotMediaWiki() 0116 { 0117 if (!reactivateToolDialog(m_toolDlg)) 0118 { 0119 delete m_toolDlg; 0120 m_toolDlg = new MediaWikiWindow(infoIface(sender()), nullptr); 0121 m_toolDlg->setPlugin(this); 0122 m_toolDlg->show(); 0123 } 0124 } 0125 0126 } // namespace DigikamGenericMediaWikiPlugin 0127 0128 #include "moc_mediawikiplugin.cpp"