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 
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(QWidget* parent, const std::string& waiting_title,
105  const std::function<void()>& func);
106 
111 class CommonUtils : public QWidget {
112  Q_OBJECT
113  public:
118  using ImportCallbackFunctiopn = std::function<void(
119  const std::string&, const std::string&, size_t, size_t)>;
120 
125  CommonUtils();
126 
132  static CommonUtils* GetInstance();
133 
134  signals:
139  void SignalKeyStatusUpdated();
140 
145  void SignalGnupgNotInstall();
146 
152 
153  public slots:
160  void SlotImportKeys(QWidget* parent, const std::string& in_buffer);
161 
167  void SlotImportKeyFromFile(QWidget* parent);
168 
174  void SlotImportKeyFromKeyServer(QWidget* parent);
175 
181  void SlotImportKeyFromClipboard(QWidget* parent);
182 
190  static void SlotImportKeyFromKeyServer(
191  const GpgFrontend::KeyIdArgsList& key_ids,
192  const GpgFrontend::UI::CommonUtils::ImportCallbackFunctiopn& callback);
193 
201  const QStringList& arguments,
202  const std::function<void(QProcess*)>& interact_func);
203 
204  private slots:
205 
210  void slot_update_key_status();
211 
212  private:
213  static std::unique_ptr<CommonUtils> instance_;
214 };
215 
216 } // namespace GpgFrontend::UI
217 
218 #endif // GPGFRONTEND_USER_INTERFACE_UTILS_H
GpgFrontend::CoreCommonUtil::GetInstance
static CoreCommonUtil * GetInstance()
Construct a new Core Common Util object.
Definition: CoreCommonUtil.cpp:33
GpgFrontend::FileOperator::ReadFile
static bool ReadFile(const QString &file_name, QByteArray &data)
read file content
Definition: FileOperator.cpp:31
GpgFrontend::UI::WaitingDialog
Definition: WaitingDialog.h:40
GpgFrontend::UI
Definition: VerifyDetailsDialog.cpp:33
GpgFrontend::UI::refresh_info_board
void refresh_info_board(InfoBoardWidget *info_board, int status, const std::string &report_text)
Definition: UserInterfaceUtils.cpp:80
GpgFrontend::GpgResultAnalyse::GetStatus
int GetStatus() const
Get the Status object.
Definition: GpgResultAnalyse.cpp:35
GpgFrontend::UI::VerifyDetailsDialog
Definition: VerifyDetailsDialog.h:41
GpgFrontend
Definition: CoreCommonUtil.cpp:29
GpgFrontend::UI::CommonUtils
Definition: UserInterfaceUtils.h:111
GpgFrontend::GpgResultAnalyse::GetResultReport
const std::string GetResultReport() const
Get the Result Report object.
Definition: GpgResultAnalyse.cpp:31
GpgFrontend::SingletonFunctionObject< GpgKeyImportExporter >::GetInstance
static GpgKeyImportExporter & GetInstance(int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL)
Get the Instance object.
Definition: GpgFunctionObject.h:181
GpgFrontend::UI::InfoBoardWidget::AddOptionalAction
void AddOptionalAction(const QString &name, const std::function< void()> &action)
Definition: InfoBoardWidget.cpp:113
GpgFrontend::GpgInfo::AppPath
std::string AppPath
executable binary path of gnupg
Definition: GpgInfo.h:41
GpgFrontend::UI::InfoBoardWidget::ResetOptionActionsMenu
void ResetOptionActionsMenu()
Definition: InfoBoardWidget.cpp:129
GpgFrontend::UI::import_unknown_key_from_keyserver
void import_unknown_key_from_keyserver(QWidget *parent, const GpgVerifyResultAnalyse &verify_res)
Definition: UserInterfaceUtils.cpp:57
GpgFrontend::GlobalSettingStation::GetUISettings
libconfig::Setting & GetUISettings() noexcept
Definition: GlobalSettingStation.h:68
GpgFrontend::UI::process_operation
void process_operation(QWidget *parent, const std::string &waiting_title, const std::function< void()> &func)
Definition: UserInterfaceUtils.cpp:112
GpgFrontend::UI::CommonUtils::SlotImportKeys
void SlotImportKeys(QWidget *parent, const std::string &in_buffer)
Definition: UserInterfaceUtils.cpp:164
GpgFrontend::GpgContext::GetInfo
const GpgInfo & GetInfo() const
Get the Info object.
Definition: GpgContext.h:95
GpgFrontend::UI::TextEdit
TextEdit class.
Definition: TextEdit.h:41
GpgFrontend::GpgVerifyResultAnalyse
Definition: GpgVerifyResultAnalyse.h:40
GpgFrontend::UI::KeyServerImportDialog
Definition: KeyServerImportDialog.h:43
GpgFrontend::GpgKeyGetter::FlushKeyCache
void FlushKeyCache()
flush the keys in the cache
Definition: GpgKeyGetter.cpp:101
GpgFrontend::UI::InfoBoardWidget::SlotRefresh
void SlotRefresh(const QString &text, GpgFrontend::UI::InfoBoardStatus status)
Definition: InfoBoardWidget.cpp:89
GpgFrontend::UI::KeyImportDetailDialog
Definition: KeyImportDetailDialog.h:42
GpgFrontend::UI::CommonUtils::slot_update_key_status
void slot_update_key_status()
update the key status when signal is emitted
Definition: UserInterfaceUtils.cpp:331
GpgFrontend::GpgResultAnalyse
Definition: GpgResultAnalyse.h:37
GpgFrontend::SingletonFunctionObject< GpgKeyGetter >::GetAllChannelId
static std::vector< int > GetAllChannelId()
Get all the channel ids.
Definition: GpgFunctionObject.h:259
GpgFrontend::UI::CommonUtils::SlotImportKeyFromFile
void SlotImportKeyFromFile(QWidget *parent)
Definition: UserInterfaceUtils.cpp:172
GpgFrontend::UI::CommonUtils::SlotImportKeyFromKeyServer
void SlotImportKeyFromKeyServer(QWidget *parent)
Definition: UserInterfaceUtils.cpp:188
GpgFrontend::UI::InfoBoardWidget::AssociateTabWidget
void AssociateTabWidget(QTabWidget *tab)
Definition: InfoBoardWidget.cpp:103
GpgFrontend::GpgVerifyResultAnalyse::GetSignatures
gpgme_signature_t GetSignatures() const
Get the Signatures object.
Definition: GpgVerifyResultAnalyse.cpp:205
GpgFrontend::UI::SignalStation::GetInstance
static SignalStation * GetInstance()
Get the Instance object.
Definition: SignalStation.cpp:37
GpgFrontend::UI::CommonUtils::SignalKeyDatabaseRefreshDone
void SignalKeyDatabaseRefreshDone()
emit when the key database is refreshed
GpgFrontend::UI::CommonUtils::SlotImportKeyFromClipboard
void SlotImportKeyFromClipboard(QWidget *parent)
Definition: UserInterfaceUtils.cpp:193
GpgFrontend::UI::CommonUtils::CommonUtils
CommonUtils()
Construct a new Common Utils object.
Definition: UserInterfaceUtils.cpp:134
GpgFrontend::GpgKeyImportExporter::ImportKey
GpgImportInformation ImportKey(StdBypeArrayPtr inBuffer)
Definition: GpgKeyImportExporter.cpp:42
GpgFrontend::UI::CommonUtils::SlotExecuteGpgCommand
void SlotExecuteGpgCommand(const QStringList &arguments, const std::function< void(QProcess *)> &interact_func)
Definition: UserInterfaceUtils.cpp:199
GpgFrontend::UI::show_verify_details
void show_verify_details(QWidget *parent, InfoBoardWidget *info_board, GpgError error, const GpgVerifyResult &verify_result)
Definition: UserInterfaceUtils.cpp:48
GpgFrontend::UI::process_result_analyse
void process_result_analyse(TextEdit *edit, InfoBoardWidget *info_board, const GpgResultAnalyse &result_analyse)
Definition: UserInterfaceUtils.cpp:92
GpgFrontend::GpgImportInformation
Definition: GpgKeyImportExporter.h:57
GpgFrontend::UI::CommonUtils::GetInstance
static CommonUtils * GetInstance()
Get the Instance object.
Definition: UserInterfaceUtils.cpp:127
GpgFrontend::UI::InfoBoardWidget
Class for handling the verify label shown at bottom of a textedit-page.
Definition: InfoBoardWidget.h:53