You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-office/kmymoney/files/kmymoney-4.8.0-kdepimlibs-o...

173 lines
5.1 KiB

From c66ab47628ad0cf76cc63de0bdf1ed578e4138ed Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
Date: Thu, 10 Nov 2016 16:18:42 +0100
Subject: [PATCH 2/2] Make kdepimlibs optional
Based on b5de50ccaa1571c4feb0c17ea8016554e3b822d7 from master.
REVIEW: 129371
---
CMakeLists.txt | 5 ++++-
kmymoney/dialogs/settings/ksettingsschedules.cpp | 5 ++++-
kmymoney/kmymoney.cpp | 20 +++++++++++++++++++-
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a01673..6662521 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -84,7 +84,7 @@ if (NOT Gpgmepp_FOUND)
else (NOT Gpgmepp_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif (NOT Gpgmepp_FOUND)
-find_package(KdepimLibs REQUIRED)
+find_package(KdepimLibs)
find_package(SharedMimeInfo REQUIRED)
# set the configuration switch signaling that KDE PIM libraries were found
@@ -417,6 +417,7 @@ macro(nice_yesno _varname)
endif(${_varname})
endmacro(nice_yesno _varname)
+nice_yesno("KdepimLibs_FOUND")
nice_yesno("LIBOFX_FOUND")
nice_yesno("LIBOFX_HAVE_CLIENTUID")
nice_yesno("KBANKING_FOUND")
@@ -433,6 +434,8 @@ message("
Configure results (user options):
--------------------------------------------
+KDE PIM holidays: ${nice_KdepimLibs_FOUND}
+
OFX plugin: ${nice_LIBOFX_FOUND}
OFX clientuid support ${nice_LIBOFX_HAVE_CLIENTUID}
diff --git a/kmymoney/dialogs/settings/ksettingsschedules.cpp b/kmymoney/dialogs/settings/ksettingsschedules.cpp
index da138a7..1f0d16f 100644
--- a/kmymoney/dialogs/settings/ksettingsschedules.cpp
+++ b/kmymoney/dialogs/settings/ksettingsschedules.cpp
@@ -24,8 +24,10 @@
#include <kdeversion.h>
#include <KStandardDirs>
+#ifdef HAVE_KDEPIMLIBS
#include <KHolidays/Holidays>
using namespace KHolidays;
+#endif
// ----------------------------------------------------------------------------
// Project Includes
@@ -50,6 +52,7 @@ KSettingsSchedules::KSettingsSchedules(QWidget* parent) :
void KSettingsSchedules::loadList()
{
QStringList regions;
+#ifdef HAVE_KDEPIMLIBS
QStringList regionCodes = HolidayRegion::regionCodes();
foreach (const QString &regionCode, regionCodes) {
@@ -65,7 +68,7 @@ void KSettingsSchedules::loadList()
regions << region;
}
regions.sort();
-
+#endif
m_regionMap[m_holidayRegion->itemText(0)] = "";
m_holidayRegion->insertItems(1, regions);
}
diff --git a/kmymoney/kmymoney.cpp b/kmymoney/kmymoney.cpp
index a4251f0..0bd2d3b 100644
--- a/kmymoney/kmymoney.cpp
+++ b/kmymoney/kmymoney.cpp
@@ -89,7 +89,9 @@
#include <kinputdialog.h>
#include <kxmlguifactory.h>
#include <krecentfilesaction.h>
+#ifdef HAVE_KDEPIMLIBS
#include <KHolidays/Holidays>
+#endif
// ----------------------------------------------------------------------------
// Project Includes
@@ -221,7 +223,9 @@ public:
m_additionalKeyLabel(0),
m_additionalKeyButton(0),
m_recentFiles(0),
+#ifdef HAVE_KDEPIMLIBS
m_holidayRegion(0),
+#endif
m_applicationIsReady(true) {
// since the days of the week are from 1 to 7,
// and a day of the week is used to index this bit array,
@@ -343,9 +347,10 @@ public:
KPushButton* m_additionalKeyButton;
KRecentFilesAction* m_recentFiles;
-
+#ifdef HAVE_KDEPIMLIBS
// used by the calendar interface for schedules
KHolidays::HolidayRegion* m_holidayRegion;
+#endif
QBitArray m_processingDays;
QMap<QDate, bool> m_holidayMap;
QStringList m_consistencyCheckResult;
@@ -455,7 +460,9 @@ KMyMoneyApp::~KMyMoneyApp()
delete d->m_transactionEditor;
delete d->m_endingBalanceDlg;
delete d->m_moveToAccountSelector;
+#ifdef HAVE_KDEPIMLIBS
delete d->m_holidayRegion;
+#endif
delete d;
}
@@ -7732,6 +7739,7 @@ void KMyMoneyApp::slotOnlineJobLog(const QStringList& onlineJobIds)
void KMyMoneyApp::setHolidayRegion(const QString& holidayRegion)
{
+#ifdef HAVE_KDEPIMLIBS
//since the cost of updating the cache is now not negligible
//check whether the region has been modified
if (!d->m_holidayRegion || d->m_holidayRegion->regionCode() != holidayRegion) {
@@ -7743,10 +7751,14 @@ void KMyMoneyApp::setHolidayRegion(const QString& holidayRegion)
//clear and update the holiday cache
preloadHolidays();
}
+#else
+ Q_UNUSED(holidayRegion);
+#endif
}
bool KMyMoneyApp::isProcessingDate(const QDate& date) const
{
+#ifdef HAVE_KDEPIMLIBS
if (!d->m_processingDays.testBit(date.dayOfWeek()))
return false;
if (!d->m_holidayRegion || !d->m_holidayRegion->isValid())
@@ -7760,10 +7772,15 @@ bool KMyMoneyApp::isProcessingDate(const QDate& date) const
d->m_holidayMap.insert(date, processingDay);
return processingDay;
}
+#else
+ Q_UNUSED(date);
+ return true;
+#endif
}
void KMyMoneyApp::preloadHolidays()
{
+#ifdef HAVE_KDEPIMLIBS
//clear the cache before loading
d->m_holidayMap.clear();
//only do this if it is a valid region
@@ -7792,6 +7809,7 @@ void KMyMoneyApp::preloadHolidays()
}
}
}
+#endif
}
KMStatus::KMStatus(const QString &text)
--
2.7.3