forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kmymoney-4.8.0-kdepimlibs-optional.patch
172 lines (154 loc) · 5.14 KB
/
kmymoney-4.8.0-kdepimlibs-optional.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
From c66ab47628ad0cf76cc63de0bdf1ed578e4138ed Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <[email protected]>
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 ®ionCode, 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