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

View File

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

View File

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