aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/UserInterfaceUtils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/UserInterfaceUtils.h')
-rw-r--r--src/ui/UserInterfaceUtils.h73
1 files changed, 40 insertions, 33 deletions
diff --git a/src/ui/UserInterfaceUtils.h b/src/ui/UserInterfaceUtils.h
index 59c803b9..39a4633e 100644
--- a/src/ui/UserInterfaceUtils.h
+++ b/src/ui/UserInterfaceUtils.h
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2021 Saturneric
+ * Copyright (C) 2021 Saturneric <[email protected]>
*
* This file is part of GpgFrontend.
*
@@ -20,18 +20,20 @@
* the gpg4usb project, which is under GPL-3.0-or-later.
*
* All the source code of GpgFrontend was modified and released by
- * Saturneric<[email protected]> starting on May 12, 2021.
+ * Saturneric <[email protected]> starting on May 12, 2021.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
-#ifndef GPGFRONTEND_USER_INTERFACE_UTILS_H
-#define GPGFRONTEND_USER_INTERFACE_UTILS_H
+#pragma once
+
+#include <qwidget.h>
-#include "core/GpgModel.h"
#include "core/function/result_analyse/GpgVerifyResultAnalyse.h"
#include "core/model/GpgKey.h"
+#include "core/thread/ThreadingModel.h"
+#include "core/typedef/GpgTypedef.h"
#include "ui/GpgFrontendUI.h"
namespace GpgFrontend {
@@ -43,6 +45,9 @@ namespace GpgFrontend::UI {
class InfoBoardWidget;
class TextEdit;
+using OperaWaitingHd = std::function<void()>;
+using OperaWaitingCb = const std::function<void(OperaWaitingHd)>;
+
/**
* @brief
*
@@ -71,7 +76,7 @@ void import_unknown_key_from_keyserver(
* @param report_text
*/
void refresh_info_board(InfoBoardWidget* info_board, int status,
- const std::string& report_text);
+ const QString& report_text);
/**
* @brief
@@ -103,10 +108,10 @@ void process_result_analyse(TextEdit* edit, InfoBoardWidget* info_board,
* @param func
*/
void process_operation(
- QWidget* parent, const std::string& waiting_title,
+ QWidget* parent, const QString& waiting_title,
GpgFrontend::Thread::Task::TaskRunnable func,
GpgFrontend::Thread::Task::TaskCallback callback = nullptr,
- Thread::Task::DataObjectPtr data_object = nullptr);
+ DataObjectPtr data_object = nullptr);
/**
* @brief
@@ -115,8 +120,8 @@ void process_operation(
* @param key_id
* @param key_server
*/
-void import_key_from_keyserver(QWidget* parent, const std::string& key_id,
- const std::string& key_server);
+void import_key_from_keyserver(QWidget* parent, const QString& key_id,
+ const QString& key_server);
/**
* @brief
@@ -129,8 +134,8 @@ class CommonUtils : public QWidget {
* @brief
*
*/
- using ImportCallbackFunctiopn = std::function<void(
- const std::string&, const std::string&, size_t, size_t)>;
+ using ImportCallbackFunctiopn =
+ std::function<void(const QString&, const QString&, size_t, size_t)>;
/**
* @brief Construct a new Common Utils object
@@ -148,57 +153,67 @@ class CommonUtils : public QWidget {
/**
* @brief
*
+ * @param err
*/
- bool isApplicationNeedRestart();
+ static void WaitForOpera(QWidget* parent, const QString&,
+ const OperaWaitingCb&);
/**
* @brief
*
+ * @param err
*/
- bool KeyExistsinFavouriteList(const GpgKey& key);
+ static void RaiseMessageBox(QWidget* parent, GpgError err);
/**
* @brief
*
+ * @param err
*/
- void AddKey2Favourtie(const GpgKey& key);
+ static void RaiseFailureMessageBox(QWidget* parent, GpgError err);
/**
* @brief
*
*/
- void RemoveKeyFromFavourite(const GpgKey& key);
+ bool isApplicationNeedRestart();
- signals:
/**
* @brief
*
*/
- void SignalKeyStatusUpdated();
+ bool KeyExistsinFavouriteList(const GpgKey& key);
/**
* @brief
*
*/
- void SignalGnupgNotInstall();
+ void AddKey2Favourtie(const GpgKey& key);
/**
- * @brief emit when the key database is refreshed
+ * @brief
*
*/
- void SignalKeyDatabaseRefreshDone();
+ void RemoveKeyFromFavourite(const GpgKey& key);
+ signals:
/**
* @brief
*
*/
- void SignalNeedUserInputPassphrase();
+ void SignalKeyStatusUpdated();
/**
* @brief
*
*/
- void SignalUserInputPassphraseDone(QString passphrase);
+ void SignalBadGnupgEnv(QString);
+
+ /**
+ * @brief emit when the key database is refreshed
+ *
+ */
+ void SignalKeyDatabaseRefreshDone();
/**
* @brief
@@ -213,7 +228,7 @@ class CommonUtils : public QWidget {
* @param parent
* @param in_buffer
*/
- void SlotImportKeys(QWidget* parent, const std::string& in_buffer);
+ void SlotImportKeys(QWidget* parent, const QString& in_buffer);
/**
* @brief
@@ -263,7 +278,7 @@ class CommonUtils : public QWidget {
* @param arguments
* @param interact_func
*/
- void SlotExecuteCommand(const std::string& cmd, const QStringList& arguments,
+ void SlotExecuteCommand(const QString& cmd, const QStringList& arguments,
const std::function<void(QProcess*)>& interact_func);
/**
@@ -280,17 +295,9 @@ class CommonUtils : public QWidget {
*/
void slot_update_key_status();
- /**
- * @brief
- *
- */
- void slot_popup_passphrase_input_dialog();
-
private:
static std::unique_ptr<CommonUtils> instance_; ///<
bool application_need_to_restart_at_once_ = false;
};
} // namespace GpgFrontend::UI
-
-#endif // GPGFRONTEND_USER_INTERFACE_UTILS_H