From 8e146597bbd27b72a42a3a197c1db17153e2e0b3 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sat, 23 May 2015 20:25:54 +0000 Subject: Tox: options fix git-svn-id: http://svn.miranda-ng.org/main/trunk@13796 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/res/resource.rc | 8 ++++---- protocols/Tox/src/tox_options.cpp | 10 ---------- protocols/Tox/src/tox_services.cpp | 10 +++++----- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/protocols/Tox/res/resource.rc b/protocols/Tox/res/resource.rc index 75d69c6295..09ca8feb54 100644 --- a/protocols/Tox/res/resource.rc +++ b/protocols/Tox/res/resource.rc @@ -79,13 +79,13 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "Tox ID:",IDC_STATIC,0,5,49,8 - EDITTEXT IDC_PASSWORD,49,52,135,12,ES_PASSWORD | ES_AUTOHSCROLL | NOT WS_VISIBLE | WS_DISABLED + EDITTEXT IDC_PASSWORD,49,52,135,12,ES_PASSWORD | ES_AUTOHSCROLL | NOT WS_VISIBLE PUSHBUTTON "Create",IDC_PROFILE_NEW,49,19,65,13 PUSHBUTTON "Import",IDC_PROFILE_IMPORT,120,19,65,13 PUSHBUTTON "Copy ID",IDC_CLIPBOARD,49,19,65,13,NOT WS_VISIBLE PUSHBUTTON "Export",IDC_PROFILE_EXPORT,120,19,65,13,NOT WS_VISIBLE LTEXT "Name:",IDC_STATIC,0,38,49,12 - EDITTEXT IDC_NAME,49,36,135,12,ES_AUTOHSCROLL | WS_DISABLED + EDITTEXT IDC_NAME,49,36,135,12,ES_AUTOHSCROLL LTEXT "Password:",IDC_STATIC,0,54,49,12,NOT WS_VISIBLE EDITTEXT IDC_TOXID,49,3,135,12,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED LTEXT "Default group:",IDC_STATIC,0,70,49,12 @@ -101,9 +101,9 @@ BEGIN LTEXT "Tox ID:",IDC_STATIC,12,17,69,11 EDITTEXT IDC_TOXID,81,15,217,12,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED LTEXT "Name:",IDC_STATIC,12,48,69,11 - EDITTEXT IDC_NAME,81,46,217,12,ES_AUTOHSCROLL | WS_DISABLED + EDITTEXT IDC_NAME,81,46,217,12,ES_AUTOHSCROLL LTEXT "Password:",IDC_STATIC,12,63,69,8,NOT WS_VISIBLE - EDITTEXT IDC_PASSWORD,81,62,217,12,ES_PASSWORD | ES_AUTOHSCROLL | NOT WS_VISIBLE | WS_DISABLED + EDITTEXT IDC_PASSWORD,81,62,217,12,ES_PASSWORD | ES_AUTOHSCROLL | NOT WS_VISIBLE LTEXT "Default group:",IDC_STATIC,12,80,69,12 EDITTEXT IDC_GROUP,81,78,217,12,ES_AUTOHSCROLL PUSHBUTTON "Create tox profile",IDC_PROFILE_NEW,81,30,107,13 diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 71cbb5fd7e..0023c60141 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -38,12 +38,6 @@ void CToxOptionsMain::OnInitDialog() ShowWindow(m_profileExport.GetHwnd(), TRUE); } - if (m_proto->IsOnline()) - { - EnableWindow(m_nickname.GetHwnd(), TRUE); - EnableWindow(m_password.GetHwnd(), TRUE); - } - SendMessage(m_toxAddress.GetHwnd(), EM_LIMITTEXT, TOX_ADDRESS_SIZE * 2, 0); SendMessage(m_nickname.GetHwnd(), EM_LIMITTEXT, TOX_MAX_NAME_LENGTH, 0); SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 32, 0); @@ -164,15 +158,11 @@ void CToxOptionsMain::ProfileExport_OnClick(CCtrlButton*) ofn.lpstrInitialDir = _T("%HOMEPATH%"); if (!GetSaveFileName(&ofn)) - { return; - } std::tstring defaultProfilePath = m_proto->GetToxProfilePath(); if (mir_tstrcmpi(profilePath, defaultProfilePath.c_str()) != 0) - { CopyFile(defaultProfilePath.c_str(), profilePath, FALSE); - } } void CToxOptionsMain::OnApply() diff --git a/protocols/Tox/src/tox_services.cpp b/protocols/Tox/src/tox_services.cpp index f42a3d35c0..c9fc238f34 100644 --- a/protocols/Tox/src/tox_services.cpp +++ b/protocols/Tox/src/tox_services.cpp @@ -5,12 +5,12 @@ INT_PTR CToxProto::SetMyNickname(WPARAM wParam, LPARAM lParam) ptrT nickname((wParam & SMNN_UNICODE) ? mir_u2t((TCHAR*)lParam) : mir_a2t((char*)lParam)); setTString("Nick", nickname); - T2Utf szNick8(nickname); - TOX_ERR_SET_INFO error; - if (!tox_self_set_name(tox, szNick8, mir_strlen(szNick8), &error)) + if (IsOnline()) { - debugLogA(__FUNCTION__": failed to set nick name"); - return 1; + T2Utf szNick8(nickname); + TOX_ERR_SET_INFO error; + if (!tox_self_set_name(tox, szNick8, mir_strlen(szNick8), &error)) + debugLogA(__FUNCTION__": failed to set nick name"); } return 0; -- cgit v1.2.3