summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-01-23 20:24:13 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-01-23 20:24:13 +0000
commit1af17c7378e35c6be7429d2181ff122f50ab2e2b (patch)
treea933b4388b7c72d6b51c59c361bb31ddf0e1b142 /src/modules
parent0314c6e414e054b0c08b788433d51583a71b5028 (diff)
God forbid me...
git-svn-id: http://svn.miranda-ng.org/main/trunk@3258 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/plugins/pluginopts.cpp53
1 files changed, 50 insertions, 3 deletions
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp
index 2d473a5cf8..b072054f9e 100644
--- a/src/modules/plugins/pluginopts.cpp
+++ b/src/modules/plugins/pluginopts.cpp
@@ -344,7 +344,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
iRow = ListView_GetNextItem(hwndList, iRow, LVNI_ALL);
} }
- ShowWindow( GetDlgItem(hwndDlg, IDC_RESTART), TRUE);
+ // ShowWindow( GetDlgItem(hwndDlg, IDC_RESTART), TRUE); // this here only in "ghazan mode"
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
@@ -386,14 +386,61 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
} } } }
if (hdr->hdr.code == PSN_APPLY) {
- HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
+ bool needRestart = false;
+ TCHAR bufRestart[1024];
+ int bufLen = mir_sntprintf(bufRestart, SIZEOF(bufRestart), _T("%s"), TranslateT("Miranda NG must be restarted to apply changes for these plugins:\n"));
+
+ HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
TCHAR buf[1024];
for (int iRow = 0; iRow != -1;) {
ListView_GetItemText(hwndList, iRow, 2, buf, SIZEOF(buf));
int iState = ListView_GetItemState(hwndList, iRow, LVIS_STATEIMAGEMASK);
SetPluginOnWhiteList(buf, (iState & 0x2000) ? 1 : 0);
+
+ LVITEM lvi = {0};
+ lvi.mask = LVIF_IMAGE | LVIF_PARAM;
+ lvi.stateMask = -1;
+ lvi.iItem = iRow;
+ lvi.iSubItem = 1;
+ if (ListView_GetItem(hwndList, &lvi)) {
+ lvi.mask = LVIF_IMAGE;
+
+ PluginListItemData* dat = (PluginListItemData*)lvi.lParam;
+ if (iState & 0x2000) {
+ // enabling plugin
+ if (lvi.iImage == 3 || lvi.iImage == 5) {
+ if (lvi.iImage == 3 && LoadPluginDynamically(dat)) {
+ lvi.iImage = 2;
+ ListView_SetItem(hwndList, &lvi);
+ } else {
+ bufLen += mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T(" - %s\n"), buf);
+ needRestart = true;
+ }
+ }
+ } else {
+ // disabling plugin
+ if (lvi.iImage == 2 || lvi.iImage == 4) {
+ if (lvi.iImage == 2 && UnloadPluginDynamically(dat)) {
+ lvi.iImage = 3;
+ ListView_SetItem(hwndList, &lvi);
+ } else {
+ bufLen += mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T(" - %s\n"), buf);
+ needRestart = true;
+ }
+ }
+ }
+ }
+
iRow = ListView_GetNextItem(hwndList, iRow, LVNI_ALL);
- } } }
+ }
+ ShowWindow( GetDlgItem(hwndDlg, IDC_RESTART), needRestart);
+ if (needRestart) {
+ mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T("\n%s"), TranslateT("Do you want to restart it now?"));
+ if (MessageBox(NULL, bufRestart, _T("Miranda NG"), MB_ICONWARNING | MB_YESNO) == IDYES)
+ CallService(MS_SYSTEM_RESTART, 0, 0);
+ }
+ }
+ }
break;
case WM_COMMAND: