diff options
author | George Hazan <george.hazan@gmail.com> | 2012-12-04 16:30:53 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-12-04 16:30:53 +0000 |
commit | c6d147395447240320d3e37286603c11d8fb00c3 (patch) | |
tree | 69d414f104fd863d200d992fd0eb8eba27846bc3 /plugins/FingerprintNG/src | |
parent | b015a208cdd9feb11b0debd2988a3bdac5b9e1f6 (diff) |
applying changed options on the fly
git-svn-id: http://svn.miranda-ng.org/main/trunk@2641 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FingerprintNG/src')
-rw-r--r-- | plugins/FingerprintNG/src/fingerprint.cpp | 17 | ||||
-rw-r--r-- | plugins/FingerprintNG/src/options.cpp | 72 |
2 files changed, 42 insertions, 47 deletions
diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index c22abf66e8..f6bdae76db 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -74,8 +74,7 @@ void FASTCALL Prepare(KN_FP_MASK* mask, bool bEnable) if (SectName == NULL)
return;
- SKINICONDESC sid = { 0 };
- sid.cbSize = sizeof(sid);
+ SKINICONDESC sid = { sizeof(sid) };
sid.flags = SIDF_ALL_TCHAR;
sid.ptszSection = SectName;
sid.pszName = mask->szIconName;
@@ -133,9 +132,6 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
HookEvent(ME_OPT_INITIALISE, OnOptInitialise);
- hExtraIcon = ExtraIcon_Register("Client","Fingerprint","client_Miranda_Unknown",
- OnExtraIconListRebuild,OnExtraImageApply,OnExtraIconClick);
-
if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
hIconFolder = FoldersRegisterCustomPathT("Fingerprint", "Icons", _T(MIRANDA_PATH) _T("\\") DEFAULT_SKIN_FOLDER);
FoldersGetCustomPathT(hIconFolder, g_szSkinLib, SIZEOF(g_szSkinLib), _T(""));
@@ -143,6 +139,10 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) else CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)DEFAULT_SKIN_FOLDER, (LPARAM)g_szSkinLib);
RegisterIcons();
+
+ hExtraIcon = ExtraIcon_Register("Client","Fingerprint","client_Miranda_Unknown",
+ OnExtraIconListRebuild,OnExtraImageApply,OnExtraIconClick);
+
return 0;
}
@@ -201,11 +201,10 @@ int OnExtraImageApply(WPARAM wParam, LPARAM lParam) if (hContact == NULL)
return 0;
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0);
+ char *szProto = GetContactProto((HANDLE)wParam);
if (szProto != NULL) {
- DBVARIANT dbvMirVer = { 0 };
-
- if (!DBGetContactSettingTString(hContact, szProto, "MirVer", &dbvMirVer)) {
+ DBVARIANT dbvMirVer;
+ if ( !db_get_ts(hContact, szProto, "MirVer", &dbvMirVer)) {
ApplyFingerprintImage(hContact, dbvMirVer.ptszVal);
DBFreeVariant(&dbvMirVer);
}
diff --git a/plugins/FingerprintNG/src/options.cpp b/plugins/FingerprintNG/src/options.cpp index 39a6c1a8ba..88382ccd01 100644 --- a/plugins/FingerprintNG/src/options.cpp +++ b/plugins/FingerprintNG/src/options.cpp @@ -21,40 +21,38 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //Start of header
#include "global.h"
-struct _settingsInfo
+struct
{
int idCtrl;
LPCSTR szSetName;
}
-static settings [] =
+static settings[] =
{
- {IDC_GROUP_MIRANDA, "GroupMiranda"},
- {IDC_GROUP_MIRANDA_VERSION, "GroupMirandaVersion"},
- {IDC_GROUP_MIRANDA_PACKS, "GroupMirandaPacks"},
+ {IDC_GROUP_MIRANDA, "GroupMiranda"},
+ {IDC_GROUP_MIRANDA_VERSION, "GroupMirandaVersion"},
+ {IDC_GROUP_MIRANDA_PACKS, "GroupMirandaPacks"},
- {IDC_GROUP_MULTI, "GroupMulti"},
- {IDC_GROUP_AIM, "GroupAIM"},
- {IDC_GROUP_GG, "GroupGG"},
- {IDC_GROUP_ICQ, "GroupICQ"},
- {IDC_GROUP_IRC, "GroupIRC"},
- {IDC_GROUP_JABBER, "GroupJabber"},
- {IDC_GROUP_MRA, "GroupMRA"},
- {IDC_GROUP_MSN, "GroupMSN"},
- {IDC_GROUP_QQ, "GroupQQ"},
- {IDC_GROUP_RSS, "GroupRSS"},
- {IDC_GROUP_TLEN, "GroupTlen"},
- {IDC_GROUP_WEATHER, "GroupWeather"},
- {IDC_GROUP_YAHOO, "GroupYahoo"},
+ {IDC_GROUP_MULTI, "GroupMulti"},
+ {IDC_GROUP_AIM, "GroupAIM"},
+ {IDC_GROUP_GG, "GroupGG"},
+ {IDC_GROUP_ICQ, "GroupICQ"},
+ {IDC_GROUP_IRC, "GroupIRC"},
+ {IDC_GROUP_JABBER, "GroupJabber"},
+ {IDC_GROUP_MRA, "GroupMRA"},
+ {IDC_GROUP_MSN, "GroupMSN"},
+ {IDC_GROUP_QQ, "GroupQQ"},
+ {IDC_GROUP_RSS, "GroupRSS"},
+ {IDC_GROUP_TLEN, "GroupTlen"},
+ {IDC_GROUP_WEATHER, "GroupWeather"},
+ {IDC_GROUP_YAHOO, "GroupYahoo"},
- {IDC_GROUP_OTHER_PROTOS, "GroupOtherProtos"},
- {IDC_GROUP_OTHERS, "GroupOthers"},
-
- {IDC_GROUP_OVERLAYS_RESOURCE, "GroupOverlaysResource"},
- {IDC_GROUP_OVERLAYS_PLATFORM, "GroupOverlaysPlatform"},
- {IDC_GROUP_OVERLAYS_PROTO, "GroupOverlaysProtos"},
- {IDC_GROUP_OVERLAYS_SECURITY, "GroupOtherProtos"},
-// {IDC_GROUP_OVERLAYS_RESOURCE_ALT, "GroupOverlays"},
+ {IDC_GROUP_OTHER_PROTOS, "GroupOtherProtos"},
+ {IDC_GROUP_OTHERS, "GroupOthers"},
+ {IDC_GROUP_OVERLAYS_RESOURCE, "GroupOverlaysResource"},
+ {IDC_GROUP_OVERLAYS_PLATFORM, "GroupOverlaysPlatform"},
+ {IDC_GROUP_OVERLAYS_PROTO, "GroupOverlaysProtos"},
+ {IDC_GROUP_OVERLAYS_SECURITY, "GroupOtherProtos"}
};
static void OptDlgChanged(HWND hwndDlg, BOOL show)
@@ -78,8 +76,8 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
switch(msg) {
case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
{
- TranslateDialogDefault(hwndDlg);
for (int i = 0; i < SIZEOF(settings); i++) {
if (lstrcmpA(settings[i].szSetName, "GroupMirandaVersion") == 0)
LoadDBCheckState(hwndDlg, settings[i].idCtrl, settings[i].szSetName, 0);
@@ -97,8 +95,6 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_GROUP_MIRANDA:
case IDC_GROUP_MIRANDA_VERSION:
case IDC_GROUP_MIRANDA_PACKS:
-// case IDC_GROUP_OVERLAYS_RESOURCE_ALT:
-
OptDlgChanged(hwndDlg, true);
break;
@@ -123,7 +119,6 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_GROUP_OVERLAYS_PLATFORM:
case IDC_GROUP_OVERLAYS_PROTO:
case IDC_GROUP_OVERLAYS_SECURITY:
-
OptDlgChanged(hwndDlg, false);
break;
@@ -133,15 +128,16 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
case WM_NOTIFY:
- {
- NMHDR *hdr = (NMHDR *)lParam;
- if (hdr && hdr->code == PSN_APPLY) {
- for (int i = 0; i < SIZEOF(settings); i++)
- StoreDBCheckState(hwndDlg, settings[i].idCtrl, settings[i].szSetName);
+ NMHDR *hdr = (NMHDR *)lParam;
+ if (hdr && hdr->code == PSN_APPLY) {
+ for (int i = 0; i < SIZEOF(settings); i++)
+ StoreDBCheckState(hwndDlg, settings[i].idCtrl, settings[i].szSetName);
- ClearFI();
- RegisterIcons();
- }
+ ClearFI();
+ RegisterIcons();
+
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
+ OnExtraImageApply((WPARAM)hContact, 0);
}
break;
}
|