diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-04-29 14:01:49 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-04-29 14:01:49 +0000 |
commit | 792732d7ef1ec4445f02e0b9c0b6eda6879db3a6 (patch) | |
tree | e07a07716aa9aa8c416f54c23820e09064c2361c /protocols/Skype | |
parent | 7717d512bcb36e8af48869eca18d56827d34d0da (diff) |
preparing for own info editing
git-svn-id: http://svn.miranda-ng.org/main/trunk@4569 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype')
-rw-r--r-- | protocols/Skype/res/Resource.rc | 31 | ||||
-rw-r--r-- | protocols/Skype/src/resource.h | 22 | ||||
-rw-r--r-- | protocols/Skype/src/skype_dialogs.cpp | 179 | ||||
-rw-r--r-- | protocols/Skype/src/skype_profile.cpp | 37 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.h | 12 |
5 files changed, 136 insertions, 145 deletions
diff --git a/protocols/Skype/res/Resource.rc b/protocols/Skype/res/Resource.rc index 2883f15109..7bcb2392a1 100644 --- a/protocols/Skype/res/Resource.rc +++ b/protocols/Skype/res/Resource.rc @@ -101,14 +101,29 @@ BEGIN EDITTEXT IDC_LASTPROFILECHANGE,74,57,142,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
END
-IDD_OWNINFO_SKYPE DIALOGEX 0, 0, 222, 151
-STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD
+IDD_OWNINFO_PERSONAL 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
- CONTROL "",IDC_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,2,2,218,133
- PUSHBUTTON "&Save changes",IDC_SAVE,140,137,80,13,WS_DISABLED
- EDITTEXT IDC_UPLOADING,2,138,127,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_VISIBLE | NOT WS_BORDER
+ LTEXT "Full name:",IDC_STATIC,5,7,51,8
+ EDITTEXT IDC_FULLNAME,58,5,159,12,ES_AUTOHSCROLL
+ LTEXT "Date of birth:",IDC_STATIC,5,20,51,8
+ COMBOBOX IDC_BIRTH_DAY,58,18,25,12,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_BIRTH_MONTH,84,18,25,12,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_BIRTH_YEAR,110,18,35,12,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Gender:",IDC_STATIC,5,34,51,8
+ COMBOBOX IDC_GENDER,58,32,62,52,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Homepage:",IDC_STATIC,6,119,51,8
+ EDITTEXT IDC_HOMEPAGE,58,117,159,12,ES_AUTOHSCROLL
+ LTEXT "Language 1:",IDC_STATIC,6,47,51,8
+ COMBOBOX IDC_LANGUAGE1,58,46,86,52,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Language 2:",IDC_STATIC,5,62,51,8
+ COMBOBOX IDC_LANGUAGE2,58,60,85,52,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Language 3:",IDC_STATIC,5,76,51,8
+ COMBOBOX IDC_LANGUAGE3,58,74,85,52,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+ LTEXT "About:",IDC_STATIC,5,90,51,8
+ EDITTEXT IDC_ABOUT,57,88,159,24,ES_MULTILINE | WS_VSCROLL
END
IDD_PASSWORD_CHANGE DIALOGEX 0, 0, 201, 90
@@ -157,12 +172,8 @@ BEGIN HORZGUIDE, 74
END
- IDD_OWNINFO_SKYPE, DIALOG
+ IDD_OWNINFO_PERSONAL, DIALOG
BEGIN
- LEFTMARGIN, 2
- RIGHTMARGIN, 220
- TOPMARGIN, 2
- BOTTOMMARGIN, 150
END
IDD_PASSWORD_CHANGE, DIALOG
diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h index 76d45d4b75..683064baaf 100644 --- a/protocols/Skype/src/resource.h +++ b/protocols/Skype/src/resource.h @@ -1,12 +1,14 @@ //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by e:\Projects\C++\MirandaNG\protocols\Skype\res\Resource.rc
+// Used by c:\Temp\Miranda NG\protocols\Skype\res\Resource.rc
//
#define IDD_ACCMGR 9
#define IDD_OPT_MAIN 10
#define IDD_INFO_SKYPE 11
-#define IDD_OWNINFO_SKYPE 12
-#define IDD_PASSWORD_CHANGE 13
+#define IDD_OWNINFO_PERSONAL 12
+#define IDD_OWNINFO_HOME 13
+#define IDD_OWNINFO_CONTACT 14
+#define IDD_PASSWORD_CHANGE 15
#define IDD_CHATROOM_INVITE 40
#define IDI_ICON 101
#define IDR_RUNTIME 102
@@ -33,9 +35,6 @@ #define IDC_LASTEVENTDATE 1011
#define IDC_PASSWORD3 1011
#define IDC_LASTPROFILECHANGE 1012
-#define IDC_SAVE 1013
-#define IDC_LIST 1014
-#define IDC_UPLOADING 1015
#define IDC_PORT 1016
#define IDC_USE_ALT_PORTS 1017
#define IDC_REGISTER 1018
@@ -45,6 +44,17 @@ #define IDC_INSTRUCTION2 1022
#define IDC_PASSWORD2 1023
#define IDC_INSTRUCTION3 1024
+#define IDC_FULLNAME 1025
+#define IDC_BIRTH_DAY 1026
+#define IDC_BIRTH_MONTH 1027
+#define IDC_BIRTH_YEAR 1028
+#define IDC_GENDER 1029
+#define IDC_HOMEPAGE 1030
+#define IDC_LANGUAGE1 1031
+#define IDC_LANGUAGE2 1032
+#define IDC_LANGUAGE3 1033
+#define IDC_HOMEPAGE2 1034
+#define IDC_ABOUT 1034
// Next default values for new objects
//
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index 6651480b88..1b7542f0bf 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -417,93 +417,110 @@ INT_PTR CALLBACK CSkypeProto::SkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam return FALSE;
}
-INT_PTR CALLBACK CSkypeProto::OwnSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK PersonalSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ const unsigned long iPageId = 0;
+ CSkypeProto* ppro = (CSkypeProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (msg) {
case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
+ if (lParam) {
+ ppro = (CSkypeProto*)lParam;
+ TranslateDialogDefault(hwndDlg);
+
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+
+ SendMessage(GetDlgItem(hwndDlg, IDC_GENDER), CB_ADDSTRING, 0, (LPARAM)_T(""));
+ SendMessage(GetDlgItem(hwndDlg, IDC_GENDER), CB_ADDSTRING, 0, (LPARAM)TranslateT("Male"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_GENDER), CB_ADDSTRING, 0, (LPARAM)TranslateT("Female"));
+ for (int i = 1; i < 32; i++)
+ {
+ TCHAR day[3];
+ _itot(i, day, 10);
+ SendMessage(GetDlgItem(hwndDlg, IDC_BIRTH_DAY), CB_ADDSTRING, 0, (LPARAM)day);
+ }
+ for (int i = 1; i < 13; i++)
+ {
+ TCHAR mon[3];
+ _itot(i, mon, 10);
+ SendMessage(GetDlgItem(hwndDlg, IDC_BIRTH_MONTH), CB_ADDSTRING, 0, (LPARAM)mon);
+ }
+ for (int i = 1900; i < 2214; i++)
+ {
+ TCHAR year[5];
+ _itot(i, year, 10);
+ SendMessage(GetDlgItem(hwndDlg, IDC_BIRTH_YEAR), CB_ADDSTRING, 0, (LPARAM)year);
+
+ }
+
+ for (std::map<std::wstring, std::wstring>::iterator it = CSkypeProto::languages.begin(); it != CSkypeProto::languages.end(); ++it)
+ {
+ const wchar_t* value = it->second.c_str();
+ SendMessage(GetDlgItem(hwndDlg, IDC_LANGUAGE1), CB_ADDSTRING, 0, (LPARAM)value);
+ SendMessage(GetDlgItem(hwndDlg, IDC_LANGUAGE2), CB_ADDSTRING, 0, (LPARAM)value);
+ SendMessage(GetDlgItem(hwndDlg, IDC_LANGUAGE3), CB_ADDSTRING, 0, (LPARAM)value);
+ }
+ DBVARIANT dbv;
+ if ( !db_get_ts(NULL, ppro->m_szModuleName, "Nick", &dbv)) {
+ SetDlgItemText(hwndDlg, IDC_FULLNAME, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else
+ SetDlgItemText(hwndDlg, IDC_FULLNAME, _T(""));
+
+ if ( !db_get_ts(NULL, ppro->m_szModuleName, "Homepage", &dbv)) {
+ SetDlgItemText(hwndDlg, IDC_HOMEPAGE, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else
+ SetDlgItemText(hwndDlg, IDC_HOMEPAGE, _T(""));
+
+ if ( !db_get_ts(NULL, ppro->m_szModuleName, "About", &dbv)) {
+ SetDlgItemText(hwndDlg, IDC_ABOUT, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else
+ SetDlgItemText(hwndDlg, IDC_ABOUT, _T(""));
+
+ BYTE b = db_get_b(NULL, ppro->m_szModuleName, "Gender", 0);
+ if (b = 'M')
+ SetDlgItemText(hwndDlg, IDC_GENDER, TranslateT("Male"));
+ else if (b = 'F')
+ SetDlgItemText(hwndDlg, IDC_GENDER, TranslateT("Female"));
+ else
+ SetDlgItemText(hwndDlg, IDC_GENDER, _T(""));
+ BYTE bday = db_get_b(NULL, ppro->m_szModuleName, "BirthDay", 0);
+ if (bday > 1 && bday < 32)
+ SetDlgItemInt(hwndDlg, IDC_BIRTH_DAY, bday, false);
+ BYTE bmon = db_get_b(NULL, ppro->m_szModuleName, "BirthMonth", 0);
+ if (bmon > 1 && bmon < 13)
+ SetDlgItemInt(hwndDlg, IDC_BIRTH_MONTH, bmon, false);
+ WORD byear = db_get_w(NULL, ppro->m_szModuleName, "BirthYear", 0);
+ if (byear > 1900 && bmon < 2214)
+ SetDlgItemInt(hwndDlg, IDC_BIRTH_YEAR, byear, false);
+ }
+ break;
+
+ case WM_COMMAND:
+ if (((HWND)lParam==GetFocus() && HIWORD(wParam)==EN_CHANGE) ||
+ ((HWND)lParam==GetDlgItem(hwndDlg, IDC_GENDER) && (HIWORD(wParam)==CBN_EDITCHANGE||HIWORD(wParam)==CBN_SELCHANGE)))
+ {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
break;
case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
+ if (((LPNMHDR)lParam)->idFrom == 0) {
switch (((LPNMHDR)lParam)->code) {
case PSN_PARAMCHANGED:
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, ((PSHNOTIFY *)lParam)->lParam);
+ SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY*)lParam)->lParam);
break;
-
- case PSN_INFOCHANGED:
- {
- CSkypeProto *ppro = (CSkypeProto *)::GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (!ppro)
- break;
-
- HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
- ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT);
- // Prepare ListView Columns
- LV_COLUMN lvc = {0};
- RECT rc;
- GetClientRect(hwndList, &rc);
- rc.right -= GetSystemMetrics(SM_CXVSCROLL);
- lvc.mask = LVCF_WIDTH;
- lvc.cx = rc.right / 3;
- ListView_InsertColumn(hwndList, 0, &lvc);
- lvc.cx = rc.right - lvc.cx;
- ListView_InsertColumn(hwndList, 1, &lvc);
- // Prepare Setting Items
- LV_ITEM lvi = {0};
- lvi.mask = LVIF_PARAM | LVIF_TEXT;
-
- for (lvi.iItem = 0; lvi.iItem < SIZEOF(CSkypeProto::setting); lvi.iItem++)
- {
- lvi.lParam = lvi.iItem;
- lvi.pszText = (LPTSTR)setting[lvi.iItem].szDescription;
- ListView_InsertItem(hwndList, &lvi);
- wchar_t *text = L"";
- switch(setting[lvi.iItem].dbType) {
- case DBVT_WCHAR:
- text = ::db_get_wsa(NULL, ppro->m_szModuleName, setting[lvi.iItem].szDbSetting);
- break;
- case DBVT_BYTE:
- {
- if (!strcmp(setting[lvi.iItem].szDbSetting, "Gender")) {
- switch(::db_get_b(NULL, ppro->m_szModuleName, setting[lvi.iItem].szDbSetting, 'M')) {
- case 'M':
- text = L"Male";
- break;
- case 'F':
- text = L"Female";
- break;
- }
- } else if (!strcmp(setting[lvi.iItem].szDbSetting, "Timezone")) {
- HANDLE hTimeZone = tmi.createByContact ? tmi.createByContact(NULL, 0) : 0;
- LPCTSTR TzDescr = tmi.getTzDescription(tmi.getTzName(hTimeZone));
- text = mir_tstrdup(TzDescr);
- } else {
- wchar_t tmp[10];
- _ltot(::db_get_b(NULL, ppro->m_szModuleName, setting[lvi.iItem].szDbSetting, 0), tmp, 10);
- text = mir_tstrdup(tmp);
- }
- break;
- }
- case DBVT_WORD:
- {
- wchar_t tmp[10];
- _ltot(::db_get_w(NULL, ppro->m_szModuleName, setting[lvi.iItem].szDbSetting, 0), tmp, 10);
- text = mir_tstrdup(tmp);
- //text = (wchar_t*)ppro->GetSettingWord(setting[lvi.iItem].szDbSetting);
- break;
- }
- }
- ListView_SetItemText(hwndList, lvi.iItem, 1, text);
- if (setting[lvi.iItem].dbType == DBVT_WORD || (strcmp(setting[lvi.iItem].szDbSetting, "Gender") && setting[lvi.iItem].dbType == DBVT_BYTE))
- mir_free(text);
- }
- }
+ case PSN_APPLY:
+ //ppro->SaveVcardToDB(hwndDlg, iPageId);
+ //if ( !ppro->m_vCardUpdates)
+ // ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
break;
- }
- break;
- }
+ } }
break;
}
return FALSE;
@@ -516,7 +533,7 @@ int __cdecl CSkypeProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE odp = {0};
odp.cbSize = sizeof(odp);
- odp.flags = ODPF_TCHAR | ODPF_DONTTRANSLATE;
+ odp.flags = ODPF_TCHAR | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE;
odp.hInstance = g_hInstance;
odp.dwInitParam = LPARAM(this);
odp.position = -1900000000;
@@ -531,8 +548,8 @@ int __cdecl CSkypeProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) UserInfo_AddPage(wParam, &odp);
}
} else {
- odp.pfnDlgProc = OwnSkypeDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OWNINFO_SKYPE);
+ odp.pfnDlgProc = PersonalSkypeDlgProc;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OWNINFO_PERSONAL);
UserInfo_AddPage(wParam, &odp);
}
diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index fe2f5a1d3d..f8c747d49a 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -1,43 +1,6 @@ #include "skype_proto.h"
#include <sstream>
-#define LI_STRING 0
-#define LI_LIST 1
-#define LI_NUMBER 2
-
-SettingItem CSkypeProto::setting[] = {
- {LPGENT("Nick"), "Nick", DBVT_WCHAR, LI_STRING},
- {LPGENT("First name"), "FirstName", DBVT_WCHAR, LI_STRING},
- {LPGENT("Last name"), "LastName", DBVT_WCHAR, LI_STRING},
- {LPGENT("Gender"), "Gender", DBVT_BYTE, LI_LIST},
-
- {LPGENT("Mood"), "XStatusMsg", DBVT_WCHAR, LI_STRING},
-
- {LPGENT("Mobile phone"), "Cellular", DBVT_WCHAR, LI_NUMBER},
- {LPGENT("Home phone"), "Phone", DBVT_WCHAR, LI_NUMBER},
- {LPGENT("Office phone"), "CompanyPhone", DBVT_WCHAR, LI_NUMBER},
-
- {LPGENT("E-mail 1"), "e-mail0", DBVT_WCHAR, LI_STRING},
- {LPGENT("E-mail 2"), "e-mail1", DBVT_WCHAR, LI_STRING},
- {LPGENT("E-mail 3"), "e-mail2", DBVT_WCHAR, LI_STRING},
-
- {LPGENT("Time zone"), "Timezone", DBVT_BYTE, LI_LIST},
- {LPGENT("Country"), "Country", DBVT_WCHAR, LI_LIST},
- {LPGENT("State"), "State", DBVT_WCHAR, LI_STRING},
- {LPGENT("City"), "City", DBVT_WCHAR, LI_STRING},
-
- {LPGENT("Birth day"), "BirthDay", DBVT_BYTE, LI_NUMBER},
- {LPGENT("Birth month"), "BirthMonth", DBVT_BYTE, LI_NUMBER},
- {LPGENT("Birth year"), "BirthYear", DBVT_WORD, LI_NUMBER},
-
- {LPGENT("Language 1"), "Language1", DBVT_WCHAR, LI_LIST},
- {LPGENT("Language 2"), "Language2", DBVT_WCHAR, LI_LIST},
- {LPGENT("Language 3"), "Language3", DBVT_WCHAR, LI_LIST},
-
- {LPGENT("About"), "About", DBVT_WCHAR, LI_STRING},
- {LPGENT("Homepage"), "Homepage", DBVT_WCHAR, LI_STRING}
-};
-
void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HANDLE hContact)
{
uint newTS = hContact ? obj->GetUintProp(Contact::P_AVATAR_TIMESTAMP) : obj->GetUintProp(Account::P_AVATAR_TIMESTAMP);
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index ed9f407c0d..15d1b57b25 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -20,14 +20,6 @@ struct _tag_iconList HANDLE Handle;
};
-struct SettingItem
-{
- const TCHAR *szDescription;
- const char *szDbSetting;
- int dbType; //DBVT_ constant
- unsigned displayType; //LI_ constant
-};
-
struct HtmlEntity
{
const char *entity;
@@ -187,6 +179,7 @@ public: static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam);
bool IsOnline();
+ static std::map<std::wstring, std::wstring> languages;
protected:
CAccount::Ref account;
@@ -312,11 +305,8 @@ protected: void __cdecl SearchByEmailAsync(void*);
// profile
- static std::map<std::wstring, std::wstring> languages;
static std::map<std::wstring, std::wstring> FillLanguages();
- static SettingItem setting[23];
-
void UpdateProfileAvatar(SEObject *obj, HANDLE hContact = NULL);
void UpdateProfileAboutText(SEObject *obj, HANDLE hContact = NULL);
void UpdateProfileBirthday(SEObject *obj, HANDLE hContact = NULL);
|