summaryrefslogtreecommitdiff
path: root/plugins/HistoryPlusPlus
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-22 09:46:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-22 09:46:17 +0000
commitd5fbcc024448bfaa582fa97d37559275f5493597 (patch)
tree2f984d00c641495150a1bb273e8ce28b57401b10 /plugins/HistoryPlusPlus
parent2b72ef9487d1487cb4096b359c3dec675ae2703e (diff)
- bookmarks have different format in 32 & 64 bits;
- fix for reading bookmarks for subcontacts; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@8679 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/HistoryPlusPlus')
-rw-r--r--plugins/HistoryPlusPlus/GlobalSearch.pas3
-rw-r--r--plugins/HistoryPlusPlus/historypp.dproj29
-rw-r--r--plugins/HistoryPlusPlus/hpp_bookmarks.pas70
3 files changed, 75 insertions, 27 deletions
diff --git a/plugins/HistoryPlusPlus/GlobalSearch.pas b/plugins/HistoryPlusPlus/GlobalSearch.pas
index aa8db4368d..08d783d6df 100644
--- a/plugins/HistoryPlusPlus/GlobalSearch.pas
+++ b/plugins/HistoryPlusPlus/GlobalSearch.pas
@@ -971,7 +971,6 @@ end;
procedure TfmGlobalSearch.bnSearchClick(Sender: TObject);
var
SearchProtected: Boolean;
- PassMode: Byte;
begin
if IsSearching then
begin
@@ -1705,8 +1704,6 @@ begin
end;
procedure TfmGlobalSearch.FormShow(Sender: TObject);
-var
- PassMode: Byte;
begin
paFilter.Visible := False;
ToggleAdvancedPanel(False);
diff --git a/plugins/HistoryPlusPlus/historypp.dproj b/plugins/HistoryPlusPlus/historypp.dproj
index 4a4281c8b7..240b4619fc 100644
--- a/plugins/HistoryPlusPlus/historypp.dproj
+++ b/plugins/HistoryPlusPlus/historypp.dproj
@@ -51,6 +51,12 @@
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
+ <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
+ <Cfg_2_Win32>true</Cfg_2_Win32>
+ <CfgParent>Cfg_2</CfgParent>
+ <Cfg_2>true</Cfg_2>
+ <Base>true</Base>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<VerInfo_Locale>1049</VerInfo_Locale>
<DCC_E>false</DCC_E>
@@ -106,11 +112,28 @@
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
+ <DCC_UnitSearchPath>..\..\include\delphi;..\..\plugins\ExternalAPI\delphi;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
- <Manifest_File>None</Manifest_File>
+ <DCC_BplOutput>..\..\bin10\Debug\Plugins\</DCC_BplOutput>
+ <BRCC_OutputDir>..\..\bin10\temp\res\</BRCC_OutputDir>
+ <DCC_ExeOutput>..\..\bin10\Debug\Plugins\</DCC_ExeOutput>
<VerInfo_Locale>1033</VerInfo_Locale>
+ <DCC_DcpOutput>..\..\bin10\Debug\Obj\hpp\</DCC_DcpOutput>
+ <Manifest_File>None</Manifest_File>
+ <DCC_DcuOutput>..\..\bin10\Debug\Obj\hpp\</DCC_DcuOutput>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
+ <Debugger_CWD>D:\Myranda\bin12\Debug64</Debugger_CWD>
+ <DCC_DebugDCUs>true</DCC_DebugDCUs>
+ <Debugger_HostApplication>D:\Myranda\bin12\Debug64\Miranda64.exe</Debugger_HostApplication>
+ <BRCC_OutputDir>..\..\bin10\temp\res\</BRCC_OutputDir>
+ <DCC_ExeOutput>..\..\bin12\Debug64\Plugins\</DCC_ExeOutput>
+ <DCC_BplOutput>..\..\bin12\Debug64\Plugins\</DCC_BplOutput>
+ <DCC_DcuOutput>..\..\bin12\Debug64\Obj\hpp\</DCC_DcuOutput>
+ <DCC_DcpOutput>..\..\bin12\Debug64\Obj\hpp\</DCC_DcpOutput>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
+ <DCC_DebugDCUs>true</DCC_DebugDCUs>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
diff --git a/plugins/HistoryPlusPlus/hpp_bookmarks.pas b/plugins/HistoryPlusPlus/hpp_bookmarks.pas
index 942ac135b3..ea944084c2 100644
--- a/plugins/HistoryPlusPlus/hpp_bookmarks.pas
+++ b/plugins/HistoryPlusPlus/hpp_bookmarks.pas
@@ -53,24 +53,31 @@ uses windows, m_api;
type
TEventData = record
- hDBEvent: THandle;
+ hDBEvent: DWord;
CRC32: DWord;
Timestamp: Cardinal;
end;
PEventData = ^TEventData;
+ TBadEventData = record
+ hDBEvent: THandle;
+ CRC32: DWord;
+ Timestamp: Cardinal;
+ end;
+ PBadEventData = ^TBadEventData;
+
TBookmarksHash = class;
TContactBookmarks = class(TObject)
private
Bookmarks: TBookmarksHash;
- hContact: THandle;
+ FContact: TMCONTACT;
FContactCP: Cardinal;
function GetBookmarked(Index: THandle): Boolean;
procedure SetBookmarked(Index: THandle; const Value: Boolean);
function GetBookmarkName(Index: THandle): String;
procedure SetBookmarkName(Index: THandle; const Value: String);
- procedure LoadBookmarks;
+ procedure LoadBookmarks(hContact:TMCONTACT);
procedure SaveBookmarks;
procedure DeleteBookmarks;
function GetCount: Integer;
@@ -85,7 +92,7 @@ type
property Items[Index: Integer]: THandle read GetItems;
property Names[Index: Integer]: String read GetNames;
property Count: Integer read GetCount;
- property Contact: THandle read hContact;
+ property Contact: TMCONTACT read FContact;
property ContactCP: Cardinal read FContactCP;
end;
PContactBookmarks = ^TContactBookmarks;
@@ -254,17 +261,25 @@ end;
{ TContactBookmarks }
constructor TContactBookmarks.Create(AContact: THandle);
+var
+ i, nSub : integer;
begin
- hContact := AContact;
- FContactCP := GetContactCodepage(hContact);
+ FContact := AContact;
+ FContactCP := GetContactCodepage(FContact);
Bookmarks := TBookmarksHash.Create(Self);
// read bookmarks from DB here
- LoadBookmarks;
+ LoadBookmarks(FContact);
+ if db_mc_isMeta(FContact) then
+ begin
+ nSub := db_mc_getSubCount(FContact);
+ for i := 0 to nSub-1 do
+ LoadBookmarks(db_mc_getSub(FContact, i));
+ end;
end;
procedure TContactBookmarks.DeleteBookmarks;
begin
- DBDelete(hContact,hppDBName,'Bookmarks');
+ DBDelete(FContact,hppDBName,'Bookmarks');
end;
destructor TContactBookmarks.Destroy;
@@ -296,7 +311,7 @@ begin
Result := Bookmarks.GetItemName(hDBEvent)
end;
-procedure TContactBookmarks.LoadBookmarks;
+procedure TContactBookmarks.LoadBookmarks(hContact:TMCONTACT);
var
i: Integer;
mem: PEventData;
@@ -305,6 +320,8 @@ var
rec_size: Word;
rec_count: Integer;
ed: PEventData;
+ tmp_ed: TEventData;
+ pbed: PBadEventData;
AllOk: Boolean;
begin
if not GetDBBlob(hContact, hppDBName, 'Bookmarks', mem_org, mem_len) then
@@ -321,6 +338,17 @@ begin
for i := 0 to rec_count - 1 do
begin
ed := PEventData(int_ptr(mem) + i * rec_size);
+ {$IFDEF WIN64}
+ if rec_size = SizeOf(TBadEventData) then
+ begin
+ pbed := PBadEventData(int_ptr(mem) + i * rec_size);
+ tmp_ed.hDBEvent := pbed^.hDBEvent;
+ tmp_ed.CRC32 := pbed^.CRC32;
+ tmp_ed.Timestamp := pbed^.Timestamp;
+ ed := @tmp_ed;
+ AllOk := false;
+ end;
+ {$ENDIF}
if not Bookmarks.AddEventData(ed^) then
AllOk := false;
end;
@@ -352,7 +380,7 @@ begin
dst := PEventData(int_ptr(mem) + SizeOf(Word) + i * SizeOf(TEventData));
Move(src^, dst^, SizeOf(src^));
end;
- WriteDBBlob(hContact, hppDBName, 'Bookmarks', mem, mem_len);
+ WriteDBBlob(FContact, hppDBName, 'Bookmarks', mem, mem_len);
FreeMem(mem, mem_len);
end
else
@@ -372,7 +400,7 @@ begin
if res then
begin
SaveBookmarks;
- NotifyAllForms(HM_NOTF_BOOKMARKCHANGED, hContact, Index);
+ NotifyAllForms(HM_NOTF_BOOKMARKCHANGED, FContact, Index);
end;
end;
@@ -561,18 +589,18 @@ end;
function TBookmarksHash.AddItemName(hDBEvent: THandle; const Value: String): Boolean;
begin
- Result := (WriteDBWideStr(Contact.hContact,hppDBName,AnsiString('bm'+intToStr(hDBEvent)),Value) = 0);
+ Result := (WriteDBWideStr(Contact.FContact,hppDBName,AnsiString('bm'+intToStr(hDBEvent)),Value) = 0);
end;
function TBookmarksHash.GetItemName(hDBEvent: THandle): String;
begin
- Result := GetDBWideStr(Contact.hContact,hppDBName,AnsiString('bm'+intToStr(hDBEvent)),'');
+ Result := GetDBWideStr(Contact.FContact,hppDBName,AnsiString('bm'+intToStr(hDBEvent)),'');
end;
function TBookmarksHash.RemoveItemName(hDBEvent: THandle): Boolean;
begin
- if DBExists(Contact.hContact,hppDBName,AnsiString('bm'+intToStr(hDBEvent))) then
- Result := DBDelete(Contact.hContact,hppDBName,AnsiString('bm'+intToStr(hDBEvent)))
+ if DBExists(Contact.FContact,hppDBName,AnsiString('bm'+intToStr(hDBEvent))) then
+ Result := DBDelete(Contact.FContact,hppDBName,AnsiString('bm'+intToStr(hDBEvent)))
else
Result := True;
end;
@@ -607,11 +635,11 @@ var
begin
Result := false;
- hDBEvent := db_event_first(Contact.hContact);
+ hDBEvent := db_event_first(Contact.FContact);
if hDBEvent = 0 then
exit;
first_ts := GetEventTimestamp(hDBEvent);
- hDBEvent := db_event_last(Contact.hContact);
+ hDBEvent := db_event_last(Contact.FContact);
if hDBEvent = 0 then
exit;
last_ts := GetEventTimestamp(hDBEvent);
@@ -622,7 +650,7 @@ begin
if StartFromFirst then
begin
- hDBEvent := db_event_first(Contact.hContact);
+ hDBEvent := db_event_first(Contact.FContact);
while hDBEvent <> 0 do
begin
cur_ts := GetEventTimestamp(hDBEvent);
@@ -634,12 +662,12 @@ begin
Result := True;
break;
end;
- hDBEvent := db_event_next(Contact.hContact,hDBEvent);
+ hDBEvent := db_event_next(Contact.FContact,hDBEvent);
end;
end
else
begin
- hDBEvent := db_event_last(Contact.hContact);
+ hDBEvent := db_event_last(Contact.FContact);
while hDBEvent <> 0 do
begin
cur_ts := GetEventTimestamp(hDBEvent);
@@ -651,7 +679,7 @@ begin
Result := True;
break;
end;
- hDBEvent := db_event_prev(Contact.hContact,hDBEvent);
+ hDBEvent := db_event_prev(Contact.FContact,hDBEvent);
end;
end;
end;