Update git submodules
[LibreOffice.git] / bin / removetooltip_markups.sh
blob5699fce99263a938bc757a7a6704def7235b1fc9
1 #!/usr/bin/env bash
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # Run the script in the core directory to remove all tooltip_markup
11 # properties from the .ui files
13 SED_BIN=`which sed`
14 CUT_BIN=`which cut`
15 LOG_FILE="modified-$(date +%s).log"
17 removeTooltipMarkup()
19 LINE=$(grep -n "<property name=\"tooltip_markup\"" $1 | $CUT_BIN -f 1 -d ':')
20 TEXT=$(grep "<property name=\"tooltip_markup\"" $1)
21 grep -v "<property name=\"tooltip_markup\"" $1 > temp && mv temp $1
22 echo "removed $TEXT from $1 at line $LINE" >> $LOG_FILE
25 changeTooltipMarkup()
27 LINE=$(grep -n "<property name=\"tooltip_markup\"" $1 | $CUT_BIN -f 1 -d ':')
28 $SED_BIN "s/tooltip_markup/tooltip_text/g" $i > temp && mv temp $1
29 echo "renamed tooltip_markup from $1 at line $LINE" >> $LOG_FILE
32 checkTooltipMarkup()
34 TEXT=`grep "<property name=\"tooltip_text\"" $1`
35 MARKUP=`grep "<property name=\"tooltip_markup\"" $1`
37 if [[ $MARKUP ]] && [[ $TEXT ]]
38 then
39 removeTooltipMarkup "$1"
41 if [[ $MARKUP ]] && [[ ! $TEXT ]]
42 then
43 changeTooltipMarkup "$1"
47 shopt -s globstar
48 echo " " > $LOG_FILE
49 for i in **/*.ui; do
50 echo -n "."
51 checkTooltipMarkup "$i"
52 done
54 echo
55 echo "Done!"