summaryrefslogtreecommitdiff
path: root/plugins/WebView/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-29 23:41:17 +0200
committerGeorge Hazan <ghazan@miranda.im>2018-04-29 23:41:17 +0200
commit0388e4a5e99d7f38718ac17c4d3e3565d1e2d559 (patch)
tree815f27c0ed0ff776f2002c92e10b59cc5d4d7f89 /plugins/WebView/src
parent66913f4be6078f89ef87fbbc5dd3497c6dde51c2 (diff)
fixes #1307 (horror in webview contact settings)
Diffstat (limited to 'plugins/WebView/src')
-rw-r--r--plugins/WebView/src/version.h2
-rw-r--r--plugins/WebView/src/webview.cpp21
-rw-r--r--plugins/WebView/src/webview.h1
-rw-r--r--plugins/WebView/src/webview_datawnd.cpp18
-rw-r--r--plugins/WebView/src/webview_opts.cpp56
5 files changed, 17 insertions, 81 deletions
diff --git a/plugins/WebView/src/version.h b/plugins/WebView/src/version.h
index bd26cbb97e..3b5eaf7336 100644
--- a/plugins/WebView/src/version.h
+++ b/plugins/WebView/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 3
-#define __BUILD_NUM 0
+#define __BUILD_NUM 1
#include <stdver.h>
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp
index 1206e4774f..3359fe2cdf 100644
--- a/plugins/WebView/src/webview.cpp
+++ b/plugins/WebView/src/webview.cpp
@@ -37,7 +37,6 @@ UINT_PTR timerId;
UINT_PTR Countdown;
LOGFONT g_lf;
HFONT h_font;
-HWND ContactHwnd;
HMENU hMenu;
int bpStatus;
HGENMENU hMenuItem1;
@@ -467,30 +466,14 @@ int ContactMenuItemUpdateData(WPARAM wParam, LPARAM lParam)
/*****************************************************************************/
INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM)
{
- HWND hwndDlg = WindowList_Find(hWindowList, wParam);
- if (hwndDlg) {
- DestroyWindow(hwndDlg);
- return 0;
- }
-
- hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTACT_OPT), nullptr, DlgProcContactOpt, (LPARAM)wParam);
- ShowWindow(hwndDlg, SW_SHOW);
- SetActiveWindow(hwndDlg);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTACT_OPT), nullptr, DlgProcContactOpt, wParam);
return 0;
}
/*****************************************************************************/
INT_PTR CntAlertMenuCommand(WPARAM wParam, LPARAM)
{
- HWND hwndDlg = WindowList_Find(hWindowList, (MCONTACT)wParam);
- if (hwndDlg) {
- DestroyWindow(hwndDlg);
- return 0;
- }
-
- hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ALRT_OPT), nullptr, DlgProcAlertOpt, (LPARAM)wParam);
- ShowWindow(hwndDlg, SW_SHOW);
- SetActiveWindow(hwndDlg);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ALRT_OPT), nullptr, DlgProcAlertOpt, wParam);
return 0;
}
diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h
index 2f8304f051..eb6ffbf572 100644
--- a/plugins/WebView/src/webview.h
+++ b/plugins/WebView/src/webview.h
@@ -142,7 +142,6 @@ extern COLORREF BackgoundClr, TextClr;
extern UINT_PTR timerId, Countdown;
extern LOGFONT g_lf;
extern HFONT h_font;
-extern HWND ContactHwnd;
extern HMENU hMenu;
extern int bpStatus;
extern HNETLIBUSER hNetlibUser;
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp
index f4159e24f3..19b600d481 100644
--- a/plugins/WebView/src/webview_datawnd.cpp
+++ b/plugins/WebView/src/webview_datawnd.cpp
@@ -383,23 +383,13 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
break;
case IDC_OPTIONS_BUTTON:
- if (hContact = FindContactByUrl(hwndDlg)) {
- ContactHwnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTACT_OPT), hwndDlg, DlgProcContactOpt, (LPARAM) hContact);
- ShowWindow(ContactHwnd, SW_SHOW);
- SetActiveWindow(ContactHwnd);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTIONS_BUTTON), 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_BUTTON), 0);
- }
+ if (hContact = FindContactByUrl(hwndDlg))
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTACT_OPT), hwndDlg, DlgProcContactOpt, hContact);
break;
case IDC_ALERT_BUTTON:
- if (hContact = FindContactByUrl(hwndDlg)) {
- HWND hwndAlertOpt = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ALRT_OPT), hwndDlg, DlgProcAlertOpt, (LPARAM) hContact);
- ShowWindow(hwndAlertOpt, SW_SHOW);
- SetActiveWindow(hwndAlertOpt);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_BUTTON), 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTIONS_BUTTON), 0);
- }
+ if (hContact = FindContactByUrl(hwndDlg))
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ALRT_OPT), hwndDlg, DlgProcAlertOpt, hContact);
break;
case IDOK:
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp
index 7cbcebb0c0..81095011ee 100644
--- a/plugins/WebView/src/webview_opts.cpp
+++ b/plugins/WebView/src/webview_opts.cpp
@@ -698,7 +698,6 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case IDC_OK2:
{
hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- wchar_t buf[MAX_PATH];
eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0);
alertIndex = db_get_b(hContact, MODULENAME, ALRT_INDEX_KEY, 0);
@@ -745,6 +744,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
break;
}
+ wchar_t buf[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_FILENAME, buf, _countof(buf));
db_set_ws(hContact, MODULENAME, FILE_KEY, buf);
@@ -764,32 +764,15 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_APPLY), 0);
- if (LOWORD(wParam) == IDC_OK2) {
- EnableWindow(GetDlgItem(ParentHwnd, IDC_ALERT_BUTTON), 1);
- EnableWindow(GetDlgItem(ParentHwnd, IDC_OPTIONS_BUTTON), 1);
- WindowList_Remove(hWindowList, hwndDlg);
- DestroyWindow(hwndDlg);
- }
+ if (LOWORD(wParam) == IDC_OK2)
+ EndDialog(hwndDlg, 1);
}
- }
- break;
+ break;
- case IDC_ALERT_CANCEL:
- EnableWindow(GetDlgItem(ParentHwnd, IDC_ALERT_BUTTON), 1);
- EnableWindow(GetDlgItem(ParentHwnd, IDC_OPTIONS_BUTTON), 1);
- WindowList_Remove(hWindowList, hwndDlg);
- if (hwndDlg) {
- DestroyWindow(hwndDlg);
- hwndDlg = nullptr;
+ case IDC_ALERT_CANCEL:
+ case IDC_CANCEL:
+ EndDialog(hwndDlg, 0);
}
- break;
-
- case WM_DESTROY:
- case IDC_CANCEL:
- EnableWindow(GetDlgItem(ParentHwnd, IDC_ALERT_BUTTON), 1);
- EnableWindow(GetDlgItem(ParentHwnd, IDC_OPTIONS_BUTTON), 1);
- WindowList_Remove(hWindowList, hwndDlg);
- DestroyWindow(hwndDlg);
}
return FALSE;
}
@@ -815,7 +798,6 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
test2 = 0;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hContact);
- WindowList_Add(hWindowList, hwndDlg, hContact);
SetWindowText(hwndDlg, TranslateT("Contact options"));
@@ -1036,33 +1018,15 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SetWindowText(ParentHwnd, str);
EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_APPLY), 0);
- if (LOWORD(wParam) == IDOK) {
- EnableWindow(GetDlgItem(ParentHwnd, IDC_OPTIONS_BUTTON), 1);
- EnableWindow(GetDlgItem(ParentHwnd, IDC_ALERT_BUTTON), 1);
- if (hwndDlg) {
- DestroyWindow(hwndDlg);
- hwndDlg = nullptr;
- }
- }
+ if (LOWORD(wParam) == IDOK)
+ EndDialog(hwndDlg, 1);
}
break;
case IDC_OPT_CANCEL:
- EnableWindow(GetDlgItem(ParentHwnd, IDC_OPTIONS_BUTTON), 1);
- EnableWindow(GetDlgItem(ParentHwnd, IDC_ALERT_BUTTON), 1);
- WindowList_Remove(hWindowList, hwndDlg);
- if (hwndDlg) {
- DestroyWindow(hwndDlg);
- hwndDlg = nullptr;
- }
+ EndDialog(hwndDlg, 0);
}
break;
-
- case WM_DESTROY:
- EnableWindow(GetDlgItem(ParentHwnd, IDC_OPTIONS_BUTTON), 1);
- EnableWindow(GetDlgItem(ParentHwnd, IDC_ALERT_BUTTON), 1);
- WindowList_Remove(hWindowList, hwndDlg);
- DestroyWindow(hwndDlg);
}
return FALSE;
}