Commit a678c6ba authored by Allen Winter's avatar Allen Winter

Feature: A calendar plugin for lunar phases as agenda view decorations.

not the most beautiful, but functional
parent 46e00d05
......@@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.1)
set(PIM_VERSION "5.7.40")
project(kdepim-addons VERSION ${PIM_VERSION})
if (POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
set(KF5_VERSION "5.42.0")
......@@ -17,7 +17,7 @@ set(KDEPIM_DEV_VERSION alpha)
# add an extra space
if(DEFINED KDEPIM_DEV_VERSION)
set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}")
set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}")
endif()
set(KDEPIMADDONS_VERSION_NUMBER ${PIM_VERSION})
......@@ -41,7 +41,6 @@ include(CheckFunctionExists)
include(ECMGeneratePriFile)
include(ECMCoverageOption)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
......@@ -52,7 +51,6 @@ option(KDEPIMADDONS_BUILD_EXAMPLES "Build the kdepim-addons example applications
option(KDEPIM_ENTERPRISE_BUILD "Enable features specific to the enterprise branch, which are normally disabled. Also, it disables many components not needed for Kontact such as the Kolab client." FALSE)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED WebEngine WebEngineWidgets Widgets Test)
find_package(KF5I18n ${KF5_VERSION} CONFIG REQUIRED)
......@@ -66,7 +64,7 @@ find_package(KF5KIO ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5IconThemes ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Parts ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Prison ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Holidays ${KF5_VERSION} CONFIG REQUIRED)
set(MAILCOMMON_LIB_VERSION "5.7.40")
set(GRAVATAR_LIB_VERSION "5.7.40")
......@@ -91,7 +89,6 @@ set(AKONADICONTACT_LIB_VERSION "5.7.40")
set(IMPORTWIZARD_LIB_VERSION "5.7.40")
set(MAILIMPORTER_LIB_VERSION "5.7.40")
find_package(KF5CalendarUtils ${CALENDAR_UTILS_VERSION} CONFIG REQUIRED)
find_package(KF5WebEngineViewer ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5TemplateParser ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
......@@ -121,27 +118,27 @@ find_package(KF5MailTransportAkonadi ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIR
find_package(KF5AkonadiContact ${AKONADICONTACT_LIB_VERSION} CONFIG REQUIRED)
find_package(KPimImportWizard ${IMPORTWIZARD_LIB_VERSION} CONFIG)
find_package(KF5MailImporterAkonadi ${MAILIMPORTER_LIB_VERSION} CONFIG REQUIRED)
add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII )
add_definitions(-DQT_NO_CAST_FROM_ASCII)
add_definitions(-DQT_NO_CAST_TO_ASCII)
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
if(KDEPIM_ENTERPRISE_BUILD)
set(KDEPIM_ENTERPRISE_BUILD true)
set(KDEPIM_ENTERPRISE_BUILD true)
else()
set(KDEPIM_ENTERPRISE_BUILD false)
set(KDEPIM_ENTERPRISE_BUILD false)
endif()
# Extra package
find_package(Gpgmepp 1.8.0 CONFIG)
set_package_properties(Gpgmepp PROPERTIES DESCRIPTION "GpgME library" URL "http://www.gnupg.org" TYPE REQUIRED)
set( SharedMimeInfo_MINIMUM_VERSION "1.0" )
set(SharedMimeInfo_MINIMUM_VERSION "1.0")
find_package(SharedMimeInfo ${SharedMimeInfo_MINIMUM_VERSION} REQUIRED)
find_package(Poppler COMPONENTS Qt5)
set_package_properties("Poppler" PROPERTIES TYPE OPTIONAL PURPOSE "Support for PDF booking confirmations in the semantic extraction plugin.")
if (KDEPIMADDONS_BUILD_EXAMPLES)
add_subdirectory(examples)
if(KDEPIMADDONS_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
add_subdirectory(plugins)
......@@ -151,9 +148,9 @@ add_subdirectory(kaddressbook)
add_subdirectory(akregator)
add_subdirectory(sieveeditor)
add_subdirectory(kmailtransport)
if (KPimImportWizard_FOUND)
add_subdirectory(akonadi-import-wizard)
if(KPimImportWizard_FOUND)
add_subdirectory(akonadi-import-wizard)
endif()
install( FILES kdepim-addons.categories kdepim-addons.renamecategories DESTINATION ${KDE_INSTALL_CONFDIR} )
install(FILES kdepim-addons.categories kdepim-addons.renamecategories DESTINATION ${KDE_INSTALL_CONFDIR})
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -2,6 +2,6 @@ add_definitions(-DTRANSLATION_DOMAIN=\"korganizer_plugins\")
add_subdirectory(datenums)
#Comment it it depends against kdelibs4support
#add_subdirectory(hebrew)
add_subdirectory(lunarphases)
add_subdirectory(picoftheday)
add_subdirectory(thisdayinhistory)
########### next target ###############
set(korg_lunarphases_PART_SRCS
lunarphases.cpp
)
add_library(korg_lunarphases MODULE ${korg_lunarphases_PART_SRCS})
target_link_libraries(korg_lunarphases
KF5::Holidays
KF5::EventViews
)
install(TARGETS
korg_lunarphases
DESTINATION ${KDE_INSTALL_PLUGINDIR}
)
########### install files ###############
install(FILES
lunarphases.desktop
DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/korganizer
)
/*
Copyright (c) 2018 Allen Winter <winter@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "lunarphases.h"
#include <KHolidays/LunarPhase>
#include <KConfig>
#include <KConfigGroup>
#include <KLocalizedString>
Lunarphases::Lunarphases()
{
KConfig _config(QStringLiteral("korganizerrc"));
KConfigGroup config(&_config, "Lunar Phases Plugin");
}
QString Lunarphases::info() const
{
return i18n("This plugin displays the day's lunar phase (New, First, Last, Full). "
"Currently, the phase is computed for noon at UTC; therefore, you should "
"expect variations by 1 day in either direction.");
}
Element::List Lunarphases::createDayElements(const QDate &date)
{
Element::List result;
const QString name = KHolidays::LunarPhase::phaseNameAtDate(date);
StoredElement *e = new StoredElement(QStringLiteral("main element"), name, name);
result.append(e);
return result;
}
Element::List Lunarphases::createWeekElements(const QDate &date)
{
Element::List result;
const QString name = KHolidays::LunarPhase::phaseNameAtDate(date);
StoredElement *e = new StoredElement(QStringLiteral("main element"), name, name);
result.append(e);
return result;
}
[Desktop Entry]
X-KDE-Library=korg_lunarphases
Name=Lunar Phases Plugin for Calendars
Comment=This plugin shows the day's lunar phase (New, First, Last, Full)
Type=Service
X-KDE-ServiceTypes=Calendar/Plugin,Calendar/Decoration
X-KDE-KOrganizer-HasSettings=false
X-KDE-PluginInterfaceVersion=2
/*
Copyright (c) 2018 Allen Winter <winter@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KORG_PLUGINS_LUNARPHASES_LUNARPHASES_H
#define KORG_PLUGINS_LUNARPHASES_LUNARPHASES_H
#include <EventViews/CalendarDecoration>
using namespace EventViews::CalendarDecoration;
class Lunarphases : public Decoration
{
public:
Lunarphases();
~Lunarphases()
{
}
Element::List createDayElements(const QDate &) override;
Element::List createWeekElements(const QDate &) override;
QString info() const override;
};
class LunarphasesFactory : public DecorationFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.kde.korganizer.Lunarphases")
public:
Decoration *createPluginFactory() override
{
return new Lunarphases;
}
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment