Add support for Qt6

XCA now supports both, Qt6 and Qt5 down to Qt-5.2

Use CMAKE_PREFIX_PATH to point to the QT dompiler directory like
$ cmake -B build -DCMAKE_PREFIX_PATH=$HOME/6.3.1/gcc_64
This commit is contained in:
Christian Hohnstaedt 2022-08-24 13:26:32 +02:00 committed by Christian Hohnstaedt
parent ded935b033
commit ced6dfc41a
22 changed files with 118 additions and 84 deletions

View File

@ -25,7 +25,7 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
@ -49,15 +49,15 @@ if (APPLE)
execute_process(COMMAND brew --prefix OUTPUT_STRIP_TRAILING_WHITESPACE execute_process(COMMAND brew --prefix OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE BREW_PREFIX ERROR_QUIET) OUTPUT_VARIABLE BREW_PREFIX ERROR_QUIET)
# Preset the default brew paths.... # Preset the default brew paths....
if (NOT Qt5_DIR) if (NOT CMAKE_PREFIX_PATH)
set(Qt5_DIR ${BREW_PREFIX}/opt/qt@5/lib/cmake/Qt5) set(CMAKE_PREFIX_PATH ${BREW_PREFIX}/opt/qt@5/)
endif() endif()
if (NOT OPENSSL_ROOT_DIR) if (NOT OPENSSL_ROOT_DIR)
set(OPENSSL_ROOT_DIR ${BREW_PREFIX}/opt/openssl@1.1) set(OPENSSL_ROOT_DIR ${BREW_PREFIX}/opt/openssl@1.1)
endif() endif()
elseif(WIN32) elseif(WIN32)
if (NOT Qt5_DIR) if (NOT CMAKE_PREFIX_PATH)
set(Qt5_DIR "C:/Qt/5.15.2/mingw81_64/lib/cmake/Qt5") set(CMAKE_PREFIX_PATH "C:/Qt/5.15.2/mingw81_64/")
endif() endif()
if (NOT OPENSSL_ROOT_DIR) if (NOT OPENSSL_ROOT_DIR)
set(OPENSSL_ROOT_DIR $ENV{PROGRAMFILES}/OpenSSL-Win64) set(OPENSSL_ROOT_DIR $ENV{PROGRAMFILES}/OpenSSL-Win64)
@ -75,13 +75,18 @@ elseif(WIN32)
file(TO_CMAKE_PATH $ENV{WINDIR}/system32 SYSTEM32) file(TO_CMAKE_PATH $ENV{WINDIR}/system32 SYSTEM32)
endif() endif()
file(TO_CMAKE_PATH "${OPENSSL_ROOT_DIR}" OPENSSL_ROOT_DIR) file(TO_CMAKE_PATH "${OPENSSL_ROOT_DIR}" OPENSSL_ROOT_DIR)
file(TO_CMAKE_PATH "${Qt5_DIR}" Qt5_DIR)
file(TO_CMAKE_PATH "${PSQL_BINDIR}" PSQL_BINDIR) file(TO_CMAKE_PATH "${PSQL_BINDIR}" PSQL_BINDIR)
file(TO_CMAKE_PATH "${MYSQL_BINDIR}" MYSQL_BINDIR) file(TO_CMAKE_PATH "${MYSQL_BINDIR}" MYSQL_BINDIR)
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Core Widgets Sql Help LinguistTools) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
get_target_property(qmake_executable Qt5::qmake IMPORTED_LOCATION) set(QT Qt${QT_VERSION_MAJOR})
find_package(${QT} REQUIRED COMPONENTS Core Widgets Sql Help LinguistTools)
message(STATUS "Using ${QT} with version ${QT_VERSION}")
get_target_property(qmake_executable ${QT}::qmake IMPORTED_LOCATION)
get_target_property(core_libdir ${QT}::Core IMPORTED_LOCATION)
message(QTCORE ${core_libdir})
get_filename_component(_qt_bin_dir "${qmake_executable}" DIRECTORY) get_filename_component(_qt_bin_dir "${qmake_executable}" DIRECTORY)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}") find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}") find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}")
@ -93,9 +98,9 @@ endif()
target_link_libraries(${CMAKE_PROJECT_NAME} target_link_libraries(${CMAKE_PROJECT_NAME}
core widgets core core widgets core
OpenSSL::Crypto OpenSSL::Crypto
Qt5::Widgets Qt5::Core Qt5::Sql Qt5::Help ${QT}::Widgets ${QT}::Core ${QT}::Sql ${QT}::Help
) )
target_link_libraries(xcadoc core Qt5::Core) target_link_libraries(xcadoc core ${QT}::Core)
if (APPLE) if (APPLE)
@ -108,13 +113,13 @@ if (APPLE)
##### Plugins ##### Plugins
get_target_property(sqlplugins Qt5::Sql QT_ALL_PLUGINS_sqldrivers) get_target_property(sqlplugins ${QT}::Sql QT_ALL_PLUGINS_sqldrivers)
message(STATUS "SQL Plugins ${sqlplugins}") message(STATUS "SQL Plugins ${sqlplugins}")
foreach(sql ${sqlplugins}) foreach(sql ${sqlplugins})
get_target_property(loc ${sql} LOCATION_${CMAKE_BUILD_TYPE}) get_target_property(loc ${sql} LOCATION_${CMAKE_BUILD_TYPE})
list(APPEND sqlplugin_paths "${loc}") list(APPEND sqlplugin_paths "${loc}")
endforeach() endforeach()
qt5_import_plugins(${CMAKE_PROJECT_NAME} INCLUDE_BY_TYPE sqldrivers) qt_import_plugins(${CMAKE_PROJECT_NAME} INCLUDE_BY_TYPE sqldrivers)
# Avoid bin/ sub-directory in DMG # Avoid bin/ sub-directory in DMG
set(RUNTIME_DEST .) set(RUNTIME_DEST .)
@ -171,7 +176,7 @@ if(APPLE)
XCODE_ATTRIBUTE_SKIP_INSTALL No XCODE_ATTRIBUTE_SKIP_INSTALL No
RESOURCE "${APP_RESOURCES}" RESOURCE "${APP_RESOURCES}"
) )
get_target_property(qmake_executable Qt5::qmake IMPORTED_LOCATION) get_target_property(qmake_executable ${QT}::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${qmake_executable}" DIRECTORY) get_filename_component(_qt_bin_dir "${qmake_executable}" DIRECTORY)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS ${_qt_bin_dir}) find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS ${_qt_bin_dir})
@ -219,11 +224,11 @@ elseif(WIN32)
${CMAKE_BINARY_DIR}/styles ${CMAKE_BINARY_DIR}/styles
DESTINATION ${RUNTIME_DEST} DESTINATION ${RUNTIME_DEST}
) )
install(FILES ${CMAKE_BINARY_DIR}/Qt5Core.dll install(FILES ${CMAKE_BINARY_DIR}/${QT}Core.dll
${CMAKE_BINARY_DIR}/Qt5Gui.dll ${CMAKE_BINARY_DIR}/${QT}Gui.dll
${CMAKE_BINARY_DIR}/Qt5Help.dll ${CMAKE_BINARY_DIR}/${QT}Help.dll
${CMAKE_BINARY_DIR}/Qt5Sql.dll ${CMAKE_BINARY_DIR}/${QT}Sql.dll
${CMAKE_BINARY_DIR}/Qt5Widgets.dll ${CMAKE_BINARY_DIR}/${QT}Widgets.dll
${CMAKE_BINARY_DIR}/libgcc_s_seh-1.dll ${CMAKE_BINARY_DIR}/libgcc_s_seh-1.dll
${CMAKE_BINARY_DIR}/libstdc++-6.dll ${CMAKE_BINARY_DIR}/libstdc++-6.dll
${CMAKE_BINARY_DIR}/libwinpthread-1.dll ${CMAKE_BINARY_DIR}/libwinpthread-1.dll

View File

@ -48,5 +48,4 @@ if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
endif() endif()
message(STATUS "VERSION: ${PROJECT_VERSION}") message(STATUS "XCA Version: ${PROJECT_VERSION}")

View File

@ -129,7 +129,7 @@ if(SPHINX)
endif() endif()
else(QTCOLLGEN) else(QTCOLLGEN)
message(WARNING "Neither 'qhelpgenerator' nor 'qcollectiongenerator' found. In-app documentation disabed. ${Qt5_DIR}/../../../bin") message(WARNING "Neither 'qhelpgenerator' nor 'qcollectiongenerator' found. In-app documentation disabed. ${Qt_DIR}/../../../bin")
endif(QTCOLLGEN) endif(QTCOLLGEN)
else(SPHINX) else(SPHINX)
message(WARNING "sphinx-build binary not found. Documentation generation disabled") message(WARNING "sphinx-build binary not found. Documentation generation disabled")

View File

@ -28,7 +28,11 @@ string(APPEND WIX_LANG_CONTENT
WixFile(${D}/language.wxs ${WIX_LANG_CONTENT}) WixFile(${D}/language.wxs ${WIX_LANG_CONTENT})
qt5_add_translation(QM_FILES ${TS_FILES}) if (${QT_VERSION} VERSION_LESS 6.0.0)
qt5_add_translation(QM_FILES ${TS_FILES})
else()
qt_add_translation(QM_FILES ${TS_FILES})
endif()
list(APPEND APP_RESOURCES ${QM_FILES}) list(APPEND APP_RESOURCES ${QM_FILES})
add_custom_target(translations DEPENDS ${QM_FILES}) add_custom_target(translations DEPENDS ${QM_FILES})

View File

@ -1,10 +1,6 @@
include_directories(${Qt5Sql_INCLUDE_DIRS}
${Qt5Core_INCLUDE_DIRS} include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
${Qt5Help_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}
)
add_library(core STATIC add_library(core STATIC
BioByteArray.cpp dbhistory.cpp pki_key.cpp BioByteArray.cpp dbhistory.cpp pki_key.cpp
BioByteArray.h dbhistory.h pki_key.h BioByteArray.h dbhistory.h pki_key.h
@ -42,3 +38,6 @@ XcaProgress.h XcaWarningCore.cpp XcaWarningCore.h
PwDialogCore.cpp PwDialogCore.h digest.h PwDialogCore.cpp PwDialogCore.h digest.h
digest.cpp pki_export.cpp digest.cpp pki_export.cpp
) )
target_link_libraries(core PRIVATE
OpenSSL::Crypto ${QT}::Core ${QT}::Sql ${QT}::Help)

View File

@ -26,7 +26,7 @@
bool a1time::isUndefined() const bool a1time::isUndefined() const
{ {
return toTime_t() == 0; return toSecsSinceEpoch() == 0;
} }
a1time &a1time::setUndefined() a1time &a1time::setUndefined()
@ -34,7 +34,7 @@ a1time &a1time::setUndefined()
/* This way we handle "Jan 01, 1970 00:00:00" /* This way we handle "Jan 01, 1970 00:00:00"
* like RFC-5280 undefined date. I dare it */ * like RFC-5280 undefined date. I dare it */
setTimeSpec(Qt::UTC); setTimeSpec(Qt::UTC);
setTime_t(0); setSecsSinceEpoch(0);
return *this; return *this;
} }

View File

@ -596,7 +596,12 @@ void db_base::timerEvent(QTimerEvent *event)
qDebug() << "Date changed for" << pki->getIntName() << ":" << hd->getName() << "Col:" << idx << t.toSortable(); qDebug() << "Date changed for" << pki->getIntName() << ":" << hd->getName() << "Col:" << idx << t.toSortable();
QModelIndex i; QModelIndex i;
i = createIndex(rownumber(pki), idx, pki); i = createIndex(rownumber(pki), idx, pki);
emit dataChanged(i, i); #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
emit dataChanged(i, i, QList<int>{Qt::DisplayRole});
#else
emit dataChanged(i, i, QVector<int>{Qt::DisplayRole});
#endif
} }
} }
} }

