Page MenuHome GnuPG

No OneTemporary

diff --git a/src/gpgolgui/CMakeLists.txt b/src/gpgolgui/CMakeLists.txt
index fbcd376..0841031 100644
--- a/src/gpgolgui/CMakeLists.txt
+++ b/src/gpgolgui/CMakeLists.txt
@@ -1,39 +1,40 @@
# Copyright (C) 2018 Intevation GmbH <info@intevation.de>
#
# This file is Free Software under the GNU GPL (v>=2)
# and comes with ABSOLUTELY NO WARRANTY!
# See LICENSE.txt for details.
set(EXECUTABLE_NAME "gpgolgui")
set(EXECUTABLE_SRC
main.cpp
gpgolgui-options.h
gpgolgui.cpp
gpgolconfigpage.cpp
+ cryptoconfigpage.cpp
${CMAKE_SOURCE_DIR}/src/img/icon.rc
${CMAKE_SOURCE_DIR}/src/util/strhelp.c
${CMAKE_SOURCE_DIR}/src/util/w32-util.cpp
${CMAKE_SOURCE_DIR}/src/util/w32-gettext.c
)
qt5_add_resources(EXECUTABLE_SRC gpgolgui.qrc)
add_executable(${EXECUTABLE_NAME}
${_add_executable_params}
${EXECUTABLE_SRC}
)
target_link_libraries(${EXECUTABLE_NAME}
Qt5::Widgets
KF5::WidgetsAddons
KF5::Libkleo
Gpgmepp
QGpgme
)
if (WIN32)
set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS "-municode")
endif(WIN32)
install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin)
diff --git a/src/gpgolgui/cryptoconfigpage.cpp b/src/gpgolgui/cryptoconfigpage.cpp
new file mode 100644
index 0000000..e6beac7
--- /dev/null
+++ b/src/gpgolgui/cryptoconfigpage.cpp
@@ -0,0 +1,134 @@
+/* Copyright (C) 2018 by Intevation GmbH <info@intevation.de>
+ *
+ * This file is Free Software under the GNU GPL (v>=2)
+ * and comes with ABSOLUTELY NO WARRANTY!
+ * See LICENSE.txt for details.
+ */
+
+#include "cryptoconfigpage.h"
+
+#include <QThread>
+#include <QVBoxLayout>
+#include <QProgressBar>
+#include <QLabel>
+#include <QDebug>
+
+#include <QGpgME/Protocol>
+#include <QGpgME/CryptoConfig>
+
+#include <Libkleo/CryptoConfigModule>
+
+void clearLayout(QLayout* layout, bool deleteWidgets = true)
+{
+ while (QLayoutItem* item = layout->takeAt(0))
+ {
+ if (deleteWidgets)
+ {
+ if (QWidget* widget = item->widget())
+ widget->deleteLater();
+ }
+ if (QLayout* childLayout = item->layout())
+ clearLayout(childLayout, deleteWidgets);
+ delete item;
+ }
+}
+
+class DelayLoader: public QThread
+{
+ Q_OBJECT
+ void run() override {
+ QGpgME::CryptoConfig *config = QGpgME::cryptoConfig();
+
+ /* Grab an entry to force the load */
+ auto entry = config->entry(QStringLiteral("gpg"),
+ QStringLiteral("Keyserver"),
+ QStringLiteral("keyserver"));
+ Q_UNUSED(entry);
+
+ emit resultReady(config);
+ deleteLater();
+ }
+signals:
+ void resultReady(QGpgME::CryptoConfig *config);
+};
+
+void CryptoConfigPage::delayLoadFinished(QGpgME::CryptoConfig *config)
+{
+ mConfigWidget = new Kleo::CryptoConfigModule(config,
+ Kleo::CryptoConfigModule::TabbedLayout);
+ auto lay = layout();
+ clearLayout(lay, true);
+ delete lay;
+ auto newLay = new QVBoxLayout(this);
+ newLay->addWidget(mConfigWidget);
+ connect(mConfigWidget, &Kleo::CryptoConfigModule::changed,
+ this, [this] () {
+ mCryptoConfigChanged = true;
+ });
+}
+
+CryptoConfigPage::CryptoConfigPage(QWidget *parent):
+ QWidget(parent),
+ mConfigWidget(nullptr),
+ mCryptoConfigChanged(false)
+{
+ auto loader = new DelayLoader;
+ auto vLay = new QVBoxLayout(this);
+ auto bar = new QProgressBar;
+ auto label = new QLabel;
+ label->setText(QStringLiteral("<h3>Loading module...</h3>"));
+ bar->setRange(0, 0);
+ vLay->addStretch(1);
+
+ auto subLay1 = new QVBoxLayout;
+ auto subLay3 = new QHBoxLayout;
+ subLay3->addStretch(0.5);
+ subLay3->addWidget(label);
+ subLay3->addStretch(1);
+ subLay1->addLayout(subLay3);
+ subLay1->addWidget(bar);
+
+ auto subLay2 = new QHBoxLayout;
+ subLay2->addStretch(0.1);
+ subLay2->addLayout(subLay1);
+ subLay2->addStretch(0.1);
+
+ vLay->addLayout(subLay2);
+
+ vLay->addStretch(1);
+
+ connect(loader, SIGNAL(resultReady(QGpgME::CryptoConfig *)),
+ this, SLOT(delayLoadFinished(QGpgME::CryptoConfig *)));
+
+ /*
+ connect(loader, &DelayLoader::resultReady, [this] (QGpgME::CryptoConfig *config) {
+ qDebug() << "Creating config widget";
+ mConfigWidget = new Kleo::CryptoConfigModule(config,
+ Kleo::CryptoConfigModule::TabbedLayout);
+ delete layout();
+ auto newLay = new QVBoxLayout(this);
+ newLay->addWidget(mConfigWidget);
+ connect(mConfigWidget, &Kleo::CryptoConfigModule::changed,
+ this, [this] () {
+ mCryptoConfigChanged = true;
+ });
+ });
+ */
+ loader->start();
+}
+
+void CryptoConfigPage::save()
+{
+ if (mConfigWidget && mCryptoConfigChanged) {
+ mConfigWidget->save();
+ }
+}
+
+void CryptoConfigPage::defaults()
+{
+ if (mConfigWidget) {
+ mConfigWidget->defaults();
+ }
+}
+
+#include "cryptoconfigpage.moc"
diff --git a/src/gpgolgui/cryptoconfigpage.h b/src/gpgolgui/cryptoconfigpage.h
new file mode 100644
index 0000000..405d12a
--- /dev/null
+++ b/src/gpgolgui/cryptoconfigpage.h
@@ -0,0 +1,41 @@
+/* Copyright (C) 2018 by Intevation GmbH <info@intevation.de>
+ *
+ * This file is Free Software under the GNU GPL (v>=2)
+ * and comes with ABSOLUTELY NO WARRANTY!
+ * See LICENSE.txt for details.
+ */
+
+#ifndef CRYPTOCONFIGPAGE_H
+#define CRYPTOCONFIGPAGE_H
+
+#include <QWidget>
+
+namespace Kleo
+{
+ class CryptoConfigModule;
+} // namespace Kleo
+
+namespace QGpgME
+{
+ class CryptoConfig;
+}
+
+class CryptoConfigPage: public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit CryptoConfigPage(QWidget *parent = nullptr);
+
+ void save();
+ void load();
+ void defaults();
+
+private Q_SLOTS:
+ void delayLoadFinished(QGpgME::CryptoConfig *config);
+
+private:
+ Kleo::CryptoConfigModule *mConfigWidget;
+ bool mCryptoConfigChanged;
+};
+#endif
diff --git a/src/gpgolgui/gpgolconfigpage.cpp b/src/gpgolgui/gpgolconfigpage.cpp
index 1131570..e941bde 100644
--- a/src/gpgolgui/gpgolconfigpage.cpp
+++ b/src/gpgolgui/gpgolconfigpage.cpp
@@ -1,137 +1,264 @@
/* Copyright (C) 2018 by Intevation GmbH <info@intevation.de>
*
* This file is Free Software under the GNU GPL (v>=2)
* and comes with ABSOLUTELY NO WARRANTY!
* See LICENSE.txt for details.
*/
#include "gpgolconfigpage.h"
#include "w32-gettext.h"
#include "w32-util.h"
#include <QDebug>
#include <QGroupBox>
#include <QLabel>
#include <QCheckBox>
#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QToolTip>
+#include <QPushButton>
+/*
+class ExplainingChkBox: public QWidget
+{
+ Q_OBJECT
+public:
+ explicit ExplainingChkBox(const QString &text, const QString &explanation):
+ mChkBox(new QCheckBox(text)),
+ mExplanation(explanation)
+ {
+ auto hBox = new QHBoxLayout(this);
+
+ hBox->addWidget(mChkBox);
+
+ auto infoBtn = new QPushButton;
+ infoBtn->setIcon(QIcon::fromTheme("help-contextual"));
+ hBox->addWidget(infoBtn);
+ hBox->addStretch(1);
+
+ connect(infoBtn, &QPushButton::clicked, this, [this, infoBtn] () {
+ QToolTip::showText(infoBtn->mapToGlobal(QPoint()), mExplanation, infoBtn);
+ });
+ }
+
+ void setChecked(bool value)
+ {
+ mChkBox->setChecked(value);
+ }
+private:
+ QCheckBox *mChkBox;
+ QString mExplanation;
+};
+*/
GpgOLConfigPage::GpgOLConfigPage(QWidget *parent):
QWidget(parent)
{
setupGUI();
load();
}
-void GpgOLConfigPage::setVersion(const QString &version)
+/* Helper to build an "About" style layout.
+static QLayout *buildAboutLayout(const QString &version)
{
- mVersionLabel->setText(version);
+ auto hLay = new QHBoxLayout;
+ auto vLay = new QVBoxLayout;
+ hLay->addLayout(vLay);
+ hLay->addStretch(1);
+
+ auto iconLbl = new QLabel;
+ iconLbl->setPixmap(QIcon(":/gpgol-logo.png").pixmap(128, 80));
+ auto versionLbl = new QLabel(QStringLiteral(" ") + QString::fromUtf8(_("Version ")) + version);
+ vLay->addWidget(iconLbl);
+ vLay->addWidget(versionLbl);
+
+ return hLay;
}
+*/
void GpgOLConfigPage::setupGUI()
{
auto baseLay = new QVBoxLayout(this);
mSMIMEGrp = new QGroupBox(_("Enable the S/MIME support"));
mSMIMEGrp->setCheckable(true);
mSMIMEGrp->setAlignment(Qt::AlignLeft);
auto smimeLay = new QVBoxLayout(mSMIMEGrp);
mPreferSMIMEChk = new QCheckBox(_("Prefer S/MIME when autoresolving recipients"));
+ mPreferSMIMEChk->setToolTip(_("If automatic resolution is enabled, prefer S/MIME over OpenPGP if both are possible."));
smimeLay->addWidget(mPreferSMIMEChk);
baseLay->addWidget(mSMIMEGrp);
// The general group
auto generalGrp = new QGroupBox(_("General"));
auto generalLay = new QVBoxLayout(generalGrp);
generalGrp->setAlignment(Qt::AlignLeft);
mAlwaysSigChk = new QCheckBox(_("&Sign new messages by default"));
+ mAlwaysSigChk->setToolTip(_("Toggles the sign option for all new mails."));
mAlwaysEncChk = new QCheckBox(_("&Encrypt new messages by default"));
+ mAlwaysSigChk->setToolTip(_("Toggles the encrypt option for all new mails."));
+
+ mReplyCryptChk = new QCheckBox(_("S&elect crypto settings automatically "
+ "for reply and forward"));
+ mReplyCryptChk->setToolTip(_("Toggles sign, encrypt options if the original mail was signed or encrypted."));
+
+ mInlinePGPChk = new QCheckBox(_("&Send OpenPGP mails without attachments as PGP/Inline"));
+ mInlinePGPChk->setToolTip(_("Instead of using the PGP/MIME format, "
+ "which properly handles attachments and encoding, "
+ "the deprecated PGP/Inline is used.\n"
+ "This can be useful for compatibility but should generally not "
+ "be used."));
generalLay->addWidget(mAlwaysSigChk);
generalLay->addWidget(mAlwaysEncChk);
+ generalLay->addWidget(mReplyCryptChk);
+ generalLay->addWidget(mInlinePGPChk);
baseLay->addWidget(generalGrp);
// The automation checkboxes
mAutomationGrp = new QGroupBox(_("Automation"));
mAutomationGrp->setToolTip(_("Enable or disable any automated key handling."));
auto autoLayout = new QVBoxLayout(mAutomationGrp);
mAutomationGrp->setCheckable(true);
- mAutoTrustChk = new QCheckBox(QStringLiteral("%1 (%2)").arg(_("Automate OpenPGP trust based on communication history")).arg(_("experimental")));
- mAutoTrustChk->setToolTip(_("This changes the trust model to \"tofu+pgp\" which tracks the history of key usage. Automated trust can <b>never</b> exceed level 2."));
+ mAutoResolveChk = new QCheckBox(_("&Resolve recipient keys automatically"));
+ autoLayout->addWidget(mAutoResolveChk);
- mAutoSecureChk = new QCheckBox(_("Automatically secure messages"));
+ auto subLay = new QHBoxLayout;
+ mAutoSecureChk = new QCheckBox(_("Automatically secure &messages"));
mAutoSecureChk->setToolTip(_("Automatically toggles secure if keys with at least level 1 trust were found for all recipients."));
+ subLay->addSpacing(20);
+ subLay->addWidget(mAutoSecureChk);
+ autoLayout->addLayout(subLay);
- autoLayout->addWidget(mAutoSecureChk);
+ mAutoTrustChk = new QCheckBox(QStringLiteral("%1 (%2)").arg(_("Include OpenPGP &trust based on communication history")).arg(_("experimental")));
+ mAutoTrustChk->setToolTip(_("This changes the trust model to \"tofu+pgp\" which tracks the history of key usage. "
+ "Automated trust can <b>never</b> exceed level 2."));
autoLayout->addWidget(mAutoTrustChk);
+
baseLay->addWidget(mAutomationGrp);
+
+ // baseLay->addLayout(buildAboutLayout(mVersion));
+
baseLay->addStretch(1);
+
+ connect(mAutoResolveChk, &QCheckBox::toggled, [this] (bool on) {
+ mAutoSecureChk->setEnabled(on);
+ mPreferSMIMEChk->setEnabled(mSMIMEGrp->isChecked() && on);
+ });
+ connect(mSMIMEGrp, &QGroupBox::toggled, [this] (bool on) {
+ mPreferSMIMEChk->setEnabled(mAutoSecureChk->isChecked() && on);
+ });
}
static bool strToBool(const std::string &str, bool defaultVal = false)
{
if (str.empty()) {
return defaultVal;
}
if (str == "1") {
return true;
}
if (str == "0") {
return false;
}
qDebug() << "Unknown bool val" << str.c_str();
return defaultVal;
}
static bool loadBool(const char *name, bool defaultVal)
{
return strToBool(W32::readRegStr(nullptr, GPGOL_REG_PATH, name), defaultVal);
}
+/* Bump this if you remove a config value */
+#define CONFIG_VERSION "1"
+
static const QMap<QString, bool> defaultMap {
{ QStringLiteral("enableSmime"), false },
{ QStringLiteral("encryptDefault"), false },
{ QStringLiteral("signDefault"), false },
{ QStringLiteral("inlinePGP"), false },
{ QStringLiteral("replyCrypt"), true },
{ QStringLiteral("preferSmime"), false },
{ QStringLiteral("debugGPGME"), false },
{ QStringLiteral("automation"), true },
+ { QStringLiteral("autoresolve"), true },
{ QStringLiteral("autosecure"), true },
{ QStringLiteral("autotrust"), false },
- { QStringLiteral("import-autocrypt"), true },
};
void GpgOLConfigPage::updateGUI(const QMap<QString, bool> &values)
{
bool smimeEnabled = values["enableSmime"];
mSMIMEGrp->setChecked(smimeEnabled);
+ mPreferSMIMEChk->setChecked(values["preferSmime"]);
+
+ mAlwaysEncChk->setChecked(values["encryptDefault"]);
+ mAlwaysSigChk->setChecked(values["signDefault"]);
+ mInlinePGPChk->setChecked(values["inlinePGP"]);
+ mReplyCryptChk->setChecked(values["replyCrypt"]);
mAutomationGrp->setChecked(values["automation"]);
mAutoSecureChk->setChecked(values["autosecure"]);
mAutoTrustChk->setChecked(values["autotrust"]);
- mPreferSMIMEChk->setChecked(values["preferSmime"]);
+ mAutoResolveChk->setChecked(values["autoresolve"]);
+
+ mAutoSecureChk->setEnabled(mAutoResolveChk->isChecked());
+ mPreferSMIMEChk->setEnabled(mAutoResolveChk->isChecked() && smimeEnabled);
}
void GpgOLConfigPage::load()
{
QMap<QString, bool> confValues;
for (const auto &key: defaultMap.keys()) {
confValues[key] = loadBool(key.toLocal8Bit().constData(), defaultMap[key]);
}
updateGUI(confValues);
+
+ const std::string version = W32::readRegStr(nullptr, GPGOL_REG_PATH, "config-version");
+ if (version != CONFIG_VERSION) {
+ qDebug() << "Config update. Cleaning old values";
+ }
+}
+
+void GpgOLConfigPage::defaults()
+{
+ updateGUI(defaultMap);
+}
+
+static void saveBool(const char *name, bool value)
+{
+ const char *val = value ? "1" : "0";
+
+ if (!W32::writeRegStr(nullptr, GPGOL_REG_PATH, name, val)) {
+ qWarning() << "Failed to write registry value for" << name;
+ }
}
void GpgOLConfigPage::save() const
{
+ saveBool("enableSmime", mSMIMEGrp->isChecked());
+ saveBool("preferSmime", mPreferSMIMEChk->isChecked());
+
+ saveBool("encryptDefault", mAlwaysEncChk->isChecked());
+ saveBool("signDefault", mAlwaysSigChk->isChecked());
+ saveBool("inlinePGP", mInlinePGPChk->isChecked());
+ saveBool("replyCrypt", mReplyCryptChk->isChecked());
+ saveBool("automation", mAutomationGrp->isChecked());
+ saveBool("autosecure", mAutoSecureChk->isChecked());
+ saveBool("autotrust", mAutoTrustChk->isChecked());
+
+ W32::writeRegStr(nullptr, GPGOL_REG_PATH, "config-version", CONFIG_VERSION);
}
+
+#include "gpgolconfigpage.moc"
diff --git a/src/gpgolgui/gpgolconfigpage.h b/src/gpgolgui/gpgolconfigpage.h
index 923642e..5209c78 100644
--- a/src/gpgolgui/gpgolconfigpage.h
+++ b/src/gpgolgui/gpgolconfigpage.h
@@ -1,45 +1,46 @@
#ifndef GPGOLCONFIGPAGE_H
#define GPGOLCONFIGPAGE_H
/* Copyright (C) 2018 by Intevation GmbH <info@intevation.de>
*
* This file is Free Software under the GNU GPL (v>=2)
* and comes with ABSOLUTELY NO WARRANTY!
* See LICENSE.txt for details.
*/
#include <QWidget>
#include <QMap>
#include <QString>
class QGroupBox;
class QCheckBox;
class QLabel;
+class ExplainingChkBox;
class GpgOLConfigPage: public QWidget
{
Q_OBJECT
public:
explicit GpgOLConfigPage(QWidget *parent = nullptr);
void save() const;
void load();
void defaults();
- void setVersion(const QString &version);
-
protected:
void setupGUI();
void updateGUI(const QMap<QString, bool> &values);
private:
QGroupBox *mSMIMEGrp,
*mAutomationGrp;
QCheckBox *mPreferSMIMEChk,
*mAutoSecureChk,
- *mAutoTrustChk,
*mAlwaysEncChk,
- *mAlwaysSigChk;
- QLabel *mVersionLabel;
+ *mAlwaysSigChk,
+ *mInlinePGPChk,
+ *mAutoTrustChk,
+ *mAutoResolveChk,
+ *mReplyCryptChk;
};
#endif
diff --git a/src/gpgolgui/gpgolgui-options.h b/src/gpgolgui/gpgolgui-options.h
index 65c71a9..e2874a6 100644
--- a/src/gpgolgui/gpgolgui-options.h
+++ b/src/gpgolgui/gpgolgui-options.h
@@ -1,36 +1,39 @@
#ifndef GPGOLGUI_OPTIONS
#define GPGOLGUI_OPTIONS
/* Copyright (C) 2018 by Intevation GmbH <info@intevation.de>
*
* This file is Free Software under the GNU GPL (v>=2)
* and comes with ABSOLUTELY NO WARRANTY!
* See LICENSE.txt for details.
*/
#include <QCommandLineParser>
#include <QList>
/** @file Commandline options*/
static void options(QCommandLineParser &parser)
{
QList<QCommandLineOption> options;
options
<< QCommandLineOption(QStringList() << QStringLiteral("debug"),
QStringLiteral("Print debug output."))
<< QCommandLineOption(QStringLiteral("hwnd"),
QStringLiteral("Parent Window"),
QStringLiteral("windows window handle"))
<< QCommandLineOption(QStringLiteral("lang"),
QStringLiteral("Language"),
QStringLiteral("Language to be used e.g. de_DE"))
+ << QCommandLineOption(QStringLiteral("gpgol-version"),
+ QStringLiteral("Version string"),
+ QStringLiteral("GpgOL's Version"))
<< QCommandLineOption(QStringLiteral("alwaysShow"),
QStringLiteral("Should always be shown"));
for (const auto &opt: options) {
parser.addOption(opt);
}
parser.addVersionOption();
parser.addHelpOption();
}
#endif
diff --git a/src/gpgolgui/gpgolgui.cpp b/src/gpgolgui/gpgolgui.cpp
index bda92db..91c1049 100644
--- a/src/gpgolgui/gpgolgui.cpp
+++ b/src/gpgolgui/gpgolgui.cpp
@@ -1,90 +1,106 @@
/* Copyright (C) 2018 by Intevation GmbH <info@intevation.de>
*
* This file is Free Software under the GNU GPL (v>=2)
* and comes with ABSOLUTELY NO WARRANTY!
* See LICENSE.txt for details.
*/
#include "gpgolgui.h"
#include "w32-gettext.h"
+#include "w32-util.h"
#include "gpgolconfigpage.h"
+#include "cryptoconfigpage.h"
#include <QLabel>
#include <QWidget>
#include <QVBoxLayout>
#include <QDialogButtonBox>
#include <QPushButton>
-
-#include <QGpgME/Protocol>
-#include <QGpgME/CryptoConfig>
+#include <QCommandLineParser>
+#include <QDebug>
#include <KPageDialog>
#include <KGuiItem>
#include <KStandardGuiItem>
-#include <Libkleo/CryptoConfigModule>
-
-GpgOLGUI::GpgOLGUI(const QCommandLineParser &parser): KPageDialog(nullptr)
+GpgOLGUI::GpgOLGUI(const QCommandLineParser &parser):
+ KPageDialog(nullptr)
{
+ setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
+
setWindowTitle(_("Configure GpgOL"));
- setupGUI();
- setWindowIcon(QIcon(":/gpgolicon.svg"));
+ setWindowIcon(QIcon(":/gpgol-icon.svg"));
+
+ const auto hwnd = parser.value(QStringLiteral("hwnd"));
+ if (!hwnd.isEmpty()) {
+ bool ok;
+ WId id = (WId) hwnd.toInt(&ok);
+ if (!ok) {
+ qDebug() << "invalid hwnd value";
+ } else {
+ W32::setupForeignParent(id, this, true);
+ setModal(true);
+ }
+ }
+
+ if (parser.isSet("gpgol-version")) {
+ mVersion = parser.value("gpgol-version");
+ } else {
+ mVersion = QStringLiteral("unknown version");
+ }
+
+ setupGUI();
resize(800, 500);
}
void GpgOLGUI::setupGUI()
{
setFaceType(KPageDialog::List);
QDialogButtonBox *buttonBox = new QDialogButtonBox();
buttonBox->setStandardButtons(QDialogButtonBox::RestoreDefaults |
QDialogButtonBox::Cancel |
QDialogButtonBox::Ok);
KGuiItem::assign(buttonBox->button(QDialogButtonBox::Ok), KStandardGuiItem::ok());
KGuiItem::assign(buttonBox->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
KGuiItem::assign(buttonBox->button(QDialogButtonBox::RestoreDefaults),
KStandardGuiItem::defaults());
setButtonBox(buttonBox);
- QGpgME::CryptoConfig *const config = QGpgME::cryptoConfig();
-
- auto cryptoConfWidget = new Kleo::CryptoConfigModule(config,
- Kleo::CryptoConfigModule::TabbedLayout);
-
+ auto cryptoConfWidget = new CryptoConfigPage;
auto gpgolConfWidget = new GpgOLConfigPage;
- connect(cryptoConfWidget, &Kleo::CryptoConfigModule::changed,
- this, [this] () {
- mCryptoConfigChanged = true;
- });
-
connect(buttonBox->button(QDialogButtonBox::Ok), &QAbstractButton::clicked,
- this, [this, cryptoConfWidget] () {
- if (mCryptoConfigChanged) {
- cryptoConfWidget->save();
- }
+ this, [this, cryptoConfWidget, gpgolConfWidget] () {
+ cryptoConfWidget->save();
+ gpgolConfWidget->save();
close();
});
connect(buttonBox->button(QDialogButtonBox::RestoreDefaults), &QAbstractButton::clicked,
- this, [this, cryptoConfWidget] () {
- cryptoConfWidget->defaults();
- mCryptoConfigChanged = true;
+ this, [this, cryptoConfWidget, gpgolConfWidget] () {
+
+ if (currentPage()->widget() == cryptoConfWidget) {
+ cryptoConfWidget->defaults();
+ } else {
+ gpgolConfWidget->defaults();
+ }
});
connect(buttonBox->button(QDialogButtonBox::Cancel), &QAbstractButton::clicked,
this, [this] () {
close();
});
KPageWidgetItem *page = new KPageWidgetItem(gpgolConfWidget, _("GpgOL"));
- page->setHeader(_("Configure GpgOL"));
- page->setIcon(QIcon(":/gpgolicon.svg"));
+ page->setHeader(QStringLiteral("%1 - %2%3").arg(_("Configure GpgOL")).arg(
+ _("Version ")).arg(mVersion));
+ page->setIcon(QIcon(":/gpgol-icon.svg"));
addPage(page);
page = new KPageWidgetItem(cryptoConfWidget, QStringLiteral("%1\n%2").arg(_("GnuPG System")).arg(_("(Technical)")));
page->setHeader(_("Configuration of GnuPG System options"));
page->setIcon(QIcon::fromTheme("document-encrypt"));
addPage(page);
}
diff --git a/src/gpgolgui/gpgolgui.h b/src/gpgolgui/gpgolgui.h
index d6781dd..439ac66 100644
--- a/src/gpgolgui/gpgolgui.h
+++ b/src/gpgolgui/gpgolgui.h
@@ -1,28 +1,30 @@
#ifndef GPGOLGUI_H
#define GPGOLGUI_H
/* Copyright (C) 2018 by Intevation GmbH <info@intevation.de>
*
* This file is Free Software under the GNU GPL (v>=2)
* and comes with ABSOLUTELY NO WARRANTY!
* See LICENSE.txt for details.
*/
#include <KPageDialog>
+#include <QString>
class QCommandLineParser;
class GpgOLGUI: public KPageDialog
{
Q_OBJECT
public:
GpgOLGUI(const QCommandLineParser &parser);
protected:
/** @brief UI setup */
void setupGUI();
private:
bool mCryptoConfigChanged;
+ QString mVersion;
};
#endif // GPGOLGUI_H
diff --git a/src/gpgolgui/gpgolgui.qrc b/src/gpgolgui/gpgolgui.qrc
index 4a15572..278d101 100644
--- a/src/gpgolgui/gpgolgui.qrc
+++ b/src/gpgolgui/gpgolgui.qrc
@@ -1,5 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
- <file alias="gpgolicon.svg">../img/lock.svg</file>
+ <file alias="gpgol-icon.svg">../img/lock.svg</file>
+ <file alias="gpgol-logo.png">../img/gpgol-logo.png</file>
</qresource>
</RCC>
diff --git a/src/img/gpgol-logo.png b/src/img/gpgol-logo.png
new file mode 100644
index 0000000..8f29f98
Binary files /dev/null and b/src/img/gpgol-logo.png differ
diff --git a/src/img/gpgol-logo.svg b/src/img/gpgol-logo.svg
new file mode 100644
index 0000000..2666e87
--- /dev/null
+++ b/src/img/gpgol-logo.svg
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ id="Ebene_1"
+ data-name="Ebene 1"
+ viewBox="0 0 242.47081 151.87432"
+ version="1.1"
+ inkscape:version="0.48.3.1 r9886"
+ width="100%"
+ height="100%"
+ sodipodi:docname="GpgOL finnished Logo.svg">
+ <metadata
+ id="metadata35">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>GpgOL finnished Logo</dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1680"
+ inkscape:window-height="993"
+ id="namedview33"
+ showgrid="false"
+ inkscape:zoom="1.736707"
+ inkscape:cx="128.09685"
+ inkscape:cy="-37.753291"
+ inkscape:window-x="-3"
+ inkscape:window-y="-3"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Ebene_1"
+ fit-margin-top="8"
+ fit-margin-left="10"
+ fit-margin-right="10"
+ fit-margin-bottom="5">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3168"
+ empspacing="5"
+ visible="true"
+ enabled="true"
+ snapvisiblegridlinesonly="true"
+ originx="9.9114058px"
+ originy="4.6946475px" />
+ </sodipodi:namedview>
+ <defs
+ id="defs3">
+ <style
+ id="style5">.cls-1{fill:#1f8fcf;}.cls-2{fill:#3d3d3b;}.cls-3{fill:#1b72b8;}.cls-4{fill:#3d3c3b;}.cls-5{fill:#1f8ece;}</style>
+ </defs>
+ <title
+ id="title7">GpgOL finnished Logo</title>
+ <polygon
+ id="polygon4191"
+ points="40.6,281.41 40.6,281.41 0,247.55 0,316.6 81.19,316.6 81.19,247.55 "
+ class="cls-4"
+ style="fill:#1f8ece"
+ transform="translate(9.9999924,-175.14)" />
+ <polygon
+ id="polygon4193"
+ points="40.6,276.5 81.19,242.65 0,242.65 0,242.65 "
+ class="cls-4"
+ style="fill:#1f8ece"
+ transform="translate(9.9999924,-175.14)" />
+ <path
+ id="path4195"
+ d="m 17.419993,43.000001 v 20.56 h 14.14 v -20.56 c 0,-11.26 8.54,-20.43 19,-20.43 10.46,0 19,9.16 19,20.43 v 20.56 h 14.14 v -20.56 c 0,-19.32 -14.87,-35.0000006 -33.17,-35.0000006 h 0 c -18.29,0 -33.17,15.7200006 -33.17,35.0000006"
+ class="cls-3"
+ inkscape:connector-curvature="0"
+ style="fill:#3d3d3b" />
+ <g
+ transform="matrix(0.98456381,0,0,1.0156782,9.9114061,7.9796704)"
+ style="font-size:26.2523365px;font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0.19689253px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#3d3d3b;fill-opacity:1;stroke:none;font-family:Roboto Condensed;-inkscape-font-specification:'Roboto Condensed, Light'"
+ id="text4209">
+ <path
+ d="m 107.33714,125.32935 c -0.13674,2.09369 -0.70075,3.63191 -1.69204,4.61467 -0.99131,0.9742 -2.36289,1.46131 -4.11475,1.46131 -0.8973,0 -1.709139,-0.17519 -2.435516,-0.52556 -0.717842,-0.35038 -1.328857,-0.85457 -1.833049,-1.51259 -0.504198,-0.65801 -0.893026,-1.45703 -1.166486,-2.39706 -0.273463,-0.94857 -0.410194,-2.01678 -0.410192,-3.20463 l 0,-4.0122 c -2e-6,-1.17075 0.136729,-2.22187 0.410192,-3.15336 0.27346,-0.93146 0.666561,-1.71766 1.179305,-2.35861 0.512737,-0.64945 1.136571,-1.1451 1.871504,-1.48695 0.734923,-0.35035 1.568122,-0.52554 2.499612,-0.52555 0.84601,1e-5 1.60231,0.11965 2.26888,0.35891 0.6751,0.2393 1.2562,0.60677 1.74332,1.1024 0.48709,0.49566 0.87165,1.12804 1.15367,1.89714 0.28199,0.76912 0.45718,1.68351 0.52555,2.74316 l -1.48694,0 c -0.0684,-0.85455 -0.20084,-1.58093 -0.39738,-2.17915 -0.19656,-0.59818 -0.47002,-1.08528 -0.82038,-1.46131 -0.34184,-0.37599 -0.76058,-0.64945 -1.25622,-0.82038 -0.49566,-0.1709 -1.07249,-0.25636 -1.7305,-0.25637 -0.72639,1e-5 -1.36732,0.14102 -1.922778,0.42301 -0.555475,0.27348 -1.025487,0.67085 -1.410038,1.19212 -0.376014,0.5213 -0.662294,1.16223 -0.858841,1.92278 -0.188008,0.76058 -0.282011,1.61942 -0.282008,2.57652 l 0,4.03784 c -3e-6,0.94857 0.08973,1.81169 0.269189,2.58934 0.188002,0.76911 0.461463,1.42713 0.820386,1.97405 0.36746,0.54693 0.82038,0.96994 1.358764,1.26903 0.546916,0.29911 1.183566,0.44865 1.909956,0.44865 0.68365,0 1.28185,-0.0769 1.7946,-0.23073 0.51273,-0.16237 0.94428,-0.42728 1.29467,-0.79475 0.35036,-0.36746 0.62382,-0.85029 0.82038,-1.44849 0.20509,-0.60674 0.34182,-1.35449 0.4102,-2.24324 l 1.48694,0"
+ id="path3014"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 116.34036,118.61244 c -0.14528,-0.0256 -0.29056,-0.047 -0.43583,-0.0641 -0.13673,-0.0171 -0.29056,-0.0256 -0.46146,-0.0256 -0.41875,1e-5 -0.79903,0.0769 -1.14085,0.23073 -0.33329,0.14529 -0.62811,0.35466 -0.88448,0.62811 -0.25637,0.26493 -0.47856,0.58539 -0.66656,0.96139 -0.17947,0.37602 -0.32047,0.78621 -0.42301,1.23058 l 0,9.57544 -1.42286,0 0,-13.86965 1.39722,0 0.0256,2.0766 c 0.31618,-0.72637 0.73492,-1.29465 1.25621,-1.70486 0.52128,-0.41872 1.16221,-0.62809 1.92278,-0.62811 0.15382,2e-5 0.31618,0.0171 0.4871,0.0513 0.17091,0.0342 0.29482,0.0727 0.37174,0.11536 l -0.0256,1.42286"
+ id="path3016"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 122.99779,128.80317 3.30718,-11.52386 1.52541,0 -4.88386,16.08725 c -0.10256,0.31619 -0.23074,0.67083 -0.38456,1.06394 -0.15382,0.3931 -0.35892,0.76056 -0.61529,1.10239 -0.25637,0.34182 -0.57256,0.6281 -0.94857,0.85884 -0.36746,0.23928 -0.81611,0.35892 -1.34594,0.35892 -0.0769,0 -0.16237,-0.009 -0.25637,-0.0256 -0.094,-0.009 -0.19228,-0.0214 -0.29483,-0.0385 -0.094,-0.0171 -0.18373,-0.0385 -0.26919,-0.0641 -0.0855,-0.0171 -0.15382,-0.0342 -0.20509,-0.0513 l -0.0128,-1.30749 c 0.0854,0.0256 0.19655,0.047 0.33328,0.0641 0.14527,0.0171 0.25209,0.0256 0.32046,0.0256 0.34183,0 0.64093,-0.0556 0.8973,-0.16664 0.26491,-0.10255 0.49565,-0.26065 0.6922,-0.47428 0.20509,-0.2051 0.38455,-0.46575 0.53838,-0.78193 0.15382,-0.30765 0.29055,-0.66657 0.41019,-1.07676 l 0.53838,-1.79459 -4.3583,-13.77992 1.56386,0 3.44818,11.52386"
+ id="path3018"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 139.93568,124.86788 c -2e-5,1.11949 -0.10256,2.08942 -0.30765,2.9098 -0.19656,0.82039 -0.48284,1.49977 -0.85884,2.03815 -0.37602,0.53838 -0.84176,0.94003 -1.39722,1.20494 -0.55548,0.25637 -1.18358,0.38456 -1.88432,0.38456 -0.83748,0 -1.55532,-0.16664 -2.15351,-0.49993 -0.58966,-0.34182 -1.07249,-0.81611 -1.4485,-1.42285 l 0,6.99891 -1.41003,0 0,-19.20215 1.30749,0 0.0641,1.89715 c 0.38455,-0.6751 0.87165,-1.20066 1.46131,-1.57668 0.58965,-0.38455 1.30321,-0.57682 2.14069,-0.57684 0.71783,2e-5 1.35449,0.12393 1.90996,0.37174 0.55546,0.24784 1.02548,0.63667 1.41004,1.16649 0.38455,0.52984 0.6751,1.20922 0.87166,2.03814 0.19654,0.8204 0.29481,1.81169 0.29483,2.9739 l 0,1.29467 m -1.42286,-1.29467 c -1e-5,-1.77749 -0.27774,-3.08498 -0.8332,-3.92247 -0.54694,-0.83746 -1.40578,-1.2562 -2.57653,-1.25621 -0.43583,1e-5 -0.82893,0.0641 -1.1793,0.19227 -0.34183,0.11966 -0.64521,0.2863 -0.91012,0.49993 -0.25637,0.21365 -0.47856,0.4572 -0.66656,0.73065 -0.17946,0.27347 -0.33328,0.56403 -0.46147,0.87166 l 0,7.30656 c 0.13673,0.2991 0.30337,0.57684 0.49993,0.8332 0.20509,0.25638 0.44009,0.47856 0.70501,0.66657 0.26492,0.188 0.56401,0.33328 0.8973,0.43583 0.34182,0.10255 0.72211,0.15382 1.14085,0.15382 1.15366,0 2.00395,-0.42301 2.55089,-1.26904 0.55546,-0.85456 0.83319,-2.17059 0.8332,-3.9481 l 0,-1.29467"
+ id="path3020"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 145.58044,113.7414 0,3.53791 2.37143,0 0,1.28186 -2.37143,0 0,9.21651 c 0,0.47857 0.0384,0.86739 0.11537,1.16649 0.0855,0.29056 0.19654,0.51702 0.33328,0.67938 0.13673,0.16237 0.29055,0.27347 0.46147,0.33328 0.17945,0.0513 0.36746,0.0769 0.56401,0.0769 0.188,1e-5 0.37173,-0.0128 0.5512,-0.0384 0.17945,-0.0342 0.33755,-0.0641 0.47428,-0.0897 l 0.0385,1.28185 c -0.15383,0.0684 -0.35893,0.11964 -0.61529,0.15382 -0.24783,0.0427 -0.50847,0.0641 -0.78193,0.0641 -0.36747,0 -0.7093,-0.0598 -1.02548,-0.17946 -0.30765,-0.11964 -0.57684,-0.32047 -0.80757,-0.60247 -0.23074,-0.28201 -0.41019,-0.65375 -0.53838,-1.11521 -0.12819,-0.47002 -0.19228,-1.05112 -0.19228,-1.74332 l 0,-9.2037 -2.14069,0 0,-1.28186 2.14069,0 0,-3.53791 1.42286,0"
+ id="path3022"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 150.43046,123.50912 c 0,-1.05111 0.12391,-1.97832 0.37174,-2.78162 0.24782,-0.80329 0.59392,-1.47839 1.0383,-2.02533 0.44437,-0.55546 0.9742,-0.97419 1.5895,-1.25622 0.62382,-0.28199 1.31175,-0.42299 2.06378,-0.42301 0.76056,2e-5 1.45276,0.14102 2.0766,0.42301 0.62382,0.28203 1.15793,0.70076 1.60231,1.25622 0.44437,0.54694 0.7862,1.22204 1.02549,2.02533 0.24781,0.8033 0.37172,1.73051 0.37173,2.78162 l 0,1.43567 c -1e-5,1.05112 -0.12392,1.97833 -0.37173,2.78162 -0.23929,0.8033 -0.58112,1.47841 -1.02549,2.02533 -0.44438,0.53838 -0.97849,0.94857 -1.60231,1.23058 -0.6153,0.282 -1.29895,0.42301 -2.05097,0.42301 -0.76057,0 -1.45277,-0.14101 -2.0766,-0.42301 -0.62383,-0.28201 -1.15794,-0.6922 -1.60231,-1.23058 -0.44438,-0.54692 -0.79048,-1.22203 -1.0383,-2.02533 -0.24783,-0.80329 -0.37174,-1.7305 -0.37174,-2.78162 l 0,-1.43567 m 1.43568,1.43567 c -1e-5,0.79475 0.0812,1.50832 0.24355,2.14069 0.16236,0.63239 0.39737,1.17077 0.70502,1.61514 0.31618,0.44438 0.70074,0.7862 1.15366,1.02548 0.45292,0.23928 0.96993,0.35892 1.55104,0.35892 0.61529,0 1.14939,-0.11964 1.60232,-0.35892 0.45291,-0.23928 0.82892,-0.5811 1.12803,-1.02548 0.29909,-0.44437 0.52128,-0.98275 0.66656,-1.61514 0.15382,-0.63237 0.23073,-1.34594 0.23074,-2.14069 l 0,-1.43567 c -1e-5,-0.77765 -0.0812,-1.48267 -0.24356,-2.11506 -0.16237,-0.64092 -0.40165,-1.18357 -0.71783,-1.62795 -0.30766,-0.45291 -0.68794,-0.79901 -1.14085,-1.0383 -0.45293,-0.24782 -0.96994,-0.37173 -1.55104,-0.37174 -0.57257,1e-5 -1.08531,0.12392 -1.53823,0.37174 -0.44438,0.23929 -0.82466,0.58539 -1.14084,1.0383 -0.30765,0.44438 -0.54266,0.98703 -0.70502,1.62795 -0.16237,0.63239 -0.24356,1.33741 -0.24355,2.11506 l 0,1.43567"
+ id="path3024"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 172.37218,112.48519 5.65297,16.42052 5.6786,-16.42052 1.9356,0 0,18.66377 -1.46131,0 0,-8.11413 0.12818,-8.11412 -5.71706,16.22825 -1.12803,0 -5.69142,-16.15134 0.12818,8.03721 0,8.11413 -1.46131,0 0,-18.66377 1.9356,0"
+ id="path3026"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 197.29601,131.14896 c -0.0684,-0.23074 -0.12392,-0.51702 -0.16664,-0.85884 -0.0427,-0.35038 -0.0726,-0.70502 -0.0897,-1.06394 -0.17947,0.29055 -0.39311,0.56829 -0.64093,0.8332 -0.24783,0.25637 -0.53411,0.48711 -0.85884,0.6922 -0.3162,0.19655 -0.67084,0.35465 -1.06394,0.47429 -0.3931,0.11964 -0.81611,0.17946 -1.26903,0.17946 -0.57256,0 -1.09385,-0.0812 -1.56386,-0.24356 -0.46147,-0.16236 -0.85884,-0.40591 -1.19212,-0.73065 -0.33329,-0.32474 -0.58966,-0.73066 -0.76911,-1.21776 -0.17946,-0.4871 -0.26919,-1.05539 -0.26919,-1.70486 0,-0.64093 0.11109,-1.23058 0.33328,-1.76896 0.22219,-0.54692 0.55119,-1.01693 0.98703,-1.41004 0.44437,-0.39309 0.99556,-0.70074 1.65359,-0.92293 0.65801,-0.22218 1.42285,-0.33328 2.29451,-0.33328 l 2.34579,0 0,-1.9356 c -1e-5,-0.99129 -0.24783,-1.70058 -0.74347,-2.12788 -0.48711,-0.43581 -1.20495,-0.65373 -2.15352,-0.65374 -0.44438,1e-5 -0.85457,0.0684 -1.23057,0.2051 -0.36747,0.13674 -0.68366,0.32902 -0.94857,0.57683 -0.26492,0.23929 -0.47002,0.52984 -0.61529,0.87166 -0.14528,0.33329 -0.21792,0.70076 -0.21792,1.10239 l -1.42285,-0.0128 c -1e-5,-0.53836 0.10681,-1.0511 0.32046,-1.53822 0.21364,-0.49564 0.51701,-0.93147 0.91011,-1.30749 0.3931,-0.376 0.86739,-0.67509 1.42286,-0.8973 0.55546,-0.22217 1.17075,-0.33326 1.84587,-0.33328 0.62383,2e-5 1.19211,0.0769 1.70486,0.23074 0.52128,0.14529 0.96993,0.38457 1.34595,0.71783 0.376,0.32475 0.66655,0.75204 0.87166,1.28186 0.21363,0.52129 0.32045,1.15795 0.32046,1.90996 l 0,7.07582 c -1e-5,0.23928 0.009,0.48711 0.0256,0.74348 0.0171,0.25637 0.0384,0.50847 0.0641,0.75629 0.0342,0.23928 0.0726,0.47001 0.11537,0.6922 0.0513,0.21364 0.10681,0.40165 0.16664,0.56401 l 0,0.15383 -1.51259,0 m -3.90965,-1.11522 c 0.44437,1e-5 0.85884,-0.0598 1.2434,-0.17945 0.39309,-0.12819 0.74346,-0.2991 1.05112,-0.51275 0.30763,-0.22218 0.57255,-0.47855 0.79474,-0.76911 0.23073,-0.29055 0.41446,-0.60246 0.5512,-0.93575 l 0,-3.37127 -2.14069,0 c -1.34168,1e-5 -2.35007,0.28201 -3.02517,0.84602 -0.67512,0.56402 -1.01267,1.32459 -1.01267,2.2817 0,0.91439 0.22219,1.58523 0.66657,2.01251 0.45291,0.41874 1.07675,0.62811 1.8715,0.6281"
+ id="path3028"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 204.10726,131.14896 -1.43568,0 0,-13.86965 1.43568,0 0,13.86965 m -1.64077,-17.86903 c 0,-0.29053 0.0812,-0.53836 0.24355,-0.74347 0.16237,-0.20508 0.3931,-0.30763 0.6922,-0.30764 0.2991,1e-5 0.52983,0.10256 0.6922,0.30764 0.17091,0.20511 0.25637,0.45294 0.25637,0.74347 0,0.29058 -0.0855,0.5384 -0.25637,0.74348 -0.16237,0.19657 -0.3931,0.29484 -0.6922,0.29482 -0.2991,2e-5 -0.52983,-0.0982 -0.6922,-0.29482 -0.16237,-0.20508 -0.24355,-0.4529 -0.24355,-0.74348"
+ id="path3030"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 209.84175,131.14896 -1.43568,0 0,-19.68926 1.43568,0 0,19.68926"
+ id="path3032"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 220.92157,127.73923 c -1e-5,-0.282 -0.0556,-0.54692 -0.16664,-0.79475 -0.10256,-0.24782 -0.27774,-0.4871 -0.52556,-0.71784 -0.23929,-0.23073 -0.55975,-0.46573 -0.96139,-0.70502 -0.39311,-0.23927 -0.88448,-0.49564 -1.47413,-0.76911 -0.63239,-0.282 -1.1964,-0.55119 -1.69205,-0.80756 -0.49565,-0.26491 -0.91439,-0.54692 -1.25621,-0.84603 -0.33328,-0.30763 -0.58965,-0.64946 -0.76911,-1.02548 -0.17946,-0.38454 -0.26919,-0.83747 -0.26919,-1.35876 0,-0.51273 0.094,-0.99129 0.28201,-1.43568 0.19655,-0.45291 0.47428,-0.84601 0.8332,-1.1793 0.35892,-0.33327 0.79475,-0.59391 1.30749,-0.78193 0.51274,-0.19654 1.0853,-0.29481 1.71768,-0.29483 0.6751,2e-5 1.28185,0.10257 1.82023,0.30765 0.53837,0.19656 0.99129,0.4743 1.35877,0.8332 0.376,0.35893 0.66228,0.79049 0.85884,1.29467 0.19654,0.49566 0.29481,1.03831 0.29482,1.62796 l -1.42285,0 c -1e-5,-0.35891 -0.0641,-0.70074 -0.19228,-1.02549 -0.12819,-0.33327 -0.3162,-0.62382 -0.56402,-0.87166 -0.24783,-0.25635 -0.5512,-0.45718 -0.91011,-0.60247 -0.35893,-0.15381 -0.77339,-0.23072 -1.2434,-0.23073 -0.48711,1e-5 -0.90157,0.0684 -1.24339,0.2051 -0.34184,0.12819 -0.62384,0.30338 -0.84603,0.52556 -0.22219,0.21365 -0.38456,0.46147 -0.4871,0.74347 -0.10255,0.27347 -0.15383,0.55121 -0.15382,0.8332 -1e-5,0.28202 0.0427,0.53412 0.12818,0.7563 0.0855,0.21365 0.23928,0.42302 0.46147,0.6281 0.23073,0.20511 0.53837,0.41875 0.92293,0.64093 0.38455,0.21365 0.8802,0.46575 1.48695,0.75629 0.64092,0.28202 1.21775,0.55548 1.7305,0.82039 0.51273,0.26492 0.94429,0.55975 1.29467,0.88448 0.35891,0.31619 0.63237,0.67511 0.82039,1.07675 0.19654,0.40165 0.29481,0.88021 0.29482,1.43568 -1e-5,0.57256 -0.10255,1.08957 -0.30764,1.55104 -0.20511,0.46147 -0.49993,0.85457 -0.88448,1.1793 -0.37602,0.32474 -0.83321,0.57684 -1.37158,0.7563 -0.52984,0.17091 -1.11949,0.25637 -1.76896,0.25637 -0.75202,0 -1.41431,-0.10682 -1.98687,-0.32047 -0.57256,-0.22218 -1.05539,-0.51701 -1.44849,-0.88447 -0.38456,-0.36747 -0.67938,-0.79475 -0.88448,-1.28186 -0.19655,-0.4871 -0.29483,-1.00411 -0.29483,-1.55104 l 1.43568,0 c 0.0256,0.54693 0.13673,0.99558 0.33328,1.34595 0.20509,0.35037 0.45719,0.62811 0.75629,0.8332 0.2991,0.2051 0.63238,0.3461 0.99985,0.42301 0.36746,0.0769 0.73065,0.11537 1.08957,0.11537 0.47001,0 0.88447,-0.0598 1.2434,-0.17946 0.36746,-0.12818 0.67083,-0.29483 0.91012,-0.49992 0.24781,-0.21364 0.43154,-0.46147 0.55119,-0.74348 0.12818,-0.29055 0.19227,-0.59819 0.19228,-0.92293"
+ id="path3034"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g3186"
+ transform="translate(9.9114061,8.2675716)">
+ <g
+ transform="matrix(1.2473152,0,0,1.2473152,-1270.0924,-84.630526)"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0.30000001px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#3d3d3b;fill-opacity:1;stroke:none;font-family:Roboto Condensed;-inkscape-font-specification:'Roboto Condensed, Bold'"
+ id="flowRoot4199">
+ <path
+ d="m 1110.6414,141.23568 c -0.2995,0.32552 -0.7031,0.69661 -1.2109,1.11328 -0.5079,0.41667 -1.1459,0.8138 -1.9141,1.1914 -0.7552,0.36459 -1.6471,0.67058 -2.6758,0.91797 -1.0286,0.26042 -2.2135,0.39063 -3.5547,0.39063 -1.5885,0 -3.0208,-0.2474 -4.2968,-0.74219 -1.2761,-0.49479 -2.3698,-1.24349 -3.2813,-2.24609 -0.9114,-1.0026 -1.6146,-2.26562 -2.1094,-3.78907 -0.4817,-1.53645 -0.7226,-3.33983 -0.7226,-5.41015 l 0,-4.80469 c 0,-2.07029 0.2344,-3.86717 0.7031,-5.39062 0.4688,-1.53644 1.1328,-2.81248 1.9922,-3.82813 0.8724,-1.0156 1.9271,-1.7708 3.1641,-2.26562 1.2499,-0.49477 2.6497,-0.74216 4.1992,-0.74219 1.6145,3e-5 3.0078,0.20185 4.1797,0.60547 1.1718,0.40367 2.1484,1.00914 2.9296,1.8164 0.7813,0.7943 1.3802,1.78388 1.7969,2.96875 0.4167,1.1719 0.6836,2.52607 0.8008,4.0625 l -5.5859,0 c -0.078,-0.89841 -0.2084,-1.64711 -0.3907,-2.24609 -0.1692,-0.59894 -0.4166,-1.0742 -0.7421,-1.42578 -0.3126,-0.36456 -0.7032,-0.62498 -1.1719,-0.78125 -0.4558,-0.15623 -1.0026,-0.23435 -1.6406,-0.23438 -0.7553,3e-5 -1.4128,0.13675 -1.9727,0.41016 -0.5599,0.26044 -1.0287,0.69013 -1.4063,1.28906 -0.3645,0.58596 -0.638,1.35419 -0.8203,2.30469 -0.1823,0.93752 -0.2734,2.07684 -0.2734,3.41797 l 0,4.84375 c 0,1.35418 0.098,2.50001 0.293,3.4375 0.2083,0.93751 0.5143,1.70573 0.9179,2.30469 0.4167,0.58594 0.9375,1.01563 1.5625,1.28906 0.625,0.26042 1.3607,0.39063 2.2071,0.39062 0.5078,1e-5 0.9375,-0.0391 1.289,-0.11718 0.3646,-0.0781 0.6706,-0.16927 0.918,-0.27344 0.2604,-0.11718 0.4687,-0.23437 0.625,-0.35156 0.1693,-0.11719 0.3125,-0.21484 0.4297,-0.29297 l 0,-5.21485 -4.0235,0 0,-4.33593 9.7852,0 0,11.73828"
+ id="path3002"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 1131.2344,134.55599 c 0,3.32032 -0.573,5.86589 -1.7188,7.63672 -1.1328,1.77083 -2.8255,2.65625 -5.0781,2.65625 -0.8984,0 -1.6927,-0.18229 -2.3828,-0.54688 -0.6771,-0.36458 -1.263,-0.8789 -1.7578,-1.54297 l 0,9.82422 -5.5274,0 0,-29.25781 5.1172,0 0.1953,1.93359 c 0.5078,-0.74216 1.1133,-1.31508 1.8164,-1.71875 0.7162,-0.40362 1.5495,-0.60544 2.5,-0.60546 2.2787,2e-5 3.9844,0.83986 5.1172,2.51953 1.1458,1.6797 1.7188,4.25131 1.7188,7.71484 l 0,1.38672 m -5.5078,-1.38672 c -10e-5,-1.00259 -0.052,-1.85545 -0.1563,-2.55859 -0.1042,-0.71613 -0.2734,-1.29556 -0.5078,-1.73828 -0.2344,-0.45572 -0.5404,-0.78775 -0.918,-0.9961 -0.3646,-0.20831 -0.8203,-0.31248 -1.3672,-0.3125 -0.5859,2e-5 -1.0872,0.12372 -1.5039,0.3711 -0.4036,0.24741 -0.7291,0.59897 -0.9765,1.05468 l 0,9.90235 c 0.2343,0.42969 0.5534,0.76823 0.957,1.01562 0.4167,0.23438 0.9375,0.35157 1.5625,0.35156 1.0937,1e-5 1.849,-0.46223 2.2656,-1.38671 0.4297,-0.92448 0.6445,-2.36328 0.6446,-4.31641 l 0,-1.38672"
+ id="path3004"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 1134.2492,133.2474 c 0,-3.46353 0.625,-6.04816 1.875,-7.75391 1.25,-1.70571 3.0013,-2.55857 5.2539,-2.55859 1.0287,2e-5 1.9011,0.20184 2.6172,0.60546 0.7161,0.39065 1.3216,0.94403 1.8164,1.66016 l 0.2149,-1.875 4.9804,0 0,21.13281 c 0,1.44531 -0.2148,2.6888 -0.6445,3.73047 -0.4167,1.05468 -1.0091,1.92057 -1.7773,2.59766 -0.7683,0.67707 -1.6928,1.17838 -2.7735,1.5039 -1.0677,0.32552 -2.2591,0.48828 -3.5742,0.48829 -0.4948,-1e-5 -1.0417,-0.0521 -1.6406,-0.15625 -0.599,-0.10418 -1.1979,-0.26043 -1.7969,-0.46875 -0.599,-0.19532 -1.1719,-0.44923 -1.7188,-0.76172 -0.5338,-0.29949 -0.983,-0.65756 -1.3476,-1.07422 l 1.8555,-3.82813 c 0.2474,0.26042 0.5403,0.5013 0.8789,0.72266 0.3515,0.23437 0.7161,0.42968 1.0937,0.58594 0.3906,0.16926 0.7943,0.29947 1.211,0.39062 0.4166,0.10416 0.8203,0.15625 1.2109,0.15625 0.5599,0 1.0547,-0.0651 1.4844,-0.19531 0.4427,-0.11719 0.8138,-0.32552 1.1132,-0.625 0.2995,-0.29948 0.5209,-0.69662 0.6641,-1.19141 0.1562,-0.49479 0.2344,-1.11328 0.2344,-1.85547 l 0,-1.69921 c -0.5078,0.66406 -1.1003,1.17838 -1.7774,1.54296 -0.664,0.35157 -1.4453,0.52735 -2.3437,0.52735 -1.1198,0 -2.1224,-0.22136 -3.0078,-0.66406 -0.8724,-0.44271 -1.6146,-1.09375 -2.2266,-1.95313 -0.5989,-0.85937 -1.0612,-1.92057 -1.3867,-3.18359 -0.3255,-1.27604 -0.4883,-2.74739 -0.4883,-4.41407 l 0,-1.38671 m 5.5274,1.38671 c 0,1.95314 0.2539,3.37892 0.7617,4.27735 0.5078,0.88542 1.3151,1.32813 2.4219,1.32812 0.5989,1e-5 1.1002,-0.10416 1.5039,-0.3125 0.4166,-0.22135 0.7552,-0.52734 1.0156,-0.91797 l 0,-10.09765 c -0.2735,-0.42967 -0.6185,-0.7617 -1.0352,-0.9961 -0.4036,-0.23435 -0.8854,-0.35154 -1.4453,-0.35156 -1.0937,2e-5 -1.9075,0.44924 -2.4414,1.34766 -0.5208,0.89845 -0.7812,2.34376 -0.7812,4.33594 l 0,1.38671"
+ id="path3006"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ transform="matrix(1.2831852,0,0,1.2831852,-1242.5744,-88.562445)"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0.30000001px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#1f8ece;fill-opacity:1;stroke:none;font-family:Roboto Condensed;-inkscape-font-specification:'Roboto Condensed, Bold'"
+ id="flowRoot4213">
+ <path
+ d="m 1121.475,132.79818 c 0,1.99219 -0.2474,3.74349 -0.7422,5.2539 -0.4948,1.51042 -1.1914,2.76693 -2.0898,3.76953 -0.8855,1.00261 -1.9597,1.75782 -3.2227,2.26563 -1.25,0.50781 -2.6367,0.76172 -4.1601,0.76172 -1.5235,0 -2.9167,-0.25391 -4.1797,-0.76172 -1.2631,-0.50781 -2.3503,-1.26302 -3.2618,-2.26563 -0.8984,-1.0026 -1.6015,-2.25911 -2.1093,-3.76953 -0.4948,-1.51041 -0.7422,-3.26171 -0.7422,-5.2539 l 0,-4.72657 c 0,-2.04425 0.2474,-3.84112 0.7422,-5.39062 0.4948,-1.56248 1.1914,-2.86456 2.0898,-3.90625 0.8985,-1.04164 1.9792,-1.82289 3.2422,-2.34375 1.263,-0.53383 2.6562,-0.80075 4.1797,-0.80078 1.5234,3e-5 2.9101,0.26695 4.1601,0.80078 1.2631,0.52086 2.3438,1.30211 3.2422,2.34375 0.9115,1.04169 1.6146,2.34377 2.1094,3.90625 0.4948,1.5495 0.7422,3.34637 0.7422,5.39062 l 0,4.72657 m -5.7617,-4.76563 c 0,-1.35415 -0.098,-2.50649 -0.293,-3.45703 -0.1953,-0.96352 -0.4818,-1.75128 -0.8594,-2.36328 -0.3776,-0.61196 -0.8463,-1.06118 -1.4062,-1.34766 -0.5599,-0.28643 -1.2045,-0.42966 -1.9336,-0.42968 -0.7422,2e-5 -1.3932,0.14325 -1.9531,0.42968 -0.5599,0.28648 -1.0287,0.7357 -1.4063,1.34766 -0.3776,0.612 -0.6641,1.39976 -0.8594,2.36328 -0.1953,0.95054 -0.2929,2.10288 -0.2929,3.45703 l 0,4.76563 c 0,1.28907 0.098,2.39584 0.2929,3.32031 0.1953,0.91147 0.4818,1.66016 0.8594,2.24609 0.3906,0.58595 0.8659,1.01563 1.4258,1.28907 0.5729,0.27344 1.2305,0.41016 1.9727,0.41015 0.7291,1e-5 1.3671,-0.13671 1.914,-0.41015 0.5599,-0.27344 1.0286,-0.70312 1.4063,-1.28907 0.3776,-0.58593 0.6575,-1.33462 0.8398,-2.24609 0.1953,-0.92447 0.293,-2.03124 0.293,-3.32031 l 0,-4.76563"
+ style="fill:#1f8ece;fill-opacity:1"
+ id="path3009"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 1131.7164,139.69271 10.0781,0 0,4.76562 -15.8203,0 0,-28.4375 5.7422,0 0,23.67188"
+ style="fill:#1f8ece;fill-opacity:1"
+ id="path3011"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+</svg>
diff --git a/src/overlayer/CMakeLists.txt b/src/overlayer/CMakeLists.txt
index 73928ca..fecb0a0 100644
--- a/src/overlayer/CMakeLists.txt
+++ b/src/overlayer/CMakeLists.txt
@@ -1,31 +1,32 @@
# Copyright (C) 2018 Intevation GmbH <info@intevation.de>
#
# This file is Free Software under the GNU GPL (v>=2)
# and comes with ABSOLUTELY NO WARRANTY!
# See LICENSE.txt for details.
set(EXECUTABLE_NAME "overlayer")
set(EXECUTABLE_SRC
main.cpp
quitter.cpp
${CMAKE_SOURCE_DIR}/src/img/icon.rc
+ ${CMAKE_SOURCE_DIR}/src/util/w32-util.cpp
${CMAKE_SOURCE_DIR}/src/util/overlay.cpp
${CMAKE_SOURCE_DIR}/src/util/strhelp.c
)
add_executable(${EXECUTABLE_NAME}
${_add_executable_params}
${EXECUTABLE_SRC}
)
target_link_libraries(${EXECUTABLE_NAME}
Qt5::Widgets
)
if (WIN32)
set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS "-municode")
endif(WIN32)
install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin)
diff --git a/src/resolver/CMakeLists.txt b/src/resolver/CMakeLists.txt
index 6c0358a..86cb52c 100644
--- a/src/resolver/CMakeLists.txt
+++ b/src/resolver/CMakeLists.txt
@@ -1,33 +1,34 @@
# Copyright (C) 2018 Intevation GmbH <info@intevation.de>
#
# This file is Free Software under the GNU GPL (v>=2)
# and comes with ABSOLUTELY NO WARRANTY!
# See LICENSE.txt for details.
set(EXECUTABLE_NAME "resolver")
set(EXECUTABLE_SRC
main.cpp
resolver.cpp
${CMAKE_SOURCE_DIR}/src/img/icon.rc
${CMAKE_SOURCE_DIR}/src/util/overlay.cpp
+ ${CMAKE_SOURCE_DIR}/src/util/w32-util.cpp
${CMAKE_SOURCE_DIR}/src/util/strhelp.c
)
add_executable(${EXECUTABLE_NAME}
${_add_executable_params}
${EXECUTABLE_SRC}
)
target_link_libraries(${EXECUTABLE_NAME}
Qt5::Widgets
KF5::Libkleo
Gpgmepp
QGpgme
)
if (WIN32)
set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS "-municode")
endif(WIN32)
install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin)
diff --git a/src/util/overlay.cpp b/src/util/overlay.cpp
index 2ee0405..8858485 100644
--- a/src/util/overlay.cpp
+++ b/src/util/overlay.cpp
@@ -1,143 +1,138 @@
/* Copyright (C) 2018 by Intevation GmbH <info@intevation.de>
*
* This file is Free Software under the GNU GPL (v>=2)
* and comes with ABSOLUTELY NO WARRANTY!
* See LICENSE.txt for details.
*/
#include "overlay.h"
#include <QProgressBar>
#include <QVBoxLayout>
#include <QLabel>
#include <QMouseEvent>
#include <QWindow>
#include <QTimer>
#include <QPainter>
#include <QBrush>
#include <QLinearGradient>
#include <QStyle>
#include <QPushButton>
#include <QApplication>
#include <QDebug>
+#include "w32-util.h"
+
#include <iostream>
#ifdef Q_OS_WIN
#include <windows.h>
class Overlay::Private
{
public:
Private(Overlay *qq, WId id, const QString &text):
q(qq)
{
m_target = (HWND) id;
q->setWindowFlags(Qt::FramelessWindowHint |
Qt::Tool | Qt::CustomizeWindowHint |
Qt::WindowStaysOnTopHint);
q->setAttribute(Qt::WA_TransparentForMouseEvents);
q->setAttribute(Qt::WA_TranslucentBackground);
- // This does not seem to make a difference so we still use the always
- // on top hint.
- auto foreignWindow = QWindow::fromWinId(id);
- q->winId();
- auto parentHandle = q->windowHandle();
- if (parentHandle && foreignWindow) {
- parentHandle->setTransientParent(foreignWindow);
- q->setWindowModality(Qt::WindowModal);
- }
+ W32::setupForeignParent(id, q, true);
+
auto vLay = new QVBoxLayout(q);
auto bar = new QProgressBar;
auto label = new QLabel;
label->setText(QStringLiteral("<h3>%1</h3>").arg(text));
bar->setRange(0, 0);
vLay->addStretch(1);
auto cancelBtn = new QPushButton;
cancelBtn->setIcon(q->style()->standardPixmap(QStyle::SP_TitleBarCloseButton));
cancelBtn->setFlat(true);
auto subLay1 = new QVBoxLayout;
auto subLay3 = new QHBoxLayout;
subLay3->addStretch(0.5);
subLay3->addWidget(label);
subLay3->addStretch(1);
subLay3->addWidget(cancelBtn);
subLay1->addLayout(subLay3);
subLay1->addWidget(bar);
auto subLay2 = new QHBoxLayout;
subLay2->addStretch(0.1);
subLay2->addLayout(subLay1);
subLay2->addStretch(0.1);
vLay->addLayout(subLay2);
vLay->addStretch(1);
connect(cancelBtn, &QPushButton::clicked, q, [this] () {
std::cout << "cancel" << std::endl;
qApp->quit();
});
auto refreshTimer = new QTimer(q);
connect(refreshTimer, &QTimer::timeout, q, [this] () {
RECT rect;
if (GetWindowRect(m_target, &rect)) {
#if 0
HWND myself = (HWND) q->winId();
if (!SetWindowPos(myself, HWND_NOTOPMOST, rect.left,
rect.top, rect.right - rect.left,
rect.bottom - rect.top, SWP_SHOWWINDOW)) {
qDebug() << "Set Window pos failed.";
UpdateWindow(m_target);
}
#endif
q->setGeometry(rect.left, rect.top, rect.right - rect.left,
rect.bottom - rect.top);
} else {
//maybe window was closed
OutputDebugStringA ("Overlay GetWindowRect failed.");
std::cout << "cancel" << std::endl;
qApp->quit();
}
});
refreshTimer->start(50); // update interval in milliseconds
q->show();
}
HWND m_target;
Overlay *q;
};
Overlay::Overlay (WId id, const QString &text):
d(new Private(this, id, text))
{
}
#else
Overlay::Overlay (WId id, const QString &text)
{
}
#endif
void Overlay::paintEvent(QPaintEvent *e) {
QPainter painter(this);
int width = size().width();
int height = size().height();
QLinearGradient gradient(0, 0, 0, height);
gradient.setColorAt(0, Qt::transparent);
gradient.setColorAt(0.5, Qt::white);
gradient.setColorAt(1, Qt::transparent);
QBrush brush(gradient);
painter.fillRect(0, 0, width, height, gradient);
QWidget::paintEvent(e);
}
diff --git a/src/util/w32-util.cpp b/src/util/w32-util.cpp
index c080c59..a0814a3 100644
--- a/src/util/w32-util.cpp
+++ b/src/util/w32-util.cpp
@@ -1,185 +1,204 @@
/* Copyright (C) 2018 by Intevation GmbH <info@intevation.de>
*
* This file is Free Software under the GNU GPL (v>=2)
* and comes with ABSOLUTELY NO WARRANTY!
* See LICENSE.txt for details.
*/
#include <stdio.h>
#include "w32-util.h"
#include <unistd.h>
#ifdef _WIN32
# include <windows.h>
#endif
+#include <QWindow>
+
#define SLDIR "\\share\\locale"
namespace W32 {
std::string getGpg4winLocaleDir()
{
const auto instdir = getGpg4winDir();
if (instdir.empty()) {
return std::string();
}
return instdir + SLDIR;
}
std::string getGpg4winDir()
{
const auto tmp = readRegStr(nullptr, GPG4WIN_REGKEY_3,
"Install Directory");
if (tmp.empty()) {
return std::string();
}
if (!access(tmp.c_str(), R_OK)) {
return tmp;
} else {
fprintf (stderr, "Failed to access: %s\n", tmp.c_str());
}
return std::string();
}
/* Helper for read_w32_registry_string(). */
#ifdef _WIN32
static HKEY
get_root_key(const char *root)
{
HKEY root_key;
if( !root )
root_key = HKEY_CURRENT_USER;
else if( !strcmp( root, "HKEY_CLASSES_ROOT" ) )
root_key = HKEY_CLASSES_ROOT;
else if( !strcmp( root, "HKEY_CURRENT_USER" ) )
root_key = HKEY_CURRENT_USER;
else if( !strcmp( root, "HKEY_LOCAL_MACHINE" ) )
root_key = HKEY_LOCAL_MACHINE;
else if( !strcmp( root, "HKEY_USERS" ) )
root_key = HKEY_USERS;
else if( !strcmp( root, "HKEY_PERFORMANCE_DATA" ) )
root_key = HKEY_PERFORMANCE_DATA;
else if( !strcmp( root, "HKEY_CURRENT_CONFIG" ) )
root_key = HKEY_CURRENT_CONFIG;
else
return nullptr;
return root_key;
}
#endif
std::string
readRegStr (const char *root, const char *dir, const char *name)
{
#ifndef _WIN32
(void)root; (void)dir; (void)name;
return std::string();
#else
HKEY root_key, key_handle;
DWORD n1, nbytes, type;
std::string ret;
if (!(root_key = get_root_key(root))) {
return ret;
}
if (RegOpenKeyExA(root_key, dir, 0, KEY_READ, &key_handle)) {
if (root) {
/* no need for a RegClose, so return direct */
return ret;
}
/* Fallback to HKLM */
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle)) {
return ret;
}
}
nbytes = 1;
if (RegQueryValueExA(key_handle, name, 0, nullptr, nullptr, &nbytes)) {
if (root) {
RegCloseKey (key_handle);
return ret;
}
/* Try to fallback to HKLM also vor a missing value. */
RegCloseKey (key_handle);
if (RegOpenKeyExA (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle)) {
return ret;
}
if (RegQueryValueExA(key_handle, name, 0, nullptr, nullptr, &nbytes)) {
RegCloseKey(key_handle);
return ret;
}
}
n1 = nbytes+1;
char result[n1];
if (RegQueryValueExA(key_handle, name, 0, &type, (LPBYTE)result, &n1)) {
RegCloseKey(key_handle);
return ret;
}
RegCloseKey(key_handle);
result[nbytes] = 0; /* make sure it is really a string */
ret = result;
if (type == REG_EXPAND_SZ && strchr (result, '%')) {
n1 += 1000;
char tmp[n1 +1];
nbytes = ExpandEnvironmentStringsA(ret.c_str(), tmp, n1);
if (nbytes && nbytes > n1) {
n1 = nbytes;
char tmp2[n1 +1];
nbytes = ExpandEnvironmentStringsA(result, tmp2, n1);
if (nbytes && nbytes > n1) {
/* oops - truncated, better don't expand at all */
return ret;
}
tmp2[nbytes] = 0;
ret = tmp2;
} else if (nbytes) { /* okay, reduce the length */
tmp[nbytes] = 0;
ret = tmp;
}
}
return ret;
#endif
}
bool writeRegStr(const char *root, const char *path, const char *key, const char *val)
{
#ifndef _WIN32
(void) root; (void) path; (void) key; (void) val;
return false;
#else
HKEY h, hk;
int type;
int ec;
hk = get_root_key (root);
if (!hk) {
fprintf(stderr, "Failed to find root key.\n");
}
ec = RegCreateKeyExA(hk, path, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL, &h, NULL);
if (ec != ERROR_SUCCESS)
{
fprintf (stderr, "creating/opening registry key `%s' failed\n", path);
return false;
}
type = strchr (val, '%')? REG_EXPAND_SZ : REG_SZ;
ec = RegSetValueExA(h, key, 0, type, (const BYTE*)val, strlen (val));
if (ec != ERROR_SUCCESS)
{
fprintf (stderr, "saving registry key `%s'->`%s' failed\n", path, key);
RegCloseKey(h);
return false;
}
RegCloseKey(h);
return true;
#endif
}
+
+void setupForeignParent(WId id, QWidget *widget, bool modal)
+{
+ if (!widget || !id) {
+ return;
+ }
+
+ auto foreignWindow = QWindow::fromWinId(id);
+ widget->winId();
+ auto parentHandle = widget->windowHandle();
+ if (parentHandle && foreignWindow) {
+ parentHandle->setTransientParent(foreignWindow);
+ if (modal) {
+ widget->setWindowModality(Qt::WindowModal);
+ }
+ }
+}
}// namespace
diff --git a/src/util/w32-util.h b/src/util/w32-util.h
index ff5dacb..3dd2eed 100644
--- a/src/util/w32-util.h
+++ b/src/util/w32-util.h
@@ -1,52 +1,56 @@
/* Copyright (C) 2018 by Intevation GmbH <info@intevation.de>
*
* This file is Free Software under the GNU GPL (v>=2)
* and comes with ABSOLUTELY NO WARRANTY!
* See LICENSE.txt for details.
*/
#include <string>
+#include <QWidget>
+
/* The Registry key used by Gpg4win. */
#ifdef _WIN64
# define GPG4WIN_REGKEY_2 "Software\\Wow6432Node\\GNU\\GnuPG"
#else
# define GPG4WIN_REGKEY_2 "Software\\GNU\\GnuPG"
#endif
#ifdef _WIN64
# define GPG4WIN_REGKEY_3 "Software\\Wow6432Node\\Gpg4win"
#else
# define GPG4WIN_REGKEY_3 "Software\\Gpg4win"
#endif
#define GPGOL_REG_PATH "Software\\GNU\\GpgOL"
namespace W32
{
/* Get the locale dir of Gpg4win. */
std::string getGpg4winLocaleDir();
/** Get the Gpg4win Install directory.
*
* Looks for the Gpg4win 3.x registry key.
* And checks that the directory can be read.
*
* @returns an empty string if no dir could be found.
*
**/
std::string getGpg4winDir();
/** Read a registry string value. If root is null first
* HKEY_CURRENT_USER is searched and then it falls back
* to HKEY_LOCAL_MACHINE . */
std::string readRegStr(const char *root,
const char *path,
const char *key);
bool writeRegStr(const char *root,
const char *path,
const char *key,
const char *val);
+void setupForeignParent(WId id, QWidget *widget, bool modal);
+
} // namespace W32

File Metadata

Mime Type
text/x-diff
Expires
Thu, Jul 17, 12:50 AM (1 d, 8 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e0/98/b1aa961211d885eb34df183e4db0

Event Timeline