File indexing completed on 2025-03-09 03:52:14
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 and import items with a remote location. 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 "ftplugin.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 "ftexportwindow.h" 0028 #include "ftimportwindow.h" 0029 0030 namespace DigikamGenericFileTransferPlugin 0031 { 0032 0033 FTPlugin::FTPlugin(QObject* const parent) 0034 : DPluginGeneric(parent) 0035 { 0036 } 0037 0038 FTPlugin::~FTPlugin() 0039 { 0040 } 0041 0042 void FTPlugin::cleanUp() 0043 { 0044 delete m_toolDlgExport; 0045 delete m_toolDlgImport; 0046 } 0047 0048 QString FTPlugin::name() const 0049 { 0050 return i18nc("@title", "File Transfer"); 0051 } 0052 0053 QString FTPlugin::iid() const 0054 { 0055 return QLatin1String(DPLUGIN_IID); 0056 } 0057 0058 QIcon FTPlugin::icon() const 0059 { 0060 return QIcon::fromTheme(QLatin1String("folder-html")); 0061 } 0062 0063 QString FTPlugin::description() const 0064 { 0065 return i18nc("@info", "A tool to export and import items with a remote location"); 0066 } 0067 0068 QString FTPlugin::details() const 0069 { 0070 return i18nc("@info", "This tool allows users to export and import items with a remote location.\n\n" 0071 "Many protocols can be used, as FTP, SFTP, SAMBA, etc."); 0072 } 0073 0074 QString FTPlugin::handbookSection() const 0075 { 0076 return QLatin1String("export_tools"); 0077 } 0078 0079 QString FTPlugin::handbookChapter() const 0080 { 0081 return QLatin1String("file_transfert"); 0082 } 0083 0084 QList<DPluginAuthor> FTPlugin::authors() const 0085 { 0086 return QList<DPluginAuthor>() 0087 << DPluginAuthor(QString::fromUtf8("Johannes Wienke"), 0088 QString::fromUtf8("languitar at semipol dot de"), 0089 QString::fromUtf8("(C) 2009")) 0090 << DPluginAuthor(QString::fromUtf8("Maik Qualmann"), 0091 QString::fromUtf8("metzpinguin at gmail dot com"), 0092 QString::fromUtf8("(C) 2017-2021")) 0093 << DPluginAuthor(QString::fromUtf8("Gilles Caulier"), 0094 QString::fromUtf8("caulier dot gilles at gmail dot com"), 0095 QString::fromUtf8("(C) 2010-2021")) 0096 ; 0097 } 0098 0099 void FTPlugin::setup(QObject* const parent) 0100 { 0101 DPluginAction* const ac = new DPluginAction(parent); 0102 ac->setIcon(icon()); 0103 ac->setText(i18nc("@action", "Export to remote storage...")); 0104 ac->setObjectName(QLatin1String("export_filetransfer")); 0105 ac->setActionCategory(DPluginAction::GenericExport); 0106 ac->setShortcut(Qt::CTRL | Qt::ALT | Qt::SHIFT | Qt::Key_K); 0107 0108 connect(ac, SIGNAL(triggered(bool)), 0109 this, SLOT(slotFileTransferExport())); 0110 0111 addAction(ac); 0112 0113 DPluginAction* const ac2 = new DPluginAction(parent); 0114 ac2->setIcon(icon()); 0115 ac2->setText(i18nc("@action", "Import from remote storage...")); 0116 ac2->setObjectName(QLatin1String("import_filetransfer")); 0117 ac2->setActionCategory(DPluginAction::GenericImport); 0118 ac2->setShortcut(Qt::ALT | Qt::SHIFT | Qt::Key_K); 0119 0120 connect(ac2, SIGNAL(triggered(bool)), 0121 this, SLOT(slotFileTransferImport())); 0122 0123 addAction(ac2); 0124 0125 } 0126 0127 void FTPlugin::slotFileTransferExport() 0128 { 0129 if (!reactivateToolDialog(m_toolDlgExport)) 0130 { 0131 delete m_toolDlgExport; 0132 m_toolDlgExport = new FTExportWindow(infoIface(sender()), nullptr); 0133 m_toolDlgExport->setPlugin(this); 0134 m_toolDlgExport->show(); 0135 } 0136 } 0137 0138 void FTPlugin::slotFileTransferImport() 0139 { 0140 if (!reactivateToolDialog(m_toolDlgImport)) 0141 { 0142 delete m_toolDlgImport; 0143 m_toolDlgImport = new FTImportWindow(infoIface(sender()), nullptr); 0144 m_toolDlgImport->setPlugin(this); 0145 m_toolDlgImport->show(); 0146 } 0147 } 0148 0149 } // namespace DigikamGenericFileTransferPlugin 0150 0151 #include "moc_ftplugin.cpp"