summaryrefslogtreecommitdiff
path: root/plugins/HistoryPlusPlus
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-02-20 15:18:40 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-02-20 15:18:40 +0300
commit827327682d75718dea04ff0ede7b46cb746d2ec5 (patch)
tree9f3123de15200a4da7bce716f7622e8571f20549 /plugins/HistoryPlusPlus
parentb37158418475db921a89452e94e51affd46949c6 (diff)
fixes #2747 (unified System History menu item creation)
Diffstat (limited to 'plugins/HistoryPlusPlus')
-rw-r--r--plugins/HistoryPlusPlus/historypp.dpr59
1 files changed, 17 insertions, 42 deletions
diff --git a/plugins/HistoryPlusPlus/historypp.dpr b/plugins/HistoryPlusPlus/historypp.dpr
index d12fae42a4..68006d6a92 100644
--- a/plugins/HistoryPlusPlus/historypp.dpr
+++ b/plugins/HistoryPlusPlus/historypp.dpr
@@ -67,31 +67,14 @@ uses
hpp_JclSysUtils in 'hpp_JclSysUtils.pas',
hpp_puny in 'hpp_puny.pas';
-type
- TMenuHandles = record
- Handle: THandle;
- Name: pWideChar;
- end;
-
-const
- miContact = 0;
- miSystem = 1;
- miSearch = 2;
- miEmpty = 3;
- miSysEmpty = 4;
-
var
MenuCount: Integer = -1;
PrevShowHistoryCount: Boolean = False;
- MenuHandles: array[0..4] of TMenuHandles = (
- (Handle:0; Name:'View &History'),
- (Handle:0; Name:'&System History'),
- (Handle:0; Name:'His&tory Search'),
- (Handle:0; Name:'&Empty History'),
- (Handle:0; Name:'&Empty System History'));
+ hmiEmpty, hmiContact: THandle;
const
hLangpack:THANDLE = 0;
+ histName:PWideChar = 'View &History';
var
HookModulesLoad,
@@ -234,42 +217,34 @@ begin
SET_UID(@menuItem, '806B9223-0522-4B6B-AB2C-666D76C45D59');
menuItem.Position := 1000090000;
- menuItem.szName.w := MenuHandles[miContact].Name;
+ menuItem.szName.w := histName;
menuItem.pszService := MS_HISTORY_SHOWCONTACTHISTORY;
menuItem.hIcon := hppIcons[HPP_ICON_CONTACTHISTORY].handle;
- MenuHandles[miContact].Handle := Menu_AddContactMenuItem(@menuItem);
+ hmiContact := Menu_AddContactMenuItem(@menuItem);
// create empty item in contact menu
SET_UID(@menuItem, 'BA23B260-0AF7-4336-9703-D47C9AD7B1B0');
menuItem.Position := 1000090001;
- menuItem.szName.w := MenuHandles[miEmpty].Name;
+ menuItem.szName.w := '&Empty History';
menuItem.pszService := MS_HPP_EMPTYHISTORY;
menuItem.hIcon := hppIcons[HPP_ICON_TOOL_DELETEALL].handle;
- MenuHandles[miEmpty].Handle := Menu_AddContactMenuItem(@menuItem);
-
- // create menu item in main menu for system history
- SET_UID(@menuItem, 'A08805DD-7402-472D-BB46-0C702D03423A');
- menuItem.Position:=500060000;
- menuItem.szName.w:=MenuHandles[miSystem].Name;
- menuItem.pszService := MS_HISTORY_SHOWCONTACTHISTORY;
- menuItem.hIcon := hppIcons[HPP_ICON_CONTACTHISTORY].handle;
- MenuHandles[miSystem].Handle := Menu_AddMainMenuItem(@menuitem);
+ hmiEmpty := Menu_AddContactMenuItem(@menuItem);
// create menu item in main menu for history search
SET_UID(@menuItem, 'A5FE6AE6-7674-4DC0-9F22-9F56AE71E2D7');
- menuItem.Position:=500060001;
- menuItem.szName.w:=MenuHandles[miSearch].Name;
+ menuItem.Position := 500060001;
+ menuItem.szName.w := 'His&tory Search';
menuItem.pszService := MS_HPP_SHOWGLOBALSEARCH;
menuItem.hIcon := hppIcons[HPP_ICON_GLOBALSEARCH].handle;
- MenuHandles[miSearch].Handle := Menu_AddMainMenuItem(@menuItem);
+ Menu_AddMainMenuItem(@menuItem);
// create menu item in main menu for empty system history
SET_UID(@menuItem, '633AD23C-24B5-4914-B240-AD9FACB564ED');
- menuItem.Position:=500060002;
- menuItem.szName.w:=MenuHandles[miSysEmpty].Name;
+ menuItem.Position := 500060002;
+ menuItem.szName.w := '&Empty System History';
menuItem.pszService := MS_HPP_EMPTYHISTORY;
menuItem.hIcon := hppIcons[HPP_ICON_TOOL_DELETEALL].handle;
- MenuHandles[miSysEmpty].Handle := Menu_AddMainMenuItem(@menuItem);
+ Menu_AddMainMenuItem(@menuItem);
LoadGridOptions;
@@ -447,17 +422,17 @@ begin
hLast := db_event_last(hContact);
if (PrevShowHistoryCount xor ShowHistoryCount) or (count <> MenuCount) then
begin
- Menu_ShowItem(MenuHandles[miEmpty].Handle, byte(hLast <> 0));
- Menu_ShowItem(MenuHandles[miContact].Handle, byte(hLast <> 0));
+ Menu_ShowItem(hmiEmpty, byte(hLast <> 0));
+ Menu_ShowItem(hmiContact, byte(hLast <> 0));
if ShowHistoryCount then
- text := pWideChar(Format('%s [%u]',[TranslateW(MenuHandles[miContact].Name),count]))
+ text := pWideChar(Format('%s [%u]',[TranslateW(histName),count]))
else if PrevShowHistoryCount then
- text := TranslateW(MenuHandles[miContact].Name)
+ text := TranslateW(histName)
else
text := nil;
- Menu_ModifyItem(MenuHandles[miContact].Handle, text);
+ Menu_ModifyItem(hmiContact, text);
MenuCount := count;
PrevShowHistoryCount := ShowHistoryCount;
end;