Work-in-progress

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5718 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
gbamber
2017-01-27 15:03:28 +00:00
parent e9b6ce6f04
commit 55b0f8fb67
6 changed files with 70 additions and 14 deletions

View File

@ -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.
"/>
<Version Minor="3" Release="4" Build="1"/>
<Version Minor="3" Release="5"/>
<Files Count="7">
<Item1>
<Filename Value="ulazautoupdate.pas"/>

View File

@ -42,15 +42,15 @@
</Unit3>
<Unit4>
<Filename Value="..\ulazautoupdate.pas"/>
<EditorIndex Value="1"/>
<TopLine Value="992"/>
<CursorPos X="68" Y="1025"/>
<IsVisibleTab Value="True"/>
<WindowIndex Value="1"/>
<TopLine Value="1707"/>
<CursorPos X="44" Y="1747"/>
<ExtraEditorCount Value="2"/>
<ExtraEditor1>
<IsVisibleTab Value="True"/>
<WindowIndex Value="1"/>
<TopLine Value="1707"/>
<CursorPos X="44" Y="1747"/>
<EditorIndex Value="1"/>
<TopLine Value="992"/>
<CursorPos X="68" Y="1025"/>
</ExtraEditor1>
<ExtraEditor2>
<EditorIndex Value="-1"/>
@ -187,8 +187,8 @@
<Filename Value="..\ushortcut.pas"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="4"/>
<TopLine Value="222"/>
<CursorPos X="72" Y="237"/>
<TopLine Value="7"/>
<CursorPos X="56" Y="39"/>
<UsageCount Value="23"/>
<Loaded Value="True"/>
</Unit22>

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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