[Libreoffice-commits] core.git: scp2/source setup_native/Package_misc.mk setup_native/source solenv/bin

Andras Timar andras.timar at collabora.com
Fri Oct 25 07:33:24 PDT 2013


 scp2/source/base/folderitem_base.scp              |    3 
 scp2/source/calc/folderitem_calc.scp              |    3 
 scp2/source/draw/folderitem_draw.scp              |    3 
 scp2/source/impress/folderitem_impress.scp        |    3 
 scp2/source/math/folderitem_math.scp              |    3 
 scp2/source/ooo/common_brand.scp                  |   11 +++
 scp2/source/ooo/folderitem_ooo.scp                |   13 ++--
 scp2/source/writer/folderitem_writer.scp          |    3 
 setup_native/Package_misc.mk                      |    1 
 setup_native/source/win32/desktophelper.txt       |    1 
 solenv/bin/modules/installer.pm                   |    2 
 solenv/bin/modules/installer/globals.pm           |    2 
 solenv/bin/modules/installer/setupscript.pm       |   31 +++++++++
 solenv/bin/modules/installer/windows/component.pm |    7 ++
 solenv/bin/modules/installer/windows/file.pm      |   24 +++++++
 solenv/bin/modules/installer/windows/property.pm  |    3 
 solenv/bin/modules/installer/windows/registry.pm  |   38 ++++++++++++
 solenv/bin/modules/installer/windows/shortcut.pm  |   69 +++++++++++++++++++++-
 solenv/bin/modules/installer/worker.pm            |   28 ++++++++
 solenv/bin/modules/t/installer-setupscript.t      |    1 
 20 files changed, 233 insertions(+), 16 deletions(-)

New commits:
commit 7d97ec9a3eba9ceacbea631a56185e40b62fdec7
Author: Andras Timar <andras.timar at collabora.com>
Date:   Fri Oct 25 06:38:06 2013 -0700

    fdo#65102 respect user's choice not to install desktop icon
    
    Using advertised shortcuts -- inspired by Intel AppUp Centre's
    requirement -- was not a good idea after all. I revert this,
    and  I also revert the commit that actually disabled it in
    default Windows builds.
    
    This reverts commit aa2450cb51cfc3805c7a596b6b89d70bb133821e.
    This reverts commit b40012bd6d0b5387005253f1d3f03929ce4d1ac6.

diff --git a/scp2/source/base/folderitem_base.scp b/scp2/source/base/folderitem_base.scp
index 2da4321..51a940b 100644
--- a/scp2/source/base/folderitem_base.scp
+++ b/scp2/source/base/folderitem_base.scp
@@ -21,13 +21,14 @@
 #ifndef ENABLE_SILENT_MSI
 FolderItem gid_Folderitem_Sbase
     Name = "%PRODUCTNAME Base";
-    ModuleID = gid_Module_Brand_Prg_Base;
+    ModuleID = gid_Module_Prg_Base_Bin;
     FolderID = gid_Folder_Staroffice51;
     FileID = gid_File_Exe_Sbase;
     IconFile = gid_File_Exe_Sbase;
     IconID = 0;
     WkDir = gid_Brand_Dir_Program;
     Parameter = "";
+    Styles = (NON_ADVERTISED);
     ALL_LANG(Tooltip, STR_FI_TOOLTIP_BASE);
 End
 
diff --git a/scp2/source/calc/folderitem_calc.scp b/scp2/source/calc/folderitem_calc.scp
index 83dd82b..05db68f 100644
--- a/scp2/source/calc/folderitem_calc.scp
+++ b/scp2/source/calc/folderitem_calc.scp
@@ -21,13 +21,14 @@
 #ifndef ENABLE_SILENT_MSI
 FolderItem gid_Folderitem_Scalc
     Name = "%PRODUCTNAME Calc";
-    ModuleID = gid_Module_Brand_Prg_Calc;
+    ModuleID = gid_Module_Prg_Calc_Bin;
     FolderID = gid_Folder_Staroffice51;
     FileID = gid_File_Exe_Scalc;
     IconFile = gid_File_Exe_Scalc;
     IconID = 0;
     WkDir = gid_Brand_Dir_Program;
     Parameter = "";
