File indexing completed on 2025-01-19 03:51:20

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 edit items geolocation.
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 "geolocationeditplugin.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 "geolocationedit.h"
0028 
0029 namespace DigikamGenericGeolocationEditPlugin
0030 {
0031 
0032 GeolocationEditPlugin::GeolocationEditPlugin(QObject* const parent)
0033     : DPluginGeneric(parent)
0034 {
0035 }
0036 
0037 GeolocationEditPlugin::~GeolocationEditPlugin()
0038 {
0039 }
0040 
0041 QString GeolocationEditPlugin::name() const
0042 {
0043     return i18nc("@title", "Geolocation Edit");
0044 }
0045 
0046 QString GeolocationEditPlugin::iid() const
0047 {
0048     return QLatin1String(DPLUGIN_IID);
0049 }
0050 
0051 QIcon GeolocationEditPlugin::icon() const
0052 {
0053     return QIcon::fromTheme(QLatin1String("globe"));
0054 }
0055 
0056 QString GeolocationEditPlugin::description() const
0057 {
0058     return i18nc("@info", "A tool to edit items geolocation");
0059 }
0060 
0061 QString GeolocationEditPlugin::details() const
0062 {
0063     return i18nc("@info", "This tool allows users to change geolocation information from items.\n\n"
0064                  "This tool can edit GPS data, manually or over a map. Reverse geo-coding is also available through web services.\n\n"
0065                  "This tool has also an export function to KML to store map traces in Google format.\n\n"
0066                  "Finally, this tool is able to read a GPS trace from a device to synchronize geo-location of items if you camera do not have an embedded GPS device.");
0067 }
0068 
0069 QString GeolocationEditPlugin::handbookSection() const
0070 {
0071     return QLatin1String("geolocation_editor");
0072 }
0073 
0074 QString GeolocationEditPlugin::handbookChapter() const
0075 {
0076     return QLatin1String("geoeditor_overview");
0077 }
0078 
0079 QList<DPluginAuthor> GeolocationEditPlugin::authors() const
0080 {
0081     return QList<DPluginAuthor>()
0082             << DPluginAuthor(QString::fromUtf8("Michael G. Hansen"),
0083                              QString::fromUtf8("mike at mghansen dot de"),
0084                              QString::fromUtf8("(C) 2008-2012"))
0085             << DPluginAuthor(QString::fromUtf8("Gabriel Voicu"),
0086                              QString::fromUtf8("ping dot gabi at gmail dot com"),
0087                              QString::fromUtf8("(C) 2010-2012"))
0088             << DPluginAuthor(QString::fromUtf8("Justus Schwartz"),
0089                              QString::fromUtf8("justus at gmx dot li"),
0090                              QString::fromUtf8("(C) 2014"))
0091             << DPluginAuthor(QString::fromUtf8("Gilles Caulier"),
0092                              QString::fromUtf8("caulier dot gilles at gmail dot com"),
0093                              QString::fromUtf8("(C) 2006-2023"))
0094             ;
0095 }
0096 
0097 void GeolocationEditPlugin::setup(QObject* const parent)
0098 {
0099     DPluginAction* const ac = new DPluginAction(parent);
0100     ac->setIcon(icon());
0101     ac->setText(i18nc("@action", "Edit Geolocation..."));
0102     ac->setObjectName(QLatin1String("geolocation_edit"));
0103     ac->setActionCategory(DPluginAction::GenericMetadata);
0104     ac->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_G);
0105 
0106     connect(ac, SIGNAL(triggered(bool)),
0107             this, SLOT(slotEditGeolocation()));
0108 
0109     addAction(ac);
0110 }
0111 
0112 void GeolocationEditPlugin::slotEditGeolocation()
0113 {
0114     QPointer<GeolocationEdit> dialog = new GeolocationEdit(nullptr, infoIface(sender()));
0115     dialog->setPlugin(this);
0116     dialog->exec();
0117     delete dialog;
0118 }
0119 
0120 } // namespace DigikamGenericGeolocationEditPlugin
0121 
0122 #include "moc_geolocationeditplugin.cpp"