diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-08 12:55:07 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-08 12:55:07 +0000 |
commit | fa488438351d7d5930a281b9293e7fb853f41eed (patch) | |
tree | 5a87a78c24a35a774876b1621e7fce82b7dd67db /src/modules/database | |
parent | e49f7274e01028a839a50af64af4bb8d46311218 (diff) |
- added 'Retry' button to the profile opening dialog;
git-svn-id: http://svn.miranda-ng.org/main/trunk@359 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/database')
-rw-r--r-- | src/modules/database/database.cpp | 54 |
1 files changed, 30 insertions, 24 deletions
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);
}
|