+    Styles = (NON_ADVERTISED);
     ALL_LANG(Tooltip, STR_FI_TOOLTIP_CALC);
 End
 
diff --git a/scp2/source/draw/folderitem_draw.scp b/scp2/source/draw/folderitem_draw.scp
index ba59ea7..f692707 100644
--- a/scp2/source/draw/folderitem_draw.scp
+++ b/scp2/source/draw/folderitem_draw.scp
@@ -21,13 +21,14 @@
 #ifndef ENABLE_SILENT_MSI
 FolderItem gid_Folderitem_Sdraw
     Name = "%PRODUCTNAME Draw";
-    ModuleID = gid_Module_Brand_Prg_Draw;
+    ModuleID = gid_Module_Prg_Draw_Bin;
     FolderID = gid_Folder_Staroffice51;
     FileID = gid_File_Exe_Sdraw;
     IconFile = gid_File_Exe_Sdraw;
     IconID = 0;
     WkDir = gid_Brand_Dir_Program;
     Parameter = "";
+    Styles = (NON_ADVERTISED);
     ALL_LANG(Tooltip, STR_FI_TOOLTIP_DRAW);
 End
 
diff --git a/scp2/source/impress/folderitem_impress.scp b/scp2/source/impress/folderitem_impress.scp
index fb5c136..44adbbe 100644
--- a/scp2/source/impress/folderitem_impress.scp
+++ b/scp2/source/impress/folderitem_impress.scp
@@ -21,13 +21,14 @@
 #ifndef ENABLE_SILENT_MSI
 FolderItem gid_Folderitem_Simpress
     Name = "%PRODUCTNAME Impress";
-    ModuleID = gid_Module_Brand_Prg_Impress;
+    ModuleID = gid_Module_Prg_Impress_Bin;
     FolderID = gid_Folder_Staroffice51;
     FileID = gid_File_Exe_Simpress;
     IconFile = gid_File_Exe_Simpress;
     IconID = 0;
     WkDir = gid_Brand_Dir_Program;
     Parameter = "";
+    Styles = (NON_ADVERTISED);
     ALL_LANG(Tooltip, STR_FI_TOOLTIP_IMPRESS);
 End
 
diff --git a/scp2/source/math/folderitem_math.scp b/scp2/source/math/folderitem_math.scp
index 127773f..fb8bbcd 100644
--- a/scp2/source/math/folderitem_math.scp
+++ b/scp2/source/math/folderitem_math.scp
@@ -21,13 +21,14 @@
 #ifndef ENABLE_SILENT_MSI
 FolderItem gid_Folderitem_Smath
     Name = "%PRODUCTNAME Math";
-    ModuleID = gid_Module_Brand_Prg_Math;
+    ModuleID = gid_Module_Prg_Math_Bin;
     FolderID = gid_Folder_Staroffice51;
     FileID = gid_File_Exe_Smath;
     IconFile = gid_File_Exe_Smath;
     IconID = 0;
     WkDir = gid_Brand_Dir_Program;
     Parameter = "";
+    Styles = (NON_ADVERTISED);
     ALL_LANG(Tooltip, STR_FI_TOOLTIP_MATH);
 End
 
diff --git a/scp2/source/ooo/common_brand.scp b/scp2/source/ooo/common_brand.scp
index 1b2e7df..c2e296d 100644
--- a/scp2/source/ooo/common_brand.scp
+++ b/scp2/source/ooo/common_brand.scp
@@ -64,6 +64,7 @@ Module gid_Module_Root_Brand
              gid_Brand_File_Bin_Libxml2,
              gid_Brand_File_Bmp_IntroAboutShell,
              gid_Brand_File_Bmp_IntroAboutShell_custom,
+	     gid_Brand_File_Desktophelper_Txt,
              gid_Brand_File_Html_Thirdpartylicensereadme,
              gid_Brand_File_Lib_Dbghelp,
              gid_Brand_File_Lib_Mingw_GccS,
@@ -559,6 +560,16 @@ File gid_Brand_File_Bin_Soffice_Bin_Manifest
 End
 #endif
 
