Page MenuHome GnuPG

No OneTemporary

diff --git a/client/icons/icons.qrc.in b/client/icons/icons.qrc.in
index 60d8014..94fbc5b 100644
--- a/client/icons/icons.qrc.in
+++ b/client/icons/icons.qrc.in
@@ -1,18 +1,19 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/icons/breeze">
<file alias="apps/48/com.gnupg.gpgolweb.svg">@app_icon_svg@</file>
</qresource>
<qresource prefix="/">
+ <file alias="/icons/addin_logo.png">@CMAKE_SOURCE_DIR@/web/assets/logo.png</file>
<file alias="/icons/level-0.svg">@CMAKE_SOURCE_DIR@/client/icons/level-0.svg</file>
<file alias="/icons/level-1.svg">@CMAKE_SOURCE_DIR@/client/icons/level-1.svg</file>
<file alias="/icons/level-2.svg">@CMAKE_SOURCE_DIR@/client/icons/level-2.svg</file>
<file alias="/icons/level-3.svg">@CMAKE_SOURCE_DIR@/client/icons/level-3.svg</file>
<file alias="/icons/level-4.svg">@CMAKE_SOURCE_DIR@/client/icons/level-4.svg</file>
<file alias="/icons/level-0-enc.svg">@CMAKE_SOURCE_DIR@/client/icons/level-0-enc.svg</file>
<file alias="/icons/level-1-enc.svg">@CMAKE_SOURCE_DIR@/client/icons/level-1-enc.svg</file>
<file alias="/icons/level-2-enc.svg">@CMAKE_SOURCE_DIR@/client/icons/level-2-enc.svg</file>
<file alias="/icons/level-3-enc.svg">@CMAKE_SOURCE_DIR@/client/icons/level-3-enc.svg</file>
<file alias="/icons/level-4-enc.svg">@CMAKE_SOURCE_DIR@/client/icons/level-4-enc.svg</file>
</qresource>
</RCC>
diff --git a/client/setupdialogs.cpp b/client/setupdialogs.cpp
index 883baa8..bd158d5 100644
--- a/client/setupdialogs.cpp
+++ b/client/setupdialogs.cpp
@@ -1,422 +1,423 @@
// SPDX-FileCopyrightText: 2026 g10 code Gmbh
// SPDX-Contributor: Carl Schwan <carl.schwan@gnupg.com>
// SPDX-Contributor: Thomas Friedrichsmeier <thomas.friedrichsmeier@gnupg.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "setupdialogs.h"
#include "config.h"
#include "connectioncontroller.h"
#include "gpgolweb_version.h"
#include "rootcagenerator/controller.h"
#include "websocketclient.h"
#include <KAssistantDialog>
#include <KLocalizedString>
#include <KTitleWidget>
#include <QApplication>
#include <QButtonGroup>
#include <QClipboard>
#include <QDialog>
#include <QDialogButtonBox>
#include <QDir>
#include <QDesktopServices>
#include <QFile>
#include <QGroupBox>
#include <QLabel>
#include <QPushButton>
#include <QRadioButton>
#include <QSaveFile>
#include <QSettings>
#include <QToolTip>
#include <QVBoxLayout>
#include "ui_confpageproxyoptions.h"
#include "ui_confpagetlscertificate.h"
using namespace Qt::StringLiterals;
PairingDialog::PairingDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18n("Pairing mode active"));
auto l = new QVBoxLayout(this);
auto lab = new QLabel(i18n("<p>Copy and paste the code shown below into the input field shown at the top of the Add-In:</p>"));
lab->setWordWrap(true);
l->addWidget(lab);
m_pairingTokenLabel = new QLabel(i18nc("status message", "<p align='center'><b>Obtaining token...</b></p>"));
l->addWidget(m_pairingTokenLabel);
auto bb = new QDialogButtonBox;
auto endButton = bb->addButton(i18nc("@button", "End pairing mode"), QDialogButtonBox::RejectRole);
connect(endButton, &QAbstractButton::clicked, this, &QDialog::reject);
m_copyButton = bb->addButton(i18nc("@button", "Copy code to clipboard"), QDialogButtonBox::ActionRole);
m_copyButton->setEnabled(false);
l->addWidget(bb);
setFixedSize(sizeHint());
connect(&WebsocketClient::self(), &WebsocketClient::pairingStatusChanged, this, &PairingDialog::pairingStatusChanged);
WebsocketClient::self().enterPairingMode();
}
void PairingDialog::pairingStatusChanged(const QString& token, bool pairingActive) {
if (!pairingActive) {
reject();
return;
}
m_pairingTokenLabel->setText(QString(u"<p align='center'><b>%1</b></p>").arg(token));
m_copyButton->setEnabled(true);
connect(m_copyButton, &QAbstractButton::clicked, [this, token]() {
qApp->clipboard()->setText(token);
});
}
class GenerateCertificateWidget : public QWidget {
Q_OBJECT
public:
GenerateCertificateWidget(bool assistant, QWidget *parent)
: QWidget(parent)
, m_controller(nullptr)
, m_installed(false)
, m_dialog(nullptr)
{
auto hbox = new QHBoxLayout(this);
hbox->setContentsMargins(0, 0, 0, 0);
m_label = new QLabel();
hbox->addWidget(m_label);
m_generateButton = new QPushButton();
m_generateButton->setVisible(!assistant);
if (!assistant) {
connect(m_generateButton, &QPushButton::clicked, this, [this]() {
KAssistantDialog dialog;
addAssistantPages(&dialog);
auto cancelButton = dialog.button(QDialogButtonBox::Cancel);
if (cancelButton) {
cancelButton->hide(); // it does not really have defined behavior
}
startGenerate();
dialog.exec();
});
}
hbox->addWidget(m_generateButton);
updateStatus();
}
void addAssistantPages(KAssistantDialog *dialog) {
m_dialog = dialog;
auto genPage = new QWidget();
auto vbox = new QVBoxLayout(genPage);
m_genProgress = new QPlainTextEdit();
vbox->addWidget(m_genProgress);
m_genDoneLabel = new QLabel();
vbox->addWidget(m_genDoneLabel);
m_genPageItem = new KPageWidgetItem(genPage);
m_genPageItem->setHeader(i18n("Generating TLS certificate"));
m_dialog->addPage(m_genPageItem);
auto installPage = new QWidget();
vbox = new QVBoxLayout(installPage);
m_installProgress = new QPlainTextEdit();
vbox->addWidget(m_installProgress);
m_installDoneLabel = new QLabel();
vbox->addWidget(m_installDoneLabel);
m_installPageItem = new KPageWidgetItem(installPage);
m_installPageItem->setHeader(i18n("Installing certificate"));
m_dialog->addPage(m_installPageItem);
connect(dialog, &KPageDialog::currentPageChanged, this,
[this](KPageWidgetItem *current, KPageWidgetItem *) {
if (current == m_genPageItem) {
startGenerate();
} else if (current == m_installPageItem) {
if (!m_installed) {
m_controller->install();
}
}
});
}
void updateStatus() {
if (Config::self()->isLocalServer()) {
setVisible(true);
if (Controller::certificateAlreadyGenerated()) {
m_label->setText(i18n("A TLS certificate has already been generated."));
m_generateButton->setText(i18n("Re-generate certificate"));
m_generateButton->setFixedSize(m_generateButton->minimumSizeHint());
//m_generateButton->setToolTip(i18n("Re-generates and installs a TLS certificate for a secure connection to the local proxy server. It is not usually necessary to repeat this step."));
} else {
m_label->setText(i18n("A TLS certificate is needed for the secure connection to the proxy."));
m_generateButton->setText(i18n("Generate and install certificate"));
if (m_dialog) {
m_label->setText(i18n("A TLS certificate is needed for the secure connection to the proxy. This will be generated in the next step."));
}
}
} else {
setVisible(false);
}
if (m_dialog) {
m_dialog->setAppropriate(m_genPageItem, Config::self()->isLocalServer() && !Controller::certificateAlreadyGenerated());
m_dialog->setAppropriate(m_installPageItem, Config::self()->isLocalServer() && !Controller::certificateAlreadyGenerated());
}
}
private:
QLabel *m_label;
QPushButton *m_generateButton;
QPlainTextEdit *m_genProgress, *m_installProgress;
QLabel *m_genDoneLabel, *m_installDoneLabel;
KPageWidgetItem *m_genPageItem, *m_installPageItem;
QPointer<Controller> m_controller; // it's a KJob and will auto-delete
bool m_installed;
KAssistantDialog *m_dialog;
void startGenerate() {
if (m_controller || m_installed) {
return;
}
m_dialog->setValid(m_genPageItem, false);
m_dialog->setValid(m_installPageItem, false);
m_controller = new Controller(this);
m_dialog->setValid(m_genPageItem, false);
connect(m_controller, &Controller::generationDone, this, [this]() {
m_genDoneLabel->setText(i18nc("@info", "Successfully generated certificate with fingerprint %1", m_controller->rootFingerprint()));
m_dialog->setValid(m_genPageItem, true);
});
connect(m_controller, &Controller::debutOutput, this, [this](const QString &output) {
m_genProgress->appendPlainText(output);
m_installProgress->appendPlainText(output);
});
connect(m_controller, &Controller::result, this, [this](KJob *) {
if (m_controller->error()) {
m_genProgress->appendPlainText(m_controller->errorText());
m_installProgress->appendPlainText(m_controller->errorText());
return;
}
m_label->setText(i18nc("@info", "Installed certificate with fingerprint: %1", m_controller->rootFingerprint()));
m_dialog->setValid(m_installPageItem, true);
m_installed = true;
});
m_controller->start();
}
};
void DialogController::doDialog(const QList<PageID> &pageIds, const bool assistant) {
KPageDialog *dialog = assistant ? new KAssistantDialog() : new KPageDialog();
auto cancelButton = dialog->button(QDialogButtonBox::Cancel);
if (cancelButton) {
cancelButton->hide(); // it does not really have defined behavior
}
if (pageIds.contains(PageProxy)) {
auto widget = new QWidget();
auto vbox = new QVBoxLayout(widget);
auto item = new KPageWidgetItem(widget, i18n("Proxy"));
item->setHeader(i18nc("@title", "Configure Proxy"));
dialog->addPage(item);
auto label = new QLabel(i18n("Choose your configuration for the proxy component:"));
vbox->addWidget(label);
label = new QLabel(i18n("Note: Changes to this setting only take effect after uploading the adjusted manifest file to Outlook on the next page!"));
auto font = label->font();
font.setItalic(true);
label->setFont(font);
label->setWordWrap(true);
vbox->addWidget(label);
auto certcontrol = new GenerateCertificateWidget(assistant, nullptr);
if (assistant) {
certcontrol->addAssistantPages(static_cast<KAssistantDialog*>(dialog));
}
auto grp = new QButtonGroup(widget);
auto localOption = new QRadioButton(i18n("Run a local proxy on this machine"));
localOption->setChecked(Config::self()->isLocalServer());
auto remoteOption = new QRadioButton(i18n("Use proxy from a remote server (EXPERIMENTAL)"));
remoteOption->setChecked(!Config::self()->isLocalServer());
grp->addButton(localOption);
vbox->addWidget(localOption);
grp->addButton(remoteOption);
vbox->addWidget(remoteOption);
auto hbox = new QHBoxLayout();
auto remoteLabel = new QLabel(i18n("Remote proxy server"));
hbox->addWidget(remoteLabel);
auto remoteServer = new QLineEdit();
remoteServer->setPlaceholderText(u"internal.company.com"_s);
remoteServer->setClearButtonEnabled(true);
hbox->addWidget(remoteServer);
vbox->addLayout(hbox);
QObject::connect(remoteOption, &QRadioButton::toggled, dialog, [remoteLabel, remoteServer, certcontrol](bool checked) {
Config::self()->setIsLocalServer(!checked);
Config::self()->save();
remoteLabel->setEnabled(!Config::self()->isLocalServer());
remoteServer->setEnabled(!Config::self()->isLocalServer());
certcontrol->updateStatus();
ConnectionController::instance()->startStopLocalServer();
});
QObject::connect(remoteServer, &QLineEdit::textChanged, dialog, [remoteServer]() {
Config::self()->setRemoteAddress(QUrl::fromUserInput(remoteServer->text()));
Config::self()->save();
ConnectionController::instance()->startWebsocketClient();
});
vbox->addWidget(certcontrol);
vbox->addStretch();
}
if (pageIds.contains(PageInstallAddin)) {
auto widget = new QWidget();
auto vbox = new QVBoxLayout(widget);
auto item = new KPageWidgetItem(widget);
item->setHeader(i18nc("@title", "Install Outlook Add-In"));
dialog->addPage(item);
auto grid = new QGridLayout();
vbox->addLayout(grid);
auto makeLabel = [](const QString &label) {
auto ret = new QLabel(label);
ret->setWordWrap(true);
return ret;
};
grid->addWidget(makeLabel(i18n("Before the first use, the add-in has to be activated in Outlook:")), 0, 0, 1, 3);
grid->addWidget(new QLabel(u"1."_s), 1, 0);
grid->addWidget(makeLabel(i18n("Go to the Outlook Extension Manager (you may be prompted to log in):")), 1, 1);
grid->addWidget(new QLabel(u"2."_s), 2, 0);
- grid->addWidget(makeLabel(i18n("Generate a manifest file (the filename will be copied to the clipboard)")), 2, 1);
+ grid->addWidget(makeLabel(i18n("Generate a manifest file (the filename will be copied to the clipboard):")), 2, 1);
grid->addWidget(new QLabel(u"3."_s), 3, 0);
grid->addWidget(makeLabel(i18n("In Outlook, register this via <tt>My Add-Ins -> Custom Add-Ins -> Add a custom Add-In</tt>")), 3, 1, 1, 2);
grid->addWidget(new QLabel(u"4."_s), 4, 0);
- grid->addWidget(makeLabel(i18n("Click on any E-Mail, and activate the add-in by clicking on the GnuPG icon shown about the email header.")), 4, 1, 1, 2);
+ grid->addWidget(makeLabel(i18n("Click on any e-mail, and activate the add-in by clicking on the GnuPG icon <nobr>( %1 )</nobr> shown above the email header.",
+ u"<img src=':/icons/addin_logo.png' height='%1'>"_s.arg(QFontMetrics(dialog->font()).ascent()))), 4, 1, 1, 2);
grid->setColumnStretch(1, 2);
auto extMgrButton = new QPushButton(i18nc("@button", "Open Outlook Extension Manager"));
QObject::connect(extMgrButton, &QPushButton::clicked, dialog, []() {
QDesktopServices::openUrl(QUrl(u"https://outlook.office.com/mail/jsmvvmdeeplink/?path=/options/manageapps&amp;bO=4"_s));
});
grid->addWidget(extMgrButton, 1, 2);
auto generateManifestButton = new QPushButton(i18nc("@button", "Generate Manifest"));
QObject::connect(generateManifestButton, &QPushButton::clicked, dialog, [generateManifestButton]() {
QFile file(u":/gpgol-client/manifest.xml.in"_s);
if (!file.open(QIODeviceBase::ReadOnly)) {
Q_ASSERT(false);
return;
}
QByteArray manifest = file.readAll();
manifest.replace("%HOST%", ConnectionController::serverDomain().toUtf8());
manifest.replace("%VERSION%", GPGOLWEB_VERSION_STRING);
const auto saveFilePath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + u"/gpgol-web-manifest.xml"_s;
QSaveFile saveFile(saveFilePath);
if (!saveFile.open(QIODeviceBase::WriteOnly)) {
Q_ASSERT(false);
return;
}
saveFile.write(manifest);
saveFile.commit();
QGuiApplication::clipboard()->setText(saveFilePath);
QToolTip::showText(generateManifestButton->mapToGlobal(QPoint(10, 10)), i18n("Copied to clipboard."), generateManifestButton, QRect(), 2000);
});
grid->addWidget(generateManifestButton, 2, 2);
//if (!Config::isLocalServer()) {
grid->addWidget(new QLabel(u"5."_s), 5, 0);
grid->addWidget(makeLabel(i18n("When prompted for a pairing code, click here to enter pairing mode:")), 5, 1);
auto pairingButton = new QPushButton(i18nc("@button", "Enter Pairing Mode"));
QObject::connect(pairingButton, &QPushButton::clicked, dialog, [dialog]() {
PairingDialog d(dialog);
d.exec();
WebsocketClient::self().quitPairingMode();
});
grid->addWidget(pairingButton, 5, 2);
//}
auto title = new KTitleWidget();
title->setText(i18n("Troubleshooting"));
vbox->addWidget(title);
grid = new QGridLayout();
vbox->addLayout(grid);
//grid->addWidget(makeLabel(i18n("If the extension is not connected:")), 0, 0, 1, 2);
grid->addWidget(makeLabel(i18n("Test for problems with the TLS-certificate installation, by opening this test page in your browser:")), 0, 0);
/* grid->addWidget(makeLabel(i18n("Sometimes the add-in icon is not immediately visible in Outlook's menu ribbon. Make sure to select an existing message in Outlook. "
"You may also have to click on the \"Apps\" icon.")), 2, 0, 1, 2);
grid->addWidget(makeLabel(i18n("Once you see the add-in, you may want to \"pin\" it for easier access.")), 3, 0, 1, 2);
grid->addWidget(makeLabel(i18n("If you have just added the manifest, it may be necessary to reload / restart Outlook.")), 4, 0, 1, 2);
grid->addWidget(makeLabel(i18n("If your account is organization managed, your administrator may have to allow usage of the GPGOL/Web add-in, manually.")), 5, 0, 1, 2); */
auto testPageButton = new QPushButton(i18nc("@button", "Open Test Page"));
QObject::connect(testPageButton, &QPushButton::clicked, dialog, []() {
QDesktopServices::openUrl(QUrl(u"https://"_s + ConnectionController::serverDomain() + u"/test"_s));
});
grid->addWidget(testPageButton, 0, 1);
grid->setColumnStretch(0, 2);
}
if (pageIds.contains(PageSettings)) {
auto widget = new QWidget();
auto vbox = new QVBoxLayout(widget);
auto featuresbox = new QGroupBox(i18n("Optional features"));
auto boxlayout = new QVBoxLayout(featuresbox);
auto reencrypt = new QCheckBox(i18n("Reencrypt email folders with new keys"), featuresbox);
reencrypt->setChecked(Config::self()->reencrypt());
QObject::connect(reencrypt, &QCheckBox::checkStateChanged, dialog, [](Qt::CheckState state) {
Config::self()->setReencrypt(state == Qt::Checked);
Config::self()->save();
});
boxlayout->addWidget(reencrypt);
vbox->addWidget(featuresbox);
auto startupbox = new QGroupBox(i18n("Startup behavior"));
boxlayout = new QVBoxLayout(startupbox);
#ifdef Q_OS_WIN
auto autoStartBox = new QCheckBox(i18n("Start GPGOL/Web automatically"));
// We intentionally don't use our own config for this: If users disable autostart via
// the Windows settings menu, we want to respect that, too.
{
QSettings winreg(u"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"_s, QSettings::NativeFormat);
autoStartBox->setChecked(!winreg.value(QCoreApplication::applicationName()).toString().isEmpty());
}
QObject::connect(autoStartBox, &QCheckBox::checkStateChanged, dialog, [](Qt::CheckState state) {
QSettings winreg(u"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"_s, QSettings::NativeFormat);
if (state) {
winreg.setValue(QCoreApplication::applicationName(),
QDir::toNativeSeparators(QCoreApplication::applicationFilePath()));
} else {
winreg.remove(QCoreApplication::applicationName());
}
});
boxlayout->addWidget(autoStartBox);
#endif
auto showOnStartup = new QCheckBox(i18n("Show status dialog when starting"));
showOnStartup->setChecked(Config::self()->showLauncher());
QObject::connect(showOnStartup, &QCheckBox::checkStateChanged, dialog, [](Qt::CheckState state) {
Config::self()->setShowLauncher(state == Qt::Checked);
Config::self()->save();
});
boxlayout->addWidget(showOnStartup);
vbox->addWidget(startupbox);
vbox->addStretch();
auto item = new KPageWidgetItem(widget);
item->setHeader(i18nc("@title", "Options"));
dialog->addPage(item);
}
dialog->exec();
}
void DialogController::doFirstTimeAssistant()
{
doDialog(QList{PageProxy, PageInstallAddin, PageSettings}, true);
}
#include "setupdialogs.moc"
diff --git a/client/statusdialog.cpp b/client/statusdialog.cpp
index 6517ece..c7239a0 100644
--- a/client/statusdialog.cpp
+++ b/client/statusdialog.cpp
@@ -1,154 +1,157 @@
// SPDX-FileCopyrightText: 2026 g10 code Gmbh
// SPDX-Contributor: Carl Schwan <carl.schwan@gnupg.com>
// SPDX-Contributor: Thomas Friedrichsmeier <thomas.friedrichsmeier@gnupg.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "statusdialog.h"
#include "config.h"
#include "connectioncontroller.h"
#include "gpgolweb_version.h"
#include "setupdialogs.h"
#include "websocketclient.h"
#include <KColorScheme>
#include <KLocalizedString>
#include <KTitleWidget>
#include <Libkleo/Compliance>
#include <QApplication>
#include <QFrame>
#include <QGroupBox>
#include <QIcon>
#include <QLabel>
#include <QPushButton>
#include <QStatusBar>
#include <QVBoxLayout>
using namespace Qt::StringLiterals;
QPointer<StatusDialog> StatusDialog::instance;
StatusDialog *StatusDialog::getOrCreate(QWidget *parent)
{
if (!instance) {
instance = new StatusDialog(parent);
}
return instance;
}
StatusDialog::StatusDialog(QWidget *parent)
: QMainWindow(parent)
{
setAttribute(Qt::WA_DeleteOnClose);
auto central = new QWidget();
setCentralWidget(central);
auto vbox = new QVBoxLayout(central);
auto appicon = new QLabel();
appicon->setPixmap(QIcon::fromTheme(u"com.gnupg.gpgolweb"_s).pixmap(64, 64));
vbox->addWidget(appicon);
vbox->setAlignment(appicon, Qt::AlignCenter);
auto title = new KTitleWidget();
title->setText(i18nc("@info", "GpgOL/Web %1", QString::fromLocal8Bit(GPGOLWEB_VERSION_STRING)));
vbox->addWidget(title);
vbox->setAlignment(title, Qt::AlignCenter);
auto label = new QLabel(i18n("The GnuPG Add-in for Outlook"));
vbox->addWidget(label);
vbox->setAlignment(label, Qt::AlignCenter);
auto statusGroup = new QGroupBox(i18n("Connection status:"));
auto grid = new QGridLayout(statusGroup);
m_proxyProcessLabel = new QLabel();
grid->addWidget(m_proxyProcessLabel, 0, 0);
m_proxyConnectionLabel = new QLabel();
grid->addWidget(m_proxyConnectionLabel, 1, 0);
auto connectionButton = new QPushButton(i18n("Setup connection"));
+ connectionButton->setIcon(QIcon::fromTheme(u"applications-network"_s));
grid->addWidget(connectionButton, 1, 1);
m_clientConnectionLabel = new QLabel();
grid->addWidget(m_clientConnectionLabel, 2, 0);
auto extensionButton = new QPushButton(i18n("Setup extension"));
+ extensionButton->setIcon(QIcon::fromTheme(u"extension-symbolic"_s));
grid->addWidget(extensionButton, 2, 1);
vbox->addStretch();
vbox->addWidget(statusGroup);
vbox->addStretch();
auto hbox = new QHBoxLayout();
auto settingsButton = new QPushButton(i18n("General Settings"));
+ settingsButton->setIcon(QIcon::fromTheme(u"configure-symbolic"_s));
hbox->addWidget(settingsButton);
hbox->addStretch();
auto minimizeButton = new QPushButton(i18n("Minimize to tray"));
connect(minimizeButton, &QPushButton::clicked, this, &QObject::deleteLater);
hbox->addWidget(minimizeButton);
vbox->addLayout(hbox);
auto statusBar = new QStatusBar(this);
m_status = new QLabel;
statusBar->addPermanentWidget(m_status);
auto version = new QLabel(i18nc("@info", "Version: %1", QString::fromLocal8Bit(GPGOLWEB_VERSION_STRING)));
statusBar->addPermanentWidget(version);
if (Kleo::DeVSCompliance::isActive()) {
auto statusLbl = std::make_unique<QLabel>(Kleo::DeVSCompliance::name());
{
auto statusPalette = qApp->palette();
KColorScheme::adjustForeground(statusPalette,
Kleo::DeVSCompliance::isCompliant() ? KColorScheme::NormalText : KColorScheme::NegativeText,
statusLbl->foregroundRole(),
KColorScheme::View);
statusLbl->setAutoFillBackground(true);
KColorScheme::adjustBackground(statusPalette,
Kleo::DeVSCompliance::isCompliant() ? KColorScheme::PositiveBackground : KColorScheme::NegativeBackground,
QPalette::Window,
KColorScheme::View);
statusLbl->setPalette(statusPalette);
}
statusBar->addPermanentWidget(statusLbl.release());
}
setStatusBar(statusBar);
connect(&WebsocketClient::self(), &WebsocketClient::stateChanged, this, &StatusDialog::stateChanged);
connect(ConnectionController::instance(), &ConnectionController::serverProcessStatusChanged, this, &StatusDialog::stateChanged);
stateChanged();
connect(connectionButton, &QPushButton::clicked, this, [this]() {
DialogController::doDialog(QList{ DialogController::PageProxy });
});
connect(extensionButton, &QPushButton::clicked, this, [this]() {
DialogController::doDialog(QList{ DialogController::PageInstallAddin });
});
connect(settingsButton, &QPushButton::clicked, this, [this]() {
DialogController::doDialog(QList{ DialogController::PageSettings });
});
}
#define ICON_OK u"<span style=\"color:green\">&#10004;</span> "_s
#define ICON_WARN u"<span style=\"color:orange\">&#9888;</span> "_s
#define ICON_ERROR u"<span style=\"color:red\">&#10060;</span> "_s
void StatusDialog::stateChanged()
{
auto serverState = ConnectionController::instance()->serverProcessState();
if (serverState == ConnectionController::RemoteServer) {
m_proxyProcessLabel->setText(i18n("Configured to connect to remote proxy %1", ConnectionController::serverDomain()));
} else if (serverState == ConnectionController::LocalServerRunning) {
m_proxyProcessLabel->setText(ICON_OK + i18n("Proxy process is running"));
} else if (serverState == ConnectionController::LocalServerStarting) {
m_proxyProcessLabel->setText(ICON_WARN + i18n("Proxy process is starting"));
} else {
m_proxyProcessLabel->setText(ICON_ERROR + i18n("Proxy process failed. Attempting restart..."));
}
auto state = WebsocketClient::self().state();
if (state == WebsocketClient::ConnectedToWebclient || state == WebsocketClient::ConnectedToProxy) {
m_proxyConnectionLabel->setText(ICON_OK + i18n("Proxy is connected"));
} else {
m_proxyConnectionLabel->setText(ICON_ERROR + i18n("Proxy is not connected"));
}
if (state == WebsocketClient::ConnectedToWebclient) {
m_clientConnectionLabel->setText(ICON_OK + i18n("Web extension is connected, and opened"));
} else {
m_clientConnectionLabel->setText(ICON_WARN + i18n("Web extension is not connected, or not opened"));
}
}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Feb 26, 6:42 PM (16 h, 2 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
3f/75/cec97db5abb0bd808954b7d4f90e

Event Timeline