int SetHideOffline(WPARAM wParam,LPARAM lParam) { switch((int)wParam) { case 0: DBWriteContactSettingByte(NULL,"CList","HideOffline",0); break; case 1: DBWriteContactSettingByte(NULL,"CList","HideOffline",1); break; case -1: DBWriteContactSettingByte(NULL,"CList","HideOffline",(BYTE)!DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)); break; } TRACE("PRE-LoadTree"); LoadContactTree(); TRACE("SetHideOffline Done\r\n"); return 0; }
int SetHideOffline(WPARAM wParam, LPARAM lParam) { switch ((int) wParam) { case 0: DBWriteContactSettingByte(NULL, "CList", "HideOffline", 0); break; case 1: DBWriteContactSettingByte(NULL, "CList", "HideOffline", 1); break; case -1: DBWriteContactSettingByte(NULL, "CList", "HideOffline", (BYTE) ! DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)); break; } SetButtonStates(hwndContactList); LoadContactTree(); return 0; }
int SetHideOffline(WPARAM wParam, LPARAM lParam) { switch ((int) wParam) { case 0: cfg::writeByte("CList", "HideOffline", 0); break; case 1: cfg::writeByte("CList", "HideOffline", 1); break; case -1: cfg::writeByte("CList", "HideOffline", (BYTE) ! cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)); break; } SetButtonStates(pcli->hwndContactList); LoadContactTree(); return 0; }
int SetHideOffline(WPARAM wParam, LPARAM) { int newVal = (int)wParam; switch ((int)wParam) { case 0: cfg::writeByte("CList", "HideOffline", 0); break; case 1: cfg::writeByte("CList", "HideOffline", 1); break; case -1: newVal = !cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); cfg::writeByte("CList", "HideOffline", (BYTE)newVal); break; } SetButtonStates(); ClcSetButtonState(IDC_TBHIDEOFFLINE, newVal); LoadContactTree(); return 0; }
static int SetGroupFlags(WPARAM wParam,LPARAM lParam) { char idstr[33]; DBVARIANT dbv; int flags,oldval,newval; itoa(wParam-1,idstr,10); if (DBGetContactSettingStringUtf(NULL, "CListGroups", idstr, &dbv)) return 1; flags=LOWORD(lParam)&HIWORD(lParam); oldval=dbv.pszVal[0]; newval=dbv.pszVal[0]=(dbv.pszVal[0]&~HIWORD(lParam))|flags; DBWriteContactSettingStringUtf(NULL, "CListGroups", idstr, dbv.pszVal); DBFreeVariant(&dbv); if ((oldval & GROUPF_HIDEOFFLINE) != (newval & GROUPF_HIDEOFFLINE)) LoadContactTree(); return 0; }
INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_USER+1: { HANDLE hContact = (HANDLE) wParam; DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *) lParam; if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && lstrcmpiA(ws->szModule, "CList") == 0 && lstrcmpiA(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) { CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0); } break; } case WM_DESTROY: UnhookEvent((HANDLE) GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); break; case WM_INITDIALOG: opt_gen_opts_changed = 0; TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1)); CheckDlgButton(hwndDlg, IDC_ONTOP, cfg::getByte("CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, cfg::getByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, cfg::getByte("CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, cfg::getByte("CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED); CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, cfg::getByte("CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); { DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0); if (!(caps & CLUIF_HIDEEMPTYGROUPS)) ShowWindow(GetDlgItem(hwndDlg, IDC_HIDEEMPTYGROUPS), SW_HIDE); if (!(caps & CLUIF_DISABLEGROUPS)) ShowWindow(GetDlgItem(hwndDlg, IDC_DISABLEGROUPS), SW_HIDE); if (caps & CLUIF_HASONTOPOPTION) ShowWindow(GetDlgItem(hwndDlg, IDC_ONTOP), SW_HIDE); if (caps & CLUIF_HASAUTOHIDEOPTION) { } } CheckDlgButton(hwndDlg, IDC_SHOWBUTTONBAR, cfg::dat.dwFlags & CLUI_FRAME_SHOWTOPBUTTONS); CheckDlgButton(hwndDlg, IDC_SHOWBOTTOMBUTTONS, cfg::dat.dwFlags & CLUI_FRAME_SHOWBOTTOMBUTTONS); CheckDlgButton(hwndDlg, IDC_CLISTSUNKEN, cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN); CheckDlgButton(hwndDlg, IDC_EVENTAREAAUTOHIDE, cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY); CheckDlgButton(hwndDlg, IDC_EVENTAREASUNKEN, (cfg::dat.dwFlags & CLUI_FRAME_EVENTAREASUNKEN) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ONECLK, cfg::getByte("CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, cfg::getByte("CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !cfg::getByte("CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DONTCYCLE, cfg::getByte("CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CYCLE, cfg::getByte("CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_MULTITRAY, cfg::getByte("CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, cfg::getByte("CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ICONBLINK, cfg::getByte("CList", "NoIconBlink", 0) == 1 ? BST_CHECKED : BST_UNCHECKED); if (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)) { Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, FALSE); Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, FALSE); Utils::enableDlgControl(hwndDlg, IDC_ALWAYSMULTI, FALSE); } if (IsDlgButtonChecked(hwndDlg, IDC_CYCLE)) { Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, FALSE); Utils::enableDlgControl(hwndDlg, IDC_ALWAYSMULTI, FALSE); } if (IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)) { Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, FALSE); Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, FALSE); Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, FALSE); } SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1)); SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(cfg::getWord("CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0)); { int i, count, item; PROTOACCOUNT **accs; DBVARIANT dbv = { DBVT_DELETED }; DBGetContactSetting(NULL, "CList", "PrimaryStatus", &dbv); ProtoEnumAccounts( &count, &accs ); item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM) TranslateT("Global")); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM) 0); for (i = 0; i < count; i++) { if ( !IsAccountEnabled(accs[i]) || CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0) continue; item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM) accs[i]->tszAccountName); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)accs[i] ); if (dbv.type == DBVT_ASCIIZ && !lstrcmpA(dbv.pszVal, accs[i]->szModuleName )) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0); } } if (-1 == (int) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0)) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, 0, 0); SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM) GetDlgItem(hwndDlg, IDC_BLINKTIME), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250)); SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(cfg::getWord("CList", "IconFlashTime", 550), 0)); CheckDlgButton(hwndDlg, IDC_NOTRAYINFOTIPS, cfg::dat.bNoTrayTips ? 1 : 0); CheckDlgButton(hwndDlg, IDC_APPLYLASTVIEWMODE, cfg::getByte("CList", "AutoApplyLastViewMode", 0) ? 1 : 0); return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDC_DONTCYCLE || LOWORD(wParam) == IDC_CYCLE || LOWORD(wParam) == IDC_MULTITRAY) { Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)); Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, IsDlgButtonChecked(hwndDlg, IDC_CYCLE)); Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_CYCLE)); Utils::enableDlgControl(hwndDlg, IDC_ALWAYSMULTI, IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)); } if ((LOWORD(wParam) == IDC_CYCLETIME) && HIWORD(wParam) != EN_CHANGE) break; if (LOWORD(wParam) == IDC_PRIMARYSTATUS && HIWORD(wParam) != CBN_SELCHANGE) break; if ((LOWORD(wParam) == IDC_CYCLETIME) && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) return 0; if (LOWORD(wParam) == IDC_BLINKTIME && HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) return 0; // dont make apply enabled during buddy set crap SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); opt_gen_opts_changed = TRUE; break; case WM_NOTIFY: switch (((LPNMHDR) lParam)->idFrom) { case 0: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: if(!opt_gen_opts_changed) return TRUE; cfg::writeByte("CList", "HideOffline", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE)); { DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0); if (caps & CLUIF_HIDEEMPTYGROUPS) cfg::writeByte("CList", "HideEmptyGroups", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS)); if (caps & CLUIF_DISABLEGROUPS) cfg::writeByte("CList", "UseGroups", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS)); if (!(caps & CLUIF_HASONTOPOPTION)) { cfg::writeByte("CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } if (!(caps & CLUIF_HASAUTOHIDEOPTION)) { } } cfg::writeByte("CList", "ConfirmDelete", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE)); cfg::writeByte("CList", "Tray1Click", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONECLK)); cfg::writeByte("CList", "AlwaysStatus", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS)); cfg::writeByte("CList", "AlwaysMulti", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI)); cfg::writeByte("CList", "TrayIcon", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE : (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE : SETTING_TRAYICON_MULTI))); cfg::writeWord("CList", "CycleTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0)); cfg::writeWord("CList", "IconFlashTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); cfg::writeByte("CList", "DisableTrayFlash", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); cfg::writeByte("CList", "NoIconBlink", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ICONBLINK)); cfg::writeByte("CList", "AutoApplyLastViewMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_APPLYLASTVIEWMODE)); __setFlag(CLUI_FRAME_EVENTAREASUNKEN, IsDlgButtonChecked(hwndDlg, IDC_EVENTAREASUNKEN)); __setFlag(CLUI_FRAME_AUTOHIDENOTIFY, IsDlgButtonChecked(hwndDlg, IDC_EVENTAREAAUTOHIDE)); __setFlag(CLUI_FRAME_SHOWTOPBUTTONS, IsDlgButtonChecked(hwndDlg, IDC_SHOWBUTTONBAR)); __setFlag(CLUI_FRAME_SHOWBOTTOMBUTTONS, IsDlgButtonChecked(hwndDlg, IDC_SHOWBOTTOMBUTTONS)); __setFlag(CLUI_FRAME_CLISTSUNKEN, IsDlgButtonChecked(hwndDlg, IDC_CLISTSUNKEN)); cfg::dat.bNoTrayTips = IsDlgButtonChecked(hwndDlg, IDC_NOTRAYINFOTIPS) ? 1 : 0; cfg::writeByte("CList", "NoTrayTips", (BYTE)cfg::dat.bNoTrayTips); { int cursel = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0); PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cursel, 0); if ( !pa ) DBDeleteContactSetting(NULL, "CList", "PrimaryStatus"); else cfg::writeString(NULL, "CList", "PrimaryStatus", pa->szModuleName ); } pcli->pfnTrayIconIconsChanged(); cfg::writeDword("CLUI", "Frameflags", cfg::dat.dwFlags); ConfigureFrame(); ConfigureCLUIGeometry(1); ConfigureEventArea(pcli->hwndContactList); HideShowNotifyFrame(); SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); LoadContactTree(); /* this won't do job properly since it only really works when changes happen */ pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); PostMessage(pcli->hwndContactList, CLUIINTM_REDRAW, 0, 0); opt_gen_opts_changed = 0; return TRUE; } break; } break; } return FALSE; }
static int DeleteGroup(WPARAM wParam,LPARAM lParam) { int i; char str[33]; DBVARIANT dbv; HANDLE hContact; TCHAR name[256], szNewParent[256], *pszLastBackslash; //get the name itoa(wParam-1,str,10); if (DBGetContactSettingTString(NULL, "CListGroups", str, &dbv)) return 1; if (DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT)) if (MessageBox((HWND)CallService(MS_CLUI_GETHWND, 0, 0), TranslateT("Are you sure you want to delete this group? This operation can not be undone."), TranslateT("Delete Group"), MB_YESNO|MB_ICONQUESTION)==IDNO) return 1; lstrcpyn(name, (TCHAR*)dbv.ptszVal + 1, SIZEOF(name)); DBFreeVariant(&dbv); SetCursor(LoadCursor(NULL,IDC_WAIT)); //must remove setting from all child contacts too //children are demoted to the next group up, not deleted. lstrcpy(szNewParent, name); pszLastBackslash = _tcsrchr(szNewParent, '\\'); if (pszLastBackslash) pszLastBackslash[0] = '\0'; else szNewParent[0] = '\0'; hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); do { if (DBGetContactSettingTString(hContact, "CList", "Group", &dbv)) continue; if (_tcscmp(dbv.ptszVal, name)) { DBFreeVariant(&dbv); continue; } DBFreeVariant(&dbv); if (szNewParent[0]) DBWriteContactSettingTString(hContact, "CList", "Group", szNewParent); else DBDeleteContactSetting(hContact, "CList", "Group"); } while((hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))!=NULL); //shuffle list of groups up to fill gap for(i=wParam-1;;i++) { itoa(i+1,str,10); if (DBGetContactSettingStringUtf(NULL, "CListGroups", str, &dbv)) break; itoa(i,str,10); DBWriteContactSettingStringUtf(NULL, "CListGroups", str, dbv.pszVal); DBFreeVariant(&dbv); } itoa(i,str,10); DBDeleteContactSetting(NULL,"CListGroups",str); //rename subgroups { TCHAR szNewName[256]; int len; len = lstrlen(name); for(i=0;;i++) { itoa(i,str,10); if (DBGetContactSettingTString(NULL, "CListGroups", str, &dbv)) break; if (!_tcsncmp((TCHAR*)dbv.ptszVal + 1, name, len) && dbv.ptszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) { if (szNewParent[0]) mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), szNewParent, dbv.ptszVal + len + 2); else lstrcpyn(szNewName, dbv.ptszVal + len + 2, SIZEOF(szNewName)); RenameGroupT((WPARAM)(i + 1), (LPARAM)szNewName); } DBFreeVariant(&dbv); } } SetCursor(LoadCursor(NULL,IDC_ARROW)); LoadContactTree(); return 0; }
static BOOL CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_USER+1: { HANDLE hContact = (HANDLE) wParam; DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *) lParam; if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && lstrcmpiA(ws->szModule, "CList") == 0 && lstrcmpiA(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) { CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0); } break; } case WM_DESTROY: { UnhookEvent((HANDLE) GetWindowLong(hwndDlg, GWL_USERDATA)); break; } case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SetWindowLong(hwndDlg, GWL_USERDATA, (LONG) HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1)); CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, DBGetContactSettingByte(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED); CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AUTOHIDE, DBGetContactSettingByte(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_EVENTSONTOP, (g_CluiData.dwFlags & CLUI_STICKYEVENTS) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DONTSEPARATE, g_CluiData.bDontSeparateOffline); { int i; for(i = 0; sortCtrlIDs[i] != 0; i++) { SendDlgItemMessage(hwndDlg, sortCtrlIDs[i], CB_INSERTSTRING, -1, (LPARAM)TranslateT("Nothing")); SendDlgItemMessage(hwndDlg, sortCtrlIDs[i], CB_INSERTSTRING, -1, (LPARAM)TranslateT("Name")); SendDlgItemMessage(hwndDlg, sortCtrlIDs[i], CB_INSERTSTRING, -1, (LPARAM)TranslateT("Protocol")); SendDlgItemMessage(hwndDlg, sortCtrlIDs[i], CB_INSERTSTRING, -1, (LPARAM)TranslateT("Status")); SendDlgItemMessage(hwndDlg, sortCtrlIDs[i], CB_INSERTSTRING, -1, (LPARAM)TranslateT("Last Message")); SendDlgItemMessage(hwndDlg, sortCtrlIDs[i], CB_INSERTSTRING, -1, (LPARAM)TranslateT("Message Frequency")); SendDlgItemMessage(hwndDlg, sortCtrlIDs[i], CB_SETCURSEL, g_CluiData.sortOrder[i], 0); } } EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); { DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0); if (!(caps & CLUIF_HIDEEMPTYGROUPS)) ShowWindow(GetDlgItem(hwndDlg, IDC_HIDEEMPTYGROUPS), SW_HIDE); if (!(caps & CLUIF_DISABLEGROUPS)) ShowWindow(GetDlgItem(hwndDlg, IDC_DISABLEGROUPS), SW_HIDE); if (caps & CLUIF_HASONTOPOPTION) ShowWindow(GetDlgItem(hwndDlg, IDC_ONTOP), SW_HIDE); if (caps & CLUIF_HASAUTOHIDEOPTION) { ShowWindow(GetDlgItem(hwndDlg, IDC_AUTOHIDE), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_STAUTOHIDESECS), SW_HIDE); } } SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1)); SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0, MAKELONG(DBGetContactSettingWord(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0)); CheckDlgButton(hwndDlg, IDC_ONECLK, DBGetContactSettingByte(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, DBGetContactSettingByte(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DONTCYCLE, DBGetContactSettingByte(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CYCLE, DBGetContactSettingByte(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_MULTITRAY, DBGetContactSettingByte(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, DBGetContactSettingByte(NULL, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ICONBLINK, DBGetContactSettingByte(NULL, "CList", "NoIconBlink", 0) == 1 ? BST_CHECKED : BST_UNCHECKED); if (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)) { EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSMULTI), FALSE); } if (IsDlgButtonChecked(hwndDlg, IDC_CYCLE)) { EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSMULTI), FALSE); } if (IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)) { EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), FALSE); } SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1)); SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(DBGetContactSettingWord(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0)); { int i, count, item; PROTOCOLDESCRIPTOR **protos; char szName[64]; DBVARIANT dbv = { DBVT_DELETED }; DBGetContactSetting(NULL, "CList", "PrimaryStatus", &dbv); CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM) &count, (LPARAM) &protos); item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM) TranslateT("Global")); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM) 0); for (i = 0; i < count; i++) { if (protos[i]->type != PROTOTYPE_PROTOCOL || CallProtoService(protos[i]->szName, PS_GETCAPS, PFLAGNUM_2, 0) == 0) continue; CallProtoService(protos[i]->szName, PS_GETNAME, sizeof(szName), (LPARAM) szName); item = SendDlgItemMessageA(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM) szName); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM) protos[i]); if (dbv.type == DBVT_ASCIIZ && !lstrcmpA(dbv.pszVal, protos[i]->szName)) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0); } } if (-1 == (int) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0)) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, 0, 0); SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM) GetDlgItem(hwndDlg, IDC_BLINKTIME), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250)); SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(DBGetContactSettingWord(NULL, "CList", "IconFlashTime", 550), 0)); CheckDlgButton(hwndDlg, IDC_NOTRAYINFOTIPS, g_CluiData.bNoTrayTips ? 1 : 0); return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDC_AUTOHIDE) { EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); } if (LOWORD(wParam) == IDC_DONTCYCLE || LOWORD(wParam) == IDC_CYCLE || LOWORD(wParam) == IDC_MULTITRAY) { EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)); EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), IsDlgButtonChecked(hwndDlg, IDC_CYCLE)); EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_CYCLE)); EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSMULTI), IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)); } if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CYCLETIME) && HIWORD(wParam) != EN_CHANGE) break; if (LOWORD(wParam) == IDC_PRIMARYSTATUS && HIWORD(wParam) != CBN_SELCHANGE) break; if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CYCLETIME) && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) return 0; if (LOWORD(wParam) == IDC_BLINKTIME && HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) return 0; // dont make apply enabled during buddy set crap SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: switch (((LPNMHDR) lParam)->idFrom) { case 0: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: DBWriteContactSettingByte(NULL, "CList", "HideOffline", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE)); { DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0); if (caps & CLUIF_HIDEEMPTYGROUPS) DBWriteContactSettingByte(NULL, "CList", "HideEmptyGroups", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS)); if (caps & CLUIF_DISABLEGROUPS) DBWriteContactSettingByte(NULL, "CList", "UseGroups", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS)); if (!(caps & CLUIF_HASONTOPOPTION)) { DBWriteContactSettingByte(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); SetWindowPos((HWND) CallService(MS_CLUI_GETHWND, 0, 0), IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } if (!(caps & CLUIF_HASAUTOHIDEOPTION)) { DBWriteContactSettingByte(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); DBWriteContactSettingWord(NULL, "CList", "HideTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0)); } } { int i; LRESULT curSel; for(i = 0; sortCtrlIDs[i] != 0; i++) { curSel = SendDlgItemMessage(hwndDlg, sortCtrlIDs[i], CB_GETCURSEL, 0, 0); if(curSel == 0 || curSel == CB_ERR) g_CluiData.sortOrder[i] = 0; else g_CluiData.sortOrder[i] = (BYTE)curSel; } DBWriteContactSettingDword(NULL, "CList", "SortOrder", MAKELONG(MAKEWORD(g_CluiData.sortOrder[0], g_CluiData.sortOrder[1]), MAKEWORD(g_CluiData.sortOrder[2], 0))); if(g_CluiData.sortOrder[0] == SORTBY_LASTMSG || g_CluiData.sortOrder[1] == SORTBY_LASTMSG || g_CluiData.sortOrder[2] == SORTBY_LASTMSG) { int i; for(i = 0; i < g_nextExtraCacheEntry; i++) g_ExtraCache[i].dwLastMsgTime = INTSORT_GetLastMsgTime(g_ExtraCache[i].hContact); } } DBWriteContactSettingByte(NULL, "CList", "ConfirmDelete", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE)); DBWriteContactSettingByte(NULL, "CList", "Tray1Click", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONECLK)); DBWriteContactSettingByte(NULL, "CList", "AlwaysStatus", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS)); DBWriteContactSettingByte(NULL, "CList", "AlwaysMulti", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI)); DBWriteContactSettingByte(NULL, "CList", "TrayIcon", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE : (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE : SETTING_TRAYICON_MULTI))); DBWriteContactSettingWord(NULL, "CList", "CycleTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0)); DBWriteContactSettingWord(NULL, "CList", "IconFlashTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); DBWriteContactSettingByte(NULL, "CList", "DisableTrayFlash", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); DBWriteContactSettingByte(NULL, "CList", "NoIconBlink", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ICONBLINK)); g_CluiData.bDontSeparateOffline = IsDlgButtonChecked(hwndDlg, IDC_DONTSEPARATE) ? 1 : 0; DBWriteContactSettingByte(NULL, "CList", "DontSeparateOffline", g_CluiData.bDontSeparateOffline); g_CluiData.bNoTrayTips = IsDlgButtonChecked(hwndDlg, IDC_NOTRAYINFOTIPS) ? 1 : 0; DBWriteContactSettingByte(NULL, "CList", "NoTrayTips", g_CluiData.bNoTrayTips); if (!SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0), 0)) DBDeleteContactSetting(NULL, "CList", "PrimaryStatus"); else DBWriteContactSettingString(NULL, "CList", "PrimaryStatus", ((PROTOCOLDESCRIPTOR *) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0), 0))->szName); pcli->pfnTrayIconIconsChanged(); LoadContactTree(); /* this won't do job properly since it only really works when changes happen */ SendMessage(pcli->hwndContactTree, CLM_AUTOREBUILD, 0, 0); /* force reshuffle */ g_CluiData.dwFlags = IsDlgButtonChecked(hwndDlg, IDC_EVENTSONTOP) ? g_CluiData.dwFlags | CLUI_STICKYEVENTS : g_CluiData.dwFlags & ~CLUI_STICKYEVENTS; DBWriteContactSettingDword(NULL, "CLUI", "Frameflags", g_CluiData.dwFlags); return TRUE; } break; } break; } return FALSE; }