+#ifdef WNT
+File gid_Brand_File_Desktophelper_Txt
+    TXT_FILE_BODY;
+    Styles = (PACKED);
+    Dir = gid_Brand_Dir_Program;
+    Name = "desktophelper.txt";
+    ComponentCondition = "CREATEDESKTOPLINK=1";
+End
+#endif
+
 File gid_Brand_File_Bin_Unoinfo
     BIN_FILE_BODY;
     Dir = gid_Brand_Dir_Program;
diff --git a/scp2/source/ooo/folderitem_ooo.scp b/scp2/source/ooo/folderitem_ooo.scp
index de77ba1..ecfc7f2 100644
--- a/scp2/source/ooo/folderitem_ooo.scp
+++ b/scp2/source/ooo/folderitem_ooo.scp
@@ -20,19 +20,19 @@
 
 FolderItem gid_Folderitem_LibreOffice
     Name = "%PRODUCTNAME";
-    ModuleID = gid_Module_Root_Brand;
+    ModuleID = gid_Module_Root;
 #ifdef ENABLE_SILENT_MSI
     FolderID = PREDEFINED_STARTMENU;
-    Tooltip = "LibreOffice";
 #else
     FolderID = gid_Folder_Staroffice51;
-    ALL_LANG(Tooltip, STR_FI_TOOLTIP_SOFFICE);
 #endif
     FileID = gid_Brand_File_Bin_Soffice;
     IconFile = gid_Brand_File_Bin_Soffice;
     IconID = 0;
     WkDir = gid_Brand_Dir_Program;
     Parameter = "";
+    Styles = (NON_ADVERTISED);
+    ALL_LANG(Tooltip, STR_FI_TOOLTIP_SOFFICE);
 End
 
 FolderItemProperty gid_Fip_LibreOffice_AppID
@@ -44,18 +44,19 @@ End
 FolderItem gid_Folderitem_Soffice_Desktop
 #ifdef ENABLE_SILENT_MSI
     Name = "%PRODUCTNAME";
-    Tooltip = "LibreOffice";
 #else
     Name = "%PRODUCTNAME %PRODUCTVERSION";
-    ALL_LANG(Tooltip, STR_FI_TOOLTIP_SOFFICE);
 #endif
-    ModuleID = gid_Module_Root_Brand;
+    ModuleID = gid_Module_Root;
     FolderID = PREDEFINED_DESKTOP;
     FileID = gid_Brand_File_Bin_Soffice;
     IconFile = gid_Brand_File_Bin_Soffice;
     IconID = 0;
+    ComponentIDFile = "gid_Brand_File_Desktophelper_Txt";
     WkDir = gid_Brand_Dir_Program;
     Parameter = "";
+    Styles = (NON_ADVERTISED,USE_HELPER_FILENAME);
+    ALL_LANG(Tooltip, STR_FI_TOOLTIP_SOFFICE);
     ComponentCondition = "CREATEDESKTOPLINK=1";
 End
 
diff --git a/scp2/source/writer/folderitem_writer.scp b/scp2/source/writer/folderitem_writer.scp
index 0257a96..c4f8dbf 100644
--- a/scp2/source/writer/folderitem_writer.scp
+++ b/scp2/source/writer/folderitem_writer.scp
@@ -21,13 +21,14 @@
 #ifndef ENABLE_SILENT_MSI
 FolderItem gid_Folderitem_Swriter
     Name = "%PRODUCTNAME Writer";
-    ModuleID = gid_Module_Brand_Prg_Wrt;
+    ModuleID = gid_Module_Prg_Wrt_Bin;
     FolderID = gid_Folder_Staroffice51;
     FileID = gid_File_Exe_Swriter;
     IconFile = gid_File_Exe_Swriter;
     IconID = 0;
     WkDir = gid_Brand_Dir_Program;
     Parameter = "";
+    Styles = (NON_ADVERTISED);
     ALL_LANG(Tooltip, STR_FI_TOOLTIP_WRITER);
 End
 
