From 080f265f84ed417f0ab607553f5a7ce7ed283220 Mon Sep 17 00:00:00 2001 From: rc-swag <58423624+rc-swag@users.noreply.github.com> Date: Fri, 24 May 2024 09:55:01 +1000 Subject: [PATCH] chore(windows): remove cleanup-alpha-tasks Remove the CleanupAlphaTasks that was specific to task schedules created it for 15.0 alpha. Scheduled tasks naming was changed to include a user name in the task. The clean up function was to make sure the previous named tasks were removed. Now there should be no 15.0 alpha users it can be removed. --- .../util/Keyman.System.KeymanStartTask.pas | 44 ------------------- 1 file changed, 44 deletions(-) diff --git a/windows/src/desktop/kmshell/util/Keyman.System.KeymanStartTask.pas b/windows/src/desktop/kmshell/util/Keyman.System.KeymanStartTask.pas index 35cb960a7ec..51d27a83a4e 100644 --- a/windows/src/desktop/kmshell/util/Keyman.System.KeymanStartTask.pas +++ b/windows/src/desktop/kmshell/util/Keyman.System.KeymanStartTask.pas @@ -11,7 +11,6 @@ interface TKeymanStartTask = class private class function GetTaskName: string; - class procedure CleanupAlphaTasks(pTaskFolder: ITaskFolder); static; {$IF FALSE} //Disabled to avoid hint during build; re-enable if wanting to //re-establish the task model @@ -115,15 +114,6 @@ class procedure TKeymanStartTask.CreateTask; end; end; - try - CleanupAlphaTasks(pTaskFolder); - except - on E:Exception do - begin - TKeymanSentryClient.ReportHandledException(E, 'Failed to cleanup alpha tasks'); - end; - end; - try // Create a new task pTask := pService.NewTask(0); @@ -228,8 +218,6 @@ class procedure TKeymanStartTask.DeleteTask; end; end; - CleanupAlphaTasks(pTaskFolder); - if pTaskFolder.GetTasks(0).Count = 0 then begin pTaskFolder := nil; @@ -260,36 +248,4 @@ class procedure TKeymanStartTask.RecreateTask; CreateTask; end; -class procedure TKeymanStartTask.CleanupAlphaTasks(pTaskFolder: ITaskFolder); -var - tasks: IRegisteredTaskCollection; - i: Integer; -begin - // Cleanup earlier alpha-version tasks: we renamed the task to include the - // user's login name in build 14.0.194 of Keyman, so that multiple users could - // create the task on the same machine. It's not obvious, but the Tasks - // namespace is shared between all users -- non-admin users will not be able - // to see or overwrite tasks created by other users; they'd just get a - // (silent) access denied result. - try - tasks := pTaskFolder.GetTasks(0); - for i := 1 to tasks.Count do - if SameText(tasks.Item[i].Name, CTaskName) then - begin - tasks := nil; - pTaskFolder.DeleteTask(CTaskName, 0); - Exit; - end; - except - on E:EOleException do - begin - if (E.ErrorCode <> HResultFromWin32(ERROR_FILE_NOT_FOUND)) and - (E.ErrorCode <> HResultFromWin32(ERROR_ACCESS_DENIED)) then - // We ignore when the task doesn't exist, but report other errors - TKeymanSentryClient.ReportHandledException(E, 'Failed to delete task '+CTaskName); - end; - end; -end; - - end.