Hi folks, it seems that the whole XDG menu handling is not as easy as I thought. Fixing the spec violation (kde-applications-merged) but keeping kde-applications.menu opened a new problem (#397057)
Basically it is triggered by this http://svn.debian.org/wsvn/pkg-kde/trunk/packages/kdelibs/debian/patches/18_applications_menu_rename.diff?op=file&rev=0&sc=0 The problem is that the internal code assumes that the base part of the filename, i.e. without the .menu extension, is also the prefix for the "-merged" directory. It is based on the idea that there is only one applications.menu and the option for desktop specific menu prefixes, e.g. "kde-" for kde-applications.menu, has only been introduced recently and is thus not yet supported by KDE. The attached patch implements the handling of this new prefix environment variable and Waldo Bastian, the core developer who implemented the menu spec thinks it is acceptable, so I am going to commit it to KDE. However this is new code and thus not tested very well. A couple of options: 1) check if applications.menu can be shared with the other desktops. This would obviously be optimal, because it does not require to change any DE's code 2) apply the attached patch (or sync with upstream once I have committed) and reverted the above mentioned kdelibs patch. This also requires XDG_MENU_PREFIX to be set to "kde-", which could be done in /usr/bin/startkde or through an environment extender in /usr/env Since supporting this variable is a new thing, a variant of this would be to hardcode the string to "kde-", i.e. not do getenv(), or maybe just for the version of Etch + QString xdgMenuPrefix = "kde-"; 3) keep the current code and install a symlink from kde-applcations-merged to applications-merged 4) revert to the behavior where KDE has kde-applications-merged. This breaks the installing of third party menus (#392807), so it could be a problem for LSB (not sure if this version of LSB covers this already) Cheers, Kevin -- Kevin Krammer, KDE developer, xdg-utils developer KDE user support, developer mentoring
Index: vfolder_menu.cpp =================================================================== --- vfolder_menu.cpp (Revision 603088) +++ vfolder_menu.cpp (Arbeitskopie) @@ -772,9 +772,29 @@ return QString::null; } - QString baseName = QDir::cleanDirPath(m_docInfo.baseDir + fileName); - QString result = locate("xdgconf-menu", baseName); + QString result; + QString xdgMenuPrefix = QString::fromLocal8Bit(getenv("XDG_MENU_PREFIX")); + if (!xdgMenuPrefix.isEmpty()) + { + QFileInfo fileInfo(fileName); + + QString fileNameOnly = fileInfo.fileName(); + if (!fileNameOnly.startsWith(xdgMenuPrefix)) + fileNameOnly = xdgMenuPrefix + fileNameOnly; + + QString baseName = QDir::cleanDirPath(m_docInfo.baseDir + + fileInfo.dirPath() + "/" + + fileNameOnly); + result = locate("xdgconf-menu", baseName); + } + + if (result.isEmpty()) + { + QString baseName = QDir::cleanDirPath(m_docInfo.baseDir + fileName); + result = locate("xdgconf-menu", baseName); + } + return result; }
pgp9WLP703eov.pgp
Description: PGP signature