From 55b0f8fb67abf7512c668eaf3fcb8c9b9cf69dc9 Mon Sep 17 00:00:00 2001 From: gbamber Date: Fri, 27 Jan 2017 15:03:28 +0000 Subject: [PATCH] Work-in-progress git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5718 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../lazautoupdate/latest_stable/lazupdate.lpk | 2 +- .../latest_stable/testapp/testapp.lps | 18 ++++----- .../latest_stable/ulazautoupdate.pas | 21 ++++++++++- .../latest_stable/updatepack/umainform.lfm | 2 + .../latest_stable/updatepack/umainform.pas | 4 ++ .../lazautoupdate/latest_stable/ushortcut.pas | 37 +++++++++++++++++-- 6 files changed, 70 insertions(+), 14 deletions(-) diff --git a/components/lazautoupdate/latest_stable/lazupdate.lpk b/components/lazautoupdate/latest_stable/lazupdate.lpk index 33f669008..ae0c73cdb 100644 --- a/components/lazautoupdate/latest_stable/lazupdate.lpk +++ b/components/lazautoupdate/latest_stable/lazupdate.lpk @@ -66,7 +66,7 @@ More information in the Wiki Home Page http://wiki.freepascal.org/LazAutoUpdater along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. "/> - + diff --git a/components/lazautoupdate/latest_stable/testapp/testapp.lps b/components/lazautoupdate/latest_stable/testapp/testapp.lps index 236542fbb..b766d5f17 100644 --- a/components/lazautoupdate/latest_stable/testapp/testapp.lps +++ b/components/lazautoupdate/latest_stable/testapp/testapp.lps @@ -42,15 +42,15 @@ - - - + + + + - - - - + + + @@ -187,8 +187,8 @@ - - + + diff --git a/components/lazautoupdate/latest_stable/ulazautoupdate.pas b/components/lazautoupdate/latest_stable/ulazautoupdate.pas index c07560197..d3e3b8985 100644 --- a/components/lazautoupdate/latest_stable/ulazautoupdate.pas +++ b/components/lazautoupdate/latest_stable/ulazautoupdate.pas @@ -1047,6 +1047,20 @@ begin C_WhatsNewFilename); Exit; end; + // Linux fix + If DirectoryExistsUTF8(C_WhatsNewFilename) then + begin + if fFireDebugEvent then + fOndebugEvent(Self, 'ShowWhatsNewIfAvailable', 'Found directory '+ + C_WhatsNewFilename); + If RemoveDirUTF8(C_WhatsNewFilename) then + begin + if fFireDebugEvent then + fOndebugEvent(Self, 'ShowWhatsNewIfAvailable', 'Deleted directory '+ + C_WhatsNewFilename); + end; + Exit; + end; // Create the form, memo and close button if fParentForm <> nil then @@ -1077,7 +1091,12 @@ begin ScrollBars := ssAutoBoth; WordWrap := True; Parent := WhatsNewForm; - Lines.LoadFromFile(ProgramDirectory + C_WhatsNewFilename); + TRY + Lines.LoadFromFile(ProgramDirectory + C_WhatsNewFilename); + except + Clear; + Lines.Add('Unable to show whats new'); + end; end; with cmdClose do begin diff --git a/components/lazautoupdate/latest_stable/updatepack/umainform.lfm b/components/lazautoupdate/latest_stable/updatepack/umainform.lfm index 8da6bc6f1..61704000f 100644 --- a/components/lazautoupdate/latest_stable/updatepack/umainform.lfm +++ b/components/lazautoupdate/latest_stable/updatepack/umainform.lfm @@ -717,6 +717,8 @@ object mainform: Tmainform VersionCountLimit = 1000000 DownloadCountLimit = 10000000 ZipfileName = 'updatepack.zip' + ShortCut.ShortcutName = 'MyShortcutName' + ShortCut.Category = scAudioVideo Left = 424 Top = 40 end diff --git a/components/lazautoupdate/latest_stable/updatepack/umainform.pas b/components/lazautoupdate/latest_stable/updatepack/umainform.pas index c28215502..8b0526308 100644 --- a/components/lazautoupdate/latest_stable/updatepack/umainform.pas +++ b/components/lazautoupdate/latest_stable/updatepack/umainform.pas @@ -487,7 +487,11 @@ end; procedure Tmainform.FormShow(Sender: TObject); begin + Try LazAutoUpdate1.ShowWhatsNewIfAvailable; + Except + raise Exception.Create('Problem in FormShow'); + end; bCurrentProfileSaved := True; end; diff --git a/components/lazautoupdate/latest_stable/ushortcut.pas b/components/lazautoupdate/latest_stable/ushortcut.pas index 1c24adca9..c3ce38163 100644 --- a/components/lazautoupdate/latest_stable/ushortcut.pas +++ b/components/lazautoupdate/latest_stable/ushortcut.pas @@ -30,6 +30,13 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Credits +======= +Code adapted from fpcup (@BigChimp and @DonAlfredo at freepascal forum) + +Use +=== +Use public function 'GetShortCutErrorString' to show an error when debugging Linux Shortcut Info =================== @@ -117,6 +124,18 @@ end; {$IFDEF MSWINDOWS} function CreateDesktopShortCut(Target, TargetArguments, ShortcutName, IconFileName, Category: string): boolean; +{ +IN: + Target: Filename with full path + TargetArguments: String of arguments + ShortCutName: Simple string + IconFileName: Filename with full path + Category: Simple string (see header of this unit) +OUT: + True = Success + False = Fail + Use function GetShortCutErrorString to get most recent error as a string +} var IObject: IUnknown; ISLink: IShellLink; @@ -162,6 +181,18 @@ end; {$IFDEF UNIX} function CreateDesktopShortCut(Target, TargetArguments, ShortcutName, IconFileName, Category: string): boolean; +{ +IN: + Target: Filename with full path + TargetArguments: String of arguments + ShortCutName: Simple string + IconFileName: Filename with full path + Category: Simple string (see header of this unit) +OUT: + True = Success + False = Fail + Use function GetShortCutErrorString to get most recent error as a string +} var XdgDesktopContent: TStringList; XdgDesktopFile: string; @@ -177,9 +208,9 @@ begin Result := False; Exit; end; - if not FileExistsUTF8(ExtractFilePath(Target) + IconFileName) then + if not FileExistsUTF8(IconFileName) then begin - sErrorString:='File "' + ExtractFilePath(Target) + IconFileName + '" cannot be located.'; + sErrorString:='File "' + IconFileName + '" cannot be located.'; Result := False; Exit; end; @@ -203,7 +234,7 @@ begin XdgDesktopContent.Add('[Desktop Entry]'); XdgDesktopContent.Add('Encoding=UTF-8'); XdgDesktopContent.Add('Type=Application'); - XdgDesktopContent.Add('Icon=' + ExtractFilePath(Target) + IconFileName); + XdgDesktopContent.Add('Icon=' + IconFileName); If TargetArguments <> '' then XdgDesktopContent.Add('Exec=' + Target + ' ' + TargetArguments) else