File indexing completed on 2025-01-05 03:52:01

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 create calendar.
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 "calendarplugin.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 "calwizard.h"
0028 
0029 namespace DigikamGenericCalendarPlugin
0030 {
0031 
0032 CalendarPlugin::CalendarPlugin(QObject* const parent)
0033     : DPluginGeneric(parent)
0034 {
0035 }
0036 
0037 CalendarPlugin::~CalendarPlugin()
0038 {
0039 }
0040 
0041 QString CalendarPlugin::name() const
0042 {
0043     return i18n("Create Calendar");
0044 }
0045 
0046 QString CalendarPlugin::iid() const
0047 {
0048     return QLatin1String(DPLUGIN_IID);
0049 }
0050 
0051 QIcon CalendarPlugin::icon() const
0052 {
0053     return QIcon::fromTheme(QLatin1String("view-calendar"));
0054 }
0055 
0056 QString CalendarPlugin::description() const
0057 {
0058     return i18n("A tool to create calendar from images");
0059 }
0060 
0061 QString CalendarPlugin::details() const
0062 {
0063     return i18n("<p>This tool allows users to compose items and create a calendar with your best photos.</p>"
0064                 "<p>Different calendar layout are available and you can integrate a list of dates from ICS format to highlight holidays time.</p>"
0065                 "<p>Finally, the tool will propose to export the result to your printer or in a PDF file.</p>");
0066 }
0067 
0068 QString CalendarPlugin::handbookSection() const
0069 {
0070     return QLatin1String("post_processing");
0071 }
0072 
0073 QString CalendarPlugin::handbookChapter() const
0074 {
0075     return QLatin1String("calendar_tool");
0076 }
0077 
0078 QList<DPluginAuthor> CalendarPlugin::authors() const
0079 {
0080     return QList<DPluginAuthor>()
0081             << DPluginAuthor(QString::fromUtf8("Renchi Raju"),
0082                              QString::fromUtf8("renchi dot raju at gmail dot com"),
0083                              QString::fromUtf8("(C) 2003-2005"),
0084                              i18n("Former Author"))
0085             << DPluginAuthor(QString::fromUtf8("Orgad Shaneh"),
0086                              QString::fromUtf8("orgads at gmail dot com"),
0087                              QString::fromUtf8("(C) 2007-2008"))
0088             << DPluginAuthor(QString::fromUtf8("Tom Albers"),
0089                              QString::fromUtf8("tomalbers at kde dot nl"),
0090                              QString::fromUtf8("(C) 2006"))
0091             << DPluginAuthor(QString::fromUtf8("Gilles Caulier"),
0092                              QString::fromUtf8("caulier dot gilles at gmail dot com"),
0093                              QString::fromUtf8("(C) 2004-2021"),
0094                              i18n("Developer and Maintainer"))
0095             ;
0096 }
0097 
0098 void CalendarPlugin::setup(QObject* const parent)
0099 {
0100     DPluginAction* const ac = new DPluginAction(parent);
0101     ac->setIcon(icon());
0102     ac->setText(i18nc("@action", "Create Calendar..."));
0103     ac->setObjectName(QLatin1String("calendar"));
0104     ac->setActionCategory(DPluginAction::GenericTool);
0105 
0106     connect(ac, SIGNAL(triggered(bool)),
0107             this, SLOT(slotCalendar()));
0108 
0109     addAction(ac);
0110 }
0111 
0112 void CalendarPlugin::slotCalendar()
0113 {
0114     QPointer<CalWizard> wzrd = new CalWizard(nullptr, infoIface(sender()));
0115     wzrd->setPlugin(this);
0116     wzrd->exec();
0117     delete wzrd;
0118 }
0119 
0120 } // namespace DigikamGenericCalendarPlugin
0121 
0122 #include "moc_calendarplugin.cpp"