GpgFrontend Project A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.

UserInterfaceUtils.h
1
29 #ifndef GPGFRONTEND_USER_INTERFACE_UTILS_H
30 #define GPGFRONTEND_USER_INTERFACE_UTILS_H
31
32 #include "core/GpgModel.h"
33 #include "core/function/result_analyse/GpgVerifyResultAnalyse.h"
34 #include "ui/GpgFrontendUI.h"
35
36 namespace GpgFrontend {
37 class GpgResultAnalyse;
38 }
39
40 namespace GpgFrontend::UI {
41
42 class InfoBoardWidget;
43 class TextEdit;
44
53 void show_verify_details(QWidget* parent, InfoBoardWidget* info_board,
54 GpgError error, const GpgVerifyResult& verify_result);
55
62 void import_unknown_key_from_keyserver(
63 QWidget* parent, const GpgVerifyResultAnalyse& verify_res);
64
72 void refresh_info_board(InfoBoardWidget* info_board, int status,
73 const std::string& report_text);
74
82 void process_result_analyse(TextEdit* edit, InfoBoardWidget* info_board,
83 const GpgResultAnalyse& result_analyse);
84
93 void process_result_analyse(TextEdit* edit, InfoBoardWidget* info_board,
94 const GpgResultAnalyse& result_analyse_a,
95 const GpgResultAnalyse& result_analyse_b);
96
104 void process_operation(
105 QWidget* parent, const std::string& waiting_title,
106 GpgFrontend::Thread::Task::TaskRunnable func,
107 GpgFrontend::Thread::Task::TaskCallback callback = nullptr,
108 Thread::Task::DataObjectPtr data_object = nullptr);
109
117 void import_key_from_keyserver(QWidget* parent, const std::string& key_id,
118 const std::string& key_server);
119
124 class CommonUtils : public QWidget {
125 Q_OBJECT
126 public:
131 using ImportCallbackFunctiopn = std::function<void(
132 const std::string&, const std::string&, size_t, size_t)>;
133
138 CommonUtils();
139
145 static CommonUtils* GetInstance();
146
151 bool isApplicationNeedRestart();
152
153 signals:
158 void SignalKeyStatusUpdated();
159
164 void SignalGnupgNotInstall();
165
170 void SignalKeyDatabaseRefreshDone();
171
176 void SignalNeedUserInputPassphrase();
177
182 void SignalUserInputPassphraseDone(QString passphrase);
183
188 void SignalRestartApplication(int);
189
190 public slots:
197 void SlotImportKeys(QWidget* parent, const std::string& in_buffer);
198
204 void SlotImportKeyFromFile(QWidget* parent);
205
211 void SlotImportKeyFromKeyServer(QWidget* parent);
212
218 void SlotImportKeyFromClipboard(QWidget* parent);
219
227 static void SlotImportKeyFromKeyServer(
228 const GpgFrontend::KeyIdArgsList& key_ids,
229 const GpgFrontend::UI::CommonUtils::ImportCallbackFunctiopn& callback);
230
237 void SlotExecuteGpgCommand(
238 const QStringList& arguments,
239 const std::function<void(QProcess*)>& interact_func);
240
247 void SlotExecuteCommand(const std::string& cmd, const QStringList& arguments,
248 const std::function<void(QProcess*)>& interact_func);
249
254 void SlotRestartApplication(int);
255
256 private slots:
257
262 void slot_update_key_status();
263
268 void slot_popup_passphrase_input_dialog();
269
270 private:
271 static std::unique_ptr<CommonUtils> instance_;
272 bool application_need_to_restart_at_once_ = false;
273 };
274
275 } // namespace GpgFrontend::UI
276
277 #endif // GPGFRONTEND_USER_INTERFACE_UTILS_H
GpgFrontend::UI::CommonUtils
Definition: UserInterfaceUtils.h:124
GpgFrontend::UI::CommonUtils::SlotImportKeyFromFile
void SlotImportKeyFromFile(QWidget *parent)
Definition: UserInterfaceUtils.cpp:230
GpgFrontend::UI::CommonUtils::SlotImportKeyFromClipboard
void SlotImportKeyFromClipboard(QWidget *parent)
Definition: UserInterfaceUtils.cpp:251
GpgFrontend::UI::CommonUtils::SignalKeyDatabaseRefreshDone
void SignalKeyDatabaseRefreshDone()
emit when the key database is refreshed
GpgFrontend::UI::CommonUtils::SlotImportKeys
void SlotImportKeys(QWidget *parent, const std::string &in_buffer)
Definition: UserInterfaceUtils.cpp:222
GpgFrontend::UI::CommonUtils::CommonUtils
CommonUtils()
Construct a new Common Utils object.
Definition: UserInterfaceUtils.cpp:155
GpgFrontend::UI::CommonUtils::SlotExecuteCommand
void SlotExecuteCommand(const std::string &cmd, const QStringList &arguments, const std::function< void(QProcess *)> &interact_func)
Definition: UserInterfaceUtils.cpp:257
GpgFrontend::UI::CommonUtils::slot_update_key_status
void slot_update_key_status()
update the key status when signal is emitted
Definition: UserInterfaceUtils.cpp:434
GpgFrontend::UI::CommonUtils::GetInstance
static CommonUtils * GetInstance()
Get the Instance object.
Definition: UserInterfaceUtils.cpp:148
GpgFrontend::UI::CommonUtils::SlotImportKeyFromKeyServer
void SlotImportKeyFromKeyServer(QWidget *parent)
Definition: UserInterfaceUtils.cpp:246
GpgFrontend::UI::CommonUtils::SlotExecuteGpgCommand
void SlotExecuteGpgCommand(const QStringList &arguments, const std::function< void(QProcess *)> &interact_func)
Definition: UserInterfaceUtils.cpp:289
GpgFrontend::UI
Definition: FileReadTask.cpp:29
GpgFrontend::UI::refresh_info_board
void refresh_info_board(InfoBoardWidget *info_board, int status, const std::string &report_text)
Definition: UserInterfaceUtils.cpp:88
GpgFrontend::UI::process_operation
void process_operation(QWidget *parent, const std::string &waiting_title, const Thread::Task::TaskRunnable func, const Thread::Task::TaskCallback callback, Thread::Task::DataObjectPtr data_object)
Definition: UserInterfaceUtils.cpp:118
GpgFrontend::UI::show_verify_details
void show_verify_details(QWidget *parent, InfoBoardWidget *info_board, GpgError error, const GpgVerifyResult &verify_result)
Definition: UserInterfaceUtils.cpp:56
GpgFrontend::UI::import_unknown_key_from_keyserver
void import_unknown_key_from_keyserver(QWidget *parent, const GpgVerifyResultAnalyse &verify_res)
Definition: UserInterfaceUtils.cpp:65
GpgFrontend::UI::import_key_from_keyserver
void import_key_from_keyserver(QWidget *parent, const std::string &key_id, const std::string &key_server)
GpgFrontend::UI::process_result_analyse
void process_result_analyse(TextEdit *edit, InfoBoardWidget *info_board, const GpgResultAnalyse &result_analyse)
Definition: UserInterfaceUtils.cpp:100
GpgFrontend
Definition: CoreCommonUtil.cpp:31