From d7f8c27eee859fd590166db0e4878562fcb42ed6 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Mon, 6 Jan 2014 03:16:47 +0100 Subject: Rename applications-kmenuedit.menu -> applications-tdemenuedit.menu --- doc/faq/panel.docbook | 2 +- doc/userguide/tde-for-admins.docbook | 2 +- kmenuedit/treeview.cpp | 2 +- r14-xdg-update | 140 ++++++++++++++++++++++++++--------- starttde | 9 ++- 5 files changed, 116 insertions(+), 39 deletions(-) diff --git a/doc/faq/panel.docbook b/doc/faq/panel.docbook index aa58c0ff2..ab571ccc7 100644 --- a/doc/faq/panel.docbook +++ b/doc/faq/panel.docbook @@ -43,7 +43,7 @@ select Menus, then inside the TDE Menu grouping, select the TDE Menu button icon User modifications to the &kmenu; are stored in -$HOME/.config/menus/applications-kmenuedit.menu. +$HOME/.config/menus/applications-tdemenuedit.menu. Try moving this file out of the way and then issuing the command tdebuildsycoca . This should restore you to the diff --git a/doc/userguide/tde-for-admins.docbook b/doc/userguide/tde-for-admins.docbook index d027a9bad..815e69d45 100644 --- a/doc/userguide/tde-for-admins.docbook +++ b/doc/userguide/tde-for-admins.docbook @@ -1848,7 +1848,7 @@ CheckSycoca=false &kmenuedit; is aimed at a single user setup. Changes to menu structure are saved to -~/.config/menus/applications-kmenuedit.menu, +~/.config/menus/applications-tdemenuedit.menu, changes to applications are saved in ~/.local/share/applications/ and changes to sub-menus (icon, name) are saved in action("newsep")) connect(m_ac->action("newsep"), TQT_SIGNAL(activated()), TQT_SLOT(newsep())); - m_menuFile = new MenuFile( locateLocal("xdgconf-menu", "applications-kmenuedit.menu")); + m_menuFile = new MenuFile( locateLocal("xdgconf-menu", "applications-tdemenuedit.menu")); m_rootFolder = new MenuFolderInfo; m_separator = new MenuSeparatorInfo; m_drag = 0; diff --git a/r14-xdg-update b/r14-xdg-update index 92de967bc..26cae4356 100644 --- a/r14-xdg-update +++ b/r14-xdg-update @@ -68,7 +68,7 @@ Log () { # Main script: SCRIPT_NAME="`basename \`readlink -f $0\``" -SCRIPT_VERSION=201401050 +SCRIPT_VERSION=201401051 # Allow forced execution of this script regardless of the kdeglobals setting # and allow passing a user home directory as a positional parameter. @@ -281,7 +281,7 @@ if [ "$R14_VERSION" -lt "201309150" ]; then fi # Remember that this script may be run more than once. The new directory # might already exist. - if [ -n "$CACHE_DIR" ] && [ -d "$CACHE_DIR" ]; then + if [ "$CACHE_DIR" != "" ] && [ -d "$CACHE_DIR" ]; then # Flush the obsolete ksycoca cache files. rm -f ${CACHE_DIR}/ksycoca* 2>/dev/null # Flush the tdesycoca cache files. This is safe at any time. @@ -309,12 +309,6 @@ if [ "$R14_VERSION" -lt "201309150" ]; then fi fi -if [ "$R14_VERSION" -lt "201309150" ]; then - Log "Updating *.desktop files." - find "$PROFILE_DIR" "$USER_DIR/.local" -name "*.desktop" -print0 2>/dev/null | \ - xargs -r0 grep -ZIl "\(X-KDE-\|KDE;\)" | \ - xargs -r0 sed -i -e "s|X-KDE-|X-TDE-|g" -e "s|KDE;|TDE;|g" -fi if [ "$R14_VERSION" -lt "201309150" ]; then Log "Updating references of $TDEDIR/share/applications/kde to share/applications/tde." # Exclude KMail mail files --- we don't want to touch those files. @@ -461,7 +455,7 @@ if [ "$R14_VERSION" -lt "201309150" ]; then LINK="`readlink $i`" LINK_PATH="`dirname $LINK`" LINK_NAME="`basename $LINK`" - if [ -n "`echo $LINK_PATH | grep \"$TDEDIR/share/applications/kde\"`" ]; then + if [ "`echo $LINK_PATH | grep \"$TDEDIR/share/applications/kde\"`" != "" ]; then NEW_LINK_PATH="`echo \"$LINK_PATH\" | sed 's|/share/applications/kde|/share/applications/tde|'`" fi if [ "$NEW_LINK_PATH" != "" ]; then @@ -479,13 +473,6 @@ if [ "$R14_VERSION" -lt "201309150" ]; then fi fi -# Update the user's customized menu. -if [ "$R14_VERSION" -lt "201309150" ]; then - if [ -r $USER_DIR/.config/menus/applications-kmenuedit.menu ]; then - sed -i 's|kde-|tde-|g' $USER_DIR/.config/menus/applications-kmenuedit.menu - fi -fi - # Ensure all KDED services are accounted for in the user's profile. Any that are missing # are defaulted to not auto-loading (false). Refer to bug report 1210. This same test is # performed in the migratekde3 script, but notice the migratekde3 script uses the key of @@ -506,19 +493,24 @@ fi # Try to update sessions. if [ "$R14_VERSION" -lt "201310050" ]; then - sed -i -e 's|kwin|twin|g' \ - -e 's|krandr|tderandr|g' \ - -e 's|kwallet|tdewallet|g' \ - -e 's|kradio|tderadio|g' \ - $PROFILE_DIR/share/config/ksmserverrc - find $PROFILE_DIR/share/config/session -name "kwin_*" -o -name "kwallet*" -o -name "kradio*" | \ - while read i; do - ir=$PROFILE_DIR/share/config/session/$(basename $i | \ - sed -e "s|^kwin_|twin_|" \ - -e "s|^kwallet|tdewallet|" \ - -e "s|^kradio|tderadio|") - mv $i $ir - done + Log "Update sessions." + if [ -f $PROFILE_DIR/share/config/ksmserverrc ]; then + sed -i -e 's|kwin|twin|g' \ + -e 's|krandr|tderandr|g' \ + -e 's|kwallet|tdewallet|g' \ + -e 's|kradio|tderadio|g' \ + $PROFILE_DIR/share/config/ksmserverrc + fi + if [ -d $PROFILE_DIR/share/config/session ]; then + find $PROFILE_DIR/share/config/session -name "kwin_*" -o -name "kwallet*" -o -name "kradio*" | \ + while read i; do + ir=$PROFILE_DIR/share/config/session/$(basename $i | \ + sed -e "s|^kwin_|twin_|" \ + -e "s|^kwallet|tdewallet|" \ + -e "s|^kradio|tderadio|") + mv $i $ir + done + fi fi Log "Renaming some configuration files and directories." @@ -659,6 +651,87 @@ if [ "$R14_VERSION" -lt "201401050" ]; then fi fi +if [ "$R14_VERSION" -lt "201401040" ]; then + # Rename the user's custom launcher menu. + # Before the release of R14.0.0, custom user menus had the same file name as KDE4: + # applications-kmenuedit.menu. Under that condition, there is a possibility the user + # was using the same custom menu for both Trinity and KDE4. To distinguish whether a + # custom menu is TDE or KDE4, search the menu for TDE-specific and KDE4-specific menu + # items. There is a possibility the user has customized a common menu to include or + # exclude all of these items. Later we will copy any existing custom menu. + # There are three environments to inherit: + # KDE4 + # KDE/TDE 3.5.x + # TDE pre R14 + if [ -f $USER_DIR/.config/menus/applications-tdemenuedit.menu ]; then + CUSTOM_MENU="TDE" + elif [ -f $USER_DIR/.config/menus/applications-kmenuedit.menu ]; then + if [ "`grep \"kde4-kfind.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ] || \ + [ "`grep \"kde4-Help.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ]; then + CUSTOM_MENU="KDE4" + elif [ "`grep \"kde-kfind.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ] || \ + [ "`grep \"kde-Help.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ]; then + # KDE/TDE 3.5.x + CUSTOM_MENU="KDE" + elif [ "`grep \"tde-Kfind.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ] || \ + [ "`grep \"tde-Help.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ] || \ + [ "`grep \"tde-Home.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ]; then + CUSTOM_MENU="TDE" + fi + + # Now we know which type of environment. Copy the existing menu. + Log " kmenuedit.menu($CUSTOM_MENU)->tdemenuedit.menu" + # Note: at this point the layout of a renamed KDE4 custom menu will not be the same as Trinity. + # We'll fix that later. + cp $USER_DIR/.config/menus/applications-kmenuedit.menu $USER_DIR/.config/menus/applications-tdemenuedit.menu 2>/dev/null + fi +fi + +if [ "$R14_VERSION" -lt "201401040" ]; then + # Update the user's custom menu. Any custom menu should have been renamed a few lines above. + if [ -r $USER_DIR/.config/menus/applications-tdemenuedit.menu ] && [ "$CUSTOM_MENU" != "TDE" ]; then + # KDE/TDE 3.5.x or converted KDE4. No need to update a pre R14 menu. + sed -i 's|kde-|tde-|g' $USER_DIR/.config/menus/applications-tdemenuedit.menu + fi +fi + +if [ "$R14_VERSION" -lt "201401040" ]; then + Log "Updating profile *.desktop files." + # First update *.desktop files in the Trinity profile folder. Updating these files is safe. + find "$PROFILE_DIR" -name "*.desktop" -print0 2>/dev/null | \ + xargs -r0 grep -ZIl "\(X-KDE-\|KDE;\)" | \ + xargs -r0 sed -i -e "s|X-KDE-|X-TDE-|g" -e "s|KDE;|TDE;|g" -e "s|kdesu|tdesu|g" + # Next update *.desktop files in $USER_DIR/.local. + # Any existing applications-kmenuedit.menu has been copied to applications-tdemenuedit.menu. + if [ -f "$USER_DIR/.config/menus/applications-tdemenuedit.menu" ] && [ "$CUSTOM_MENU" != "TDE" ]; then + # KDE/TDE 3.5.x or converted KDE4. No need to update a pre R14 menu. + Log "Updating ~/.local *.desktop files." + find "$USER_DIR/.local" -name "*.desktop" -print0 2>/dev/null | \ + xargs -r0 grep -ZIl "\(X-KDE-\|KDE;\)" | \ + xargs -r0 sed -i -e "s|X-KDE-|X-TDE-|g" -e "s|KDE;|TDE;|g" -e "s|kdesu|tdesu|g" + # When the custom menu is from KDE/TDE 3.5.x or pre R14, then we are done. + # When the custom menu is from KDE4, we have additional work to perform because the KDE4 + # layout structure is different from the Trinity layout. + # In limited tests the following menu items are out of place when migrating a KDE4 menu: + # Edutainment (because KDE4 uses 'Education' rather than 'Edutainment' + # Find Files/Folders (because of kde4- prefix rather than tde- prefix) + # Help (because of kde4- prefix rather than tde- prefix) + # Home - Personal Files (because of kde4- prefix rather than tde- prefix) + # All four items are placed at the top of the migrated menu. + # The following should fix the layout to conform to Trinity. + if [ "$CUSTOM_MENU" = "KDE4" ]; then + Log "Repairing menu layout structure." + sed -i -e "s|Education|Edutainment|" -e "s|kde4-|tde-|g" $USER_DIR/.config/menus/applications-tdemenuedit.menu + # The following must be performed in this order. + sed -i "s|tde-Help.desktop|tde-Home.desktop|" $USER_DIR/.config/menus/applications-tdemenuedit.menu + sed -i "s|tde-kfind.desktop|tde-Help.desktop|" $USER_DIR/.config/menus/applications-tdemenuedit.menu + sed -i "s|Applications|tde-Kfind.desktop|" $USER_DIR/.config/menus/applications-tdemenuedit.menu + # Also need to fix Lost+Found? Lost+Found is not in alphabetical order + # when opening the menu editor against the converted menu. + fi + fi +fi + # Disable some features new to R14, otherwise users will see an unfamiliar desktop. if [ "$R14_VERSION" -lt "201309150" ]; then if [ $($TDEDIR/bin/kreadconfig --file kickerrc --group "General" --key "ShowDeepButtons" --default false) = "false" ]; then @@ -674,7 +747,7 @@ fi # Perform some nominal update validations. # First clean house from any previous failures. -if [ -z "$CACHE_DIR" ]; then +if [ "$CACHE_DIR" = "" ]; then CACHE_DIR=$PROFILE_DIR fi if [ -d "$CACHE_DIR" ]; then @@ -792,11 +865,11 @@ if [ "$QUICK_LAUNCH_CONFIG" != "" ]; then fi TEST_NUM="9" R14_UPDATE_TEST9="" -if [ -r $USER_DIR/.config/menus/applications-kmenuedit.menu ]; then - grep "kde-" "$USER_DIR/.config/menus/applications-kmenuedit.menu" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt +if [ -r $USER_DIR/.config/menus/applications-tdemenuedit.menu ]; then + grep "kde-" "$USER_DIR/.config/menus/applications-tdemenuedit.menu" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt ]; then R14_UPDATE_TEST9="failed" - MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check applications-kmenuedit.menu for 'kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)" + MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check applications-tdemenuedit.menu for 'kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)" Validation_Failure else rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null @@ -835,4 +908,5 @@ unset KDEGLOBALS_KEY_VALUE unset TEST_NUM unset SCRIPT_NAME unset SCRIPT_VERSION +unset CUSTOM_MENU exit 0 diff --git a/starttde b/starttde index 0d7cbff21..269d4ffa5 100644 --- a/starttde +++ b/starttde @@ -280,6 +280,11 @@ test -n "$TDEHOME" && tdehome=`echo "$TDEHOME" | sed "s,^~/,$HOME/,"` # to know that this is a Trinity desktop and not a KDE one. export DESKTOP_SESSION=trinity +# Create profile directory. +if [ ! -d "$tdehome" ]; then + echo "[starttde] Creating $tdehome" 1>&2 + mkdir -m 700 -p "$tdehome" +fi if [ -d "$tdehome" ]; then # Run some R14 updates. R14_UPDATED="`$TDEDIR/bin/kreadconfig --file kdeglobals --group "R14 XDG Updates" --key Updated --default false`" @@ -302,11 +307,9 @@ if [ -d "$tdehome" ]; then exit 1 fi fi -else - echo "[starttde] Creating $tdehome" 1>&2 fi + # Please see tdestartupconfig source for usage. -mkdir -m 700 -p "$tdehome" mkdir -m 700 -p "$tdehome/share" mkdir -m 700 -p "$tdehome/share/config" cat >"$tdehome/share/config/startupconfigkeys" <