From 343ed18d264ae1b90eda3c64ffb066035997489f Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 10 Jul 2013 18:51:18 +0000 Subject: options page for privacy settings git-svn-id: http://svn.miranda-ng.org/main/trunk@5312 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/res/Resource.rc | 32 ++++++++++++++ protocols/Skype/src/resource.h | 14 +++++- protocols/Skype/src/skype_dialogs.cpp | 81 +++++++++++++++++++++++++++++++++++ protocols/Skype/src/skype_events.cpp | 10 +++++ protocols/Skype/src/skype_proto.h | 4 +- 5 files changed, 139 insertions(+), 2 deletions(-) diff --git a/protocols/Skype/res/Resource.rc b/protocols/Skype/res/Resource.rc index 0b783eae8c..185b9438b7 100644 --- a/protocols/Skype/res/Resource.rc +++ b/protocols/Skype/res/Resource.rc @@ -200,6 +200,16 @@ BEGIN COMBOBOX IDC_TIMEZONE,68,44,142,172,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP END +IDD_OWNINFO_ACCOUNT DIALOGEX 0, 0, 222, 132 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LTEXT "Skype credit:",IDC_STATIC,5,6,59,8 + EDITTEXT IDC_CREDITVALUE,67,4,10,12,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + EDITTEXT IDC_CREDITCURRENCY,78,4,10,12,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER +END + IDD_PASSWORD_CHANGE DIALOGEX 0, 0, 201, 90 STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Change password" @@ -259,6 +269,28 @@ BEGIN PUSHBUTTON "Block",IDC_BLOCK,248,206,50,13,WS_DISABLED END +IDD_OPT_PRIVACY DIALOGEX 0, 0, 305, 230 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + GROUPBOX "Allow IMs from...",IDC_STATIC,4,4,294,39 + CONTROL "Anyone",IDC_PRIVACY_IM_ANYONE,"Button",BS_AUTORADIOBUTTON,11,17,58,10 + CONTROL "People in my Contact list only",IDC_PRIVACY_IM_CONTACTLIST, + "Button",BS_AUTORADIOBUTTON,11,29,138,10 + GROUPBOX "Allow calls from...",IDC_STATIC,5,44,293,40 + CONTROL "Anyone",IDC_PRIVACY_CALL_ANYONE,"Button",BS_AUTORADIOBUTTON,15,56,69,10 + CONTROL "People in my Contact list only",IDC_PRIVACY_CALL_CONTACTLIST, + "Button",BS_AUTORADIOBUTTON,15,68,129,10 + GROUPBOX "Automatically receive video and share screens with...",IDC_STATIC,6,87,291,46 + CONTROL "Anyone",IDC_PRIVACY_SHARE_ANYONE,"Button",BS_AUTORADIOBUTTON,12,96,41,10 + CONTROL "People in my Contact list only",IDC_PRIVACY_SHARE_CONTACTLIST, + "Button",BS_AUTORADIOBUTTON,12,107,123,10 + CONTROL "No one",IDC_PRIVACY_SHARE_NOONE,"Button",BS_AUTORADIOBUTTON,11,118,39,10 + CONTROL "Allow my online status to be shown on the web",IDC_PRIVACY_WEB, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,138,187,10 +END + IDD_BLOCK DIALOGEX 0, 0, 295, 170 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h index fb2e2359e4..508353d960 100644 --- a/protocols/Skype/src/resource.h +++ b/protocols/Skype/src/resource.h @@ -16,6 +16,8 @@ #define IDD_OPT_BLOCKED 20 #define IDD_IGNORE_LIST 21 #define IDD_BLOCK 22 +#define IDD_OWNINFO_ACCOUNT 23 +#define IDD_OPT_PRIVACY 24 #define IDI_SKYPE 101 #define IDR_RUNTIME 102 #define IDR_KEY 107 @@ -92,6 +94,16 @@ #define IDC_HEADERBAR 1063 #define IDC_BM_LIST 1064 #define IDC_LIST 1065 +#define IDC_PRIVACY_IM_ANYONE 1066 +#define IDC_PRIVACY_IM_CONTACTLIST 1067 +#define IDC_PRIVACY_CALL_ANYONE 1068 +#define IDC_PRIVACY_CALL_CONTACTLIST 1069 +#define IDC_PRIVACY_SHARE_ANYONE 1070 +#define IDC_PRIVACY_SHARE_CONTACTLIST 1071 +#define IDC_PRIVACY_SHARE_NOONE 1072 +#define IDC_PRIVACY_WEB 1073 +#define IDC_CREDITVALUE 1074 +#define IDC_CREDITCURRENCY 1075 // Next default values for new objects // @@ -99,7 +111,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 118 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1066 +#define _APS_NEXT_CONTROL_VALUE 1076 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index 427c924c7f..010e599ec4 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -187,6 +187,45 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR return FALSE; } +INT_PTR CALLBACK CSkypeProto::SkypePrivacyOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + + switch (msg) + { + case WM_INITDIALOG: + if (lParam) + { + ppro = (CSkypeProto *)lParam; + ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); + + ::TranslateDialogDefault(hwndDlg); + } + break; + + case WM_COMMAND: + { + switch(LOWORD(wParam)) + { + } + } + break; + + case WM_NOTIFY: + if (reinterpret_cast(lParam)->code == PSN_APPLY && !ppro->IsOnline()) + { + return TRUE; + } + break; + + switch(LOWORD(wParam)) + { + } + break; + } + return FALSE; +} + INT_PTR CALLBACK CSkypeProto::SkypePasswordRequestProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { PasswordRequestBoxParam *param = reinterpret_cast(::GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); @@ -764,6 +803,48 @@ INT_PTR CALLBACK CSkypeProto::HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wP } break; + case WM_NOTIFY: + if (((LPNMHDR)lParam)->idFrom == 0) { + switch (((LPNMHDR)lParam)->code) { + case PSN_PARAMCHANGED: + SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY *)lParam)->lParam); + break; + case PSN_APPLY: + if (ppro->IsOnline() && ppro->NeedUpdate) + ppro->SaveOwnInfoToServer(hwndDlg, iPageId); + else if ( !ppro->IsOnline()) + ppro->ShowNotification(::TranslateT("You are not currently connected to the Skype network. You must be online in order to update your information on the server.")); + break; + } + } + break; + } + return FALSE; +} + +INT_PTR CALLBACK CSkypeProto::AccountSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + const unsigned long iPageId = 3; + CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + + switch (msg) { + case WM_INITDIALOG: + if (lParam) { + ppro = (CSkypeProto *)lParam; + ::TranslateDialogDefault(hwndDlg); + + ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); + } + break; + + case WM_COMMAND: + if (((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE)) + { + ppro->NeedUpdate = 1; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + break; + case WM_NOTIFY: if (((LPNMHDR)lParam)->idFrom == 0) { switch (((LPNMHDR)lParam)->code) { diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index 3a9f8a3a99..59848a66aa 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -119,6 +119,11 @@ int __cdecl CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = CSkypeProto::SkypeBlockedOptionsProc; ::Options_AddPage(wParam, &odp); + odp.pszTab = LPGEN("Privacy"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PRIVACY); + odp.pfnDlgProc = CSkypeProto::SkypePrivacyOptionsProc; + ::Options_AddPage(wParam, &odp); + ::mir_free(title); return 0; } @@ -164,6 +169,11 @@ int __cdecl CSkypeProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OWNINFO_PERSONAL); odp.ptszTab = LPGENT("General"); UserInfo_AddPage(wParam, &odp); + + odp.pfnDlgProc = AccountSkypeDlgProc; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OWNINFO_ACCOUNT); + odp.ptszTab = LPGENT("Skype account"); + UserInfo_AddPage(wParam, &odp); } return 0; diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index c576d68bbe..97ae2c8143 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -502,11 +502,13 @@ protected: static INT_PTR CALLBACK SkypePasswordRequestProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK SkypePasswordChangeProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK ChatRoomProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + static INT_PTR CALLBACK SkypePrivacyOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); static INT_PTR CALLBACK SkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK PersonalSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK ContactSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - static INT_PTR CALLBACK HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + static INT_PTR CALLBACK HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + static INT_PTR CALLBACK AccountSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); // skype runtime char *LoadKeyPair(); -- cgit v1.2.3