File indexing completed on 2025-01-19 04:46:47
0001 /* 0002 This file is part of KOrganizer. 0003 0004 SPDX-FileCopyrightText: 2001 Cornelius Schumacher <schumacher@kde.org> 0005 SPDX-FileCopyrightText: 2007 Loïc Corbasson <loic.corbasson@gmail.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #include "thisdayinhistory.h" 0011 0012 #include <KConfig> 0013 #include <KConfigGroup> 0014 #include <KLocalizedString> 0015 #include <KPluginFactory> 0016 0017 K_PLUGIN_CLASS_WITH_JSON(ThisDayInHistory, "thisdayinhistory.json") 0018 0019 ThisDayInHistory::ThisDayInHistory(QObject *parent, const QVariantList &args) 0020 : Decoration(parent, args) 0021 { 0022 KConfig _config(QStringLiteral("korganizerrc")); 0023 KConfigGroup config(&_config, QStringLiteral("This Day in History Plugin")); 0024 } 0025 0026 QString ThisDayInHistory::info() const 0027 { 0028 return i18n( 0029 "This plugin provides links to Wikipedia's " 0030 "'This Day in History' pages."); 0031 } 0032 0033 Element::List ThisDayInHistory::createDayElements(const QDate &date) 0034 { 0035 Element::List elements; 0036 0037 auto element = new StoredElement(QStringLiteral("Wikipedia link"), i18n("This day in history")); 0038 0039 element->setUrl(QUrl(i18nc("Localized Wikipedia website", "https://en.wikipedia.org/wiki/") 0040 + date.toString(i18nc("Qt date format used by the localized Wikipedia", "MMMM_d")))); 0041 0042 elements.append(element); 0043 0044 return elements; 0045 } 0046 0047 Element::List ThisDayInHistory::createMonthElements(const QDate &date) 0048 { 0049 Element::List elements; 0050 0051 auto element = new StoredElement(QStringLiteral("Wikipedia link"), i18n("This month in history")); 0052 0053 element->setUrl(QUrl(i18nc("Localized Wikipedia website", "https://en.wikipedia.org/wiki/") 0054 + date.toString(i18nc("Qt date format used by the localized Wikipedia", "MMMM_yyyy")))); 0055 0056 elements.append(element); 0057 0058 return elements; 0059 } 0060 0061 #include "thisdayinhistory.moc"