airgapped signing with UR

This commit is contained in:
tobtoht
2023-12-04 16:06:33 +01:00
parent 33035a21a8
commit 51b0fcc19d
80 changed files with 3943 additions and 624 deletions
+37
View File
@@ -8,6 +8,7 @@
#include <QPushButton>
#include <QFontDatabase>
#include <QTcpSocket>
#include <QFileDialog>
#include "constants.h"
#include "networktype.h"
@@ -111,6 +112,28 @@ QStringList fileFind(const QRegularExpression &pattern, const QString &baseDir,
return rtn;
}
QString getSaveFileName(QWidget* parent, const QString &caption, const QString &filename, const QString &filter) {
QDir lastPath{conf()->get(Config::lastPath).toString()};
QString fn = QFileDialog::getSaveFileName(parent, caption, lastPath.filePath(filename), filter);
if (fn.isEmpty()) {
return {};
}
QFileInfo fileInfo(fn);
conf()->set(Config::lastPath, fileInfo.absolutePath());
return fn;
}
QString getOpenFileName(QWidget* parent, const QString& caption, const QString& filter) {
QString lastPath = conf()->get(Config::lastPath).toString();
QString fn = QFileDialog::getOpenFileName(parent, caption, lastPath, filter);
if (fn.isEmpty()) {
return {};
}
QFileInfo fileInfo(fn);
conf()->set(Config::lastPath, fileInfo.absolutePath());
return fn;
}
bool dirExists(const QString &path) {
QDir pathDir(path);
return pathDir.exists();
@@ -645,6 +668,20 @@ void showMsg(const Message &m) {
showMsg(m.parent, QMessageBox::Warning, "Error", m.title, m.description, m.helpItems, m.doc, m.highlight);
}
void openDir(QWidget *parent, const QString &message, const QString &dir) {
QMessageBox openDir{parent};
openDir.setWindowTitle("Info");
openDir.setText(message);
QPushButton *copy = openDir.addButton("Open directory", QMessageBox::HelpRole);
openDir.addButton(QMessageBox::Ok);
openDir.setDefaultButton(QMessageBox::Ok);
openDir.exec();
if (openDir.clickedButton() == copy) {
QDesktopServices::openUrl(QUrl::fromLocalFile(dir));
}
}
QWindow *windowForQObject(QObject* object) {
while (object) {
if (auto widget = qobject_cast<QWidget*>(object)) {