View File

@ -237,7 +237,7 @@ const QString getDocDir()
#ifdef DOCDIR #ifdef DOCDIR
docs << QString(DOCDIR); docs << QString(DOCDIR);
#endif #endif
docs += QStandardPaths::standardLocations(QStandardPaths::DataLocation); docs += QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
foreach (docdir, docs) { foreach (docdir, docs) {
#if !defined(Q_OS_MAC) #if !defined(Q_OS_MAC)
docdir += "/html"; docdir += "/html";
@ -275,7 +275,7 @@ const QString getUserSettingsDir()
const QString getI18nDir() const QString getI18nDir()
{ {
QString qm = QStandardPaths::locate(QStandardPaths::DataLocation, QString qm = QStandardPaths::locate(QStandardPaths::AppDataLocation,
I18N_DIR "xca_de.qm"); I18N_DIR "xca_de.qm");
return QFileInfo(qm).path(); return QFileInfo(qm).path();
} }

View File

@ -14,7 +14,6 @@
#include <openssl/rand.h> #include <openssl/rand.h>
#include <QMessageBox> #include <QMessageBox>
#include <QTextCodec>
#include "ui_SelectToken.h" #include "ui_SelectToken.h"

View File

@ -150,7 +150,11 @@ QString XSqlQuery::rewriteQuery(QString _q)
QString XSqlQuery::query_details() QString XSqlQuery::query_details()
{ {
QString lq = lastq; QString lq = lastq;
QList<QVariant> list = boundValues().values(); #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
QVariantList list = boundValues();
#else
QVariantList list = boundValues().values();
#endif
QStringList sl; QStringList sl;
if (query != lastq) { if (query != lastq) {

View File

@ -13,6 +13,21 @@
Copy C:\Windows\System32\vcruntime140.dll C:\Windows\WOW64\ Copy C:\Windows\System32\vcruntime140.dll C:\Windows\WOW64\
The WIX system uses that one and it crashes on the target. The WIX system uses that one and it crashes on the target.
--> -->
<Component Id="CQtCore" Guid="561efd92-0fc8-4e2d-abe8-6ba16fc8bacd">
<File Id="QtCore.dll" Source="@QT@Core.dll" KeyPath="yes"/>
</Component>
<Component Id="CQtGui" Guid="2f680a70-2b2b-4b6e-9119-f53c8b5e1fe4">
<File Id="QtGui.dll" Source="@QT@Gui.dll" KeyPath="yes"/>
</Component>
<Component Id="CQtSql" Guid="df605486-2591-4232-8799-25ad2271e3d4">
<File Id="QtSql.dll" Source="@QT@Sql.dll" KeyPath="yes"/>
</Component>
<Component Id="CQtWidgets" Guid="eff9bc63-dc01-4f44-ab1f-8447a773817b">
<File Id="QtWidgets.dll" Source="@QT@Widgets.dll" KeyPath="yes"/>
</Component>
<Component Id="CQtHelp" Guid="83c15eef-0d1a-43a4-a0f7-1b90d0788705">
<File Id="QtHelp.dll" Source="@QT@Help.dll" KeyPath="yes"/>
</Component>
</DirectoryRef> </DirectoryRef>
<FeatureGroup Id="DatabaseGroup"> <FeatureGroup Id="DatabaseGroup">
<Feature Id="Databases" Title="Database Drivers" <Feature Id="Databases" Title="Database Drivers"

View File

@ -100,21 +100,6 @@
<Component Id="Clibgcc_s_seh1" Guid="f5c27ddf-a2e1-49e2-9f24-fbf97bc5cb70"> <Component Id="Clibgcc_s_seh1" Guid="f5c27ddf-a2e1-49e2-9f24-fbf97bc5cb70">
<File Id="libgcc_s_seh1.dll" Source="libgcc_s_seh-1.dll" KeyPath="yes"/> <File Id="libgcc_s_seh1.dll" Source="libgcc_s_seh-1.dll" KeyPath="yes"/>
</Component> </Component>
<Component Id="CQt5Core" Guid="561efd92-0fc8-4e2d-abe8-6ba16fc8bacd">
<File Id="Qt5Core.dll" Source="Qt5Core.dll" KeyPath="yes"/>
</Component>
<Component Id="CQt5Gui" Guid="2f680a70-2b2b-4b6e-9119-f53c8b5e1fe4">
<File Id="Qt5Gui.dll" Source="Qt5Gui.dll" KeyPath="yes"/>
</Component>
<Component Id="CQt5Sql" Guid="df605486-2591-4232-8799-25ad2271e3d4">
<File Id="Qt5Sql.dll" Source="Qt5Sql.dll" KeyPath="yes"/>
</Component>
<Component Id="CQt5Widgets" Guid="eff9bc63-dc01-4f44-ab1f-8447a773817b">
<File Id="Qt5Widgets.dll" Source="Qt5Widgets.dll" KeyPath="yes"/>
</Component>
<Component Id="CQt5Help" Guid="83c15eef-0d1a-43a4-a0f7-1b90d0788705">
<File Id="Qt5Help.dll" Source="Qt5Help.dll" KeyPath="yes"/>
</Component>
<Component Id="Ccopyright.rtf" Guid="83c15eef-0d1a-43a4-a0f7-1b90d0784712"> <Component Id="Ccopyright.rtf" Guid="83c15eef-0d1a-43a4-a0f7-1b90d0784712">
<File Id="copyright.rtf" Source="$(var.CPACK_WIX_LICENSE_RTF)" KeyPath="yes"/> <File Id="copyright.rtf" Source="$(var.CPACK_WIX_LICENSE_RTF)" KeyPath="yes"/>
</Component> </Component>
@ -188,11 +173,11 @@
<ComponentRef Id="Clibgcc_s_seh1"/> <ComponentRef Id="Clibgcc_s_seh1"/>
<ComponentRef Id="Clibcrypto11x64"/> <ComponentRef Id="Clibcrypto11x64"/>
<ComponentRef Id="Cvcruntime140"/> <ComponentRef Id="Cvcruntime140"/>
<ComponentRef Id="CQt5Core"/> <ComponentRef Id="CQtCore"/>
<ComponentRef Id="CQt5Gui"/> <ComponentRef Id="CQtGui"/>
<ComponentRef Id="CQt5Sql"/> <ComponentRef Id="CQtSql"/>
<ComponentRef Id="CQt5Widgets"/> <ComponentRef Id="CQtWidgets"/>
<ComponentRef Id="CQt5Help"/> <ComponentRef Id="CQtHelp"/>
<ComponentRef Id="Ccopyright.rtf"/> <ComponentRef Id="Ccopyright.rtf"/>
<ComponentRef Id="ApplicationShortcut" /> <ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="RegistryEntries" /> <ComponentRef Id="RegistryEntries" />
@ -201,7 +186,7 @@
<Feature Id='Complete' Title='XCA' Description="Complete Installation" <Feature Id='Complete' Title='XCA' Description="Complete Installation"
Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'> Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'>
<Feature Id="XCA" Title="Main Application" Level="1" Absent="disallow" <Feature Id="XCA" Title="Main Application" Level="1" Absent="disallow"
Description="Contains the main application, required Qt5 libraries and the SQLite driver."> Description="Contains the main application, required Qt libraries and the SQLite driver.">
<ComponentGroupRef Id="GroupBasic" /> <ComponentGroupRef Id="GroupBasic" />
<ComponentGroupRef Id="GroupI18n" /> <ComponentGroupRef Id="GroupI18n" />
<ComponentGroupRef Id="GroupMisc" /> <ComponentGroupRef Id="GroupMisc" />

View File

@ -1,11 +1,6 @@
include_directories(${Qt5Widgets_INCLUDE_DIRS}
${Qt5Sql_INCLUDE_DIRS} include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
${Qt5Core_INCLUDE_DIRS}
${Qt5Help_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}
)
add_library(widgets STATIC add_library(widgets STATIC
CertDetail.cpp NewCrl.cpp XcaApplication.h CertDetail.cpp NewCrl.cpp XcaApplication.h
CertDetail.h NewCrl.h XcaDialog.cpp CertDetail.h NewCrl.h XcaDialog.cpp
@ -34,3 +29,6 @@ MW_menu.cpp X509SuperTreeView.cpp v3ext.h
MainWindow.cpp X509SuperTreeView.h validity.cpp MainWindow.cpp X509SuperTreeView.h validity.cpp
MainWindow.h XcaApplication.cpp validity.h MainWindow.h XcaApplication.cpp validity.h
) )
target_link_libraries(widgets PRIVATE
OpenSSL::Crypto ${QT}::Widgets ${QT}::Core ${QT}::Sql ${QT}::Help)

View File

@ -207,7 +207,7 @@ void CertDetail::setReq(pki_x509req *req)
QGridLayout *attrLayout = new QGridLayout(attributes); QGridLayout *attrLayout = new QGridLayout(attributes);
attrLayout->setAlignment(Qt::AlignTop); attrLayout->setAlignment(Qt::AlignTop);
attrLayout->setSpacing(6); attrLayout->setSpacing(6);
attrLayout->setMargin(11); attrLayout->setContentsMargins(11, 11, 11, 11);
for (int i = 0, ii = 0; i<cnt; i++) { for (int i = 0, ii = 0; i<cnt; i++) {
int nid; int nid;

View File

@ -12,6 +12,9 @@
#include <QDialog> #include <QDialog>
#include <QHelpEngine> #include <QHelpEngine>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
#include <QHelpLink>
#endif
Help::Help() : QWidget(NULL), helpengine(nullptr) Help::Help() : QWidget(NULL), helpengine(nullptr)
{ {
@ -42,19 +45,29 @@ void Help::content()
display(QUrl("qthelp://org.sphinx.xca/doc/index.html")); display(QUrl("qthelp://org.sphinx.xca/doc/index.html"));
} }
QMap<QString, QUrl> Help::url_by_ctx(const QString &ctx) const QList<QUrl> Help::url_by_ctx(const QString &ctx) const
{ {
if (!helpengine) if (!helpengine)
return QMap<QString, QUrl>(); return QList<QUrl>();
return helpengine->linksForIdentifier(QString("%1.%1").arg(ctx)); #if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
QList<QUrl> l;
foreach(QHelpLink hl,
helpengine->documentsForIdentifier(QString("%1.%1").arg(ctx)))
{
l << hl.url;
}
return l;
#else
return helpengine->linksForIdentifier(QString("%1.%1").arg(ctx)).values();
#endif
} }
void Help::contexthelp(const QString &context) void Help::contexthelp(const QString &context)
{ {
QMap<QString, QUrl> helpctx = url_by_ctx(context); QList<QUrl> helpctx = url_by_ctx(context);
if (helpctx.count()) if (helpctx.count())
display(helpctx.constBegin().value()); display(helpctx.at(0));
} }
void Help::contexthelp() void Help::contexthelp()
@ -81,7 +94,7 @@ void Help::register_ctxhelp_button(QDialog *dlg, const QString &help_ctx) const
buttonBox->setProperty("help_ctx", QVariant(help_ctx)); buttonBox->setProperty("help_ctx", QVariant(help_ctx));
connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(contexthelp())); connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(contexthelp()));
if (helpengine && url_by_ctx(help_ctx).count() == 0) { if (url_by_ctx(help_ctx).count() == 0) {
qWarning() << "Unknown help context: " << help_ctx; qWarning() << "Unknown help context: " << help_ctx;
buttonBox->button(QDialogButtonBox::Help)->setEnabled(false); buttonBox->button(QDialogButtonBox::Help)->setEnabled(false);
} }

View File

@ -26,7 +26,7 @@ class Help: public QWidget, public Ui::Help
~Help(); ~Help();
void register_ctxhelp_button(QDialog *dlg, void register_ctxhelp_button(QDialog *dlg,
const QString &help_ctx) const; const QString &help_ctx) const;
QMap<QString, QUrl> url_by_ctx(const QString &ctx) const; QList<QUrl> url_by_ctx(const QString &ctx) const;
public slots: public slots:
void contexthelp(); void contexthelp();

View File

@ -14,6 +14,7 @@
#include "ExportDialog.h" #include "ExportDialog.h"
#include "XcaWarning.h" #include "XcaWarning.h"
#include <QAbstractItemView> #include <QAbstractItemView>
#include <QActionGroup>
#include <QMenu> #include <QMenu>
void KeyTreeView::fillContextMenu(QMenu *menu, QMenu *subExport, void KeyTreeView::fillContextMenu(QMenu *menu, QMenu *subExport,

View File

@ -28,6 +28,7 @@
#include <QMenuBar> #include <QMenuBar>
#include <QMessageBox> #include <QMessageBox>
#include <QFileDialog> #include <QFileDialog>
#include <QActionGroup>
static QAction *languageMenuEntry(const QStringList &sl) static QAction *languageMenuEntry(const QStringList &sl)
{ {

View File

@ -68,7 +68,8 @@ QList<nameEdit> NewX509::setupExplicitInputs(NIDlist nid_list,
layout = new QGridLayout(parent); layout = new QGridLayout(parent);
layout->setAlignment(Qt::AlignTop); layout->setAlignment(Qt::AlignTop);
layout->setSpacing(6); layout->setSpacing(6);
layout->setMargin(0); layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins(11, 11, 11, 11);
} }
int n = 0, col = 0; int n = 0, col = 0;

View File

@ -38,7 +38,8 @@ Options::Options(QWidget *parent)
<< tr("UTF8 strings only (RFC2459)") << tr("UTF8 strings only (RFC2459)")
<< tr("All strings"); << tr("All strings");
mbstring->addItems(s); mbstring->addItems(s);
mbstring->setCurrentIndex(string_opts.indexOf(Settings["string_opt"])); mbstring->setCurrentIndex(string_opts.indexOf(
QString(Settings["string_opt"])));
searchP11 = NULL; searchP11 = NULL;
transDnEntries->setText(transDnEntries->text() transDnEntries->setText(transDnEntries->text()

View File

@ -12,7 +12,6 @@
#include "lib/entropy.h" #include "lib/entropy.h"
#include <QClipboard> #include <QClipboard>
#include <QTextCodec>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QAction> #include <QAction>
@ -50,13 +49,13 @@ XcaApplication::XcaApplication(int &argc, char *argv[])
} }
langAvail << QLocale::system(); langAvail << QLocale::system();
langAvail << QString("en"); langAvail << QLocale("en");
QDirIterator qmIt(getI18nDir(), QStringList() << "*.qm", QDir::Files); QDirIterator qmIt(getI18nDir(), QStringList() << "*.qm", QDir::Files);
while (qmIt.hasNext()) { while (qmIt.hasNext()) {
XcaTranslator t; XcaTranslator t;
qmIt.next(); qmIt.next();
QString language = qmIt.fileInfo().baseName().mid(4, -1); QString language = qmIt.fileInfo().baseName().mid(4, -1);
if (t.load(language, "xca", getI18nDir())) if (t.load(QLocale(language), "xca", getI18nDir()))
langAvail << QLocale(language); langAvail << QLocale(language);
} }
setupLanguage(lang); setupLanguage(lang);
@ -157,8 +156,13 @@ bool XcaApplication::eventFilter(QObject *watched, QEvent *ev)
case QEvent::NonClientAreaMouseMove: case QEvent::NonClientAreaMouseMove:
if (mctr++ > 8) { if (mctr++ > 8) {
me = static_cast<QMouseEvent *>(ev); me = static_cast<QMouseEvent *>(ev);
Entropy::add(me->globalX()); #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
Entropy::add(me->globalY()); QPoint p = me->globalPosition().toPoint();
#else
QPoint p = me->globalPos();
#endif
Entropy::add(p.x());
Entropy::add(p.y());
mctr = 0; mctr = 0;
} }
break; break;
@ -174,7 +178,7 @@ bool XcaApplication::eventFilter(QObject *watched, QEvent *ev)
dynamic_cast<XcaTreeView*>(watched->parent()) : NULL; dynamic_cast<XcaTreeView*>(watched->parent()) : NULL;
if ((watched == mainw || treeview) && if ((watched == mainw || treeview) &&
me->button() == Qt::MidButton && me->button() == Qt::MiddleButton &&
QApplication::clipboard()->supportsSelection()) QApplication::clipboard()->supportsSelection())
{ {
mainw->pastePem(); mainw->pastePem();

View File

@ -23,16 +23,16 @@ DistName::DistName(QWidget* parent)
DistNameLayout = new QGridLayout(); DistNameLayout = new QGridLayout();
DistNameLayout->setAlignment(Qt::AlignTop); DistNameLayout->setAlignment(Qt::AlignTop);
DistNameLayout->setSpacing(6); DistNameLayout->setSpacing(6);
DistNameLayout->setMargin(11); DistNameLayout->setContentsMargins(11, 11, 11, 11);
QGridLayout *g = new QGridLayout(); QGridLayout *g = new QGridLayout();
g->setAlignment(Qt::AlignTop); g->setAlignment(Qt::AlignTop);
g->setSpacing(6); g->setSpacing(6);
g->setMargin(11); g->setContentsMargins(11, 11, 11, 11);
QVBoxLayout *v = new QVBoxLayout(this); QVBoxLayout *v = new QVBoxLayout(this);
v->setSpacing(6); v->setSpacing(6);
v->setMargin(11); v->setContentsMargins(11, 11, 11, 11);
v->addLayout(DistNameLayout); v->addLayout(DistNameLayout);
v->addStretch(); v->addStretch();
v->addLayout(g); v->addLayout(g);