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
;
21 use installer
::exiter
;
23 use installer
::globals
;
24 use installer
::windows
::idtglobal
;
26 ##############################################################
27 # Returning identifier for msishortcutproperty table.
28 ##############################################################
30 sub get_msishortcutproperty_identifier
32 my ($msishortcutproperty) = @_;
34 my $identifier = $msishortcutproperty->{'gid'};
39 ##############################################################
40 # Returning shortcut for msishortcutproperty table.
41 ##############################################################
43 sub get_msishorcutproperty_shortcut
45 my ($msishortcutproperty, $filesref) = @_;
50 my $msishortcutproperty_shortcutid = $msishortcutproperty->{'ShortcutID'};
52 for ( my $i = 0; $i <= $#{$filesref}; $i++ )
54 $onefile = ${$filesref}[$i];
55 my $filegid = $onefile->{'gid'};
57 if ( $filegid eq $msishortcutproperty_shortcutid )
66 installer
::exiter
::exit_program
("ERROR: Did not find ShortcutID $msishortcutproperty_shortcutid in file collection for shortcut", "get_msishorcutproperty_shortcut");
69 $shortcut = $onefile->{'gid'};
74 ##############################################################
75 # Returning the propertykey for msishortcutproperty table.
76 ##############################################################
78 sub get_msishortcutproperty_propertykey
80 my ($msishortcutproperty) = @_;
83 if ( $msishortcutproperty->{'Key'} ) { $propertykey = $msishortcutproperty->{'Key'}; }
88 ################################################################
89 # Returning the propvariantvalue for msishortcutproperty table.
90 ################################################################
92 sub get_msishortcutproperty_propvariantvalue
94 my ($msishortcutproperty) = @_;
96 my $propvariantvalue = "";
97 if ( $msishortcutproperty->{'Value'} ) { $propvariantvalue = $msishortcutproperty->{'Value'}; }
99 return $propvariantvalue;
102 ###################################################################
103 # Creating the file MsiShortcutProperty.idt dynamically
105 # MsiShortcutProperty Shortcut_ PropertyKey PropVariantValue
106 ###################################################################
108 sub create_msishortcutproperty_table
110 my ($folderitempropertiesref, $folderitemsref, $basedir) = @_;
112 my @msishortcutpropertytable = ();
114 installer
::windows
::idtglobal
::write_idt_header
(\
@msishortcutpropertytable, "msishortcutproperty");
116 # The entries defined in scp as FolderItemProperties
118 for ( my $j = 0; $j <= $#{$folderitempropertiesref}; $j++ )
120 my $onelink = ${$folderitempropertiesref}[$j];
121 my %msishortcutproperty = ();
123 $msishortcutproperty{'MsiShortcutProperty'} = get_msishortcutproperty_identifier
($onelink);
124 $msishortcutproperty{'Shortcut_'} = get_msishorcutproperty_shortcut
($onelink, $folderitemsref);
125 $msishortcutproperty{'PropertyKey'} = get_msishortcutproperty_propertykey
($onelink);
126 $msishortcutproperty{'PropVariantValue'} = get_msishortcutproperty_propvariantvalue
($onelink);
128 my $oneline = $msishortcutproperty{'MsiShortcutProperty'} . "\t" . $msishortcutproperty{'Shortcut_'} . "\t"
129 . $msishortcutproperty{'PropertyKey'} . "\t" . $msishortcutproperty{'PropVariantValue'} . "\n";
131 push(@msishortcutpropertytable, $oneline);
136 my $msishortcutpropertytablename = $basedir . $installer::globals
::separator
. "MsiShorP.idt";
137 installer
::files
::save_file
($msishortcutpropertytablename ,\
@msishortcutpropertytable);
138 my $infoline = "Created idt file: $msishortcutpropertytablename\n";
139 push(@installer::globals
::logfileinfo
, $infoline);