Page MenuHome GnuPG

No OneTemporary

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5bfe6163a..3cde48054 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,251 +1,251 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(RELEASE_SERVICE_VERSION_MAJOR "26")
set(RELEASE_SERVICE_VERSION_MINOR "03")
set(RELEASE_SERVICE_VERSION_MICRO "70")
set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
if(RELEASE_SERVICE_VERSION_MICRO LESS 10)
set(KDE_APPLICATIONS_COMPACT_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}${RELEASE_SERVICE_VERSION_MINOR}0${RELEASE_SERVICE_VERSION_MICRO}")
else()
set(KDE_APPLICATIONS_COMPACT_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}${RELEASE_SERVICE_VERSION_MINOR}${RELEASE_SERVICE_VERSION_MICRO}")
endif()
set(KLEOPATRA_VERSION_MAJOR "4")
set(KLEOPATRA_VERSION_MINOR "0")
set(KLEOPATRA_VERSION_MICRO "0")
set(kleopatra_version "${KLEOPATRA_VERSION_MAJOR}.${KLEOPATRA_VERSION_MINOR}.${KLEOPATRA_VERSION_MICRO}.${KDE_APPLICATIONS_COMPACT_VERSION}")
# KLEOPATRA_VERSION_STRING is used for the About data; Gpg4win sets it to a custom value
if (NOT KLEOPATRA_VERSION_STRING)
set(KLEOPATRA_VERSION_STRING "${kleopatra_version}")
endif()
# The following is for Windows
set(kleopatra_version_win "${KLEOPATRA_VERSION_MAJOR}.${KLEOPATRA_VERSION_MINOR}.${KLEOPATRA_VERSION_MICRO}")
set(kleopatra_fileversion_win "${KLEOPATRA_VERSION_MAJOR},${KLEOPATRA_VERSION_MINOR},${KLEOPATRA_VERSION_MICRO},0")
if (NOT KLEOPATRA_DISTRIBUTION_TEXT)
# This is only used on Windows for the file attributes of Kleopatra
set(KLEOPATRA_DISTRIBUTION_TEXT "KDE")
endif()
-if (NOT KLEOPATRA_APPLICATION_NAME)
+if (NOT KLEOPATRA_ORGANIZATION_DOMAIN)
# This is used to allow multiple flavors of Kleopatra to run at the same time on Windows
- set(KLEOPATRA_APPLICATION_NAME "kleopatra")
+ set(KLEOPATRA_ORGANIZATION_DOMAIN "kde.org")
endif()
if (KLEOPATRA_LIST_AS_COMPONENT)
set(KLEOPATRA_LIST_AS_COMPONENT 1)
endif()
project(kleopatra VERSION ${kleopatra_version})
option(DISABLE_KWATCHGNUPG "Don't build the kwatchgnupg tool [default=OFF]" OFF)
# Standalone build. Find / include everything necessary.
set(KF_MIN_VERSION "6.20.0")
set(KIDENTITYMANAGEMENT_VERSION "6.6.40")
set(KMAILTRANSPORT_VERSION "6.6.40")
set(AKONADI_MIME_VERSION "6.6.40")
set(KMIME_VERSION "6.6.40")
set(LIBKLEO_VERSION "6.6.41")
set(QT_REQUIRED_VERSION "6.7.0")
set(MIMETREEPARSER_VERSION "6.6.40")
set(GPGME_REQUIRED_VERSION "1.23.2")
set(LIBASSUAN_REQUIRED_VERSION "2.4.2")
set(GPG_ERROR_REQUIRED_VERSION "1.36")
if (WIN32)
set(KF6_WANT_VERSION ${KF_MIN_VERSION})
set(KMIME_WANT_VERSION ${KMIME_VERSION})
else ()
set(KF6_WANT_VERSION ${KF_MIN_VERSION})
set(KMIME_WANT_VERSION ${KMIME_VERSION})
endif ()
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
find_package(ECM ${KF6_WANT_VERSION} CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
include(ECMInstallIcons)
include(ECMSetupVersion)
include(ECMAddTests)
include(GenerateExportHeader)
include(ECMGenerateHeaders)
include(CheckFunctionExists)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMAddAppIcon)
include(ECMQtDeclareLoggingCategory)
include(ECMDeprecationSettings)
include(ECMFeatureSummary)
include(KDEClangFormat)
include(KDEGitCommitHooks)
# Find KF6 packages
find_package(KF6 ${KF6_WANT_VERSION}
REQUIRED COMPONENTS
Codecs
ColorScheme
Config
CoreAddons
Crash
I18n
IconThemes
ItemModels
KIO
WidgetsAddons
WindowSystem
XmlGui
OPTIONAL_COMPONENTS
DocTools
)
set_package_properties(KF6DocTools PROPERTIES
DESCRIPTION "Documentation tools"
PURPOSE "Required to generate Kleopatra documentation."
TYPE OPTIONAL)
# Optional packages
# shall we use DBus?
# enabled per default on Linux & BSD systems
set(USE_DBUS_DEFAULT OFF)
if(UNIX AND NOT APPLE AND NOT ANDROID AND NOT HAIKU)
set(USE_DBUS_DEFAULT ON)
endif()
option(USE_DBUS "Build components using DBus (used for interprocess communication, external open in same instance and various presentation related bits)" ${USE_DBUS_DEFAULT})
if(USE_DBUS)
find_package(KF6DBusAddons ${KF6_WANT_VERSION} CONFIG REQUIRED)
set(_kleopatra_dbusaddons_libs KF6::DBusAddons)
set(HAVE_QDBUS 1)
endif()
find_package(Gpgmepp ${GPGME_REQUIRED_VERSION} CONFIG REQUIRED)
set(QGPGME_NAME "QGpgmeQt6")
find_package(${QGPGME_NAME} ${GPGME_REQUIRED_VERSION} CONFIG REQUIRED)
if (${QGPGME_NAME}_VERSION VERSION_GREATER_EQUAL "1.24.0")
set(QGPGME_FILE_JOBS_SUPPORT_DIRECT_FILE_IO 1)
set(QGPGME_IMPORT_JOB_SUPPORTS_IMPORT_OPTIONS 1)
set(QGPGME_SUPPORTS_PROCESS_ALL_SIGNATURES 1)
endif()
find_package(KPim6Libkleo ${LIBKLEO_VERSION} CONFIG REQUIRED)
find_package(KPim6Mime ${KMIME_WANT_VERSION} CONFIG REQUIRED)
find_package(KPim6IdentityManagementCore ${KIDENTITYMANAGEMENT_VERSION} CONFIG)
find_package(KPim6MailTransport ${KMAILTRANSPORT_VERSION} CONFIG)
find_package(KPim6AkonadiMime ${AKONADI_MIME_VERSION} CONFIG)
find_package(KPim6MimeTreeParserWidgets ${MIMETREEPARSER_VERSION} CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${LIBKLEO_MODULE_PATH} ${CMAKE_MODULE_PATH})
find_package(Qt6 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test Network PrintSupport)
find_package(LibAssuan ${LIBASSUAN_REQUIRED_VERSION} REQUIRED)
set_package_properties(LibAssuan PROPERTIES
TYPE REQUIRED
PURPOSE "Needed for Kleopatra to act as the GnuPG UI Server"
)
find_package(LibGpgError ${GPG_ERROR_REQUIRED_VERSION} REQUIRED)
set(kleopatra_release FALSE)
if(NOT kleopatra_release)
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE rc
ERROR_QUIET)
if(rc EQUAL 0)
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --oneline --format=%h ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE Kleopatra_WC_REVISION)
string(REGEX REPLACE "\n" "" Kleopatra_WC_REVISION "${Kleopatra_WC_REVISION}")
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --oneline --format=%cI ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE Kleopatra_WC_LAST_CHANGED_DATE)
string(REGEX REPLACE "^([0-9]+)-([0-9]+)-([0-9]+)T([0-9]+):([0-9]+):([0-9]+).*$" "\\1\\2\\3T\\4\\5\\6"
Kleopatra_WC_LAST_CHANGED_DATE "${Kleopatra_WC_LAST_CHANGED_DATE}")
set(KLEOPATRA_VERSION_STRING "${KLEOPATRA_VERSION_STRING}+git${Kleopatra_WC_LAST_CHANGED_DATE}~${Kleopatra_WC_REVISION}")
endif()
endif()
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/VERSION)
file(STRINGS ${CMAKE_SOURCE_DIR}/VERSION lines)
list(GET lines 1 kleopatra_commit_id)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version-kleopatra.h.in ${CMAKE_CURRENT_BINARY_DIR}/version-kleopatra.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-kleopatra.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-kleopatra.h)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
add_definitions(-DQT_NO_CONTEXTLESS_CONNECT)
ecm_set_disabled_deprecation_versions(QT 6.10.0 KF 6.21.0)
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-braces -Wno-parentheses -Wno-ignored-qualifiers")
endif()
if(MINGW)
# we do not care about different signedness of passed pointer arguments
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-pointer-sign>)
endif()
add_definitions(-DQT_NO_EMIT)
remove_definitions(-DQT_NO_FOREACH)
# Disable the use of QStringBuilder for operator+ to prevent crashes when
# returning the result of concatenating string temporaries in lambdas. We do
# this for example in some std::transform expressions.
# This is a known issue: https://bugreports.qt.io/browse/QTBUG-47066
# Alternatively, one would always have to remember to force the lambdas to
# return a QString instead of QStringBuilder, but that's just too easy to
# forget and, unfortunately, the compiler doesn't issue a warning if one forgets
# this. So, it's just too dangerous.
# One can still use QStringBuilder explicitly with the operator% if necessary.
remove_definitions(-DQT_USE_FAST_OPERATOR_PLUS)
remove_definitions(-DQT_USE_QSTRINGBUILDER)
kde_enable_exceptions()
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" OFF)
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT OFF)
if (USE_UNITY_CMAKE_SUPPORT)
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT ON)
endif()
add_subdirectory(src)
if(BUILD_TESTING)
add_subdirectory(tests)
add_subdirectory(autotests)
endif()
ecm_qt_install_logging_categories(
EXPORT KLEOPATRA
FILE kleopatra.categories
DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
)
ki18n_install(po)
if(KF6DocTools_FOUND)
kdoctools_install(po)
add_subdirectory(doc)
endif()
ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
# add clang-format target for all our real source files
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h *.c)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
diff --git a/config-kleopatra.h.in b/config-kleopatra.h.in
index 2762482e8..a574340ed 100644
--- a/config-kleopatra.h.in
+++ b/config-kleopatra.h.in
@@ -1,16 +1,16 @@
-#cmakedefine KLEOPATRA_APPLICATION_NAME "@KLEOPATRA_APPLICATION_NAME@"
+#cmakedefine KLEOPATRA_ORGANIZATION_DOMAIN "@KLEOPATRA_ORGANIZATION_DOMAIN@"
/* Whether Kleopatra itself shall be listed as component in About data; used by Gpg4win */
#cmakedefine01 KLEOPATRA_LIST_AS_COMPONENT
/* DBus available */
#cmakedefine01 HAVE_QDBUS
/* Whether the normal encrypt/decrypt/sign/verify jobs support direct file IO */
#cmakedefine01 QGPGME_FILE_JOBS_SUPPORT_DIRECT_FILE_IO
/* Whether ImportJob::setImportOptions exists */
#cmakedefine01 QGPGME_IMPORT_JOB_SUPPORTS_IMPORT_OPTIONS
/* Whether the verify jobs have setProcessAllSignatures. */
#cmakedefine01 QGPGME_SUPPORTS_PROCESS_ALL_SIGNATURES
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index eacd2a230..208a63599 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,630 +1,629 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(mimetypes)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
if (NOT DISABLE_KWATCHGNUPG)
add_subdirectory(kwatchgnupg)
endif()
add_subdirectory(conf)
if(WIN32)
set(_kleopatra_extra_uiserver_SRCS uiserver/uiserver_win.cpp)
set(_kleopatra_extra_SRCS
pics/gpg4win.qrc
selftest/registrycheck.cpp selftest/registrycheck.h
utils/gnupg-registry.c
utils/userinfo_win.cpp
utils/winapi-helpers.cpp utils/winapi-helpers.h
utils/windowsprocessdevice.cpp utils/windowsprocessdevice.h
versioninfo.rc kleopatra.w32-manifest
)
else()
set(_kleopatra_extra_uiserver_SRCS uiserver/uiserver_unix.cpp)
set(_kleopatra_extra_SRCS)
endif()
set(_kleopatra_uiserver_SRCS
${_kleopatra_extra_uiserver_SRCS}
selftest/uiservercheck.cpp selftest/uiservercheck.h
uiserver/assuanserverconnection.cpp uiserver/assuanserverconnection.h
uiserver/createchecksumscommand.cpp uiserver/createchecksumscommand.h
uiserver/decryptverifycommandemailbase.cpp uiserver/decryptverifycommandemailbase.h
uiserver/decryptverifycommandfilesbase.cpp uiserver/decryptverifycommandfilesbase.h
uiserver/echocommand.cpp uiserver/echocommand.h
uiserver/encryptcommand.cpp uiserver/encryptcommand.h
uiserver/importfilescommand.cpp uiserver/importfilescommand.h
uiserver/prepencryptcommand.cpp uiserver/prepencryptcommand.h
uiserver/prepsigncommand.cpp uiserver/prepsigncommand.h
uiserver/selectcertificatecommand.cpp
uiserver/sessiondata.cpp uiserver/sessiondata.h
uiserver/signcommand.cpp uiserver/signcommand.h
uiserver/signencryptfilescommand.cpp
uiserver/uiserver.cpp
uiserver/verifychecksumscommand.cpp uiserver/verifychecksumscommand.h
)
set(_kleopatra_uiserver_extra_libs LibAssuan::LibAssuan LibGpgError::LibGpgError)
if(HAVE_GPG_ERR_SOURCE_KLEO)
add_definitions(-DGPG_ERR_SOURCE_DEFAULT=GPG_ERR_SOURCE_KLEO)
add_definitions(-DGPGMEPP_ERR_SOURCE_DEFAULT=GPG_ERR_SOURCE_KLEO)
else()
add_definitions(-DGPG_ERR_SOURCE_DEFAULT=GPG_ERR_SOURCE_USER_1)
add_definitions(-DGPGMEPP_ERR_SOURCE_DEFAULT=GPG_ERR_SOURCE_USER_1)
endif()
if(KPim6IdentityManagementCore_FOUND AND KPim6MailTransport_FOUND AND KPim6AkonadiMime_FOUND)
set(_kleopatra_mail_libs
KPim6::IdentityManagementCore # Export OpenPGP keys using WKS
KPim6::MailTransport
KPim6::AkonadiMime
)
add_definitions(-DMAILAKONADI_ENABLED)
endif()
ki18n_wrap_ui(_kleopatra_uiserver_SRCS crypto/gui/signingcertificateselectionwidget.ui)
-configure_file(kleopatra.qrc.in kleopatra.qrc @ONLY)
set(_kleopatra_SRCS
${_kleopatra_extra_SRCS}
accessibility/accessiblelink.cpp
accessibility/accessiblelink_p.h
accessibility/accessiblerichtextlabel.cpp
accessibility/accessiblerichtextlabel_p.h
accessibility/accessiblevaluelabel.cpp
accessibility/accessiblevaluelabel_p.h
accessibility/accessiblewidgetfactory.cpp
accessibility/accessiblewidgetfactory.h
commands/addadskcommand.cpp
commands/addadskcommand.h
commands/addsubkeycommand.cpp
commands/addsubkeycommand.h
commands/adduseridcommand.cpp
commands/adduseridcommand.h
commands/authenticatepivcardapplicationcommand.cpp
commands/authenticatepivcardapplicationcommand.h
commands/cardcommand.cpp
commands/cardcommand.h
commands/certificatetocardcommand.cpp
commands/certificatetocardcommand.h
commands/certificatetopivcardcommand.cpp
commands/certificatetopivcardcommand.h
commands/certifycertificatecommand.cpp
commands/certifycertificatecommand.h
commands/certifygroupcommand.cpp
commands/certifygroupcommand.h
commands/changeexpirycommand.cpp
commands/changeexpirycommand.h
commands/changeownertrustcommand.cpp
commands/changeownertrustcommand.h
commands/changepassphrasecommand.cpp
commands/changepassphrasecommand.h
commands/changepincommand.cpp
commands/changepincommand.h
commands/changeroottrustcommand.cpp
commands/changeroottrustcommand.h
commands/checksumcreatefilescommand.cpp
commands/checksumcreatefilescommand.h
commands/checksumverifyfilescommand.cpp
commands/checksumverifyfilescommand.h
commands/clearcrlcachecommand.cpp
commands/clearcrlcachecommand.h
commands/command.cpp
commands/command.h
commands/createcsrforcardkeycommand.cpp
commands/createcsrforcardkeycommand.h
commands/creategroupcommand.cpp
commands/creategroupcommand.h
commands/createopenpgpkeyfromcardkeyscommand.cpp
commands/createopenpgpkeyfromcardkeyscommand.h
commands/decryptverifyclipboardcommand.cpp
commands/decryptverifyclipboardcommand.h
commands/decryptverifyfilescommand.cpp
commands/decryptverifyfilescommand.h
commands/deletecertificatescommand.cpp
commands/deletecertificatescommand.h
commands/detailscommand.cpp
commands/detailscommand.h
commands/dumpcertificatecommand.cpp
commands/dumpcertificatecommand.h
commands/dumpcrlcachecommand.cpp
commands/dumpcrlcachecommand.h
commands/exportcertificatecommand.cpp
commands/exportcertificatecommand.h
commands/exportgroupscommand.cpp
commands/exportgroupscommand.h
commands/exportopenpgpcertstoservercommand.cpp
commands/exportopenpgpcertstoservercommand.h
commands/exportopenpgpcerttoprovidercommand.cpp
commands/exportopenpgpcerttoprovidercommand.h
commands/exportpaperkeycommand.cpp
commands/exportpaperkeycommand.h
commands/exportsecretkeycommand.cpp
commands/exportsecretkeycommand.h
commands/exportsecretsubkeycommand.cpp
commands/exportsecretsubkeycommand.h
commands/exportsecretteamkeycommand.cpp
commands/exportsecretteamkeycommand.h
commands/generateopenpgpcardkeysandcertificatecommand.cpp
commands/generateopenpgpcardkeysandcertificatecommand.h
commands/genrevokecommand.cpp
commands/genrevokecommand.h
commands/gnupgprocesscommand.cpp
commands/gnupgprocesscommand.h
commands/importcertificatefromclipboardcommand.cpp
commands/importcertificatefromclipboardcommand.h
commands/importcertificatefromdatacommand.cpp
commands/importcertificatefromdatacommand.h
commands/importcertificatefromfilecommand.cpp
commands/importcertificatefromfilecommand.h
commands/importcertificatefromkeyservercommand.cpp
commands/importcertificatefromkeyservercommand.h
commands/importcertificatefrompivcardcommand.cpp
commands/importcertificatefrompivcardcommand.h
commands/importcertificatescommand.cpp
commands/importcertificatescommand.h
commands/importcrlcommand.cpp
commands/importcrlcommand.h
commands/importpaperkeycommand.cpp
commands/importpaperkeycommand.h
commands/keytocardcommand.cpp
commands/keytocardcommand.h
commands/lookupcertificatescommand.cpp
commands/lookupcertificatescommand.h
commands/newcertificatesigningrequestcommand.cpp
commands/newcertificatesigningrequestcommand.h
commands/newopenpgpcertificatecommand.cpp
commands/newopenpgpcertificatecommand.h
commands/openpgpgeneratecardkeycommand.cpp
commands/openpgpgeneratecardkeycommand.h
commands/pivgeneratecardkeycommand.cpp
commands/pivgeneratecardkeycommand.h
commands/refreshcertificatescommand.cpp
commands/refreshcertificatescommand.h
commands/reloadkeyscommand.cpp
commands/reloadkeyscommand.h
commands/revokecertificationcommand.cpp
commands/revokecertificationcommand.h
commands/revokekeycommand.cpp
commands/revokekeycommand.h
commands/revokeuseridcommand.cpp
commands/revokeuseridcommand.h
commands/selftestcommand.cpp
commands/selftestcommand.h
commands/setinitialpincommand.cpp
commands/setinitialpincommand.h
commands/setpivcardapplicationadministrationkeycommand.cpp
commands/setpivcardapplicationadministrationkeycommand.h
commands/setprimaryuseridcommand.cpp
commands/setprimaryuseridcommand.h
commands/signencryptclipboardcommand.cpp
commands/signencryptclipboardcommand.h
commands/signencryptfilescommand.cpp
commands/signencryptfilescommand.h
commands/signencryptfoldercommand.cpp
commands/signencryptfoldercommand.h
commands/togglecertificateenabledcommand.cpp
commands/togglecertificateenabledcommand.h
commands/viewemailfilescommand.cpp
commands/viewemailfilescommand.h
conf/configuredialog.cpp
conf/configuredialog.h
conf/groupsconfigdialog.cpp
conf/groupsconfigdialog.h
conf/groupsconfigwidget.cpp
conf/groupsconfigwidget.h
crypto/decryptverifyfilescontroller.cpp
crypto/decryptverifyfilescontroller.h
crypto/certificateresolver.cpp
crypto/certificateresolver.h
crypto/checksumsutils_p.cpp
crypto/checksumsutils_p.h
crypto/controller.cpp
crypto/controller.h
crypto/createchecksumscontroller.cpp
crypto/createchecksumscontroller.h
crypto/decryptverifyemailcontroller.cpp
crypto/decryptverifyemailcontroller.h
crypto/decryptverifytask.cpp
crypto/decryptverifytask.h
crypto/encryptemailcontroller.cpp
crypto/encryptemailcontroller.h
crypto/encryptemailtask.cpp
crypto/encryptemailtask.h
crypto/gui/certificatelineedit.cpp
crypto/gui/certificatelineedit.h
crypto/gui/certificateselectionline.cpp
crypto/gui/certificateselectionline.h
crypto/gui/decryptverifyfilesdialog.cpp
crypto/gui/decryptverifyfilesdialog.h
crypto/gui/encryptemailwizard.cpp
crypto/gui/encryptemailwizard.h
crypto/gui/newresultpage.cpp
crypto/gui/newresultpage.h
crypto/gui/objectspage.cpp
crypto/gui/objectspage.h
crypto/gui/resolverecipientspage.cpp
crypto/gui/resolverecipientspage.h
crypto/gui/resultitemwidget.cpp
crypto/gui/resultitemwidget.h
crypto/gui/resultlistwidget.cpp
crypto/gui/resultlistwidget.h
crypto/gui/resultpage.cpp
crypto/gui/resultpage.h
crypto/gui/signemailwizard.cpp
crypto/gui/signemailwizard.h
crypto/gui/signencryptemailconflictdialog.cpp
crypto/gui/signencryptemailconflictdialog.h
crypto/gui/signencryptfilesdialog.cpp
crypto/gui/signencryptfilesdialog.h
crypto/gui/signencryptwidget.cpp
crypto/gui/signencryptwidget.h
crypto/gui/signencryptwizard.cpp
crypto/gui/signencryptwizard.h
crypto/gui/signerresolvepage.cpp
crypto/gui/signerresolvepage.h
crypto/gui/signingcertificateselectiondialog.cpp
crypto/gui/signingcertificateselectiondialog.h
crypto/gui/signingcertificateselectionwidget.cpp
crypto/gui/signingcertificateselectionwidget.h
crypto/gui/unknownrecipientwidget.cpp
crypto/gui/unknownrecipientwidget.h
crypto/gui/verifychecksumsdialog.cpp
crypto/gui/verifychecksumsdialog.h
crypto/gui/wizard.cpp
crypto/gui/wizard.h
crypto/gui/wizardpage.cpp
crypto/gui/wizardpage.h
crypto/newsignencryptemailcontroller.cpp
crypto/newsignencryptemailcontroller.h
crypto/recipient.cpp
crypto/recipient.h
crypto/sender.cpp
crypto/sender.h
crypto/signemailcontroller.cpp
crypto/signemailcontroller.h
crypto/signemailtask.cpp
crypto/signemailtask.h
crypto/signencryptfilescontroller.cpp
crypto/signencryptfilescontroller.h
crypto/signencrypttask.cpp
crypto/signencrypttask.h
crypto/task.cpp
crypto/task.h
crypto/taskcollection.cpp
crypto/taskcollection.h
crypto/verifychecksumscontroller.cpp
crypto/verifychecksumscontroller.h
dialogs/addsubkeydialog.cpp
dialogs/addsubkeydialog.h
dialogs/adduseriddialog.cpp
dialogs/adduseriddialog.h
dialogs/certificatedetailsdialog.cpp
dialogs/certificatedetailsdialog.h
dialogs/certificatedetailswidget.cpp
dialogs/certificatedetailswidget.h
dialogs/certificatedumpwidget.cpp
dialogs/certificatedumpwidget.h
dialogs/certificateselectiondialog.cpp
dialogs/certificateselectiondialog.h
dialogs/certifycertificatedialog.cpp
dialogs/certifycertificatedialog.h
dialogs/certifywidget.cpp
dialogs/certifywidget.h
dialogs/createcsrdialog.cpp
dialogs/createcsrdialog.h
dialogs/copytosmartcarddialog.cpp
dialogs/copytosmartcarddialog.h
dialogs/debugdialog.cpp
dialogs/debugdialog.h
dialogs/deletecertificatesdialog.cpp
dialogs/deletecertificatesdialog.h
dialogs/editgroupdialog.cpp
dialogs/editgroupdialog.h
dialogs/expirydialog.cpp
dialogs/expirydialog.h
dialogs/exportdialog.cpp
dialogs/exportdialog.h
dialogs/gencardkeydialog.cpp
dialogs/gencardkeydialog.h
dialogs/groupdetailsdialog.cpp
dialogs/groupdetailsdialog.h
dialogs/importedcertificatesdialog.cpp
dialogs/importedcertificatesdialog.h
dialogs/lookupcertificatesdialog.cpp
dialogs/lookupcertificatesdialog.h
dialogs/padwindow.cpp
dialogs/padwindow.h
dialogs/pivcardapplicationadministrationkeyinputdialog.cpp
dialogs/pivcardapplicationadministrationkeyinputdialog.h
dialogs/revokekeydialog.cpp
dialogs/revokekeydialog.h
dialogs/revokerswidget.cpp
dialogs/revokerswidget.h
dialogs/selftestdialog.cpp
dialogs/selftestdialog.h
dialogs/setinitialpindialog.cpp
dialogs/setinitialpindialog.h
dialogs/signencryptclipboarddialog.cpp
dialogs/signencryptclipboarddialog.h
dialogs/smartcardwindow.cpp
dialogs/smartcardwindow.h
dialogs/subkeyswidget.cpp
dialogs/subkeyswidget.h
dialogs/trustchainwidget.cpp
dialogs/trustchainwidget.h
dialogs/updatenotification.cpp
dialogs/updatenotification.h
dialogs/useridswidget.cpp
dialogs/useridswidget.h
dialogs/weboftrustwidget.cpp
dialogs/weboftrustwidget.h
interfaces/anchorprovider.h
interfaces/focusfirstchild.h
selftest/compliancecheck.cpp
selftest/compliancecheck.h
selftest/enginecheck.cpp
selftest/enginecheck.h
selftest/gpgagentcheck.cpp
selftest/gpgagentcheck.h
selftest/gpgconfcheck.cpp
selftest/gpgconfcheck.h
selftest/libkleopatrarccheck.cpp
selftest/libkleopatrarccheck.h
selftest/selftest.cpp
selftest/selftest.h
selftest/testuiserver.cpp
selftest/testuiserver.h
smartcard/algorithminfo.h
smartcard/card.cpp
smartcard/card.h
smartcard/deviceinfowatcher.cpp
smartcard/deviceinfowatcher.h
smartcard/keypairinfo.cpp
smartcard/keypairinfo.h
smartcard/netkeycard.cpp
smartcard/netkeycard.h
smartcard/openpgpcard.cpp
smartcard/openpgpcard.h
smartcard/p15card.cpp
smartcard/p15card.h
smartcard/pivcard.cpp
smartcard/pivcard.h
smartcard/readerstatus.cpp
smartcard/readerstatus.h
smartcard/utils.cpp
smartcard/utils.h
utils/accessibility.cpp
utils/accessibility.h
utils/action_data.cpp
utils/action_data.h
utils/applicationstate.cpp
utils/applicationstate.h
utils/archivedefinition.cpp
utils/archivedefinition.h
utils/certificatepair.h
utils/clipboardmenu.cpp
utils/clipboardmenu.h
utils/csrutils.cpp
utils/csrutils.h
utils/debug-helpers.cpp
utils/debug-helpers.h
utils/dragqueen.cpp
utils/dragqueen.h
utils/email.cpp
utils/email.h
utils/emptypassphraseprovider.cpp
utils/emptypassphraseprovider.h
utils/filedialog.cpp
utils/filedialog.h
utils/fileutils.cpp
utils/fileutils.h
utils/gui-helper.cpp
utils/gui-helper.h
utils/headerview.cpp
utils/headerview.h
utils/input.cpp
utils/input.h
utils/iodevicelogger.cpp
utils/iodevicelogger.h
utils/kdpipeiodevice.cpp
utils/kdpipeiodevice.h
utils/keyexportdraghandler.cpp
utils/keyexportdraghandler.h
utils/kuniqueservice.cpp
utils/kuniqueservice.h
utils/log.cpp
utils/log.h
utils/memory-helpers.h
utils/migration.cpp
utils/migration.h
utils/output.cpp
utils/output.h
utils/overwritedialog.cpp
utils/overwritedialog.h
utils/path-helper.cpp
utils/path-helper.h
utils/statusmessage.cpp
utils/statusmessage.h
utils/systemtrayicon.cpp
utils/systemtrayicon.h
utils/tags.cpp
utils/tags.h
utils/types.cpp
utils/types.h
utils/userinfo.cpp
utils/userinfo.h
utils/writecertassuantransaction.cpp
utils/writecertassuantransaction.h
utils/wsastarter.cpp
utils/wsastarter.h
view/anchorcache.cpp
view/anchorcache_p.h
view/cardkeysview.cpp
view/cardkeysview.h
view/htmllabel.cpp
view/htmllabel.h
view/infofield.cpp
view/infofield.h
view/keycacheoverlay.cpp
view/keycacheoverlay.h
view/keylistcontroller.cpp
view/keylistcontroller.h
view/keytreeview.cpp
view/keytreeview.h
view/netkeywidget.cpp
view/netkeywidget.h
view/overlaywidget.cpp
view/overlaywidget.h
view/p15cardwidget.cpp
view/p15cardwidget.h
view/padwidget.cpp
view/padwidget.h
view/pgpcardwidget.cpp
view/pgpcardwidget.h
view/pivcardwidget.cpp
view/pivcardwidget.h
view/progressoverlay.cpp
view/progressoverlay.h
view/searchbar.cpp
view/searchbar.h
view/smartcardactions.cpp
view/smartcardactions.h
view/smartcardswidget.cpp
view/smartcardswidget.h
view/smartcardwidget.cpp
view/smartcardwidget.h
view/tabwidget.cpp
view/tabwidget.h
view/textoverlay.cpp
view/textoverlay.h
view/waitwidget.cpp
view/waitwidget.h
view/welcomewidget.cpp
view/welcomewidget.h
aboutdata.cpp
aboutdata.h
- ${CMAKE_CURRENT_BINARY_DIR}/kleopatra.qrc
+ kleopatra.qrc
kleopatraapplication.cpp
kleopatraapplication.h
main.cpp
mainwindow.cpp
mainwindow.h
systrayicon.cpp
systrayicon.h
kleopatra_options.h
)
if(WIN32)
configure_file (versioninfo.rc.in versioninfo.rc)
configure_file (kleopatra.w32-manifest.in kleopatra.w32-manifest)
set(_kleopatra_SRCS
${CMAKE_CURRENT_BINARY_DIR}/kleopatra.w32-manifest
${CMAKE_CURRENT_BINARY_DIR}/versioninfo.rc
conf/kmessageboxdontaskagainstorage.cpp
conf/kmessageboxdontaskagainstorage.h
${_kleopatra_SRCS}
)
endif()
set (_kleopatra_SRCS conf/kleopageconfigdialog.cpp conf/kleopageconfigdialog.h ${_kleopatra_SRCS})
ecm_qt_declare_logging_category(_kleopatra_SRCS HEADER kleopatra_debug.h IDENTIFIER KLEOPATRA_LOG CATEGORY_NAME org.kde.pim.kleopatra
DESCRIPTION "kleopatra (kleopatra)"
OLD_CATEGORY_NAMES log_kleopatra
EXPORT KLEOPATRA
)
if(KLEO_MODEL_TEST)
add_definitions(-DKLEO_MODEL_TEST)
set(_kleopatra_SRCS ${_kleopatra_SRCS} models/modeltest.cpp)
endif()
ki18n_wrap_ui(_kleopatra_SRCS
dialogs/setinitialpindialog.ui
)
kconfig_add_kcfg_files(_kleopatra_SRCS
kcfg/settings.kcfgc
)
# setting a different KLEOPATRA_ICON_DIR allows to use different icons for a customized build
if (NOT KLEOPATRA_ICON_DIR)
set(KLEOPATRA_ICON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/icons")
endif()
file(GLOB ICONS_PNGS "${KLEOPATRA_ICON_DIR}/*.png")
file(GLOB ICONS_SVGS "${KLEOPATRA_ICON_DIR}/*.svg")
ecm_add_app_icon(_kleopatra_SRCS ICONS ${ICONS_PNGS} ${ICONS_SVGS})
if (NOT WIN32)
ecm_install_icons(ICONS ${ICONS_PNGS} ${ICONS_SVGS} DESTINATION ${KDE_INSTALL_ICONDIR})
else()
if (ICONS_SVGS)
list(GET ICONS_SVGS 0 app_icon_svg)
configure_file(icons/icons.qrc.in icons.qrc @ONLY)
set(_kleopatra_SRCS ${_kleopatra_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/icons.qrc)
endif()
endif()
add_executable(kleopatra_bin ${_kleopatra_SRCS} ${_kleopatra_uiserver_SRCS})
# For the ConfigureDialog & KCMs
target_link_libraries(kleopatra_bin kcm_kleopatra_static)
#if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
# set_target_properties(kleopatra_bin PROPERTIES UNITY_BUILD ON)
#endif()
set_target_properties(kleopatra_bin PROPERTIES OUTPUT_NAME kleopatra)
if (WIN32)
set(_kleopatra_platform_libs "secur32")
endif ()
target_link_libraries(kleopatra_bin
Gpgmepp
KPim6::Libkleo
KPim6::Mime
KPim6::MimeTreeParserWidgets
KF6::Codecs
KF6::CoreAddons
KF6::Crash
KF6::I18n
KF6::IconThemes
KF6::ItemModels
KF6::KIOCore
KF6::KIOWidgets
KF6::WindowSystem
KF6::XmlGui
Qt::Network
Qt::PrintSupport # Printing secret keys
${_kleopatra_extra_libs}
${_kleopatra_mail_libs}
${_kleopatra_uiserver_extra_libs}
${_kleopatra_dbusaddons_libs}
${_kleopatra_platform_libs}
)
target_link_libraries(kleopatra_bin QGpgmeQt6)
install(TARGETS kleopatra_bin ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install(
PROGRAMS data/org.kde.kleopatra.desktop data/kleopatra_import.desktop
DESTINATION ${KDE_INSTALL_APPDIR}
)
install(FILES data/org.kde.kleopatra.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
install(FILES data/kleopatra-mime.xml DESTINATION ${KDE_INSTALL_MIMEDIR})
install(
PROGRAMS data/kleopatra_signencryptfiles.desktop
data/kleopatra_signencryptfolders.desktop
data/kleopatra_decryptverifyfiles.desktop
DESTINATION ${KDE_INSTALL_DATADIR}/kio/servicemenus
)
install(FILES kleopatradebugcommandsrc DESTINATION ${KDE_INSTALL_CONFDIR})
diff --git a/src/aboutdata.cpp b/src/aboutdata.cpp
index eac97f86e..fcdfc7e27 100644
--- a/src/aboutdata.cpp
+++ b/src/aboutdata.cpp
@@ -1,155 +1,157 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2001, 2002, 2004 Klarälvdalens Datakonsult AB
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config-kleopatra.h>
#include <version-kleopatra.h>
#include "aboutdata.h"
#include "kleopatraapplication.h"
#include <Libkleo/GnuPG>
#include <QCoreApplication>
#include <QFile>
#include <QSettings>
#include <QThread>
#include <KLazyLocalizedString>
#include <KLocalizedString>
#include "kleopatra_debug.h"
/* Path to GnuPGs signing keys relative to the GnuPG installation */
#ifndef GNUPG_DISTSIGKEY_RELPATH
#define GNUPG_DISTSIGKEY_RELPATH "/../share/gnupg/distsigkey.gpg"
#endif
/* Path to a VERSION file relative to QCoreApplication::applicationDirPath */
#ifndef VERSION_RELPATH
#define VERSION_RELPATH "/../VERSION"
#endif
using namespace Qt::Literals::StringLiterals;
struct about_data {
const KLazyLocalizedString name;
const KLazyLocalizedString description;
};
static constexpr auto authors = std::to_array<about_data>({
{kli18n("Ingo Klöcker"), kli18n("Maintainer")},
{kli18n("Tobias Fella"), kli18n("Developer")},
{kli18n("Andre Heinecke"), kli18n("Former Maintainer")},
{kli18n("Marc Mutz"), kli18n("Former Maintainer")},
{kli18n("Steffen Hansen"), kli18n("Former Maintainer")},
});
static constexpr auto credits = std::to_array<about_data>({
{kli18n("Alexander Kulbartsch"), kli18nc("@info:credit", "UX redesign of smartcard view and certificate details")},
{kli18n("Carl Schwan"), kli18nc("@info:credit", "Mail viewer")},
{kli18n("David Faure"), kli18n("Backend configuration framework, KIO integration")},
{kli18n("Frank Osterfeld"), kli18n("UI Server commands and dialogs")},
{kli18n("Karl-Heinz Zimmer"), kli18n("DN display ordering support, infrastructure")},
{kli18n("Laurent Montel"), kli18n("Qt5 port, general code maintenance")},
{kli18n("Matthias Kalle Dalheimer"), kli18n("Original Author")},
{kli18n("Michel Boyer de la Giroday"), kli18n("Key-state dependent colors and fonts in the certificates list")},
{kli18n("Thomas Moenicke"), kli18n("Artwork")},
{kli18n("Werner Koch"), kli18n("GnuPG consulting")},
});
static void updateAboutDataFromSettings(KAboutData &about, const QSettings *settings)
{
if (!settings) {
return;
}
about.setDisplayName(settings->value(QStringLiteral("displayName"), about.displayName()).toString());
about.setProductName(settings->value(QStringLiteral("productName"), about.productName()).toByteArray());
about.setComponentName(settings->value(QStringLiteral("componentName"), about.componentName()).toString());
about.setShortDescription(settings->value(QStringLiteral("shortDescription"), about.shortDescription()).toString());
about.setHomepage(settings->value(QStringLiteral("homepage"), about.homepage()).toString());
about.setBugAddress(settings->value(QStringLiteral("bugAddress"), about.bugAddress()).toByteArray());
about.setVersion(settings->value(QStringLiteral("version"), about.version()).toByteArray());
about.setOtherText(settings->value(QStringLiteral("otherText"), about.otherText()).toString());
about.setCopyrightStatement(settings->value(QStringLiteral("copyrightStatement"), about.copyrightStatement()).toString());
about.setDesktopFileName(settings->value(QStringLiteral("desktopFileName"), about.desktopFileName()).toString());
}
// Extend the about data with the used GnuPG Version since this can
// make a big difference with regards to the available features.
static void loadBackendVersions()
{
auto thread = QThread::create([]() {
STARTUP_TIMING << "Checking backend versions";
const auto backendComponents = Kleo::backendComponents();
STARTUP_TIMING << "backend versions checked";
if (!backendComponents.empty()) {
QMetaObject::invokeMethod(qApp, [backendComponents]() {
auto about = KAboutData::applicationData();
for (const auto &component : backendComponents) {
about.addComponent(component);
}
KAboutData::setApplicationData(about);
});
}
});
thread->start();
}
// This code is mostly for Gpg4win and GnuPG VS-Desktop so that they
// can put in their own about data information.
static void loadCustomAboutData(KAboutData &about)
{
const QString versionFile = QCoreApplication::applicationDirPath() + QStringLiteral(VERSION_RELPATH);
if (QFile::exists(versionFile)) {
const QStringList searchPaths = {Kleo::gnupgInstallPath()};
const QString distSigKeys = Kleo::gnupgInstallPath() + QStringLiteral(GNUPG_DISTSIGKEY_RELPATH);
STARTUP_TIMING << "Starting version info check";
const bool valid = Kleo::gpgvVerify(versionFile, QString(), distSigKeys, searchPaths);
STARTUP_TIMING << "Version info checked";
if (valid) {
qCDebug(KLEOPATRA_LOG) << "Found valid VERSION file. Updating about data.";
auto settings = std::make_shared<QSettings>(versionFile, QSettings::IniFormat);
settings->beginGroup(QStringLiteral("Kleopatra"));
updateAboutDataFromSettings(about, settings.get());
KleopatraApplication::instance()->setDistributionSettings(settings);
}
}
loadBackendVersions();
}
AboutData::AboutData()
- : KAboutData(QStringLiteral(KLEOPATRA_APPLICATION_NAME),
+ : KAboutData(QStringLiteral("kleopatra"),
i18n("Kleopatra"),
QLatin1StringView(KLEOPATRA_VERSION_STRING),
i18n("Certificate manager and cryptography app"),
KAboutLicense::GPL,
i18nc("@info:credit", "\u00A9 2019-%1 g10 Code GmbH", QStringLiteral("2024")) + QLatin1Char('\n')
+ i18nc("@info:credit", "\u00A9 2015-2018 Intevation GmbH") + QLatin1Char('\n')
+ i18nc("@info:credit", "\u00A9 2015-2018 Bundesamt für Sicherheit in der Informationstechnik") + QLatin1Char('\n')
+ i18nc("@info:credit", "\u00A9 2001-2010 Klar\u00E4lvdalens\u00A0Datakonsult\u00A0AB") + QLatin1Char('\n')
+ i18nc("@info:credit", "\u00A9 2001-%1 The Kleopatra developers", QStringLiteral("2024")))
{
using ::authors;
using ::credits;
+ setOrganizationDomain(KLEOPATRA_ORGANIZATION_DOMAIN);
+
for (const auto &author : authors) {
addAuthor(author.name.toString(), author.description.toString());
}
for (const auto &credit : credits) {
addCredit(credit.name.toString(), credit.description.toString());
}
#if KLEOPATRA_LIST_AS_COMPONENT
const QLatin1StringView commitId{KLEOPATRA_COMMIT_ID};
if (!commitId.isEmpty()) {
addComponent(i18n("Kleopatra"), i18n("Certificate manager and cryptography app"), commitId, u"https://apps.kde.org/kleopatra"_s, KAboutLicense::GPL);
}
#endif
loadCustomAboutData(*this);
}
diff --git a/src/kleopatra.qrc b/src/kleopatra.qrc
new file mode 100644
index 000000000..33e440191
--- /dev/null
+++ b/src/kleopatra.qrc
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+ <qresource prefix="/kxmlgui5/kleopatra">
+ <file>kleopatra.rc</file>
+ </qresource>
+</RCC>
+
diff --git a/src/kleopatra.qrc.in b/src/kleopatra.qrc.in
deleted file mode 100644
index 32d50057e..000000000
--- a/src/kleopatra.qrc.in
+++ /dev/null
@@ -1,6 +0,0 @@
-<!DOCTYPE RCC>
-<RCC version="1.0">
- <qresource prefix="/kxmlgui5/@KLEOPATRA_APPLICATION_NAME@">
- <file alias="kleopatra.rc">@CMAKE_CURRENT_SOURCE_DIR@/kleopatra.rc</file>
- </qresource>
-</RCC>
diff --git a/src/main.cpp b/src/main.cpp
index 61a4cca13..6ca5251f8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,318 +1,318 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2001, 2002, 2004, 2008 Klarälvdalens Datakonsult AB
SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik
SPDX-FileContributor: Intevation GmbH
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config-kleopatra.h>
#include "aboutdata.h"
#include "kleopatraapplication.h"
#include "mainwindow.h"
#include "utils/migration.h"
#include "accessibility/accessiblewidgetfactory.h"
#include <commands/reloadkeyscommand.h>
#include <commands/selftestcommand.h>
#ifdef Q_OS_WIN
#include "conf/kmessageboxdontaskagainstorage.h"
#endif
#include "utils/kuniqueservice.h"
#include "utils/userinfo.h"
#include <Libkleo/GnuPG>
#include <utils/accessibility.h>
#include <utils/archivedefinition.h>
#include <uiserver/assuancommand.h>
#include <uiserver/createchecksumscommand.h>
#include <uiserver/decryptcommand.h>
#include <uiserver/decryptfilescommand.h>
#include <uiserver/decryptverifyfilescommand.h>
#include <uiserver/echocommand.h>
#include <uiserver/encryptcommand.h>
#include <uiserver/importfilescommand.h>
#include <uiserver/prepencryptcommand.h>
#include <uiserver/prepsigncommand.h>
#include <uiserver/selectcertificatecommand.h>
#include <uiserver/signcommand.h>
#include <uiserver/signencryptfilescommand.h>
#include <uiserver/uiserver.h>
#include <uiserver/verifychecksumscommand.h>
#include <uiserver/verifycommand.h>
#include <uiserver/verifyfilescommand.h>
#include <Libkleo/ChecksumDefinition>
#include "kleopatra_debug.h"
#include "kleopatra_options.h"
#include <KCrash>
#include <KIconTheme>
#include <KLocalizedString>
#include <KMessageBox>
#include <QAccessible>
#include <QElapsedTimer>
#include <QEventLoop>
#include <QMessageBox>
#include <QThreadPool>
#include <QTime>
#include <QTimer>
#include <gpgme++/error.h>
#include <gpgme++/global.h>
#include <QCommandLineParser>
#include <iostream>
#include <memory>
using namespace Qt::StringLiterals;
QElapsedTimer startupTimer;
static bool selfCheck()
{
Kleo::Commands::SelfTestCommand cmd(nullptr);
cmd.setAutoDelete(false);
cmd.setAutomaticMode(true);
QEventLoop loop;
QObject::connect(&cmd, &Kleo::Commands::SelfTestCommand::finished, &loop, &QEventLoop::quit);
QTimer::singleShot(0, &cmd, &Kleo::Command::start); // start() may Q_EMIT finished()...
loop.exec();
if (cmd.isCanceled()) {
return false;
} else {
return true;
}
}
static void fillKeyCache(Kleo::UiServer *server)
{
auto cmd = new Kleo::ReloadKeysCommand(nullptr);
QObject::connect(cmd, SIGNAL(finished()), server, SLOT(enableCryptoCommands()));
cmd->start();
}
int main(int argc, char **argv)
{
startupTimer.start();
// Initialize GpgME
const GpgME::Error gpgmeInitError = GpgME::initializeLibrary(0);
STARTUP_TIMING << "GPGME Initialized";
// Set the application name before any standard paths are resolved
- QCoreApplication::setApplicationName(QStringLiteral(KLEOPATRA_APPLICATION_NAME));
+ QCoreApplication::setApplicationName(QStringLiteral("kleopatra"));
// Set OrganizationDomain early as this is used to generate the service
// name that will be registered on the bus.
- QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
+ QCoreApplication::setOrganizationDomain(QStringLiteral(KLEOPATRA_ORGANIZATION_DOMAIN));
#ifdef Q_OS_WIN
// The config files need to be migrated before the application is created. Otherwise, at least
// the staterc might already have been created at the new location.
Migration::migrateApplicationConfigFiles();
STARTUP_TIMING << "Config files migrated";
#endif
// Enforce the Breeze icon theme for all icons (including recoloring);
// needs to be done before creating the QApplication
KIconTheme::initTheme();
STARTUP_TIMING << "Icon theme initialized";
KleopatraApplication app(argc, argv);
KLocalizedString::setApplicationDomain(QByteArrayLiteral("kleopatra"));
STARTUP_TIMING << "Application created";
// Early parsing of command line to handle --standalone option
QCommandLineParser parser;
kleopatra_options(&parser);
(void)parser.parse(QApplication::arguments()); // ignore errors; they are handled later
app.setIsStandalone(parser.isSet(u"standalone"_s));
/* Create the unique service ASAP to prevent double starts if
* the application is started twice very quickly. */
if (!app.isStandalone()) {
auto service = new KUniqueService(&app);
QObject::connect(service, &KUniqueService::activateRequested, &app, &KleopatraApplication::slotActivateRequested);
QObject::connect(&app, &KleopatraApplication::setExitValue, service, [service](int i) {
service->setExitValue(i);
});
STARTUP_TIMING << "Unique service created";
}
QAccessible::installFactory(Kleo::accessibleWidgetFactory);
if (qEnvironmentVariableIntValue("KLEO_LOG_A11Y_EVENTS") != 0) {
Kleo::installAccessibleEventLogger();
}
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kleopatra"), app.windowIcon()));
if (gpgmeInitError) {
// Show a failed initialization of GpgME after creating QApplication and KUniqueService,
// and after setting the application domain for the localization.
KMessageBox::error(nullptr,
xi18nc("@info",
"<para>The version of the <application>GpgME</application> library you are running against "
"is older than the one that the <application>GpgME++</application> library was built against.</para>"
"<para><application>Kleopatra</application> will not function in this setting.</para>"
"<para>Please ask your administrator for help in resolving this issue.</para>"),
i18nc("@title", "GpgME Too Old"));
return EXIT_FAILURE;
}
AboutData aboutData;
KAboutData::setApplicationData(aboutData);
KCrash::initialize();
if (Kleo::userIsElevated()) {
/* This is a safeguard against bugreports that something fails because
* of permission problems on windows. Some users still have the Windows
* Vista behavior of running things as Administrator. This can break
* GnuPG in horrible ways for example if a stale lockfile is left that
* can't be removed without another elevation.
*
* Note: This is not the same as running as root on Linux. Elevated means
* that you are temporarily running with the "normal" user environment but
* with elevated permissions.
* */
if (KMessageBox::warningContinueCancel(nullptr,
xi18nc("@info",
"<para><application>Kleopatra</application> cannot be run as adminstrator without "
"breaking file permissions in the GnuPG data folder.</para>"
"<para>To manage keys for other users please manage them as a normal user and "
"copy the <filename>AppData\\Roaming\\gnupg</filename> directory with proper permissions.</para>")
+ xi18nc("@info", "<para>Are you sure that you want to continue?</para>"),
i18nc("@title", "Running as Administrator"))
!= KMessageBox::Continue) {
return EXIT_FAILURE;
}
qCWarning(KLEOPATRA_LOG) << "User is running with administrative permissions.";
}
// Delay init after KUniqueservice call as this might already
// have terminated us and so we can avoid overhead (e.g. keycache
// setup / systray icon).
Migration::migrate();
app.init();
STARTUP_TIMING << "Application initialized";
aboutData.setupCommandLine(&parser);
parser.process(QApplication::arguments());
aboutData.processCommandLine(&parser);
{
const unsigned int threads = QThreadPool::globalInstance()->maxThreadCount();
QThreadPool::globalInstance()->setMaxThreadCount(qMax(2U, threads));
}
Kleo::ChecksumDefinition::setInstallPath(Kleo::gpg4winInstallPath());
Kleo::ArchiveDefinition::setInstallPath(Kleo::gnupgInstallPath());
Kleo::UiServer *server = nullptr;
#ifndef DISABLE_UISERVER
if (!app.isStandalone()) {
try {
server = new Kleo::UiServer(parser.value(QStringLiteral("uiserver-socket")));
STARTUP_TIMING << "UiServer created";
QObject::connect(server, &Kleo::UiServer::startKeyManagerRequested, &app, &KleopatraApplication::openOrRaiseMainWindow);
QObject::connect(server, &Kleo::UiServer::startConfigDialogRequested, &app, &KleopatraApplication::openOrRaiseConfigDialog);
#define REGISTER(Command) server->registerCommandFactory(std::shared_ptr<Kleo::AssuanCommandFactory>(new Kleo::GenericAssuanCommandFactory<Kleo::Command>))
REGISTER(CreateChecksumsCommand);
REGISTER(DecryptCommand);
REGISTER(DecryptFilesCommand);
REGISTER(DecryptVerifyFilesCommand);
REGISTER(EchoCommand);
REGISTER(EncryptCommand);
REGISTER(EncryptFilesCommand);
REGISTER(EncryptSignFilesCommand);
REGISTER(ImportFilesCommand);
REGISTER(PrepEncryptCommand);
REGISTER(PrepSignCommand);
REGISTER(SelectCertificateCommand);
REGISTER(SignCommand);
REGISTER(SignEncryptFilesCommand);
REGISTER(SignFilesCommand);
REGISTER(VerifyChecksumsCommand);
REGISTER(VerifyCommand);
REGISTER(VerifyFilesCommand);
#undef REGISTER
server->start();
STARTUP_TIMING << "UiServer started";
} catch (const std::exception &e) {
qCDebug(KLEOPATRA_LOG) << "Failed to start UI Server: " << e.what();
#ifdef Q_OS_WIN
// We should probably change the UIServer to be only run on Windows at all because
// only the Windows Explorer Plugin uses it. But the plan of GnuPG devs as of 2022 is to
// change the Windows Explorer Plugin to use the command line and then remove the
// UiServer for everyone.
QMessageBox::information(nullptr,
i18n("GPG UI Server Error"),
i18nc("This error message is only shown on Windows when the socket to communicate with "
"Windows Explorer could not be created. This often times means that the whole installation is "
"buggy. e.g. GnuPG is not installed at all.",
"<qt>The Kleopatra Windows Explorer Module could not be initialized.<br/>"
"The error given was: <b>%1</b><br/>"
"This likely means that there is a problem with your installation. Try reinstalling or "
"contact your Administrator for support.<br/>"
"You can try to continue to use Kleopatra but there might be other problems.</qt>",
QString::fromUtf8(e.what()).toHtmlEscaped()));
#endif
}
}
#endif // DISABLE_UISERVER
const bool daemon = parser.isSet(QStringLiteral("daemon"));
if (!daemon && app.isSessionRestored()) {
app.restoreMainWindow();
}
if (!selfCheck()) {
return EXIT_FAILURE;
}
STARTUP_TIMING << "SelfCheck completed";
if (server) {
fillKeyCache(server);
}
#ifndef QT_NO_SYSTEMTRAYICON
app.startMonitoringSmartCard();
#endif
app.setIgnoreNewInstance(false);
if (!daemon) {
const QString err = app.newInstance(parser);
if (!err.isEmpty()) {
std::cerr << i18n("Invalid arguments: %1", err).toLocal8Bit().constData() << "\n";
return EXIT_FAILURE;
}
STARTUP_TIMING << "new instance created";
}
#ifdef Q_OS_WIN
auto messageBoxConfigStorage = std::make_unique<KMessageBoxDontAskAgainConfigStorage>();
KMessageBox::setDontShowAgainInterface(messageBoxConfigStorage.get());
#endif
const int rc = app.exec();
app.setIgnoreNewInstance(true);
QObject::disconnect(server, &Kleo::UiServer::startKeyManagerRequested, &app, &KleopatraApplication::openOrRaiseMainWindow);
QObject::disconnect(server, &Kleo::UiServer::startConfigDialogRequested, &app, &KleopatraApplication::openOrRaiseConfigDialog);
if (server) {
server->stop();
server->waitForStopped();
delete server;
}
return rc;
}
diff --git a/src/utils/migration.cpp b/src/utils/migration.cpp
index c3b3890dd..7e41c6ef5 100644
--- a/src/utils/migration.cpp
+++ b/src/utils/migration.cpp
@@ -1,147 +1,146 @@
// SPDX-FileCopyrightText: 2024 g10 Code GmbH
// SPDX-FileContributor: Tobias Fella <tobias.fella@gnupg.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "utils/migration.h"
#include "kleopatra_debug.h"
#include <KConfigGroup>
#include <KSharedConfig>
#include <QCoreApplication>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QRegularExpression>
#include <QUuid>
#include <Libkleo/GnuPG>
using namespace Qt::Literals::StringLiterals;
static const QStringList groupStateIgnoredKeys = {
QStringLiteral("magic"),
};
static void migrateGroupState(const QString &configName, const QString &name)
{
const auto config = KSharedConfig::openConfig(configName);
auto groups = config->groupList().filter(QRegularExpression(QStringLiteral("^View #\\d+$")));
groups.sort();
QStringList uuids;
const auto newConfig = KSharedConfig::openStateConfig();
for (const auto &g : groups) {
auto group = KConfigGroup(config, g);
auto newGroup = KConfigGroup(newConfig, QStringLiteral("%1:View %2").arg(name, QUuid::createUuid().toString()));
for (const auto &key : group.keyList()) {
if (key == QLatin1StringView("column-sizes")) {
newGroup.writeEntry("ColumnWidths", group.readEntry(key));
} else if (!groupStateIgnoredKeys.contains(key)) {
newGroup.writeEntry(key, group.readEntry(key));
}
}
newGroup.sync();
uuids += newGroup.name();
}
if (!uuids.isEmpty()) {
newConfig->group(name).writeEntry("Tabs", uuids);
}
}
static void migrateFile(const QString &oldFileName, const QString &newFileName, const QString &oldLocation, const QString &newLocation)
{
const QFileInfo oldPath{oldLocation + u'/' + oldFileName};
const QDir newDir{newLocation};
const QFileInfo newPath{newDir.absoluteFilePath(newFileName)};
if (!newPath.exists() && oldPath.exists()) {
qCInfo(KLEOPATRA_LOG) << "Copying" << oldPath.absoluteFilePath() << "to" << newPath.absoluteFilePath();
if (!QDir{}.mkpath(newPath.absolutePath())) {
qCWarning(KLEOPATRA_LOG) << "Failed to create folder" << newPath.absolutePath();
return;
}
const bool ok = QFile::copy(oldPath.absoluteFilePath(), newPath.absoluteFilePath());
if (!ok) {
qCWarning(KLEOPATRA_LOG) << "Failed to copy the file to" << newPath.absoluteFilePath();
}
}
}
static void migrateFile(const QString &fileName, const QString &oldLocation, const QString &newLocation)
{
migrateFile(fileName, fileName, oldLocation, newLocation);
}
#ifdef Q_OS_WIN
static QString getOldGenericConfigLocation()
{
// Gpg4win 4.[34] used %APPDATA%/kleopatra as GenericConfigLocation;
// VSD 3.[123] and GPD 4.3 used %LOCALAPPDATA% as GenericConfigLocation;
- // if application name is not "kleopatra" then we assume VSD/GPD
- return QCoreApplication::applicationName() == "kleopatra"_L1 //
- ? qEnvironmentVariable("APPDATA") + "/kleopatra/"_L1 //
- : qEnvironmentVariable("LOCALAPPDATA") + u'/';
+ // if organization domain starts with "gnupg." then we assume VSD/GPD
+ return QCoreApplication::organizationDomain().startsWith("gnupg."_L1) //
+ ? qEnvironmentVariable("LOCALAPPDATA") + u'/' //
+ : qEnvironmentVariable("APPDATA") + "/kleopatra/"_L1;
}
void Migration::migrateApplicationConfigFiles()
{
- const QString applicationName = QCoreApplication::applicationName();
const QString oldConfigLocation = getOldGenericConfigLocation();
const QString newConfigLocation = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
// all Gpg4win-based versions used %APPDATA%/kleopatra as AppDataLocation (for the *staterc file)
const QString oldStateLocation = qEnvironmentVariable("APPDATA") + "/kleopatra/"_L1;
const QString newStateLocation = QStandardPaths::writableLocation(QStandardPaths::GenericStateLocation);
// Migrate the main config file to QStandardPaths::GenericConfigLocation
- migrateFile(u"kleopatrarc"_s, applicationName + "rc"_L1, oldConfigLocation, newConfigLocation);
+ migrateFile(u"kleopatrarc"_s, "kleopatrarc"_L1, oldConfigLocation, newConfigLocation);
// Migrate the state config file to QStandardPaths::GenericStateLocation;
- migrateFile(u"kleopatrastaterc"_s, applicationName + "staterc"_L1, oldStateLocation, newStateLocation);
+ migrateFile(u"kleopatrastaterc"_s, "kleopatrastaterc"_L1, oldStateLocation, newStateLocation);
// Migrate some more config files
migrateFile(u"klanguageoverridesrc"_s, oldConfigLocation, newConfigLocation);
migrateFile(u"libkleopatrarc"_s, oldConfigLocation, newConfigLocation);
- migrateFile(u"kxmlgui5/kleopatra/kleopatra.rc"_s, "kxmlgui5/"_L1 + applicationName + "/kleopatra.rc"_L1, oldConfigLocation, newConfigLocation);
+ migrateFile(u"kxmlgui5/kleopatra/kleopatra.rc"_s, "kxmlgui5/kleopatra/kleopatra.rc"_L1, oldConfigLocation, newConfigLocation);
}
#else
static QString getOldGenericConfigLocation()
{
return QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
}
#endif
static void removeFilterNames(const QString &fileName)
{
const QDir configDir{QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation)};
const QFileInfo configFilePath{configDir.absoluteFilePath(fileName)};
if (!configFilePath.exists()) {
return;
}
auto config = KConfig{configFilePath.absoluteFilePath(), KConfig::SimpleConfig};
const QStringList keyFilterGroups = config.groupList().filter(QRegularExpression(QStringLiteral("^Key Filter #\\d+$")));
for (const auto &groupName : keyFilterGroups) {
KConfigGroup group(&config, groupName);
if (group.hasKey(u"Name"_s)) {
group.deleteEntry(u"Name"_s);
}
}
if (config.isDirty()) {
config.sync();
qCInfo(KLEOPATRA_LOG) << "Removed filter names from" << config.name();
}
}
void Migration::migrate()
{
auto migrations = KSharedConfig::openStateConfig()->group(QStringLiteral("Migrations"));
if (!migrations.readEntry("01-key-list-layout", false)) {
migrateGroupState({}, QStringLiteral("KeyList"));
migrateGroupState(QStringLiteral("kleopatracertificateselectiondialogrc"), QStringLiteral("CertificateSelectionDialog"));
migrations.writeEntry("01-key-list-layout", true);
migrations.sync();
}
// Migrate kleopatragroupsrc from old location to GNUPGHOME/kleopatra/
migrateFile(u"kleopatragroupsrc"_s, getOldGenericConfigLocation(), Kleo::gnupgHomeDirectory() + "/kleopatra"_L1);
removeFilterNames(u"libkleopatrarc"_s);
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Dec 14, 3:05 PM (1 d, 17 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
86/ea/58090e829af923a236eb9ca9a8da

Event Timeline