diff --git a/setup_native/Package_misc.mk b/setup_native/Package_misc.mk
index fa96a27..9262fc6 100644
--- a/setup_native/Package_misc.mk
+++ b/setup_native/Package_misc.mk
@@ -18,5 +18,6 @@ $(eval $(call gb_Package_add_file,setup_native/misc,bin/osl/osxdndinstall.png,ma
 $(eval $(call gb_Package_add_file,setup_native/misc,bin/root3.dat,linux/root3.dat))
 $(eval $(call gb_Package_add_file,setup_native/misc,bin/root4.dat,linux/root4.dat))
 $(eval $(call gb_Package_add_file,setup_native/misc,bin/root5.dat,linux/root5.dat))
+$(eval $(call gb_Package_add_file,setup_native/misc,bin/desktophelper.txt,win32/desktophelper.txt))
 
 # vim: set noet sw=4 ts=4:
diff --git a/setup_native/source/win32/desktophelper.txt b/setup_native/source/win32/desktophelper.txt
new file mode 100644
index 0000000..c754011
--- /dev/null
+++ b/setup_native/source/win32/desktophelper.txt
@@ -0,0 +1 @@
+# File used for desktop link
diff --git a/solenv/bin/modules/installer.pm b/solenv/bin/modules/installer.pm
index 0b5e845..3d36acf 100644
--- a/solenv/bin/modules/installer.pm
+++ b/solenv/bin/modules/installer.pm
@@ -373,6 +373,8 @@ sub run {
 
         $folderitempropertiesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "FolderItemProperty");
 
+        installer::setupscript::prepare_non_advertised_files($folderitemsinproductarrayref, $filesinproductarrayref);
+
         installer::logger::print_message( "... analyzing registryitems ... \n" );
 
         $registryitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "RegistryItem");
diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm
index 3cc3aef..29ca75d 100644
--- a/solenv/bin/modules/installer/globals.pm
+++ b/solenv/bin/modules/installer/globals.pm
@@ -186,6 +186,8 @@ BEGIN
     $refresh_includepaths = 0;
     $include_paths_read = 0;
     @patchfilecollector = ();
+    @userregistrycollector = ();
+    $addeduserregitrykeys = 0;
     $desktoplinkexists = 0;
     $analyze_spellcheckerlanguage = 0;
     %spellcheckerlanguagehash = ();
diff --git a/solenv/bin/modules/installer/setupscript.pm b/solenv/bin/modules/installer/setupscript.pm
index cc78f9a..e47f0bd 100644
--- a/solenv/bin/modules/installer/setupscript.pm
+++ b/solenv/bin/modules/installer/setupscript.pm
@@ -33,6 +33,7 @@ our @EXPORT_OK = qw(
     add_predefined_folder
     get_all_items_from_script
     get_all_scriptvariables_from_installation_object
+    prepare_non_advertised_files
     replace_all_setupscriptvariables_in_script
     replace_preset_properties
     resolve_lowercase_productname_setupscriptvariable
@@ -395,6 +396,36 @@ sub add_predefined_folder
 }
 
 #####################################################################################
+# If folderitems are non-advertised, the component needs to have a registry key
+# below HKCU as key path. Therefore it is required, to mark the file belonging
+# to a non-advertised shortcut, that a special userreg_xxx registry key can be
+# created during packing process.
+#####################################################################################
+
+sub prepare_non_advertised_files
+{
+    my ( $folderitemref, $filesref ) = @_;
+
+    for ( my $i = 0; $i <= $#{$folderitemref}; $i++ )
+    {
+        my $folderitem = ${$folderitemref}[$i];
+        my $styles = "";
+        if ( $folderitem->{'Styles'} ) { $styles = $folderitem->{'Styles'}; }
+
+        if ( $styles =~ /\bNON_ADVERTISED\b/ )
+        {
+            my $fileid = $folderitem->{'FileID'};
+            if ( $folderitem->{'ComponentIDFile'} ) { $fileid = $folderitem->{'ComponentIDFile'}; }
+            my $onefile = installer::worker::find_file_by_id($filesref, $fileid);
+
+            # Attention: If $onefile with "FileID" is not found, this is not always an error.
+            # FileID can also contain an executable file, for example msiexec.exe.
+            if ( $onefile ne "" ) { $onefile->{'needs_user_registry_key'} = 1; }
+        }
+    }
+}
+
+#####################################################################################
 # Adding all variables defined in the installation object into the hash
 # of all variables from the zip list file.
 # This is needed if variables are defined in the installation object,
diff --git a/solenv/bin/modules/installer/windows/component.pm b/solenv/bin/modules/installer/windows/component.pm
index 8f48941..65d79b8 100644
--- a/solenv/bin/modules/installer/windows/component.pm
+++ b/solenv/bin/modules/installer/windows/component.pm
@@ -218,6 +218,11 @@ sub get_file_component_attributes
         $attributes = 0;    # Assembly files cannot run from source
     }
 
+    if ( $onefile->{'needs_user_registry_key'} )
+    {
+        $attributes = 4;    # Files in non advertised startmenu entries must have user registry key as KeyPath
+    }
+
     # Setting msidbComponentAttributes64bit, if this is a 64 bit installation set.
     if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) { $attributes |= 256; }
 
