summaryrefslogtreecommitdiff
path: root/kde-apps/gwenview/files/gwenview-18.07.90-activities-optional.patch
blob: bf66688a6b91c076c6ac5b126728d7102d22a7cc (plain)
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
From a00eecc78507f48843f719f32e80ae8805a34c15 Mon Sep 17 00:00:00 2001
From: Alexander Volkov <a.volkov@rusbitech.ru>
Date: Tue, 7 Aug 2018 23:59:15 +0300
Subject: Make dependency on KActivities optional

Reviewers: #gwenview, rkflx

Reviewed By: #gwenview, rkflx

Subscribers: asturmlechner, rkflx

Differential Revision: https://phabricator.kde.org/D14512
---
 CMakeLists.txt          |  4 +++-
 app/CMakeLists.txt      |  5 ++++-
 app/viewmainpage.cpp    | 19 ++++++++++++++++---
 config-gwenview.h.cmake |  1 +
 4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6e3e412..810813a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,7 +71,6 @@ add_definitions(-DPHONON_LIB_SONAME=\"${PHONON_LIB_SONAME}\")
 
 find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
     KIO
-    Activities
     ItemModels
     I18n
     DocTools
@@ -80,6 +79,9 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
     IconThemes
     Notifications
 )
+find_package(KF5 ${KF5_MIN_VERSION} OPTIONAL_COMPONENTS
+    Activities
+)
 
 ## Dependencies
 find_package(JPEG)
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 5fe34d6..0d24360 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -78,11 +78,14 @@ add_executable(gwenview ${gwenview_SRCS})
 
 target_link_libraries(gwenview
     KF5::ItemModels
-    KF5::Activities
     KF5::Notifications
     gwenviewlib
     )
 
+if (KF5Activities_FOUND)
+    target_link_libraries(gwenview KF5::Activities)
+endif()
+
 target_link_libraries(gwenview LINK_INTERFACE_LIBRARIES KF5::KIOCore Qt5::Core)
 
 if (KF5Kipi_FOUND)
diff --git a/app/viewmainpage.cpp b/app/viewmainpage.cpp
index fa06e80..480d3c2 100644
--- a/app/viewmainpage.cpp
+++ b/app/viewmainpage.cpp
@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 */
 #include "viewmainpage.h"
+#include "config-gwenview.h"
 
 // Qt
 #include <QCheckBox>
@@ -35,8 +36,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 #include <KMessageBox>
 #include <KModelIndexProxyMapper>
 #include <KToggleAction>
-#include <KActivities/ResourceInstance>
 #include <KSqueezedTextLabel>
+#ifdef KF5Activities_FOUND
+#include <KActivities/ResourceInstance>
+#endif
 
 // Local
 #include "fileoperations.h"
@@ -132,7 +135,9 @@ struct ViewMainPagePrivate
     // Activity Resource events reporting needs to be above KPart,
     // in the shell itself, to avoid problems with other MDI applications
     // that use this KPart
+#ifdef KF5Activities_FOUND
     QHash<DocumentView*, KActivities::ResourceInstance*> mActivityResources;
+#endif
 
     bool mCompareMode;
     ZoomMode::Enum mZoomMode;
@@ -250,7 +255,9 @@ struct ViewMainPagePrivate
         QObject::connect(view, &DocumentView::videoFinished, mSlideShow, &SlideShow::resumeAndGoToNextUrl);
 
         mDocumentViews << view;
+#ifdef KF5Activities_FOUND
         mActivityResources.insert(view, new KActivities::ResourceInstance(q->window()->winId(), view));
+#endif
 
         return view;
     }
@@ -269,7 +276,9 @@ struct ViewMainPagePrivate
         QObject::disconnect(view, nullptr, mSlideShow, nullptr);
 
         mDocumentViews.removeOne(view);
+#ifdef KF5Activities_FOUND
         mActivityResources.remove(view);
+#endif
         mDocumentViewContainer->deleteView(view);
     }
 
@@ -344,8 +353,10 @@ struct ViewMainPagePrivate
         }
         if (oldView) {
             oldView->setCurrent(false);
+#ifdef KF5Activities_FOUND
             Q_ASSERT(mActivityResources.contains(oldView));
             mActivityResources.value(oldView)->notifyFocusedOut();
+#endif
         }
         view->setCurrent(true);
         mDocumentViewController->setView(view);
@@ -358,10 +369,10 @@ struct ViewMainPagePrivate
             // *before* listing /foo (because it matters less to the user)
             mThumbnailBar->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Current);
         }
-
+#ifdef KF5Activities_FOUND
         Q_ASSERT(mActivityResources.contains(view));
         mActivityResources.value(view)->notifyFocusedIn();
-
+#endif
         QObject::connect(view, &DocumentView::currentToolChanged,
                          q, &ViewMainPage::updateFocus);
     }
@@ -701,7 +712,9 @@ void ViewMainPage::openUrls(const QList<QUrl>& allUrls, const QUrl &currentUrl)
         DocumentView* view = it.value();
         DocumentView::Setup savedSetup = d->mDocumentViewContainer->savedSetup(url);
         view->openUrl(url, d->mZoomMode == ZoomMode::Individual && savedSetup.valid ? savedSetup : setup);
+#ifdef KF5Activities_FOUND
         d->mActivityResources.value(view)->setUri(url);
+#endif
     }
 
     // Init views
diff --git a/config-gwenview.h.cmake b/config-gwenview.h.cmake
index 29a5a60..369442a 100644
--- a/config-gwenview.h.cmake
+++ b/config-gwenview.h.cmake
@@ -6,3 +6,4 @@
 #cmakedefine HAVE_X11 ${HAVE_X11}
 #cmakedefine HAVE_FITS ${HAVE_FITS}
 #cmakedefine HAVE_QTDBUS ${HAVE_QTDBUS}
+#cmakedefine KF5Activities_FOUND 1
-- 
cgit v0.11.2