diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-02-18 19:24:48 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-02-18 19:24:48 +0000 |
commit | 40453965455818d568bf90224b828c3f72b2606d (patch) | |
tree | 896abd9c140e7ccce2302937788ef14027d0142f /protocols/Tox/src/tox_options.cpp | |
parent | a8bb7b8d1f606b887c614d6200840fffb1bd48aa (diff) |
Tox:
- code cleaning
- removed unneeded dependencies
- posible fix for disconnect
git-svn-id: http://svn.miranda-ng.org/main/trunk@12183 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_options.cpp')
-rw-r--r-- | protocols/Tox/src/tox_options.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 77a7e5e806..e99c73dcd5 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -25,16 +25,15 @@ INT_PTR CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l }
ptrT group(proto->getTStringA(TOX_SETTINGS_GROUP));
- if (group)
- SetDlgItemText(hwnd, IDC_GROUP, group);
- else
- SetDlgItemText(hwnd, IDC_GROUP, _T("Tox"));
+ SetDlgItemText(hwnd, IDC_GROUP, group ? group : _T("Tox"));
SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, 64, 0);
CheckDlgButton(hwnd, IDC_DISABLE_UDP, proto->getBool("DisableUDP", 0));
CheckDlgButton(hwnd, IDC_DISABLE_IPV6, proto->getBool("DisableIPv6", 0));
- if (proto->IsOffline())
+ if (!proto->IsToxCoreInited())
+ {
EnableWindow(GetDlgItem(hwnd, IDC_IMPORT_PROFILE), TRUE);
+ }
}
return TRUE;
@@ -90,15 +89,24 @@ INT_PTR CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l if (GetOpenFileName(&ofn))
{
- if (proto->IsOffline()) {
+ if (!proto->IsToxCoreInited())
+ {
std::tstring defaultProfilePath = GetToxProfilePath(proto->accountName);
- if (PathFileExists(defaultProfilePath.c_str()))
- if (MessageBox(hwnd, TranslateT("You have existing profile. Do you want remove it with all tox contacts and history and continue import?"), TranslateT("Tox profile import"), MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) == IDNO)
- break;
- else {
+ if (CToxProto::IsFileExists(defaultProfilePath.c_str()))
+ {
+ if (MessageBox(
+ hwnd,
+ TranslateT("You have existing profile. Do you want remove it with all tox contacts and history and continue import?"),
+ TranslateT("Tox profile import"),
+ MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) == IDYES)
+ {
while (MCONTACT hContact = db_find_first(proto->m_szModuleName))
+ {
CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ }
}
+ else break;
+ }
if (profilePath && _tcslen(profilePath))
{
if (_tcsicmp(profilePath, defaultProfilePath.c_str()) != 0)
|