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, along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 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"> <Files Count="7">
<Item1> <Item1>
<Filename Value="ulazautoupdate.pas"/> <Filename Value="ulazautoupdate.pas"/>

View File

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

View File

@ -1047,6 +1047,20 @@ begin
C_WhatsNewFilename); C_WhatsNewFilename);
Exit; Exit;
end; 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 // Create the form, memo and close button
if fParentForm <> nil then if fParentForm <> nil then
@ -1077,7 +1091,12 @@ begin
ScrollBars := ssAutoBoth; ScrollBars := ssAutoBoth;
WordWrap := True; WordWrap := True;
Parent := WhatsNewForm; Parent := WhatsNewForm;
Lines.LoadFromFile(ProgramDirectory + C_WhatsNewFilename); TRY
Lines.LoadFromFile(ProgramDirectory + C_WhatsNewFilename);
except
Clear;
Lines.Add('Unable to show whats new');
end;
end; end;
with cmdClose do with cmdClose do
begin begin

View File

@ -717,6 +717,8 @@ object mainform: Tmainform
VersionCountLimit = 1000000 VersionCountLimit = 1000000
DownloadCountLimit = 10000000 DownloadCountLimit = 10000000
ZipfileName = 'updatepack.zip' ZipfileName = 'updatepack.zip'
ShortCut.ShortcutName = 'MyShortcutName'
ShortCut.Category = scAudioVideo
Left = 424 Left = 424
Top = 40 Top = 40
end end

View File

@ -487,7 +487,11 @@ end;
procedure Tmainform.FormShow(Sender: TObject); procedure Tmainform.FormShow(Sender: TObject);
begin begin
Try
LazAutoUpdate1.ShowWhatsNewIfAvailable; LazAutoUpdate1.ShowWhatsNewIfAvailable;
Except
raise Exception.Create('Problem in FormShow');
end;
bCurrentProfileSaved := True; bCurrentProfileSaved := True;
end; 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, along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 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 Linux Shortcut Info
=================== ===================
@ -117,6 +124,18 @@ end;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
function CreateDesktopShortCut(Target, TargetArguments, ShortcutName, function CreateDesktopShortCut(Target, TargetArguments, ShortcutName,
IconFileName, Category: string): boolean; 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 var
IObject: IUnknown; IObject: IUnknown;
ISLink: IShellLink; ISLink: IShellLink;
@ -162,6 +181,18 @@ end;
{$IFDEF UNIX} {$IFDEF UNIX}
function CreateDesktopShortCut(Target, TargetArguments, ShortcutName, function CreateDesktopShortCut(Target, TargetArguments, ShortcutName,
IconFileName, Category: string): boolean; 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 var
XdgDesktopContent: TStringList; XdgDesktopContent: TStringList;
XdgDesktopFile: string; XdgDesktopFile: string;
@ -177,9 +208,9 @@ begin
Result := False; Result := False;
Exit; Exit;
end; end;
if not FileExistsUTF8(ExtractFilePath(Target) + IconFileName) then if not FileExistsUTF8(IconFileName) then
begin begin
sErrorString:='File "' + ExtractFilePath(Target) + IconFileName + '" cannot be located.'; sErrorString:='File "' + IconFileName + '" cannot be located.';
Result := False; Result := False;
Exit; Exit;
end; end;
@ -203,7 +234,7 @@ begin
XdgDesktopContent.Add('[Desktop Entry]'); XdgDesktopContent.Add('[Desktop Entry]');
XdgDesktopContent.Add('Encoding=UTF-8'); XdgDesktopContent.Add('Encoding=UTF-8');
XdgDesktopContent.Add('Type=Application'); XdgDesktopContent.Add('Type=Application');
XdgDesktopContent.Add('Icon=' + ExtractFilePath(Target) + IconFileName); XdgDesktopContent.Add('Icon=' + IconFileName);
If TargetArguments <> '' then If TargetArguments <> '' then
XdgDesktopContent.Add('Exec=' + Target + ' ' + TargetArguments) XdgDesktopContent.Add('Exec=' + Target + ' ' + TargetArguments)
else else