summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_options.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-02-18 19:24:48 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-02-18 19:24:48 +0000
commit40453965455818d568bf90224b828c3f72b2606d (patch)
tree896abd9c140e7ccce2302937788ef14027d0142f /protocols/Tox/src/tox_options.cpp
parenta8bb7b8d1f606b887c614d6200840fffb1bd48aa (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.cpp28
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)