Commit 51949311 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

improve check + add autotests

parent 032540b2
......@@ -25,6 +25,16 @@ if(Inotify_FOUND)
else()
set(HAVE_SYS_INOTIFY_H 0)
endif()
find_package(Qca-qt5 2.1.0)
set_package_properties(Qca-qt5 PROPERTIES DESCRIPTION "Qt Cryptographic Architecture"
URL "https:/download.kde.org/stable/qca-qt5" TYPE OPTIONAL
PURPOSE "Needed for kdim support.")
if (${Qca-qt5_FOUND})
set(USE_DKIM_CHECKER 1)
endif()
configure_file(config-messageviewer.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-messageviewer.h)
# target_include_directories does not handle empty include paths
......@@ -46,13 +56,7 @@ add_subdirectory(kconf_update)
add_subdirectory(about)
add_subdirectory(messageviewerheaderplugins)
find_package(Qca-qt5 2.1.0)
set_package_properties(Qca-qt5 PROPERTIES DESCRIPTION "Qt Cryptographic Architecture"
URL "https:/download.kde.org/stable/qca-qt5" TYPE OPTIONAL
PURPOSE "Needed for kdim support.")
if (${Qca-qt5_FOUND})
set(USE_DKIM_CHECKER 1)
if (BUILD_TESTING)
add_subdirectory(dkim-verify/autotests)
add_subdirectory(dkim-verify/tests)
......@@ -240,7 +244,6 @@ set(libmessageviewer_SRCS
qt5_add_resources(libmessageviewer_SRCS messagepartthemes.qrc)
ecm_qt_declare_logging_category(libmessageviewer_SRCS HEADER messageviewer_debug.h IDENTIFIER MESSAGEVIEWER_LOG CATEGORY_NAME org.kde.pim.messageviewer)
#temporary
ecm_qt_declare_logging_category(libmessageviewer_SRCS HEADER messageviewer_dkimcheckerdebug.h IDENTIFIER MESSAGEVIEWER_DKIMCHECKER_LOG CATEGORY_NAME org.kde.pim.messageviewer_dkimchecker)
kconfig_add_kcfg_files(libmessageviewer_SRCS
settings/globalsettings_messageviewer.kcfgc
......
add_definitions( -DDKIM_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data" )
macro(add_messageviewer_dkim_verify_unittest _source)
get_filename_component(_name ${_source} NAME_WE)
ecm_add_test(${_source}
TEST_NAME ${_name}
NAME_PREFIX "messageviewer-"
LINK_LIBRARIES KF5::MessageViewer KF5::WebEngineViewer KF5::Libkleo QGpgme Qt5::Test
LINK_LIBRARIES KF5::MessageViewer KF5::WebEngineViewer KF5::Libkleo QGpgme Qt5::Test qca-qt5 KF5::ItemViews
)
endmacro ()
......
From null@kde.org Sat Aug 24 17:33:32 2019
Return-Path: <kde-commits-bounces@kde.org>
Delivered-To: kde@famillemontel.org
Received: from localhost (HELO queue) (127.0.0.1)
by localhost with SMTP; 24 Aug 2019 19:33:49 +0200
Received: from unknown (HELO output15.mail.ovh.net) (10.108.117.206)
by mail742.ha.ovh.net with AES256-GCM-SHA384 encrypted SMTP; 24 Aug 2019 19:33:49 +0200
Received: from vr51.mail.ovh.net (unknown [10.101.8.51])
by out15.mail.ovh.net (Postfix) with ESMTP id 46G53J6BNFz6D8gd
for <kde@famillemontel.org>; Sat, 24 Aug 2019 17:33:48 +0000 (UTC)
Received: from in20.mail.ovh.net (unknown [10.101.4.20])
by vr51.mail.ovh.net (Postfix) with ESMTP id 46G53C54GQzYFgf6
for <kde@famillemontel.org>; Sat, 24 Aug 2019 17:33:43 +0000 (UTC)
Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=46.43.1.242; helo=letterbox.kde.org; envelope-from=kde-commits-bounces@kde.org; receiver=<UNKNOWN>
Authentication-Results: in20.mail.ovh.net;
dkim=pass (2048-bit key; unprotected) header.d=kde.org header.i=@kde.org header.b="pXHd1xHj";
dkim=pass (1024-bit key; unprotected) header.d=kde.org header.i=@kde.org header.b="HPphw8I7";
dkim-atps=neutral
Received: from letterbox.kde.org (letterbox.kde.org [46.43.1.242])
by in20.mail.ovh.net (Postfix) with ESMTPS id 46G53C3zcGz59nL8
for <kde@famillemontel.org>; Sat, 24 Aug 2019 17:33:43 +0000 (UTC)
Received: from letterbox.kde.org (localhost.kde.org [127.0.0.1])
by letterbox.kde.org (Postfix) with ESMTP id 0CDB82814FB;
Sat, 24 Aug 2019 18:33:43 +0100 (BST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kde.org; s=lists;
t=1566668023; bh=GuaFu5z+mmU6OQesA2h1EXnfGtqEynF8C5YIsBl9bV0=;
h=From:To:Subject:Date:List-Id:List-Unsubscribe:List-Post:List-Help:
List-Subscribe:From;
b=pXHd1xHjXisPW6UBfGTnh2Qte6eCZcRO6nwPlQmOO6KYlIox/RMPSZ/CKPb1RS97I
lKG3AHRTXe03yzrYWtp6rTDXw3rjc9yRHJb4jjJoCd+qhKitMqKprvcMn7157rPiuV
IeDt7oVePMeoJ+OZwa4Bt22jCekgdLUaWOBKJvMv+bvORIbZ9jPXlViF50sagDSHaa
dtFLuLc4XMYwUtU/Qj0i9Dq6UNjOsv+af3WNHMwHg9W/OC/GKRyNiD2MFsgVp5PwhN
+AlEdKyQcxvAbVQEC+JTGaxr+9ZPql/HPHgB9W4V+fsEGoLERsdxIw9oa3Xm4vIdeg
6T177CiPy8zIA==
X-Original-To: kde-commits@kde.org
Delivered-To: kde-commits@localhost
Received: from bluemchen.kde.org (bluemchen.kde.org [IPv6:2001:470:142:8::100])
by letterbox.kde.org (Postfix) with ESMTPS id 143B92814FB
for <kde-commits@kde.org>; Sat, 24 Aug 2019 18:33:34 +0100 (BST)
Authentication-Results: letterbox.kde.org;
dmarc=none (p=none dis=none) header.from=kde.org
Authentication-Results: letterbox.kde.org; spf=pass smtp.mailfrom=null@kde.org
Authentication-Results: letterbox.kde.org; dkim=pass (1024-bit key;
unprotected) header.d=kde.org header.i=@kde.org header.b="HPphw8I7";
dkim-atps=neutral
Received: from code.kde.org (code.kde.org [IPv6:2a01:4f8:171:2687::4])
by bluemchen.kde.org (Postfix) with ESMTPS id 4E922203D6
for <kde-commits@kde.org>; Sat, 24 Aug 2019 13:33:33 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kde.org; s=transact;
t=1566668013; bh=GuaFu5z+mmU6OQesA2h1EXnfGtqEynF8C5YIsBl9bV0=;
h=From:To:Subject:Date:From;
b=HPphw8I7HzXzutAEXxZnKuzLH3zLQUOtaj/zaZEY5lHqa/Yb5jUUTglitPXRN2w9T
v3xSyh93hTSeLSkkfjw10KvtU35tHP49Zolo/5kwo86FLMptaOOroC5RPlwD8uhWZi
Jfr2muLq7SmJqxT34Vtm5SzsvjAPXsMWTUi5cW5g=
Received: from svn by code.kde.org with local (Exim 4.86_2)
(envelope-from <null@kde.org>) id 1i1Zuu-0005wK-D8
for kde-commits@kde.org; Sat, 24 Aug 2019 17:33:32 +0000
From: =?utf-8?q?Antoni=20Bella=20P=C3=A9rez?= <null@kde.org>
To: kde-commits@kde.org
Subject: l10n-kf5/ca/messages/www
X-Commit-Directories: (0) trunk/l10n-kf5/ca/messages/www
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-Id: <E1i1Zuu-0005wK-D8@code.kde.org>
Date: Sat, 24 Aug 2019 17:33:32 +0000
X-Scanned-By: MIMEDefang 2.83 on 46.43.1.242
X-BeenThere: kde-commits@kde.org
X-Mailman-Version: 2.1.26
Precedence: list
List-Id: Notification of KDE commits <kde-commits.kde.org>
List-Unsubscribe: <https://mail.kde.org/mailman/options/kde-commits>,
<mailto:kde-commits-request@kde.org?subject=unsubscribe>
List-Post: <mailto:kde-commits@kde.org>
List-Help: <mailto:kde-commits-request@kde.org?subject=help>
List-Subscribe: <https://mail.kde.org/mailman/listinfo/kde-commits>,
<mailto:kde-commits-request@kde.org?subject=subscribe>
Reply-To: kde-commits@kde.org
Errors-To: kde-commits-bounces@kde.org
Sender: "kde-commits" <kde-commits-bounces@kde.org>
X-Ovh-Remote: 46.43.1.242 (letterbox.kde.org)
X-Ovh-Tracer-Id: 8428205230410539987
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: 0
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrudehtddguddujecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecu
X-Ovh-Spam-Status: OK
X-Ovh-Spam-Reason: vr: OK; dkim: disabled; spf: disabled
X-Ovh-Message-Type: OK
SVN commit 1550342 by bellaperez:
doc_www: Catalan Works
* Updates, fixes from custom pology rules and start the last new translations
M +3 -3 docs_krita_org_KritaFAQ.po
M +6 -6 docs_krita_org_contributors_manual___krita_manual_conventions.po
M +3 -3 docs_krita_org_general_concepts___colors___bit_depth.po
M +3 -3 docs_krita_org_general_concepts___colors___color_mixing.po
M +8 -8 docs_krita_org_general_concepts___colors___scene_linear_painting.po
M +3 -3 docs_krita_org_general_concepts___projection___axonometric.po
M +3 -3 docs_krita_org_general_concepts___projection___perspective.po
M +3 -3 docs_krita_org_reference_manual___brushes___brush_engines___clone_engine.po
M +3 -3 docs_krita_org_reference_manual___brushes___brush_engines___color_smudge_engine.po
M +4 -4 docs_krita_org_reference_manual___brushes___brush_engines___spray_brush_engine.po
M +3 -3 docs_krita_org_reference_manual___brushes___brush_settings___locked_brush_settings.po
M +3 -3 docs_krita_org_reference_manual___dockers___animation_curve.po
M +4 -4 docs_krita_org_reference_manual___dockers___artistic_color_selector.po
M +4 -4 docs_krita_org_reference_manual___dockers___brush_preset_docker.po
M +3 -3 docs_krita_org_reference_manual___dockers___compositions.po
M +3 -3 docs_krita_org_reference_manual___dockers___gamut_mask_docker.po
M +4 -4 docs_krita_org_reference_manual___dockers___layers.po
M +3 -3 docs_krita_org_reference_manual___dockers___overview.po
M +4 -4 docs_krita_org_reference_manual___dockers___palette_docker.po
M +4 -4 docs_krita_org_reference_manual___dockers___pattern_docker.po
M +4 -4 docs_krita_org_reference_manual___dockers___timeline.po
M +3 -3 docs_krita_org_reference_manual___dockers___undo_history.po
M +3 -3 docs_krita_org_reference_manual___instant_preview.po
M +4 -4 docs_krita_org_reference_manual___layers_and_masks___selection_masks.po
M +4 -4 docs_krita_org_reference_manual___layers_and_masks___split_alpha.po
M +3 -3 docs_krita_org_reference_manual___main_menu___settings_menu.po
M +3 -3 docs_krita_org_reference_manual___main_menu___view_menu.po
M +3 -3 docs_krita_org_reference_manual___popup-palette.po
M +3 -3 docs_krita_org_reference_manual___preferences___author_settings.po
M +3 -3 docs_krita_org_reference_manual___preferences___python_plugin_manager.po
M +4 -4 docs_krita_org_reference_manual___resource_management.po
M +4 -4 docs_krita_org_reference_manual___resource_management___resource_gradients.po
M +3 -3 docs_krita_org_reference_manual___split_layer.po
M +3 -3 docs_krita_org_reference_manual___tools___assistant.po
M +3 -3 docs_krita_org_reference_manual___tools___calligraphy.po
M +6 -6 docs_krita_org_reference_manual___tools___colorize_mask.po
M +5 -5 docs_krita_org_reference_manual___tools___contiguous_select.po
M +3 -3 docs_krita_org_reference_manual___tools___dyna.po
M +3 -3 docs_krita_org_reference_manual___tools___ellipse.po
M +5 -5 docs_krita_org_reference_manual___tools___elliptical_select.po
M +3 -3 docs_krita_org_reference_manual___tools___fill.po
M +3 -3 docs_krita_org_reference_manual___tools___freehand_brush.po
M +3 -3 docs_krita_org_reference_manual___tools___freehand_path.po
M +3 -3 docs_krita_org_reference_manual___tools___gradient_draw.po
M +3 -3 docs_krita_org_reference_manual___tools___gradient_edit.po
M +4 -4 docs_krita_org_reference_manual___tools___grid_tool.po
M +4 -4 docs_krita_org_reference_manual___tools___line.po
M +4 -4 docs_krita_org_reference_manual___tools___measure.po
M +3 -3 docs_krita_org_reference_manual___tools___move.po
M +4 -4 docs_krita_org_reference_manual___tools___multibrush.po
M +5 -5 docs_krita_org_reference_manual___tools___outline_select.po
M +5 -5 docs_krita_org_reference_manual___tools___pan.po
M +5 -5 docs_krita_org_reference_manual___tools___path.po
M +5 -5 docs_krita_org_reference_manual___tools___path_select.po
M +3 -3 docs_krita_org_reference_manual___tools___pattern_edit.po
M +3 -3 docs_krita_org_reference_manual___tools___perspective_grid.po
M +4 -4 docs_krita_org_reference_manual___tools___polygon.po
M +5 -5 docs_krita_org_reference_manual___tools___polygonal_select.po
M +3 -3 docs_krita_org_reference_manual___tools___polyline.po
M +4 -4 docs_krita_org_reference_manual___tools___rectangle.po
M +5 -5 docs_krita_org_reference_manual___tools___rectangular_select.po
M +4 -4 docs_krita_org_reference_manual___tools___reference_images_tool.po
M +11 -11 docs_krita_org_reference_manual___tools___shape_edit.po
M +4 -4 docs_krita_org_reference_manual___tools___shape_selection.po
M +5 -5 docs_krita_org_reference_manual___tools___similar_select.po
M +3 -3 docs_krita_org_reference_manual___tools___smart_patch.po
M +6 -6 docs_krita_org_reference_manual___tools___text.po
M +3 -3 docs_krita_org_reference_manual___tools___transform.po
M +6 -6 docs_krita_org_reference_manual___tools___zoom.po
M +8 -7 docs_krita_org_tutorials___common_workflows.po
M +12 -12 docs_krita_org_tutorials___flat-coloring.po
M +90 -7 docs_krita_org_tutorials___inking.po
A docs_krita_org_tutorials___krita-brush-tips.po
A docs_krita_org_tutorials___krita-brush-tips___animated_brushes.po
A docs_krita_org_tutorials___krita-brush-tips___bokeh-brush.po
A docs_krita_org_tutorials___krita-brush-tips___caustics.po
A docs_krita_org_tutorials___krita-brush-tips___fur.po
A docs_krita_org_tutorials___krita-brush-tips___hair.po
A docs_krita_org_tutorials___krita-brush-tips___outline.po
A docs_krita_org_tutorials___krita-brush-tips___rainbow-brush.po
A docs_krita_org_tutorials___krita-brush-tips___sculpt-paint-brush.po
M +6 -6 docs_krita_org_tutorials___making_an_azalea_with_the_transformation_masks.po
M +4 -4 docs_krita_org_user_manual___animation.po
M +5 -5 docs_krita_org_user_manual___getting_started___navigation.po
M +3 -3 docs_krita_org_user_manual___getting_started___starting_krita.po
M +6 -6 docs_krita_org_user_manual___introduction_from_other_software___introduction_from_photoshop.po
M +5 -5 docs_krita_org_user_manual___introduction_from_other_software___introduction_from_sai.po
M +3 -2 docs_krita_org_user_manual___python_scripting___krita_python_plugin_howto.po
M +11 -11 docs_krita_org_user_manual___selections.po
M +3 -3 docs_krita_org_user_manual___vector_graphics.po
http://websvn.kde.org/?view=rev&revision=1550342
From bugzilla_noreply@kde.org Thu Oct 17 09:10:12 2019
Return-Path: <bugzilla_noreply@kde.org>
Delivered-To: kde@famillemontel.org
Received: from localhost (HELO queue) (127.0.0.1)
by localhost with SMTP; 17 Oct 2019 11:11:19 +0200
Received: from unknown (HELO output51.mail.ovh.net) (10.108.97.200)
by mail104.ha.ovh.net with AES256-GCM-SHA384 encrypted SMTP; 17 Oct 2019 11:11:19 +0200
Received: from vr13.mail.ovh.net (unknown [10.101.8.13])
by out51.mail.ovh.net (Postfix) with ESMTP id 46v3LX3g65zBDlRNg
for <kde@famillemontel.org>; Thu, 17 Oct 2019 09:11:16 +0000 (UTC)
Received: from in70.mail.ovh.net (unknown [10.101.4.70])
by vr13.mail.ovh.net (Postfix) with ESMTP id 46v3LX2bGmzwPGt
for <kde@famillemontel.org>; Thu, 17 Oct 2019 09:11:16 +0000 (UTC)
Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=46.43.1.242; helo=letterbox.kde.org; envelope-from=bugzilla_noreply@kde.org; receiver=<UNKNOWN>
Authentication-Results: in70.mail.ovh.net;
dkim=pass (1024-bit key; unprotected) header.d=kde.org header.i=@kde.org header.b="EZ6wCZ9n";
dkim-atps=neutral
Received: from letterbox.kde.org (letterbox.kde.org [46.43.1.242])
by in70.mail.ovh.net (Postfix) with ESMTPS id 46v3LX1XxTzVqdbq
for <kde@famillemontel.org>; Thu, 17 Oct 2019 09:11:16 +0000 (UTC)
Received: from bluemchen.kde.org (bluemchen.kde.org [IPv6:2001:470:142:8::100])
by letterbox.kde.org (Postfix) with ESMTPS id E2D93282897
for <montel@kde.org>; Thu, 17 Oct 2019 10:11:08 +0100 (BST)
Authentication-Results: letterbox.kde.org; dmarc=none (p=none dis=none) header.from=kde.org
Authentication-Results: letterbox.kde.org; spf=pass smtp.mailfrom=bugzilla_noreply@kde.org
Authentication-Results: letterbox.kde.org;
dkim=pass (1024-bit key; unprotected) header.d=kde.org header.i=@kde.org header.b="EZ6wCZ9n";
dkim-atps=neutral
Received: from komaci.kde.org (komaci.kde.org [IPv6:2a01:4f8:171:c9a::4])
by bluemchen.kde.org (Postfix) with ESMTPS id C066720F09
for <montel@kde.org>; Thu, 17 Oct 2019 05:10:13 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kde.org; s=transact;
t=1571303413; bh=HKAXj47vQzqGPsUNjYlOO672cnUBx1pgpWeK3+TYB5M=;
h=From:To:Subject:Date:In-Reply-To:References:From;
b=EZ6wCZ9nJz0kyZUF5G91y68bRVzTWOFBTCK0A/3tdQgkIVHt7d3DkAZX4vzwm23D+
RmleLr64RQeV5xQRaRlWvR60nXgcQBEncB9ddP1mrRmKxgbvdEm4JI3ISmcuQ0hVRe
YJmQj4yUBHOtn+oWRormU5FETRNnjFBhhcb2Ylsw=
Received: from www-data by komaci.kde.org with local (Exim 4.90_1)
(envelope-from <bugzilla_noreply@kde.org>)
id 1iL1nQ-0006wt-SP
for montel@kde.org; Thu, 17 Oct 2019 09:10:12 +0000
From: "Leandro Lucarella" <bugzilla_noreply@kde.org>
To: montel@kde.org
Subject: [kdepim] [Bug 413078] Can't change name of akonadi EWS resource
(sort of)
Date: Thu, 17 Oct 2019 09:10:12 +0000
Reply-To: bug-control@kde.org
X-Bugzilla-Reason: None
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: AssignedTo kdepim-bugs@kde.org
X-Bugzilla-Product: kdepim
X-Bugzilla-Component: general
X-Bugzilla-Version: unspecified
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: leandro.lucarella@quoscient.io
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: NOR
X-Bugzilla-Assigned-To: kdepim-bugs@kde.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-413078-5146-NNgivgOjnR@http.bugs.kde.org/>
In-Reply-To: <bug-413078-5146@http.bugs.kde.org/>
References: <bug-413078-5146@http.bugs.kde.org/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.kde.org/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.83 on 46.43.1.242
X-Ovh-Remote: 46.43.1.242 (letterbox.kde.org)
X-Ovh-Tracer-Id: 3473401216784747731
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: 0
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrjeejgddufecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecu
X-Ovh-Spam-Status: OK
X-Ovh-Spam-Reason: vr: OK; dkim: disabled; spf: disabled
X-Ovh-Message-Type: OK
https://bugs.kde.org/show_bug.cgi?id=3D413078
--- Comment #2 from Leandro Lucarella <leandro.lucarella@quoscient.io> ---
Created attachment 123268
--> https://bugs.kde.org/attachment.cgi?id=3D123268&action=3Dedit
KMail accounts view
--=20
You are receiving this mail because:
You are watching the assignee of the bug.=
This diff is collapsed.
......@@ -19,7 +19,9 @@
#include "dkimchecksignaturejobtest.h"
#include "dkim-verify/dkimchecksignaturejob.h"
#include <QSignalSpy>
#include <QTest>
#include <QTimer>
QTEST_MAIN(DKIMCheckSignatureJobTest)
DKIMCheckSignatureJobTest::DKIMCheckSignatureJobTest(QObject *parent)
......@@ -27,6 +29,17 @@ DKIMCheckSignatureJobTest::DKIMCheckSignatureJobTest(QObject *parent)
{
}
void DKIMCheckSignatureJobTest::initTestCase()
{
mQcaInitializer = new QCA::Initializer(QCA::Practical, 64);
qRegisterMetaType<MessageViewer::DKIMCheckSignatureJob::CheckSignatureResult>();
}
void DKIMCheckSignatureJobTest::cleanupTestCase()
{
delete mQcaInitializer;
}
void DKIMCheckSignatureJobTest::shouldHaveDefaultValues()
{
MessageViewer::DKIMCheckSignatureJob job;
......@@ -42,10 +55,46 @@ void DKIMCheckSignatureJobTest::shouldHaveDefaultValues()
void DKIMCheckSignatureJobTest::shouldTestMail_data()
{
QTest::addColumn<QString>("fileName");
QTest::addRow("test1") << QStringLiteral("foo");
QTest::addColumn<MessageViewer::DKIMCheckSignatureJob::DKIMError>("dkimerror");
QTest::addColumn<MessageViewer::DKIMCheckSignatureJob::DKIMWarning>("dkimwarning");
QTest::addColumn<MessageViewer::DKIMCheckSignatureJob::DKIMStatus>("dkimstatus");
QTest::addRow("dkim2") << QStringLiteral("dkim2.mbox")
<< MessageViewer::DKIMCheckSignatureJob::DKIMError::Any
<< MessageViewer::DKIMCheckSignatureJob::DKIMWarning::Any
<< MessageViewer::DKIMCheckSignatureJob::DKIMStatus::Valid;
QTest::addRow("notsigned") << QStringLiteral("notsigned.mbox")
<< MessageViewer::DKIMCheckSignatureJob::DKIMError::Any
<< MessageViewer::DKIMCheckSignatureJob::DKIMWarning::Any
<< MessageViewer::DKIMCheckSignatureJob::DKIMStatus::EmailNotSigned;
QTest::addRow("broken1") << QStringLiteral("broken1.mbox")
<< MessageViewer::DKIMCheckSignatureJob::DKIMError::Any
<< MessageViewer::DKIMCheckSignatureJob::DKIMWarning::Any
<< MessageViewer::DKIMCheckSignatureJob::DKIMStatus::Valid;
}
void DKIMCheckSignatureJobTest::shouldTestMail()
{
QFETCH(QString, fileName);
QFETCH(MessageViewer::DKIMCheckSignatureJob::DKIMError, dkimerror);
QFETCH(MessageViewer::DKIMCheckSignatureJob::DKIMWarning, dkimwarning);
QFETCH(MessageViewer::DKIMCheckSignatureJob::DKIMStatus, dkimstatus);
KMime::Message *msg = new KMime::Message;
QFile file(QStringLiteral(DKIM_DATA_DIR "/") + fileName);
QVERIFY(file.open(QIODevice::ReadOnly));
msg->setContent(file.readAll());
msg->parse();
MessageViewer::DKIMCheckSignatureJob *job = new MessageViewer::DKIMCheckSignatureJob();
job->setMessage(KMime::Message::Ptr(msg));
job->setSaveKey(false);
QSignalSpy dkimSignatureSpy(job, &MessageViewer::DKIMCheckSignatureJob::result);
QTimer::singleShot(10, job, &MessageViewer::DKIMCheckSignatureJob::start);
QVERIFY(dkimSignatureSpy.wait());
QCOMPARE(dkimSignatureSpy.count(), 1);
const MessageViewer::DKIMCheckSignatureJob::CheckSignatureResult info = dkimSignatureSpy.at(0).at(0).value<MessageViewer::DKIMCheckSignatureJob::CheckSignatureResult>();
QCOMPARE(info.warning, dkimwarning);
QCOMPARE(info.error, dkimerror);
QCOMPARE(info.status, dkimstatus);
}
......@@ -21,7 +21,7 @@
#define DKIMCHECKSIGNATUREJOBTEST_H
#include <QObject>
#include <QtCrypto>
class DKIMCheckSignatureJobTest : public QObject
{
Q_OBJECT
......@@ -32,6 +32,10 @@ private Q_SLOTS:
void shouldHaveDefaultValues();
void shouldTestMail();
void shouldTestMail_data();
void initTestCase();
void cleanupTestCase();
private:
QCA::Initializer *mQcaInitializer = nullptr;
};
#endif // DKIMCHECKSIGNATUREJOBTEST_H
......@@ -33,4 +33,5 @@ void DKIMHeaderParserTest::shouldHaveDefaultValues()
{
MessageViewer::DKIMHeaderParser parser;
QVERIFY(parser.head().isEmpty());
QVERIFY(parser.headerType(QStringLiteral("bla")).isEmpty());
}
......@@ -47,6 +47,7 @@ void DKIMManagerKeyDialogTest::shouldHaveDefaultValue()
MessageViewer::DKIMManagerKeyWidget *w = dlg.findChild<MessageViewer::DKIMManagerKeyWidget *>(QStringLiteral("managerWidget"));
QVERIFY(w);
QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
QVERIFY(buttonBox);
QCOMPARE(buttonBox->standardButtons(), {QDialogButtonBox::Close});
......
......@@ -22,6 +22,7 @@
#include <QTest>
#include <QTreeWidget>
#include <QVBoxLayout>
#include <KTreeWidgetSearchLine>
QTEST_MAIN(DKIMManagerKeyWidgetTest)
DKIMManagerKeyWidgetTest::DKIMManagerKeyWidgetTest(QObject *parent)
: QObject(parent)
......@@ -36,6 +37,12 @@ void DKIMManagerKeyWidgetTest::shouldHaveDefaultValue()
QVERIFY(mainLayout);
QCOMPARE(mainLayout->contentsMargins(), QMargins(0, 0, 0, 0));
KTreeWidgetSearchLine *searchLineEdit = w.findChild<KTreeWidgetSearchLine *>(QStringLiteral("searchlineedit"));
QVERIFY(searchLineEdit);
QVERIFY(searchLineEdit->isClearButtonEnabled());
mainLayout->addWidget(searchLineEdit);
QTreeWidget *mTreeWidget = w.findChild<QTreeWidget *>(QStringLiteral("treewidget"));
QVERIFY(mTreeWidget);
QCOMPARE(mTreeWidget->topLevelItemCount(), 0);
......
......@@ -62,12 +62,12 @@ QString DKIMCheckSignatureJob::headerCanonizationResult() const
void DKIMCheckSignatureJob::start()
{
if (!mMessage) {
mStatus = MessageViewer::DKIMCheckSignatureJob::DKIMStatus::Invalid;
Q_EMIT result(createCheckResult());
deleteLater();
return;
}
// if (!mMessage) {
// mStatus = MessageViewer::DKIMCheckSignatureJob::DKIMStatus::Invalid;
// Q_EMIT result(createCheckResult());
// deleteLater();
// return;
// }
if (mMessageItem.isValid() && !mMessage) {
if (mMessageItem.hasPayload<KMime::Message::Ptr>()) {
mMessage = mMessageItem.payload<KMime::Message::Ptr>();
......@@ -503,7 +503,7 @@ void DKIMCheckSignatureJob::verifyRSASignature()
//TODO
}
if (rsaPublicKey.canVerify()) {
//qDebug() << "mHeaderCanonizationResult " << mHeaderCanonizationResult << " mDkimInfo.signature() " << mDkimInfo.signature().replace(QLatin1Char(' '), QString());
qDebug() << "mHeaderCanonizationResult " << mHeaderCanonizationResult << " mDkimInfo.signature() " << mDkimInfo.signature().replace(QLatin1Char(' '), QString());
const QString s = mDkimInfo.signature().replace(QLatin1Char(' '), QString());
//qDebug() << " s base 64" << s.toLocal8Bit().toBase64();
QCA::SecureArray sec = mHeaderCanonizationResult.toLatin1();
......
......@@ -151,5 +151,5 @@ private:
bool mSaveKey = false;
};
}
Q_DECLARE_METATYPE(MessageViewer::DKIMCheckSignatureJob::CheckSignatureResult)
#endif // DKIMCHECKSIGNATUREJOB_H
......@@ -20,7 +20,6 @@
#include "dkimheaderparser.h"
#include <QChar>
#include <KCodecs>
#include <QDebug>
using namespace MessageViewer;
......@@ -75,12 +74,14 @@ MessageViewer::DKIMHeaderParser::Header *DKIMHeaderParser::extractHeader(const Q
header->headerName = QString::fromLatin1(QByteArray::fromRawData(rawType, rawTypeLen)).toLower();
if (folded) {
const auto unfoldedBody = unfoldHeader(head.constData() + startOfFieldBody, endOfFieldBody - startOfFieldBody);
const QString str = KCodecs::decodeRFC2047String(unfoldedBody, &header->codec, QByteArrayLiteral("ISO-8859-1"));
header->HeaderValue = str;
//qDebug() << " unfoldedBody" << unfoldedBody;
//const QString str = KCodecs::decodeRFC2047String(unfoldedBody, &header->codec, QByteArrayLiteral("ISO-8859-1"));
header->HeaderValue = QString::fromLatin1(unfoldedBody);
} else {
QByteArray ba = QByteArray::fromRawData(head.constData() + startOfFieldBody, endOfFieldBody - startOfFieldBody);
const QString str = KCodecs::decodeRFC2047String(ba, &header->codec, QByteArrayLiteral("ISO-8859-1"));
header->HeaderValue = str;
const QByteArray ba = QByteArray::fromRawData(head.constData() + startOfFieldBody, endOfFieldBody - startOfFieldBody);
//qDebug() << " unfoldedBody ba" << ba;
//const QString str = KCodecs::decodeRFC2047String(ba, &header->codec, QByteArrayLiteral("ISO-8859-1"));
header->HeaderValue = QString::fromLatin1(ba);
}
return header;
}
......@@ -204,11 +205,10 @@ int DKIMHeaderParser::findHeaderLineEnd(const QByteArray &src, int &dataBegin, b
QString DKIMHeaderParser::headerType(const QString &str)
{
for (int i = mListHeaders.count() -1; i >= 0; --i) {
qDebug() << " mListHeaders.at(i)->headerName" <<mListHeaders.at(i)->headerName;
if (mListHeaders.at(i)->headerName == str) {
DKIMHeaderParser::Header *header = mListHeaders.takeAt(i);
const QString headerValue = header->HeaderValue;
delete header;
delete header; //Delete it as we want to use one time each header.
return headerValue;
}
}
......
......@@ -18,7 +18,7 @@
*/
#include "dkimmanager.h"
#include "messageviewer_dkimcheckerdebug.h"
#include "dkimmanagerkey.h"
#include "dkimresultattribute.h"
#include "dkimstoreresultjob.h"
......@@ -45,6 +45,7 @@ void DKIMManager::checkDKim(const Akonadi::Item &item)
{
if (MessageViewer::MessageViewerSettings::self()->saveDkimResult()) {
if (item.hasAttribute<MessageViewer::DKIMResultAttribute>()) {
qDebug() << " HAS ATTRIBUTE";
const MessageViewer::DKIMResultAttribute *const attr
= item.attribute<MessageViewer::DKIMResultAttribute>();
if (attr) {
......@@ -53,7 +54,7 @@ void DKIMManager::checkDKim(const Akonadi::Item &item)
checkResult.error = static_cast<DKIMCheckSignatureJob::DKIMError>(attr->error());
checkResult.warning = static_cast<DKIMCheckSignatureJob::DKIMWarning>(attr->warning());
checkResult.status = static_cast<DKIMCheckSignatureJob::DKIMStatus>(attr->status());
qDebug() << "result : status " << (int)checkResult.status << " error : " << (int)checkResult.error << " warning " << (int)checkResult.warning;
qCDebug(MESSAGEVIEWER_DKIMCHECKER_LOG) << "result : status " << checkResult.status << " error : " << checkResult.error << " warning " << checkResult.warning;
Q_EMIT result(checkResult);
return;
}
......@@ -77,6 +78,7 @@ void DKIMManager::checkDKim(const KMime::Message::Ptr &message)
DKIMCheckSignatureJob *job = new DKIMCheckSignatureJob(this);
connect(job, &DKIMCheckSignatureJob::storeKey, this, &DKIMManager::storeKey);
connect(job, &DKIMCheckSignatureJob::result, this, &DKIMManager::slotResult);
job->setSaveKey(MessageViewer::MessageViewerSettings::self()->saveKey());
job->setMessage(message);
job->start();
}
......@@ -98,6 +100,6 @@ void DKIMManager::slotResult(const DKIMCheckSignatureJob::CheckSignatureResult &
job->start();
}
}
qDebug() << "result : status " << checkResult.status << " error : " << checkResult.error << " warning " << checkResult.warning;
qCDebug(MESSAGEVIEWER_DKIMCHECKER_LOG) << "result : status " << checkResult.status << " error : " << checkResult.error << " warning " << checkResult.warning;
Q_EMIT result(checkResult);
}
......@@ -24,7 +24,7 @@
#include <QVBoxLayout>
#include <KLocalizedString>
#include <QMenu>
#include <KTreeWidgetSearchLine>
using namespace MessageViewer;
DKIMManagerKeyWidget::DKIMManagerKeyWidget(QWidget *parent)