diff --git a/qt/PKGBUILD b/qt/PKGBUILD index f8cfee2d1..15201ca25 100644 --- a/qt/PKGBUILD +++ b/qt/PKGBUILD @@ -16,10 +16,9 @@ pkgname=('qt' 'qt-demos' 'qt-tools') -pkgver=4.7.1 -pkgrel=1 -kdeqtver=stock-qt-version -#kdeqtver=7abde40e7484d0ab7d61de3531bc0aeedf24aa85 +pkgver=4.7.0 +pkgrel=2 +kdeqtver=7abde40e7484d0ab7d61de3531bc0aeedf24aa85 pkgdesc="A cross-platform application and UI framework" arch=('i686' 'x86_64') @@ -58,23 +57,28 @@ makedepends=('inputproto' _pkgfqn=${_origname}-everywhere-opensource-src-${pkgver} source=("ftp://ftp.qt.nokia.com/qt/source/${_pkgfqn}.tar.gz" -# "http://chakra-project.org/sources/qt/kde-qt-${kdeqtver}.patch.gz" + "http://chakra-project.org/sources/qt/kde-qt-${kdeqtver}.patch.gz" 'assistant.desktop' 'designer.desktop' 'linguist.desktop' 'qtconfig.desktop' - 'demosexamples-manual-install.patch' - 'appmenu.patch') + 'http://chakra-project.org/sources/qt/qt-any-demosexamples-manual-install.patch' + 'http://chakra-project.org/sources/qt/qt-any-appmenu.patch' + 'http://chakra-project.org/sources/qt/qt-4.7.0-qmake-linker-flags-as-needed.patch' + 'http://chakra-project.org/sources/qt/qt-4.7.0-fix-scroll-when-last-item-is-removed.patch' + 'http://chakra-project.org/sources/qt/qt-4.7.0-fix-opengl-multisampling-for-some-graphics-drivers.patch') - -md5sums=('6f88d96507c84e9fea5bf3a71ebeb6d7' -# '9d665e17a64c9e32b374ba5b1eafb350' # kde-qt-7abde40e7484d0ab7d61de3531bc0aeedf24aa85.patch.gz +md5sums=('3a2f25b9b115037277f4fb759194a7a5' + '9d665e17a64c9e32b374ba5b1eafb350' # kde-qt-7abde40e7484d0ab7d61de3531bc0aeedf24aa85.patch.gz '20d333282c43f9e643cb8e91b6307dcc' 'bf89ee0bdd178933f19d8bc4090173ec' 'a9bfeeffab8ba103bc8153fdb31474a1' '83b2a4aece6c9d86301c53a979af0b63' '579e63488320a8d692d25502551787af' - 'dba7f852bce6e1ebd78f6a78f9979c68') + 'dba7f852bce6e1ebd78f6a78f9979c68' + 'c436732fc467271e8a3838145c122070' + 'ef20c34afc5be5ed62f2935be66d9402' + 'b2e0f134bbb848ebef41134a45a36ee9') # source PKGBUILD && _create-kdeqt-patch _create-kdeqt-patch() { @@ -104,19 +108,24 @@ build() { cd $srcdir/$_pkgfqn msg "applying kde-qt patches" cd $srcdir/$_pkgfqn -# patch -p1 -i $srcdir/kde-qt-${kdeqtver}.patch || return 1 + patch -p1 -i $srcdir/kde-qt-${kdeqtver}.patch || return 1 # editing qt.install sed -i -e 's/^.*> Qt .*/ echo " > Qt '${pkgver}'"/' $startdir/qt.install sed -i -e 's/^.*kde-qt .*/ echo " kde-qt '${kdeqtver}'"/' $startdir/qt.install msg "apply other patches" + # Already fixed in 4.7.1 + patch -Np1 -i ${srcdir}/qt-4.7.0-fix-scroll-when-last-item-is-removed.patch || return 1 + patch -Np1 -i ${srcdir}/qt-4.7.0-qmake-linker-flags-as-needed.patch || return 1 + patch -Np1 -i ${srcdir}/qt-4.7.0-fix-opengl-multisampling-for-some-graphics-drivers.patch # apply appmenu patch from Aurelien Gateau - patch -Np1 -i ${srcdir}/appmenu.patch || return 1 + patch -Np1 -i ${srcdir}/qt-any-appmenu.patch || return 1 # we want our cflags etc sed -i "s|-O2|$CXXFLAGS|" mkspecs/common/g++.conf sed -i "/^QMAKE_RPATH/s| -Wl,-rpath,||g" mkspecs/common/g++.conf - sed -i "/^QMAKE_LFLAGS\s/s|+=|+= $LDFLAGS|g" mkspecs/common/g++.conf + # undash it in 4.7.1 + # sed -i "/^QMAKE_LFLAGS\s/s|+=|+= $LDFLAGS|g" mkspecs/common/g++.conf msg "starting configure" @@ -157,7 +166,7 @@ build() { -ptmalloc || return 1 # disable automatic installation of demos and examples, we want to do that manually - patch -p0 -i $srcdir/demosexamples-manual-install.patch || return 1 + patch -p0 -i $srcdir/qt-any-demosexamples-manual-install.patch || return 1 msg "starting the build" make || return 1 diff --git a/qt/appmenu.patch b/qt/appmenu.patch deleted file mode 100644 index 977db8eb5..000000000 --- a/qt/appmenu.patch +++ /dev/null @@ -1,3869 +0,0 @@ -Appmenu patch 20100923 -diff --git a/src/3rdparty/dbusmenu-qt/.gitattributes b/src/3rdparty/dbusmenu-qt/.gitattributes -new file mode 100644 -index 0000000..c9bcc1a ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/.gitattributes -@@ -0,0 +1 @@ -+org.ayatana.dbusmenu.xml -crlf -diff --git a/src/3rdparty/dbusmenu-qt/.krazy b/src/3rdparty/dbusmenu-qt/.krazy -new file mode 100644 -index 0000000..0b16e7f ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/.krazy -@@ -0,0 +1 @@ -+SKIP /tests/ -diff --git a/src/3rdparty/dbusmenu-qt/CMakeLists.txt b/src/3rdparty/dbusmenu-qt/CMakeLists.txt -new file mode 100644 -index 0000000..695871b ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/CMakeLists.txt -@@ -0,0 +1,59 @@ -+project(dbusmenu-qt) -+cmake_minimum_required(VERSION 2.6.0) -+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules") -+ -+set(dbusmenu_qt_VERSION 0.3.2) -+ -+set(ARCHIVE_NAME libdbusmenu-qt-${dbusmenu_qt_VERSION}) -+add_custom_target(dist -+ COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD -+ | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 -+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -+ ) -+ -+add_custom_target(distcheck -+ COMMAND cd ${CMAKE_BINARY_DIR} -+ && rm -rf ${ARCHIVE_NAME} -+ && tar xf ${ARCHIVE_NAME}.tar.bz2 -+ && mkdir ${ARCHIVE_NAME}/build -+ && cd ${ARCHIVE_NAME}/build -+ && cmake -DCMAKE_INSTALL_PREFIX=../install .. -+ && make -+ && make install -+ && make check -+ ) -+add_dependencies(distcheck dist) -+ -+# Bump this one when a binary-incompatible change is introduced -+set(dbusmenu_qt_lib_SOVERSION 2) -+ -+# Bump this one when the API is extended in a binary-compatible way -+set(dbusmenu_qt_lib_API_VERSION 0) -+ -+# Bump this one when changes do not extend the API -+set(dbusmenu_qt_lib_PATCH_VERSION 2) -+set(dbusmenu_qt_lib_VERSION ${dbusmenu_qt_lib_SOVERSION}.${dbusmenu_qt_lib_API_VERSION}.${dbusmenu_qt_lib_PATCH_VERSION}) -+ -+find_package(Qt4 REQUIRED) -+ -+include_directories( -+ ${QT_INCLUDE_DIR} -+ ${QT_QTCORE_INCLUDE_DIR} -+ ${QT_QTDBUS_INCLUDE_DIR} -+ ${QT_QTXML_INCLUDE_DIR} -+ ${QT_QTGUI_INCLUDE_DIR} -+ ) -+ -+configure_file(dbusmenu-qt.pc.in ${CMAKE_BINARY_DIR}/dbusmenu-qt.pc @ONLY) -+ -+install(FILES ${CMAKE_BINARY_DIR}/dbusmenu-qt.pc -+ DESTINATION lib${LIB_SUFFIX}/pkgconfig -+ ) -+ -+option(BUILD_TESTS "Build tests" ON) -+ -+add_subdirectory(src) -+if (BUILD_TESTS) -+ add_subdirectory(tests) -+endif (BUILD_TESTS) -+add_subdirectory(tools) -diff --git a/src/3rdparty/dbusmenu-qt/COPYING b/src/3rdparty/dbusmenu-qt/COPYING -new file mode 100644 -index 0000000..e38ffa8 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/COPYING -@@ -0,0 +1,481 @@ -+ GNU LIBRARY GENERAL PUBLIC LICENSE -+ Version 2, June 1991 -+ -+ Copyright (C) 1991 Free Software Foundation, Inc. -+ 59 Temple Place - Suite 330 -+ Boston, MA 02111-1307, USA. -+ Everyone is permitted to copy and distribute verbatim copies -+ of this license document, but changing it is not allowed. -+ -+[This is the first released version of the library GPL. It is -+ numbered 2 because it goes with version 2 of the ordinary GPL.] -+ -+ Preamble -+ -+ The licenses for most software are designed to take away your -+freedom to share and change it. By contrast, the GNU General Public -+Licenses are intended to guarantee your freedom to share and change -+free software--to make sure the software is free for all its users. -+ -+ This license, the Library General Public License, applies to some -+specially designated Free Software Foundation software, and to any -+other libraries whose authors decide to use it. You can use it for -+your libraries, too. -+ -+ When we speak of free software, we are referring to freedom, not -+price. Our General Public Licenses are designed to make sure that you -+have the freedom to distribute copies of free software (and charge for -+this service if you wish), that you receive source code or can get it -+if you want it, that you can change the software or use pieces of it -+in new free programs; and that you know you can do these things. -+ -+ To protect your rights, we need to make restrictions that forbid -+anyone to deny you these rights or to ask you to surrender the rights. -+These restrictions translate to certain responsibilities for you if -+you distribute copies of the library, or if you modify it. -+ -+ For example, if you distribute copies of the library, whether gratis -+or for a fee, you must give the recipients all the rights that we gave -+you. You must make sure that they, too, receive or can get the source -+code. If you link a program with the library, you must provide -+complete object files to the recipients so that they can relink them -+with the library, after making changes to the library and recompiling -+it. And you must show them these terms so they know their rights. -+ -+ Our method of protecting your rights has two steps: (1) copyright -+the library, and (2) offer you this license which gives you legal -+permission to copy, distribute and/or modify the library. -+ -+ Also, for each distributor's protection, we want to make certain -+that everyone understands that there is no warranty for this free -+library. If the library is modified by someone else and passed on, we -+want its recipients to know that what they have is not the original -+version, so that any problems introduced by others will not reflect on -+the original authors' reputations. -+ -+ Finally, any free program is threatened constantly by software -+patents. We wish to avoid the danger that companies distributing free -+software will individually obtain patent licenses, thus in effect -+transforming the program into proprietary software. To prevent this, -+we have made it clear that any patent must be licensed for everyone's -+free use or not licensed at all. -+ -+ Most GNU software, including some libraries, is covered by the ordinary -+GNU General Public License, which was designed for utility programs. This -+license, the GNU Library General Public License, applies to certain -+designated libraries. This license is quite different from the ordinary -+one; be sure to read it in full, and don't assume that anything in it is -+the same as in the ordinary license. -+ -+ The reason we have a separate public license for some libraries is that -+they blur the distinction we usually make between modifying or adding to a -+program and simply using it. Linking a program with a library, without -+changing the library, is in some sense simply using the library, and is -+analogous to running a utility program or application program. However, in -+a textual and legal sense, the linked executable is a combined work, a -+derivative of the original library, and the ordinary General Public License -+treats it as such. -+ -+ Because of this blurred distinction, using the ordinary General -+Public License for libraries did not effectively promote software -+sharing, because most developers did not use the libraries. We -+concluded that weaker conditions might promote sharing better. -+ -+ However, unrestricted linking of non-free programs would deprive the -+users of those programs of all benefit from the free status of the -+libraries themselves. This Library General Public License is intended to -+permit developers of non-free programs to use free libraries, while -+preserving your freedom as a user of such programs to change the free -+libraries that are incorporated in them. (We have not seen how to achieve -+this as regards changes in header files, but we have achieved it as regards -+changes in the actual functions of the Library.) The hope is that this -+will lead to faster development of free libraries. -+ -+ The precise terms and conditions for copying, distribution and -+modification follow. Pay close attention to the difference between a -+"work based on the library" and a "work that uses the library". The -+former contains code derived from the library, while the latter only -+works together with the library. -+ -+ Note that it is possible for a library to be covered by the ordinary -+General Public License rather than by this special one. -+ -+ GNU LIBRARY GENERAL PUBLIC LICENSE -+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -+ -+ 0. This License Agreement applies to any software library which -+contains a notice placed by the copyright holder or other authorized -+party saying it may be distributed under the terms of this Library -+General Public License (also called "this License"). Each licensee is -+addressed as "you". -+ -+ A "library" means a collection of software functions and/or data -+prepared so as to be conveniently linked with application programs -+(which use some of those functions and data) to form executables. -+ -+ The "Library", below, refers to any such software library or work -+which has been distributed under these terms. A "work based on the -+Library" means either the Library or any derivative work under -+copyright law: that is to say, a work containing the Library or a -+portion of it, either verbatim or with modifications and/or translated -+straightforwardly into another language. (Hereinafter, translation is -+included without limitation in the term "modification".) -+ -+ "Source code" for a work means the preferred form of the work for -+making modifications to it. For a library, complete source code means -+all the source code for all modules it contains, plus any associated -+interface definition files, plus the scripts used to control compilation -+and installation of the library. -+ -+ Activities other than copying, distribution and modification are not -+covered by this License; they are outside its scope. The act of -+running a program using the Library is not restricted, and output from -+such a program is covered only if its contents constitute a work based -+on the Library (independent of the use of the Library in a tool for -+writing it). Whether that is true depends on what the Library does -+and what the program that uses the Library does. -+ -+ 1. You may copy and distribute verbatim copies of the Library's -+complete source code as you receive it, in any medium, provided that -+you conspicuously and appropriately publish on each copy an -+appropriate copyright notice and disclaimer of warranty; keep intact -+all the notices that refer to this License and to the absence of any -+warranty; and distribute a copy of this License along with the -+Library. -+ -+ You may charge a fee for the physical act of transferring a copy, -+and you may at your option offer warranty protection in exchange for a -+fee. -+ -+ 2. You may modify your copy or copies of the Library or any portion -+of it, thus forming a work based on the Library, and copy and -+distribute such modifications or work under the terms of Section 1 -+above, provided that you also meet all of these conditions: -+ -+ a) The modified work must itself be a software library. -+ -+ b) You must cause the files modified to carry prominent notices -+ stating that you changed the files and the date of any change. -+ -+ c) You must cause the whole of the work to be licensed at no -+ charge to all third parties under the terms of this License. -+ -+ d) If a facility in the modified Library refers to a function or a -+ table of data to be supplied by an application program that uses -+ the facility, other than as an argument passed when the facility -+ is invoked, then you must make a good faith effort to ensure that, -+ in the event an application does not supply such function or -+ table, the facility still operates, and performs whatever part of -+ its purpose remains meaningful. -+ -+ (For example, a function in a library to compute square roots has -+ a purpose that is entirely well-defined independent of the -+ application. Therefore, Subsection 2d requires that any -+ application-supplied function or table used by this function must -+ be optional: if the application does not supply it, the square -+ root function must still compute square roots.) -+ -+These requirements apply to the modified work as a whole. If -+identifiable sections of that work are not derived from the Library, -+and can be reasonably considered independent and separate works in -+themselves, then this License, and its terms, do not apply to those -+sections when you distribute them as separate works. But when you -+distribute the same sections as part of a whole which is a work based -+on the Library, the distribution of the whole must be on the terms of -+this License, whose permissions for other licensees extend to the -+entire whole, and thus to each and every part regardless of who wrote -+it. -+ -+Thus, it is not the intent of this section to claim rights or contest -+your rights to work written entirely by you; rather, the intent is to -+exercise the right to control the distribution of derivative or -+collective works based on the Library. -+ -+In addition, mere aggregation of another work not based on the Library -+with the Library (or with a work based on the Library) on a volume of -+a storage or distribution medium does not bring the other work under -+the scope of this License. -+ -+ 3. You may opt to apply the terms of the ordinary GNU General Public -+License instead of this License to a given copy of the Library. To do -+this, you must alter all the notices that refer to this License, so -+that they refer to the ordinary GNU General Public License, version 2, -+instead of to this License. (If a newer version than version 2 of the -+ordinary GNU General Public License has appeared, then you can specify -+that version instead if you wish.) Do not make any other change in -+these notices. -+ -+ Once this change is made in a given copy, it is irreversible for -+that copy, so the ordinary GNU General Public License applies to all -+subsequent copies and derivative works made from that copy. -+ -+ This option is useful when you wish to copy part of the code of -+the Library into a program that is not a library. -+ -+ 4. You may copy and distribute the Library (or a portion or -+derivative of it, under Section 2) in object code or executable form -+under the terms of Sections 1 and 2 above provided that you accompany -+it with the complete corresponding machine-readable source code, which -+must be distributed under the terms of Sections 1 and 2 above on a -+medium customarily used for software interchange. -+ -+ If distribution of object code is made by offering access to copy -+from a designated place, then offering equivalent access to copy the -+source code from the same place satisfies the requirement to -+distribute the source code, even though third parties are not -+compelled to copy the source along with the object code. -+ -+ 5. A program that contains no derivative of any portion of the -+Library, but is designed to work with the Library by being compiled or -+linked with it, is called a "work that uses the Library". Such a -+work, in isolation, is not a derivative work of the Library, and -+therefore falls outside the scope of this License. -+ -+ However, linking a "work that uses the Library" with the Library -+creates an executable that is a derivative of the Library (because it -+contains portions of the Library), rather than a "work that uses the -+library". The executable is therefore covered by this License. -+Section 6 states terms for distribution of such executables. -+ -+ When a "work that uses the Library" uses material from a header file -+that is part of the Library, the object code for the work may be a -+derivative work of the Library even though the source code is not. -+Whether this is true is especially significant if the work can be -+linked without the Library, or if the work is itself a library. The -+threshold for this to be true is not precisely defined by law. -+ -+ If such an object file uses only numerical parameters, data -+structure layouts and accessors, and small macros and small inline -+functions (ten lines or less in length), then the use of the object -+file is unrestricted, regardless of whether it is legally a derivative -+work. (Executables containing this object code plus portions of the -+Library will still fall under Section 6.) -+ -+ Otherwise, if the work is a derivative of the Library, you may -+distribute the object code for the work under the terms of Section 6. -+Any executables containing that work also fall under Section 6, -+whether or not they are linked directly with the Library itself. -+ -+ 6. As an exception to the Sections above, you may also compile or -+link a "work that uses the Library" with the Library to produce a -+work containing portions of the Library, and distribute that work -+under terms of your choice, provided that the terms permit -+modification of the work for the customer's own use and reverse -+engineering for debugging such modifications. -+ -+ You must give prominent notice with each copy of the work that the -+Library is used in it and that the Library and its use are covered by -+this License. You must supply a copy of this License. If the work -+during execution displays copyright notices, you must include the -+copyright notice for the Library among them, as well as a reference -+directing the user to the copy of this License. Also, you must do one -+of these things: -+ -+ a) Accompany the work with the complete corresponding -+ machine-readable source code for the Library including whatever -+ changes were used in the work (which must be distributed under -+ Sections 1 and 2 above); and, if the work is an executable linked -+ with the Library, with the complete machine-readable "work that -+ uses the Library", as object code and/or source code, so that the -+ user can modify the Library and then relink to produce a modified -+ executable containing the modified Library. (It is understood -+ that the user who changes the contents of definitions files in the -+ Library will not necessarily be able to recompile the application -+ to use the modified definitions.) -+ -+ b) Accompany the work with a written offer, valid for at -+ least three years, to give the same user the materials -+ specified in Subsection 6a, above, for a charge no more -+ than the cost of performing this distribution. -+ -+ c) If distribution of the work is made by offering access to copy -+ from a designated place, offer equivalent access to copy the above -+ specified materials from the same place. -+ -+ d) Verify that the user has already received a copy of these -+ materials or that you have already sent this user a copy. -+ -+ For an executable, the required form of the "work that uses the -+Library" must include any data and utility programs needed for -+reproducing the executable from it. However, as a special exception, -+the source code distributed need not include anything that is normally -+distributed (in either source or binary form) with the major -+components (compiler, kernel, and so on) of the operating system on -+which the executable runs, unless that component itself accompanies -+the executable. -+ -+ It may happen that this requirement contradicts the license -+restrictions of other proprietary libraries that do not normally -+accompany the operating system. Such a contradiction means you cannot -+use both them and the Library together in an executable that you -+distribute. -+ -+ 7. You may place library facilities that are a work based on the -+Library side-by-side in a single library together with other library -+facilities not covered by this License, and distribute such a combined -+library, provided that the separate distribution of the work based on -+the Library and of the other library facilities is otherwise -+permitted, and provided that you do these two things: -+ -+ a) Accompany the combined library with a copy of the same work -+ based on the Library, uncombined with any other library -+ facilities. This must be distributed under the terms of the -+ Sections above. -+ -+ b) Give prominent notice with the combined library of the fact -+ that part of it is a work based on the Library, and explaining -+ where to find the accompanying uncombined form of the same work. -+ -+ 8. You may not copy, modify, sublicense, link with, or distribute -+the Library except as expressly provided under this License. Any -+attempt otherwise to copy, modify, sublicense, link with, or -+distribute the Library is void, and will automatically terminate your -+rights under this License. However, parties who have received copies, -+or rights, from you under this License will not have their licenses -+terminated so long as such parties remain in full compliance. -+ -+ 9. You are not required to accept this License, since you have not -+signed it. However, nothing else grants you permission to modify or -+distribute the Library or its derivative works. These actions are -+prohibited by law if you do not accept this License. Therefore, by -+modifying or distributing the Library (or any work based on the -+Library), you indicate your acceptance of this License to do so, and -+all its terms and conditions for copying, distributing or modifying -+the Library or works based on it. -+ -+ 10. Each time you redistribute the Library (or any work based on the -+Library), the recipient automatically receives a license from the -+original licensor to copy, distribute, link with or modify the Library -+subject to these terms and conditions. You may not impose any further -+restrictions on the recipients' exercise of the rights granted herein. -+You are not responsible for enforcing compliance by third parties to -+this License. -+ -+ 11. If, as a consequence of a court judgment or allegation of patent -+infringement or for any other reason (not limited to patent issues), -+conditions are imposed on you (whether by court order, agreement or -+otherwise) that contradict the conditions of this License, they do not -+excuse you from the conditions of this License. If you cannot -+distribute so as to satisfy simultaneously your obligations under this -+License and any other pertinent obligations, then as a consequence you -+may not distribute the Library at all. For example, if a patent -+license would not permit royalty-free redistribution of the Library by -+all those who receive copies directly or indirectly through you, then -+the only way you could satisfy both it and this License would be to -+refrain entirely from distribution of the Library. -+ -+If any portion of this section is held invalid or unenforceable under any -+particular circumstance, the balance of the section is intended to apply, -+and the section as a whole is intended to apply in other circumstances. -+ -+It is not the purpose of this section to induce you to infringe any -+patents or other property right claims or to contest validity of any -+such claims; this section has the sole purpose of protecting the -+integrity of the free software distribution system which is -+implemented by public license practices. Many people have made -+generous contributions to the wide range of software distributed -+through that system in reliance on consistent application of that -+system; it is up to the author/donor to decide if he or she is willing -+to distribute software through any other system and a licensee cannot -+impose that choice. -+ -+This section is intended to make thoroughly clear what is believed to -+be a consequence of the rest of this License. -+ -+ 12. If the distribution and/or use of the Library is restricted in -+certain countries either by patents or by copyrighted interfaces, the -+original copyright holder who places the Library under this License may add -+an explicit geographical distribution limitation excluding those countries, -+so that distribution is permitted only in or among countries not thus -+excluded. In such case, this License incorporates the limitation as if -+written in the body of this License. -+ -+ 13. The Free Software Foundation may publish revised and/or new -+versions of the Library General Public License from time to time. -+Such new versions will be similar in spirit to the present version, -+but may differ in detail to address new problems or concerns. -+ -+Each version is given a distinguishing version number. If the Library -+specifies a version number of this License which applies to it and -+"any later version", you have the option of following the terms and -+conditions either of that version or of any later version published by -+the Free Software Foundation. If the Library does not specify a -+license version number, you may choose any version ever published by -+the Free Software Foundation. -+ -+ 14. If you wish to incorporate parts of the Library into other free -+programs whose distribution conditions are incompatible with these, -+write to the author to ask for permission. For software which is -+copyrighted by the Free Software Foundation, write to the Free -+Software Foundation; we sometimes make exceptions for this. Our -+decision will be guided by the two goals of preserving the free status -+of all derivatives of our free software and of promoting the sharing -+and reuse of software generally. -+ -+ NO WARRANTY -+ -+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -+ -+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -+DAMAGES. -+ -+ END OF TERMS AND CONDITIONS -+ How to Apply These Terms to Your New Libraries -+ -+ If you develop a new library, and you want it to be of the greatest -+possible use to the public, we recommend making it free software that -+everyone can redistribute and change. You can do so by permitting -+redistribution under these terms (or, alternatively, under the terms of the -+ordinary General Public License). -+ -+ To apply these terms, attach the following notices to the library. It is -+safest to attach them to the start of each source file to most effectively -+convey the exclusion of warranty; and each file should have at least the -+"copyright" line and a pointer to where the full notice is found. -+ -+ -+ Copyright (C) -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with this library; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ -+Also add information on how to contact you by electronic and paper mail. -+ -+You should also get your employer (if you work as a programmer) or your -+school, if any, to sign a "copyright disclaimer" for the library, if -+necessary. Here is a sample; alter the names: -+ -+ Yoyodyne, Inc., hereby disclaims all copyright interest in the -+ library `Frob' (a library for tweaking knobs) written by James Random Hacker. -+ -+ , 1 April 1990 -+ Ty Coon, President of Vice -+ -+That's all there is to it! -diff --git a/src/3rdparty/dbusmenu-qt/NEWS b/src/3rdparty/dbusmenu-qt/NEWS -new file mode 100644 -index 0000000..a89a352 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/NEWS -@@ -0,0 +1,36 @@ -+# 0.3.2 - 2010.04.02 -+- Fix some weird positioning of menus and submenus. -+- Handle ItemPropertyUpdated() signal. -+- Correctly handle properties which are not part of the returned property map -+ because they are set to their default value. -+- Export "visible" property of action. -+ -+# 0.3.1 - 2010.04.01 -+- Updated to the latest protocol change: 0 is no longer the default value of -+ the "toggle-state" property. -+- Make it build without QJson again. -+ -+# 0.3.0 - 2010.03.09 -+- Moved the DBus side of DBusMenuExporter to a separate class, hiding it from -+ the outside world. -+- Cleaned the API of DBusMenuExporter and DBusMenuImporter. -+- Implemented AboutToShow method from the DBusMenu spec. -+ -+# 0.2.2 - 2010.02.17 -+- Fixed crash if action is removed from menu after exporter is deleted -+ (LP BUG 521011). -+- Introduced a Qt equivalent of the test application used by dbusmenu-bench in -+ libdbusmenu-glib. -+- Added distcheck target. -+ -+# 0.2.1 - 2010.02.04 -+- Export KDE titles as disabled standard items. -+- Added temporary workaround to get more dynamic menus to work on GNOME. -+ -+# 0.2.0 - 2010.02.03 -+- Make it possible to define the object-path used by DBusMenuExporter. -+- Unit tests. -+- Follow new DBusMenu spec. -+ -+# 0.1.0 - 2010.01.05 -+- First release. -diff --git a/src/3rdparty/dbusmenu-qt/README b/src/3rdparty/dbusmenu-qt/README -new file mode 100644 -index 0000000..8aa9480 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/README -@@ -0,0 +1,10 @@ -+# Summary -+ -+This library provides a Qt implementation of the DBusMenu protocol. -+ -+The DBusMenu protocol makes it possible for applications to export and import -+their menus over DBus. -+ -+# Author -+ -+Canonical DX Team, Aurélien Gâteau -diff --git a/src/3rdparty/dbusmenu-qt/README.qt b/src/3rdparty/dbusmenu-qt/README.qt -new file mode 100644 -index 0000000..594c835 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/README.qt -@@ -0,0 +1,39 @@ -+# Presentation -+ -+This dir contains a modified copy of dbusmenu-qt, which is maintained here: -+ -+ git://gitorious.org/dbusmenu/dbusmenu-qt.git -+ -+Here is a list of changes. These changes should be reapplied when syncing from -+a new version of dbusmenu-qt. -+ -+- Added a dbusmenu-qt.pri file -+ -+- Removed dbusmenuimporter*: -+ We only export menus, we do not import -+ -+- Hand-generated (ugh) the dbusmenu adaptor -+ -+- Renamed dbusmenuexporter.h to dbusmenuexporter_p.h, dbusmenuadaptor.h to -+ dbusmenuadaptor_p.h. Turned dbusmenu_export.h into a dummy file: -+ We do not want DBusMenuExporter to be part of the public API for now -+ -+- Removed ending '#include "file.moc"' as this is not the way Qt is build -+ -+# Syncing -+ -+- Run update.sh script from this dir. -+- Add any new file to dbusmenu-qt.pri. -+- Add sha-id to "Past syncs". -+ -+# Past syncs -+ -+sha-id are from dbusmenu-qt git repository. -+ -+- 2010.09.23: 586496b23a8f0ea27535be9044739554e8ddfa37 -+- 2010.09.02: f759da2eaa9c71341d7e17231c49ecf87e2bcc24 -+- 2010.08.10: 29d5670cbc105b4f60d8d8376cbc72b90218d9e9 -+- 2010.07.01: 3a47d355b2291bad865b911a0cdd3cf1e5e1b95e -+- 2010.06.24: f3c2fb90e1c2b94e561ccf33e4c2049f96ce45e2 -+- 2010.06.17: 6e0a47965f7f6d8cc8e3c9dccfdd9065ec7c831e -+- 2010.06.07: 84fd071ca778025ee2919a1d5c971658d8108f03 -diff --git a/src/3rdparty/dbusmenu-qt/RELEASE_CHECK_LIST b/src/3rdparty/dbusmenu-qt/RELEASE_CHECK_LIST -new file mode 100644 -index 0000000..c858157 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/RELEASE_CHECK_LIST -@@ -0,0 +1,12 @@ -+- Update NEWS -+ git log x.y.z-1..HEAD -+- Bump version number in CMakeLists.txt -+- Commit -+- Create tarball -+- Unpack tarball, build and run tests -+- If ok, create "x.y.z" tag -+ git tag -a x.y.z -+- Push -+ git push -+ git push --tags -+- Upload tarball -diff --git a/src/3rdparty/dbusmenu-qt/cmake/modules/FindQJSON.cmake b/src/3rdparty/dbusmenu-qt/cmake/modules/FindQJSON.cmake -new file mode 100644 -index 0000000..0b066d4 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/cmake/modules/FindQJSON.cmake -@@ -0,0 +1,44 @@ -+# Find QJSON - JSON handling library for Qt -+# -+# This module defines -+# QJSON_FOUND - whether the qsjon library was found -+# QJSON_LIBRARIES - the qjson library -+# QJSON_INCLUDE_DIR - the include path of the qjson library -+# -+ -+if (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) -+ -+ # Already in cache -+ set (QJSON_FOUND TRUE) -+ -+else (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) -+ -+ if (NOT WIN32) -+ # use pkg-config to get the values of QJSON_INCLUDE_DIRS -+ # and QJSON_LIBRARY_DIRS to add as hints to the find commands. -+ include (FindPkgConfig) -+ pkg_check_modules (QJSON QJson>=0.5) -+ endif (NOT WIN32) -+ -+ find_library (QJSON_LIBRARIES -+ NAMES -+ qjson -+ PATHS -+ ${QJSON_LIBRARY_DIRS} -+ ${LIB_INSTALL_DIR} -+ ${KDE4_LIB_DIR} -+ ) -+ -+ find_path (QJSON_INCLUDE_DIR -+ NAMES -+ qjson/parser.h -+ PATHS -+ ${QJSON_INCLUDE_DIRS} -+ ${INCLUDE_INSTALL_DIR} -+ ${KDE4_INCLUDE_DIR} -+ ) -+ -+ include(FindPackageHandleStandardArgs) -+ find_package_handle_standard_args(QJSON DEFAULT_MSG QJSON_LIBRARIES QJSON_INCLUDE_DIR) -+ -+endif (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) -diff --git a/src/3rdparty/dbusmenu-qt/dbusmenu-qt.pc.in b/src/3rdparty/dbusmenu-qt/dbusmenu-qt.pc.in -new file mode 100644 -index 0000000..6adecc4 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/dbusmenu-qt.pc.in -@@ -0,0 +1,10 @@ -+prefix=@CMAKE_INSTALL_PREFIX@ -+exec_prefix=@CMAKE_INSTALL_PREFIX@ -+libdir=@CMAKE_INSTALL_PREFIX@/lib -+includedir=@CMAKE_INSTALL_PREFIX@/include/dbusmenu-qt -+ -+Name: libdbusmenu-qt -+Description: Qt implementation of dbusmenu spec -+Version: @dbusmenu_qt_VERSION@ -+Libs: -L${libdir} -ldbusmenu-qt -+Cflags: -I${includedir} -diff --git a/src/3rdparty/dbusmenu-qt/dbusmenu-qt.pri b/src/3rdparty/dbusmenu-qt/dbusmenu-qt.pri -new file mode 100644 -index 0000000..76cc7b5 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/dbusmenu-qt.pri -@@ -0,0 +1,32 @@ -+QT += dbus -+ -+DBUSMENUQT_DIR = $$QT_SOURCE_TREE/src/3rdparty/dbusmenu-qt/src -+ -+INCLUDEPATH += $$DBUSMENUQT_DIR -+ -+#qdbusxml2cpp -m -a dbusmenuadaptor -i dbusmenuexporterdbus_p.h -l DBusMenuExporterDBus dbusmenu-qt/src/org.ayatana.dbusmenu.xml -+ -+HEADERS += \ -+ $$DBUSMENUQT_DIR/dbusmenuexporterdbus_p.h \ -+ $$DBUSMENUQT_DIR/dbusmenuexporter_p.h \ -+ $$DBUSMENUQT_DIR/dbusmenuexporterprivate_p.h \ -+ $$DBUSMENUQT_DIR/dbusmenuitem_p.h \ -+ $$DBUSMENUQT_DIR/dbusmenushortcut_p.h \ -+ $$DBUSMENUQT_DIR/dbusmenu_p.h \ -+ $$DBUSMENUQT_DIR/debug_p.h \ -+ $$DBUSMENUQT_DIR/utils_p.h -+ -+SOURCES += \ -+ $$DBUSMENUQT_DIR/dbusmenuexporter.cpp \ -+ $$DBUSMENUQT_DIR/dbusmenuexporterdbus_p.cpp \ -+ $$DBUSMENUQT_DIR/dbusmenuitem_p.cpp \ -+ $$DBUSMENUQT_DIR/dbusmenushortcut_p.cpp \ -+ $$DBUSMENUQT_DIR/dbusmenu_p.cpp \ -+ $$DBUSMENUQT_DIR/utils.cpp -+ -+# UGLY++ -+HEADERS += \ -+ $$DBUSMENUQT_DIR/dbusmenuadaptor_p.h -+ -+SOURCES += \ -+ $$DBUSMENUQT_DIR/dbusmenuadaptor.cpp -diff --git a/src/3rdparty/dbusmenu-qt/src/CMakeLists.txt b/src/3rdparty/dbusmenu-qt/src/CMakeLists.txt -new file mode 100644 -index 0000000..c8f49ab ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/CMakeLists.txt -@@ -0,0 +1,65 @@ -+include (CheckCXXCompilerFlag) -+check_cxx_compiler_flag(-fvisibility=hidden __DBUSMENU_HAVE_GCC_VISIBILITY) -+if (__DBUSMENU_HAVE_GCC_VISIBILITY AND NOT WIN32) -+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") -+endif (__DBUSMENU_HAVE_GCC_VISIBILITY AND NOT WIN32) -+ -+check_cxx_compiler_flag(-Woverloaded-virtual __DBUSMENU_HAVE_W_OVERLOADED_VIRTUAL) -+if (__DBUSMENU_HAVE_W_OVERLOADED_VIRTUAL) -+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual") -+endif (__DBUSMENU_HAVE_W_OVERLOADED_VIRTUAL) -+ -+check_cxx_compiler_flag(-Wall __DBUSMENU_HAVE_W_ALL) -+if (__DBUSMENU_HAVE_W_ALL) -+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") -+endif (__DBUSMENU_HAVE_W_ALL) -+ -+if (MSVC) -+ add_definitions(-D__PRETTY_FUNCTION__=__FUNCTION__) -+endif (MSVC) -+ -+set(dbusmenu_qt_SRCS -+ dbusmenu_p.cpp -+ dbusmenuexporter.cpp -+ dbusmenuexporterdbus_p.cpp -+ dbusmenuimporter.cpp -+ dbusmenuitem_p.cpp -+ utils.cpp -+ ) -+ -+include_directories( -+ ${CMAKE_SOURCE_DIR}/src -+ ${CMAKE_BINARY_DIR}/src -+ ) -+ -+qt4_automoc(${dbusmenu_qt_SRCS}) -+ -+qt4_add_dbus_adaptor(dbusmenu_qt_SRCS -+ ${CMAKE_CURRENT_SOURCE_DIR}/org.ayatana.dbusmenu.xml -+ ${CMAKE_CURRENT_SOURCE_DIR}/dbusmenuexporterdbus_p.h DBusMenuExporterDBus -+ ) -+ -+add_library(dbusmenu-qt SHARED ${dbusmenu_qt_SRCS}) -+set_target_properties(dbusmenu-qt PROPERTIES -+ VERSION ${dbusmenu_qt_lib_VERSION} -+ SOVERSION ${dbusmenu_qt_lib_SOVERSION} -+ ) -+ -+target_link_libraries(dbusmenu-qt -+ ${QT_QTGUI_LIBRARIES} -+ ${QT_QTDBUS_LIBRARIES} -+ ${QT_QTXML_LIBRARIES} -+ ${QT_QTCORE_LIBRARIES} -+ ) -+ -+install(TARGETS dbusmenu-qt -+ LIBRARY DESTINATION lib${LIB_SUFFIX} -+ ARCHIVE DESTINATION lib -+ RUNTIME DESTINATION bin -+) -+ -+install(DIRECTORY . -+ DESTINATION include/dbusmenu-qt -+ FILES_MATCHING PATTERN "*.h" -+ PATTERN "*_p.h" EXCLUDE -+ ) -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenu_config.h b/src/3rdparty/dbusmenu-qt/src/dbusmenu_config.h -new file mode 100644 -index 0000000..49b83b7 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenu_config.h -@@ -0,0 +1,27 @@ -+/* This file is part of the KDE libraries -+ Copyright 2010 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+// This file has been generated by 3rdparty/dbusmenu-qt/update.sh -+#ifndef DBUSMENU_CONFIG_H -+#define DBUSMENU_CONFIG_H -+ -+#define HAVE_QICON_NAME -+ -+#endif -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenu_export.h b/src/3rdparty/dbusmenu-qt/src/dbusmenu_export.h -new file mode 100644 -index 0000000..548183a ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenu_export.h -@@ -0,0 +1,28 @@ -+/* This file is part of the KDE libraries -+ Copyright 2010 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+// This file has been generated by 3rdparty/dbusmenu-qt/update.sh -+// We do not want Qt to export dbusmenu -+#ifndef DBUSMENU_EXPORT_H -+#define DBUSMENU_EXPORT_H -+ -+#define DBUSMENU_EXPORT -+ -+#endif -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenu_p.cpp b/src/3rdparty/dbusmenu-qt/src/dbusmenu_p.cpp -new file mode 100644 -index 0000000..c3c55a5 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenu_p.cpp -@@ -0,0 +1,93 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2009 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#include "dbusmenu_p.h" -+ -+// Qt -+#include -+#include -+#include -+ -+// Local -+#include "dbusmenuexporter_p.h" -+#include "dbusmenuexporterprivate_p.h" -+#include "debug_p.h" -+ -+DBusMenu::DBusMenu(QMenu *menu, DBusMenuExporter *exporter, int parentId) -+: QObject(menu) -+, m_exporter(exporter) -+, m_parentId(parentId) -+{ -+ menu->installEventFilter(this); -+} -+ -+DBusMenu::~DBusMenu() -+{ -+} -+ -+bool DBusMenu::eventFilter(QObject *, QEvent *event) -+{ -+ QActionEvent *actionEvent = 0; -+ switch (event->type()) { -+ case QEvent::ActionAdded: -+ case QEvent::ActionChanged: -+ case QEvent::ActionRemoved: -+ actionEvent = static_cast(event); -+ break; -+ default: -+ return false; -+ } -+ switch (event->type()) { -+ case QEvent::ActionAdded: -+ addAction(actionEvent->action()); -+ break; -+ case QEvent::ActionChanged: -+ updateAction(actionEvent->action()); -+ break; -+ case QEvent::ActionRemoved: -+ removeAction(actionEvent->action()); -+ break; -+ default: -+ break; -+ } -+ return false; -+} -+ -+void DBusMenu::addAction(QAction *action) -+{ -+ if (m_exporter.data()) { -+ m_exporter.data()->d->addAction(action, m_parentId); -+ } -+} -+ -+void DBusMenu::updateAction(QAction *action) -+{ -+ if (m_exporter.data()) { -+ m_exporter.data()->d->updateAction(action); -+ } -+} -+ -+void DBusMenu::removeAction(QAction *action) -+{ -+ if (m_exporter.data()) { -+ m_exporter.data()->d->removeAction(action, m_parentId); -+ } -+} -+ -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenu_p.h b/src/3rdparty/dbusmenu-qt/src/dbusmenu_p.h -new file mode 100644 -index 0000000..65f19f1 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenu_p.h -@@ -0,0 +1,57 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2009 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#ifndef DBUSMENU_H -+#define DBUSMENU_H -+ -+#include -+#include -+#include -+ -+class QAction; -+class QMenu; -+ -+class DBusMenuExporter; -+ -+/** -+ * Internal class responsible for tracking changes in a menu and reporting them -+ * through DBusMenuExporter -+ * @internal -+ */ -+class DBusMenu : public QObject -+{ -+ Q_OBJECT -+public: -+ DBusMenu(QMenu *menu, DBusMenuExporter *exporter, int parentId); -+ ~DBusMenu(); -+ -+protected: -+ virtual bool eventFilter(QObject *obj, QEvent *event); -+ -+private: -+ void addAction(QAction *action); -+ void updateAction(QAction *action); -+ void removeAction(QAction *action); -+ -+ QWeakPointer m_exporter; -+ int m_parentId; -+}; -+ -+#endif /* DBUSMENU_H */ -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenuadaptor.cpp b/src/3rdparty/dbusmenu-qt/src/dbusmenuadaptor.cpp -new file mode 100644 -index 0000000..9cfcc8d ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenuadaptor.cpp -@@ -0,0 +1,84 @@ -+/* -+ * This file was generated by qdbusxml2cpp version 0.7 -+ * Command line was: qdbusxml2cpp -m -a dbusmenuadaptor -i dbusmenuexporterdbus_p.h -l DBusMenuExporterDBus org.ayatana.dbusmenu.xml -+ * -+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -+ * -+ * This is an auto-generated file. -+ * Do not edit! All changes made to it will be lost. -+ */ -+ -+#include "dbusmenuadaptor_p.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* -+ * Implementation of adaptor class DbusmenuAdaptor -+ */ -+ -+DbusmenuAdaptor::DbusmenuAdaptor(DBusMenuExporterDBus *parent) -+ : QDBusAbstractAdaptor(parent) -+{ -+ // constructor -+ setAutoRelaySignals(true); -+} -+ -+DbusmenuAdaptor::~DbusmenuAdaptor() -+{ -+ // destructor -+} -+ -+uint DbusmenuAdaptor::version() const -+{ -+ // get the value of property version -+ return qvariant_cast< uint >(parent()->property("version")); -+} -+ -+bool DbusmenuAdaptor::AboutToShow(int id) -+{ -+ // handle method call org.ayatana.dbusmenu.AboutToShow -+ return parent()->AboutToShow(id); -+} -+ -+void DbusmenuAdaptor::Event(int id, const QString &eventId, const QDBusVariant &data, uint timestamp) -+{ -+ // handle method call org.ayatana.dbusmenu.Event -+ parent()->Event(id, eventId, data, timestamp); -+} -+ -+DBusMenuItemList DbusmenuAdaptor::GetChildren(int id, const QStringList &propertyNames) -+{ -+ // handle method call org.ayatana.dbusmenu.GetChildren -+ return parent()->GetChildren(id, propertyNames); -+} -+ -+DBusMenuItemList DbusmenuAdaptor::GetGroupProperties(const QList &ids, const QStringList &propertyNames) -+{ -+ // handle method call org.ayatana.dbusmenu.GetGroupProperties -+ return parent()->GetGroupProperties(ids, propertyNames); -+} -+ -+uint DbusmenuAdaptor::GetLayout(int parentId, QString &layout) -+{ -+ // handle method call org.ayatana.dbusmenu.GetLayout -+ return parent()->GetLayout(parentId, layout); -+} -+ -+QVariantMap DbusmenuAdaptor::GetProperties(int id, const QStringList &propertyNames) -+{ -+ // handle method call org.ayatana.dbusmenu.GetProperties -+ return parent()->GetProperties(id, propertyNames); -+} -+ -+QDBusVariant DbusmenuAdaptor::GetProperty(int id, const QString &name) -+{ -+ // handle method call org.ayatana.dbusmenu.GetProperty -+ return parent()->GetProperty(id, name); -+} -+ -+ -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenuadaptor_p.h b/src/3rdparty/dbusmenu-qt/src/dbusmenuadaptor_p.h -new file mode 100644 -index 0000000..8afd839 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenuadaptor_p.h -@@ -0,0 +1,347 @@ -+/* -+ * This file was generated by qdbusxml2cpp version 0.7 -+ * Command line was: qdbusxml2cpp -m -a dbusmenuadaptor -i dbusmenuexporterdbus_p.h -l DBusMenuExporterDBus org.ayatana.dbusmenu.xml -+ * -+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -+ * -+ * This is an auto-generated file. -+ * This file may have been hand-edited. Look for HAND-EDIT comments -+ * before re-generating it. -+ */ -+ -+#ifndef DBUSMENUADAPTOR_H_1285231004 -+#define DBUSMENUADAPTOR_H_1285231004 -+ -+#include -+#include -+#include "dbusmenuexporterdbus_p.h" -+class QByteArray; -+template class QList; -+template class QMap; -+class QString; -+class QStringList; -+class QVariant; -+ -+/* -+ * Adaptor class for interface org.ayatana.dbusmenu -+ */ -+class DbusmenuAdaptor: public QDBusAbstractAdaptor -+{ -+ Q_OBJECT -+ Q_CLASSINFO("D-Bus Interface", "org.ayatana.dbusmenu") -+ Q_CLASSINFO("D-Bus Introspection", "" -+" \n" -+" \n" -+" \n" -+" Name\n" -+" Type\n" -+" Description\n" -+" Default Value\n" -+" \n" -+" \n" -+" type\n" -+" String\n" -+" Can be one of:\n" -+" - \"standard\": an item which can be clicked to trigger an action or\n" -+" show another menu\n" -+" - \"separator\": a separator\n" -+"\n" -+" Vendor specific types can be added by prefixing them with\n" -+" \"x--\".\n" -+" \n" -+" \"standard\"\n" -+" \n" -+" \n" -+" label\n" -+" string\n" -+" Text of the item, except that:\n" -+" -# two consecutive underscore characters \"__\" are displayed as a\n" -+" single underscore,\n" -+" -# any remaining underscore characters are not displayed at all,\n" -+" -# the first of those remaining underscore characters (unless it is\n" -+" the last character in the string) indicates that the following\n" -+" character is the access key.\n" -+" \n" -+" \"\"\n" -+" \n" -+" \n" -+" enabled\n" -+" boolean\n" -+" Whether the item can be activated or not.\n" -+" true\n" -+" \n" -+" \n" -+" icon-name\n" -+" string\n" -+" Icon name of the item, following the freedesktop.org icon spec.\n" -+" \"\"\n" -+" \n" -+" \n" -+" icon-data\n" -+" binary\n" -+" PNG data of the icon.\n" -+" Empty\n" -+" \n" -+" \n" -+" toggle-type\n" -+" string\n" -+" \n" -+" If the item can be toggled, this property should be set to:\n" -+" - \"checkmark\": Item is an independent togglable item\n" -+" - \"radio\": Item is part of a group where only one item can be\n" -+" toggled at a time\n" -+" - \"\": Item cannot be toggled\n" -+" \n" -+" \"\"\n" -+" \n" -+" \n" -+" toggle-state\n" -+" int\n" -+" \n" -+" Describe the current state of a \"togglable\" item. Can be one of:\n" -+" - 0 = off\n" -+" - 1 = on\n" -+" - anything else = indeterminate\n" -+"\n" -+" Note:\n" -+" The implementation does not itself handle ensuring that only one\n" -+" item in a radio group is set to \"on\", or that a group does not have\n" -+" \"on\" and \"indeterminate\" items simultaneously; maintaining this\n" -+" policy is up to the toolkit wrappers.\n" -+" \n" -+" 0\n" -+" \n" -+" \n" -+" children-display\n" -+" string\n" -+" \n" -+" If the menu item has children this property should be set to\n" -+" \"submenu\".\n" -+" \n" -+" \"\"\n" -+" \n" -+" \n" -+"\n" -+" Vendor specific properties can be added by prefixing them with\n" -+" \"x--\".\n" -+" ]]>\n" -+" \n" -+" \n" -+" \n" -+" Provides the version of the DBusmenu API that this API is\n" -+" implementing.\n" -+" \n" -+" \n" -+" \n" -+" \n" -+" # Root container\n" -+" # First level menu, for example \"File\"\n" -+" ~ Second level menu, for example \"Open\"\n" -+" \n" -+" ...\n" -+" \n" -+" # Another first level menu, say \"Edit\"\n" -+" ...\n" -+" \n" -+" ...\n" -+"\n" -+" @endverbatim\n" -+" ]]>\n" -+" \n" -+" The ID of the parent node for the layout. For\n" -+" grabbing the layout from the root node use zero.\n" -+" \n" -+" \n" -+" The revision number of the layout. For matching\n" -+" with layoutUpdated signals.\n" -+" \n" -+" \n" -+" The layout as an XML string of IDs.\n" -+" \n" -+" \n" -+" \n" -+" \" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n" -+" \n" -+" \n" -+" Returns the list of items which are children of @a parentId.\n" -+" \n" -+" \n" -+" \n" -+" A list of ids that we should be finding the properties\n" -+" on. If the list is empty, all menu items should be sent.\n" -+" \n" -+" \n" -+" \n" -+" \n" -+" The list of item properties we are\n" -+" interested in. If there are no entries in the list all of\n" -+" the properties will be sent.\n" -+" \n" -+" \n" -+" \n" -+" \n" -+" An array of property values.\n" -+" An item in this area is represented as a struct following\n" -+" this format:\n" -+" @li id unsigned the item id\n" -+" @li properties map(string => variant) the requested item properties\n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" Returns multiple properties in one call. This is more efficient than\n" -+" GetProperty.\n" -+"\n" -+" \n" -+" \n" -+" \n" -+" The item whose properties we want to retrieve.\n" -+" \n" -+" \n" -+" List of string name of the properties we want. If the list contains no entries, all properties are sent.\n" -+" \n" -+" \n" -+" \n" -+" \n" -+" -\"\n" -+" ]]>\n" -+" \n" -+" the id of the item which received the event\n" -+" \n" -+" \n" -+" the type of event\n" -+" \n" -+" \n" -+" event-specific data\n" -+" \n" -+" \n" -+" The time that the event occured if available or the time the message was sent if not\n" -+" \n" -+" \n" -+" \n" -+" This is called by the applet to notify the application it is\n" -+" about to show the menu whose parent is @p id. The application\n" -+" should return True if the menu needs to be refreshed, False if it\n" -+" does not.\n" -+" \n" -+" the id of the parent item of the menu\n" -+" \n" -+" \n" -+" True if the menu has just been updated and should be\n" -+" refreshed\n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" Triggered by the application to notify the applet that the property @a property\n" -+" from item @a id has changed to @a value.\n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" Triggered by the application to notify the applet that all properties of item\n" -+" \n" -+" \n" -+" id which should be considered outdated\n" -+" \n" -+" \n" -+" \n" -+" \n" -+" Triggered by the application to notify display of a layout update, up to\n" -+" revision\n" -+" \n" -+" \n" -+" The revision of the layout that we're currently on\n" -+" \n" -+" \n" -+" \n" -+" If the layout update is only of a subtree, this is the\n" -+" parent item for the entries that have changed. It is zero if\n" -+" the whole layout should be considered invalid.\n" -+" \n" -+" \n" -+" \n" -+" \n" -+" \n" -+" The server is requesting that all clients displaying this\n" -+" menu open it to the user. This would be for things like\n" -+" hotkeys that when the user presses them the menu should\n" -+" open and display itself to the user.\n" -+" \n" -+" \n" -+" ID of the menu that should be activated\n" -+" \n" -+" \n" -+" The time that the event occured\n" -+" \n" -+" \n" -+" \n" -+" \n" -+ "") -+public: -+ DbusmenuAdaptor(DBusMenuExporterDBus *parent); -+ virtual ~DbusmenuAdaptor(); -+ -+ inline DBusMenuExporterDBus *parent() const -+ { return static_cast(QObject::parent()); } -+ -+public: // PROPERTIES -+ Q_PROPERTY(uint version READ version) -+ uint version() const; -+ -+public Q_SLOTS: // METHODS -+ bool AboutToShow(int id); -+ void Event(int id, const QString &eventId, const QDBusVariant &data, uint timestamp); -+ DBusMenuItemList GetChildren(int id, const QStringList &propertyNames); -+ DBusMenuItemList GetGroupProperties(const QList &ids, const QStringList &propertyNames); -+ uint GetLayout(int parentId, QString &layout); -+ QVariantMap GetProperties(int id, const QStringList &propertyNames); -+ QDBusVariant GetProperty(int id, const QString &name); -+Q_SIGNALS: // SIGNALS -+ void ItemActivationRequested(int id, uint timestamp); -+ void ItemPropertyUpdated(int id, const QString &prop, const QDBusVariant &value); -+ void ItemUpdated(int id); -+ void LayoutUpdated(uint revision, int parent); -+}; -+ -+#endif -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenuexporter.cpp b/src/3rdparty/dbusmenu-qt/src/dbusmenuexporter.cpp -new file mode 100644 -index 0000000..b5468fc ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenuexporter.cpp -@@ -0,0 +1,325 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2009 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#include "dbusmenuexporter_p.h" -+ -+// Qt -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+// Local -+#include "dbusmenu_config.h" -+#include "dbusmenu_p.h" -+#include "dbusmenuexporterdbus_p.h" -+#include "dbusmenuexporterprivate_p.h" -+#include "dbusmenuitem_p.h" -+#include "dbusmenushortcut_p.h" -+#include "debug_p.h" -+#include "utils_p.h" -+ -+static const char *KMENU_TITLE = "kmenu_title"; -+ -+//------------------------------------------------- -+// -+// DBusMenuExporterPrivate -+// -+//------------------------------------------------- -+int DBusMenuExporterPrivate::idForAction(QAction *action) const -+{ -+ DMRETURN_VALUE_IF_FAIL(action, -1); -+ return m_idForAction.value(action, -2); -+} -+ -+void DBusMenuExporterPrivate::addMenu(QMenu *menu, int parentId) -+{ -+ new DBusMenu(menu, q, parentId); -+ Q_FOREACH(QAction *action, menu->actions()) { -+ addAction(action, parentId); -+ } -+} -+ -+QVariantMap DBusMenuExporterPrivate::propertiesForAction(QAction *action) const -+{ -+ DMRETURN_VALUE_IF_FAIL(action, QVariantMap()); -+ -+ if (action->objectName() == KMENU_TITLE) { -+ // Hack: Support for KDE menu titles in a Qt-only library... -+ return propertiesForKMenuTitleAction(action); -+ } else if (action->isSeparator()) { -+ return propertiesForSeparatorAction(action); -+ } else { -+ return propertiesForStandardAction(action); -+ } -+} -+ -+QVariantMap DBusMenuExporterPrivate::propertiesForKMenuTitleAction(QAction *action_) const -+{ -+ QVariantMap map; -+ map.insert("enabled", false); -+ map.insert("x-kde-title", true); -+ -+ const QWidgetAction *widgetAction = qobject_cast(action_); -+ DMRETURN_VALUE_IF_FAIL(widgetAction, map); -+ QToolButton *button = qobject_cast(widgetAction->defaultWidget()); -+ DMRETURN_VALUE_IF_FAIL(button, map); -+ QAction *action = button->defaultAction(); -+ DMRETURN_VALUE_IF_FAIL(action, map); -+ -+ map.insert("label", swapMnemonicChar(action->text(), '&', '_')); -+ insertIconProperty(&map, action); -+ if (!action->isVisible()) { -+ map.insert("visible", false); -+ } -+ return map; -+} -+ -+QVariantMap DBusMenuExporterPrivate::propertiesForSeparatorAction(QAction *action) const -+{ -+ QVariantMap map; -+ map.insert("type", "separator"); -+ if (!action->isVisible()) { -+ map.insert("visible", false); -+ } -+ return map; -+} -+ -+QVariantMap DBusMenuExporterPrivate::propertiesForStandardAction(QAction *action) const -+{ -+ QVariantMap map; -+ map.insert("label", swapMnemonicChar(action->text(), '&', '_')); -+ if (!action->isEnabled()) { -+ map.insert("enabled", false); -+ } -+ if (!action->isVisible()) { -+ map.insert("visible", false); -+ } -+ if (action->menu()) { -+ map.insert("children-display", "submenu"); -+ } -+ if (action->isCheckable()) { -+ bool exclusive = action->actionGroup() && action->actionGroup()->isExclusive(); -+ map.insert("toggle-type", exclusive ? "radio" : "checkmark"); -+ map.insert("toggle-state", action->isChecked() ? 1 : 0); -+ } -+ insertIconProperty(&map, action); -+ QKeySequence keySequence = action->shortcut(); -+ if (!keySequence.isEmpty()) { -+ DBusMenuShortcut shortcut = DBusMenuShortcut::fromKeySequence(keySequence); -+ map.insert("shortcut", QVariant::fromValue(shortcut)); -+ } -+ return map; -+} -+ -+QMenu *DBusMenuExporterPrivate::menuForId(int id) const -+{ -+ if (id == 0) { -+ return m_rootMenu; -+ } -+ QAction *action = m_actionForId.value(id); -+ DMRETURN_VALUE_IF_FAIL(action, 0); -+ QMenu *menu = action->menu(); -+ DMRETURN_VALUE_IF_FAIL(menu, 0); -+ return menu; -+} -+ -+void DBusMenuExporterPrivate::writeXmlForMenu(QXmlStreamWriter *writer, QMenu *menu, int id) -+{ -+ Q_ASSERT(menu); -+ writer->writeStartElement("menu"); -+ writer->writeAttribute("id", QString::number(id)); -+ Q_FOREACH(QAction *action, menu->actions()) { -+ int actionId = m_idForAction.value(action, -1); -+ if (actionId == -1) { -+ DMWARNING << "No id for action"; -+ continue; -+ } -+ QMenu *actionMenu = action->menu(); -+ if (actionMenu) { -+ writeXmlForMenu(writer, actionMenu, actionId); -+ } else { -+ writer->writeEmptyElement("menu"); -+ writer->writeAttribute("id", QString::number(actionId)); -+ } -+ } -+ writer->writeEndElement(); -+} -+ -+void DBusMenuExporterPrivate::updateAction(QAction *action) -+{ -+ int id = idForAction(action); -+ if (m_itemUpdatedIds.contains(id)) { -+ return; -+ } -+ m_itemUpdatedIds << id; -+ m_itemUpdatedTimer->start(); -+} -+ -+void DBusMenuExporterPrivate::addAction(QAction *action, int parentId) -+{ -+ QVariantMap map = propertiesForAction(action); -+ int id = m_nextId++; -+ QObject::connect(action, SIGNAL(destroyed(QObject*)), q, SLOT(slotActionDestroyed(QObject*))); -+ m_actionForId.insert(id, action); -+ m_idForAction.insert(action, id); -+ m_actionProperties.insert(action, map); -+ if (action->menu()) { -+ addMenu(action->menu(), id); -+ } -+ ++m_revision; -+ emitLayoutUpdated(parentId); -+} -+ -+/** -+ * IMPORTANT: action might have already been destroyed when this method is -+ * called, so don't dereference the pointer (it is a QObject to avoid being -+ * tempted to dereference) -+ */ -+void DBusMenuExporterPrivate::removeActionInternal(QObject *object) -+{ -+ QAction* action = static_cast(object); -+ m_actionProperties.remove(action); -+ int id = m_idForAction.take(action); -+ m_actionForId.remove(id); -+} -+ -+void DBusMenuExporterPrivate::removeAction(QAction *action, int parentId) -+{ -+ removeActionInternal(action); -+ QObject::disconnect(action, SIGNAL(destroyed(QObject*)), q, SLOT(slotActionDestroyed(QObject*))); -+ ++m_revision; -+ emitLayoutUpdated(parentId); -+} -+ -+void DBusMenuExporterPrivate::emitLayoutUpdated(int id) -+{ -+ if (m_layoutUpdatedIds.contains(id)) { -+ return; -+ } -+ m_layoutUpdatedIds << id; -+ m_layoutUpdatedTimer->start(); -+} -+ -+void DBusMenuExporterPrivate::insertIconProperty(QVariantMap *map, QAction *action) const -+{ -+ QString iconName = q->iconNameForAction(action); -+ if (!iconName.isEmpty()) { -+ map->insert("icon-name", iconName); -+ return; -+ } -+ QIcon icon = action->icon(); -+ if (icon.isNull()) { -+ return; -+ } -+ -+ // "icon-data"; -+} -+ -+//------------------------------------------------- -+// -+// DBusMenuExporter -+// -+//------------------------------------------------- -+DBusMenuExporter::DBusMenuExporter(const QString &objectPath, QMenu *menu, const QDBusConnection &_connection) -+: QObject(menu) -+, d(new DBusMenuExporterPrivate) -+{ -+ d->q = this; -+ d->m_rootMenu = menu; -+ d->m_nextId = 1; -+ d->m_revision = 1; -+ d->m_itemUpdatedTimer = new QTimer(this); -+ d->m_layoutUpdatedTimer = new QTimer(this); -+ d->m_dbusObject = new DBusMenuExporterDBus(this); -+ -+ d->addMenu(d->m_rootMenu, 0); -+ -+ d->m_itemUpdatedTimer->setInterval(0); -+ d->m_itemUpdatedTimer->setSingleShot(true); -+ connect(d->m_itemUpdatedTimer, SIGNAL(timeout()), SLOT(doUpdateActions())); -+ -+ d->m_layoutUpdatedTimer->setInterval(0); -+ d->m_layoutUpdatedTimer->setSingleShot(true); -+ connect(d->m_layoutUpdatedTimer, SIGNAL(timeout()), SLOT(doEmitLayoutUpdated())); -+ -+ QDBusConnection connection(_connection); -+ connection.registerObject(objectPath, d->m_dbusObject, QDBusConnection::ExportAllContents); -+} -+ -+DBusMenuExporter::~DBusMenuExporter() -+{ -+ delete d; -+} -+ -+void DBusMenuExporter::doUpdateActions() -+{ -+ Q_FOREACH(int id, d->m_itemUpdatedIds) { -+ QAction *action = d->m_actionForId.value(id); -+ if (!action) { -+ // Action does not exist anymore -+ continue; -+ } -+ d->m_actionProperties[action] = d->propertiesForAction(action); -+ QMenu *menu = action->menu(); -+ if (menu && !menu->findChild()) { -+ d->addMenu(menu, id); -+ } -+ d->m_dbusObject->ItemUpdated(id); -+ } -+ d->m_itemUpdatedIds.clear(); -+} -+ -+void DBusMenuExporter::doEmitLayoutUpdated() -+{ -+ Q_FOREACH(int id, d->m_layoutUpdatedIds) { -+ d->m_dbusObject->LayoutUpdated(d->m_revision, id); -+ } -+ d->m_layoutUpdatedIds.clear(); -+} -+ -+QString DBusMenuExporter::iconNameForAction(QAction *action) -+{ -+ DMRETURN_VALUE_IF_FAIL(action, QString()); -+#ifdef HAVE_QICON_NAME -+ QIcon icon = action->icon(); -+ return icon.isNull() ? QString() : icon.name(); -+#else -+ return QString(); -+#endif -+} -+ -+void DBusMenuExporter::activateAction(QAction *action) -+{ -+ int id = d->idForAction(action); -+ DMRETURN_IF_FAIL(id >= 0); -+ uint timeStamp = QDateTime::currentDateTime().toTime_t(); -+ d->m_dbusObject->ItemActivationRequested(id, timeStamp); -+} -+ -+void DBusMenuExporter::slotActionDestroyed(QObject* object) -+{ -+ d->removeActionInternal(object); -+} -+ -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenuexporter_p.h b/src/3rdparty/dbusmenu-qt/src/dbusmenuexporter_p.h -new file mode 100644 -index 0000000..8f1987c ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenuexporter_p.h -@@ -0,0 +1,81 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2009 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#ifndef DBUSMENUEXPORTER_H -+#define DBUSMENUEXPORTER_H -+ -+// Qt -+#include -+#include -+ -+// Local -+#include -+ -+class QAction; -+class QMenu; -+ -+class DBusMenuExporterPrivate; -+ -+/** -+ * A DBusMenuExporter instance can serialize a menu over DBus -+ */ -+class DBUSMENU_EXPORT DBusMenuExporter : public QObject -+{ -+ Q_OBJECT -+public: -+ /** -+ * Creates a DBusMenuExporter exporting menu at the dbus object path -+ * dbusObjectPath, using the given dbusConnection. -+ * The instance adds itself to the menu children. -+ */ -+ DBusMenuExporter(const QString &dbusObjectPath, QMenu *menu, const QDBusConnection &dbusConnection = QDBusConnection::sessionBus()); -+ -+ ~DBusMenuExporter(); -+ -+ /** -+ * Asks the matching DBusMenuImporter to activate @p action. For menus it -+ * means popup them, for items it means triggering the associated action. -+ */ -+ void activateAction(QAction *action); -+ -+protected: -+ /** -+ * Must extract the icon name for action. This is the name which will -+ * be used to present the icon over DBus. -+ * Default implementation returns action->icon().name() when built on Qt -+ * >= 4.7 and a null string otherwise. -+ */ -+ virtual QString iconNameForAction(QAction *action); -+ -+private Q_SLOTS: -+ void doUpdateActions(); -+ void doEmitLayoutUpdated(); -+ void slotActionDestroyed(QObject*); -+ -+private: -+ Q_DISABLE_COPY(DBusMenuExporter) -+ DBusMenuExporterPrivate *const d; -+ -+ friend class DBusMenuExporterPrivate; -+ friend class DBusMenuExporterDBus; -+ friend class DBusMenu; -+}; -+ -+#endif /* DBUSMENUEXPORTER_H */ -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenuexporterdbus_p.cpp b/src/3rdparty/dbusmenu-qt/src/dbusmenuexporterdbus_p.cpp -new file mode 100644 -index 0000000..4d77ff5 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenuexporterdbus_p.cpp -@@ -0,0 +1,173 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2010 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#include "dbusmenuexporterdbus_p.h" -+ -+// Qt -+#include -+ -+// Local -+#include "dbusmenuadaptor_p.h" -+#include "dbusmenuexporterprivate_p.h" -+#include "dbusmenushortcut_p.h" -+#include "debug_p.h" -+ -+DBusMenuExporterDBus::DBusMenuExporterDBus(DBusMenuExporter *exporter) -+: QObject(exporter) -+, m_exporter(exporter) -+{ -+ qDBusRegisterMetaType(); -+ qDBusRegisterMetaType(); -+ qDBusRegisterMetaType(); -+ new DbusmenuAdaptor(this); -+} -+ -+ -+DBusMenuItemList DBusMenuExporterDBus::GetChildren(int parentId, const QStringList &names) -+{ -+ DBusMenuItemList list; -+ -+ QMenu *menu = m_exporter->d->menuForId(parentId); -+ if (!menu) { -+ return DBusMenuItemList(); -+ } -+ // Process pending actions, we need them *now* -+ QMetaObject::invokeMethod(m_exporter, "doUpdateActions"); -+ Q_FOREACH(QAction *action, menu->actions()) { -+ DBusMenuItem item; -+ item.id = m_exporter->d->idForAction(action); -+ item.properties = GetProperties(item.id, names); -+ list << item; -+ } -+ return list; -+} -+ -+uint DBusMenuExporterDBus::GetLayout(int parentId, QString &layout) -+{ -+ QMenu *menu = m_exporter->d->menuForId(parentId); -+ DMRETURN_VALUE_IF_FAIL(menu, 0); -+ -+ QXmlStreamWriter writer(&layout); -+ writer.setAutoFormatting(true); -+ writer.writeStartDocument(); -+ m_exporter->d->writeXmlForMenu(&writer, menu, parentId); -+ writer.writeEndDocument(); -+ -+ return m_exporter->d->m_revision; -+} -+ -+void DBusMenuExporterDBus::Event(int id, const QString &eventType, const QDBusVariant &/*data*/, uint /*timestamp*/) -+{ -+ if (eventType == "clicked") { -+ QAction *action = m_exporter->d->m_actionForId.value(id); -+ if (!action) { -+ return; -+ } -+ // dbusmenu-glib seems to ignore the Q_NOREPLY and blocks when calling -+ // Event(), so trigger the action asynchronously -+ QMetaObject::invokeMethod(action, "trigger", Qt::QueuedConnection); -+ } else if (eventType == "hovered") { -+ QMenu *menu = m_exporter->d->menuForId(id); -+ if (menu) { -+ QMetaObject::invokeMethod(menu, "aboutToShow"); -+ } -+ } -+} -+ -+QDBusVariant DBusMenuExporterDBus::GetProperty(int id, const QString &name) -+{ -+ QAction *action = m_exporter->d->m_actionForId.value(id); -+ DMRETURN_VALUE_IF_FAIL(action, QDBusVariant()); -+ return QDBusVariant(m_exporter->d->m_actionProperties.value(action).value(name)); -+} -+ -+QVariantMap DBusMenuExporterDBus::GetProperties(int id, const QStringList &names) -+{ -+ QAction *action = m_exporter->d->m_actionForId.value(id); -+ DMRETURN_VALUE_IF_FAIL(action, QVariantMap()); -+ QVariantMap all = m_exporter->d->m_actionProperties.value(action); -+ if (names.isEmpty()) { -+ return all; -+ } else { -+ QVariantMap map; -+ Q_FOREACH(const QString &name, names) { -+ QVariant value = all.value(name); -+ if (value.isValid()) { -+ map.insert(name, value); -+ } -+ } -+ return map; -+ } -+} -+ -+DBusMenuItemList DBusMenuExporterDBus::GetGroupProperties(const QList &ids, const QStringList &names) -+{ -+ DBusMenuItemList list; -+ Q_FOREACH(int id, ids) { -+ DBusMenuItem item; -+ item.id = id; -+ item.properties = GetProperties(item.id, names); -+ list << item; -+ } -+ return list; -+} -+ -+/** -+ * An helper class for ::AboutToShow, which sets mChanged to true if a menu -+ * changes after its aboutToShow() signal has been emitted. -+ */ -+class ActionEventFilter: public QObject -+{ -+public: -+ ActionEventFilter() -+ : mChanged(false) -+ {} -+ -+ bool mChanged; -+protected: -+ bool eventFilter(QObject *object, QEvent *event) -+ { -+ switch (event->type()) { -+ case QEvent::ActionAdded: -+ case QEvent::ActionChanged: -+ case QEvent::ActionRemoved: -+ mChanged = true; -+ // We noticed a change, no need to filter anymore -+ object->removeEventFilter(this); -+ break; -+ default: -+ break; -+ } -+ return false; -+ } -+}; -+ -+bool DBusMenuExporterDBus::AboutToShow(int id) -+{ -+ QMenu *menu = m_exporter->d->menuForId(id); -+ DMRETURN_VALUE_IF_FAIL(menu, false); -+ -+ ActionEventFilter filter; -+ menu->installEventFilter(&filter); -+ QMetaObject::invokeMethod(menu, "aboutToShow"); -+ return filter.mChanged; -+} -+ -+ -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenuexporterdbus_p.h b/src/3rdparty/dbusmenu-qt/src/dbusmenuexporterdbus_p.h -new file mode 100644 -index 0000000..aff7c52 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenuexporterdbus_p.h -@@ -0,0 +1,69 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2010 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#ifndef DBUSMENUEXPORTERDBUS_P_H -+#define DBUSMENUEXPORTERDBUS_P_H -+ -+// Qt -+#include -+#include -+#include -+#include -+ -+// Local -+#include -+ -+class DBusMenuExporter; -+ -+/** -+ * Internal class implementing the DBus side of DBusMenuExporter -+ * This avoid exposing the implementation of the DBusMenu spec to the outside -+ * world. -+ */ -+class DBusMenuExporterDBus : public QObject -+{ -+ Q_OBJECT -+ Q_CLASSINFO("D-Bus Interface", "org.ayatana.dbusmenu") -+public: -+ DBusMenuExporterDBus(DBusMenuExporter *m_exporter); -+ -+public Q_SLOTS: -+ DBusMenuItemList GetChildren(int parentId, const QStringList &propertyNames); -+ Q_NOREPLY void Event(int id, const QString &eventId, const QDBusVariant &data, uint timestamp); -+ QDBusVariant GetProperty(int id, const QString &property); -+ QVariantMap GetProperties(int id, const QStringList &names); -+ uint GetLayout(int parentId, QString &layout); -+ DBusMenuItemList GetGroupProperties(const QList &ids, const QStringList &propertyNames); -+ bool AboutToShow(int id); -+ -+Q_SIGNALS: -+ void ItemUpdated(int); -+ void ItemPropertyUpdated(int, QString, QVariant); -+ void LayoutUpdated(uint revision, int parentId); -+ void ItemActivationRequested(int id, uint timeStamp); -+ -+private: -+ DBusMenuExporter *m_exporter; -+ -+ friend class DBusMenuExporter; -+ friend class DBusMenuExporterPrivate; -+}; -+ -+#endif /* DBUSMENUEXPORTERDBUS_P_H */ -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenuexporterprivate_p.h b/src/3rdparty/dbusmenu-qt/src/dbusmenuexporterprivate_p.h -new file mode 100644 -index 0000000..a44f1d0 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenuexporterprivate_p.h -@@ -0,0 +1,86 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2010 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#ifndef DBUSMENUEXPORTERPRIVATE_P_H -+#define DBUSMENUEXPORTERPRIVATE_P_H -+ -+// Qt -+#include -+#include -+#include -+#include -+ -+// Local -+#include "dbusmenuexporter_p.h" -+ -+class QMenu; -+class QXmlStreamWriter; -+ -+class DBusMenuExporterDBus; -+ -+class DBusMenuExporterPrivate -+{ -+public: -+ DBusMenuExporter *q; -+ -+ DBusMenuExporterDBus *m_dbusObject; -+ -+ QMenu *m_rootMenu; -+ QHash m_actionProperties; -+ QMap m_actionForId; -+ QMap m_idForAction; -+ int m_nextId; -+ uint m_revision; -+ -+ QSet m_itemUpdatedIds; -+ QTimer *m_itemUpdatedTimer; -+ -+ QSet m_layoutUpdatedIds; -+ QTimer *m_layoutUpdatedTimer; -+ -+ int idForAction(QAction *action) const; -+ void addMenu(QMenu *menu, int parentId); -+ QVariantMap propertiesForAction(QAction *action) const; -+ QVariantMap propertiesForKMenuTitleAction(QAction *action_) const; -+ QVariantMap propertiesForSeparatorAction(QAction *action) const; -+ QVariantMap propertiesForStandardAction(QAction *action) const; -+ QMenu *menuForId(int id) const; -+ void writeXmlForMenu(QXmlStreamWriter *writer, QMenu *menu, int id); -+ -+ void addAction(QAction *action, int parentId); -+ void updateAction(QAction *action); -+ void removeAction(QAction *action, int parentId); -+ /** -+ * Removes any reference from action in the exporter, but do not notify the -+ * change outside. This is useful when a submenu is destroyed because we do -+ * not receive QEvent::ActionRemoved events for its actions. -+ * IMPORTANT: action might have already been destroyed when this method is -+ * called, so don't dereference the pointer (it is a QObject to avoid being -+ * tempted to dereference) -+ */ -+ void removeActionInternal(QObject *action); -+ -+ void emitLayoutUpdated(int id); -+ -+ void insertIconProperty(QVariantMap* map, QAction *action) const; -+}; -+ -+ -+#endif /* DBUSMENUEXPORTERPRIVATE_P_H */ -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenuitem_p.cpp b/src/3rdparty/dbusmenu-qt/src/dbusmenuitem_p.cpp -new file mode 100644 -index 0000000..f3b9e95 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenuitem_p.cpp -@@ -0,0 +1,40 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2009 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#include "dbusmenuitem_p.h" -+ -+// Qt -+#include -+ -+QDBusArgument &operator<<(QDBusArgument &argument, const DBusMenuItem &item) -+{ -+ argument.beginStructure(); -+ argument << item.id << item.properties; -+ argument.endStructure(); -+ return argument; -+} -+ -+const QDBusArgument &operator>>(const QDBusArgument &argument, DBusMenuItem &item) -+{ -+ argument.beginStructure(); -+ argument >> item.id >> item.properties; -+ argument.endStructure(); -+ return argument; -+} -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenuitem_p.h b/src/3rdparty/dbusmenu-qt/src/dbusmenuitem_p.h -new file mode 100644 -index 0000000..9491815 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenuitem_p.h -@@ -0,0 +1,51 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2009 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#ifndef DBUSMENUITEM_H -+#define DBUSMENUITEM_H -+ -+// Qt -+#include -+#include -+ -+// Local -+#include -+ -+class QDBusArgument; -+ -+/** -+ * Internal struct used to communicate on DBus -+ */ -+struct DBUSMENU_EXPORT DBusMenuItem -+{ -+ int id; -+ QVariantMap properties; -+}; -+ -+Q_DECLARE_METATYPE(DBusMenuItem) -+ -+DBUSMENU_EXPORT QDBusArgument &operator<<(QDBusArgument &argument, const DBusMenuItem &item); -+DBUSMENU_EXPORT const QDBusArgument &operator>>(const QDBusArgument &argument, DBusMenuItem &item); -+ -+typedef QList DBusMenuItemList; -+ -+Q_DECLARE_METATYPE(DBusMenuItemList) -+ -+#endif /* DBUSMENUITEM_H */ -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenushortcut_p.cpp b/src/3rdparty/dbusmenu-qt/src/dbusmenushortcut_p.cpp -new file mode 100644 -index 0000000..6b8da4a ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenushortcut_p.cpp -@@ -0,0 +1,81 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2009 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#include "dbusmenushortcut_p.h" -+ -+// Qt -+#include -+ -+// Local -+#include "debug_p.h" -+ -+static const int QT_COLUMN = 0; -+static const int DM_COLUMN = 1; -+ -+#ifdef _MSC_VER -+// dummy implementation to make MSVC happy (due to QList::toSet()) -+uint qHash( const QStringList& key ) { return 0; } -+#endif -+ -+static void processKeyTokens(QStringList* tokens, int srcCol, int dstCol) -+{ -+ struct Row { -+ const char* zero; -+ const char* one; -+ const char* operator[](int col) const { return col == 0 ? zero : one; } -+ }; -+ static const Row table[] = -+ { {"Meta", "Super"}, -+ {"Ctrl", "Control"}, -+ {0, 0} -+ }; -+ -+ const Row* ptr = table; -+ for (; ptr->zero != 0; ++ptr) { -+ const char* from = (*ptr)[srcCol]; -+ const char* to = (*ptr)[dstCol]; -+ tokens->replaceInStrings(from, to); -+ } -+} -+ -+DBusMenuShortcut DBusMenuShortcut::fromKeySequence(const QKeySequence& sequence) -+{ -+ QString string = sequence.toString(); -+ DBusMenuShortcut shortcut; -+ QStringList tokens = string.split(", "); -+ Q_FOREACH(const QString& token, tokens) { -+ QStringList keyTokens = token.split('+'); -+ processKeyTokens(&keyTokens, QT_COLUMN, DM_COLUMN); -+ shortcut << keyTokens; -+ } -+ return shortcut; -+} -+ -+QKeySequence DBusMenuShortcut::toKeySequence() const -+{ -+ QStringList tmp; -+ Q_FOREACH(const QStringList& keyTokens_, *this) { -+ QStringList keyTokens = keyTokens_; -+ processKeyTokens(&keyTokens, DM_COLUMN, QT_COLUMN); -+ tmp << keyTokens.join(QLatin1String("+")); -+ } -+ QString string = tmp.join(QLatin1String(", ")); -+ return QKeySequence::fromString(string); -+} -diff --git a/src/3rdparty/dbusmenu-qt/src/dbusmenushortcut_p.h b/src/3rdparty/dbusmenu-qt/src/dbusmenushortcut_p.h -new file mode 100644 -index 0000000..b7441b9 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/dbusmenushortcut_p.h -@@ -0,0 +1,47 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2009 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#ifndef DBUSMENUSHORTCUT_H -+#define DBUSMENUSHORTCUT_H -+ -+// Qt -+#include -+#include -+ -+// Local -+#include -+ -+ -+class QKeySequence; -+ -+class DBUSMENU_EXPORT DBusMenuShortcut : public QList -+{ -+public: -+ QKeySequence toKeySequence() const; -+ static DBusMenuShortcut fromKeySequence(const QKeySequence&); -+}; -+ -+#ifdef _MSC_VER -+uint qHash( const QStringList& key ); -+#endif -+ -+Q_DECLARE_METATYPE(DBusMenuShortcut) -+ -+#endif /* DBUSMENUSHORTCUT_H */ -diff --git a/src/3rdparty/dbusmenu-qt/src/debug_p.h b/src/3rdparty/dbusmenu-qt/src/debug_p.h -new file mode 100644 -index 0000000..bff37bd ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/debug_p.h -@@ -0,0 +1,48 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2009 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#ifndef DEBUG_P_H -+#define DEBUG_P_H -+ -+#include -+ -+#define _DMBLUE "\033[34m" -+#define _DMRED "\033[31m" -+#define _DMRESET "\033[0m" -+#define _DMTRACE(level, color) (level().nospace() << color << __PRETTY_FUNCTION__ << _DMRESET ":").space() -+ -+// Simple macros to get KDebug like support -+#define DMDEBUG _DMTRACE(qDebug, _DMBLUE) -+#define DMWARNING _DMTRACE(qWarning, _DMRED) -+ -+// Log a variable name and value -+#define DMVAR(var) DMDEBUG << #var ":" << var -+ -+#define DMRETURN_IF_FAIL(cond) if (!(cond)) { \ -+ DMWARNING << "Condition failed: " #cond; \ -+ return; \ -+} -+ -+#define DMRETURN_VALUE_IF_FAIL(cond, value) if (!(cond)) { \ -+ DMWARNING << "Condition failed: " #cond; \ -+ return (value); \ -+} -+ -+#endif /* DEBUG_P_H */ -diff --git a/src/3rdparty/dbusmenu-qt/src/org.ayatana.dbusmenu.xml b/src/3rdparty/dbusmenu-qt/src/org.ayatana.dbusmenu.xml -new file mode 100644 -index 0000000..7dba7cf ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/org.ayatana.dbusmenu.xml -@@ -0,0 +1,333 @@ -+ -+ -+ -+ -+ -+ -+ Name -+ Type -+ Description -+ Default Value -+ -+ -+ type -+ String -+ Can be one of: -+ - "standard": an item which can be clicked to trigger an action or -+ show another menu -+ - "separator": a separator -+ -+ Vendor specific types can be added by prefixing them with -+ "x--". -+ -+ "standard" -+ -+ -+ label -+ string -+ Text of the item, except that: -+ -# two consecutive underscore characters "__" are displayed as a -+ single underscore, -+ -# any remaining underscore characters are not displayed at all, -+ -# the first of those remaining underscore characters (unless it is -+ the last character in the string) indicates that the following -+ character is the access key. -+ -+ "" -+ -+ -+ enabled -+ boolean -+ Whether the item can be activated or not. -+ true -+ -+ -+ icon-name -+ string -+ Icon name of the item, following the freedesktop.org icon spec. -+ "" -+ -+ -+ icon-data -+ binary -+ PNG data of the icon. -+ Empty -+ -+ -+ toggle-type -+ string -+ -+ If the item can be toggled, this property should be set to: -+ - "checkmark": Item is an independent togglable item -+ - "radio": Item is part of a group where only one item can be -+ toggled at a time -+ - "": Item cannot be toggled -+ -+ "" -+ -+ -+ toggle-state -+ int -+ -+ Describe the current state of a "togglable" item. Can be one of: -+ - 0 = off -+ - 1 = on -+ - anything else = indeterminate -+ -+ Note: -+ The implementation does not itself handle ensuring that only one -+ item in a radio group is set to "on", or that a group does not have -+ "on" and "indeterminate" items simultaneously; maintaining this -+ policy is up to the toolkit wrappers. -+ -+ 0 -+ -+ -+ children-display -+ string -+ -+ If the menu item has children this property should be set to -+ "submenu". -+ -+ "" -+ -+ -+ -+ Vendor specific properties can be added by prefixing them with -+ "x--". -+ ]]> -+ -+ -+ -+ -+ Provides the version of the DBusmenu API that this API is -+ implementing. -+ -+ -+ -+ -+ -+ -+ # Root container -+ # First level menu, for example "File" -+ ~ Second level menu, for example "Open" -+ -+ ... -+ -+ # Another first level menu, say "Edit" -+ ... -+ -+ ... -+ -+ @endverbatim -+ ]]> -+ -+ The ID of the parent node for the layout. For -+ grabbing the layout from the root node use zero. -+ -+ -+ The revision number of the layout. For matching -+ with layoutUpdated signals. -+ -+ -+ The layout as an XML string of IDs. -+ -+ -+ -+ -+ -+ -+ -+ Returns the list of items which are children of @a parentId. -+ -+ -+ -+ A list of ids that we should be finding the properties -+ on. If the list is empty, all menu items should be sent. -+ -+ -+ -+ -+ The list of item properties we are -+ interested in. If there are no entries in the list all of -+ the properties will be sent. -+ -+ -+ -+ -+ An array of property values. -+ An item in this area is represented as a struct following -+ this format: -+ @li id unsigned the item id -+ @li properties map(string => variant) the requested item properties -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ Returns multiple properties in one call. This is more efficient than -+ GetProperty. -+ -+ -+ -+ -+ The item whose properties we want to retrieve. -+ -+ -+ List of string name of the properties we want. If the list contains no entries, all properties are sent. -+ -+ -+ -+ -+ -+ -" -+ ]]> -+ -+ the id of the item which received the event -+ -+ -+ the type of event -+ -+ -+ event-specific data -+ -+ -+ The time that the event occured if available or the time the message was sent if not -+ -+ -+ -+ -+ This is called by the applet to notify the application it is -+ about to show the menu whose parent is @p id. The application -+ should return True if the menu needs to be refreshed, False if it -+ does not. -+ -+ the id of the parent item of the menu -+ -+ -+ True if the menu has just been updated and should be -+ refreshed -+ -+ -+ -+ -+ -+ -+ Triggered by the application to notify the applet that the property @a property -+ from item @a id has changed to @a value. -+ -+ -+ -+ -+ -+ -+ -+ -+ Triggered by the application to notify the applet that all properties of item -+ -+ -+ id which should be considered outdated -+ -+ -+ -+ -+ -+ Triggered by the application to notify display of a layout update, up to -+ revision -+ -+ -+ The revision of the layout that we're currently on -+ -+ -+ -+ If the layout update is only of a subtree, this is the -+ parent item for the entries that have changed. It is zero if -+ the whole layout should be considered invalid. -+ -+ -+ -+ -+ -+ The server is requesting that all clients displaying this -+ menu open it to the user. This would be for things like -+ hotkeys that when the user presses them the menu should -+ open and display itself to the user. -+ -+ -+ ID of the menu that should be activated -+ -+ -+ The time that the event occured -+ -+ -+ -+ -+ -+ -+ -diff --git a/src/3rdparty/dbusmenu-qt/src/utils.cpp b/src/3rdparty/dbusmenu-qt/src/utils.cpp -new file mode 100644 -index 0000000..e0fa004 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/utils.cpp -@@ -0,0 +1,64 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2010 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#include "utils_p.h" -+ -+// Qt -+#include -+ -+QString swapMnemonicChar(const QString &in, const char src, const char dst) -+{ -+ QString out; -+ bool mnemonicFound = false; -+ -+ for (int pos = 0; pos < in.length(); ) { -+ QChar ch = in[pos]; -+ if (ch == src) { -+ if (pos == in.length() - 1) { -+ // 'src' at the end of string, skip it -+ ++pos; -+ } else { -+ if (in[pos + 1] == src) { -+ // A real 'src' -+ out += src; -+ pos += 2; -+ } else if (!mnemonicFound) { -+ // We found the mnemonic -+ mnemonicFound = true; -+ out += dst; -+ ++pos; -+ } else { -+ // We already have a mnemonic, just skip the char -+ ++pos; -+ } -+ } -+ } else if (ch == dst) { -+ // Escape 'dst' -+ out += dst; -+ out += dst; -+ ++pos; -+ } else { -+ out += ch; -+ ++pos; -+ } -+ } -+ -+ return out; -+} -diff --git a/src/3rdparty/dbusmenu-qt/src/utils_p.h b/src/3rdparty/dbusmenu-qt/src/utils_p.h -new file mode 100644 -index 0000000..3f6e888 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/src/utils_p.h -@@ -0,0 +1,31 @@ -+/* This file is part of the dbusmenu-qt library -+ Copyright 2010 Canonical -+ Author: Aurelien Gateau -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+#ifndef UTILS_P_H -+#define UTILS_P_H -+ -+class QString; -+ -+/** -+ * Swap mnemonic char: Qt uses '&', while dbusmenu uses '_' -+ */ -+QString swapMnemonicChar(const QString &in, const char src, const char dst); -+ -+#endif /* UTILS_P_H */ -diff --git a/src/3rdparty/dbusmenu-qt/update.sh b/src/3rdparty/dbusmenu-qt/update.sh -new file mode 100755 -index 0000000..bf6c3f1 ---- /dev/null -+++ b/src/3rdparty/dbusmenu-qt/update.sh -@@ -0,0 +1,85 @@ -+#!/bin/sh -+set -e -+ -+GENERATED_COMMENT="This file has been generated by 3rdparty/dbusmenu-qt/update.sh" -+ -+srcdir=$1 -+cd $srcdir -+srcdir=$PWD -+cd - -+ -+dstdir=$2 -+cd $dstdir -+cp $srcdir/*.h . -+cp $srcdir/*.cpp . -+cp $srcdir/*.xml . -+rm dbusmenuimporter* -+ -+cat > dbusmenu_export.h < -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+// $GENERATED_COMMENT -+// We do not want Qt to export dbusmenu -+#ifndef DBUSMENU_EXPORT_H -+#define DBUSMENU_EXPORT_H -+ -+#define DBUSMENU_EXPORT -+ -+#endif -+EOF -+ -+cat > dbusmenu_config.h < -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License (LGPL) as published by the Free Software Foundation; -+ either version 2 of the License, or (at your option) any later -+ version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+// $GENERATED_COMMENT -+#ifndef DBUSMENU_CONFIG_H -+#define DBUSMENU_CONFIG_H -+ -+#define HAVE_QICON_NAME -+ -+#endif -+EOF -+ -+qdbusxml2cpp -m -a dbusmenuadaptor -i dbusmenuexporterdbus_p.h -l DBusMenuExporterDBus org.ayatana.dbusmenu.xml -+ -+for file in dbusmenuexporter dbusmenuadaptor ; do -+ msrp $file.h ${file}_p.h . -+done -+ -+sed -i '/#include .*\.moc/d' *.cpp -diff --git a/src/gui/gui.pro b/src/gui/gui.pro -index 13d2c77..0cb9c7e 100644 ---- a/src/gui/gui.pro -+++ b/src/gui/gui.pro -@@ -40,6 +40,7 @@ include(util/util.pri) - include(statemachine/statemachine.pri) - include(math3d/math3d.pri) - include(effects/effects.pri) -+x11:include(../3rdparty/dbusmenu-qt/dbusmenu-qt.pri) - - include(egl/egl.pri) - win32:!wince*: DEFINES += QT_NO_EGL -diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h -index 33283fd..9ef61b5 100644 ---- a/src/gui/widgets/qmenu_p.h -+++ b/src/gui/widgets/qmenu_p.h -@@ -154,6 +154,9 @@ public: - #endif - scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0), - hasCheckableItems(0), sloppyAction(0), doChildEffects(false) -+#ifdef QT3_SUPPORT -+ ,emitHighlighted(false) -+#endif - #ifdef Q_WS_MAC - ,mac_menu(0) - #endif -@@ -163,9 +166,6 @@ public: - #ifdef Q_WS_S60 - ,symbian_menu(0) - #endif --#ifdef QT3_SUPPORT -- ,emitHighlighted(false) --#endif - { } - ~QMenuPrivate() - { -diff --git a/src/gui/widgets/qmenu_x11.cpp b/src/gui/widgets/qmenu_x11.cpp -new file mode 100644 -index 0000000..b163ef9 ---- /dev/null -+++ b/src/gui/widgets/qmenu_x11.cpp -@@ -0,0 +1,216 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -+** All rights reserved. -+** Contact: Nokia Corporation (qt-info@nokia.com) -+** -+** This file is part of the QtGui module of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL$ -+** No Commercial Usage -+** This file contains pre-release code and may not be distributed. -+** You may use this file in accordance with the terms and conditions -+** contained in the Technology Preview License Agreement accompanying -+** this package. -+** -+** GNU Lesser General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU Lesser -+** General Public License version 2.1 as published by the Free Software -+** Foundation and appearing in the file LICENSE.LGPL included in the -+** packaging of this file. Please review the following information to -+** ensure the GNU Lesser General Public License version 2.1 requirements -+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -+** -+** In addition, as a special exception, Nokia gives you certain additional -+** rights. These rights are described in the Nokia Qt LGPL Exception -+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -+** -+** If you have questions regarding the use of this file, please contact -+** Nokia at qt-info@nokia.com. -+** -+** -+** -+** -+** -+** -+** -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+#include "qmenu.h" -+#include "qapplication.h" -+#include "qboxlayout.h" -+#include "qdebug.h" -+#include "qmainwindow.h" -+#include "qtoolbar.h" -+#include "qwidgetaction.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "dbusmenuexporter_p.h" -+ -+#ifndef QT_NO_MENUBAR -+ -+QT_BEGIN_NAMESPACE -+ -+void QMenuBarPrivate::x11CreateMenuBar(QMenuBar *menuBar) -+{ -+ static bool firstCall = true; -+ static bool envSaysNo = !qgetenv("QT_X11_NO_NATIVE_MENUBAR").isEmpty(); -+ static bool envSaysBoth = qgetenv("APPMENU_DISPLAY_BOTH") == "1"; -+ -+ if (!menuBar->parentWidget()) -+ return; -+ -+ x11_menubar = 0; -+ -+ if (!firstCall && !envSaysBoth && QApplication::testAttribute(Qt::AA_DontUseNativeMenuBar)) -+ return; -+ -+ if (envSaysNo) { -+ if (firstCall) { -+ firstCall = false; -+ QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); -+ } -+ return; -+ } -+ -+ x11_menubar = new QX11MenuBarPrivate(menuBar, x11_objectPath); -+ if (!x11_menubar->registerWindow()) -+ x11DestroyMenuBar(); -+ -+ if (firstCall) { -+ firstCall = false; -+ bool dontUseNativeMenuBar = !x11_menubar; -+ if (envSaysBoth) { -+ // Make the rest of Qt think we do not use the native menubar, so -+ // that space for the menubar widget is correctly allocated -+ dontUseNativeMenuBar = true; -+ } -+ QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, dontUseNativeMenuBar); -+ } -+} -+ -+void QMenuBarPrivate::x11DestroyMenuBar() -+{ -+ delete x11_menubar; -+ x11_menubar = 0; -+} -+ -+QMenuBarPrivate::QX11MenuBarPrivate::QX11MenuBarPrivate(QMenuBar *_menuBar, const QString &_objectPath) -+: exporter(0) -+, rootMenu(new QMenu) -+, menuBar(_menuBar) -+, cornerWidgetToolBar(0) -+, cornerWidgetContainer(0) -+, objectPath(_objectPath) -+, registeredWinId(0) -+{ -+} -+ -+bool QMenuBarPrivate::QX11MenuBarPrivate::registerWindow() -+{ -+ if (!menuBar->window()) { -+ qWarning() << __FUNCTION__ << "No parent for this menubar"; -+ return false; -+ } -+ -+ uint winId = menuBar->window()->winId(); -+ if (winId == registeredWinId) { -+ return true; -+ } -+ -+ QDBusInterface host(QLatin1String("org.ayatana.AppMenu.Registrar"), QLatin1String("/org/ayatana/AppMenu/Registrar"), QLatin1String("org.ayatana.AppMenu.Registrar")); -+ if (!host.isValid()) { -+ return false; -+ } -+ -+ Q_FOREACH(QAction *action, menuBar->actions()) { -+ if (!action->isSeparator()) { -+ rootMenu->addAction(action); -+ } -+ } -+ -+ if (rootMenu->actions().isEmpty()) { -+ return true; -+ } -+ -+ if (!exporter) { -+ exporter = new DBusMenuExporter(objectPath, rootMenu); -+ } -+ -+ registeredWinId = winId; -+ QVariant path = QVariant::fromValue(QDBusObjectPath(objectPath)); -+ host.asyncCall(QLatin1String("RegisterWindow"), QVariant(winId), path); -+ return true; -+} -+ -+QMenuBarPrivate::QX11MenuBarPrivate::~QX11MenuBarPrivate() -+{ -+ delete cornerWidgetToolBar; -+ cornerWidgetToolBar = 0; -+ delete exporter; -+ exporter = 0; -+ delete rootMenu; -+ rootMenu = 0; -+} -+ -+void QMenuBarPrivate::QX11MenuBarPrivate::addAction(QAction *action, QAction *before) -+{ -+ if (!action->isSeparator()) { -+ rootMenu->insertAction(before, action); -+ } -+ if (!registeredWinId) { -+ registerWindow(); -+ } -+} -+ -+void QMenuBarPrivate::QX11MenuBarPrivate::removeAction(QAction *action) -+{ -+ rootMenu->removeAction(action); -+} -+ -+void QMenuBarPrivate::QX11MenuBarPrivate::popupAction(QAction *action) -+{ -+ exporter->activateAction(action); -+} -+ -+void QMenuBarPrivate::QX11MenuBarPrivate::updateCornerWidgetToolBar() -+{ -+ if (!cornerWidgetToolBar) { -+ QMainWindow *window = qobject_cast(menuBar->window()); -+ if (!window) { -+ qWarning() << "Menubar parent is not a QMainWindow, not showing corner widgets"; -+ return; -+ } -+ cornerWidgetToolBar = window->addToolBar(QApplication::translate("QMenuBar", "Corner Toolbar")); -+ cornerWidgetToolBar->setObjectName(QLatin1String("CornerToolBar")); -+ cornerWidgetContainer = new QWidget; -+ cornerWidgetToolBar->addWidget(cornerWidgetContainer); -+ new QHBoxLayout(cornerWidgetContainer); -+ } else { -+ QLayout *layout = cornerWidgetContainer->layout(); -+ while (layout->count() > 0) { -+ layout->takeAt(0); -+ } -+ } -+ QWidget *left = menuBar->cornerWidget(Qt::TopLeftCorner); -+ QWidget *right = menuBar->cornerWidget(Qt::TopRightCorner); -+ if (left) { -+ left->setParent(cornerWidgetContainer); -+ cornerWidgetContainer->layout()->addWidget(left); -+ } -+ if (right) { -+ right->setParent(cornerWidgetContainer); -+ cornerWidgetContainer->layout()->addWidget(right); -+ } -+} -+ -+QT_END_NAMESPACE -+ -+#endif //QT_NO_MENUBAR -diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp -index df16f7f..626d555 100644 ---- a/src/gui/widgets/qmenubar.cpp -+++ b/src/gui/widgets/qmenubar.cpp -@@ -67,6 +67,11 @@ - #include "qmenubar_p.h" - #include "qdebug.h" - -+#ifdef Q_WS_X11 -+#include -+#include -+#endif -+ - #ifdef Q_WS_WINCE - extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp - #endif -@@ -173,6 +178,10 @@ void QMenuBarPrivate::updateGeometries() - return; - int q_width = q->width()-(q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q)*2); - int q_start = -1; -+ -+#ifdef Q_WS_X11 -+ if(!q->isNativeMenuBar()) { -+#endif - if(leftWidget || rightWidget) { - int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q) - + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q); -@@ -194,6 +203,9 @@ void QMenuBarPrivate::updateGeometries() - rightWidget->setGeometry(vRect); - } - } -+#ifdef Q_WS_X11 -+ } -+#endif - - #ifdef Q_WS_MAC - if(q->isNativeMenuBar()) {//nothing to see here folks, move along.. -@@ -201,8 +213,6 @@ void QMenuBarPrivate::updateGeometries() - return; - } - #endif -- calcActionRects(q_width, q_start); -- currentAction = 0; - #ifndef QT_NO_SHORTCUT - if(itemsDirty) { - for(int j = 0; j < shortcutIndexMap.size(); ++j) -@@ -212,6 +222,16 @@ void QMenuBarPrivate::updateGeometries() - shortcutIndexMap.append(q->grabShortcut(QKeySequence::mnemonic(actions.at(i)->text()))); - } - #endif -+#ifdef Q_WS_X11 -+ // For X11 we only check for nativeMenuBar here because we want -+ // shortcutIndexMap to be updated. -+ if(q->isNativeMenuBar()) {//nothing to see here folks, move along.. -+ itemsDirty = false; -+ return; -+ } -+#endif -+ calcActionRects(q_width, q_start); -+ currentAction = 0; - itemsDirty = false; - - hiddenActions.clear(); -@@ -743,6 +763,22 @@ void QMenuBarPrivate::init() - QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); - } - #endif -+#ifdef Q_WS_X11 -+ static int menuBarId = 1; -+ x11_objectPath = QString(QLatin1String("/MenuBar/%1")).arg(menuBarId++); -+ // FIXME: Service name is duplicated in qmenu_x11.cpp -+ x11_menuBarServiceWatcher = new QDBusServiceWatcher( -+ QLatin1String("org.ayatana.AppMenu.Registrar"), -+ QDBusConnection::sessionBus(), -+ QDBusServiceWatcher::WatchForOwnerChange, -+ q); -+ // x11_menubar will be created in handleReparent() -+ x11_menubar = 0; -+ -+ QObject::connect(x11_menuBarServiceWatcher, SIGNAL(serviceOwnerChanged(const QString &, const QString &, const QString &)), -+ q, SLOT(_q_x11_menuBarServiceChanged(const QString &, const QString &, const QString &))); -+#endif -+ - q->setBackgroundRole(QPalette::Button); - oldWindow = oldParent = 0; - #ifdef QT3_SUPPORT -@@ -821,6 +857,10 @@ QMenuBar::~QMenuBar() - Q_D(QMenuBar); - d->symbianDestroyMenuBar(); - #endif -+#ifdef Q_WS_X11 -+ Q_D(QMenuBar); -+ d->x11DestroyMenuBar(); -+#endif - } - - /*! -@@ -1072,6 +1112,9 @@ void QMenuBar::paintEvent(QPaintEvent *e) - */ - void QMenuBar::setVisible(bool visible) - { -+ // For Q_WS_X11 we do not want to disable this method even when using a -+ // native menubar because the bar needs to be visible, otherwise shortcuts -+ // for items which are not present in any toolbar do not work. - #if defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60) - if (isNativeMenuBar()) - return; -@@ -1272,17 +1315,17 @@ void QMenuBar::actionEvent(QActionEvent *e) - { - Q_D(QMenuBar); - d->itemsDirty = true; --#if defined (Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60) -- if (isNativeMenuBar()) { -+#if defined (Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) - #ifdef Q_WS_MAC - QMenuBarPrivate::QMacMenuBarPrivate *nativeMenuBar = d->mac_menubar; - #elif defined(Q_WS_S60) - QMenuBarPrivate::QSymbianMenuBarPrivate *nativeMenuBar = d->symbian_menubar; --#else -+#elif defined(Q_OS_WINCE) - QMenuBarPrivate::QWceMenuBarPrivate *nativeMenuBar = d->wce_menubar; -+#else -+ QMenuBarPrivate::QX11MenuBarPrivate *nativeMenuBar = d->x11_menubar; - #endif -- if (!nativeMenuBar) -- return; -+ if (nativeMenuBar) { - if(e->type() == QEvent::ActionAdded) - nativeMenuBar->addAction(e->action(), nativeMenuBar->findAction(e->before())); - else if(e->type() == QEvent::ActionRemoved) -@@ -1366,9 +1409,6 @@ void QMenuBarPrivate::handleReparent() - newWindow->installEventFilter(q); - } - -- oldParent = newParent; -- oldWindow = newWindow; -- - #ifdef Q_WS_MAC - if (q->isNativeMenuBar() && !macWidgetHasNativeMenubar(newParent)) { - // If the new parent got a native menubar from before, keep that -@@ -1378,6 +1418,17 @@ void QMenuBarPrivate::handleReparent() - macCreateMenuBar(newParent); - } - #endif -+#ifdef Q_WS_X11 -+ if (q->isNativeMenuBar()) { -+ if (x11_menubar) { -+ if (oldWindow != newWindow) { -+ x11_menubar->registerWindow(); -+ } -+ } else { -+ x11CreateMenuBar(q); -+ } -+ } -+#endif - - #ifdef Q_WS_WINCE - if (qt_wince_is_mobile() && wce_menubar) -@@ -1415,6 +1466,9 @@ void QMenuBarPrivate::handleReparent() - } - #endif // QT_SOFTKEYS_ENABLED - #endif // Q_WS_S60 -+ -+ oldParent = newParent; -+ oldWindow = newWindow; - } - - #ifdef QT3_SUPPORT -@@ -1563,6 +1617,11 @@ bool QMenuBar::event(QEvent *e) - bool QMenuBar::eventFilter(QObject *object, QEvent *event) - { - Q_D(QMenuBar); -+ if (event->type() == QEvent::WinIdChange) { -+ if (isNativeMenuBar() && d->x11_menubar) { -+ QMetaObject::invokeMethod(this, "_q_x11_registerWindow", Qt::QueuedConnection); -+ } -+ } - if (object == parent() && object) { - #ifdef QT3_SUPPORT - if (d->doAutoResize && event->type() == QEvent::Resize) { -@@ -1656,7 +1715,7 @@ QRect QMenuBar::actionGeometry(QAction *act) const - QSize QMenuBar::minimumSizeHint() const - { - Q_D(const QMenuBar); --#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) -+#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) - const bool as_gui_menubar = !isNativeMenuBar(); - #else - const bool as_gui_menubar = true; -@@ -1679,6 +1738,9 @@ QSize QMenuBar::minimumSizeHint() const - ret += QSize(2*fw + hmargin, 2*fw + vmargin); - } - int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; -+#ifdef Q_WS_X11 -+ if (as_gui_menubar) { -+#endif - if(d->leftWidget) { - QSize sz = d->leftWidget->minimumSizeHint(); - ret.setWidth(ret.width() + sz.width()); -@@ -1691,6 +1753,9 @@ QSize QMenuBar::minimumSizeHint() const - if(sz.height() + margin > ret.height()) - ret.setHeight(sz.height() + margin); - } -+#ifdef Q_WS_X11 -+ } -+#endif - if(as_gui_menubar) { - QStyleOptionMenuItem opt; - opt.rect = rect(); -@@ -1712,7 +1777,7 @@ QSize QMenuBar::minimumSizeHint() const - QSize QMenuBar::sizeHint() const - { - Q_D(const QMenuBar); --#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) -+#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) - const bool as_gui_menubar = !isNativeMenuBar(); - #else - const bool as_gui_menubar = true; -@@ -1738,6 +1803,9 @@ QSize QMenuBar::sizeHint() const - ret += QSize(fw + hmargin, fw + vmargin); - } - int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; -+#ifdef Q_WS_X11 -+ if(as_gui_menubar) { -+#endif - if(d->leftWidget) { - QSize sz = d->leftWidget->sizeHint(); - ret.setWidth(ret.width() + sz.width()); -@@ -1750,6 +1818,9 @@ QSize QMenuBar::sizeHint() const - if(sz.height() + margin > ret.height()) - ret.setHeight(sz.height() + margin); - } -+#ifdef Q_WS_X11 -+ } -+#endif - if(as_gui_menubar) { - QStyleOptionMenuItem opt; - opt.rect = rect(); -@@ -1771,7 +1842,7 @@ QSize QMenuBar::sizeHint() const - int QMenuBar::heightForWidth(int) const - { - Q_D(const QMenuBar); --#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) -+#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) - const bool as_gui_menubar = !isNativeMenuBar(); - #else - const bool as_gui_menubar = true; -@@ -1791,10 +1862,16 @@ int QMenuBar::heightForWidth(int) const - height += 2*vmargin; - } - int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; -+#ifdef Q_WS_X11 -+ if (as_gui_menubar) { -+#endif - if(d->leftWidget) - height = qMax(d->leftWidget->sizeHint().height() + margin, height); - if(d->rightWidget) - height = qMax(d->rightWidget->sizeHint().height() + margin, height); -+#ifdef Q_WS_X11 -+ } -+#endif - if(as_gui_menubar) { - QStyleOptionMenuItem opt; - opt.init(this); -@@ -1814,7 +1891,15 @@ void QMenuBarPrivate::_q_internalShortcutActivated(int id) - { - Q_Q(QMenuBar); - QAction *act = actions.at(id); -- setCurrentAction(act, true, true); -+#ifdef Q_WS_X11 -+ if (act && act->menu() && q->isNativeMenuBar()) { -+ x11_menubar->popupAction(act); -+ } else { -+#endif -+ setCurrentAction(act, true, true); -+#ifdef Q_WS_X11 -+ } -+#endif - if (act && !act->menu()) { - activateAction(act, QAction::Trigger); - //100 is the same as the default value in QPushButton::animateClick -@@ -1860,10 +1945,18 @@ void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner) - return; - } - -- if (w) { -- w->setParent(this); -- w->installEventFilter(this); -+#ifdef Q_WS_X11 -+ if(isNativeMenuBar()) { -+ d->x11_menubar->updateCornerWidgetToolBar(); -+ } else { -+#endif -+ if (w) { -+ w->setParent(this); -+ w->installEventFilter(this); -+ } -+#ifdef Q_WS_X11 - } -+#endif - - d->_q_updateLayout(); - } -@@ -1935,6 +2028,11 @@ void QMenuBar::setNativeMenuBar(bool nativeMenuBar) - if (!d->nativeMenuBar && parentWidget()) - setVisible(true); - #endif -+#ifdef Q_WS_X11 -+ if (!d->nativeMenuBar) { -+ d->x11DestroyMenuBar(); -+ } -+#endif - } - } - -@@ -2000,6 +2098,34 @@ QAction *QMenuBar::defaultAction() const - } - #endif - -+#ifdef Q_WS_X11 -+void QMenuBarPrivate::_q_x11_menuBarServiceChanged(const QString &/*serviceName*/, const QString &/*oldOwner*/, const QString &newOwner) -+{ -+ Q_Q(QMenuBar); -+ if (newOwner.isEmpty()) { -+ x11DestroyMenuBar(); -+ // This is needed for the menu to come back, but then it will never be -+ // moved again to the menubar :/ -+ //QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); -+ q->updateGeometry(); -+ q->setVisible(false); -+ q->setVisible(true); -+ return; -+ } -+ if (x11_menubar) { -+ x11_menubar->registeredWinId = 0; -+ x11_menubar->registerWindow(); -+ } else -+ x11CreateMenuBar(q); -+} -+ -+void QMenuBarPrivate::_q_x11_registerWindow() -+{ -+ if (x11_menubar) -+ x11_menubar->registerWindow(); -+} -+#endif -+ - /*! - \fn void QMenuBar::triggered(QAction *action) - -diff --git a/src/gui/widgets/qmenubar.h b/src/gui/widgets/qmenubar.h -index c63a4f5..e07b3d8 100644 ---- a/src/gui/widgets/qmenubar.h -+++ b/src/gui/widgets/qmenubar.h -@@ -356,6 +356,11 @@ private: - friend class QWidgetPrivate; - friend bool qt_mac_activate_action(MenuRef, uint, QAction::ActionEvent, bool); - #endif -+ -+#ifdef Q_WS_X11 -+ Q_PRIVATE_SLOT(d_func(), void _q_x11_menuBarServiceChanged(const QString &, const QString &, const QString &)) -+ Q_PRIVATE_SLOT(d_func(), void _q_x11_registerWindow()) -+#endif - }; - - #endif // QT_NO_MENUBAR -diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h -index fc6701c..d6d0b27 100644 ---- a/src/gui/widgets/qmenubar_p.h -+++ b/src/gui/widgets/qmenubar_p.h -@@ -68,6 +68,12 @@ class CEikMenuBar; - #endif - #endif - -+#ifdef Q_WS_X11 -+class QDBusServiceWatcher; -+class QToolBar; -+class DBusMenuExporter; -+#endif -+ - QT_BEGIN_NAMESPACE - - #ifndef QT_NO_MENUBAR -@@ -92,6 +98,9 @@ public: - #ifdef Q_WS_S60 - , symbian_menubar(0) - #endif -+#ifdef Q_WS_X11 -+ , x11_menubar(0) -+#endif - - { } - ~QMenuBarPrivate() -@@ -105,6 +114,9 @@ public: - #ifdef Q_WS_S60 - delete symbian_menubar; - #endif -+#ifdef Q_WS_X11 -+ delete x11_menubar; -+#endif - } - - void init(); -@@ -150,6 +162,11 @@ public: - void _q_updateDefaultAction(); - #endif - -+#ifdef Q_WS_X11 -+ void _q_x11_menuBarServiceChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner); -+ void _q_x11_registerWindow(); -+#endif -+ - //extra widgets in the menubar - QPointer leftWidget, rightWidget; - QMenuBarExtension *extension; -@@ -273,6 +290,37 @@ public: - #ifdef QT_SOFTKEYS_ENABLED - QAction *menuBarAction; - #endif -+#ifdef Q_WS_X11 -+ void x11CreateMenuBar(QMenuBar *); -+ void x11DestroyMenuBar(); -+ struct QX11MenuBarPrivate { -+ QX11MenuBarPrivate(QMenuBar *, const QString &); -+ ~QX11MenuBarPrivate(); -+ void addAction(QAction *, QAction *before=0); -+ void removeAction(QAction *); -+ // Other ${PLATFORM}MenuBarPrivate structs have findAction() and -+ // syncAction(), so we need to provide them as well, even if they do -+ // nothing -+ void syncAction(QAction *) {} -+ QAction *findAction(QAction * action) { return action; } -+ -+ bool registerWindow(); -+ -+ void popupAction(QAction *); -+ -+ void updateCornerWidgetToolBar(); -+ -+ DBusMenuExporter *exporter; -+ QMenu *rootMenu; -+ QMenuBar *menuBar; -+ QToolBar *cornerWidgetToolBar; -+ QWidget *cornerWidgetContainer; -+ QString objectPath; -+ uint registeredWinId; -+ } *x11_menubar; -+ QDBusServiceWatcher *x11_menuBarServiceWatcher; -+ QString x11_objectPath; -+#endif - }; - #endif - -diff --git a/src/gui/widgets/widgets.pri b/src/gui/widgets/widgets.pri -index 937b8d6..91540ec 100644 ---- a/src/gui/widgets/widgets.pri -+++ b/src/gui/widgets/widgets.pri -@@ -167,3 +167,7 @@ wince*: { - symbian: { - SOURCES += widgets/qmenu_symbian.cpp - } -+ -+x11: { -+ SOURCES += widgets/qmenu_x11.cpp -+} -diff --git a/src/src.pro b/src/src.pro -index f856a0c..b1374c9 100644 ---- a/src/src.pro -+++ b/src/src.pro -@@ -89,7 +89,7 @@ src_webkit_declarative.target = sub-webkitdeclarative - #CONFIG += ordered - !wince*:!ordered:!symbian-abld:!symbian-sbsv2 { - src_corelib.depends = src_tools_moc src_tools_rcc -- src_gui.depends = src_corelib src_tools_uic -+ src_gui.depends = src_corelib src_tools_uic src_dbus - embedded: src_gui.depends += src_network - src_xml.depends = src_corelib - src_xmlpatterns.depends = src_corelib src_network diff --git a/qt/demosexamples-manual-install.patch b/qt/demosexamples-manual-install.patch deleted file mode 100644 index b91189452..000000000 --- a/qt/demosexamples-manual-install.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- Makefile.orig 2010-01-20 01:46:53.000000000 +0100 -+++ Makefile 2010-01-20 02:37:45.000000000 +0100 -@@ -908,9 +908,9 @@ sub-examples-distclean-ordered: examples - sub-examples-distclean: examples/$(MAKEFILE) FORCE - cd examples/ && $(MAKE) -f $(MAKEFILE) distclean - sub-examples-install_subtargets-ordered: examples/$(MAKEFILE) sub-translations-install_subtargets-ordered FORCE -- cd examples/ && $(MAKE) -f $(MAKEFILE) install -+ /bin/true - sub-examples-install_subtargets: examples/$(MAKEFILE) FORCE -- cd examples/ && $(MAKE) -f $(MAKEFILE) install -+ /bin/true - sub-examples-uninstall_subtargets-ordered: examples/$(MAKEFILE) sub-translations-uninstall_subtargets-ordered FORCE - cd examples/ && $(MAKE) -f $(MAKEFILE) uninstall - sub-examples-uninstall_subtargets: examples/$(MAKEFILE) FORCE -@@ -944,9 +944,9 @@ sub-demos-distclean-ordered: demos/$(MAK - sub-demos-distclean: demos/$(MAKEFILE) FORCE - cd demos/ && $(MAKE) -f $(MAKEFILE) distclean - sub-demos-install_subtargets-ordered: demos/$(MAKEFILE) sub-examples-install_subtargets-ordered FORCE -- cd demos/ && $(MAKE) -f $(MAKEFILE) install -+ /bin/true - sub-demos-install_subtargets: demos/$(MAKEFILE) FORCE -- cd demos/ && $(MAKE) -f $(MAKEFILE) install -+ /bin/true - sub-demos-uninstall_subtargets-ordered: demos/$(MAKEFILE) sub-examples-uninstall_subtargets-ordered FORCE - cd demos/ && $(MAKE) -f $(MAKEFILE) uninstall - sub-demos-uninstall_subtargets: demos/$(MAKEFILE) FORCE