mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-28 03:38:53 +01:00
airgapped signing with UR
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user