@@ -351,6 +356,8 @@ sub get_component_keypath
         }
     }
 
+    if ( $oneitem->{'userregkeypath'} ) { $keypath = $oneitem->{'userregkeypath'}; }
+
     # saving it in the file and registry collection
     $oneitem->{'keypath'} = $keypath;
 
diff --git a/solenv/bin/modules/installer/windows/file.pm b/solenv/bin/modules/installer/windows/file.pm
index a1026db..ce34592 100644
--- a/solenv/bin/modules/installer/windows/file.pm
+++ b/solenv/bin/modules/installer/windows/file.pm
@@ -662,6 +662,22 @@ sub get_language_for_file
 }
 
 ####################################################################
+# Creating a new KeyPath for components in TemplatesFolder.
+####################################################################
+
+sub generate_registry_keypath
+{
+    my ($onefile) = @_;
+
+    my $keypath = $onefile->{'Name'};
+    $keypath =~ s/\.//g;
+    $keypath = lc($keypath);
+    $keypath = "userreg_" . $keypath;
+
+    return $keypath;
+}
+
+####################################################################
 # Check, if in an update process files are missing. No removal
 # of files allowed for Windows Patch creation.
 # Also logging all new files, that have to be included in extra
@@ -942,6 +958,14 @@ sub create_files_table
 
         my $destdir = "";
         if ( $onefile->{'Dir'} ) { $destdir = $onefile->{'Dir'}; }
+
+        if ( $onefile->{'needs_user_registry_key'} )
+        {
+            my $keypath = generate_registry_keypath($onefile);
+            $onefile->{'userregkeypath'} = $keypath;
+            push(@installer::globals::userregistrycollector, $onefile);
+            $installer::globals::addeduserregitrykeys = 1;
+        }
     }
 
     # putting content from %allfilecomponents to $allfilecomponentsref for later usage
diff --git a/solenv/bin/modules/installer/windows/property.pm b/solenv/bin/modules/installer/windows/property.pm
index 5bd2508..0742ebd 100644
--- a/solenv/bin/modules/installer/windows/property.pm
+++ b/solenv/bin/modules/installer/windows/property.pm
@@ -270,9 +270,6 @@ sub set_important_properties
     $onepropertyline = "DONTOPTIMIZELIBS" . "\t" . "0" . "\n";
     push(@{$propertyfile}, $onepropertyline);
 
-    $onepropertyline = "DISABLEADVTSHORTCUTS" . "\t" . "1" . "\n";
-    push(@{$propertyfile}, $onepropertyline);
-
     if ( $installer::globals::officedirhostname )
     {
         my $onepropertyline = "OFFICEDIRHOSTNAME" . "\t" . $installer::globals::officedirhostname . "\n";
diff --git a/solenv/bin/modules/installer/windows/registry.pm b/solenv/bin/modules/installer/windows/registry.pm
index d0605af..81c4f9a 100644
--- a/solenv/bin/modules/installer/windows/registry.pm
+++ b/solenv/bin/modules/installer/windows/registry.pm
@@ -289,6 +289,38 @@ sub get_registry_component
 }
 
 ######################################################
