V0.3.4.0

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5716 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
gbamber
2017-01-27 11:41:56 +00:00
parent 51a37fa2df
commit 8df7405532
4 changed files with 40 additions and 15 deletions

View File

@ -996,7 +996,14 @@ begin
Result := CreateDesktopShortCut(fShortCutClass.Target,
fShortCutClass.TargetArguments, fShortCutClass.ShortcutName,
fShortCutClass.IconFileName, fShortCutClass.CategoryString);
if fFireDebugEvent then
if Result = True then
fOndebugEvent(Self, 'MakeShortCut', 'MakeShortCut succeded')
else
fOndebugEvent(Self, 'MakeShortCut', 'MakeShortCut failed');
end;
function TLazAutoUpdate.DeleteShortCut: boolean;
begin
Result := False; // assume failure, look for success
@ -1004,14 +1011,22 @@ begin
fFireDebugEvent := True;
if fFireDebugEvent then
fOndebugEvent(Self, 'DeleteShortCut', 'DeleteShortCut called');
If fShortCutClass.ShortcutName='' then
fOndebugEvent(Self, 'DeleteShortCut',
Format('DeleteShortCut called. Shortcut name=%s', [fShortCutClass.ShortcutName]));
if fShortCutClass.ShortcutName = '' then
begin
if fFireDebugEvent then
fOndebugEvent(Self, 'DeleteShortCut', 'ShortCut.ShortCutName was empty!');
Exit;
end;
Result:=DeleteDesktopShortcut(fShortCutClass.ShortCutName);
Result := DeleteDesktopShortcut(fShortCutClass.ShortCutName);
if fFireDebugEvent then
if Result = True then
fOndebugEvent(Self, 'MakeShortCut', 'DeleteShortCut succeded')
else
fOndebugEvent(Self, 'MakeShortCut', 'DeleteShortCut failed');
end;
procedure TLazAutoUpdate.ShowWhatsNewIfAvailable;

View File

@ -9,7 +9,7 @@
"ForceNotify" : false,
"InternalVersion" : 1,
"Name" : "lazupdate.lpk",
"Version" : "0.3.3.0"
"Version" : "0.3.4.0"
}
]
}

View File

@ -1,4 +1,5 @@
unit ushortcut;
{
License
=======
@ -74,6 +75,7 @@ Icon=fooview-new
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LazUTF8, FileUtil, LazFileUtils
{$IFDEF LINUX}, process{$ENDIF}
@ -83,7 +85,7 @@ uses
function CreateDesktopShortCut(Target, TargetArguments, ShortcutName,
IconFileName, Category: string): boolean;
function DeleteDesktopShortcut(ShortcutName: string):Boolean;
function DeleteDesktopShortcut(ShortcutName: string): boolean;
implementation
@ -166,7 +168,8 @@ begin
Result := False;
if Result = False then
Exit;
if Category = '' then Category := 'Utility';
if Category = '' then
Category := 'Utility';
XdgDesktopFile := IncludeTrailingPathDelimiter(GetTempDir(False)) +
'fpcup-' + shortcutname + '.desktop';
@ -210,24 +213,31 @@ end;
{$ENDIF UNIX}
{$IFDEF MSWINDOWS}
Function DeleteDesktopShortcut(ShortcutName: string):Boolean;
function DeleteDesktopShortcut(ShortcutName: string): boolean;
var
PIDL: PItemIDList;
InFolder: array[0..MAX_PATH] of char;
LinkName: WideString;
begin
Result:=FALSE;
{ Get the desktop location }
SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, PIDL);
SHGetPathFromIDList(PIDL, InFolder);
LinkName := IncludeTrailingPathDelimiter(InFolder) + ShortcutName + '.lnk';
If SysUtils.DeleteFile(LinkName) then Result:=TRUE;
Result := False;
try
{ Get the desktop location }
SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, PIDL);
SHGetPathFromIDList(PIDL, InFolder);
LinkName := IncludeTrailingPathDelimiter(InFolder) + ShortcutName + '.lnk';
if SysUtils.DeleteFile(LinkName) then
Result := True;
except
// Eat the exception
end;
end;
{$ELSE}
Function DeleteDesktopShortcut(ShortcutName: string):Boolean;
function DeleteDesktopShortcut(ShortcutName: string): boolean;
begin
Result:=FALSE;
Result := False;
end;
{$ENDIF MSWINDOWS}
end.