summaryrefslogtreecommitdiff
path: root/plugins/StatusManager/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-09-04 22:38:13 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-09-04 22:38:18 +0300
commit79cb42be4c83876c9e3ca8072a6deea8665733a7 (patch)
tree9cd9c7e3f29f4f95b968ab46aa9edc349a0b4801 /plugins/StatusManager/src
parent9f5901ce26fd728ef007286103f45baef77e0565 (diff)
fixes #2559 (PluginUpdater: "Restart Miranda automatically" doesn't work with StartupStatus (StatusManager) Plugin Updater)
Diffstat (limited to 'plugins/StatusManager/src')
-rw-r--r--plugins/StatusManager/src/commonstatus.h1
-rw-r--r--plugins/StatusManager/src/confirmdialog.cpp34
-rw-r--r--plugins/StatusManager/src/ss_main.cpp1
3 files changed, 22 insertions, 14 deletions
diff --git a/plugins/StatusManager/src/commonstatus.h b/plugins/StatusManager/src/commonstatus.h
index 5aafe73be4..fd1117902e 100644
--- a/plugins/StatusManager/src/commonstatus.h
+++ b/plugins/StatusManager/src/commonstatus.h
@@ -126,6 +126,7 @@ extern TProtoSettings protoList;
int CompareProtoSettings(const SMProto *p1, const SMProto *p2);
HWND ShowConfirmDialogEx(TProtoSettings *params, int _timeout);
+void ShutdownConfirmDialog(void);
int SetStatusEx(TProtoSettings &ps);
diff --git a/plugins/StatusManager/src/confirmdialog.cpp b/plugins/StatusManager/src/confirmdialog.cpp
index 2d8a275673..5ef6a719a3 100644
--- a/plugins/StatusManager/src/confirmdialog.cpp
+++ b/plugins/StatusManager/src/confirmdialog.cpp
@@ -24,14 +24,14 @@
#define TIMER_ID 1
// variables
-static HWND win;
+static HWND hwndConfirm;
static int timeOut;
static TProtoSettings *confirmSettings;
static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- static PROTOCOLSETTINGEX* protoSetting = nullptr;
+ static PROTOCOLSETTINGEX *protoSetting = nullptr;
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
@@ -46,12 +46,10 @@ static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
}
else SetDlgItemText(hwndDlg, IDC_STSMSG, protoSetting->m_szMsg);
- {
- wchar_t desc[512];
- mir_snwprintf(desc, TranslateT("Set %s message for %s."),
- Clist_GetStatusModeDescription(GetActualStatus(protoSetting), 0), protoSetting->m_tszAccName);
- SetDlgItemText(hwndDlg, IDC_DESCRIPTION, desc);
- }
+ wchar_t desc[512];
+ mir_snwprintf(desc, TranslateT("Set %s message for %s."),
+ Clist_GetStatusModeDescription(GetActualStatus(protoSetting), 0), protoSetting->m_tszAccName);
+ SetDlgItemText(hwndDlg, IDC_DESCRIPTION, desc);
break;
case WM_COMMAND:
@@ -64,9 +62,9 @@ static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
if (protoSetting->m_szMsg != nullptr)
GetDlgItemText(hwndDlg, IDC_STSMSG, protoSetting->m_szMsg, len + 1);
}
- SendMessage(GetParent(hwndDlg), UM_STSMSGDLGCLOSED, TRUE, 0);
- EndDialog(hwndDlg, IDC_OK);
}
+ SendMessage(GetParent(hwndDlg), UM_STSMSGDLGCLOSED, TRUE, 0);
+ EndDialog(hwndDlg, IDC_OK);
break;
case IDC_CANCEL:
@@ -147,6 +145,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
+ hwndConfirm = hwndDlg;
{
HWND hList = GetDlgItem(hwndDlg, IDC_STARTUPLIST);
SendMessage(hList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
@@ -372,6 +371,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_DESTROY:
delete confirmSettings; confirmSettings = nullptr;
+ hwndConfirm = nullptr;
break;
}
@@ -391,10 +391,16 @@ HWND ShowConfirmDialogEx(TProtoSettings *params, int _timeout)
if (timeOut < 0)
timeOut = DEF_CLOSE_TIME;
- if (GetWindow(win, 0) == nullptr) {
- win = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONFIRMDIALOG), nullptr, ConfirmDlgProc, 0);
- EnableWindow(win, TRUE);
+ if (hwndConfirm == nullptr) {
+ hwndConfirm = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONFIRMDIALOG), nullptr, ConfirmDlgProc, 0);
+ EnableWindow(hwndConfirm, TRUE);
}
- return win;
+ return hwndConfirm;
+}
+
+void ShutdownConfirmDialog()
+{
+ if (hwndConfirm)
+ DestroyWindow(hwndConfirm);
}
diff --git a/plugins/StatusManager/src/ss_main.cpp b/plugins/StatusManager/src/ss_main.cpp
index de60dd4e05..bd3e6cd630 100644
--- a/plugins/StatusManager/src/ss_main.cpp
+++ b/plugins/StatusManager/src/ss_main.cpp
@@ -308,6 +308,7 @@ static int OnShutdown(WPARAM, LPARAM)
if (hMessageWindow)
DestroyWindow(hMessageWindow);
+ ShutdownConfirmDialog();
protoList.destroy();
return 0;
}