summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_database.h9
-rw-r--r--plugins/DbChecker/src/cleaning.cpp4
-rw-r--r--plugins/DbChecker/src/dbchecker.h2
-rw-r--r--plugins/DbChecker/src/fileaccess.cpp8
-rw-r--r--plugins/DbChecker/src/main.cpp19
-rw-r--r--plugins/DbChecker/src/openerror.cpp5
-rw-r--r--plugins/DbChecker/src/progress.cpp34
-rw-r--r--plugins/DbChecker/src/selectdb.cpp12
-rw-r--r--plugins/DbChecker/src/welcome.cpp2
-rw-r--r--plugins/DbChecker/src/wizard.cpp15
-rw-r--r--plugins/Dbx_tree/DataBase.cpp38
-rw-r--r--plugins/Dbx_tree/DatabaseLink.cpp4
-rw-r--r--src/modules/database/profilemanager.cpp56
-rw-r--r--src/modules/plugins/newplugins.cpp19
14 files changed, 158 insertions, 69 deletions
diff --git a/include/m_database.h b/include/m_database.h
index f10cb76bfd..e39fb8b884 100644
--- a/include/m_database.h
+++ b/include/m_database.h
@@ -129,6 +129,15 @@ Analog of Database/DefaultProfile in mirandaboot.ini
#define MS_DB_SETDEFAULTPROFILE "DB/SetDefaultProfile"
+/* DB/CheckProfile service
+Checks the specified profile like dbtool did.
+Implemented in the dbchecker plugins, thus it might not exist
+ wParam = (WPARAM)(TCHAR*)ptszProfileName
+ lParam = 0 (unused)
+*/
+
+#define MS_DB_CHECKPROFILE "DB/CheckProfile"
+
/************************* Contact ********************************/
/* DB/Contact/GetSetting service
diff --git a/plugins/DbChecker/src/cleaning.cpp b/plugins/DbChecker/src/cleaning.cpp
index bd8f296afb..b40bdb7244 100644
--- a/plugins/DbChecker/src/cleaning.cpp
+++ b/plugins/DbChecker/src/cleaning.cpp
@@ -43,9 +43,9 @@ INT_PTR CALLBACK CleaningDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
switch(LOWORD(wParam)) {
case IDC_BACK:
if (opts.bCheckOnly)
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
else
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
break;
case IDOK:
diff --git a/plugins/DbChecker/src/dbchecker.h b/plugins/DbChecker/src/dbchecker.h
index 51a8466c7c..4039cab040 100644
--- a/plugins/DbChecker/src/dbchecker.h
+++ b/plugins/DbChecker/src/dbchecker.h
@@ -67,7 +67,7 @@ extern HINSTANCE hInst;
extern DbToolOptions opts;
extern HANDLE hEventRun, hEventAbort;
extern int errorCount;
-extern bool bServiceMode, bLaunchMiranda;
+extern bool bServiceMode, bLaunchMiranda, bShortMode;
int DoMyControlProcessing(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam, INT_PTR *bReturn);
diff --git a/plugins/DbChecker/src/fileaccess.cpp b/plugins/DbChecker/src/fileaccess.cpp
index ef19a1244f..b785d733d5 100644
--- a/plugins/DbChecker/src/fileaccess.cpp
+++ b/plugins/DbChecker/src/fileaccess.cpp
@@ -26,6 +26,8 @@ INT_PTR CALLBACK FileAccessDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
switch(message) {
case WM_INITDIALOG:
+ if (bShortMode)
+ EnableWindow(GetDlgItem(GetParent(hdlg), IDC_BACK), FALSE);
CheckDlgButton(hdlg, IDC_CHECKONLY, opts.bCheckOnly);
CheckDlgButton(hdlg, IDC_BACKUP, opts.bBackup);
CheckDlgButton(hdlg, IDC_AGGRESSIVE, opts.bAggressive);
@@ -43,14 +45,14 @@ INT_PTR CALLBACK FileAccessDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDC_BACK:
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
break;
case IDOK:
if (opts.bCheckOnly)
- OpenDatabase(hdlg, IDD_PROGRESS);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc);
else
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc);
break;
case IDC_CHECKONLY:
diff --git a/plugins/DbChecker/src/main.cpp b/plugins/DbChecker/src/main.cpp
index 4a98a5dd1d..a36f74f340 100644
--- a/plugins/DbChecker/src/main.cpp
+++ b/plugins/DbChecker/src/main.cpp
@@ -22,9 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
HINSTANCE hInst;
int hLangpack = 0;
-bool bServiceMode = false, bLaunchMiranda = false;
-
-static HANDLE hLaunchFunc;
+bool bServiceMode, bLaunchMiranda, bShortMode;
DbToolOptions opts = {0};
@@ -63,22 +61,31 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_SERVICE
static INT_PTR ServiceMode(WPARAM, LPARAM)
{
- bLaunchMiranda = false;
+ bLaunchMiranda = bShortMode = false;
bServiceMode = true;
DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc);
return (bLaunchMiranda) ? SERVICE_CONTINUE : SERVICE_FAILED;
}
+static INT_PTR CheckProfile(WPARAM wParam, LPARAM)
+{
+ bShortMode = true;
+ bLaunchMiranda = bServiceMode = false;
+ _tcsncpy(opts.filename, (TCHAR*)wParam, SIZEOF(opts.filename));
+ DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc);
+ return 0;
+}
+
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfoEx);
- hLaunchFunc = CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceMode);
+ CreateServiceFunction(MS_DB_CHECKPROFILE, CheckProfile);
+ CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceMode);
return 0;
}
extern "C" __declspec(dllexport) int Unload(void)
{
- DestroyServiceFunction(hLaunchFunc);
return 0;
}
diff --git a/plugins/DbChecker/src/openerror.cpp b/plugins/DbChecker/src/openerror.cpp
index 0ae07ed2c4..5f8b769af6 100644
--- a/plugins/DbChecker/src/openerror.cpp
+++ b/plugins/DbChecker/src/openerror.cpp
@@ -21,8 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
INT_PTR bReturn;
+ if ( DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn))
+ return bReturn;
- if (DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn)) return bReturn;
switch(message) {
case WM_INITDIALOG:
{
@@ -39,7 +40,7 @@ INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDC_BACK:
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
break;
case IDOK:
diff --git a/plugins/DbChecker/src/progress.cpp b/plugins/DbChecker/src/progress.cpp
index 4fe976f61f..f223066b1d 100644
--- a/plugins/DbChecker/src/progress.cpp
+++ b/plugins/DbChecker/src/progress.cpp
@@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void __cdecl WorkerThread(void *unused);
static HWND hwndStatus, hdlgProgress, hwndBar;
+static bool bShortModeDone;
HANDLE hEventRun = NULL, hEventAbort = NULL;
int errorCount;
@@ -74,6 +75,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
hdlgProgress = hdlg;
hwndStatus = GetDlgItem(hdlg, IDC_STATUS);
errorCount = 0;
+ bShortModeDone = false;
hwndBar = GetDlgItem(hdlg, IDC_PROGRESS);
SendMessage(hwndBar, PBM_SETRANGE, 0, MAKELPARAM(0, 1000));
{
@@ -147,25 +149,41 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
case WM_PROCESSINGDONE:
SetProgressBar(1000);
- EnableWindow(GetDlgItem(GetParent(hdlg), IDOK), TRUE);
+ if (bShortMode) {
+ EnableWindow(GetDlgItem(GetParent(hdlg), IDC_BACK), FALSE);
+ EnableWindow(GetDlgItem(GetParent(hdlg), IDOK), FALSE);
+ SetDlgItemText(GetParent(hdlg), IDCANCEL, TranslateT("&Finish"));
+ bShortModeDone = true;
+ }
+ else {
+ AddToStatus(STATUS_SUCCESS, TranslateT("Click Next to continue"));
+ EnableWindow(GetDlgItem(GetParent(hdlg), IDOK), TRUE);
+ }
+
if (manualAbort == 1)
EndDialog(GetParent(hdlg), 0);
else if (manualAbort == 2) {
if (opts.bCheckOnly)
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
else {
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc);
CloseHandle(opts.hOutFile);
opts.hOutFile = NULL;
}
break;
}
- AddToStatus(STATUS_SUCCESS, TranslateT("Click Next to continue"));
break;
case WZN_CANCELCLICKED:
+ if (bShortModeDone) {
+ EndDialog( GetParent(hdlg), 1);
+ return TRUE;
+ }
+
ResetEvent(hEventRun);
- if (IsWindowEnabled(GetDlgItem(GetParent(hdlg), IDOK))) break;
+ if (IsWindowEnabled(GetDlgItem(GetParent(hdlg), IDOK)))
+ break;
+
if (MessageBox(hdlg, TranslateT("Processing has not yet completed, if you cancel now then the changes that have currently been made will be rolled back and the original database will be restored. Do you still want to cancel?"), TranslateT("Miranda Database Tool"), MB_YESNO) == IDYES) {
manualAbort = 1;
SetEvent(hEventAbort);
@@ -188,12 +206,12 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
}
SetEvent(hEventRun);
if (opts.bCheckOnly)
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
else
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc);
break;
case IDOK:
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FINISHED, (LPARAM)FinishedDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FINISHED, (LPARAM)FinishedDlgProc);
break;
}
break;
diff --git a/plugins/DbChecker/src/selectdb.cpp b/plugins/DbChecker/src/selectdb.cpp
index a8b40af3d8..dbd7e8baaa 100644
--- a/plugins/DbChecker/src/selectdb.cpp
+++ b/plugins/DbChecker/src/selectdb.cpp
@@ -44,16 +44,16 @@ LBL_Error:
opts.dbChecker = dblink->CheckDB(opts.filename, &error);
if (opts.dbChecker == NULL) {
opts.error = error;
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_OPENERROR, (LPARAM)OpenErrorDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_OPENERROR, (LPARAM)OpenErrorDlgProc);
return;
}
opts.dblink = dblink;
}
if (iNextPage == IDD_FILEACCESS)
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
else
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc);
}
void GetProfileDirectory(TCHAR* szMirandaDir, TCHAR* szPath, int cbPath)
@@ -237,6 +237,9 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
opts.dbChecker->Destroy();
opts.dbChecker = NULL;
}
+
+ if (bShortMode)
+ OpenDatabase(hdlg, IDD_FILEACCESS);
return TRUE;
case WZN_PAGECHANGING:
@@ -286,7 +289,8 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
break;
case IDC_BACK:
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_WELCOME, (LPARAM)WelcomeDlgProc);
+ if (!bShortMode)
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_WELCOME, (LPARAM)WelcomeDlgProc);
break;
case IDOK:
diff --git a/plugins/DbChecker/src/welcome.cpp b/plugins/DbChecker/src/welcome.cpp
index 99d7a3091a..214514715e 100644
--- a/plugins/DbChecker/src/welcome.cpp
+++ b/plugins/DbChecker/src/welcome.cpp
@@ -56,7 +56,7 @@ INT_PTR CALLBACK WelcomeDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDOK:
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
+ PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
break;
}
break;
diff --git a/plugins/DbChecker/src/wizard.cpp b/plugins/DbChecker/src/wizard.cpp
index 7a49a06daf..bfc5c5774e 100644
--- a/plugins/DbChecker/src/wizard.cpp
+++ b/plugins/DbChecker/src/wizard.cpp
@@ -98,7 +98,10 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP
SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_DBTOOL)));
hdlgPage = NULL;
bLaunchMiranda = false;
- SendMessage(hdlg, WZM_GOTOPAGE, IDD_WELCOME, (LPARAM)WelcomeDlgProc);
+ if (bShortMode)
+ SendMessage(hdlg, WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
+ else
+ SendMessage(hdlg, WZM_GOTOPAGE, IDD_WELCOME, (LPARAM)WelcomeDlgProc);
TranslateDialogDefault(hdlg);
return TRUE;
@@ -138,8 +141,14 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP
CloseHandle(opts.hOutFile);
DestroyWindow(hdlgPage);
- if (hBoldFont != NULL) DeleteObject(hBoldFont);
- if (hEmfHeaderLogo != NULL) DeleteEnhMetaFile(hEmfHeaderLogo);
+ if (hBoldFont != NULL) {
+ DeleteObject(hBoldFont);
+ hBoldFont = NULL;
+ }
+ if (hEmfHeaderLogo != NULL) {
+ DeleteEnhMetaFile(hEmfHeaderLogo);
+ hEmfHeaderLogo = NULL;
+ }
break;
}
return FALSE;
diff --git a/plugins/Dbx_tree/DataBase.cpp b/plugins/Dbx_tree/DataBase.cpp
index b685981037..033e472c9d 100644
--- a/plugins/Dbx_tree/DataBase.cpp
+++ b/plugins/Dbx_tree/DataBase.cpp
@@ -106,25 +106,25 @@ int CDataBase::CheckFile(TDBFileType Index)
HANDLE htmp = CreateFile(m_FileName[Index], GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL);
if (htmp != INVALID_HANDLE_VALUE)
{
- SetFilePointer(htmp, 0, NULL, FILE_BEGIN);
- if (ReadFile(htmp, &h, sizeof(h), &r, NULL))
- {
- if (0 != memcmp(h.Gen.Signature, cFileSignature[Index], sizeof(cFileSignature[Index])))
- {
- CloseHandle(htmp);
- return EGROKPRF_UNKHEADER;
- }
-
- if (cDBVersion < h.Gen.Version)
- {
- CloseHandle(htmp);
- return EGROKPRF_VERNEWER;
- }
-
- CloseHandle(htmp);
- return EGROKPRF_NOERROR;
- }
- CloseHandle(htmp);
+ SetFilePointer(htmp, 0, NULL, FILE_BEGIN);
+ if (ReadFile(htmp, &h, sizeof(h), &r, NULL))
+ {
+ if (0 != memcmp(h.Gen.Signature, cFileSignature[Index], sizeof(cFileSignature[Index])))
+ {
+ CloseHandle(htmp);
+ return EGROKPRF_UNKHEADER;
+ }
+
+ if (cDBVersion < h.Gen.Version)
+ {
+ CloseHandle(htmp);
+ return EGROKPRF_VERNEWER;
+ }
+
+ CloseHandle(htmp);
+ return EGROKPRF_NOERROR;
+ }
+ CloseHandle(htmp);
}
return EGROKPRF_CANTREAD;
diff --git a/plugins/Dbx_tree/DatabaseLink.cpp b/plugins/Dbx_tree/DatabaseLink.cpp
index 579076613d..79c1758fca 100644
--- a/plugins/Dbx_tree/DatabaseLink.cpp
+++ b/plugins/Dbx_tree/DatabaseLink.cpp
@@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static int makeDatabase(const TCHAR *profile)
{
std::auto_ptr<CDataBase> db( new CDataBase(profile));
- return gDataBase->CreateDB();
+ return db->CreateDB();
}
/*
@@ -54,7 +54,7 @@ static int makeDatabase(const TCHAR *profile)
static int grokHeader(const TCHAR *profile)
{
std::auto_ptr<CDataBase> db( new CDataBase(profile));
- return gDataBase->CheckDB();
+ return db->CheckDB();
}
/*
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp
index 2d9b003e9a..3238f14e87 100644
--- a/src/modules/database/profilemanager.cpp
+++ b/src/modules/database/profilemanager.cpp
@@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "profilemanager.h"
#include <sys/stat.h>
+void EnsureCheckerLoaded(void);
+
#define WM_INPUTCHANGED (WM_USER + 0x3000)
#define WM_FOCUSTEXTBOX (WM_USER + 0x3001)
@@ -286,7 +288,25 @@ BOOL EnumProfilesForList(TCHAR *fullpath, TCHAR *profile, LPARAM lParam)
return TRUE;
}
-void DeleteProfile(HWND hwndList, int iItem, DlgProfData* dat)
+void CheckProfile(HWND hwndList, int iItem, DlgProfData *dat)
+{
+ if (iItem < 0)
+ return;
+
+ TCHAR profile[MAX_PATH], fullName[MAX_PATH];
+ LVITEM item = {0};
+ item.mask = LVIF_TEXT;
+ item.iItem = iItem;
+ item.pszText = profile;
+ item.cchTextMax = SIZEOF(profile);
+ if ( !ListView_GetItem(hwndList, &item))
+ return;
+
+ mir_sntprintf(fullName, SIZEOF(fullName), _T("%s\\%s\\%s.dat"), dat->pd->szProfileDir, profile, profile);
+ CallService(MS_DB_CHECKPROFILE, (WPARAM)fullName, 0);
+}
+
+void DeleteProfile(HWND hwndList, int iItem, DlgProfData *dat)
{
if (iItem < 0)
return;
@@ -318,21 +338,19 @@ void DeleteProfile(HWND hwndList, int iItem, DlgProfData* dat)
static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- DlgProfData* dat = (struct DlgProfData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ DlgProfData *dat = (struct DlgProfData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
HWND hwndList = GetDlgItem(hwndDlg, IDC_PROFILELIST);
switch (msg) {
case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ EnsureCheckerLoaded();
{
- HIMAGELIST hImgList;
- LVCOLUMN col;
-
- TranslateDialogDefault(hwndDlg);
-
dat = (DlgProfData*) lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
// set columns
+ LVCOLUMN col;
col.mask = LVCF_TEXT | LVCF_WIDTH;
col.pszText = TranslateT("Profile");
col.cx = 122;
@@ -355,7 +373,7 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam,
ListView_InsertColumn(hwndList, 4, &col);
// icons
- hImgList = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 2, 1);
+ HIMAGELIST hImgList = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 2, 1);
ImageList_AddIcon_NotShared(hImgList, MAKEINTRESOURCE(IDI_USERDETAILS));
ImageList_AddIcon_NotShared(hImgList, MAKEINTRESOURCE(IDI_DELETE));
@@ -410,14 +428,19 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam,
lvht.pt.x = GET_X_LPARAM(lParam);
lvht.pt.y = GET_Y_LPARAM(lParam);
ScreenToClient(hwndList, &lvht.pt);
- if (ListView_HitTest(hwndList, &lvht) < 0) break;
+ if (ListView_HitTest(hwndList, &lvht) < 0)
+ break;
lvht.pt.x = GET_X_LPARAM(lParam);
lvht.pt.y = GET_Y_LPARAM(lParam);
HMENU hMenu = CreatePopupMenu();
AppendMenu(hMenu, MF_STRING, 1, TranslateT("Run"));
- AppendMenu(hMenu, MF_SEPARATOR, 2, NULL);
+ AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
+ if (ServiceExists(MS_DB_CHECKPROFILE)) {
+ AppendMenu(hMenu, MF_STRING, 2, TranslateT("Check"));
+ AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
+ }
AppendMenu(hMenu, MF_STRING, 3, TranslateT("Delete"));
int index = TrackPopupMenu(hMenu, TPM_RETURNCMD, lvht.pt.x, lvht.pt.y, 0, hwndDlg, NULL);
switch (index) {
@@ -425,6 +448,10 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam,
SendMessage(GetParent(hwndDlg), WM_COMMAND, IDOK, 0);
break;
+ case 2:
+ CheckProfile(hwndList, lvht.iItem, dat);
+ break;
+
case 3:
DeleteProfile(hwndList, lvht.iItem, dat);
break;
@@ -445,12 +472,9 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam,
EnableWindow(dat->hwndOK, ListView_GetSelectedCount(hwndList) == 1);
case NM_DBLCLK:
- {
- LVITEM item = {0};
+ if (dat != NULL) {
TCHAR profile[MAX_PATH];
-
- if (dat == NULL) break;
-
+ LVITEM item = {0};
item.mask = LVIF_TEXT;
item.iItem = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED | LVNI_ALL);
item.pszText = profile;
@@ -468,8 +492,8 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam,
CloseHandle(hFile);
if (hdr->code == NM_DBLCLK) EndDialog(GetParent(hwndDlg), 1);
}
- return TRUE;
}
+ return TRUE;
case LVN_KEYDOWN:
{
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp
index b52e917dd0..7bdd1d87b1 100644
--- a/src/modules/plugins/newplugins.cpp
+++ b/src/modules/plugins/newplugins.cpp
@@ -421,7 +421,6 @@ pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path)
return p;
}
-
void SetPluginOnWhiteList(const TCHAR* pluginname, int allow)
{
char plugName[MAX_PATH];
@@ -589,7 +588,6 @@ static int LaunchServicePlugin(pluginEntry* p)
// plugin load failed - terminating Miranda
if ( !( p->pclass & PCLASS_LOADED)) {
if (p->bpi.Load() != ERROR_SUCCESS) {
- p->pclass |= PCLASS_FAILED;
Plugin_Uninit(p);
return SERVICE_FAILED;
}
@@ -630,6 +628,23 @@ int LoadServiceModePlugin()
return (serviceModePlugin == NULL) ? SERVICE_CONTINUE : LaunchServicePlugin(serviceModePlugin);
}
+void EnsureCheckerLoaded(void)
+{
+ for (int i=0; i < servicePlugins.getCount(); i++) {
+ pluginEntry* p = servicePlugins[i];
+ if ( _tcsicmp(p->pluginname, _T("dbchecker.dll")))
+ continue;
+
+ if ( !(p->pclass & PCLASS_LOADED)) {
+ if (p->bpi.Load() != ERROR_SUCCESS)
+ Plugin_Uninit(p);
+ else
+ p->pclass |= PCLASS_LOADED;
+ }
+ break;
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// Event hook to unload all non-core plugins
// hooked very late, after all the internal plugins, blah