summaryrefslogtreecommitdiff
path: root/plugins/DbChecker
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-07-20 11:09:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-07-20 11:09:16 +0000
commite35464b3a1c3a5af68b348803049d90d73c1bc0d (patch)
treebe5f05a3cb1b490653132afb735d9befeba4352b /plugins/DbChecker
parent7663d8886a2e059232287b6652ead02142f6d6fc (diff)
all profile conversion stuff moved to dbchecker
git-svn-id: http://svn.miranda-ng.org/main/trunk@9880 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/DbChecker')
-rw-r--r--plugins/DbChecker/src/dbchecker.h1
-rw-r--r--plugins/DbChecker/src/finished.cpp2
-rw-r--r--plugins/DbChecker/src/main.cpp8
-rw-r--r--plugins/DbChecker/src/progress.cpp7
-rw-r--r--plugins/DbChecker/src/selectdb.cpp9
-rw-r--r--plugins/DbChecker/src/wizard.cpp7
6 files changed, 23 insertions, 11 deletions
diff --git a/plugins/DbChecker/src/dbchecker.h b/plugins/DbChecker/src/dbchecker.h
index a487bf3dd9..1e97526d96 100644
--- a/plugins/DbChecker/src/dbchecker.h
+++ b/plugins/DbChecker/src/dbchecker.h
@@ -57,6 +57,7 @@ extern HINSTANCE hInst;
extern DbToolOptions opts;
extern HANDLE hEventRun, hEventAbort;
extern int errorCount;
+extern LRESULT wizardResult;
extern bool bServiceMode, bLaunchMiranda, bShortMode;
int DoMyControlProcessing(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam, INT_PTR *bReturn);
diff --git a/plugins/DbChecker/src/finished.cpp b/plugins/DbChecker/src/finished.cpp
index 47b272860f..6fc21564d3 100644
--- a/plugins/DbChecker/src/finished.cpp
+++ b/plugins/DbChecker/src/finished.cpp
@@ -44,7 +44,7 @@ INT_PTR CALLBACK FinishedDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
case WZN_CANCELCLICKED:
bLaunchMiranda = IsDlgButtonChecked(hdlg, IDC_LAUNCHMIRANDA) == BST_CHECKED;
CallService(MS_DB_SETDEFAULTPROFILE, (WPARAM)opts.filename, 0);
- EndDialog(GetParent(hdlg), 1);
+ wizardResult = 1;
return TRUE;
}
return FALSE;
diff --git a/plugins/DbChecker/src/main.cpp b/plugins/DbChecker/src/main.cpp
index cc09e35f78..ffd53b4b23 100644
--- a/plugins/DbChecker/src/main.cpp
+++ b/plugins/DbChecker/src/main.cpp
@@ -67,13 +67,13 @@ static INT_PTR ServiceMode(WPARAM, LPARAM)
return (bLaunchMiranda) ? SERVICE_CONTINUE : SERVICE_FAILED;
}
-static INT_PTR CheckProfile(WPARAM wParam, LPARAM)
+static INT_PTR CheckProfile(WPARAM wParam, LPARAM lParam)
{
bShortMode = true;
- bLaunchMiranda = bServiceMode = false;
+ bLaunchMiranda = lParam != 0;
+ bServiceMode = false;
_tcsncpy(opts.filename, (TCHAR*)wParam, SIZEOF(opts.filename));
- DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc);
- return 0;
+ return DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc);
}
extern "C" __declspec(dllexport) int Load(void)
diff --git a/plugins/DbChecker/src/progress.cpp b/plugins/DbChecker/src/progress.cpp
index 467111a40b..ad12ca550c 100644
--- a/plugins/DbChecker/src/progress.cpp
+++ b/plugins/DbChecker/src/progress.cpp
@@ -26,6 +26,7 @@ static HWND hwndStatus, hdlgProgress, hwndBar;
static bool bShortModeDone;
HANDLE hEventRun = NULL, hEventAbort = NULL;
int errorCount;
+LRESULT wizardResult;
void AddToStatus(int flags, const TCHAR* fmt, ...)
{
@@ -177,7 +178,9 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
case WZN_CANCELCLICKED:
if (bShortModeDone) {
- EndDialog( GetParent(hdlg), 1);
+ if (bLaunchMiranda)
+ CallService(MS_DB_SETDEFAULTPROFILE, (WPARAM)opts.filename, 0);
+ wizardResult = 1;
return TRUE;
}
@@ -211,11 +214,13 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
else
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc);
break;
+
case IDOK:
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FINISHED, (LPARAM)FinishedDlgProc);
break;
}
break;
+
case WM_DESTROY:
if (hEventAbort) {
CloseHandle(hEventAbort);
diff --git a/plugins/DbChecker/src/selectdb.cpp b/plugins/DbChecker/src/selectdb.cpp
index a013835748..c5455ef4fd 100644
--- a/plugins/DbChecker/src/selectdb.cpp
+++ b/plugins/DbChecker/src/selectdb.cpp
@@ -31,6 +31,7 @@ static bool CheckBroken(const TCHAR *ptszFullPath)
int OpenDatabase(HWND hdlg, INT iNextPage)
{
TCHAR tszMsg[1024];
+ int error = 0;
if (opts.dbChecker == NULL) {
DATABASELINK* dblink = FindDatabasePlugin(opts.filename);
@@ -50,7 +51,6 @@ LBL_Error:
goto LBL_Error;
}
- int error = 0;
opts.dbChecker = dblink->CheckDB(opts.filename, &error);
if (opts.dbChecker == NULL) {
if ((opts.error = GetLastError()) == 0)
@@ -61,7 +61,12 @@ LBL_Error:
opts.dblink = dblink;
}
- if (iNextPage == IDD_FILEACCESS)
+ // force check
+ if (error == EGROKPRF_OBSOLETE) {
+ opts.bAggressive = opts.bBackup = true;
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc);
+ }
+ else if (iNextPage == IDD_FILEACCESS)
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
else
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc);
diff --git a/plugins/DbChecker/src/wizard.cpp b/plugins/DbChecker/src/wizard.cpp
index e3641f7cf8..ca4b95885d 100644
--- a/plugins/DbChecker/src/wizard.cpp
+++ b/plugins/DbChecker/src/wizard.cpp
@@ -98,7 +98,6 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP
case WM_INITDIALOG:
SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_DBTOOL)));
hdlgPage = NULL;
- bLaunchMiranda = false;
if (bShortMode)
SendMessage(hdlg, WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
else
@@ -125,9 +124,11 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP
SendMessage(hdlgPage, WZN_PAGECHANGING, wParam, 0);
SendMessage(hdlgPage, message, wParam, lParam);
break;
+
case IDCANCEL:
- if (SendMessage(hdlgPage, WZN_CANCELCLICKED, 0, 0)) break;
- EndDialog(hdlg, 0);
+ wizardResult = 0;
+ SendMessage(hdlgPage, WZN_CANCELCLICKED, 0, 0);
+ EndDialog(hdlg, wizardResult);
break;
}
break;