diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-03 15:44:40 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-03 15:44:40 +0000 |
commit | 914e0b89c4aa13461d4f36fdfcb1b49bb3f00456 (patch) | |
tree | 82e26a44d5494700d4077295468051fb41dccd85 /src/modules/metacontacts/meta_edit.cpp | |
parent | 2cbc7f36727cc86800c0866df859a0ab473b678e (diff) |
- META_PROTO/Default went to cache;
- MIDatabase::MetaSetDefault method added to store the default sub in a database;
- Meta_SettingChanged fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@8380 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/metacontacts/meta_edit.cpp')
-rw-r--r-- | src/modules/metacontacts/meta_edit.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/modules/metacontacts/meta_edit.cpp b/src/modules/metacontacts/meta_edit.cpp index 98c877a5ac..87929eedf4 100644 --- a/src/modules/metacontacts/meta_edit.cpp +++ b/src/modules/metacontacts/meta_edit.cpp @@ -152,10 +152,8 @@ void ApplyChanges(CHANGES *chg) NotifyEventHooks(hSubcontactsChanged, chg->hMeta, chg->hDefaultContact);
// set default
- if (chg->hDefaultContact)
- db_set_dw(chg->hMeta, META_PROTO, "Default", Meta_GetContactNumber(chg->cc, chg->hDefaultContact));
- else
- db_set_dw(chg->hMeta, META_PROTO, "Default", 0);
+ chg->cc->nDefault = (chg->hDefaultContact) ? Meta_GetContactNumber(chg->cc, chg->hDefaultContact) : 0;
+ currDb->MetaSetDefault(chg->cc);
NotifyEventHooks(hEventDefaultChanged, chg->hMeta, chg->hDefaultContact);
// set offline
@@ -231,6 +229,12 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TranslateDialogDefault( hwndDlg );
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(I_EDIT));
{
+ DBCachedContact *cc = currDb->m_cache->GetCachedContact(lParam);
+ if (cc == NULL) {
+ DestroyWindow(hwndDlg);
+ return FALSE;
+ }
+
// Disable the 'Apply' button.
EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),FALSE);
@@ -268,17 +272,15 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UP), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DOWN), FALSE);
- int nb_contacts = db_get_dw(lParam, META_PROTO, "NumContacts", 0);
- int default_contact_number = db_get_dw(lParam, META_PROTO, "Default", INVALID_CONTACT_ID);
int offline_contact_number = db_get_dw(lParam, META_PROTO, "OfflineSend", INVALID_CONTACT_ID);
+ changes.cc = cc;
changes.hMeta = lParam;
- changes.cc = currDb->m_cache->GetCachedContact(lParam);
- changes.num_contacts = nb_contacts;
+ changes.num_contacts = cc->nSubs;
changes.num_deleted = 0;
- changes.hDefaultContact = Meta_GetContactHandle(changes.cc, default_contact_number);
+ changes.hDefaultContact = Meta_GetContactHandle(changes.cc, cc->nDefault);
changes.hOfflineContact = Meta_GetContactHandle(changes.cc, offline_contact_number);
- for (i = 0; i < nb_contacts; i++)
+ for (i = 0; i < cc->nSubs; i++)
changes.hContact[i] = Meta_GetContactHandle(changes.cc, i);
changes.force_default = MetaAPI_GetForceState((WPARAM)lParam, 0);
|