2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package installer
::windows
::msishortcutproperty
;
24 use installer
::exiter
;
26 use installer
::globals
;
27 use installer
::windows
::idtglobal
;
29 ##############################################################
30 # Returning identifier for msishortcutproperty table.
31 ##############################################################
33 sub get_msishortcutproperty_identifier
35 my ($msishortcutproperty) = @_;
37 my $identifier = $msishortcutproperty->{'gid'};
42 ##############################################################
43 # Returning shortcut for msishortcutproperty table.
44 ##############################################################
46 sub get_msishorcutproperty_shortcut
48 my ($msishortcutproperty, $filesref) = @_;
53 my $msishortcutproperty_shortcutid = $msishortcutproperty->{'ShortcutID'};
55 for ( my $i = 0; $i <= $#{$filesref}; $i++ )
57 $onefile = ${$filesref}[$i];
58 my $filegid = $onefile->{'gid'};
60 if ( $filegid eq $msishortcutproperty_shortcutid )
69 installer
::exiter
::exit_program
("ERROR: Did not find ShortcutID $msishortcutproperty_shortcutid in file collection for shortcut", "get_msishorcutproperty_shortcut");
72 $shortcut = $onefile->{'gid'};
77 ##############################################################
78 # Returning the propertykey for msishortcutproperty table.
79 ##############################################################
81 sub get_msishortcutproperty_propertykey
83 my ($msishortcutproperty) = @_;
86 if ( $msishortcutproperty->{'Key'} ) { $propertykey = $msishortcutproperty->{'Key'}; }
91 ################################################################
92 # Returning the propvariantvalue for msishortcutproperty table.
93 ################################################################
95 sub get_msishortcutproperty_propvariantvalue
97 my ($msishortcutproperty) = @_;
99 my $propvariantvalue = "";
100 if ( $msishortcutproperty->{'Value'} ) { $propvariantvalue = $msishortcutproperty->{'Value'}; }
102 return $propvariantvalue;
105 ###################################################################
106 # Creating the file MsiShortcutProperty.idt dynamically
108 # MsiShortcutProperty Shortcut_ PropertyKey PropVariantValue
109 ###################################################################
111 sub create_msishortcutproperty_table
113 my ($folderitempropertiesref, $folderitemsref, $basedir) = @_;
115 my @msishortcutpropertytable = ();
117 installer
::windows
::idtglobal
::write_idt_header
(\
@msishortcutpropertytable, "msishortcutproperty");
119 # The entries defined in scp as FolderItemProperties
121 for ( my $j = 0; $j <= $#{$folderitempropertiesref}; $j++ )
123 my $onelink = ${$folderitempropertiesref}[$j];
124 my %msishortcutproperty = ();
126 $msishortcutproperty{'MsiShortcutProperty'} = get_msishortcutproperty_identifier
($onelink);
127 $msishortcutproperty{'Shortcut_'} = get_msishorcutproperty_shortcut
($onelink, $folderitemsref);
128 $msishortcutproperty{'PropertyKey'} = get_msishortcutproperty_propertykey
($onelink);
129 $msishortcutproperty{'PropVariantValue'} = get_msishortcutproperty_propvariantvalue
($onelink);
131 my $oneline = $msishortcutproperty{'MsiShortcutProperty'} . "\t" . $msishortcutproperty{'Shortcut_'} . "\t"
132 . $msishortcutproperty{'PropertyKey'} . "\t" . $msishortcutproperty{'PropVariantValue'} . "\n";
134 push(@msishortcutpropertytable, $oneline);
139 my $msishortcutpropertytablename = $basedir . $installer::globals
::separator
. "MsiShorP.idt";
140 installer
::files
::save_file
($msishortcutpropertytablename ,\
@msishortcutpropertytable);
141 my $infoline = "Created idt file: $msishortcutpropertytablename\n";
142 push(@installer::globals
::logfileinfo
, $infoline);