From fa488438351d7d5930a281b9293e7fb853f41eed Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 8 Jun 2012 12:55:07 +0000 Subject: - added 'Retry' button to the profile opening dialog; git-svn-id: http://svn.miranda-ng.org/main/trunk@359 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/database/database.cpp | 54 ++++++++++++++++++++----------------- src/modules/protocols/protoopts.cpp | 2 -- 2 files changed, 30 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index 76685ac795..a2cae1e64b 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -531,33 +531,39 @@ int LoadDatabaseModule(void) else dbe.pfnEnumCallback=( int(*) (const char*,void*,LPARAM) )FindDbPluginForProfile; - // find a driver to support the given profile - int rc = CallService(MS_PLUGINS_ENUMDBPLUGINS, 0, (LPARAM)&dbe); - switch ( rc ) { - case -1: { - // no plugins at all - TCHAR buf[256]; - TCHAR* p = _tcsrchr(szProfile,'\\'); - mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_3x.dll or equivalent."), p ? ++p : szProfile ); - MessageBox(0,buf,TranslateT("No profile support installed!"),MB_OK | MB_ICONERROR); - break; - } - case 1: - // if there were drivers but they all failed cos the file is locked, try and find the miranda which locked it - if (fileExist(szProfile)) { - // file isn't locked, just no driver could open it. + // find a driver to support the given profile + bool retry; + int rc; + do { + retry = false; + rc = CallService(MS_PLUGINS_ENUMDBPLUGINS, 0, (LPARAM)&dbe); + switch ( rc ) { + case -1: { + // no plugins at all TCHAR buf[256]; TCHAR* p = _tcsrchr(szProfile,'\\'); - mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda was unable to open '%s', it's in an unknown format.\nThis profile might also be damaged, please run DB-tool which should be installed."), p ? ++p : szProfile); - MessageBox(0,buf,TranslateT("Miranda can't understand that profile"),MB_OK | MB_ICONERROR); + mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_3x.dll or equivalent."), p ? ++p : szProfile ); + MessageBox(0,buf,TranslateT("No profile support installed!"),MB_OK | MB_ICONERROR); + break; } - else if (!FindMirandaForProfile(szProfile)) { - TCHAR buf[256]; - TCHAR* p = _tcsrchr(szProfile,'\\'); - mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda was unable to open '%s'\nIt's inaccessible or used by other application or Miranda instance"), p ? ++p : szProfile); - MessageBox(0,buf,TranslateT("Miranda can't open that profile"),MB_OK | MB_ICONERROR); + case 1: + // if there were drivers but they all failed cos the file is locked, try and find the miranda which locked it + if (fileExist(szProfile)) { + // file isn't locked, just no driver could open it. + TCHAR buf[256]; + TCHAR* p = _tcsrchr(szProfile,'\\'); + mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda was unable to open '%s', it's in an unknown format.\nThis profile might also be damaged, please run DB-tool which should be installed."), p ? ++p : szProfile); + MessageBox(0,buf,TranslateT("Miranda can't understand that profile"),MB_OK | MB_ICONERROR); + } + else if (!FindMirandaForProfile(szProfile)) { + TCHAR buf[256]; + TCHAR* p = _tcsrchr(szProfile,'\\'); + mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda was unable to open '%s'\nIt's inaccessible or used by other application or Miranda instance"), p ? ++p : szProfile); + retry = MessageBox(0,buf,TranslateT("Miranda can't open that profile"),MB_RETRYCANCEL | MB_ICONERROR) == IDRETRY; + } + break; } - break; - } + } while (retry); + return (rc != 0); } diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index c98445cfbd..4fcb5b7e18 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.cpp @@ -723,8 +723,6 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg,UINT message, WPARAM wParam, LPARAM if ( pa->bOldProto || pa->bDynDisabled ) AppendMenu(hMenu, MF_STRING, 5, TranslateT("Upgrade")); - AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); - AppendMenu(hMenu, MF_STRING, 0, TranslateT("Cancel")); switch (TrackPopupMenu( hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL )) { case 1: PostMessage(hwndList, WM_MY_RENAME, 0, 0); -- cgit v1.2.3