+# Adding the content of
+# @installer::globals::userregistrycollector
+# to the registry table. The content was collected
+# in create_files_table() in file.pm.
+######################################################
+
+sub add_userregs_to_registry_table
+{
+    my ( $registrytable, $allvariables ) = @_;
+
+    for ( my $i = 0; $i <= $#installer::globals::userregistrycollector; $i++ )
+    {
+        my $onefile = $installer::globals::userregistrycollector[$i];
+
+        my %registry = ();
+
+        $registry{'Registry'} = $onefile->{'userregkeypath'};
+        $registry{'Root'} = "1";  # always HKCU
+        $registry{'Key'} = "Software\\$allvariables->{'MANUFACTURER'}\\$allvariables->{'PRODUCTNAME'} $allvariables->{'PRODUCTVERSION'}\\";
+        if ( $onefile->{'needs_user_registry_key'} ) { $registry{'Key'} = $registry{'Key'} . "StartMenu"; }
+        $registry{'Name'} = $onefile->{'Name'};
+        $registry{'Value'} = "1";
+        $registry{'Component_'} = $onefile->{'componentname'};
+
+        my $oneline = $registry{'Registry'} . "\t" . $registry{'Root'} . "\t" . $registry{'Key'} . "\t"
+                    . $registry{'Name'} . "\t" . $registry{'Value'} . "\t" . $registry{'Component_'} . "\n";
+
+        push(@{$registrytable}, $oneline);
+    }
+}
+
+######################################################
 # Creating the file Registry.idt dynamically
 # Content:
 # Registry Root Key Name Value Component_
@@ -360,6 +392,12 @@ sub create_registry_table
             push(@registrytable, $oneline);
         }
 
+        # If there are added user registry keys for files collected in
+        # @installer::globals::userregistrycollector (file.pm), then
+        # this registry keys have to be added now.
+
+        if ( $installer::globals::addeduserregitrykeys ) { add_userregs_to_registry_table(\@registrytable, $allvariableshashref); }
+
         # Saving the file
 
         my $registrytablename = $basedir . $installer::globals::separator . "Registry.idt" . "." . $onelanguage;
diff --git a/solenv/bin/modules/installer/windows/shortcut.pm b/solenv/bin/modules/installer/windows/shortcut.pm
index b32c772..421a649 100644
--- a/solenv/bin/modules/installer/windows/shortcut.pm
+++ b/solenv/bin/modules/installer/windows/shortcut.pm
@@ -112,6 +112,14 @@ sub get_shortcut_component
     my $found = 0;
     my $shortcut_fileid = $shortcut->{'FileID'};
 
