summaryrefslogtreecommitdiff
path: root/plugins/New_GPG
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-06-19 18:36:43 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-06-19 18:36:43 +0300
commit4a35a5a5e1f1c8aa25d9d017901a88ced0db9ba2 (patch)
treeda0110e410f8801bda685e63214823d66ad2749e /plugins/New_GPG
parent855b21f95ed509e16892fa51cca9bdebe9044047 (diff)
New_GPG: UI code cleaning
Diffstat (limited to 'plugins/New_GPG')
-rwxr-xr-xplugins/New_GPG/src/ui.cpp323
-rwxr-xr-xplugins/New_GPG/src/ui.h127
2 files changed, 190 insertions, 260 deletions
diff --git a/plugins/New_GPG/src/ui.cpp b/plugins/New_GPG/src/ui.cpp
index fffc8faec8..06e81ce88e 100755
--- a/plugins/New_GPG/src/ui.cpp
+++ b/plugins/New_GPG/src/ui.cpp
@@ -59,14 +59,10 @@ void CDlgEncryptedFileMsgBox::onClick_DECRYPT(CCtrlButton*)
CDlgExportKeysMsgBox::CDlgExportKeysMsgBox() :
CDlgBase(g_plugin, IDD_EXPORT_TYPE),
- btn_OK(this, IDC_OK),
- btn_CANCEL(this, IDC_CANCEL),
chk_PUBLIC(this, IDC_PUBLIC),
chk_PRIVATE(this, IDC_PRIVATE),
chk_ALL(this, IDC_ALL)
{
- btn_OK.OnClick = Callback(this, &CDlgExportKeysMsgBox::onClick_OK);
- btn_CANCEL.OnClick = Callback(this, &CDlgExportKeysMsgBox::onClick_CANCEL);
}
bool CDlgExportKeysMsgBox::OnInitDialog()
@@ -75,7 +71,7 @@ bool CDlgExportKeysMsgBox::OnInitDialog()
return true;
}
-void CDlgExportKeysMsgBox::onClick_OK(CCtrlButton*)
+bool CDlgExportKeysMsgBox::OnApply()
{
if (chk_PUBLIC.GetState())
ExportGpGKeysFunc(0);
@@ -83,31 +79,25 @@ void CDlgExportKeysMsgBox::onClick_OK(CCtrlButton*)
ExportGpGKeysFunc(1);
else if (chk_ALL.GetState())
ExportGpGKeysFunc(2);
- this->Close();
-}
-void CDlgExportKeysMsgBox::onClick_CANCEL(CCtrlButton*)
-{
- this->Close();
+ return true;
}
/////////////////////////////////////////////////////////////////////////////////////////
CDlgChangePasswdMsgBox::CDlgChangePasswdMsgBox() :
CDlgBase(g_plugin, IDD_CHANGE_PASSWD),
- btn_OK(this, ID_OK),
edit_NEW_PASSWD1(this, IDC_NEW_PASSWD1),
edit_NEW_PASSWD2(this, IDC_NEW_PASSWD2),
edit_OLD_PASSWD(this, IDC_OLD_PASSWD)
{
- btn_OK.OnClick = Callback(this, &CDlgChangePasswdMsgBox::onClick_OK);
}
-void CDlgChangePasswdMsgBox::onClick_OK(CCtrlButton*)
+bool CDlgChangePasswdMsgBox::OnApply()
{
//TODO: show some prgress
if (mir_wstrcmp(edit_NEW_PASSWD1.GetText(), edit_NEW_PASSWD2.GetText())) {
MessageBox(m_hwnd, TranslateT("New passwords do not match"), TranslateT("Error"), MB_OK);
- return;
+ return false;
}
std::string old_pass, new_pass;
// wchar_t buf[256] = { 0 };
@@ -133,7 +123,7 @@ void CDlgChangePasswdMsgBox::onClick_OK(CCtrlButton*)
if (!old_pass_match)
if (MessageBox(m_hwnd, TranslateT("Old password does not match, you can continue, but GPG will reject wrong password.\nDo you want to continue?"), TranslateT("Error"), MB_YESNO) == IDNO)
- return;
+ return false;
string output;
DWORD exitcode;
@@ -155,12 +145,10 @@ void CDlgChangePasswdMsgBox::onClick_OK(CCtrlButton*)
boost::process::terminate(*(params->child));
if (globals.bDebugLog)
globals.debuglog << std::string(time_str() + ": GPG execution timed out, aborted");
- this->Close();
- return;
+ return true;
}
- if (result != pxNotFound)
- this->Close();
+ return (result != pxNotFound);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -994,11 +982,8 @@ CDlgKeyGen::CDlgKeyGen() :
edit_KEY_EMAIL(this, IDC_KEY_EMAIL),
edit_KEY_COMMENT(this, IDC_KEY_COMMENT),
edit_KEY_EXPIRE_DATE(this, IDC_KEY_EXPIRE_DATE),
- lbl_GENERATING_TEXT(this, IDC_GENERATING_TEXT),
- btn_OK(this, IDOK), btn_CANCEL(this, IDCANCEL)
+ lbl_GENERATING_TEXT(this, IDC_GENERATING_TEXT)
{
- btn_OK.OnClick = Callback(this, &CDlgKeyGen::onClick_OK);
- btn_CANCEL.OnClick = Callback(this, &CDlgKeyGen::onClick_CANCEL);
}
bool CDlgKeyGen::OnInitDialog()
@@ -1013,163 +998,124 @@ bool CDlgKeyGen::OnInitDialog()
return true;
}
-void CDlgKeyGen::onClick_OK(CCtrlButton*)
+bool CDlgKeyGen::OnApply()
{
- {
- wstring path;
- { //data sanity checks
- wchar_t *tmp = mir_wstrdup(combo_KEY_TYPE.GetText());
- if (!tmp) {
- MessageBox(nullptr, TranslateT("You must set encryption algorithm first"), TranslateT("Error"), MB_OK);
- return;
- }
- if (mir_wstrlen(tmp) < 3) {
- mir_free(tmp);
- tmp = nullptr;
- MessageBox(nullptr, TranslateT("You must set encryption algorithm first"), TranslateT("Error"), MB_OK);
- return;
- }
- mir_free(tmp);
- tmp = mir_wstrdup(edit_KEY_LENGTH.GetText());
- if (!tmp) {
- MessageBox(nullptr, TranslateT("Key length must be of length from 1024 to 4096 bits"), TranslateT("Error"), MB_OK);
- return;
- }
- int length = _wtoi(tmp);
- mir_free(tmp);
- if (length < 1024 || length > 4096) {
- MessageBox(nullptr, TranslateT("Key length must be of length from 1024 to 4096 bits"), TranslateT("Error"), MB_OK);
- return;
- }
- tmp = mir_wstrdup(edit_KEY_EXPIRE_DATE.GetText());
- if (!tmp) {
- MessageBox(nullptr, TranslateT("Invalid date"), TranslateT("Error"), MB_OK);
- return;
- }
- if (mir_wstrlen(tmp) != 10 && tmp[0] != '0') {
- MessageBox(nullptr, TranslateT("Invalid date"), TranslateT("Error"), MB_OK);
- mir_free(tmp);
- return;
- }
- mir_free(tmp);
- tmp = mir_wstrdup(edit_KEY_REAL_NAME.GetText());
- if (!tmp) {
- MessageBox(nullptr, TranslateT("Name must contain at least 5 characters"), TranslateT("Error"), MB_OK);
- return;
- }
- if (mir_wstrlen(tmp) < 5) {
- MessageBox(nullptr, TranslateT("Name must contain at least 5 characters"), TranslateT("Error"), MB_OK);
- mir_free(tmp);
- return;
- }
- else if (wcschr(tmp, '(') || wcschr(tmp, ')')) {
- MessageBox(nullptr, TranslateT("Name cannot contain '(' or ')'"), TranslateT("Error"), MB_OK);
- mir_free(tmp);
- return;
- }
- mir_free(tmp);
- tmp = mir_wstrdup(edit_KEY_EMAIL.GetText());
- if (!tmp) {
- MessageBox(nullptr, TranslateT("Invalid Email"), TranslateT("Error"), MB_OK);
- return;
- }
- if ((mir_wstrlen(tmp)) < 5 || (!wcschr(tmp, '@')) || (!wcschr(tmp, '.'))) {
- MessageBox(nullptr, TranslateT("Invalid Email"), TranslateT("Error"), MB_OK);
- mir_free(tmp);
- return;
- }
- mir_free(tmp);
- }
- { //generating key file
- wchar_t *tmp = db_get_wsa(0, MODULENAME, "szHomePath", L"");
- char *tmp2;// = mir_u2a(tmp);
- path = tmp;
- mir_free(tmp);
- // mir_free(tmp2);
- path.append(L"\\new_key");
- wfstream f(path.c_str(), std::ios::out);
- if (!f.is_open()) {
- MessageBox(nullptr, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK);
- return;
- }
- f << "Key-Type: ";
- tmp2 = mir_u2a(combo_KEY_TYPE.GetText());
- char *subkeytype = (char*)mir_alloc(6);
- if (strstr(tmp2, "RSA"))
- mir_strcpy(subkeytype, "RSA");
- else if (strstr(tmp2, "DSA")) //this is useless check for now, but it will be required if someone add another key types support
- mir_strcpy(subkeytype, "ELG-E");
- f << tmp2;
- mir_free(tmp2);
- f << "\n";
- f << "Key-Length: ";
- f << _wtoi(edit_KEY_LENGTH.GetText());
- f << "\n";
- f << "Subkey-Length: ";
- f << _wtoi(edit_KEY_LENGTH.GetText());
- f << "\n";
- f << "Subkey-Type: ";
- f << subkeytype;
- mir_free(subkeytype);
- f << "\n";
- if (edit_KEY_PASSWD.GetText()[0]) {
- f << "Passphrase: ";
- f << toUTF8(edit_KEY_PASSWD.GetText()).c_str();
- f << "\n";
- }
- f << "Name-Real: ";
- f << toUTF8(edit_KEY_REAL_NAME.GetText()).c_str();
- f << "\n";
- if (edit_KEY_COMMENT.GetText()[0]) {
- f << "Name-Comment: ";
- f << toUTF8(edit_KEY_COMMENT.GetText()).c_str();
- f << "\n";
- }
- f << "Name-Email: ";
- f << toUTF8(edit_KEY_EMAIL.GetText()).c_str();
- f << "\n";
- f << "Expire-Date: ";
- f << toUTF8(edit_KEY_EXPIRE_DATE.GetText()).c_str();
- f << "\n";
- f.close();
- }
- { //gpg execution
- DWORD code;
- string out;
- std::vector<wstring> cmd;
- cmd.push_back(L"--batch");
- cmd.push_back(L"--yes");
- cmd.push_back(L"--gen-key");
- cmd.push_back(path);
- gpg_execution_params params(cmd);
- pxResult result;
- params.out = &out;
- params.code = &code;
- params.result = &result;
- lbl_GENERATING_TEXT.SendMsg(WM_SETFONT, (WPARAM)globals.bold_font, TRUE);
- lbl_GENERATING_TEXT.SetText(TranslateT("Generating new key, please wait..."));
- btn_CANCEL.Disable();
- btn_OK.Disable();
- combo_KEY_TYPE.Disable();
- edit_KEY_LENGTH.Disable();
- edit_KEY_PASSWD.Disable();
- edit_KEY_REAL_NAME.Disable();
- edit_KEY_EMAIL.Disable();
- edit_KEY_COMMENT.Disable();
- edit_KEY_EXPIRE_DATE.Disable();
- if (!gpg_launcher(params, boost::posix_time::minutes(10)))
- return;
- if (result == pxNotFound)
- return;
- }
- boost::filesystem::remove(path);
+ // data sanity checks
+ ptrW tmp(combo_KEY_TYPE.GetText());
+ if (mir_wstrlen(tmp) < 3) {
+ MessageBox(nullptr, TranslateT("You must set encryption algorithm first"), TranslateT("Error"), MB_OK);
+ return false;
}
- this->Close();
-}
-void CDlgKeyGen::onClick_CANCEL(CCtrlButton*)
-{
- this->Close();
+ tmp = edit_KEY_LENGTH.GetText();
+ int length = _wtoi(tmp);
+ if (length < 1024 || length > 4096) {
+ MessageBox(nullptr, TranslateT("Key length must be of length from 1024 to 4096 bits"), TranslateT("Error"), MB_OK);
+ return false;
+ }
+
+ tmp = edit_KEY_EXPIRE_DATE.GetText();
+ if (mir_wstrlen(tmp) != 10 && tmp[0] != '0') {
+ MessageBox(nullptr, TranslateT("Invalid date"), TranslateT("Error"), MB_OK);
+ return false;
+ }
+
+ tmp = edit_KEY_REAL_NAME.GetText();
+ if (mir_wstrlen(tmp) < 5) {
+ MessageBox(nullptr, TranslateT("Name must contain at least 5 characters"), TranslateT("Error"), MB_OK);
+ return false;
+ }
+ if (wcschr(tmp, '(') || wcschr(tmp, ')')) {
+ MessageBox(nullptr, TranslateT("Name cannot contain '(' or ')'"), TranslateT("Error"), MB_OK);
+ return false;
+ }
+
+ tmp = edit_KEY_EMAIL.GetText();
+ if ((mir_wstrlen(tmp)) < 5 || (!wcschr(tmp, '@')) || (!wcschr(tmp, '.'))) {
+ MessageBox(nullptr, TranslateT("Invalid Email"), TranslateT("Error"), MB_OK);
+ return false;
+ }
+
+ // generating key file
+ wstring path = ptrW(db_get_wsa(0, MODULENAME, "szHomePath", L""));
+
+ path.append(L"\\new_key");
+ wfstream f(path.c_str(), std::ios::out);
+ if (!f.is_open()) {
+ MessageBox(nullptr, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK);
+ return false;
+ }
+
+ f << "Key-Type: ";
+ char *tmp2 = mir_u2a(combo_KEY_TYPE.GetText());
+ char *subkeytype = (char*)mir_alloc(6);
+ if (strstr(tmp2, "RSA"))
+ mir_strcpy(subkeytype, "RSA");
+ else if (strstr(tmp2, "DSA")) //this is useless check for now, but it will be required if someone add another key types support
+ mir_strcpy(subkeytype, "ELG-E");
+ f << tmp2;
+ mir_free(tmp2);
+ f << "\n";
+ f << "Key-Length: ";
+ f << _wtoi(edit_KEY_LENGTH.GetText());
+ f << "\n";
+ f << "Subkey-Length: ";
+ f << _wtoi(edit_KEY_LENGTH.GetText());
+ f << "\n";
+ f << "Subkey-Type: ";
+ f << subkeytype;
+ mir_free(subkeytype);
+ f << "\n";
+ if (edit_KEY_PASSWD.GetText()[0]) {
+ f << "Passphrase: ";
+ f << toUTF8(edit_KEY_PASSWD.GetText()).c_str();
+ f << "\n";
+ }
+ f << "Name-Real: ";
+ f << toUTF8(edit_KEY_REAL_NAME.GetText()).c_str();
+ f << "\n";
+ if (edit_KEY_COMMENT.GetText()[0]) {
+ f << "Name-Comment: ";
+ f << toUTF8(edit_KEY_COMMENT.GetText()).c_str();
+ f << "\n";
+ }
+ f << "Name-Email: ";
+ f << toUTF8(edit_KEY_EMAIL.GetText()).c_str();
+ f << "\n";
+ f << "Expire-Date: ";
+ f << toUTF8(edit_KEY_EXPIRE_DATE.GetText()).c_str();
+ f << "\n";
+ f.close();
+
+ // gpg execution
+ DWORD code;
+ string out;
+ std::vector<wstring> cmd;
+ cmd.push_back(L"--batch");
+ cmd.push_back(L"--yes");
+ cmd.push_back(L"--gen-key");
+ cmd.push_back(path);
+ gpg_execution_params params(cmd);
+ pxResult result;
+ params.out = &out;
+ params.code = &code;
+ params.result = &result;
+ lbl_GENERATING_TEXT.SendMsg(WM_SETFONT, (WPARAM)globals.bold_font, TRUE);
+ lbl_GENERATING_TEXT.SetText(TranslateT("Generating new key, please wait..."));
+ combo_KEY_TYPE.Disable();
+ edit_KEY_LENGTH.Disable();
+ edit_KEY_PASSWD.Disable();
+ edit_KEY_REAL_NAME.Disable();
+ edit_KEY_EMAIL.Disable();
+ edit_KEY_COMMENT.Disable();
+ edit_KEY_EXPIRE_DATE.Disable();
+ if (!gpg_launcher(params, boost::posix_time::minutes(10)))
+ return false;
+ if (result == pxNotFound)
+ return false;
+
+ boost::filesystem::remove(path);
+ return true;
}
void CDlgKeyGen::OnDestroy()
@@ -1183,14 +1129,9 @@ void CDlgKeyGen::OnDestroy()
CDlgLoadExistingKey::CDlgLoadExistingKey() :
CDlgBase(g_plugin, IDD_LOAD_EXISTING_KEY),
- btn_OK(this, IDOK),
- btn_CANCEL(this, IDCANCEL),
list_EXISTING_KEY_LIST(this, IDC_EXISTING_KEY_LIST)
{
id[0] = 0;
- btn_OK.OnClick = Callback(this, &CDlgLoadExistingKey::onClick_OK);
- btn_CANCEL.OnClick = Callback(this, &CDlgLoadExistingKey::onClick_CANCEL);
-
}
bool CDlgLoadExistingKey::OnInitDialog()
@@ -1302,11 +1243,11 @@ void CDlgLoadExistingKey::OnDestroy()
g_plugin.setDword("LoadExistingKeyWindowY", globals.load_existing_key_rect.top);
}
-void CDlgLoadExistingKey::onClick_OK(CCtrlButton*)
+bool CDlgLoadExistingKey::OnApply()
{
int i = list_EXISTING_KEY_LIST.GetSelectionMark();
if (i == -1)
- return; //TODO: error message
+ return false; //TODO: error message
list_EXISTING_KEY_LIST.GetItemText(i, 0, id, _countof(id));
extern CCtrlEdit *edit_p_PubKeyEdit;
@@ -1323,9 +1264,9 @@ void CDlgLoadExistingKey::onClick_OK(CCtrlButton*)
params.code = &code;
params.result = &result;
if (!gpg_launcher(params))
- return;
+ return false;
if (result == pxNotFound)
- return;
+ return false;
string::size_type s = 0;
while ((s = out.find("\r", s)) != string::npos) {
out.erase(s, 1);
@@ -1347,17 +1288,11 @@ void CDlgLoadExistingKey::onClick_OK(CCtrlButton*)
}
else MessageBox(nullptr, TranslateT("Failed to export public key."), TranslateT("Error"), MB_OK);
- this->Close();
-}
-void CDlgLoadExistingKey::onClick_CANCEL(CCtrlButton*)
-{
- this->Close();
+ return true;
}
-void CDlgLoadExistingKey::onChange_EXISTING_KEY_LIST(CCtrlListView::TEventInfo * /*ev*/) //TODO: check if this work
+void CDlgLoadExistingKey::onChange_EXISTING_KEY_LIST(CCtrlListView::TEventInfo * /*ev*/)
{
- if (list_EXISTING_KEY_LIST.GetSelectionMark() != -1)
- btn_OK.Enable();
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/New_GPG/src/ui.h b/plugins/New_GPG/src/ui.h
index 22b57024c4..0390301252 100755
--- a/plugins/New_GPG/src/ui.h
+++ b/plugins/New_GPG/src/ui.h
@@ -17,49 +17,55 @@
#ifndef UI_H
#define UI_H
-
class CDlgEncryptedFileMsgBox : public CDlgBase
{
+ CCtrlCheck chk_REMEMBER;
+ CCtrlButton btn_IGNORE, btn_DECRYPT;
+
public:
CDlgEncryptedFileMsgBox();
bool OnInitDialog() override;
+
void onClick_IGNORE(CCtrlButton*);
void onClick_DECRYPT(CCtrlButton*);
-
-private:
- CCtrlCheck chk_REMEMBER;
- CCtrlButton btn_IGNORE, btn_DECRYPT;
};
class CDlgExportKeysMsgBox : public CDlgBase
{
+ CCtrlCheck chk_PUBLIC, chk_PRIVATE, chk_ALL;
+
public:
CDlgExportKeysMsgBox();
- bool OnInitDialog() override;
- void onClick_OK(CCtrlButton*);
- void onClick_CANCEL(CCtrlButton*);
-private:
- CCtrlButton btn_OK, btn_CANCEL;
- CCtrlCheck chk_PUBLIC, chk_PRIVATE, chk_ALL;
+ bool OnInitDialog() override;
+ bool OnApply() override;
};
class CDlgChangePasswdMsgBox : public CDlgBase //always modal
{
+ CCtrlEdit edit_NEW_PASSWD1, edit_NEW_PASSWD2, edit_OLD_PASSWD;
+
public:
CDlgChangePasswdMsgBox();
- void onClick_OK(CCtrlButton*);
-private:
- CCtrlButton btn_OK;
- CCtrlEdit edit_NEW_PASSWD1, edit_NEW_PASSWD2, edit_OLD_PASSWD;
+
+ bool OnApply() override;
};
class CDlgFirstRun : public CDlgBase
{
+ void refresh_key_list();
+ CCtrlListView list_KEY_LIST;
+ CCtrlButton btn_COPY_PUBKEY, btn_EXPORT_PRIVATE, btn_CHANGE_PASSWD, btn_GENERATE_RANDOM, btn_GENERATE_KEY, btn_OTHER, btn_DELETE_KEY, btn_OK;
+ CCtrlEdit edit_KEY_PASSWORD;
+ CCtrlCombo combo_ACCOUNT;
+ CCtrlData lbl_KEY_ID, lbl_GENERATING_KEY;
+ wchar_t fp[16];
+
public:
CDlgFirstRun();
-
bool OnInitDialog() override;
+ void OnDestroy() override;
+
void onClick_COPY_PUBKEY(CCtrlButton*);
void onClick_EXPORT_PRIVATE(CCtrlButton*);
void onClick_CHANGE_PASSWD(CCtrlButton*);
@@ -70,111 +76,100 @@ public:
void onClick_OK(CCtrlButton*);
void onChange_ACCOUNT(CCtrlCombo*);
void onChange_KEY_LIST(CCtrlListView::TEventInfo *ev);
- virtual void OnDestroy() override;
-
-private:
- void refresh_key_list();
- CCtrlListView list_KEY_LIST;
- CCtrlButton btn_COPY_PUBKEY, btn_EXPORT_PRIVATE, btn_CHANGE_PASSWD, btn_GENERATE_RANDOM, btn_GENERATE_KEY, btn_OTHER, btn_DELETE_KEY, btn_OK;
- CCtrlEdit edit_KEY_PASSWORD;
- CCtrlCombo combo_ACCOUNT;
- CCtrlData lbl_KEY_ID, lbl_GENERATING_KEY;
- wchar_t fp[16];
};
class CDlgGpgBinOpts : public CDlgBase
{
+ CCtrlButton btn_SET_BIN_PATH, btn_SET_HOME_DIR, btn_OK, btn_GENERATE_RANDOM;
+ CCtrlEdit edit_BIN_PATH, edit_HOME_DIR;
+ CCtrlCheck chk_AUTO_EXCHANGE;
+
public:
CDlgGpgBinOpts();
bool OnInitDialog() override;
+ void OnDestroy() override;
+
void onClick_SET_BIN_PATH(CCtrlButton*);
void onClick_SET_HOME_DIR(CCtrlButton*);
void onClick_OK(CCtrlButton*);
void onClick_GENERATE_RANDOM(CCtrlButton*);
- virtual void OnDestroy() override;
-private:
- CCtrlButton btn_SET_BIN_PATH, btn_SET_HOME_DIR, btn_OK, btn_GENERATE_RANDOM;
- CCtrlEdit edit_BIN_PATH, edit_HOME_DIR;
- CCtrlCheck chk_AUTO_EXCHANGE;
};
class CDlgNewKey : public CDlgBase
{
+ wstring new_key;
+ MCONTACT hContact;
+ CCtrlData lbl_KEY_FROM, lbl_MESSAGE;
+ CCtrlButton btn_IMPORT, btn_IMPORT_AND_USE, btn_IGNORE_KEY;
+
public:
CDlgNewKey(MCONTACT hContact, wstring new_key);
bool OnInitDialog() override;
- virtual void OnDestroy() override;
+ void OnDestroy() override;
+
void onClick_IMPORT(CCtrlButton*);
void onClick_IMPORT_AND_USE(CCtrlButton*);
void onClick_IGNORE_KEY(CCtrlButton*);
-private:
- wstring new_key;
- MCONTACT hContact;
- CCtrlData lbl_KEY_FROM, lbl_MESSAGE;
- CCtrlButton btn_IMPORT, btn_IMPORT_AND_USE, btn_IGNORE_KEY;
};
class CDlgKeyGen : public CDlgBase //TODO: in modal mode window destroying on any button press even without direct "Close" call
{
-public:
- CDlgKeyGen();
- bool OnInitDialog() override;
-
- void onClick_OK(CCtrlButton*);
- void onClick_CANCEL(CCtrlButton*);
- virtual void OnDestroy() override;
-
-private:
CCtrlCombo combo_KEY_TYPE;
CCtrlEdit edit_KEY_LENGTH, edit_KEY_PASSWD, edit_KEY_REAL_NAME, edit_KEY_EMAIL, edit_KEY_COMMENT, edit_KEY_EXPIRE_DATE;
CCtrlData lbl_GENERATING_TEXT;
- CCtrlButton btn_OK, btn_CANCEL;
+public:
+ CDlgKeyGen();
+
+ bool OnInitDialog() override;
+ bool OnApply() override;
+ void OnDestroy() override;
};
class CDlgLoadExistingKey : public CDlgBase
{
+ wchar_t id[16];
+ CCtrlListView list_EXISTING_KEY_LIST;
+
public:
CDlgLoadExistingKey();
bool OnInitDialog() override;
- virtual void OnDestroy() override;
- void onClick_OK(CCtrlButton*);
- void onClick_CANCEL(CCtrlButton*);
+ bool OnApply() override;
+ void OnDestroy() override;
+
void onChange_EXISTING_KEY_LIST(CCtrlListView::TEventInfo * /*ev*/);
-private:
- wchar_t id[16];
- CCtrlButton btn_OK, btn_CANCEL;
- CCtrlListView list_EXISTING_KEY_LIST;
};
class CDlgImportKey : public CDlgBase
{
+ MCONTACT hContact;
+ CCtrlCombo combo_KEYSERVER;
+ CCtrlButton btn_IMPORT;
+
public:
CDlgImportKey(MCONTACT hContact);
bool OnInitDialog() override;
- virtual void OnDestroy() override;
+ void OnDestroy() override;
+
void onClick_IMPORT(CCtrlButton*);
-private:
- MCONTACT hContact;
- CCtrlCombo combo_KEYSERVER;
- CCtrlButton btn_IMPORT;
};
class CDlgKeyPasswordMsgBox : public CDlgBase //always modal
{
-public:
- CDlgKeyPasswordMsgBox(MCONTACT _hContact);
- bool OnInitDialog() override;
- virtual void OnDestroy() override;
- void onClick_OK(CCtrlButton*);
- void onClick_CANCEL(CCtrlButton*);
-private:
char *inkeyid = nullptr;
MCONTACT hContact;
CCtrlData lbl_KEYID;
CCtrlEdit edit_KEY_PASSWORD;
CCtrlCheck chk_DEFAULT_PASSWORD, chk_SAVE_PASSWORD;
CCtrlButton btn_OK, btn_CANCEL;
+
+public:
+ CDlgKeyPasswordMsgBox(MCONTACT _hContact);
+ bool OnInitDialog() override;
+ void OnDestroy() override;
+
+ void onClick_OK(CCtrlButton*);
+ void onClick_CANCEL(CCtrlButton*);
};
#endif // UI_H \ No newline at end of file