Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F34135317
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
17 KB
Subscribers
None
View Options
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a04fe454..7375d524 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,412 +1,415 @@
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: none
# target_include_directories does not handle empty include paths
include_directories(
${Boost_INCLUDE_DIRS}
${GPGME_INCLUDES}
)
add_definitions(-DTRANSLATION_DOMAIN=\"libkleopatra\")
#add_definitions( -DQT_NO_CAST_FROM_ASCII )
#add_definitions( -DQT_NO_CAST_TO_ASCII )
kde_enable_exceptions()
add_definitions( -DGPGMEPP_ERR_SOURCE_DEFAULT=13 ) # 13 is GPG_ERR_SOURCE_KLEO, even if gpg-error's too old to know about
add_subdirectory( pics )
add_library(KPim${KF_MAJOR_VERSION}Libkleo)
add_library(KPim${KF_MAJOR_VERSION}::Libkleo ALIAS KPim${KF_MAJOR_VERSION}Libkleo)
########### next target ###############
target_sources(KPim${KF_MAJOR_VERSION}Libkleo PRIVATE
kleo/auditlogentry.cpp
kleo/auditlogentry.h
kleo/checksumdefinition.cpp
kleo/checksumdefinition.h
kleo/debug.cpp
kleo/debug.h
kleo/defaultkeyfilter.cpp
kleo/defaultkeyfilter.h
kleo/defaultkeygenerationjob.cpp
kleo/defaultkeygenerationjob.h
kleo/docaction.cpp kleo/docaction.h
kleo/dn.cpp
kleo/dn.h
kleo/enum.cpp
kleo/enum.h
kleo/expirychecker.cpp
kleo/expirychecker.h
kleo/expirycheckerconfig.cpp
kleo/expirycheckerconfig.h
kleo/expirycheckersettings.cpp
kleo/expirycheckersettings.h
kleo/kconfigbasedkeyfilter.cpp
kleo/kconfigbasedkeyfilter.h
kleo/keyfilter.h
kleo/keyfiltermanager.cpp
kleo/keyfiltermanager.h
kleo/keygroup.cpp
kleo/keygroup.h
kleo/keygroupconfig.cpp
kleo/keygroupconfig.h
kleo/keygroupimportexport.cpp
kleo/keygroupimportexport.h
kleo/keyresolver.cpp
kleo/keyresolver.h
kleo/keyresolvercore.cpp
kleo/keyresolvercore.h
kleo/keyserverconfig.cpp
kleo/keyserverconfig.h
kleo/kleoexception.cpp
kleo/kleoexception.h
kleo/oidmap.cpp
kleo/oidmap.h
kleo/predicates.h
kleo/stl_util.h
models/keycache.cpp
models/keycache.h
models/keycache_p.h
models/keylist.h
models/keylistmodel.cpp
models/keylistmodel.h
models/keylistmodelinterface.cpp
models/keylistmodelinterface.h
models/keylistsortfilterproxymodel.cpp
models/keylistsortfilterproxymodel.h
models/keyrearrangecolumnsproxymodel.cpp
models/keyrearrangecolumnsproxymodel.h
models/subkeylistmodel.cpp
models/subkeylistmodel.h
models/useridlistmodel.cpp
models/useridlistmodel.h
utils/algorithm.h
utils/assuan.cpp
utils/assuan.h
utils/chrono.h
utils/classify.cpp
utils/classify.h
utils/compat.cpp
utils/compat.h
utils/compliance.cpp
utils/compliance.h
utils/cryptoconfig.cpp
utils/cryptoconfig.h
utils/cryptoconfig_p.h
utils/filesystemwatcher.cpp
utils/filesystemwatcher.h
utils/formatting.cpp
utils/formatting.h
utils/gnupg-registry.c
utils/gnupg-registry.h
utils/gnupg.cpp
utils/gnupg.h
utils/hex.cpp
utils/hex.h
utils/keyhelpers.cpp
utils/keyhelpers.h
utils/keyusage.h
utils/qtstlhelpers.cpp
utils/qtstlhelpers.h
utils/scdaemon.cpp
utils/scdaemon.h
utils/stringutils.cpp
utils/stringutils.h
utils/systeminfo.cpp
utils/systeminfo.h
utils/test.cpp
utils/test.h
utils/uniquelock.cpp
utils/uniquelock.h
)
ecm_qt_declare_logging_category(KPim${KF_MAJOR_VERSION}Libkleo HEADER libkleo_debug.h IDENTIFIER LIBKLEO_LOG CATEGORY_NAME org.kde.pim.libkleo
DESCRIPTION "libkleo (kleo_core)"
EXPORT LIBKLEO
)
target_sources(KPim${KF_MAJOR_VERSION}Libkleo PRIVATE
+ ui/adjustingscrollarea.cpp
+ ui/adjustingscrollarea.h
ui/auditlogviewer.cpp
ui/auditlogviewer.h
ui/cryptoconfigentryreaderport.cpp
ui/cryptoconfigentryreaderport_p.h
ui/cryptoconfigmodule.cpp
ui/cryptoconfigmodule.h
ui/cryptoconfigmodule_p.h
ui/directoryserviceswidget.cpp
ui/directoryserviceswidget.h
ui/dnattributeorderconfigwidget.cpp
ui/dnattributeorderconfigwidget.h
ui/editdirectoryservicedialog.cpp
ui/editdirectoryservicedialog.h
ui/filenamerequester.cpp
ui/filenamerequester.h
ui/messagebox.cpp
ui/messagebox.h
ui/navigatabletreeview.cpp
ui/navigatabletreeview.h
ui/navigatabletreewidget.cpp
ui/navigatabletreewidget.h
ui/progressbar.cpp
ui/progressbar.h
ui/progressdialog.cpp
ui/progressdialog.h
ui/readerportselection.cpp
ui/readerportselection.h
)
ecm_qt_declare_logging_category(KPim${KF_MAJOR_VERSION}Libkleo HEADER kleo_ui_debug.h IDENTIFIER KLEO_UI_LOG CATEGORY_NAME org.kde.pim.kleo_ui
DESCRIPTION "libkleo (kleo_ui)"
OLD_CATEGORY_NAMES log_kleo_ui
EXPORT LIBKLEO
)
target_sources(KPim${KF_MAJOR_VERSION}Libkleo PRIVATE # make this a separate lib.
ui/keyapprovaldialog.cpp
ui/keyapprovaldialog.h
ui/keylistview.cpp
ui/keylistview.h
ui/keyrequester.cpp
ui/keyrequester.h
ui/keyselectioncombo.cpp
ui/keyselectioncombo.h
ui/keyselectiondialog.cpp
ui/keyselectiondialog.h
ui/newkeyapprovaldialog.cpp
ui/newkeyapprovaldialog.h
)
if(MINGW)
# we do not care about different signedness of passed pointer arguments
set_source_files_properties(utils/gnupg-registry.c PROPERTIES COMPILE_OPTIONS "-Wno-pointer-sign")
endif()
target_link_libraries(KPim${KF_MAJOR_VERSION}Libkleo PUBLIC Gpgmepp PRIVATE Qt::Widgets
KF${KF_MAJOR_VERSION}::I18n
KF${KF_MAJOR_VERSION}::Completion
KF${KF_MAJOR_VERSION}::ConfigCore
KF${KF_MAJOR_VERSION}::ConfigWidgets
KF${KF_MAJOR_VERSION}::CoreAddons
KF${KF_MAJOR_VERSION}::WidgetsAddons
KF${KF_MAJOR_VERSION}::ItemModels
KF${KF_MAJOR_VERSION}::Codecs
LibGpgError::LibGpgError)
if (QT_MAJOR_VERSION STREQUAL "6")
target_link_libraries(KPim${KF_MAJOR_VERSION}Libkleo PRIVATE Qt6::Core5Compat PUBLIC QGpgmeQt6)
else()
target_link_libraries(KPim${KF_MAJOR_VERSION}Libkleo PUBLIC QGpgme)
endif()
# Boost::headers may not be available for old versions of Boost
if (TARGET Boost::headers)
target_link_libraries(KPim${KF_MAJOR_VERSION}Libkleo PRIVATE Boost::headers)
endif()
if (KPim${KF_MAJOR_VERSION}TextEdit_FOUND)
add_definitions(-DHAVE_PIMTEXTEDIT)
target_link_libraries(KPim${KF_MAJOR_VERSION}Libkleo PRIVATE KPim${KF_MAJOR_VERSION}::PimTextEdit)
endif()
if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
set_target_properties(KPim${KF_MAJOR_VERSION}Libkleo PROPERTIES UNITY_BUILD ON)
endif()
ecm_generate_export_header(KPim${KF_MAJOR_VERSION}Libkleo
BASE_NAME kleo
VERSION ${PIM_VERSION}
DEPRECATED_BASE_VERSION 0
DEPRECATION_VERSIONS 5.23
)
if(WIN32)
target_link_libraries(KPim${KF_MAJOR_VERSION}Libkleo ${GPGME_VANILLA_LIBRARIES} )
endif()
set_target_properties(KPim${KF_MAJOR_VERSION}Libkleo PROPERTIES
VERSION ${LIBKLEO_VERSION}
SOVERSION ${LIBKLEO_SOVERSION}
EXPORT_NAME Libkleo
)
install(TARGETS
KPim${KF_MAJOR_VERSION}Libkleo
EXPORT KPim${KF_MAJOR_VERSION}LibkleoTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}
)
target_include_directories(KPim${KF_MAJOR_VERSION}Libkleo INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}/KPim${KF_MAJOR_VERSION}/Libkleo>")
target_include_directories(KPim${KF_MAJOR_VERSION}Libkleo PUBLIC "$<BUILD_INTERFACE:${libkleo_SOURCE_DIR}/src;${libkleo_BINARY_DIR}/src>")
ecm_generate_headers(libkleo_CamelCase_HEADERS
HEADER_NAMES
AuditLogEntry
ChecksumDefinition
Debug
DefaultKeyFilter
DefaultKeyGenerationJob
DocAction
Dn
Enum
ExpiryChecker
ExpiryCheckerConfig
ExpiryCheckerSettings
KConfigBasedKeyFilter
KeyFilter
KeyFilterManager
KeyGroup
KeyGroupConfig
KeyGroupImportExport
KeyResolver
KeyResolverCore
KeyserverConfig
KleoException
OidMap
Predicates
Stl_Util
REQUIRED_HEADERS libkleo_HEADERS
PREFIX Libkleo
RELATIVE kleo
)
ecm_generate_headers(libkleo_CamelCase_models_HEADERS
HEADER_NAMES
KeyCache
KeyList
KeyListModel
KeyListModelInterface
KeyListSortFilterProxyModel
KeyRearrangeColumnsProxyModel
SubkeyListModel
UserIDListModel
REQUIRED_HEADERS libkleo_models_HEADERS
PREFIX Libkleo
RELATIVE models
)
ecm_generate_headers(libkleo_CamelCase_utils_HEADERS
HEADER_NAMES
Algorithm
Assuan
Chrono
Classify
Compat
Compliance
CryptoConfig
FileSystemWatcher
Formatting
GnuPG
Hex
KeyHelpers
KeyUsage
QtStlHelpers
SCDaemon
StringUtils
SystemInfo
Test
UniqueLock
REQUIRED_HEADERS libkleo_utils_HEADERS
PREFIX Libkleo
RELATIVE utils
)
ecm_generate_headers(libkleo_CamelCase_ui_HEADERS
HEADER_NAMES
+ AdjustingScrollArea
AuditLogViewer
CryptoConfigModule
DNAttributeOrderConfigWidget
DirectoryServicesWidget
EditDirectoryServiceDialog
FileNameRequester
KeyApprovalDialog
KeyListView
KeyRequester
KeySelectionCombo
KeySelectionDialog
MessageBox
NavigatableTreeView
NavigatableTreeWidget
NewKeyApprovalDialog
ProgressDialog
ReaderPortSelection
REQUIRED_HEADERS libkleo_ui_HEADERS
PREFIX Libkleo
RELATIVE ui
)
if (QT_MAJOR_VERSION STREQUAL "6")
ecm_generate_pri_file(BASE_NAME Libkleo
LIB_NAME KPim${KF_MAJOR_VERSION}Libkleo
DEPS "QGpgme" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR}/KPim${KF_MAJOR_VERSION}/Libkleo
)
else()
ecm_generate_pri_file(BASE_NAME Libkleo
LIB_NAME KPim${KF_MAJOR_VERSION}Libkleo
DEPS "QGpgmeQt6" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR}/KPim${KF_MAJOR_VERSION}/Libkleo
)
endif()
kconfig_add_kcfg_files(KPim${KF_MAJOR_VERSION}Libkleo
kcfg/expirycheckerconfigbase.kcfgc
kcfg/classifyconfig.kcfgc
)
install(FILES
${libkleo_CamelCase_HEADERS}
${libkleo_CamelCase_models_HEADERS}
${libkleo_CamelCase_ui_HEADERS}
${libkleo_CamelCase_utils_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KPim${KF_MAJOR_VERSION}/Libkleo/Libkleo
COMPONENT Devel
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/expirycheckerconfigbase.h
${CMAKE_CURRENT_BINARY_DIR}/kleo_export.h
${libkleo_HEADERS}
${libkleo_models_HEADERS}
${libkleo_ui_HEADERS}
${libkleo_utils_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/classifyconfig.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KPim${KF_MAJOR_VERSION}/Libkleo/libkleo
COMPONENT Devel
)
install(FILES
${PRI_FILENAME}
DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
if ( WIN32 )
install ( FILES libkleopatrarc-win32.desktop DESTINATION ${KDE_INSTALL_CONFDIR} RENAME libkleopatrarc )
else ()
install ( FILES libkleopatrarc.desktop DESTINATION ${KDE_INSTALL_CONFDIR} RENAME libkleopatrarc )
endif ()
if (BUILD_QCH)
ecm_add_qch(
KPim${KF_MAJOR_VERSION}Libkleo_QCH
NAME KPim${KF_MAJOR_VERSION}Libkleo
BASE_NAME KPim${KF_MAJOR_VERSION}Libkleo
VERSION ${PIM_VERSION}
ORG_DOMAIN org.kde
SOURCES # using only public headers, to cover only public API
${libkleo_HEADERS}
${libkleo_models_HEADERS}
${libkleo_ui_HEADERS}
${libkleo_utils_HEADERS}
#MD_MAINPAGE "${CMAKE_SOURCE_DIR}/README.md"
#IMAGE_DIRS "${CMAKE_SOURCE_DIR}/docs/pics"
LINK_QCHS
Qt${QT_MAJOR_VERSION}Core_QCH
Qt${QT_MAJOR_VERSION}Gui_QCH
Qt${QT_MAJOR_VERSION}Widgets_QCH
INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
BLANK_MACROS
KLEO_EXPORT
TAGFILE_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR}
QCH_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR}
COMPONENT Devel
)
endif()
diff --git a/src/ui/adjustingscrollarea.cpp b/src/ui/adjustingscrollarea.cpp
new file mode 100644
index 00000000..c0a699c9
--- /dev/null
+++ b/src/ui/adjustingscrollarea.cpp
@@ -0,0 +1,99 @@
+/* -*- mode: c++; c-basic-offset:4 -*-
+ utils/adjustingscrollarea.cpp
+
+ This file is part of Kleopatra, the KDE keymanager
+ SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
+ SPDX-FileCopyrightText: 2022 g10 Code GmbH
+ SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
+
+ SPDX-License-Identifier: GPL-2.0-or-later
+*/
+
+#include "adjustingscrollarea.h"
+
+#include <QApplication>
+#include <QResizeEvent>
+#include <QScreen>
+#include <QScrollBar>
+#include <QVBoxLayout>
+
+using namespace Kleo;
+
+AdjustingScrollArea::AdjustingScrollArea(QWidget *parent)
+ : QScrollArea{parent}
+{
+ auto w = new QWidget;
+ w->setObjectName(QLatin1String("scrollarea_widget"));
+ new QVBoxLayout{w};
+ setWidget(w);
+ setWidgetResizable(true);
+ w->installEventFilter(this);
+
+ connect(qApp, &QApplication::focusChanged, this, [this](QWidget *old, QWidget *now) {
+ Q_UNUSED(old);
+ ensureWidgetVisible(now);
+ });
+}
+
+AdjustingScrollArea::~AdjustingScrollArea()
+{
+ widget()->removeEventFilter(this);
+}
+
+QSize AdjustingScrollArea::minimumSizeHint() const
+{
+ const int fw = frameWidth();
+ QSize sz{2 * fw, 2 * fw};
+ sz += {widget()->minimumSizeHint().width(), 0};
+ if (verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff) {
+ sz.setWidth(sz.width() + verticalScrollBar()->sizeHint().width());
+ }
+ if (horizontalScrollBarPolicy() != Qt::ScrollBarAlwaysOff) {
+ sz.setHeight(sz.height() + horizontalScrollBar()->sizeHint().height());
+ }
+ return QScrollArea::minimumSizeHint().expandedTo(sz);
+}
+
+QSize AdjustingScrollArea::sizeHint() const
+{
+ const int fw = frameWidth();
+ QSize sz{2 * fw, 2 * fw};
+ sz += viewportSizeHint();
+ if (verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff) {
+ sz.setWidth(sz.width() + verticalScrollBar()->sizeHint().width());
+ }
+ if (horizontalScrollBarPolicy() != Qt::ScrollBarAlwaysOff) {
+ sz.setHeight(sz.height() + horizontalScrollBar()->sizeHint().height());
+ }
+ sz = QScrollArea::sizeHint().expandedTo(sz);
+ return sz;
+}
+
+void AdjustingScrollArea::adjustSizeOfWindowBy(const QSize &extent)
+{
+ if (auto w = window()) {
+ const auto currentSize = w->size();
+ // we limit the automatic size adjustment to 2/3 of the screen's size
+ const auto maxWindowSize = screen()->geometry().size() * 2 / 3;
+ const auto newWindowSize = currentSize.expandedTo((currentSize + extent).boundedTo(maxWindowSize));
+ if (newWindowSize != currentSize) {
+ w->resize(newWindowSize);
+ }
+ }
+}
+
+bool AdjustingScrollArea::eventFilter(QObject *obj, QEvent *ev)
+{
+ if (ev->type() == QEvent::Resize && obj == widget() && sizeAdjustPolicy() == AdjustToContents) {
+ const auto *const event = static_cast<QResizeEvent *>(ev);
+ if (event->size().height() > event->oldSize().height()) {
+ const auto currentViewportHeight = viewport()->height();
+ const auto wantedViewportHeight = event->size().height();
+ const auto wantedAdditionalHeight = wantedViewportHeight - currentViewportHeight;
+ if (wantedAdditionalHeight > 0) {
+ adjustSizeOfWindowBy(QSize{0, wantedAdditionalHeight});
+ }
+ }
+ }
+ return QScrollArea::eventFilter(obj, ev);
+}
diff --git a/src/ui/adjustingscrollarea.h b/src/ui/adjustingscrollarea.h
new file mode 100644
index 00000000..1e5ceaf0
--- /dev/null
+++ b/src/ui/adjustingscrollarea.h
@@ -0,0 +1,56 @@
+/* -*- mode: c++; c-basic-offset:4 -*-
+ utils/adjustingscrollarea.h
+
+ This file is part of Kleopatra, the KDE keymanager
+ SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
+ SPDX-FileCopyrightText: 2022 g10 Code GmbH
+ SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
+
+ SPDX-License-Identifier: GPL-2.0-or-later
+*/
+
+#pragma once
+
+#include <QScrollArea>
+
+namespace Kleo
+{
+
+/**
+ * This class improves a few aspects of QScrollArea for usage by us, in
+ * particular, for vertically scrollable widgets.
+ *
+ * If sizeAdjustPolicy is set to QAbstractScrollArea::AdjustToContents,
+ * then the scroll area will (try to) adjust its size to the widget to avoid
+ * scroll bars as much as possible.
+ */
+class AdjustingScrollArea : public QScrollArea
+{
+ Q_OBJECT
+
+public:
+ /**
+ * Creates a scroll area with a QWidget with QVBoxLayout that is flagged
+ * as resizable.
+ */
+ explicit AdjustingScrollArea(QWidget *parent = nullptr);
+ ~AdjustingScrollArea() override;
+
+ /**
+ * Reimplemented to add the minimum size hint of the widget.
+ */
+ QSize minimumSizeHint() const override;
+
+ /**
+ * Reimplemented to remove the caching of the size/size hint of the
+ * widget and to add the horizontal size hint of the vertical scroll bar
+ * unless it is explicitly turned off.
+ */
+ QSize sizeHint() const override;
+
+private:
+ void adjustSizeOfWindowBy(const QSize &extent);
+ bool eventFilter(QObject *obj, QEvent *ev) override;
+};
+
+}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Dec 8, 11:45 AM (8 h, 28 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b6/f9/e93b4c0bfab1556e3ed89e4c9cbc
Attached To
rLIBKLEO Libkleo
Event Timeline
Log In to Comment