+    my $absolute_filename = 0;
+    if ( $shortcut->{'Styles'} ) { $styles = $shortcut->{'Styles'}; }
+    if ( $styles =~ /\bABSOLUTE_FILENAME\b/ ) { $absolute_filename = 1; }   # FileID contains an absolute filename
+    if ( $styles =~ /\bUSE_HELPER_FILENAME\b/ ) { $absolute_filename = 1; } # ComponentIDFile contains id of a helper file
+
+    # if the FileID contains an absolute filename, therefore the entry for "ComponentIDFile" has to be used.
+    if ( $absolute_filename ) { $shortcut_fileid = $shortcut->{'ComponentIDFile'}; }
+
     for ( my $i = 0; $i <= $#{$filesref}; $i++ )
     {
         $onefile = ${$filesref}[$i];
@@ -342,18 +350,71 @@ sub get_folderitem_directory
 
 ########################################################################
 # Returning the target (feature) for a folderitem for shortcut table.
+# For non-advertised shortcuts this is a formatted string.
 ########################################################################
 
 sub get_folderitem_target
 {
     my ($shortcut, $filesref) = @_;
 
-    my $target = $shortcut->{'ModuleID'};
+    my $onefile;
+    my $target = "";
+    my $found = 0;
+    my $shortcut_fileid = $shortcut->{'FileID'};
+
+    my $styles = "";
+    my $nonadvertised = 0;
+    my $absolute_filename = 0;
+    if ( $shortcut->{'Styles'} ) { $styles = $shortcut->{'Styles'}; }
+    if ( $styles =~ /\bNON_ADVERTISED\b/ ) { $nonadvertised = 1; }  # this is a non-advertised shortcut
+    if ( $styles =~ /\bABSOLUTE_FILENAME\b/ ) { $absolute_filename = 1; }   # FileID contains an absolute filename
+
+    # if the FileID contains an absolute filename this can simply be returned as target for the shortcut table.
+    if ( $absolute_filename )
+    {
+        $shortcut->{'target'} = $shortcut_fileid;
+        return $shortcut_fileid;
+    }
+
+    for ( my $i = 0; $i <= $#{$filesref}; $i++ )
+    {
+        $onefile = ${$filesref}[$i];
+        my $filegid = $onefile->{'gid'};
+
+        if ( $filegid eq $shortcut_fileid )
+        {
+            $found = 1;
+            last;
+        }
+    }
+
+    if (!($found))
+    {
+        installer::exiter::exit_program("ERROR: Did not find FileID $shortcut_fileid in file collection for folderitem", "get_folderitem_target");
+    }
+
+    # Non advertised shortcuts do not return the feature, but the path to the file
+    if ( $nonadvertised )
+    {
+        $target = "\[" . $onefile->{'uniquedirname'} . "\]" . "\\" . $onefile->{'Name'};
+        $shortcut->{'target'} = $target;
+        return $target;
+    }
+
+    # the rest only for advertised shortcuts, which contain the feature in the shortcut table.
+
+    if ( $onefile->{'modules'} ) { $target = $onefile->{'modules'}; }
+
+    # If modules contains a list of modules, only taking the first one.
+    # But this should never be needed
+
+    if ( $target =~ /^\s*(.*?)\,/ ) { $target = $1; }
 
     # Attention: Maximum feature length is 38!
     installer::windows::idtglobal::shorten_feature_gid(\$target);
 
     # and finally saving the target in the folderitems collector
+
     $shortcut->{'target'} = $target;
 
     return $target;
@@ -385,6 +446,7 @@ sub get_folderitem_icon
 
     my $styles = "";
     if ( $shortcut->{'Styles'} ) { $styles = $shortcut->{'Styles'}; }
+    if ( $styles =~ /\bNON_ADVERTISED\b/ ) { return ""; }   # no icon for non-advertised shortcuts
 
     my $iconfilegid = "";
 
@@ -432,6 +494,11 @@ sub get_folderitem_icon
 sub get_folderitem_iconindex
 {
     my ($shortcut) = @_;
+
+    my $styles = "";
+    if ( $shortcut->{'Styles'} ) { $styles = $shortcut->{'Styles'}; }
+    if ( $styles =~ /\bNON_ADVERTISED\b/ ) { return ""; }   # no iconindex for non-advertised shortcuts
+
     my $iconid = 0;
 
     if ( $shortcut->{'IconID'} ) { $iconid = $shortcut->{'IconID'}; }
diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm
index 4022907..6620695 100644
--- a/solenv/bin/modules/installer/worker.pm
+++ b/solenv/bin/modules/installer/worker.pm
@@ -627,6 +627,34 @@ sub collect_all_files_from_includepaths
     push( @installer::globals::globallogfileinfo, "\n");
 }
 
+##############################################
+# Searching for a file with the gid
+##############################################
+
+sub find_file_by_id
+{
+    my ( $filesref, $gid ) = @_;
+
+    my $foundfile = 0;
+    my $onefile;
+
+    for ( my $i = 0; $i <= $#{$filesref}; $i++ )
+    {
+        $onefile = ${$filesref}[$i];
+        my $filegid = $onefile->{'gid'};
+
+        if ( $filegid eq $gid )
+        {
+            $foundfile = 1;
+            last;
+        }
+    }
+
+    if (! $foundfile ) { $onefile  = ""; }
+
+    return $onefile;
+}
+
 #################################################
 # Generating paths for cygwin (second version)
 # This function generates smaller files for
diff --git a/solenv/bin/modules/t/installer-setupscript.t b/solenv/bin/modules/t/installer-setupscript.t
index 5bed7d1..2994288 100644
--- a/solenv/bin/modules/t/installer-setupscript.t
+++ b/solenv/bin/modules/t/installer-setupscript.t
@@ -20,6 +20,7 @@ BEGIN {
         add_predefined_folder
         get_all_items_from_script
         get_all_scriptvariables_from_installation_object
+        prepare_non_advertised_files
         replace_all_setupscriptvariables_in_script
         replace_preset_properties
         resolve_lowercase_productname_setupscriptvariable


More information about the Libreoffice-commits mailing list