CMakeLists.txt 12.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12


add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII )


add_definitions(-DTRANSLATION_DOMAIN=\"libmessageviewer\")

# KCFG files:
# The main messageviewer.kcfg is configured by CMake and put in the build directory.

if(KDEPIM_ENTERPRISE_BUILD)
Laurent Montel's avatar
Laurent Montel committed
13
14
15
    set(LEGACY_MANGLE_FROM_TO_HEADERS true)
    set(LEGACY_BODY_INVITES true)
    set(EXCHANGE_COMPATIBLE_INVITATIONS true)
16
else()
Laurent Montel's avatar
Laurent Montel committed
17
18
19
    set(LEGACY_MANGLE_FROM_TO_HEADERS false)
    set(LEGACY_BODY_INVITES false)
    set(EXCHANGE_COMPATIBLE_INVITATIONS false)
20
21
22
23
24
25
26
27
28
29
30
31
endif()

configure_file(settings/messageviewer.kcfg.cmake ${CMAKE_CURRENT_BINARY_DIR}/messageviewer.kcfg)
include(CheckIncludeFiles)
check_include_files(sys/inotify.h SYS_INOTIFY_H_FOUND)
macro_bool_to_01(SYS_INOTIFY_H_FOUND HAVE_SYS_INOTIFY_H)
configure_file(config-messageviewer.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-messageviewer.h)

# target_include_directories does not handle empty include paths
include_directories(${GPGME_INCLUDES})

if(BUILD_TESTING)
Laurent Montel's avatar
Laurent Montel committed
32
33
34
    add_subdirectory(scamdetection/autotests)
    add_subdirectory(scamdetection/tests)
    add_subdirectory(viewerplugins/tests/)
Laurent Montel's avatar
Laurent Montel committed
35
    add_subdirectory(htmlwriter/autotests/)
Laurent Montel's avatar
Laurent Montel committed
36
    add_subdirectory(viewer/webengine/tests)
37
    add_subdirectory(messagepartthemes/default/autotests)
38
    add_subdirectory(viewer/webengine/autotests/)
39
40
41
42
endif()
add_subdirectory(pics)
add_subdirectory(kconf_update)
add_subdirectory(about)
43
add_subdirectory(messageviewerheaderplugins)
44
if(DEBUG_SIGNATURE)
Laurent Montel's avatar
Laurent Montel committed
45
    add_definitions(-DDEBUG_SIGNATURE)
46
47
endif()

Laurent Montel's avatar
Laurent Montel committed
48
49
50
51
52
set(libmessageviewer_mailviewer_SRCS
    viewer/webengine/mailwebengineview.cpp
    viewer/webengine/mailwebenginepage.cpp
    viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.cpp
    viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.cpp
Laurent Montel's avatar
Laurent Montel committed
53
    viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp
Laurent Montel's avatar
Laurent Montel committed
54
55
    viewer/webengine/mailwebenginescript.cpp
    )
Laurent Montel's avatar
Laurent Montel committed
56

57
set(libmessageviewer_viewer_SRCS
Laurent Montel's avatar
Laurent Montel committed
58
    viewer/bodypartformatterfactory.cpp
59
    viewer/bodypartformatterfactorysingleton.cpp
Laurent Montel's avatar
Laurent Montel committed
60
    viewer/csshelper.cpp
61
    viewer/csshelperbase.cpp
Laurent Montel's avatar
Laurent Montel committed
62
63
64
65
66
67
68
69
70
    viewer/editorwatcher.cpp
    viewer/objecttreeemptysource.cpp
    viewer/objecttreeviewersource.cpp
    viewer/pluginloaderbase.cpp
    viewer/viewer.cpp
    viewer/viewer_p.cpp
    viewer/messagedisplayformatattribute.cpp
    viewer/urlhandlermanager.cpp
    viewer/mimeparttree/mimeparttreeview.cpp
71
    viewer/mimeparttree/mimetreemodel.cpp
Laurent Montel's avatar
Laurent Montel committed
72
    )
73
74

set(libmessageviewer_widgets_SRCS
Laurent Montel's avatar
Laurent Montel committed
75
76
77
78
79
80
81
82
    widgets/attachmentdialog.cpp
    widgets/configurewidget.cpp
    widgets/printingsettings.cpp
    widgets/htmlstatusbar.cpp
    widgets/vcardviewer.cpp
    widgets/invitationsettings.cpp
    widgets/openattachmentfolderwidget.cpp
    widgets/mailsourceviewtextbrowserwidget.cpp
83
    widgets/submittedformwarningwidget.cpp
Laurent Montel's avatar
Laurent Montel committed
84
    )
85

Laurent Montel's avatar
Laurent Montel committed
86
87
88
set(libmessageviewer_widgets_webengine_SRCS
    widgets/mailsourcewebengineviewer.cpp
    )
89

90
set(libmessageviewer_header_SRCS
Laurent Montel's avatar
Laurent Montel committed
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
    header/contactdisplaymessagememento.cpp
    header/headerstrategy.cpp
    header/richheaderstrategy.cpp
    header/headerstyle.cpp
    header/grantleeheaderstyle.cpp
    header/plainheaderstyle.cpp
    header/headerstyle_util.cpp
    header/grantleeheaderformatter.cpp
    header/grantleeheaderteststyle.cpp
    header/kxface.cpp
    header/headerstyleplugin.cpp
    header/headerstylepluginmanager.cpp
    header/headerstyleinterface.cpp
    header/headerstylemenumanager.cpp
    )
106
107

set(libmessageviewer_scamdetection_SRCS
Laurent Montel's avatar
Laurent Montel committed
108
109
110
111
    scamdetection/scamdetectionwarningwidget.cpp
    scamdetection/scamdetectiondetailsdialog.cpp
    scamdetection/scamattribute.cpp
    scamdetection/scamcheckshorturl.cpp
112
    scamdetection/scamexpandurljob.cpp
Laurent Montel's avatar
Laurent Montel committed
113
    scamdetection/scamcheckshorturlmanager.cpp
Laurent Montel's avatar
Laurent Montel committed
114
    )
115

Laurent Montel's avatar
Laurent Montel committed
116
117
118
set(libmessageviewer_scamdetection_webengine_SRCS
    scamdetection/scamdetectionwebengine.cpp
    )
119

120
set(libmessageviewer_findbar_SRCS
Laurent Montel's avatar
Laurent Montel committed
121
122
    findbar/findbarsourceview.cpp
    )
123
124

set(libmessageviewer_utils_SRCS
125
    utils/iconnamecache.cpp
Laurent Montel's avatar
Laurent Montel committed
126
127
    utils/markmessagereadhandler.cpp
    utils/messageviewerutil.cpp
Sandro Knauß's avatar
Sandro Knauß committed
128
    utils/mimetype.cpp
Laurent Montel's avatar
Laurent Montel committed
129
    )
130

Laurent Montel's avatar
Laurent Montel committed
131
132
133
134
set(libmessageviewer_htmlwriter_webengine_SRCS
    htmlwriter/webengineparthtmlwriter.cpp
    htmlwriter/webengineembedpart.cpp
    )
135

136
set(libmessageviewer_htmlwriter_SRCS
Laurent Montel's avatar
Laurent Montel committed
137
138
    htmlwriter/teehtmlwriter.cpp
    )
139
140

set(libmessageviewer_antispam_SRCS
Laurent Montel's avatar
Laurent Montel committed
141
142
143
    antispam/spamheaderanalyzer.cpp
    antispam/antispamconfig.cpp
    )
144
145

set(libmessageviewer_job_SRCS
Laurent Montel's avatar
Laurent Montel committed
146
147
148
    job/attachmenteditjob.cpp
    job/modifymessagedisplayformatjob.cpp
    )
149
150

set(libmessageviewer_viewerplugins_SRCS
Laurent Montel's avatar
Laurent Montel committed
151
152
153
154
155
    viewerplugins/viewerpluginmanager.cpp
    viewerplugins/viewerplugin.cpp
    viewerplugins/viewerplugininterface.cpp
    viewerplugins/viewerplugintoolmanager.cpp
    )
156

157
158
159
160
set(libmessageviewer_messagepartthemes_default_SRCS
    messagepartthemes/default/converthtmltoplaintext.cpp
    messagepartthemes/default/defaultrenderer.cpp
    messagepartthemes/default/htmlblock.cpp
161
    messagepartthemes/default/messagepartrenderermanager.cpp
162
163
    )

164
set(libmessageviewer_SRCS
Laurent Montel's avatar
Laurent Montel committed
165
166
    ${libmessageviewer_messagepartthemes_default_SRCS}
    ${libmessageviewer_htmlwriter_webengine_SRCS}
167
    ${libmessageviewer_messagepartthemes_SRCS}
168
    ${libmessageviewer_scamdetection_webengine_SRCS}
169
    ${libmessageviewer_widgets_webengine_SRCS}
Laurent Montel's avatar
Laurent Montel committed
170
171
172
173
174
175
176
177
178
179
180
181
182
    ${libmessageviewer_viewer_SRCS}
    ${libmessageviewer_widgets_SRCS}
    ${libmessageviewer_header_SRCS}
    ${libmessageviewer_scamdetection_SRCS}
    ${libmessageviewer_findbar_SRCS}
    ${libmessageviewer_utils_SRCS}
    ${libmessageviewer_htmlwriter_SRCS}
    ${libmessageviewer_antispam_SRCS}
    ${libmessageviewer_job_SRCS}
    ${libmessageviewer_viewerplugins_SRCS}
    settings/messageviewersettings.cpp
    ${libmessageviewer_mailviewer_SRCS}
    )
183

184
185
qt5_add_resources(libmessageviewer_SRCS messagepartthemes.qrc)

Laurent Montel's avatar
Laurent Montel committed
186
ecm_qt_declare_logging_category(libmessageviewer_SRCS HEADER messageviewer_debug.h IDENTIFIER MESSAGEVIEWER_LOG CATEGORY_NAME org.kde.pim.messageviewer)
187
188

kconfig_add_kcfg_files(libmessageviewer_SRCS
Laurent Montel's avatar
Laurent Montel committed
189
190
    settings/globalsettings_messageviewer.kcfgc
    )
191
192

ki18n_wrap_ui(libmessageviewer_SRCS
Laurent Montel's avatar
Laurent Montel committed
193
194
195
196
    ui/settings.ui
    ui/invitationsettings.ui
    ui/printingsettings.ui
    )
197
198
199
200
201
202
203
204
205
206


add_library(KF5MessageViewer ${libmessageviewer_SRCS})
generate_export_header(KF5MessageViewer BASE_NAME messageviewer)
add_library(KF5::MessageViewer ALIAS KF5MessageViewer)

target_include_directories(KF5MessageViewer INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/MessageViewer/;${KDE_INSTALL_INCLUDEDIR_KF5}/messageviewer>")
target_include_directories(KF5MessageViewer PUBLIC "$<BUILD_INTERFACE:${MessageViewer_SOURCE_DIR}/src;${MessageViewer_BINARY_DIR}/src;>")

target_link_libraries(KF5MessageViewer
Laurent Montel's avatar
Laurent Montel committed
207
208
209
210
211
212
213
    PUBLIC
    KF5::MessageCore
    KF5::PimCommon
    KF5::AkonadiCore
    KF5::AkonadiMime
    KF5::Contacts
    KF5::Libkleo
214
    KF5::MimeTreeParser
Laurent Montel's avatar
Laurent Montel committed
215
216
    PRIVATE
    KF5::ItemViews
Sandro Knauß's avatar
Sandro Knauß committed
217
218
    Qt5::Network
    Qt5::WebKitWidgets
Laurent Montel's avatar
Laurent Montel committed
219
    KF5::WebEngineViewer
Laurent Montel's avatar
Laurent Montel committed
220
221
222
223
224
225
226
227
228
229
    KF5::Libkdepim
    KF5::GrantleeTheme
    KF5::KaddressbookGrantlee
    Grantlee5::Templates
    KF5::MailTransport
    KF5::Mime
    KF5::Mbox
    KF5::PimTextEdit
    KF5::Gravatar
    KF5::IconThemes
230
231
232
233
234
    KF5::I18n
    KF5::KIOFileWidgets
    KF5::KIOWidgets
    KF5::WindowSystem
    KF5::XmlGui
235
236
    Grantlee5::TextDocument
    Grantlee5::Templates
237
    Qt5::PrintSupport
238
    QGpgme
Laurent Montel's avatar
Laurent Montel committed
239
    )
240

241
242
243
if (KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT)
    target_link_libraries(KF5MessageViewer PRIVATE KF5::SyntaxHighlighting)
endif()
244
245
246
247
248

set_target_properties(KF5MessageViewer PROPERTIES
    VERSION ${MESSAGEVIEWER_VERSION_STRING}
    SOVERSION ${MESSAGEVIEWER_SOVERSION}
    EXPORT_NAME MessageViewer
Laurent Montel's avatar
Laurent Montel committed
249
    )
250
251
252
253

install(TARGETS
    KF5MessageViewer
    EXPORT KF5MessageViewerTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK}
Laurent Montel's avatar
Laurent Montel committed
254
    )
255

Laurent Montel's avatar
Laurent Montel committed
256
257
258
259
ecm_generate_headers(MessageViewer_Camelcasewebengine_HEADERS
    HEADER_NAMES
    MailWebEnginePage
    MailWebEngineView
260

Laurent Montel's avatar
Laurent Montel committed
261
262
263
264
    REQUIRED_HEADERS MessageViewer_webengine_HEADERS
    PREFIX MessageViewer
    RELATIVE viewer/webengine
    )
Laurent Montel's avatar
Laurent Montel committed
265

Laurent Montel's avatar
Laurent Montel committed
266
267
268
ecm_generate_headers(MessageViewer_Camelcasescam_HEADERS
    HEADER_NAMES
    ScamExpandUrlJob
Laurent Montel's avatar
Laurent Montel committed
269
    ScamCheckShortUrlManager
Laurent Montel's avatar
Laurent Montel committed
270
    ScamCheckShortUrl
Laurent Montel's avatar
Laurent Montel committed
271
272
273
274
275
276
    REQUIRED_HEADERS MessageViewer_scam_HEADERS
    PREFIX MessageViewer
    RELATIVE scamdetection
    )


277
ecm_generate_headers(MessageViewer_Camelcaseviewer_HEADERS
Laurent Montel's avatar
Laurent Montel committed
278
279
    HEADER_NAMES
    Viewer
280
    CSSHelperBase
Laurent Montel's avatar
Laurent Montel committed
281
282
283
284
    CSSHelper
    ObjectTreeEmptySource
    EditorWatcher
    Stl_Util
285
    BodyPartFormatterFactory
Laurent Montel's avatar
Laurent Montel committed
286
287
288
289
    REQUIRED_HEADERS MessageViewer_viewer_HEADERS
    PREFIX MessageViewer
    RELATIVE viewer
    )
290
291

ecm_generate_headers(MessageViewer_Camelcasewidgets_HEADERS
Laurent Montel's avatar
Laurent Montel committed
292
293
294
295
296
297
298
299
    HEADER_NAMES
    InvitationSettings
    PrintingSettings
    ConfigureWidget
    REQUIRED_HEADERS MessageViewer_widgets_HEADERS
    PREFIX MessageViewer
    RELATIVE widgets
    )
300
301

ecm_generate_headers(MessageViewer_Camelcaseutils_HEADERS
Laurent Montel's avatar
Laurent Montel committed
302
    HEADER_NAMES
303
    IconNameCache
Laurent Montel's avatar
Laurent Montel committed
304
    MarkMessageReadHandler
Sandro Knauß's avatar
Sandro Knauß committed
305
306
    MessageViewerUtil
    MimeType
Laurent Montel's avatar
Laurent Montel committed
307
308
309
310
    REQUIRED_HEADERS MessageViewer_utils_HEADERS
    PREFIX MessageViewer
    RELATIVE utils
    )
311
312

ecm_generate_headers(MessageViewer_Camelcaseantispam_HEADERS
Laurent Montel's avatar
Laurent Montel committed
313
314
315
316
317
318
    HEADER_NAMES
    SpamHeaderAnalyzer
    REQUIRED_HEADERS MessageViewer_antispam_HEADERS
    PREFIX MessageViewer
    RELATIVE antispam
    )
319
320

ecm_generate_headers(MessageViewer_Camelcaseinterfaces_HEADERS
Laurent Montel's avatar
Laurent Montel committed
321
322
323
324
325
326
327
    HEADER_NAMES
    BodyPartURLHandler
    URLHandler
    REQUIRED_HEADERS MessageViewer_interfaces_HEADERS
    PREFIX MessageViewer
    RELATIVE interfaces
    )
328
329

ecm_generate_headers(MessageViewer_Camelcasesettings_HEADERS
Laurent Montel's avatar
Laurent Montel committed
330
331
332
333
334
335
    HEADER_NAMES
    MessageViewerSettings
    REQUIRED_HEADERS MessageViewer_settings_HEADERS
    PREFIX MessageViewer
    RELATIVE settings
    )
336
337
338


ecm_generate_headers(MessageViewer_Camelcaseheader_HEADERS
Laurent Montel's avatar
Laurent Montel committed
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
    HEADER_NAMES
    HeaderStrategy
    GrantleeHeaderTestStyle
    GrantleeHeaderStyle
    HeaderStyle
    KXFace
    HeaderStyle_Util
    HeaderStylePlugin
    HeaderStyleInterface
    PlainHeaderStyle
    RichHeaderStrategy
    HeaderStylePluginManager
    HeaderStyleMenuManager
    REQUIRED_HEADERS MessageViewer_header_HEADERS
    PREFIX MessageViewer
    RELATIVE header
    )
356
357

ecm_generate_headers(MessageViewer_Camelcaseviewerplugin_HEADERS
Laurent Montel's avatar
Laurent Montel committed
358
359
360
361
362
363
364
365
366
    HEADER_NAMES
    ViewerPluginManager
    ViewerPlugin
    ViewerPluginInterface
    ViewerPluginToolManager
    REQUIRED_HEADERS MessageViewer_viewerplugin_HEADERS
    PREFIX MessageViewer
    RELATIVE viewerplugins
    )
367
368
369

ecm_generate_pri_file(BASE_NAME MessageViewer
    LIB_NAME KF5MessageViewer
370
    DEPS "PimCommon MessageCore AkonadiCore AkonadiMime Contacts Libkleo MimeTreeParser" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/MessageViewer
Laurent Montel's avatar
Laurent Montel committed
371
    )
372

Laurent Montel's avatar
Laurent Montel committed
373

374
install(FILES
Laurent Montel's avatar
Laurent Montel committed
375
    ${MessageViewer_Camelcasewebengine_HEADERS}
376
377
378
379
380
381
382
383
    ${MessageViewer_Camelcaseheader_HEADERS}
    ${MessageViewer_Camelcaseviewerplugin_HEADERS}
    ${MessageViewer_Camelcasesettings_HEADERS}
    ${MessageViewer_Camelcaseutils_HEADERS}
    ${MessageViewer_Camelcaseinterfaces_HEADERS}
    ${MessageViewer_Camelcaseviewer_HEADERS}
    ${MessageViewer_Camelcasewidgets_HEADERS}
    ${MessageViewer_Camelcaseantispam_HEADERS}
384
    ${MessageViewer_Camelfindbar_HEADERS}
Laurent Montel's avatar
Laurent Montel committed
385
    ${MessageViewer_Camelcasescam_HEADERS}
386
387
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MessageViewer
    COMPONENT Devel
Laurent Montel's avatar
Laurent Montel committed
388
    )
389
390

install(FILES
Laurent Montel's avatar
Laurent Montel committed
391
    ${MessageViewer_webengine_HEADERS}
Laurent Montel's avatar
Laurent Montel committed
392
    ${MessageViewer_scam_HEADERS}
393
394
395
396
397
398
399
400
401
    ${MessageViewer_viewerplugin_HEADERS}
    ${MessageViewer_settings_HEADERS}
    ${MessageViewer_header_HEADERS}
    ${MessageViewer_utils_HEADERS}
    ${MessageViewer_interfaces_HEADERS}
    ${MessageViewer_HEADERS}
    ${MessageViewer_viewer_HEADERS}
    ${MessageViewer_widgets_HEADERS}
    ${MessageViewer_antispam_HEADERS}
402
    ${MessageViewer_findbar_HEADERS}
403
404
405
    ${CMAKE_CURRENT_BINARY_DIR}/messageviewer_export.h
    ${CMAKE_CURRENT_BINARY_DIR}/globalsettings_messageviewer.h
    ${CMAKE_CURRENT_BINARY_DIR}/messageviewer_debug.h
406
    ${CMAKE_CURRENT_BINARY_DIR}/config-messageviewer.h
407
408
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/messageviewer
    COMPONENT Devel
Laurent Montel's avatar
Laurent Montel committed
409
    )
410
411
412
413
414
415
416
417
418
419

install(FILES
    ${PRI_FILENAME}
    DESTINATION ${ECM_MKSPECS_INSTALL_DIR})


install(FILES header/data/messageviewer_header_themes.knsrc DESTINATION ${KDE_INSTALL_CONFDIR} )

install(FILES notify/messageviewer.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR} )
install(FILES scamdetection/data/longurlServices.json DESTINATION ${KDE_INSTALL_DATADIR}/messageviewer )