GpgFrontend-Doxygen/docs/latex/KeyList_8h_source.tex
2022-05-09 03:59:26 +08:00

171 lines
13 KiB
TeX

\hypertarget{KeyList_8h_source}{}\doxysection{Key\+List.\+h}
\label{KeyList_8h_source}\index{src/ui/widgets/KeyList.h@{src/ui/widgets/KeyList.h}}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 }
\DoxyCodeLine{29 \textcolor{preprocessor}{\#ifndef \_\_KEYLIST\_H\_\_}}
\DoxyCodeLine{30 \textcolor{preprocessor}{\#define \_\_KEYLIST\_H\_\_}}
\DoxyCodeLine{31 }
\DoxyCodeLine{32 \textcolor{preprocessor}{\#include <utility>}}
\DoxyCodeLine{33 }
\DoxyCodeLine{34 \textcolor{preprocessor}{\#include "{}core/GpgContext.h"{}}}
\DoxyCodeLine{35 \textcolor{preprocessor}{\#include "{}ui/import\_export/KeyImportDetailDialog.h"{}}}
\DoxyCodeLine{36 }
\DoxyCodeLine{37 \textcolor{keyword}{class }Ui\_KeyList;}
\DoxyCodeLine{38 }
\DoxyCodeLine{39 \textcolor{keyword}{namespace }\mbox{\hyperlink{namespaceGpgFrontend_1_1UI}{GpgFrontend::UI}} \{}
\DoxyCodeLine{40 }
\DoxyCodeLine{45 \textcolor{keyword}{struct }\mbox{\hyperlink{structGpgFrontend_1_1UI_1_1KeyListRow}{KeyListRow}} \{}
\DoxyCodeLine{46 \textcolor{keyword}{using} KeyType = \textcolor{keywordtype}{unsigned} int;}
\DoxyCodeLine{47 }
\DoxyCodeLine{48 \textcolor{keyword}{static} \textcolor{keyword}{const} KeyType SECRET\_OR\_PUBLIC\_KEY = 0; }
\DoxyCodeLine{49 \textcolor{keyword}{static} \textcolor{keyword}{const} KeyType ONLY\_SECRET\_KEY = 1; }
\DoxyCodeLine{50 \};}
\DoxyCodeLine{51 }
\DoxyCodeLine{56 \textcolor{keyword}{struct }\mbox{\hyperlink{structGpgFrontend_1_1UI_1_1KeyListColumn}{KeyListColumn}} \{}
\DoxyCodeLine{57 \textcolor{keyword}{using} InfoType = \textcolor{keywordtype}{unsigned} int;}
\DoxyCodeLine{58 }
\DoxyCodeLine{59 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} InfoType ALL = \string~0; }
\DoxyCodeLine{60 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} InfoType TYPE = 1 << 0; }
\DoxyCodeLine{61 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} InfoType NAME = 1 << 1; }
\DoxyCodeLine{62 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} InfoType EmailAddress = 1 << 2; }
\DoxyCodeLine{63 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} InfoType Usage = 1 << 3; }
\DoxyCodeLine{64 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} InfoType Validity = 1 << 4; }
\DoxyCodeLine{65 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} InfoType FingerPrint = 1 << 5; }
\DoxyCodeLine{66 \};}
\DoxyCodeLine{67 }
\DoxyCodeLine{72 \textcolor{keyword}{struct }\mbox{\hyperlink{structGpgFrontend_1_1UI_1_1KeyMenuAbility}{KeyMenuAbility}} \{}
\DoxyCodeLine{73 \textcolor{keyword}{using} AbilityType = \textcolor{keywordtype}{unsigned} int;}
\DoxyCodeLine{74 }
\DoxyCodeLine{75 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} AbilityType ALL = \string~0; }
\DoxyCodeLine{76 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} AbilityType NONE = 0; }
\DoxyCodeLine{77 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} AbilityType REFRESH = 1 << 0; }
\DoxyCodeLine{78 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} AbilityType SYNC\_PUBLIC\_KEY = 1 << 1; }
\DoxyCodeLine{79 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} AbilityType UNCHECK\_ALL = 1 << 3; }
\DoxyCodeLine{80 \textcolor{keyword}{static} \textcolor{keyword}{constexpr} AbilityType CHECK\_ALL = 1 << 5; }
\DoxyCodeLine{81 \};}
\DoxyCodeLine{82 }
\DoxyCodeLine{87 \textcolor{keyword}{struct }\mbox{\hyperlink{structGpgFrontend_1_1UI_1_1KeyTable}{KeyTable}} \{}
\DoxyCodeLine{88 QTableWidget* key\_list\_; }
\DoxyCodeLine{89 KeyListRow::KeyType select\_type\_; }
\DoxyCodeLine{90 KeyListColumn::InfoType info\_type\_; }
\DoxyCodeLine{91 std::vector<GpgKey> buffered\_keys\_; }
\DoxyCodeLine{92 std::function<bool(\textcolor{keyword}{const} \mbox{\hyperlink{classGpgFrontend_1_1GpgKey}{GpgKey}}\&)> filter\_; }
\DoxyCodeLine{93 KeyIdArgsListPtr checked\_key\_ids\_; }
\DoxyCodeLine{94 }
\DoxyCodeLine{103 \mbox{\hyperlink{structGpgFrontend_1_1UI_1_1KeyTable_a88606ba6954d60244faf38de419bfc47}{KeyTable}}(}
\DoxyCodeLine{104 QTableWidget* \_key\_list, KeyListRow::KeyType \_select\_type,}
\DoxyCodeLine{105 KeyListColumn::InfoType \_info\_type,}
\DoxyCodeLine{106 std::function<\textcolor{keywordtype}{bool}(\textcolor{keyword}{const} \mbox{\hyperlink{classGpgFrontend_1_1GpgKey}{GpgKey}}\&)> \_filter = [](\textcolor{keyword}{const} \mbox{\hyperlink{classGpgFrontend_1_1GpgKey}{GpgKey}}\&) -\/> \textcolor{keywordtype}{bool} \{}
\DoxyCodeLine{107 \textcolor{keywordflow}{return} \textcolor{keyword}{true};}
\DoxyCodeLine{108 \})}
\DoxyCodeLine{109 : key\_list\_(\_key\_list),}
\DoxyCodeLine{110 select\_type\_(\_select\_type),}
\DoxyCodeLine{111 info\_type\_(\_info\_type),}
\DoxyCodeLine{112 filter\_(std::move(\_filter)) \{\}}
\DoxyCodeLine{113 }
\DoxyCodeLine{119 \textcolor{keywordtype}{void} \mbox{\hyperlink{structGpgFrontend_1_1UI_1_1KeyTable_aaac381e205c323444098803e0295060f}{Refresh}}(KeyLinkListPtr m\_keys = \textcolor{keyword}{nullptr});}
\DoxyCodeLine{120 }
\DoxyCodeLine{126 KeyIdArgsListPtr\& \mbox{\hyperlink{structGpgFrontend_1_1UI_1_1KeyTable_a77eba4055ecb7d32fab06f65b80ae07e}{GetChecked}}();}
\DoxyCodeLine{127 }
\DoxyCodeLine{132 \textcolor{keywordtype}{void} UncheckALL() \textcolor{keyword}{const};}
\DoxyCodeLine{133 }
\DoxyCodeLine{138 \textcolor{keywordtype}{void} CheckALL() \textcolor{keyword}{const};}
\DoxyCodeLine{139 }
\DoxyCodeLine{145 \textcolor{keywordtype}{void} \mbox{\hyperlink{structGpgFrontend_1_1UI_1_1KeyTable_ae0713ebbc21e78995db9a856d746fe6c}{SetChecked}}(KeyIdArgsListPtr key\_ids);}
\DoxyCodeLine{146 \};}
\DoxyCodeLine{147 }
\DoxyCodeLine{152 \textcolor{keyword}{class }\mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList}{KeyList}} : \textcolor{keyword}{public} QWidget \{}
\DoxyCodeLine{153 Q\_OBJECT}
\DoxyCodeLine{154 }
\DoxyCodeLine{155 \textcolor{keyword}{public}:}
\DoxyCodeLine{162 \textcolor{keyword}{explicit} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a7c9d5cacdb42e1fbda5d3cc96e861418}{KeyList}}(KeyMenuAbility::AbilityType menu\_ability,}
\DoxyCodeLine{163 QWidget* parent = \textcolor{keyword}{nullptr});}
\DoxyCodeLine{164 }
\DoxyCodeLine{173 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a73ddb7feb1f70eac44e038c3dc925fec}{AddListGroupTab}}(}
\DoxyCodeLine{174 \textcolor{keyword}{const} QString\& name,}
\DoxyCodeLine{175 KeyListRow::KeyType selectType = KeyListRow::SECRET\_OR\_PUBLIC\_KEY,}
\DoxyCodeLine{176 KeyListColumn::InfoType infoType = KeyListColumn::ALL,}
\DoxyCodeLine{177 \textcolor{keyword}{const} std::function<\textcolor{keywordtype}{bool}(\textcolor{keyword}{const} \mbox{\hyperlink{classGpgFrontend_1_1GpgKey}{GpgKey}}\&)>\& filter =}
\DoxyCodeLine{178 [](\textcolor{keyword}{const} \mbox{\hyperlink{classGpgFrontend_1_1GpgKey}{GpgKey}}\&) -\/> \textcolor{keywordtype}{bool} \{ \textcolor{keywordflow}{return} \textcolor{keyword}{true}; \});}
\DoxyCodeLine{179 }
\DoxyCodeLine{185 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a7d75246eee6368be295c9ab5fe5ef291}{SetDoubleClickedAction}}(}
\DoxyCodeLine{186 std::function<\textcolor{keywordtype}{void}(\textcolor{keyword}{const} \mbox{\hyperlink{classGpgFrontend_1_1GpgKey}{GpgKey}}\&, QWidget*)> action);}
\DoxyCodeLine{187 }
\DoxyCodeLine{194 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_aab3f4facfc850e7eeb917571ca89f4a5}{SetColumnWidth}}(\textcolor{keywordtype}{int} row, \textcolor{keywordtype}{int} size);}
\DoxyCodeLine{195 }
\DoxyCodeLine{201 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_aa961e3ba3c48f84dea4bb7ab4f756886}{AddMenuAction}}(QAction* act);}
\DoxyCodeLine{202 }
\DoxyCodeLine{207 \textcolor{keywordtype}{void} AddSeparator();}
\DoxyCodeLine{208 }
\DoxyCodeLine{214 KeyIdArgsListPtr \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_ac1e5046770c36f67aab34715e50c0a33}{GetChecked}}();}
\DoxyCodeLine{215 }
\DoxyCodeLine{222 \textcolor{keyword}{static} KeyIdArgsListPtr \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_ac1e5046770c36f67aab34715e50c0a33}{GetChecked}}(\textcolor{keyword}{const} \mbox{\hyperlink{structGpgFrontend_1_1UI_1_1KeyTable}{KeyTable}}\& key\_table);}
\DoxyCodeLine{223 }
\DoxyCodeLine{229 KeyIdArgsListPtr \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a81c2e36427371fa6ae6381870b9b5bdd}{GetPrivateChecked}}();}
\DoxyCodeLine{230 }
\DoxyCodeLine{236 KeyIdArgsListPtr \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a7ead8845ceb7c9310e3f4742251e1d87}{GetAllPrivateKeys}}();}
\DoxyCodeLine{237 }
\DoxyCodeLine{243 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a68b595a2bb83dfafa61b3e467dd15689}{SetChecked}}(KeyIdArgsListPtr key\_ids);}
\DoxyCodeLine{244 }
\DoxyCodeLine{251 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a68b595a2bb83dfafa61b3e467dd15689}{SetChecked}}(\textcolor{keyword}{const} KeyIdArgsListPtr\& keyIds,}
\DoxyCodeLine{252 \textcolor{keyword}{const} \mbox{\hyperlink{structGpgFrontend_1_1UI_1_1KeyTable}{KeyTable}}\& key\_table);}
\DoxyCodeLine{253 }
\DoxyCodeLine{259 KeyIdArgsListPtr \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a1bcca32b18c539a2ae83c30fc07db544}{GetSelected}}();}
\DoxyCodeLine{260 }
\DoxyCodeLine{266 std::string \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_ab4368b81402e2468a9e960de8fb7080f}{GetSelectedKey}}();}
\DoxyCodeLine{267 }
\DoxyCodeLine{273 [[maybe\_unused]] \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a31a4c067eed90830203862cb4adf951e}{MarkKeys}}(QStringList* keyIds);}
\DoxyCodeLine{274 }
\DoxyCodeLine{281 [[maybe\_unused]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a20c4a242f49123bd64982952fdad08e9}{ContainsPrivateKeys}}();}
\DoxyCodeLine{282 }
\DoxyCodeLine{283 signals:}
\DoxyCodeLine{290 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a947f4ce45285b58bbde94f4ae879ff7a}{SignalRefreshStatusBar}}(\textcolor{keyword}{const} QString\& message, \textcolor{keywordtype}{int} timeout);}
\DoxyCodeLine{291 }
\DoxyCodeLine{296 \textcolor{keywordtype}{void} SignalRefreshDatabase();}
\DoxyCodeLine{297 }
\DoxyCodeLine{298 \textcolor{keyword}{public} slots:}
\DoxyCodeLine{299 }
\DoxyCodeLine{304 \textcolor{keywordtype}{void} SlotRefresh();}
\DoxyCodeLine{305 }
\DoxyCodeLine{306 \textcolor{keyword}{private}:}
\DoxyCodeLine{311 \textcolor{keywordtype}{void} init();}
\DoxyCodeLine{312 }
\DoxyCodeLine{318 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_ab64ba3049fac1aaa9fed4fb1c5919153}{import\_keys}}(\textcolor{keyword}{const} QByteArray\& inBuffer);}
\DoxyCodeLine{319 }
\DoxyCodeLine{324 \textcolor{keywordtype}{void} uncheck\_all();}
\DoxyCodeLine{325 }
\DoxyCodeLine{330 \textcolor{keywordtype}{void} check\_all();}
\DoxyCodeLine{331 }
\DoxyCodeLine{332 std::mutex buffered\_key\_list\_mutex\_; }
\DoxyCodeLine{333 }
\DoxyCodeLine{334 std::shared\_ptr<Ui\_KeyList> ui\_; }
\DoxyCodeLine{335 QTableWidget* m\_key\_list\_\{\}; }
\DoxyCodeLine{336 std::vector<KeyTable> m\_key\_tables\_; }
\DoxyCodeLine{337 QMenu* popup\_menu\_\{\}; }
\DoxyCodeLine{338 GpgFrontend::KeyLinkListPtr buffered\_keys\_list\_; }
\DoxyCodeLine{339 std::function<void(\textcolor{keyword}{const} \mbox{\hyperlink{classGpgFrontend_1_1GpgKey}{GpgKey}}\&, QWidget*)> m\_action\_ = \textcolor{keyword}{nullptr}; }
\DoxyCodeLine{340 KeyMenuAbility::AbilityType menu\_ability\_ = KeyMenuAbility::ALL; }
\DoxyCodeLine{341 }
\DoxyCodeLine{342 \textcolor{keyword}{private} slots:}
\DoxyCodeLine{343 }
\DoxyCodeLine{349 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a69e54f06d546d516a0dcdf1055b8028e}{slot\_double\_clicked}}(\textcolor{keyword}{const} QModelIndex\& index);}
\DoxyCodeLine{350 }
\DoxyCodeLine{355 \textcolor{keywordtype}{void} slot\_refresh\_ui();}
\DoxyCodeLine{356 }
\DoxyCodeLine{361 \textcolor{keywordtype}{void} slot\_sync\_with\_key\_server();}
\DoxyCodeLine{362 }
\DoxyCodeLine{363 \textcolor{keyword}{protected}:}
\DoxyCodeLine{369 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a82da61a76a08023b2ddbe2a6869f4190}{contextMenuEvent}}(QContextMenuEvent* event) \textcolor{keyword}{override};}
\DoxyCodeLine{370 }
\DoxyCodeLine{376 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_ae3ad87e114432b0d659a0297d520d72f}{dragEnterEvent}}(QDragEnterEvent* event) \textcolor{keyword}{override};}
\DoxyCodeLine{377 }
\DoxyCodeLine{383 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1UI_1_1KeyList_a23ebf79be8de637560d41afd0433c35f}{dropEvent}}(QDropEvent* event) \textcolor{keyword}{override};}
\DoxyCodeLine{384 \};}
\DoxyCodeLine{385 }
\DoxyCodeLine{386 \} \textcolor{comment}{// namespace GpgFrontend::UI}}
\DoxyCodeLine{387 }
\DoxyCodeLine{388 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// \_\_KEYLIST\_H\_\_}}
\end{DoxyCode}