summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-04-24 15:59:31 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-04-24 15:59:31 +0000
commit263eb6c9c953a24df9944ea364e429e9a4076918 (patch)
treefb3b686f1f8ef124efea20fe24a13337176fa9f1 /src/modules
parent61ad99d76b1e86714cffb24a1f6571b2c4510de0 (diff)
fix for disabling SendOffline flag for a MC
git-svn-id: http://svn.miranda-ng.org/main/trunk@9071 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/metacontacts/meta_edit.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/modules/metacontacts/meta_edit.cpp b/src/modules/metacontacts/meta_edit.cpp
index ce10aaf181..14ab3bb642 100644
--- a/src/modules/metacontacts/meta_edit.cpp
+++ b/src/modules/metacontacts/meta_edit.cpp
@@ -250,13 +250,6 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara
LvCol.cx = 85;
ListView_InsertColumn(hwndList, 4, &LvCol);
- // disable buttons until a selection is made in the list
- EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_REM), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SETDEFAULT), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UP), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DOWN), FALSE);
-
int offline_contact_number = db_get_dw(lParam, META_PROTO, "OfflineSend", INVALID_CONTACT_ID);
ZeroMemory(&g_data, sizeof(g_data));
@@ -294,9 +287,13 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara
// enable buttons
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_REM), sel != -1);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SETDEFAULT), sel != -1 && g_data.hContact[sel] != g_data.hDefaultContact);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE), sel != -1 && g_data.hContact[sel] != g_data.hOfflineContact);
+
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UP), sel > 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DOWN), (sel != -1 && sel < g_data.num_contacts - 1));
+
+ HWND hwndOffline = GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE);
+ EnableWindow(hwndOffline, sel != -1);
+ SetWindowText(hwndOffline, TranslateTS((sel != -1 && g_data.hContact[sel] != g_data.hOfflineContact) ? LPGENT("Send &Offline") : LPGENT("Send &Online")));
}
}
break;
@@ -352,11 +349,13 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara
case IDC_BTN_SETOFFLINE:
sel = ListView_GetNextItem(hwndList, -1, LVNI_FOCUSED | LVNI_SELECTED);
InvalidateRect(hwndList, 0, TRUE);
- g_data.hOfflineContact = g_data.hContact[sel];
+ if (g_data.hContact[sel] != g_data.hOfflineContact)
+ g_data.hOfflineContact = g_data.hContact[sel];
+ else
+ g_data.hOfflineContact = 0;
FillContactList(hwndList);
SetListSelection(hwndList, sel);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_VALIDATE), TRUE);
return TRUE;
@@ -382,7 +381,6 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara
// disable buttons
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_REM), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SETDEFAULT), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UP), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DOWN), FALSE);