diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2016-03-30 10:28:13 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2016-03-30 10:28:13 +0000 |
commit | 1c2541a00e52e5dd11c8e5d1036c8208b801b25c (patch) | |
tree | 91bd315067ab922b48a74911d76ca75981392eb3 /protocols/VKontakte/src/vk_wallpost.cpp | |
parent | 41fa778883c3bbb5c14470b66c35304f894012c6 (diff) |
VKontakte: wall post dialog -> core ui
git-svn-id: http://svn.miranda-ng.org/main/trunk@16564 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_wallpost.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_wallpost.cpp | 70 |
1 files changed, 2 insertions, 68 deletions
diff --git a/protocols/VKontakte/src/vk_wallpost.cpp b/protocols/VKontakte/src/vk_wallpost.cpp index 909d167269..8adf6e2deb 100644 --- a/protocols/VKontakte/src/vk_wallpost.cpp +++ b/protocols/VKontakte/src/vk_wallpost.cpp @@ -17,79 +17,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-struct WALLPOST_FORM_PARAMS
-{
- TCHAR* ptszMsg;
- TCHAR* ptszUrl;
- TCHAR* ptszNick;
- bool bFriendsOnly;
-
- WALLPOST_FORM_PARAMS(TCHAR* nick) :
- ptszNick(nick),
- bFriendsOnly(false)
- {
- ptszMsg = ptszUrl = NULL;
- }
-
- ~WALLPOST_FORM_PARAMS()
- {
- mir_free(ptszMsg);
- mir_free(ptszUrl);
- mir_free(ptszNick);
- }
-};
-
-static INT_PTR CALLBACK WallPostFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- WALLPOST_FORM_PARAMS *param = (WALLPOST_FORM_PARAMS *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- param = (WALLPOST_FORM_PARAMS *)lParam;
- TranslateDialogDefault(hwndDlg);
- {
- SetDlgItemText(hwndDlg, IDC_ST_WARNING, _T(""));
- CMString tszTitle(FORMAT, _T("%s %s"), TranslateT("Wall message for"), param->ptszNick);
- SetWindowText(hwndDlg, tszTitle);
- }
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)param);
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCANCEL:
- EndDialog(hwndDlg, 0);
- return TRUE;
-
- case IDOK:
- TCHAR tszMsg[4096], tszUrl[4096];
- GetDlgItemText(hwndDlg, IDC_ED_MSG, tszMsg, _countof(tszMsg));
- GetDlgItemText(hwndDlg, IDC_ED_URL, tszUrl, _countof(tszUrl));
-
- if (IsEmpty(tszMsg) && IsEmpty(tszUrl)) {
- SetDlgItemText(hwndDlg, IDC_ST_WARNING, TranslateT("Attention! Message body or url should not be empty!"));
- return FALSE;
- }
-
- if (!IsEmpty(tszMsg))
- param->ptszMsg = mir_tstrdup(tszMsg);
- if (!IsEmpty(tszUrl))
- param->ptszUrl = mir_tstrdup(tszUrl);
-
- param->bFriendsOnly = IsDlgButtonChecked(hwndDlg, IDC_ONLY_FRIENDS) == BST_CHECKED;
- EndDialog(hwndDlg, (INT_PTR)param);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
INT_PTR __cdecl CVkProto::SvcWallPost(WPARAM hContact, LPARAM)
{
debugLogA("CVkProto::SvcWallPost");
WALLPOST_FORM_PARAMS param(db_get_tsa(hContact, m_szModuleName, "Nick"));
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_WALLPOST), NULL, WallPostFormDlgProc, (LPARAM)¶m) == 0)
+ WallPostForm dlg(this, ¶m);
+ if (!dlg.DoModal())
return 1;
WallPost((MCONTACT)hContact, param.ptszMsg, param.ptszUrl, param.bFriendsOnly);
|