# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../kdelibs/kdelibs-4.6.3-kde4-xdg-menu-prefix.patch
# Copyright (C) 2011 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---

Description: Use 'kde4-' as XDG_MENU_PREFIX

With this patch the 'applications.menu' file gets installed as
'kde4-applications.menu' avoiding a shared file issue with other
desktop environments which use the same file name.

Besides that this patch enforces the 'kde4-' prefix unless the
XDG_MENU_PREFIX is set.

--- kdelibs-4.6.3/kded/CMakeLists.txt		2011-04-01 15:55:50.000000000 +0200
+++ kdelibs-4.6.3/kded/CMakeLists.txt		2011-05-19 11:27:57.932002344 +0200
@@ -74,7 +74,7 @@
 if (WIN32)
 install( FILES applications.menu  DESTINATION  ${SHARE_INSTALL_PREFIX}/xdg/menus )
 else (WIN32)
-install( FILES applications.menu  DESTINATION  ${SYSCONF_INSTALL_DIR}/xdg/menus )
+install( FILES applications.menu  DESTINATION  ${SYSCONF_INSTALL_DIR}/xdg/menus RENAME kde4-applications.menu )
 endif (WIN32)
 install( FILES kdedmodule.desktop DESTINATION  ${SERVICETYPES_INSTALL_DIR} )
 install( FILES kded.upd           DESTINATION  ${DATA_INSTALL_DIR}/kconf_update )
--- kdelibs-4.6.3/kded/vfolder_menu.cpp	2011-04-01 15:55:50.000000000 +0200
+++ kdelibs-4.6.3/kded/vfolder_menu.cpp	2011-05-19 11:30:49.960002344 +0200
@@ -770,8 +770,10 @@
    QString result;
 
    QString xdgMenuPrefix = QString::fromLocal8Bit(qgetenv("XDG_MENU_PREFIX"));
-   if (!xdgMenuPrefix.isEmpty())
-   {
+   // enforce kde4- prefix unless XDG_MENU_PREFIX is set
+   if (xdgMenuPrefix.isEmpty())
+      xdgMenuPrefix = QString("kde4-");
+
       QFileInfo fileInfo(fileName);
 
       QString fileNameOnly = fileInfo.fileName();
@@ -781,7 +783,6 @@
       QString baseName = QDir::cleanPath(m_docInfo.baseDir +
                                          fileInfo.path() + '/' + fileNameOnly);
       result = KStandardDirs::locate("xdgconf-menu", baseName);
-   }
 
    if (result.isEmpty())
    {