diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2013-01-04 20:43:21 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2013-01-04 20:43:21 +0000 |
commit | 3afd2d1c465a6ffcbf0f80e0cb50880b9ff174f0 (patch) | |
tree | 9abee8ca8391fa3579246e79ef84049d6421b5a0 /plugins/Msg_Export/src | |
parent | 84cb58607f11d437b875e0db3857a94920c3a6b6 (diff) |
-support for WindowList
-simplified storing position
-removed duplicated menu item
git-svn-id: http://svn.miranda-ng.org/main/trunk@2968 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Msg_Export/src')
-rwxr-xr-x | plugins/Msg_Export/src/FileViewer.cpp | 77 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/Glob.h | 2 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/main.cpp | 57 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/options.cpp | 18 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/resource.h | 2 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/utils.cpp | 73 |
6 files changed, 108 insertions, 121 deletions
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index d4e76339d4..39ee4305c0 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -215,8 +215,8 @@ int CLStreamRTFInfo::nOptimalReadLen = 3300; int CLStreamRTFInfo::nWriteHeader( char * pszTarget , int nLen )
{
- COLORREF cMyText = DBGetContactSettingDword(NULL,"SRMsg","Font3Col",RGB(64,0,128));
- COLORREF cYourText = DBGetContactSettingDword(NULL,"SRMsg","Font0Col",RGB(240,0,0));
+ COLORREF cMyText = db_get_dw(NULL,"SRMsg","Font3Col",RGB(64,0,128));
+ COLORREF cYourText = db_get_dw(NULL,"SRMsg","Font0Col",RGB(240,0,0));
/* original header !!
"{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}\r\n"
@@ -1032,14 +1032,14 @@ void SetRichEditFont(HWND hRichEdit, bool bUseSyntaxHL ) CHARFORMAT ncf = { 0 };
ncf.cbSize = sizeof( CHARFORMAT );
ncf.dwMask = CFM_BOLD | CFM_FACE | CFM_ITALIC | CFM_SIZE | CFM_UNDERLINE;
- ncf.dwEffects = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "TEffects" , 0 );
- ncf.yHeight = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "THeight" , 165 );
+ ncf.dwEffects = db_get_dw( NULL , MODULE , szFileViewDB "TEffects" , 0 );
+ ncf.yHeight = db_get_dw( NULL , MODULE , szFileViewDB "THeight" , 165 );
_tcscpy( ncf.szFaceName , _DBGetString( NULL , MODULE , szFileViewDB "TFace" , _T("Courier New")).c_str() );
if( ! bUseSyntaxHL )
{
ncf.dwMask |= CFM_COLOR;
- ncf.crTextColor = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "TColor" , 0 );
+ ncf.crTextColor = db_get_dw( NULL , MODULE , szFileViewDB "TColor" , 0 );
}
SendMessage(hRichEdit, EM_SETCHARFORMAT, (WPARAM)SCF_ALL, (LPARAM)&ncf);
@@ -1089,36 +1089,27 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, InsertMenu( hSysMenu , 0 , MF_SEPARATOR | MF_BYPOSITION , 0 , 0 );
- BYTE bUseCC = (BYTE)DBGetContactSettingByte( NULL , MODULE , szFileViewDB "UseCC" , 0 );
+ BYTE bUseCC = (BYTE)db_get_b( NULL , MODULE , szFileViewDB "UseCC" , 0 );
InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION | ( bUseCC ? MF_CHECKED : 0 ) , ID_FV_COLOR, LPGENT("Color...") );
if( bUseCC )
{
SendMessage( hRichEdit , EM_SETBKGNDCOLOR, 0 ,
- DBGetContactSettingDword( NULL , MODULE , szFileViewDB "CustomC" , RGB(255,255,255) )
+ db_get_dw( NULL , MODULE , szFileViewDB "CustomC" , RGB(255,255,255) )
);
}
InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION , ID_FV_FONT, LPGENT("Font...") );
- bool bUseSyntaxHL = DBGetContactSettingByte( NULL , MODULE , szFileViewDB "UseSyntaxHL" , 1 )!=0;
+ bool bUseSyntaxHL = db_get_b( NULL , MODULE , szFileViewDB "UseSyntaxHL" , 1 )!=0;
InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION | ( bUseSyntaxHL ? MF_CHECKED : 0 ) , ID_FV_SYNTAX_HL, LPGENT("Syntax highlight") );
SetRichEditFont( hRichEdit , bUseSyntaxHL );
TranslateDialogDefault(hwndDlg);
-
- int cx= DBGetContactSettingDword( NULL , MODULE , szFileViewDB "cx" , 0 );
- int cy= DBGetContactSettingDword( NULL , MODULE , szFileViewDB "cy" , 0 );
-
- if( cx > 0 && cy > 0)
- {
- int x = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "x" , 0 );
- int y = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "y" , 0 );
-
- SetWindowPos( hwndDlg , NULL , x , y , cx , cy , SWP_NOZORDER );
- }
+
+ Utils_RestoreWindowPosition(hwndDlg,pclDlg->hContact,MODULE,szFileViewDB);
pclDlg->sPath = GetFilePathFromUser( pclDlg->hContact );
@@ -1145,6 +1136,8 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, }
}
+
+ WindowList_Add(hInternalWindowList,hwndDlg,pclDlg->hContact);
return TRUE;
}
case WM_RELOAD_FILE:
@@ -1170,20 +1163,8 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, }
case WM_DESTROY:
{
- RECT rSize;
- if( GetWindowRect( hwndDlg , &rSize ) )
- {
- // first we make sure the window has resonable dimentions.
- // if it is minimized it will not have that.
- if( rSize.left <= -32000 || rSize.top <= -32000 )
- return 0;
- if( rSize.right <= -32000 || rSize.bottom <= -32000 )
- return 0;
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "x" , rSize.left );
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "y" , rSize.top );
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "cx" , rSize.right - rSize.left );
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "cy" , rSize.bottom - rSize.top );
- }
+ Utils_SaveWindowPosition(hwndDlg,pclDlg->hContact,MODULE,szFileViewDB);
+ WindowList_Remove(hInternalWindowList,hwndDlg);
return 0;
}
case WM_SYSCOMMAND:
@@ -1197,7 +1178,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, LOGFONT lf = { 0 };
lf.lfHeight = 14L;
- { DWORD dwEffects = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "TEffects" , 0 );
+ { DWORD dwEffects = db_get_dw( NULL , MODULE , szFileViewDB "TEffects" , 0 );
lf.lfWeight = (dwEffects & CFE_BOLD) ? FW_BOLD : 0;
lf.lfUnderline = (dwEffects & CFE_UNDERLINE) != 0;
lf.lfStrikeOut = (dwEffects & CFE_STRIKEOUT) != 0;
@@ -1208,7 +1189,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, cf.lStructSize = sizeof( cf );
cf.hwndOwner = hwndDlg;
cf.lpLogFont = &lf;
- cf.rgbColors = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "TColor" , 0 );
+ cf.rgbColors = db_get_dw( NULL , MODULE , szFileViewDB "TColor" , 0 );
cf.Flags = CF_EFFECTS | CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT;
if( ChooseFont( &cf ) )
@@ -1218,30 +1199,30 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, (lf.lfStrikeOut ? CFE_STRIKEOUT : 0) |
(lf.lfUnderline ? CFE_UNDERLINE : 0);
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "TEffects" , dwEffects );
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "THeight" , cf.iPointSize * 2 );
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "TColor" , cf.rgbColors );
- DBWriteContactSettingTString( NULL , MODULE , szFileViewDB "TFace" , lf.lfFaceName );
+ db_set_dw( NULL , MODULE , szFileViewDB "TEffects" , dwEffects );
+ db_set_dw( NULL , MODULE , szFileViewDB "THeight" , cf.iPointSize * 2 );
+ db_set_dw( NULL , MODULE , szFileViewDB "TColor" , cf.rgbColors );
+ db_set_ts( NULL , MODULE , szFileViewDB "TFace" , lf.lfFaceName );
SetRichEditFont( hRichEdit , bUseSyntaxHL );
}
return TRUE;
}
else if ((wParam & 0xFFF0) == ID_FV_COLOR)
{
- BYTE bUseCC = ! DBGetContactSettingByte( NULL , MODULE , szFileViewDB "UseCC" , 0 );
+ BYTE bUseCC = ! db_get_b( NULL , MODULE , szFileViewDB "UseCC" , 0 );
if( bUseCC )
{
CHOOSECOLOR cc = {0};
cc.lStructSize = sizeof( cc );
cc.hwndOwner = hwndDlg;
- cc.rgbResult = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "CustomC" , RGB(255,255,255) );
+ cc.rgbResult = db_get_dw( NULL , MODULE , szFileViewDB "CustomC" , RGB(255,255,255) );
cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;
static COLORREF MyCustColors[16] = { 0xFFFFFFFF };
cc.lpCustColors = MyCustColors;
if( ChooseColor( &cc ) )
{
SendMessage( hRichEdit , EM_SETBKGNDCOLOR, 0 , cc.rgbResult );
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "CustomC" , cc.rgbResult );
+ db_set_dw( NULL , MODULE , szFileViewDB "CustomC" , cc.rgbResult );
}
else
{
@@ -1254,7 +1235,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage( hRichEdit , EM_SETBKGNDCOLOR, TRUE , 0 );
}
CheckMenuItem( hSysMenu , ID_FV_COLOR , MF_BYCOMMAND | (bUseCC ? MF_CHECKED : 0) );
- DBWriteContactSettingByte( NULL , MODULE , szFileViewDB "UseCC" , bUseCC );
+ db_set_b( NULL , MODULE , szFileViewDB "UseCC" , bUseCC );
return TRUE;
}
else if ((wParam & 0xFFF0) == ID_FV_SYNTAX_HL)
@@ -1266,7 +1247,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, bUseSyntaxHL = !bUseSyntaxHL;
CheckMenuItem( hSysMenu , ID_FV_SYNTAX_HL , MF_BYCOMMAND | (bUseSyntaxHL ? MF_CHECKED : 0) );
- DBWriteContactSettingByte( NULL , MODULE , szFileViewDB "UseSyntaxHL" , bUseSyntaxHL );
+ db_set_b( NULL , MODULE , szFileViewDB "UseSyntaxHL" , bUseSyntaxHL );
if( bUseSyntaxHL )
bLoadFile(hwndDlg , pclDlg );
@@ -1387,6 +1368,14 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, bool bShowFileViewer( HANDLE hContact )
{
+ HWND hInternalWindow = WindowList_Find(hInternalWindowList,hContact);
+ if(hInternalWindow)
+ {
+ SetForegroundWindow(hInternalWindow);
+ SetFocus(hInternalWindow);
+ return true;
+ }
+
CLHistoryDlg * pcl = new CLHistoryDlg( hContact );
pcl->hWnd = CreateDialogParam( hInstance,MAKEINTRESOURCE(IDD_FILE_VIEWER),NULL,DlgProcFileViewer,(LPARAM)pcl);
if( pcl->hWnd )
diff --git a/plugins/Msg_Export/src/Glob.h b/plugins/Msg_Export/src/Glob.h index 8de2c0843e..ec898ac3f1 100755 --- a/plugins/Msg_Export/src/Glob.h +++ b/plugins/Msg_Export/src/Glob.h @@ -26,4 +26,6 @@ extern HINSTANCE hInstance;
+extern HANDLE hInternalWindowList;
+
#endif
\ No newline at end of file diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp index 0ab02fa6f2..a2a5c63789 100755 --- a/plugins/Msg_Export/src/main.cpp +++ b/plugins/Msg_Export/src/main.cpp @@ -45,6 +45,8 @@ static HANDLE hServiceFunc = 0; static HANDLE hOpenHistoryMenuItem = 0;
+HANDLE hInternalWindowList = NULL;
+
/////////////////////////////////////////////////////
// Remember to update the Version in the resource !!!
/////////////////////////////////////////////////////
@@ -105,6 +107,8 @@ static INT_PTR ShowExportHistory(WPARAM wParam,LPARAM /*lParam*/) int nSystemShutdown(WPARAM /*wparam*/,LPARAM /*lparam*/)
{
+ WindowList_Broadcast(hInternalWindowList,WM_CLOSE,0,0);
+
if( hEventOptionsInitialize )
{
UnhookEvent(hEventOptionsInitialize);
@@ -180,34 +184,29 @@ int MainInit(WPARAM /*wparam*/,LPARAM /*lparam*/) MessageBox( NULL , LPGENT("Failed to HookEvent ME_OPT_INITIALISE") , MSG_BOX_TITEL , MB_OK );
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags=0;
- mi.pszContactOwner=NULL; //all contacts
- mi.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_EXPORT_MESSAGE));
- if( bReplaceHistory )
- {
- mi.position= 1000090000;
- mi.pszName=LPGEN("View &History");
- mi.pszService=MS_HISTORY_SHOWCONTACTHISTORY;
- }
- else
+ if( !bReplaceHistory )
{
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags=0;
+ mi.pszContactOwner=NULL; //all contacts
+ mi.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_EXPORT_MESSAGE));
mi.position = 1000090100;
mi.pszName=LPGEN("Open E&xported History");
mi.pszService=MS_SHOW_EXPORT_HISTORY;
+ hOpenHistoryMenuItem = Menu_AddContactMenuItem(&mi);
+
+ if( !hOpenHistoryMenuItem )
+ MessageBox( NULL , LPGENT("Failed to add menu item Open Exported History\nCallService(MS_CLIST_ADDCONTACTMENUITEM,...)") , MSG_BOX_TITEL , MB_OK );
}
- hOpenHistoryMenuItem = Menu_AddContactMenuItem(&mi);
- if( !hOpenHistoryMenuItem )
- MessageBox( NULL , LPGENT("Failed to add menu item Open Exported History\nCallService(MS_CLIST_ADDCONTACTMENUITEM,...)") , MSG_BOX_TITEL , MB_OK );
-/*
+
hEventSystemShutdown = HookEvent( ME_SYSTEM_SHUTDOWN , nSystemShutdown );
if( !hEventSystemShutdown )
- MessageBox( NULL , "Failed to HookEvent ME_SYSTEM_SHUTDOWN" , MSG_BOX_TITEL , MB_OK );
-*/
+ MessageBox( NULL , _T("Failed to HookEvent ME_SYSTEM_SHUTDOWN") , MSG_BOX_TITEL , MB_OK );
+
/*
_TCHAR szBuf[ 10000 ];
@@ -312,7 +311,7 @@ int __declspec(dllexport)Load() return 0;
}
- nMaxLineWidth = DBGetContactSettingWord( NULL , MODULE , "MaxLineWidth" , nMaxLineWidth );
+ nMaxLineWidth = db_get_w( NULL , MODULE , "MaxLineWidth" , nMaxLineWidth );
if( nMaxLineWidth < 5 )
nMaxLineWidth = 5;
@@ -322,18 +321,18 @@ int __declspec(dllexport)Load() sTimeFormat = _DBGetString( NULL , MODULE , "TimeFormat" , _T("d s") );
sFileViewerPrg = _DBGetString( NULL , MODULE , "FileViewerPrg" , _T("") );
- bUseInternalViewer( DBGetContactSettingByte( NULL , MODULE , "UseInternalViewer" , bUseInternalViewer() ) != 0 );
+ bUseInternalViewer( db_get_b( NULL , MODULE , "UseInternalViewer" , bUseInternalViewer() ) != 0 );
- bReplaceHistory = DBGetContactSettingByte( NULL , MODULE , "ReplaceHistory" , bReplaceHistory ) != 0;
- bAppendNewLine = DBGetContactSettingByte( NULL , MODULE , "AppendNewLine" , bAppendNewLine ) != 0;
- bUseUtf8InNewFiles = DBGetContactSettingByte( NULL , MODULE , "UseUtf8InNewFiles" , bUseUtf8InNewFiles ) != 0;
- bUseLessAndGreaterInExport = DBGetContactSettingByte( NULL , MODULE , "UseLessAndGreaterInExport" , bUseLessAndGreaterInExport ) != 0;
+ bReplaceHistory = db_get_b( NULL , MODULE , "ReplaceHistory" , bReplaceHistory ) != 0;
+ bAppendNewLine = db_get_b( NULL , MODULE , "AppendNewLine" , bAppendNewLine ) != 0;
+ bUseUtf8InNewFiles = db_get_b( NULL , MODULE , "UseUtf8InNewFiles" , bUseUtf8InNewFiles ) != 0;
+ bUseLessAndGreaterInExport = db_get_b( NULL , MODULE , "UseLessAndGreaterInExport" , bUseLessAndGreaterInExport ) != 0;
- enRenameAction = (ENDialogAction)DBGetContactSettingByte( NULL , MODULE , "RenameAction" , enRenameAction );
- enDeleteAction = (ENDialogAction)DBGetContactSettingByte( NULL , MODULE , "DeleteAction" , enDeleteAction );;
+ enRenameAction = (ENDialogAction)db_get_b( NULL , MODULE , "RenameAction" , enRenameAction );
+ enDeleteAction = (ENDialogAction)db_get_b( NULL , MODULE , "DeleteAction" , enDeleteAction );;
// Plugin sweeper support
- DBWriteContactSettingTString(NULL,"Uninstall","Message Export",_T(MODULE));
+ db_set_ts(NULL,"Uninstall","Message Export",_T(MODULE));
if( bReplaceHistory )
{
@@ -365,6 +364,8 @@ int __declspec(dllexport)Load() {
MessageBox( NULL , LPGENT("Failed to CreateServiceFunction MS_SHOW_EXPORT_HISTORY") , MSG_BOX_TITEL , MB_OK );
}
+
+ hInternalWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
return 0;
}
@@ -384,10 +385,6 @@ int __declspec(dllexport)Load() __declspec(dllexport)int Unload(void)
{
- //if( !hEventSystemShutdown ) // we will try to unload anyway
- {
- nSystemShutdown(0,0);
- }
Uninitilize();
bUseInternalViewer( false );
return 0;
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 122c3e3521..b2ba1478eb 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -142,12 +142,12 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) }
if( lParamSort == 3 )
{
- DWORD dwUin1 = DBGetContactSettingDword(
+ DWORD dwUin1 = db_get_dw(
(HANDLE)lParam1,
_DBGetStringA( (HANDLE)lParam1 , "Protocol" , "p" , "" ).c_str(),
"UIN",
0);
- DWORD dwUin2 = DBGetContactSettingDword(
+ DWORD dwUin2 = db_get_dw(
(HANDLE)lParam2,
_DBGetStringA( (HANDLE)lParam2 , "Protocol" , "p" , "" ).c_str(),
"UIN",
@@ -457,14 +457,14 @@ BOOL bApplyChanges( HWND hwndDlg ) {
HANDLE hUser = (HANDLE)sItem.lParam;
if( _tcslen( szTemp ) > 0 )
- DBWriteContactSettingTString( hUser , MODULE , "FileName" , szTemp );
+ db_set_ts( hUser , MODULE , "FileName" , szTemp );
else
DBDeleteContactSetting( hUser , MODULE , "FileName" );
if( sItem.iImage )
DBDeleteContactSetting( hUser , MODULE , "EnableLog" ); // default is Enabled !!
else
- DBWriteContactSettingByte( hUser , MODULE , "EnableLog",0);
+ db_set_b( hUser , MODULE , "EnableLog",0);
}
}
UpdateFileToColWidth();
@@ -739,7 +739,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar sItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
sItem.iItem = nUser;
sItem.iSubItem = 0;
- sItem.iImage = DBGetContactSettingByte(hContact,MODULE,"EnableLog",1);
+ sItem.iImage = db_get_b(hContact,MODULE,"EnableLog",1);
sItem.lParam = (LPARAM) hContact;
@@ -761,7 +761,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar ListView_SetItem( hMapUser , &sItem );
- DWORD dwUIN = DBGetContactSettingDword(hContact, sTmpA.c_str(), "UIN", 0);
+ DWORD dwUIN = db_get_dw(hContact, sTmpA.c_str(), "UIN", 0);
_TCHAR szTmp[50];
_sntprintf( szTmp , sizeof(szTmp) ,_T("%d") , dwUIN );
sItem.iSubItem = 3;
@@ -1247,9 +1247,9 @@ BOOL bApplyChanges2( HWND hwndDlg ) if( ::SendMessage(hMapUser, LVM_GETITEMA, 0, (LPARAM)&sItem ) )
{
if( sItem.iImage )
- DBDeleteContactSetting( NULL , MODULE , szTemp ); // default is Enabled !!
+ db_unset( NULL , MODULE , szTemp ); // default is Enabled !!
else
- DBWriteContactSettingByte( NULL , MODULE , szTemp,0);
+ db_set_b( NULL , MODULE , szTemp,0);
}
}
SaveSettings();
@@ -1351,7 +1351,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts2(HWND hwndDlg, UINT msg, WPARAM wPa {
_snprintf(szTemp , sizeof( szTemp ) , "DisableProt_%s" , proto[i]->szModuleName);
sItem.pszText = proto[i]->szModuleName;
- sItem.iImage = DBGetContactSettingByte(NULL,MODULE,szTemp,1);
+ sItem.iImage = db_get_b(NULL,MODULE,szTemp,1);
::SendMessage( hMapUser , LVM_INSERTITEMA , 0 ,(LPARAM)&sItem );
sItem.iItem++;
}
diff --git a/plugins/Msg_Export/src/resource.h b/plugins/Msg_Export/src/resource.h index cd12714f9a..adf81b6ae2 100755 --- a/plugins/Msg_Export/src/resource.h +++ b/plugins/Msg_Export/src/resource.h @@ -1,5 +1,5 @@ //{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
+// Microsoft Visual C++ generated include file.
// Used by resource.rc
//
#define IDI_EXPORT_MESSAGE 108
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 08d7323b36..134f53ae3d 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -293,7 +293,7 @@ tstring _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting tstring ret;
DBVARIANT dbv = {0};
//DBGetContactSetting
- if( ! DBGetContactSettingWString( hContact , szModule , szSetting , &dbv ) )
+ if( ! db_get_ws( hContact , szModule , szSetting , &dbv ) )
{
if( dbv.type != DBVT_WCHAR)
{
@@ -307,7 +307,7 @@ tstring _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting }
else
ret = pszError;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return ret;
}
@@ -315,7 +315,7 @@ string _DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting {
string ret;
DBVARIANT dbv = {0};
- if( ! DBGetContactSetting( hContact , szModule , szSetting , &dbv ) )
+ if( ! db_get( hContact , szModule , szSetting , &dbv ) )
{
if( dbv.type != DBVT_ASCIIZ)
{
@@ -329,7 +329,7 @@ string _DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting }
else
ret = pszError;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return ret;
}
@@ -699,7 +699,7 @@ tstring GetFilePathFromUser( HANDLE hContact ) }
// Store the Filename used so that we can check if it changes.
- DBWriteContactSettingTString( hContact , MODULE , "PrevFileName" , sNoDBPath.c_str() );
+ db_set_ts( hContact , MODULE , "PrevFileName" , sNoDBPath.c_str() );
}
return sFilePath;
@@ -782,7 +782,7 @@ void ReplaceDefines( HANDLE hContact , tstring & sTarget ) string sProto = _DBGetStringA( hContact , "Protocol" , "p" , "" );
if( bUINUsed || ( bIdentifierUsed && sProto == "ICQ" ) )
{
- DWORD dwUIN = DBGetContactSettingDword(hContact, sProto.c_str(), "UIN", 0);
+ DWORD dwUIN = db_get_dw(hContact, sProto.c_str(), "UIN", 0);
tstring sReplaceUin;
if( dwUIN )
{
@@ -975,11 +975,10 @@ void DisplayErrorDialog( const _TCHAR * pszError , tstring& sFilePath , DBEVENTI if( GetSaveFileName(&ofn) )
{
- HANDLE hf; // file handle
- hf = CreateFile(ofn.lpstrFile, GENERIC_WRITE,
+ HANDLE hf = CreateFile(ofn.lpstrFile, GENERIC_WRITE,
0, (LPSECURITY_ATTRIBUTES) NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
- (HANDLE) NULL);
+ (HANDLE) NULL); // file handle
bWriteTextToFile( hf , sError.c_str() , false );
if( dbei )
@@ -1128,13 +1127,13 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) ReplaceAll( output , pszReplaceList[nCur] , _DBGetString( hContact , sProto.c_str() , pszReplaceListA[nCur] , _T("") ) );
}
- _sntprintf( szTemp , sizeof( szTemp ) , _T("%d") , DBGetContactSettingDword(hContact, sProto.c_str(), "UIN", 0) );
+ _sntprintf( szTemp , sizeof( szTemp ) , _T("%d") , db_get_dw(hContact, sProto.c_str(), "UIN", 0) );
ReplaceAll( output , _T("%UIN%") , szTemp );
- _sntprintf( szTemp , sizeof( szTemp ) , _T("%d") , DBGetContactSettingWord(hContact, sProto.c_str(), "Age", 0));
+ _sntprintf( szTemp , sizeof( szTemp ) , _T("%d") , db_get_w(hContact, sProto.c_str(), "Age", 0));
ReplaceAll( output , _T("%Age%") , szTemp );
- szTemp[0] = (_TCHAR)DBGetContactSettingByte(hContact, sProto.c_str(), "Gender", 0);
+ szTemp[0] = (_TCHAR)db_get_b(hContact, sProto.c_str(), "Gender", 0);
szTemp[1] = 0;
ReplaceAll( output , _T("%Gender%") , szTemp );
@@ -1432,7 +1431,7 @@ int nExportEvent(WPARAM wparam,LPARAM lparam) {
HANDLE hContact = (HANDLE)wparam;
- if( ! DBGetContactSettingByte(hContact,MODULE,"EnableLog",1) )
+ if( ! db_get_b(hContact,MODULE,"EnableLog",1) )
return 0;
DBEVENTINFO dbei={0};
@@ -1459,7 +1458,7 @@ int nExportEvent(WPARAM wparam,LPARAM lparam) if( dbei.eventType != EVENTTYPE_STATUSCHANGE )
{
_snprintf( szTemp , sizeof( szTemp ) , "DisableProt_%s" , dbei.szModule );
- if( DBGetContactSettingByte(NULL,MODULE,szTemp,1) )
+ if( db_get_b(NULL,MODULE,szTemp,1) )
{
ExportDBEventInfo( hContact , dbei );
}
@@ -1616,28 +1615,28 @@ SuperBreak: int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/)
{
+ HANDLE hContact = (HANDLE)wparam;
+
+ HWND hInternalWindow = WindowList_Find(hInternalWindowList,hContact);
+ if(hInternalWindow)
+ CloseWindow(hInternalWindow);
+
if( enDeleteAction == eDANothing )
return 0;
- HANDLE hContact = (HANDLE)wparam;
-
tstring sFilePath = GetFilePathFromUser( hContact );
- { // Test if there is another user using this file
- HANDLE hOtherContact = db_find_first();
- for(;;)
+ { // Test if there is another user using this file
+ for(HANDLE hOtherContact = db_find_first();hOtherContact;hOtherContact = db_find_next(hOtherContact))
{
if( hContact != hOtherContact && sFilePath == GetFilePathFromUser( hOtherContact ) )
{
return 0; // we found another contact abort mission :-)
}
-
- if( ! hOtherContact )
- break;
- hOtherContact = db_find_next(hOtherContact);
}
}
+
// Test to see if there is a file to delete
HANDLE hPrevFile = CreateFile( sFilePath.c_str() ,
GENERIC_READ ,
@@ -1687,19 +1686,19 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/) void SaveSettings()
{
- DBWriteContactSettingWord( NULL , MODULE , "MaxLineWidth" , (WORD) nMaxLineWidth );
- DBWriteContactSettingTString( NULL , MODULE , "ExportDir" , sExportDir.c_str() );
- DBWriteContactSettingTString( NULL , MODULE , "DefaultFile" , sDefaultFile.c_str() );
- DBWriteContactSettingTString( NULL , MODULE , "TimeFormat" , sTimeFormat.c_str() );
-
- DBWriteContactSettingTString( NULL , MODULE , "FileViewerPrg" , sFileViewerPrg.c_str() );
- DBWriteContactSettingByte( NULL , MODULE , "UseInternalViewer" , bUseInternalViewer() );
- DBWriteContactSettingByte( NULL , MODULE , "ReplaceHistory" , bReplaceHistory );
- DBWriteContactSettingByte( NULL , MODULE , "AppendNewLine" , bAppendNewLine );
- DBWriteContactSettingByte( NULL , MODULE , "UseUtf8InNewFiles" , bUseUtf8InNewFiles );
- DBWriteContactSettingByte( NULL , MODULE , "UseLessAndGreaterInExport" , bUseLessAndGreaterInExport );
-
- DBWriteContactSettingByte( NULL , MODULE , "RenameAction" , (BYTE)enRenameAction );
- DBWriteContactSettingByte( NULL , MODULE , "DeleteAction" , (BYTE)enDeleteAction );
+ db_set_w( NULL , MODULE , "MaxLineWidth" , (WORD) nMaxLineWidth );
+ db_set_ts( NULL , MODULE , "ExportDir" , sExportDir.c_str() );
+ db_set_ts( NULL , MODULE , "DefaultFile" , sDefaultFile.c_str() );
+ db_set_ts( NULL , MODULE , "TimeFormat" , sTimeFormat.c_str() );
+
+ db_set_ts( NULL , MODULE , "FileViewerPrg" , sFileViewerPrg.c_str() );
+ db_set_b( NULL , MODULE , "UseInternalViewer" , bUseInternalViewer() );
+ db_set_b( NULL , MODULE , "ReplaceHistory" , bReplaceHistory );
+ db_set_b( NULL , MODULE , "AppendNewLine" , bAppendNewLine );
+ db_set_b( NULL , MODULE , "UseUtf8InNewFiles" , bUseUtf8InNewFiles );
+ db_set_b( NULL , MODULE , "UseLessAndGreaterInExport" , bUseLessAndGreaterInExport );
+
+ db_set_b( NULL , MODULE , "RenameAction" , (BYTE)enRenameAction );
+ db_set_b( NULL , MODULE , "DeleteAction" , (BYTE)enDeleteAction );
}
|