├── .git-blame-ignore-revs ├── .gitignore ├── .gitlab-ci.yml ├── .kde-ci.yml ├── CMakeLists.txt ├── KF6FrameworkIntegrationConfig.cmake.in ├── LICENSES ├── CC0-1.0.txt ├── LGPL-2.0-only.txt ├── LGPL-2.0-or-later.txt ├── LGPL-3.0-only.txt └── LicenseRef-KDE-Accepted-LGPL.txt ├── README.md ├── autotests ├── CMakeLists.txt ├── kdeplatformtheme_config.h.in ├── kdeplatformtheme_kdeglobals └── kstyle_unittest.cpp ├── metainfo.yaml ├── plasma_workspace.notifyrc ├── src ├── CMakeLists.txt ├── integrationplugin │ ├── CMakeLists.txt │ ├── frameworkintegrationplugin.cpp │ └── frameworkintegrationplugin.h ├── kpackage-install-handlers │ ├── CMakeLists.txt │ ├── appstream │ │ ├── CMakeLists.txt │ │ └── main.cpp │ └── kns │ │ ├── CMakeLists.txt │ │ ├── knshandlerversion.h.in │ │ └── main.cpp └── kstyle │ ├── CMakeLists.txt │ ├── frameworkintegration-index.qdoc │ ├── kstyle-checklist.txt │ ├── kstyle.cpp │ ├── kstyle.h │ ├── kstyle.qdoc │ └── kstyle.qdocconf └── tests ├── CMakeLists.txt └── kstyletest.cpp /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | #clang-format 2 | 31ba7764665ccacb0a2da9c40fdc49083b5decd0 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore the following files 2 | *~ 3 | *.[oa] 4 | *.diff 5 | *.kate-swp 6 | *.kdev4 7 | .kdev_include_paths 8 | *.kdevelop.pcs 9 | *.moc 10 | *.moc.cpp 11 | *.orig 12 | *.user 13 | .*.swp 14 | .swp.* 15 | Doxyfile 16 | Makefile 17 | avail 18 | random_seed 19 | /build*/ 20 | CMakeLists.txt.user* 21 | *.unc-backup* 22 | .cmake/ 23 | /.clang-format 24 | /compile_commands.json 25 | .clangd 26 | .idea 27 | /cmake-build* 28 | .cache 29 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2020 Volker Krause 2 | # SPDX-License-Identifier: CC0-1.0 3 | 4 | include: 5 | - project: sysadmin/ci-utilities 6 | file: 7 | - /gitlab-templates/linux-qt6.yml 8 | - /gitlab-templates/linux-qt6-next.yml 9 | - /gitlab-templates/freebsd-qt6.yml 10 | - /gitlab-templates/xml-lint.yml 11 | - /gitlab-templates/yaml-lint.yml 12 | -------------------------------------------------------------------------------- /.kde-ci.yml: -------------------------------------------------------------------------------- 1 | Dependencies: 2 | - 'on': ['Linux', 'FreeBSD', 'Windows', 'macOS'] 3 | 'require': 4 | 'frameworks/extra-cmake-modules': '@same' 5 | 'frameworks/ki18n': '@same' 6 | 'frameworks/kguiaddons': '@same' 7 | 'frameworks/kwidgetsaddons': '@same' 8 | 'frameworks/kconfigwidgets': '@same' 9 | 'frameworks/kitemviews': '@same' 10 | 'frameworks/kconfig': '@same' 11 | 'frameworks/kcolorscheme': '@same' 12 | 'frameworks/kiconthemes': '@same' 13 | 'frameworks/knotifications': '@same' 14 | 'frameworks/kio': '@same' 15 | 'frameworks/oxygen-icons': '@same' 16 | 'frameworks/kpackage': '@same' 17 | 'frameworks/knewstuff': '@same' 18 | 'third-party/appstream': '@latest' 19 | 20 | Options: 21 | test-before-installing: True 22 | require-passing-tests-on: ['Linux', 'FreeBSD'] 23 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | 3 | set(KF_VERSION "6.16.0") # handled by release scripts 4 | set(KF_DEP_VERSION "6.15.0") # handled by release scripts 5 | project(FrameworkIntegration VERSION ${KF_VERSION}) 6 | 7 | include(FeatureSummary) 8 | find_package(ECM 6.15.0 NO_MODULE) 9 | set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") 10 | feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) 11 | 12 | 13 | set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) 14 | 15 | 16 | include(ECMGenerateExportHeader) 17 | include(CMakePackageConfigHelpers) 18 | include(ECMSetupVersion) 19 | include(ECMGenerateHeaders) 20 | 21 | include(KDEInstallDirs) 22 | include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) 23 | include(KDECMakeSettings) 24 | include(KDEGitCommitHooks) 25 | include(ECMDeprecationSettings) 26 | include(ECMGenerateQDoc) 27 | 28 | set(REQUIRED_QT_VERSION 6.7.0) 29 | find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Gui Widgets) 30 | 31 | 32 | ecm_setup_version(PROJECT VARIABLE_PREFIX FRAMEWORKINTEGRATION 33 | VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/frameworkintegration_version.h" 34 | PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF6FrameworkIntegrationConfigVersion.cmake" 35 | SOVERSION 6) 36 | 37 | find_package(KF6Config ${KF_DEP_VERSION} REQUIRED) 38 | find_package(KF6ColorScheme ${KF_DEP_VERSION} REQUIRED) 39 | find_package(KF6IconThemes ${KF_DEP_VERSION} REQUIRED) 40 | find_package(KF6Notifications ${KF_DEP_VERSION} REQUIRED) 41 | find_package(KF6WidgetsAddons ${KF_DEP_VERSION} REQUIRED) 42 | 43 | 44 | option(BUILD_KPACKAGE_INSTALL_HANDLERS "Build the KPackage install handler binaries (recommended)" ON) 45 | if (BUILD_KPACKAGE_INSTALL_HANDLERS) 46 | find_package(KF6NewStuffCore ${KF_DEP_VERSION} REQUIRED) 47 | find_package(KF6Package ${KF_DEP_VERSION} REQUIRED) 48 | find_package(KF6I18n ${KF_DEP_VERSION} REQUIRED) 49 | 50 | find_package(packagekitqt6) 51 | find_package(AppStreamQt 1.0) 52 | endif() 53 | 54 | ecm_set_disabled_deprecation_versions( 55 | QT 6.9.0 56 | KF 6.13.0 57 | ) 58 | 59 | add_subdirectory(src) 60 | if (BUILD_TESTING) 61 | add_subdirectory(autotests) 62 | add_subdirectory(tests) 63 | endif() 64 | 65 | # create a Config.cmake and a ConfigVersion.cmake file and install them 66 | set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6FrameworkIntegration") 67 | 68 | configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF6FrameworkIntegrationConfig.cmake.in" 69 | "${CMAKE_CURRENT_BINARY_DIR}/KF6FrameworkIntegrationConfig.cmake" 70 | INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} 71 | ) 72 | 73 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF6FrameworkIntegrationConfig.cmake" 74 | "${CMAKE_CURRENT_BINARY_DIR}/KF6FrameworkIntegrationConfigVersion.cmake" 75 | DESTINATION "${CMAKECONFIG_INSTALL_DIR}" 76 | COMPONENT Devel ) 77 | 78 | install(EXPORT KF6FrameworkIntegrationTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF6FrameworkIntegrationTargets.cmake NAMESPACE KF6:: ) 79 | 80 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/frameworkintegration_version.h 81 | DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/FrameworkIntegration COMPONENT Devel) 82 | 83 | install(FILES plasma_workspace.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR}) 84 | 85 | 86 | include(ECMFeatureSummary) 87 | ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) 88 | 89 | kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT) 90 | -------------------------------------------------------------------------------- /KF6FrameworkIntegrationConfig.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | include(CMakeFindDependencyMacro) 4 | find_dependency(KF6ColorScheme "@KF_DEP_VERSION@") 5 | find_dependency(KF6IconThemes "@KF_DEP_VERSION@") 6 | find_dependency(KF6WidgetsAddons "@KF_DEP_VERSION@") 7 | 8 | include("${CMAKE_CURRENT_LIST_DIR}/KF6FrameworkIntegrationTargets.cmake") 9 | 10 | -------------------------------------------------------------------------------- /LICENSES/CC0-1.0.txt: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 12 | HEREUNDER. 13 | 14 | Statement of Purpose 15 | 16 | The laws of most jurisdictions throughout the world automatically confer 17 | exclusive Copyright and Related Rights (defined below) upon the creator 18 | and subsequent owner(s) (each and all, an "owner") of an original work of 19 | authorship and/or a database (each, a "Work"). 20 | 21 | Certain owners wish to permanently relinquish those rights to a Work for 22 | the purpose of contributing to a commons of creative, cultural and 23 | scientific works ("Commons") that the public can reliably and without fear 24 | of later claims of infringement build upon, modify, incorporate in other 25 | works, reuse and redistribute as freely as possible in any form whatsoever 26 | and for any purposes, including without limitation commercial purposes. 27 | These owners may contribute to the Commons to promote the ideal of a free 28 | culture and the further production of creative, cultural and scientific 29 | works, or to gain reputation or greater distribution for their Work in 30 | part through the use and efforts of others. 31 | 32 | For these and/or other purposes and motivations, and without any 33 | expectation of additional consideration or compensation, the person 34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 35 | is an owner of Copyright and Related Rights in the Work, voluntarily 36 | elects to apply CC0 to the Work and publicly distribute the Work under its 37 | terms, with knowledge of his or her Copyright and Related Rights in the 38 | Work and the meaning and intended legal effect of CC0 on those rights. 39 | 40 | 1. Copyright and Related Rights. A Work made available under CC0 may be 41 | protected by copyright and related or neighboring rights ("Copyright and 42 | Related Rights"). Copyright and Related Rights include, but are not 43 | limited to, the following: 44 | 45 | i. the right to reproduce, adapt, distribute, perform, display, 46 | communicate, and translate a Work; 47 | ii. moral rights retained by the original author(s) and/or performer(s); 48 | iii. publicity and privacy rights pertaining to a person's image or 49 | likeness depicted in a Work; 50 | iv. rights protecting against unfair competition in regards to a Work, 51 | subject to the limitations in paragraph 4(a), below; 52 | v. rights protecting the extraction, dissemination, use and reuse of data 53 | in a Work; 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal 56 | protection of databases, and under any national implementation 57 | thereof, including any amended or successor version of such 58 | directive); and 59 | vii. other similar, equivalent or corresponding rights throughout the 60 | world based on applicable law or treaty, and any national 61 | implementations thereof. 62 | 63 | 2. Waiver. To the greatest extent permitted by, but not in contravention 64 | of, applicable law, Affirmer hereby overtly, fully, permanently, 65 | irrevocably and unconditionally waives, abandons, and surrenders all of 66 | Affirmer's Copyright and Related Rights and associated claims and causes 67 | of action, whether now known or unknown (including existing as well as 68 | future claims and causes of action), in the Work (i) in all territories 69 | worldwide, (ii) for the maximum duration provided by applicable law or 70 | treaty (including future time extensions), (iii) in any current or future 71 | medium and for any number of copies, and (iv) for any purpose whatsoever, 72 | including without limitation commercial, advertising or promotional 73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 74 | member of the public at large and to the detriment of Affirmer's heirs and 75 | successors, fully intending that such Waiver shall not be subject to 76 | revocation, rescission, cancellation, termination, or any other legal or 77 | equitable action to disrupt the quiet enjoyment of the Work by the public 78 | as contemplated by Affirmer's express Statement of Purpose. 79 | 80 | 3. Public License Fallback. Should any part of the Waiver for any reason 81 | be judged legally invalid or ineffective under applicable law, then the 82 | Waiver shall be preserved to the maximum extent permitted taking into 83 | account Affirmer's express Statement of Purpose. In addition, to the 84 | extent the Waiver is so judged Affirmer hereby grants to each affected 85 | person a royalty-free, non transferable, non sublicensable, non exclusive, 86 | irrevocable and unconditional license to exercise Affirmer's Copyright and 87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 88 | maximum duration provided by applicable law or treaty (including future 89 | time extensions), (iii) in any current or future medium and for any number 90 | of copies, and (iv) for any purpose whatsoever, including without 91 | limitation commercial, advertising or promotional purposes (the 92 | "License"). The License shall be deemed effective as of the date CC0 was 93 | applied by Affirmer to the Work. Should any part of the License for any 94 | reason be judged legally invalid or ineffective under applicable law, such 95 | partial invalidity or ineffectiveness shall not invalidate the remainder 96 | of the License, and in such case Affirmer hereby affirms that he or she 97 | will not (i) exercise any of his or her remaining Copyright and Related 98 | Rights in the Work or (ii) assert any associated claims and causes of 99 | action with respect to the Work, in either case contrary to Affirmer's 100 | express Statement of Purpose. 101 | 102 | 4. Limitations and Disclaimers. 103 | 104 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 105 | surrendered, licensed or otherwise affected by this document. 106 | b. Affirmer offers the Work as-is and makes no representations or 107 | warranties of any kind concerning the Work, express, implied, 108 | statutory or otherwise, including without limitation warranties of 109 | title, merchantability, fitness for a particular purpose, non 110 | infringement, or the absence of latent or other defects, accuracy, or 111 | the present or absence of errors, whether or not discoverable, all to 112 | the greatest extent permissible under applicable law. 113 | c. Affirmer disclaims responsibility for clearing rights of other persons 114 | that may apply to the Work or any use thereof, including without 115 | limitation any person's Copyright and Related Rights in the Work. 116 | Further, Affirmer disclaims responsibility for obtaining any necessary 117 | consents, permissions or other rights required for any use of the 118 | Work. 119 | d. Affirmer understands and acknowledges that Creative Commons is not a 120 | party to this document and has no duty or obligation with respect to 121 | this CC0 or use of the Work. 122 | -------------------------------------------------------------------------------- /LICENSES/LGPL-2.0-only.txt: -------------------------------------------------------------------------------- 1 | GNU LIBRARY GENERAL PUBLIC LICENSE 2 | 3 | Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 4 | 5 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 6 | 7 | Everyone is permitted to copy and distribute verbatim copies of this license 8 | document, but changing it is not allowed. 9 | 10 | [This is the first released version of the library GPL. It is numbered 2 because 11 | it goes with version 2 of the ordinary GPL.] 12 | 13 | Preamble 14 | 15 | The licenses for most software are designed to take away your freedom to share 16 | and change it. By contrast, the GNU General Public Licenses are intended to 17 | guarantee your freedom to share and change free software--to make sure the 18 | software is free for all its users. 19 | 20 | This license, the Library General Public License, applies to some specially 21 | designated Free Software Foundation software, and to any other libraries whose 22 | authors decide to use it. You can use it for your libraries, too. 23 | 24 | When we speak of free software, we are referring to freedom, not price. Our 25 | General Public Licenses are designed to make sure that you have the freedom 26 | to distribute copies of free software (and charge for this service if you 27 | wish), that you receive source code or can get it if you want it, that you 28 | can change the software or use pieces of it in new free programs; and that 29 | you know you can do these things. 30 | 31 | To protect your rights, we need to make restrictions that forbid anyone to 32 | deny you these rights or to ask you to surrender the rights. These restrictions 33 | translate to certain responsibilities for you if you distribute copies of 34 | the library, or if you modify it. 35 | 36 | For example, if you distribute copies of the library, whether gratis or for 37 | a fee, you must give the recipients all the rights that we gave you. You must 38 | make sure that they, too, receive or can get the source code. If you link 39 | a program with the library, you must provide complete object files to the 40 | recipients so that they can relink them with the library, after making changes 41 | to the library and recompiling it. And you must show them these terms so they 42 | know their rights. 43 | 44 | Our method of protecting your rights has two steps: (1) copyright the library, 45 | and (2) offer you this license which gives you legal permission to copy, distribute 46 | and/or modify the library. 47 | 48 | Also, for each distributor's protection, we want to make certain that everyone 49 | understands that there is no warranty for this free library. If the library 50 | is modified by someone else and passed on, we want its recipients to know 51 | that what they have is not the original version, so that any problems introduced 52 | by others will not reflect on the original authors' reputations. 53 | 54 | Finally, any free program is threatened constantly by software patents. We 55 | wish to avoid the danger that companies distributing free software will individually 56 | obtain patent licenses, thus in effect transforming the program into proprietary 57 | software. To prevent this, we have made it clear that any patent must be licensed 58 | for everyone's free use or not licensed at all. 59 | 60 | Most GNU software, including some libraries, is covered by the ordinary GNU 61 | General Public License, which was designed for utility programs. This license, 62 | the GNU Library General Public License, applies to certain designated libraries. 63 | This license is quite different from the ordinary one; be sure to read it 64 | in full, and don't assume that anything in it is the same as in the ordinary 65 | license. 66 | 67 | The reason we have a separate public license for some libraries is that they 68 | blur the distinction we usually make between modifying or adding to a program 69 | and simply using it. Linking a program with a library, without changing the 70 | library, is in some sense simply using the library, and is analogous to running 71 | a utility program or application program. However, in a textual and legal 72 | sense, the linked executable is a combined work, a derivative of the original 73 | library, and the ordinary General Public License treats it as such. 74 | 75 | Because of this blurred distinction, using the ordinary General Public License 76 | for libraries did not effectively promote software sharing, because most developers 77 | did not use the libraries. We concluded that weaker conditions might promote 78 | sharing better. 79 | 80 | However, unrestricted linking of non-free programs would deprive the users 81 | of those programs of all benefit from the free status of the libraries themselves. 82 | This Library General Public License is intended to permit developers of non-free 83 | programs to use free libraries, while preserving your freedom as a user of 84 | such programs to change the free libraries that are incorporated in them. 85 | (We have not seen how to achieve this as regards changes in header files, 86 | but we have achieved it as regards changes in the actual functions of the 87 | Library.) The hope is that this will lead to faster development of free libraries. 88 | 89 | The precise terms and conditions for copying, distribution and modification 90 | follow. Pay close attention to the difference between a "work based on the 91 | library" and a "work that uses the library". The former contains code derived 92 | from the library, while the latter only works together with the library. 93 | 94 | Note that it is possible for a library to be covered by the ordinary General 95 | Public License rather than by this special one. 96 | 97 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 98 | 99 | 0. This License Agreement applies to any software library which contains a 100 | notice placed by the copyright holder or other authorized party saying it 101 | may be distributed under the terms of this Library General Public License 102 | (also called "this License"). Each licensee is addressed as "you". 103 | 104 | A "library" means a collection of software functions and/or data prepared 105 | so as to be conveniently linked with application programs (which use some 106 | of those functions and data) to form executables. 107 | 108 | The "Library", below, refers to any such software library or work which has 109 | been distributed under these terms. A "work based on the Library" means either 110 | the Library or any derivative work under copyright law: that is to say, a 111 | work containing the Library or a portion of it, either verbatim or with modifications 112 | and/or translated straightforwardly into another language. (Hereinafter, translation 113 | is included without limitation in the term "modification".) 114 | 115 | "Source code" for a work means the preferred form of the work for making modifications 116 | to it. For a library, complete source code means all the source code for all 117 | modules it contains, plus any associated interface definition files, plus 118 | the scripts used to control compilation and installation of the library. 119 | 120 | Activities other than copying, distribution and modification are not covered 121 | by this License; they are outside its scope. The act of running a program 122 | using the Library is not restricted, and output from such a program is covered 123 | only if its contents constitute a work based on the Library (independent of 124 | the use of the Library in a tool for writing it). Whether that is true depends 125 | on what the Library does and what the program that uses the Library does. 126 | 127 | 1. You may copy and distribute verbatim copies of the Library's complete source 128 | code as you receive it, in any medium, provided that you conspicuously and 129 | appropriately publish on each copy an appropriate copyright notice and disclaimer 130 | of warranty; keep intact all the notices that refer to this License and to 131 | the absence of any warranty; and distribute a copy of this License along with 132 | the Library. 133 | 134 | You may charge a fee for the physical act of transferring a copy, and you 135 | may at your option offer warranty protection in exchange for a fee. 136 | 137 | 2. You may modify your copy or copies of the Library or any portion of it, 138 | thus forming a work based on the Library, and copy and distribute such modifications 139 | or work under the terms of Section 1 above, provided that you also meet all 140 | of these conditions: 141 | 142 | a) The modified work must itself be a software library. 143 | 144 | b) You must cause the files modified to carry prominent notices stating that 145 | you changed the files and the date of any change. 146 | 147 | c) You must cause the whole of the work to be licensed at no charge to all 148 | third parties under the terms of this License. 149 | 150 | d) If a facility in the modified Library refers to a function or a table of 151 | data to be supplied by an application program that uses the facility, other 152 | than as an argument passed when the facility is invoked, then you must make 153 | a good faith effort to ensure that, in the event an application does not supply 154 | such function or table, the facility still operates, and performs whatever 155 | part of its purpose remains meaningful. 156 | 157 | (For example, a function in a library to compute square roots has a purpose 158 | that is entirely well-defined independent of the application. Therefore, Subsection 159 | 2d requires that any application-supplied function or table used by this function 160 | must be optional: if the application does not supply it, the square root function 161 | must still compute square roots.) 162 | 163 | These requirements apply to the modified work as a whole. If identifiable 164 | sections of that work are not derived from the Library, and can be reasonably 165 | considered independent and separate works in themselves, then this License, 166 | and its terms, do not apply to those sections when you distribute them as 167 | separate works. But when you distribute the same sections as part of a whole 168 | which is a work based on the Library, the distribution of the whole must be 169 | on the terms of this License, whose permissions for other licensees extend 170 | to the entire whole, and thus to each and every part regardless of who wrote 171 | it. 172 | 173 | Thus, it is not the intent of this section to claim rights or contest your 174 | rights to work written entirely by you; rather, the intent is to exercise 175 | the right to control the distribution of derivative or collective works based 176 | on the Library. 177 | 178 | In addition, mere aggregation of another work not based on the Library with 179 | the Library (or with a work based on the Library) on a volume of a storage 180 | or distribution medium does not bring the other work under the scope of this 181 | License. 182 | 183 | 3. You may opt to apply the terms of the ordinary GNU General Public License 184 | instead of this License to a given copy of the Library. To do this, you must 185 | alter all the notices that refer to this License, so that they refer to the 186 | ordinary GNU General Public License, version 2, instead of to this License. 187 | (If a newer version than version 2 of the ordinary GNU General Public License 188 | has appeared, then you can specify that version instead if you wish.) Do not 189 | make any other change in these notices. 190 | 191 | Once this change is made in a given copy, it is irreversible for that copy, 192 | so the ordinary GNU General Public License applies to all subsequent copies 193 | and derivative works made from that copy. 194 | 195 | This option is useful when you wish to copy part of the code of the Library 196 | into a program that is not a library. 197 | 198 | 4. You may copy and distribute the Library (or a portion or derivative of 199 | it, under Section 2) in object code or executable form under the terms of 200 | Sections 1 and 2 above provided that you accompany it with the complete corresponding 201 | machine-readable source code, which must be distributed under the terms of 202 | Sections 1 and 2 above on a medium customarily used for software interchange. 203 | 204 | If distribution of object code is made by offering access to copy from a designated 205 | place, then offering equivalent access to copy the source code from the same 206 | place satisfies the requirement to distribute the source code, even though 207 | third parties are not compelled to copy the source along with the object code. 208 | 209 | 5. A program that contains no derivative of any portion of the Library, but 210 | is designed to work with the Library by being compiled or linked with it, 211 | is called a "work that uses the Library". Such a work, in isolation, is not 212 | a derivative work of the Library, and therefore falls outside the scope of 213 | this License. 214 | 215 | However, linking a "work that uses the Library" with the Library creates an 216 | executable that is a derivative of the Library (because it contains portions 217 | of the Library), rather than a "work that uses the library". The executable 218 | is therefore covered by this License. Section 6 states terms for distribution 219 | of such executables. 220 | 221 | When a "work that uses the Library" uses material from a header file that 222 | is part of the Library, the object code for the work may be a derivative work 223 | of the Library even though the source code is not. Whether this is true is 224 | especially significant if the work can be linked without the Library, or if 225 | the work is itself a library. The threshold for this to be true is not precisely 226 | defined by law. 227 | 228 | If such an object file uses only numerical parameters, data structure layouts 229 | and accessors, and small macros and small inline functions (ten lines or less 230 | in length), then the use of the object file is unrestricted, regardless of 231 | whether it is legally a derivative work. (Executables containing this object 232 | code plus portions of the Library will still fall under Section 6.) 233 | 234 | Otherwise, if the work is a derivative of the Library, you may distribute 235 | the object code for the work under the terms of Section 6. Any executables 236 | containing that work also fall under Section 6, whether or not they are linked 237 | directly with the Library itself. 238 | 239 | 6. As an exception to the Sections above, you may also compile or link a "work 240 | that uses the Library" with the Library to produce a work containing portions 241 | of the Library, and distribute that work under terms of your choice, provided 242 | that the terms permit modification of the work for the customer's own use 243 | and reverse engineering for debugging such modifications. 244 | 245 | You must give prominent notice with each copy of the work that the Library 246 | is used in it and that the Library and its use are covered by this License. 247 | You must supply a copy of this License. If the work during execution displays 248 | copyright notices, you must include the copyright notice for the Library among 249 | them, as well as a reference directing the user to the copy of this License. 250 | Also, you must do one of these things: 251 | 252 | a) Accompany the work with the complete corresponding machine-readable source 253 | code for the Library including whatever changes were used in the work (which 254 | must be distributed under Sections 1 and 2 above); and, if the work is an 255 | executable linked with the Library, with the complete machine-readable "work 256 | that uses the Library", as object code and/or source code, so that the user 257 | can modify the Library and then relink to produce a modified executable containing 258 | the modified Library. (It is understood that the user who changes the contents 259 | of definitions files in the Library will not necessarily be able to recompile 260 | the application to use the modified definitions.) 261 | 262 | b) Accompany the work with a written offer, valid for at least three years, 263 | to give the same user the materials specified in Subsection 6a, above, for 264 | a charge no more than the cost of performing this distribution. 265 | 266 | c) If distribution of the work is made by offering access to copy from a designated 267 | place, offer equivalent access to copy the above specified materials from 268 | the same place. 269 | 270 | d) Verify that the user has already received a copy of these materials or 271 | that you have already sent this user a copy. 272 | 273 | For an executable, the required form of the "work that uses the Library" must 274 | include any data and utility programs needed for reproducing the executable 275 | from it. However, as a special exception, the source code distributed need 276 | not include anything that is normally distributed (in either source or binary 277 | form) with the major components (compiler, kernel, and so on) of the operating 278 | system on which the executable runs, unless that component itself accompanies 279 | the executable. 280 | 281 | It may happen that this requirement contradicts the license restrictions of 282 | other proprietary libraries that do not normally accompany the operating system. 283 | Such a contradiction means you cannot use both them and the Library together 284 | in an executable that you distribute. 285 | 286 | 7. You may place library facilities that are a work based on the Library side-by-side 287 | in a single library together with other library facilities not covered by 288 | this License, and distribute such a combined library, provided that the separate 289 | distribution of the work based on the Library and of the other library facilities 290 | is otherwise permitted, and provided that you do these two things: 291 | 292 | a) Accompany the combined library with a copy of the same work based on the 293 | Library, uncombined with any other library facilities. This must be distributed 294 | under the terms of the Sections above. 295 | 296 | b) Give prominent notice with the combined library of the fact that part of 297 | it is a work based on the Library, and explaining where to find the accompanying 298 | uncombined form of the same work. 299 | 300 | 8. You may not copy, modify, sublicense, link with, or distribute the Library 301 | except as expressly provided under this License. Any attempt otherwise to 302 | copy, modify, sublicense, link with, or distribute the Library is void, and 303 | will automatically terminate your rights under this License. However, parties 304 | who have received copies, or rights, from you under this License will not 305 | have their licenses terminated so long as such parties remain in full compliance. 306 | 307 | 9. You are not required to accept this License, since you have not signed 308 | it. However, nothing else grants you permission to modify or distribute the 309 | Library or its derivative works. These actions are prohibited by law if you 310 | do not accept this License. Therefore, by modifying or distributing the Library 311 | (or any work based on the Library), you indicate your acceptance of this License 312 | to do so, and all its terms and conditions for copying, distributing or modifying 313 | the Library or works based on it. 314 | 315 | 10. Each time you redistribute the Library (or any work based on the Library), 316 | the recipient automatically receives a license from the original licensor 317 | to copy, distribute, link with or modify the Library subject to these terms 318 | and conditions. You may not impose any further restrictions on the recipients' 319 | exercise of the rights granted herein. You are not responsible for enforcing 320 | compliance by third parties to this License. 321 | 322 | 11. If, as a consequence of a court judgment or allegation of patent infringement 323 | or for any other reason (not limited to patent issues), conditions are imposed 324 | on you (whether by court order, agreement or otherwise) that contradict the 325 | conditions of this License, they do not excuse you from the conditions of 326 | this License. If you cannot distribute so as to satisfy simultaneously your 327 | obligations under this License and any other pertinent obligations, then as 328 | a consequence you may not distribute the Library at all. For example, if a 329 | patent license would not permit royalty-free redistribution of the Library 330 | by all those who receive copies directly or indirectly through you, then the 331 | only way you could satisfy both it and this License would be to refrain entirely 332 | from distribution of the Library. 333 | 334 | If any portion of this section is held invalid or unenforceable under any 335 | particular circumstance, the balance of the section is intended to apply, 336 | and the section as a whole is intended to apply in other circumstances. 337 | 338 | It is not the purpose of this section to induce you to infringe any patents 339 | or other property right claims or to contest validity of any such claims; 340 | this section has the sole purpose of protecting the integrity of the free 341 | software distribution system which is implemented by public license practices. 342 | Many people have made generous contributions to the wide range of software 343 | distributed through that system in reliance on consistent application of that 344 | system; it is up to the author/donor to decide if he or she is willing to 345 | distribute software through any other system and a licensee cannot impose 346 | that choice. 347 | 348 | This section is intended to make thoroughly clear what is believed to be a 349 | consequence of the rest of this License. 350 | 351 | 12. If the distribution and/or use of the Library is restricted in certain 352 | countries either by patents or by copyrighted interfaces, the original copyright 353 | holder who places the Library under this License may add an explicit geographical 354 | distribution limitation excluding those countries, so that distribution is 355 | permitted only in or among countries not thus excluded. In such case, this 356 | License incorporates the limitation as if written in the body of this License. 357 | 358 | 13. The Free Software Foundation may publish revised and/or new versions of 359 | the Library General Public License from time to time. Such new versions will 360 | be similar in spirit to the present version, but may differ in detail to address 361 | new problems or concerns. 362 | 363 | Each version is given a distinguishing version number. If the Library specifies 364 | a version number of this License which applies to it and "any later version", 365 | you have the option of following the terms and conditions either of that version 366 | or of any later version published by the Free Software Foundation. If the 367 | Library does not specify a license version number, you may choose any version 368 | ever published by the Free Software Foundation. 369 | 370 | 14. If you wish to incorporate parts of the Library into other free programs 371 | whose distribution conditions are incompatible with these, write to the author 372 | to ask for permission. For software which is copyrighted by the Free Software 373 | Foundation, write to the Free Software Foundation; we sometimes make exceptions 374 | for this. Our decision will be guided by the two goals of preserving the free 375 | status of all derivatives of our free software and of promoting the sharing 376 | and reuse of software generally. 377 | 378 | NO WARRANTY 379 | 380 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR 381 | THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE 382 | STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY 383 | "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, 384 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 385 | FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE 386 | OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 387 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 388 | 389 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 390 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 391 | THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 392 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE 393 | OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA 394 | OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES 395 | OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH 396 | HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 397 | END OF TERMS AND CONDITIONS 398 | 399 | How to Apply These Terms to Your New Libraries 400 | 401 | If you develop a new library, and you want it to be of the greatest possible 402 | use to the public, we recommend making it free software that everyone can 403 | redistribute and change. You can do so by permitting redistribution under 404 | these terms (or, alternatively, under the terms of the ordinary General Public 405 | License). 406 | 407 | To apply these terms, attach the following notices to the library. It is safest 408 | to attach them to the start of each source file to most effectively convey 409 | the exclusion of warranty; and each file should have at least the "copyright" 410 | line and a pointer to where the full notice is found. 411 | 412 | one line to give the library's name and an idea of what it does. 413 | 414 | Copyright (C) year name of author 415 | 416 | This library is free software; you can redistribute it and/or modify it under 417 | the terms of the GNU Library General Public License as published by the Free 418 | Software Foundation; either version 2 of the License, or (at your option) 419 | any later version. 420 | 421 | This library is distributed in the hope that it will be useful, but WITHOUT 422 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 423 | FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more 424 | details. 425 | 426 | You should have received a copy of the GNU Library General Public License 427 | along with this library; if not, write to the Free Software Foundation, Inc., 428 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 429 | 430 | Also add information on how to contact you by electronic and paper mail. 431 | 432 | You should also get your employer (if you work as a programmer) or your school, 433 | if any, to sign a "copyright disclaimer" for the library, if necessary. Here 434 | is a sample; alter the names: 435 | 436 | Yoyodyne, Inc., hereby disclaims all copyright interest in 437 | 438 | the library `Frob' (a library for tweaking knobs) written 439 | 440 | by James Random Hacker. 441 | 442 | signature of Ty Coon, 1 April 1990 443 | 444 | Ty Coon, President of Vice 445 | 446 | That's all there is to it! 447 | -------------------------------------------------------------------------------- /LICENSES/LGPL-2.0-or-later.txt: -------------------------------------------------------------------------------- 1 | GNU LIBRARY GENERAL PUBLIC LICENSE 2 | 3 | Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 4 | 5 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 6 | 7 | Everyone is permitted to copy and distribute verbatim copies of this license 8 | document, but changing it is not allowed. 9 | 10 | [This is the first released version of the library GPL. It is numbered 2 because 11 | it goes with version 2 of the ordinary GPL.] 12 | 13 | Preamble 14 | 15 | The licenses for most software are designed to take away your freedom to share 16 | and change it. By contrast, the GNU General Public Licenses are intended to 17 | guarantee your freedom to share and change free software--to make sure the 18 | software is free for all its users. 19 | 20 | This license, the Library General Public License, applies to some specially 21 | designated Free Software Foundation software, and to any other libraries whose 22 | authors decide to use it. You can use it for your libraries, too. 23 | 24 | When we speak of free software, we are referring to freedom, not price. Our 25 | General Public Licenses are designed to make sure that you have the freedom 26 | to distribute copies of free software (and charge for this service if you 27 | wish), that you receive source code or can get it if you want it, that you 28 | can change the software or use pieces of it in new free programs; and that 29 | you know you can do these things. 30 | 31 | To protect your rights, we need to make restrictions that forbid anyone to 32 | deny you these rights or to ask you to surrender the rights. These restrictions 33 | translate to certain responsibilities for you if you distribute copies of 34 | the library, or if you modify it. 35 | 36 | For example, if you distribute copies of the library, whether gratis or for 37 | a fee, you must give the recipients all the rights that we gave you. You must 38 | make sure that they, too, receive or can get the source code. If you link 39 | a program with the library, you must provide complete object files to the 40 | recipients so that they can relink them with the library, after making changes 41 | to the library and recompiling it. And you must show them these terms so they 42 | know their rights. 43 | 44 | Our method of protecting your rights has two steps: (1) copyright the library, 45 | and (2) offer you this license which gives you legal permission to copy, distribute 46 | and/or modify the library. 47 | 48 | Also, for each distributor's protection, we want to make certain that everyone 49 | understands that there is no warranty for this free library. If the library 50 | is modified by someone else and passed on, we want its recipients to know 51 | that what they have is not the original version, so that any problems introduced 52 | by others will not reflect on the original authors' reputations. 53 | 54 | Finally, any free program is threatened constantly by software patents. We 55 | wish to avoid the danger that companies distributing free software will individually 56 | obtain patent licenses, thus in effect transforming the program into proprietary 57 | software. To prevent this, we have made it clear that any patent must be licensed 58 | for everyone's free use or not licensed at all. 59 | 60 | Most GNU software, including some libraries, is covered by the ordinary GNU 61 | General Public License, which was designed for utility programs. This license, 62 | the GNU Library General Public License, applies to certain designated libraries. 63 | This license is quite different from the ordinary one; be sure to read it 64 | in full, and don't assume that anything in it is the same as in the ordinary 65 | license. 66 | 67 | The reason we have a separate public license for some libraries is that they 68 | blur the distinction we usually make between modifying or adding to a program 69 | and simply using it. Linking a program with a library, without changing the 70 | library, is in some sense simply using the library, and is analogous to running 71 | a utility program or application program. However, in a textual and legal 72 | sense, the linked executable is a combined work, a derivative of the original 73 | library, and the ordinary General Public License treats it as such. 74 | 75 | Because of this blurred distinction, using the ordinary General Public License 76 | for libraries did not effectively promote software sharing, because most developers 77 | did not use the libraries. We concluded that weaker conditions might promote 78 | sharing better. 79 | 80 | However, unrestricted linking of non-free programs would deprive the users 81 | of those programs of all benefit from the free status of the libraries themselves. 82 | This Library General Public License is intended to permit developers of non-free 83 | programs to use free libraries, while preserving your freedom as a user of 84 | such programs to change the free libraries that are incorporated in them. 85 | (We have not seen how to achieve this as regards changes in header files, 86 | but we have achieved it as regards changes in the actual functions of the 87 | Library.) The hope is that this will lead to faster development of free libraries. 88 | 89 | The precise terms and conditions for copying, distribution and modification 90 | follow. Pay close attention to the difference between a "work based on the 91 | library" and a "work that uses the library". The former contains code derived 92 | from the library, while the latter only works together with the library. 93 | 94 | Note that it is possible for a library to be covered by the ordinary General 95 | Public License rather than by this special one. 96 | 97 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 98 | 99 | 0. This License Agreement applies to any software library which contains a 100 | notice placed by the copyright holder or other authorized party saying it 101 | may be distributed under the terms of this Library General Public License 102 | (also called "this License"). Each licensee is addressed as "you". 103 | 104 | A "library" means a collection of software functions and/or data prepared 105 | so as to be conveniently linked with application programs (which use some 106 | of those functions and data) to form executables. 107 | 108 | The "Library", below, refers to any such software library or work which has 109 | been distributed under these terms. A "work based on the Library" means either 110 | the Library or any derivative work under copyright law: that is to say, a 111 | work containing the Library or a portion of it, either verbatim or with modifications 112 | and/or translated straightforwardly into another language. (Hereinafter, translation 113 | is included without limitation in the term "modification".) 114 | 115 | "Source code" for a work means the preferred form of the work for making modifications 116 | to it. For a library, complete source code means all the source code for all 117 | modules it contains, plus any associated interface definition files, plus 118 | the scripts used to control compilation and installation of the library. 119 | 120 | Activities other than copying, distribution and modification are not covered 121 | by this License; they are outside its scope. The act of running a program 122 | using the Library is not restricted, and output from such a program is covered 123 | only if its contents constitute a work based on the Library (independent of 124 | the use of the Library in a tool for writing it). Whether that is true depends 125 | on what the Library does and what the program that uses the Library does. 126 | 127 | 1. You may copy and distribute verbatim copies of the Library's complete source 128 | code as you receive it, in any medium, provided that you conspicuously and 129 | appropriately publish on each copy an appropriate copyright notice and disclaimer 130 | of warranty; keep intact all the notices that refer to this License and to 131 | the absence of any warranty; and distribute a copy of this License along with 132 | the Library. 133 | 134 | You may charge a fee for the physical act of transferring a copy, and you 135 | may at your option offer warranty protection in exchange for a fee. 136 | 137 | 2. You may modify your copy or copies of the Library or any portion of it, 138 | thus forming a work based on the Library, and copy and distribute such modifications 139 | or work under the terms of Section 1 above, provided that you also meet all 140 | of these conditions: 141 | 142 | a) The modified work must itself be a software library. 143 | 144 | b) You must cause the files modified to carry prominent notices stating that 145 | you changed the files and the date of any change. 146 | 147 | c) You must cause the whole of the work to be licensed at no charge to all 148 | third parties under the terms of this License. 149 | 150 | d) If a facility in the modified Library refers to a function or a table of 151 | data to be supplied by an application program that uses the facility, other 152 | than as an argument passed when the facility is invoked, then you must make 153 | a good faith effort to ensure that, in the event an application does not supply 154 | such function or table, the facility still operates, and performs whatever 155 | part of its purpose remains meaningful. 156 | 157 | (For example, a function in a library to compute square roots has a purpose 158 | that is entirely well-defined independent of the application. Therefore, Subsection 159 | 2d requires that any application-supplied function or table used by this function 160 | must be optional: if the application does not supply it, the square root function 161 | must still compute square roots.) 162 | 163 | These requirements apply to the modified work as a whole. If identifiable 164 | sections of that work are not derived from the Library, and can be reasonably 165 | considered independent and separate works in themselves, then this License, 166 | and its terms, do not apply to those sections when you distribute them as 167 | separate works. But when you distribute the same sections as part of a whole 168 | which is a work based on the Library, the distribution of the whole must be 169 | on the terms of this License, whose permissions for other licensees extend 170 | to the entire whole, and thus to each and every part regardless of who wrote 171 | it. 172 | 173 | Thus, it is not the intent of this section to claim rights or contest your 174 | rights to work written entirely by you; rather, the intent is to exercise 175 | the right to control the distribution of derivative or collective works based 176 | on the Library. 177 | 178 | In addition, mere aggregation of another work not based on the Library with 179 | the Library (or with a work based on the Library) on a volume of a storage 180 | or distribution medium does not bring the other work under the scope of this 181 | License. 182 | 183 | 3. You may opt to apply the terms of the ordinary GNU General Public License 184 | instead of this License to a given copy of the Library. To do this, you must 185 | alter all the notices that refer to this License, so that they refer to the 186 | ordinary GNU General Public License, version 2, instead of to this License. 187 | (If a newer version than version 2 of the ordinary GNU General Public License 188 | has appeared, then you can specify that version instead if you wish.) Do not 189 | make any other change in these notices. 190 | 191 | Once this change is made in a given copy, it is irreversible for that copy, 192 | so the ordinary GNU General Public License applies to all subsequent copies 193 | and derivative works made from that copy. 194 | 195 | This option is useful when you wish to copy part of the code of the Library 196 | into a program that is not a library. 197 | 198 | 4. You may copy and distribute the Library (or a portion or derivative of 199 | it, under Section 2) in object code or executable form under the terms of 200 | Sections 1 and 2 above provided that you accompany it with the complete corresponding 201 | machine-readable source code, which must be distributed under the terms of 202 | Sections 1 and 2 above on a medium customarily used for software interchange. 203 | 204 | If distribution of object code is made by offering access to copy from a designated 205 | place, then offering equivalent access to copy the source code from the same 206 | place satisfies the requirement to distribute the source code, even though 207 | third parties are not compelled to copy the source along with the object code. 208 | 209 | 5. A program that contains no derivative of any portion of the Library, but 210 | is designed to work with the Library by being compiled or linked with it, 211 | is called a "work that uses the Library". Such a work, in isolation, is not 212 | a derivative work of the Library, and therefore falls outside the scope of 213 | this License. 214 | 215 | However, linking a "work that uses the Library" with the Library creates an 216 | executable that is a derivative of the Library (because it contains portions 217 | of the Library), rather than a "work that uses the library". The executable 218 | is therefore covered by this License. Section 6 states terms for distribution 219 | of such executables. 220 | 221 | When a "work that uses the Library" uses material from a header file that 222 | is part of the Library, the object code for the work may be a derivative work 223 | of the Library even though the source code is not. Whether this is true is 224 | especially significant if the work can be linked without the Library, or if 225 | the work is itself a library. The threshold for this to be true is not precisely 226 | defined by law. 227 | 228 | If such an object file uses only numerical parameters, data structure layouts 229 | and accessors, and small macros and small inline functions (ten lines or less 230 | in length), then the use of the object file is unrestricted, regardless of 231 | whether it is legally a derivative work. (Executables containing this object 232 | code plus portions of the Library will still fall under Section 6.) 233 | 234 | Otherwise, if the work is a derivative of the Library, you may distribute 235 | the object code for the work under the terms of Section 6. Any executables 236 | containing that work also fall under Section 6, whether or not they are linked 237 | directly with the Library itself. 238 | 239 | 6. As an exception to the Sections above, you may also compile or link a "work 240 | that uses the Library" with the Library to produce a work containing portions 241 | of the Library, and distribute that work under terms of your choice, provided 242 | that the terms permit modification of the work for the customer's own use 243 | and reverse engineering for debugging such modifications. 244 | 245 | You must give prominent notice with each copy of the work that the Library 246 | is used in it and that the Library and its use are covered by this License. 247 | You must supply a copy of this License. If the work during execution displays 248 | copyright notices, you must include the copyright notice for the Library among 249 | them, as well as a reference directing the user to the copy of this License. 250 | Also, you must do one of these things: 251 | 252 | a) Accompany the work with the complete corresponding machine-readable source 253 | code for the Library including whatever changes were used in the work (which 254 | must be distributed under Sections 1 and 2 above); and, if the work is an 255 | executable linked with the Library, with the complete machine-readable "work 256 | that uses the Library", as object code and/or source code, so that the user 257 | can modify the Library and then relink to produce a modified executable containing 258 | the modified Library. (It is understood that the user who changes the contents 259 | of definitions files in the Library will not necessarily be able to recompile 260 | the application to use the modified definitions.) 261 | 262 | b) Accompany the work with a written offer, valid for at least three years, 263 | to give the same user the materials specified in Subsection 6a, above, for 264 | a charge no more than the cost of performing this distribution. 265 | 266 | c) If distribution of the work is made by offering access to copy from a designated 267 | place, offer equivalent access to copy the above specified materials from 268 | the same place. 269 | 270 | d) Verify that the user has already received a copy of these materials or 271 | that you have already sent this user a copy. 272 | 273 | For an executable, the required form of the "work that uses the Library" must 274 | include any data and utility programs needed for reproducing the executable 275 | from it. However, as a special exception, the source code distributed need 276 | not include anything that is normally distributed (in either source or binary 277 | form) with the major components (compiler, kernel, and so on) of the operating 278 | system on which the executable runs, unless that component itself accompanies 279 | the executable. 280 | 281 | It may happen that this requirement contradicts the license restrictions of 282 | other proprietary libraries that do not normally accompany the operating system. 283 | Such a contradiction means you cannot use both them and the Library together 284 | in an executable that you distribute. 285 | 286 | 7. You may place library facilities that are a work based on the Library side-by-side 287 | in a single library together with other library facilities not covered by 288 | this License, and distribute such a combined library, provided that the separate 289 | distribution of the work based on the Library and of the other library facilities 290 | is otherwise permitted, and provided that you do these two things: 291 | 292 | a) Accompany the combined library with a copy of the same work based on the 293 | Library, uncombined with any other library facilities. This must be distributed 294 | under the terms of the Sections above. 295 | 296 | b) Give prominent notice with the combined library of the fact that part of 297 | it is a work based on the Library, and explaining where to find the accompanying 298 | uncombined form of the same work. 299 | 300 | 8. You may not copy, modify, sublicense, link with, or distribute the Library 301 | except as expressly provided under this License. Any attempt otherwise to 302 | copy, modify, sublicense, link with, or distribute the Library is void, and 303 | will automatically terminate your rights under this License. However, parties 304 | who have received copies, or rights, from you under this License will not 305 | have their licenses terminated so long as such parties remain in full compliance. 306 | 307 | 9. You are not required to accept this License, since you have not signed 308 | it. However, nothing else grants you permission to modify or distribute the 309 | Library or its derivative works. These actions are prohibited by law if you 310 | do not accept this License. Therefore, by modifying or distributing the Library 311 | (or any work based on the Library), you indicate your acceptance of this License 312 | to do so, and all its terms and conditions for copying, distributing or modifying 313 | the Library or works based on it. 314 | 315 | 10. Each time you redistribute the Library (or any work based on the Library), 316 | the recipient automatically receives a license from the original licensor 317 | to copy, distribute, link with or modify the Library subject to these terms 318 | and conditions. You may not impose any further restrictions on the recipients' 319 | exercise of the rights granted herein. You are not responsible for enforcing 320 | compliance by third parties to this License. 321 | 322 | 11. If, as a consequence of a court judgment or allegation of patent infringement 323 | or for any other reason (not limited to patent issues), conditions are imposed 324 | on you (whether by court order, agreement or otherwise) that contradict the 325 | conditions of this License, they do not excuse you from the conditions of 326 | this License. If you cannot distribute so as to satisfy simultaneously your 327 | obligations under this License and any other pertinent obligations, then as 328 | a consequence you may not distribute the Library at all. For example, if a 329 | patent license would not permit royalty-free redistribution of the Library 330 | by all those who receive copies directly or indirectly through you, then the 331 | only way you could satisfy both it and this License would be to refrain entirely 332 | from distribution of the Library. 333 | 334 | If any portion of this section is held invalid or unenforceable under any 335 | particular circumstance, the balance of the section is intended to apply, 336 | and the section as a whole is intended to apply in other circumstances. 337 | 338 | It is not the purpose of this section to induce you to infringe any patents 339 | or other property right claims or to contest validity of any such claims; 340 | this section has the sole purpose of protecting the integrity of the free 341 | software distribution system which is implemented by public license practices. 342 | Many people have made generous contributions to the wide range of software 343 | distributed through that system in reliance on consistent application of that 344 | system; it is up to the author/donor to decide if he or she is willing to 345 | distribute software through any other system and a licensee cannot impose 346 | that choice. 347 | 348 | This section is intended to make thoroughly clear what is believed to be a 349 | consequence of the rest of this License. 350 | 351 | 12. If the distribution and/or use of the Library is restricted in certain 352 | countries either by patents or by copyrighted interfaces, the original copyright 353 | holder who places the Library under this License may add an explicit geographical 354 | distribution limitation excluding those countries, so that distribution is 355 | permitted only in or among countries not thus excluded. In such case, this 356 | License incorporates the limitation as if written in the body of this License. 357 | 358 | 13. The Free Software Foundation may publish revised and/or new versions of 359 | the Library General Public License from time to time. Such new versions will 360 | be similar in spirit to the present version, but may differ in detail to address 361 | new problems or concerns. 362 | 363 | Each version is given a distinguishing version number. If the Library specifies 364 | a version number of this License which applies to it and "any later version", 365 | you have the option of following the terms and conditions either of that version 366 | or of any later version published by the Free Software Foundation. If the 367 | Library does not specify a license version number, you may choose any version 368 | ever published by the Free Software Foundation. 369 | 370 | 14. If you wish to incorporate parts of the Library into other free programs 371 | whose distribution conditions are incompatible with these, write to the author 372 | to ask for permission. For software which is copyrighted by the Free Software 373 | Foundation, write to the Free Software Foundation; we sometimes make exceptions 374 | for this. Our decision will be guided by the two goals of preserving the free 375 | status of all derivatives of our free software and of promoting the sharing 376 | and reuse of software generally. 377 | 378 | NO WARRANTY 379 | 380 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR 381 | THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE 382 | STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY 383 | "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, 384 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 385 | FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE 386 | OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 387 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 388 | 389 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 390 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 391 | THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 392 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE 393 | OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA 394 | OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES 395 | OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH 396 | HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 397 | END OF TERMS AND CONDITIONS 398 | 399 | How to Apply These Terms to Your New Libraries 400 | 401 | If you develop a new library, and you want it to be of the greatest possible 402 | use to the public, we recommend making it free software that everyone can 403 | redistribute and change. You can do so by permitting redistribution under 404 | these terms (or, alternatively, under the terms of the ordinary General Public 405 | License). 406 | 407 | To apply these terms, attach the following notices to the library. It is safest 408 | to attach them to the start of each source file to most effectively convey 409 | the exclusion of warranty; and each file should have at least the "copyright" 410 | line and a pointer to where the full notice is found. 411 | 412 | one line to give the library's name and an idea of what it does. 413 | 414 | Copyright (C) year name of author 415 | 416 | This library is free software; you can redistribute it and/or modify it under 417 | the terms of the GNU Library General Public License as published by the Free 418 | Software Foundation; either version 2 of the License, or (at your option) 419 | any later version. 420 | 421 | This library is distributed in the hope that it will be useful, but WITHOUT 422 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 423 | FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more 424 | details. 425 | 426 | You should have received a copy of the GNU Library General Public License 427 | along with this library; if not, write to the Free Software Foundation, Inc., 428 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 429 | 430 | Also add information on how to contact you by electronic and paper mail. 431 | 432 | You should also get your employer (if you work as a programmer) or your school, 433 | if any, to sign a "copyright disclaimer" for the library, if necessary. Here 434 | is a sample; alter the names: 435 | 436 | Yoyodyne, Inc., hereby disclaims all copyright interest in 437 | 438 | the library `Frob' (a library for tweaking knobs) written 439 | 440 | by James Random Hacker. 441 | 442 | signature of Ty Coon, 1 April 1990 443 | 444 | Ty Coon, President of Vice 445 | 446 | That's all there is to it! 447 | -------------------------------------------------------------------------------- /LICENSES/LGPL-3.0-only.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | 3 | Version 3, 29 June 2007 4 | 5 | Copyright (C) 2007 Free Software Foundation, Inc. 6 | 7 | Everyone is permitted to copy and distribute verbatim copies of this license 8 | document, but changing it is not allowed. 9 | 10 | This version of the GNU Lesser General Public License incorporates the terms 11 | and conditions of version 3 of the GNU General Public License, supplemented 12 | by the additional permissions listed below. 13 | 14 | 0. Additional Definitions. 15 | 16 | 17 | 18 | As used herein, "this License" refers to version 3 of the GNU Lesser General 19 | Public License, and the "GNU GPL" refers to version 3 of the GNU General Public 20 | License. 21 | 22 | 23 | 24 | "The Library" refers to a covered work governed by this License, other than 25 | an Application or a Combined Work as defined below. 26 | 27 | 28 | 29 | An "Application" is any work that makes use of an interface provided by the 30 | Library, but which is not otherwise based on the Library. Defining a subclass 31 | of a class defined by the Library is deemed a mode of using an interface provided 32 | by the Library. 33 | 34 | 35 | 36 | A "Combined Work" is a work produced by combining or linking an Application 37 | with the Library. The particular version of the Library with which the Combined 38 | Work was made is also called the "Linked Version". 39 | 40 | 41 | 42 | The "Minimal Corresponding Source" for a Combined Work means the Corresponding 43 | Source for the Combined Work, excluding any source code for portions of the 44 | Combined Work that, considered in isolation, are based on the Application, 45 | and not on the Linked Version. 46 | 47 | 48 | 49 | The "Corresponding Application Code" for a Combined Work means the object 50 | code and/or source code for the Application, including any data and utility 51 | programs needed for reproducing the Combined Work from the Application, but 52 | excluding the System Libraries of the Combined Work. 53 | 54 | 1. Exception to Section 3 of the GNU GPL. 55 | 56 | You may convey a covered work under sections 3 and 4 of this License without 57 | being bound by section 3 of the GNU GPL. 58 | 59 | 2. Conveying Modified Versions. 60 | 61 | If you modify a copy of the Library, and, in your modifications, a facility 62 | refers to a function or data to be supplied by an Application that uses the 63 | facility (other than as an argument passed when the facility is invoked), 64 | then you may convey a copy of the modified version: 65 | 66 | a) under this License, provided that you make a good faith effort to ensure 67 | that, in the event an Application does not supply the function or data, the 68 | facility still operates, and performs whatever part of its purpose remains 69 | meaningful, or 70 | 71 | b) under the GNU GPL, with none of the additional permissions of this License 72 | applicable to that copy. 73 | 74 | 3. Object Code Incorporating Material from Library Header Files. 75 | 76 | The object code form of an Application may incorporate material from a header 77 | file that is part of the Library. You may convey such object code under terms 78 | of your choice, provided that, if the incorporated material is not limited 79 | to numerical parameters, data structure layouts and accessors, or small macros, 80 | inline functions and templates (ten or fewer lines in length), you do both 81 | of the following: 82 | 83 | a) Give prominent notice with each copy of the object code that the Library 84 | is used in it and that the Library and its use are covered by this License. 85 | 86 | b) Accompany the object code with a copy of the GNU GPL and this license document. 87 | 88 | 4. Combined Works. 89 | 90 | You may convey a Combined Work under terms of your choice that, taken together, 91 | effectively do not restrict modification of the portions of the Library contained 92 | in the Combined Work and reverse engineering for debugging such modifications, 93 | if you also do each of the following: 94 | 95 | a) Give prominent notice with each copy of the Combined Work that the Library 96 | is used in it and that the Library and its use are covered by this License. 97 | 98 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 99 | document. 100 | 101 | c) For a Combined Work that displays copyright notices during execution, include 102 | the copyright notice for the Library among these notices, as well as a reference 103 | directing the user to the copies of the GNU GPL and this license document. 104 | 105 | d) Do one of the following: 106 | 107 | 0) Convey the Minimal Corresponding Source under the terms of this License, 108 | and the Corresponding Application Code in a form suitable for, and under terms 109 | that permit, the user to recombine or relink the Application with a modified 110 | version of the Linked Version to produce a modified Combined Work, in the 111 | manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 112 | 113 | 1) Use a suitable shared library mechanism for linking with the Library. A 114 | suitable mechanism is one that (a) uses at run time a copy of the Library 115 | already present on the user's computer system, and (b) will operate properly 116 | with a modified version of the Library that is interface-compatible with the 117 | Linked Version. 118 | 119 | e) Provide Installation Information, but only if you would otherwise be required 120 | to provide such information under section 6 of the GNU GPL, and only to the 121 | extent that such information is necessary to install and execute a modified 122 | version of the Combined Work produced by recombining or relinking the Application 123 | with a modified version of the Linked Version. (If you use option 4d0, the 124 | Installation Information must accompany the Minimal Corresponding Source and 125 | Corresponding Application Code. If you use option 4d1, you must provide the 126 | Installation Information in the manner specified by section 6 of the GNU GPL 127 | for conveying Corresponding Source.) 128 | 129 | 5. Combined Libraries. 130 | 131 | You may place library facilities that are a work based on the Library side 132 | by side in a single library together with other library facilities that are 133 | not Applications and are not covered by this License, and convey such a combined 134 | library under terms of your choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based on the 137 | Library, uncombined with any other library facilities, conveyed under the 138 | terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it is a work 141 | based on the Library, and explaining where to find the accompanying uncombined 142 | form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions of the 147 | GNU Lesser General Public License from time to time. Such new versions will 148 | be similar in spirit to the present version, but may differ in detail to address 149 | new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the Library as you 152 | received it specifies that a certain numbered version of the GNU Lesser General 153 | Public License "or any later version" applies to it, you have the option of 154 | following the terms and conditions either of that published version or of 155 | any later version published by the Free Software Foundation. If the Library 156 | as you received it does not specify a version number of the GNU Lesser General 157 | Public License, you may choose any version of the GNU Lesser General Public 158 | License ever published by the Free Software Foundation. 159 | 160 | If the Library as you received it specifies that a proxy can decide whether 161 | future versions of the GNU Lesser General Public License shall apply, that 162 | proxy's public statement of acceptance of any version is permanent authorization 163 | for you to choose that version for the Library. 164 | -------------------------------------------------------------------------------- /LICENSES/LicenseRef-KDE-Accepted-LGPL.txt: -------------------------------------------------------------------------------- 1 | This library is free software; you can redistribute it and/or 2 | modify it under the terms of the GNU Lesser General Public 3 | License as published by the Free Software Foundation; either 4 | version 3 of the license or (at your option) any later version 5 | that is accepted by the membership of KDE e.V. (or its successor 6 | approved by the membership of KDE e.V.), which shall act as a 7 | proxy as defined in Section 6 of version 3 of the license. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Framework Integration 2 | 3 | Integration of Qt application with KDE workspaces 4 | 5 | ## Introduction 6 | 7 | Framework Integration is a set of plugins responsible for better integration of 8 | Qt applications when running on a KDE Plasma workspace. 9 | 10 | Applications do not need to link to this directly. 11 | 12 | ## Components 13 | 14 | ### KF6Style 15 | 16 | The library KF6Style provides integration with KDE Plasma Workspace 17 | settings for Qt styles. 18 | 19 | Derive your Qt style from KStyle to automatically inherit various 20 | settings from the KDE Plasma Workspace, providing a consistent user 21 | experience. For example, this will ensure a consistent single-click 22 | or double-click activation setting, and the use of standard themed 23 | icons. 24 | 25 | ### FrameworkIntegrationPlugin 26 | 27 | FrameworkIntegrationPlugin provides extra features to other KDE 28 | Frameworks to integrate with KDE Plasma. 29 | 30 | It currently provides an addon to KMessageBox which stores settings 31 | for asking users the same question again. 32 | 33 | -------------------------------------------------------------------------------- /autotests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(ECMMarkAsTest) 2 | include(ECMMarkNonGuiExecutable) 3 | include(ECMAddTests) 4 | 5 | find_package(Qt6Test ${REQUIRED_QT_VERSION} CONFIG QUIET) 6 | 7 | if(NOT TARGET Qt6::Test) 8 | message(STATUS "Qt6Test not found, autotests will not be built.") 9 | return() 10 | endif() 11 | 12 | set(CONFIGFILE "${CMAKE_CURRENT_SOURCE_DIR}/kdeplatformtheme_kdeglobals") 13 | configure_file(kdeplatformtheme_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/kdeplatformtheme_config.h) 14 | 15 | remove_definitions(-DQT_NO_CAST_FROM_ASCII) 16 | 17 | macro(FRAMEWORKINTEGRATION_TESTS _testname) 18 | ecm_add_test(${_testname}.cpp ${ARGN} 19 | LINK_LIBRARIES Qt6::Test KF6::ConfigCore KF6::IconThemes KF6::Style KF6::Notifications 20 | TEST_NAME ${_testname} 21 | NAME_PREFIX "frameworkintegration-") 22 | set_target_properties(${_testname} PROPERTIES COMPILE_FLAGS "-DUNIT_TEST") 23 | endmacro() 24 | 25 | frameworkintegration_tests( 26 | kstyle_unittest 27 | ) 28 | 29 | -------------------------------------------------------------------------------- /autotests/kdeplatformtheme_config.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KDE libraries 3 | SPDX-FileCopyrightText: 2013 Alejandro Fiestas Olivares 4 | 5 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 6 | */ 7 | 8 | #ifndef KPLATFORMTHEMETEST_H 9 | #define KPLATFORMTHEMETEST_H 10 | 11 | #define CONFIGFILE "${CONFIGFILE}" 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /autotests/kdeplatformtheme_kdeglobals: -------------------------------------------------------------------------------- 1 | [KDE] 2 | CursorBlinkRate=1042 3 | DoubleClickInterval=4343 4 | StartDragDist=15 5 | StartDragTime=555 6 | SingleClick=false 7 | widgetStyle=non-existent-widget-style 8 | ShowIconsInMenuItems=false 9 | ShowIconsOnPushButtons=false 10 | GraphicEffectsLevel=0 11 | WheelScrollLines=1234 12 | ShowIconsInMenuItems=true 13 | 14 | [Toolbar style] 15 | ToolButtonStyle=textonly 16 | ToolButtonStyleOtherToolbars=textundericon 17 | 18 | [Icons] 19 | Theme=non-existent-icon-theme 20 | 21 | [MainToolbarIcons] 22 | Size=2 23 | 24 | [ColorEffects:Active] 25 | ChangeSelectionColor=false 26 | Enable=false 27 | 28 | [ColorEffects:Inactive] 29 | ChangeSelectionColor=false 30 | Enable=false 31 | 32 | [ColorEffects:Disabled] 33 | ChangeSelectionColor=false 34 | Enable=false 35 | 36 | [Colors:Button] 37 | BackgroundAlternate=0,128,0 38 | BackgroundNormal=0,128,0 39 | DecorationFocus=0,128,0 40 | DecorationHover=0,128,0 41 | ForegroundActive=0,128,0 42 | ForegroundInactive=0,128,0 43 | ForegroundLink=0,128,0 44 | ForegroundNegative=0,128,0 45 | ForegroundNeutral=0,128,0 46 | ForegroundNormal=0,128,0 47 | ForegroundPositive=0,128,0 48 | ForegroundVisited=0,128,0 49 | 50 | [Colors:Selection] 51 | BackgroundAlternate=0,128,0 52 | BackgroundNormal=0,128,0 53 | DecorationFocus=0,128,0 54 | DecorationHover=0,128,0 55 | ForegroundActive=0,128,0 56 | ForegroundInactive=0,128,0 57 | ForegroundLink=0,128,0 58 | ForegroundNegative=0,128,0 59 | ForegroundNeutral=0,128,0 60 | ForegroundNormal=0,128,0 61 | ForegroundPositive=0,128,0 62 | ForegroundVisited=0,128,0 63 | 64 | [Colors:Tooltip] 65 | BackgroundAlternate=0,128,0 66 | BackgroundNormal=0,128,0 67 | DecorationFocus=0,128,0 68 | DecorationHover=0,128,0 69 | ForegroundActive=0,128,0 70 | ForegroundInactive=0,128,0 71 | ForegroundLink=0,128,0 72 | ForegroundNegative=0,128,0 73 | ForegroundNeutral=0,128,0 74 | ForegroundNormal=0,128,0 75 | ForegroundPositive=0,128,0 76 | ForegroundVisited=0,128,0 77 | 78 | [Colors:View] 79 | BackgroundAlternate=0,128,0 80 | BackgroundNormal=0,128,0 81 | DecorationFocus=0,128,0 82 | DecorationHover=0,128,0 83 | ForegroundActive=0,128,0 84 | ForegroundInactive=0,128,0 85 | ForegroundLink=0,128,0 86 | ForegroundNegative=0,128,0 87 | ForegroundNeutral=0,128,0 88 | ForegroundNormal=0,128,0 89 | ForegroundPositive=0,128,0 90 | ForegroundVisited=0,128,0 91 | 92 | [Colors:Window] 93 | BackgroundAlternate=0,128,0 94 | BackgroundNormal=0,128,0 95 | DecorationFocus=0,128,0 96 | DecorationHover=0,128,0 97 | ForegroundActive=0,128,0 98 | ForegroundInactive=0,128,0 99 | ForegroundLink=0,128,0 100 | ForegroundNegative=0,128,0 101 | ForegroundNeutral=0,128,0 102 | ForegroundNormal=0,128,0 103 | ForegroundPositive=0,128,0 104 | ForegroundVisited=0,128,0 105 | 106 | [WM] 107 | activeFont=OxyActiveTest,9,-1,5,50,0,0,0,0,0 108 | 109 | [General] 110 | desktopFont=OxyDesktopTest,9,-1,5,50,0,0,0,0,0 111 | fixed=OxyFixedTest Mono,10,-1,5,50,0,0,0,0,0 112 | font=OxyFontTest,9,-1,5,50,0,0,0,0,0 113 | menuFont=OxyMenuTest,9,-1,5,50,0,0,0,0,0 114 | smallestReadableFont=OxySmallestReadableTest,8,-1,5,50,0,0,0,0,0 115 | taskbarFont=OxyTaskbarTest,9,-1,5,50,0,0,0,0,0 116 | toolBarFont=OxyToolbarTest,8,-1,5,50,0,0,0,0,0 -------------------------------------------------------------------------------- /autotests/kstyle_unittest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KDE libraries 3 | SPDX-FileCopyrightText: 2013 Alejandro Fiestas Olivares 4 | 5 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 6 | */ 7 | 8 | #include "kdeplatformtheme_config.h" 9 | #include "kstyle.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | static void prepareEnvironment() 22 | { 23 | QStandardPaths::setTestModeEnabled(true); 24 | 25 | QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); 26 | 27 | if (!QDir(configPath).mkpath(QStringLiteral("."))) { 28 | qFatal("Failed to create test configuration directory."); 29 | } 30 | 31 | configPath.append("/kdeglobals"); 32 | 33 | QFile::remove(configPath); 34 | if (!QFile::copy(CONFIGFILE, configPath)) { 35 | qFatal("Failed to copy kdeglobals required for tests."); 36 | } 37 | } 38 | 39 | Q_COREAPP_STARTUP_FUNCTION(prepareEnvironment) 40 | 41 | class KStyle_UnitTest : public QObject 42 | { 43 | Q_OBJECT 44 | private Q_SLOTS: 45 | void initTestCase() 46 | { 47 | qApp->setStyle(new KStyle); 48 | } 49 | void cleanupTestCase() 50 | { 51 | QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); 52 | configPath.append("/kdeglobals"); 53 | QFile::remove(configPath); 54 | } 55 | 56 | void testToolButtonStyleHint() 57 | { 58 | QToolBar *toolbar = new QToolBar(); 59 | QToolButton *btn = new QToolButton(toolbar); 60 | 61 | QCOMPARE(qApp->style()->styleHint(QStyle::SH_ToolButtonStyle, nullptr, btn), (int)Qt::ToolButtonTextOnly); 62 | 63 | toolbar->setProperty("otherToolbar", true); 64 | QCOMPARE(qApp->style()->styleHint(QStyle::SH_ToolButtonStyle, nullptr, btn), (int)Qt::ToolButtonTextUnderIcon); 65 | } 66 | }; 67 | 68 | QTEST_MAIN(KStyle_UnitTest) 69 | 70 | #include "kstyle_unittest.moc" 71 | -------------------------------------------------------------------------------- /metainfo.yaml: -------------------------------------------------------------------------------- 1 | description: Workspace and cross-framework integration plugins 2 | tier: 4 3 | type: integration 4 | platforms: 5 | - name: Linux 6 | - name: Windows 7 | - name: macOS 8 | - name: Linux 9 | - name: FreeBSD 10 | portingAid: false 11 | deprecated: false 12 | release: true 13 | 14 | public_lib: true 15 | group: Frameworks 16 | subgroup: Tier 4 17 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(integrationplugin) 2 | add_subdirectory(kstyle) 3 | if (BUILD_KPACKAGE_INSTALL_HANDLERS) 4 | add_subdirectory(kpackage-install-handlers) 5 | endif() 6 | -------------------------------------------------------------------------------- /src/integrationplugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_library(FrameworkIntegrationPlugin 3 | MODULE frameworkintegrationplugin.cpp) 4 | 5 | target_link_libraries(FrameworkIntegrationPlugin 6 | PRIVATE 7 | KF6::WidgetsAddons 8 | KF6::ConfigCore 9 | KF6::Notifications 10 | ) 11 | 12 | install(TARGETS FrameworkIntegrationPlugin 13 | DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf6) 14 | -------------------------------------------------------------------------------- /src/integrationplugin/frameworkintegrationplugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KDE libraries 3 | SPDX-FileCopyrightText: 2012 David Faure 4 | 5 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 6 | */ 7 | 8 | #include "frameworkintegrationplugin.h" 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | bool KMessageBoxDontAskAgainConfigStorage::shouldBeShownTwoActions(const QString &dontShowAgainName, KMessageBox::ButtonCode &result) 17 | { 18 | KConfigGroup cg(KMessageBox_againConfig ? KMessageBox_againConfig : KSharedConfig::openConfig().data(), QStringLiteral("Notification Messages")); 19 | const QString dontAsk = cg.readEntry(dontShowAgainName, QString()).toLower(); 20 | if (dontAsk == QLatin1String("yes") || dontAsk == QLatin1String("true")) { 21 | result = KMessageBox::PrimaryAction; 22 | return false; 23 | } 24 | if (dontAsk == QLatin1String("no") || dontAsk == QLatin1String("false")) { 25 | result = KMessageBox::SecondaryAction; 26 | return false; 27 | } 28 | return true; 29 | } 30 | 31 | bool KMessageBoxDontAskAgainConfigStorage::shouldBeShownContinue(const QString &dontShowAgainName) 32 | { 33 | KConfigGroup cg(KMessageBox_againConfig ? KMessageBox_againConfig : KSharedConfig::openConfig().data(), QStringLiteral("Notification Messages")); 34 | return cg.readEntry(dontShowAgainName, true); 35 | } 36 | 37 | void KMessageBoxDontAskAgainConfigStorage::saveDontShowAgainTwoActions(const QString &dontShowAgainName, KMessageBox::ButtonCode result) 38 | { 39 | KConfigGroup::WriteConfigFlags flags = KConfig::Persistent; 40 | if (dontShowAgainName[0] == QLatin1Char(':')) { 41 | flags |= KConfigGroup::Global; 42 | } 43 | KConfigGroup cg(KMessageBox_againConfig ? KMessageBox_againConfig : KSharedConfig::openConfig().data(), QStringLiteral("Notification Messages")); 44 | cg.writeEntry(dontShowAgainName, result == KMessageBox::PrimaryAction, flags); 45 | cg.sync(); 46 | } 47 | 48 | void KMessageBoxDontAskAgainConfigStorage::saveDontShowAgainContinue(const QString &dontShowAgainName) 49 | { 50 | KConfigGroup::WriteConfigFlags flags = KConfigGroup::Persistent; 51 | if (dontShowAgainName[0] == QLatin1Char(':')) { 52 | flags |= KConfigGroup::Global; 53 | } 54 | KConfigGroup cg(KMessageBox_againConfig ? KMessageBox_againConfig : KSharedConfig::openConfig().data(), QStringLiteral("Notification Messages")); 55 | cg.writeEntry(dontShowAgainName, false, flags); 56 | cg.sync(); 57 | } 58 | 59 | void KMessageBoxDontAskAgainConfigStorage::enableAllMessages() 60 | { 61 | KConfig *config = KMessageBox_againConfig ? KMessageBox_againConfig : KSharedConfig::openConfig().data(); 62 | if (!config->hasGroup(QStringLiteral("Notification Messages"))) { 63 | return; 64 | } 65 | 66 | KConfigGroup cg(config, QStringLiteral("Notification Messages")); 67 | 68 | typedef QMap configMap; 69 | 70 | const configMap map = cg.entryMap(); 71 | 72 | configMap::ConstIterator it; 73 | for (it = map.begin(); it != map.end(); ++it) { 74 | cg.deleteEntry(it.key()); 75 | } 76 | } 77 | 78 | void KMessageBoxDontAskAgainConfigStorage::enableMessage(const QString &dontShowAgainName) 79 | { 80 | KConfig *config = KMessageBox_againConfig ? KMessageBox_againConfig : KSharedConfig::openConfig().data(); 81 | if (!config->hasGroup(QStringLiteral("Notification Messages"))) { 82 | return; 83 | } 84 | 85 | KConfigGroup cg(config, QStringLiteral("Notification Messages")); 86 | 87 | cg.deleteEntry(dontShowAgainName); 88 | config->sync(); 89 | } 90 | 91 | void KMessageBoxNotify::sendNotification(QMessageBox::Icon notificationType, const QString &message, QWidget * /*parent*/) 92 | { 93 | QString messageType; 94 | switch (notificationType) { 95 | case QMessageBox::Warning: 96 | messageType = QStringLiteral("messageWarning"); 97 | break; 98 | case QMessageBox::Critical: 99 | messageType = QStringLiteral("messageCritical"); 100 | break; 101 | case QMessageBox::Question: 102 | messageType = QStringLiteral("messageQuestion"); 103 | break; 104 | default: 105 | messageType = QStringLiteral("messageInformation"); 106 | break; 107 | } 108 | 109 | KNotification::event(messageType, message, QPixmap(), KNotification::DefaultEvent | KNotification::CloseOnTimeout); 110 | } 111 | 112 | KFrameworkIntegrationPlugin::KFrameworkIntegrationPlugin() 113 | : QObject() 114 | { 115 | setProperty(KMESSAGEBOXDONTASKAGAIN_PROPERTY, QVariant::fromValue(&m_dontAskAgainConfigStorage)); 116 | setProperty(KMESSAGEBOXNOTIFY_PROPERTY, QVariant::fromValue(&m_notify)); 117 | } 118 | 119 | void KFrameworkIntegrationPlugin::reparseConfiguration() 120 | { 121 | KSharedConfig::openConfig()->reparseConfiguration(); 122 | } 123 | 124 | #include "moc_frameworkintegrationplugin.cpp" 125 | -------------------------------------------------------------------------------- /src/integrationplugin/frameworkintegrationplugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KDE libraries 3 | SPDX-FileCopyrightText: 2012 David Faure 4 | 5 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 6 | */ 7 | 8 | #ifndef FRAMEWORKINTEGRATIONPLUGIN_H 9 | #define FRAMEWORKINTEGRATIONPLUGIN_H 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | class KConfig; 16 | 17 | class KMessageBoxDontAskAgainConfigStorage : public KMessageBoxDontAskAgainInterface 18 | { 19 | public: 20 | KMessageBoxDontAskAgainConfigStorage() 21 | : KMessageBox_againConfig(nullptr) 22 | { 23 | } 24 | ~KMessageBoxDontAskAgainConfigStorage() override 25 | { 26 | } 27 | 28 | bool shouldBeShownTwoActions(const QString &dontShowAgainName, KMessageBox::ButtonCode &result) override; 29 | bool shouldBeShownContinue(const QString &dontShowAgainName) override; 30 | void saveDontShowAgainTwoActions(const QString &dontShowAgainName, KMessageBox::ButtonCode result) override; 31 | void saveDontShowAgainContinue(const QString &dontShowAgainName) override; 32 | void enableAllMessages() override; 33 | void enableMessage(const QString &dontShowAgainName) override; 34 | void setConfig(KConfig *cfg) override 35 | { 36 | KMessageBox_againConfig = cfg; 37 | } 38 | 39 | private: 40 | KConfig *KMessageBox_againConfig; 41 | }; 42 | 43 | class KMessageBoxNotify : public KMessageBoxNotifyInterface 44 | { 45 | public: 46 | void sendNotification(QMessageBox::Icon notificationType, const QString &message, QWidget *parent) override; 47 | }; 48 | 49 | class KFrameworkIntegrationPlugin : public QObject 50 | { 51 | Q_PLUGIN_METADATA(IID "org.kde.FrameworkIntegrationPlugin") 52 | Q_OBJECT 53 | public: 54 | KFrameworkIntegrationPlugin(); 55 | 56 | public Q_SLOTS: 57 | void reparseConfiguration(); 58 | 59 | private: 60 | KMessageBoxDontAskAgainConfigStorage m_dontAskAgainConfigStorage; 61 | KMessageBoxNotify m_notify; 62 | }; 63 | 64 | #endif // FRAMEWORKINTEGRATIONPLUGIN_H 65 | -------------------------------------------------------------------------------- /src/kpackage-install-handlers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(kns) 2 | 3 | if(AppStreamQt_FOUND AND packagekitqt6_FOUND) 4 | add_subdirectory(appstream) 5 | endif() 6 | -------------------------------------------------------------------------------- /src/kpackage-install-handlers/appstream/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(appstreamhandler main.cpp) 2 | target_link_libraries(appstreamhandler PK::packagekitqt6 AppStreamQt) 3 | install(TARGETS appstreamhandler DESTINATION ${KDE_INSTALL_LIBEXECDIR_KF}/kpackagehandlers) 4 | -------------------------------------------------------------------------------- /src/kpackage-install-handlers/appstream/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KDE libraries 3 | SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez 4 | 5 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | using namespace AppStream; 14 | 15 | int main(int argc, char **argv) 16 | { 17 | QCoreApplication app(argc, argv); 18 | Q_ASSERT(app.arguments().count() == 2); 19 | 20 | const QUrl url(app.arguments().last()); 21 | Q_ASSERT(url.isValid()); 22 | Q_ASSERT(url.scheme() == QLatin1String("appstream")); 23 | 24 | const QString componentName = url.host(); 25 | if (componentName.isEmpty()) { 26 | qWarning() << "wrongly formatted URI" << url; 27 | return 1; 28 | } 29 | 30 | Pool pool; 31 | auto b = pool.load(); 32 | Q_ASSERT(b); 33 | const auto components = pool.componentsById(componentName).toList(); 34 | if (components.isEmpty()) { 35 | qWarning() << "couldn't find" << componentName; 36 | return 1; 37 | } 38 | 39 | QStringList packages; 40 | for (const auto &component : components) { 41 | packages += component.packageNames(); 42 | } 43 | packages.removeDuplicates(); 44 | 45 | if (packages.isEmpty()) { 46 | qWarning() << "no packages to install"; 47 | return 1; 48 | } 49 | 50 | auto resolveTransaction = PackageKit::Daemon::global()->resolve(packages, PackageKit::Transaction::FilterArch); 51 | Q_ASSERT(resolveTransaction); 52 | 53 | QHash pkgs; 54 | 55 | QObject::connect(resolveTransaction, 56 | &PackageKit::Transaction::package, 57 | resolveTransaction, 58 | [&pkgs](PackageKit::Transaction::Info info, const QString &packageID, const QString & /*summary*/) { 59 | if (info == PackageKit::Transaction::InfoAvailable) 60 | pkgs[PackageKit::Daemon::packageName(packageID)] = packageID; 61 | qDebug() << "resolved package" << info << packageID; 62 | }); 63 | QObject::connect(resolveTransaction, &PackageKit::Transaction::finished, resolveTransaction, [&app, &pkgs](PackageKit::Transaction::Exit status) { 64 | if (status != PackageKit::Transaction::ExitSuccess) { 65 | qWarning() << "resolve failed" << status; 66 | QCoreApplication::exit(1); 67 | return; 68 | } 69 | QStringList pkgids = pkgs.values(); 70 | 71 | if (pkgids.isEmpty()) { 72 | qDebug() << "Nothing to install"; 73 | QCoreApplication::exit(0); 74 | } else { 75 | qDebug() << "installing..." << pkgids; 76 | pkgids.removeDuplicates(); 77 | auto installTransaction = PackageKit::Daemon::global()->installPackages(pkgids); 78 | QObject::connect(installTransaction, &PackageKit::Transaction::finished, &app, [](PackageKit::Transaction::Exit status) { 79 | qDebug() << "install finished" << status; 80 | QCoreApplication::exit(status == PackageKit::Transaction::ExitSuccess ? 0 : 1); 81 | }); 82 | } 83 | }); 84 | return app.exec(); 85 | } 86 | -------------------------------------------------------------------------------- /src/kpackage-install-handlers/kns/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file(knshandlerversion.h.in knshandlerversion.h) 2 | add_executable(knshandler main.cpp) 3 | target_link_libraries(knshandler KF6::NewStuffCore KF6::I18n KF6::Notifications) 4 | 5 | install(TARGETS knshandler DESTINATION ${KDE_INSTALL_LIBEXECDIR_KF}/kpackagehandlers) 6 | 7 | add_executable(knshandlertest main.cpp) 8 | target_link_libraries(knshandlertest KF6::NewStuffCore KF6::I18n KF6::Notifications) 9 | target_compile_definitions(knshandlertest PRIVATE -DTEST) 10 | 11 | if(EXISTS "${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_CONFDIR}/colorschemes.knsrc") 12 | add_test(NAME test_kns-kpackage COMMAND knshandlertest kns://colorschemes.knsrc/api.kde-look.org/1136471) 13 | 14 | add_test(NAME test_kns-kpackage-fail COMMAND knshandlertest kns://colorschemes.knsrc/xxx/1136471) 15 | set_tests_properties(test_kns-kpackage-fail PROPERTIES WILL_FAIL TRUE) 16 | message(STATUS "KNS-KPackage test enabled") 17 | endif() 18 | -------------------------------------------------------------------------------- /src/kpackage-install-handlers/kns/knshandlerversion.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KDE libraries 3 | SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen 4 | 5 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 6 | */ 7 | 8 | #ifndef KNSHANDLERVERSION_H 9 | #define KNSHANDLERVERSION_H 10 | 11 | #include 12 | 13 | static QLatin1String knshandlerversion("@PROJECT_VERSION@"); 14 | 15 | #endif//KNSHANDLERVERSION_H 16 | -------------------------------------------------------------------------------- /src/kpackage-install-handlers/kns/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the KDE libraries 3 | SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez 4 | SPDX-FileCopyrightText: 2021 Alexander Lohnau 5 | 6 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "knshandlerversion.h" 29 | 30 | /** 31 | * Unfortunately there are two knsrc files for the window decorations, but only one is used in the KCM. 32 | * But both are used by third parties, consequently we can not remove one. To solve this we create a symlink 33 | * which links the old cache file to the new cache file, which is exposed on the GUI. 34 | * This way users can again remove window decorations that are installed as a dependency of a global theme. 35 | * BUG: 414570 36 | * 37 | * TODO: knsrc aliases can be specified now, drop this workaround some time later. 38 | */ 39 | void createSymlinkForWindowDecorations() 40 | { 41 | QFileInfo info(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/knewstuff3/aurorae.knsregistry")); 42 | // If we have created the symbolic link already we can exit the function here 43 | if (info.isSymbolicLink()) { 44 | return; 45 | } 46 | // Delete this file, it the KNS entries are not exposed in any GUI 47 | if (info.exists()) { 48 | QFile::remove(info.absoluteFilePath()); 49 | } 50 | QFileInfo newFileInfo(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/knewstuff3/window-decorations.knsregistry")); 51 | QFile file(newFileInfo.absoluteFilePath()); 52 | // Make sure that the file exists 53 | if (!newFileInfo.exists()) { 54 | file.open(QFile::WriteOnly); 55 | file.close(); 56 | } 57 | file.link(info.absoluteFilePath()); 58 | } 59 | 60 | int main(int argc, char **argv) 61 | { 62 | createSymlinkForWindowDecorations(); 63 | QCoreApplication app(argc, argv); 64 | app.setApplicationName(QStringLiteral("kpackage-knshandler")); 65 | app.setApplicationVersion(knshandlerversion); 66 | app.setQuitLockEnabled(false); 67 | Q_ASSERT(app.arguments().count() == 2); 68 | 69 | #ifdef TEST 70 | QStandardPaths::setTestModeEnabled(true); 71 | #endif 72 | 73 | const QUrl url(app.arguments().last()); 74 | Q_ASSERT(url.isValid()); 75 | Q_ASSERT(url.scheme() == QLatin1String("kns")); 76 | 77 | QString knsname; 78 | const QStringList availableConfigFiles = KNSCore::EngineBase::availableConfigFiles(); 79 | auto knsNameIt = std::find_if(availableConfigFiles.begin(), availableConfigFiles.end(), [&url](const QString &availableFile) { 80 | return availableFile.endsWith(QLatin1String("/") + url.host()); 81 | }); 82 | 83 | if (knsNameIt == availableConfigFiles.end()) { 84 | qWarning() << "couldn't find knsrc file for" << url.host(); 85 | return 1; 86 | } else { 87 | knsname = *knsNameIt; 88 | } 89 | 90 | const auto pathParts = url.path().split(QLatin1Char('/'), Qt::SkipEmptyParts); 91 | if (pathParts.size() != 2) { 92 | qWarning() << "wrong format in the url path" << url << pathParts; 93 | return 1; 94 | } 95 | const auto providerid = pathParts.at(0); 96 | const auto entryid = pathParts.at(1); 97 | int linkid = 1; 98 | if (url.hasQuery()) { 99 | QUrlQuery query(url); 100 | if (query.hasQueryItem(QStringLiteral("linkid"))) { 101 | bool ok; 102 | linkid = query.queryItemValue(QStringLiteral("linkid")).toInt(&ok); 103 | if (!ok) { 104 | qWarning() << "linkid is not an integer" << url << pathParts; 105 | return 1; 106 | } 107 | } 108 | } 109 | 110 | KNSCore::EngineBase engine; 111 | int installedCount = 0; 112 | QObject::connect(KNSCore::QuestionManager::instance(), &KNSCore::QuestionManager::askQuestion, &engine, [](KNSCore::Question *question) { 113 | auto discardQuestion = [question]() { 114 | question->setResponse(KNSCore::Question::InvalidResponse); 115 | }; 116 | switch (question->questionType()) { 117 | case KNSCore::Question::YesNoQuestion: { 118 | auto f = KNotification::event(KNotification::StandardEvent::Notification, question->title(), question->question()); 119 | 120 | auto *yes = f->addAction(i18n("Yes")); 121 | QObject::connect(yes, &KNotificationAction::activated, question, [question] { 122 | question->setResponse(KNSCore::Question::YesResponse); 123 | }); 124 | 125 | auto *no = f->addAction(i18n("No")); 126 | QObject::connect(no, &KNotificationAction::activated, question, [question] { 127 | question->setResponse(KNSCore::Question::NoResponse); 128 | }); 129 | 130 | QObject::connect(f, &KNotification::closed, question, discardQuestion); 131 | } break; 132 | case KNSCore::Question::ContinueCancelQuestion: { 133 | auto f = KNotification::event(KNotification::StandardEvent::Notification, question->title(), question->question()); 134 | 135 | auto *continueAction = f->addAction(i18n("Continue")); 136 | QObject::connect(continueAction, &KNotificationAction::activated, question, [question]() { 137 | question->setResponse(KNSCore::Question::ContinueResponse); 138 | }); 139 | 140 | auto *cancelAction = f->addAction(i18n("Cancel")); 141 | QObject::connect(cancelAction, &KNotificationAction::activated, question, [question]() { 142 | question->setResponse(KNSCore::Question::CancelResponse); 143 | }); 144 | 145 | QObject::connect(f, &KNotification::closed, question, discardQuestion); 146 | } break; 147 | case KNSCore::Question::InputTextQuestion: 148 | case KNSCore::Question::SelectFromListQuestion: 149 | case KNSCore::Question::PasswordQuestion: 150 | discardQuestion(); 151 | break; 152 | } 153 | }); 154 | 155 | const auto onError = [](KNSCore::ErrorCode::ErrorCode errorCode, const QString &message, const QVariant &metadata) { 156 | qWarning() << "kns error:" << errorCode << message << metadata; 157 | QCoreApplication::exit(1); 158 | }; 159 | 160 | bool entryWasFound = false; 161 | const auto onEntriesLoded = [providerid, linkid, &installedCount, &engine, &entryWasFound, onError](const KNSCore::Entry::List list) { 162 | Q_ASSERT(list.size() == 1); 163 | entryWasFound = true; 164 | const auto entry = list.first(); 165 | if (providerid != entry.providerId()) { 166 | qWarning() << "Wrong provider" << providerid << "instead of" << entry.providerId(); 167 | QCoreApplication::exit(1); 168 | } else if (entry.status() == KNSCore::Entry::Downloadable) { 169 | qDebug() << "installing..."; 170 | installedCount++; 171 | auto transaction = KNSCore::Transaction::installLinkId(&engine, entry, linkid); 172 | QObject::connect(transaction, &KNSCore::Transaction::signalErrorCode, onError); 173 | QObject::connect(transaction, &KNSCore::Transaction::signalEntryEvent, [&installedCount](auto entry, auto event) { 174 | if (event == KNSCore::Entry::StatusChangedEvent) { 175 | if (entry.status() == KNSCore::Entry::Installed) { 176 | installedCount--; 177 | } 178 | if (installedCount == 0) { 179 | QCoreApplication::exit(0); 180 | } 181 | } 182 | }); 183 | } else if (installedCount == 0) { 184 | qDebug() << "already installed."; 185 | QCoreApplication::exit(0); 186 | } 187 | }; 188 | QObject::connect(&engine, &KNSCore::EngineBase::signalProvidersLoaded, &engine, [&engine, &entryid, onEntriesLoded, &entryWasFound]() { 189 | qWarning() << "providers are loaded"; 190 | KNSCore::SearchRequest request(KNSCore::SortMode::Newest, KNSCore::Filter::ExactEntryId, entryid, QStringList{}, 0); 191 | KNSCore::ResultsStream *results = engine.search(request); 192 | QObject::connect(results, &KNSCore::ResultsStream::entriesFound, &engine, onEntriesLoded); 193 | QObject::connect(results, &KNSCore::ResultsStream::finished, &engine, [&entryWasFound, &entryid]() { 194 | if (!entryWasFound) { 195 | qWarning() << "Entry with id" << entryid << "could not be found"; 196 | QCoreApplication::exit(1); 197 | } 198 | }); 199 | results->fetch(); 200 | }); 201 | 202 | QObject::connect(&engine, &KNSCore::EngineBase::signalErrorCode, &engine, onError); 203 | if (!engine.init(knsname)) { 204 | qWarning() << "couldn't initialize" << knsname; 205 | return 1; 206 | } 207 | return app.exec(); 208 | } 209 | -------------------------------------------------------------------------------- /src/kstyle/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # create a Config.cmake and a ConfigVersion.cmake file and install them 2 | set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6Style") 3 | 4 | add_library(KF6Style kstyle.cpp) 5 | add_library(KF6::Style ALIAS KF6Style) 6 | 7 | set_target_properties(KF6Style PROPERTIES 8 | VERSION ${FRAMEWORKINTEGRATION_VERSION} 9 | SOVERSION ${FRAMEWORKINTEGRATION_SOVERSION} 10 | EXPORT_NAME Style 11 | ) 12 | 13 | ecm_generate_export_header(KF6Style 14 | BASE_NAME KStyle 15 | GROUP_BASE_NAME KF 16 | VERSION ${KF_VERSION} 17 | USE_VERSION_HEADER 18 | VERSION_BASE_NAME FrameworkIntegration 19 | DEPRECATED_BASE_VERSION 0 20 | ) 21 | 22 | target_include_directories(KF6Style 23 | INTERFACE 24 | "$" # version header 25 | "$" 26 | PUBLIC 27 | "$" # version header 28 | ) 29 | 30 | target_link_libraries(KF6Style 31 | PUBLIC 32 | Qt6::Widgets 33 | PRIVATE 34 | KF6::WidgetsAddons 35 | KF6::ColorScheme 36 | KF6::IconThemes 37 | ) 38 | 39 | ecm_generate_headers(KStyle_HEADERS 40 | HEADER_NAMES 41 | KStyle 42 | REQUIRED_HEADERS KStyle_HEADERS 43 | ) 44 | 45 | ecm_generate_qdoc(KF6Style kstyle.qdocconf) 46 | 47 | install(TARGETS KF6Style 48 | EXPORT KF6FrameworkIntegrationTargets 49 | ${KF_INSTALL_TARGETS_DEFAULT_ARGS}) 50 | 51 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kstyle_export.h 52 | ${KStyle_HEADERS} 53 | DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KStyle 54 | COMPONENT Devel) 55 | 56 | -------------------------------------------------------------------------------- /src/kstyle/frameworkintegration-index.qdoc: -------------------------------------------------------------------------------- 1 | /*! 2 | \page frameworkintegration-index.html 3 | \title FrameworkIntegration 4 | 5 | Integration of Qt application with KDE workspaces. 6 | 7 | Framework Integration is a set of plugins responsible for better integration of 8 | Qt applications when running on a KDE Plasma workspace. 9 | 10 | Applications do not need to link to this directly. 11 | 12 | The library KF6Style provides integration with KDE Plasma Workspace 13 | settings for Qt styles. 14 | 15 | Derive your Qt style from KStyle to automatically inherit various 16 | settings from the KDE Plasma Workspace, providing a consistent user 17 | experience. For example, this will ensure a consistent single-click 18 | or double-click activation setting, and the use of standard themed 19 | icons. 20 | 21 | \section1 Using the Module 22 | 23 | \include {module-use.qdocinc} {using the c++ api} 24 | 25 | \section2 Building with CMake 26 | 27 | \include {module-use.qdocinc} {building with cmake} {KF6} {FrameworkIntegration} {KF6::Style} 28 | 29 | \section1 API Reference 30 | 31 | \list 32 | \li \l{KStyle C++ Classes} 33 | \endlist 34 | */ 35 | -------------------------------------------------------------------------------- /src/kstyle/kstyle-checklist.txt: -------------------------------------------------------------------------------- 1 | - Vertical tabs and titles of dockwidgets are broken 2 | Vertical tabs are drawn as yellow rectangle (unfilled) without title 3 | Vertical titles of dockwidgets are not rotated 4 | 5 | drawComplexControl: 6 | CC_SpinBox: 7 | Needs to honor stepEnabled 8 | 9 | CC_ComboBox: 10 | Interaction with some of the style option flags (frameless, non-editable, etc.) seems missing. 11 | Frameless implemented via subControlRect, but probably best to honor in draw as well. 12 | Need to check frame w/designer, at least. Not clear how editable interacts with the SC flags --- 13 | might still pass SC_All? 14 | 15 | CC_ScrollBar: 16 | Fallback to QCommonStyle. Should be OK... 17 | 18 | CC_Slider: 19 | Looks fine... 20 | 21 | CC_ToolButton: 22 | Needs to handle the QStyleOptionToolButton::Arrow feature, though perhaps in CE_ToolButtonLabel? 23 | 24 | CC_TitleBar: 25 | Looks OK 26 | 27 | CC_Q3ListView: 28 | Looks OK 29 | 30 | CC_GroupBox: 31 | No handling (Qt 4.1) 32 | 33 | QCommonStyle breaks it up into PE_IndicatorCheckBox, PE_FrameGroupBox, and PE_FrameFocusRect, 34 | along with drawItem text. Need to check with Oxy folks on what their goals are. Probably need at 35 | least a nice placeholder WT for the frame PE, not sure the rest can probably be pushed back to 36 | 4.1 or 4.0.x 37 | 38 | Also, need to file a Qt docs bug that drawComplexControl docs don't mention QStyleOptionGroupBox for CC_GroupBox 39 | 40 | CC_Dial: 41 | QCommonStyle does something reasonable. No need to style this, I think, it's (thankfully) hardly ever used. 42 | 43 | CC_MdiControls: 44 | No handling (Qt 4.3) 45 | Should probably integrate with CC_TitleBar handling somehow, but may need a flag or something to distinguish them, perhaps 46 | some sort of bevel/bevelless mode in ButtonKOpt? Definitely a lot of overlap.. 47 | Side note: only passes in QStyleOptionComplex 48 | 49 | drawControl 50 | CE_PushButton 51 | QStyleOptionButton::Flat not taken into account (thus the frame is always drawn). 52 | 53 | CE_HeaderSection 54 | The sort indicator is the same for both ascending and descending directions. 55 | 56 | sizeFromContents: 57 | CT_CheckBox: OK 58 | CT_ComboBox: 59 | Missing! Should compute space much like subControlRect computations do 60 | 61 | CT_Q3DockWindow: Missing, along with other Q3DockWindow primitives. Need to test in 62 | designer to see if it's drawn OK. 63 | 64 | CT_HeaderSection: Hardcodes icon size instead of using PM_SmallIconSize. 65 | Probably should not apply the icon - text margin when there is no icon.. 66 | 67 | CT_LineEdit: should probably add it, especially if Oxygen needs it; 68 | unfortunately the QLineEdit internals seem to do some pretty weird stuff, 69 | hardcoding some margins and anything. But, well, a uniform margin model 70 | for this would be nice.. 71 | see also SE_LineEditContents.. 72 | 73 | CT_Menu: OK 74 | 75 | CT_Q3Header: 76 | Missing. Probably share code with CT_HeaderSection, or OK as-is? 77 | 78 | CT_MenuBar, CT_MenuItem: CT_MenuBarItem: OK 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /src/kstyle/kstyle.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | KStyle for KDE4 3 | SPDX-FileCopyrightText: 2004-2005 Maksim Orlovich 4 | SPDX-FileCopyrightText: 2005, 2006 Sandro Giessl 5 | 6 | Based in part on the following software: 7 | 8 | KStyle for KDE3 9 | SPDX-FileCopyrightText: 2001-2002 Karol Szwed 10 | Portions: 11 | SPDX-FileCopyrightText: 1998-2000 TrollTech AS 12 | 13 | Keramik for KDE3, 14 | SPDX-FileCopyrightText: 2002 Malte Starostik 15 | SPDX-FileCopyrightText: 2002-2003 Maksim Orlovich 16 | Portions: 17 | SPDX-FileCopyrightText: 2001-2002 Karol Szwed 18 | SPDX-FileCopyrightText: 2001-2002 Fredrik Höglund 19 | SPDX-FileCopyrightText: 2000 Daniel M. Duley 20 | SPDX-FileCopyrightText: 2000 Dirk Mueller 21 | SPDX-FileCopyrightText: 2001 Martijn Klingens 22 | SPDX-FileCopyrightText: 2003 Sandro Giessl 23 | 24 | Many thanks to Bradley T. Hughes for the 3 button scrollbar code. 25 | 26 | SPDX-License-Identifier: LGPL-2.0-or-later 27 | */ 28 | 29 | #include "kstyle.h" 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | // ---------------------------------------------------------------------------- 47 | 48 | static const QStyle::StyleHint SH_KCustomStyleElement = (QStyle::StyleHint)0xff000001; 49 | static const int X_KdeBase = 0xff000000; 50 | 51 | class KStylePrivate 52 | { 53 | public: 54 | KStylePrivate(); 55 | 56 | QHash styleElements; 57 | int hintCounter, controlCounter, subElementCounter; 58 | }; 59 | 60 | KStylePrivate::KStylePrivate() 61 | { 62 | controlCounter = subElementCounter = X_KdeBase; 63 | hintCounter = X_KdeBase + 1; // sic! X_KdeBase is covered by SH_KCustomStyleElement 64 | } 65 | 66 | /* 67 | The functions called by widgets that request custom element support, passed to the effective style. 68 | Collected in a static inline function due to similarity. 69 | */ 70 | 71 | static inline int customStyleElement(QStyle::StyleHint type, const QString &element, QWidget *widget) 72 | { 73 | if (!widget || widget->style()->metaObject()->indexOfClassInfo("X-KDE-CustomElements") < 0) { 74 | return 0; 75 | } 76 | 77 | const QString originalName = widget->objectName(); 78 | widget->setObjectName(element); 79 | const int id = widget->style()->styleHint(type, nullptr, widget); 80 | widget->setObjectName(originalName); 81 | return id; 82 | } 83 | 84 | QStyle::StyleHint KStyle::customStyleHint(const QString &element, const QWidget *widget) 85 | { 86 | return (StyleHint)customStyleElement(SH_KCustomStyleElement, element, const_cast(widget)); 87 | } 88 | 89 | QStyle::ControlElement KStyle::customControlElement(const QString &element, const QWidget *widget) 90 | { 91 | return (ControlElement)customStyleElement(SH_KCustomStyleElement, element, const_cast(widget)); 92 | } 93 | 94 | QStyle::SubElement KStyle::customSubElement(const QString &element, const QWidget *widget) 95 | { 96 | return (SubElement)customStyleElement(SH_KCustomStyleElement, element, const_cast(widget)); 97 | } 98 | 99 | KStyle::KStyle() 100 | : d(new KStylePrivate) 101 | { 102 | } 103 | 104 | KStyle::~KStyle() 105 | { 106 | delete d; 107 | } 108 | 109 | /* 110 | Custom Style Element runtime extension: 111 | We reserve one StyleHint to let the effective style inform widgets whether it supports certain 112 | string based style elements. 113 | As this could lead to number conflicts (i.e. an app utilizing one of the hints itself for other 114 | purposes) there're various safety mechanisms to rule out such interference. 115 | 116 | 1) It's most unlikely that a widget in some 3rd party app will accidentally call a general 117 | QStyle/KStyle styleHint() or draw*() and (unconditionally) expect a valid return, however: 118 | a. The StyleHint is not directly above Qt's custom base, assuming most 3rd party apps would 119 | - in case - make use of such 120 | b. In order to be accepted, the StyleHint query must pass a widget with a perfectly matching 121 | name, containing the typical element prefix ("CE_", etc.) and being supported by the current style 122 | c. Instead using Qt's fragile qstyleoption_cast on the QStyleOption provided to the StyleHint 123 | query, try to dump out a string and hope for the best, we now manipulate the widgets objectName(). 124 | Plain Qt dependent widgets can do that themselves and if a widget uses KStyle's convenience access 125 | functions, it won't notice this at all 126 | 127 | 2) The key problem is that a common KDE widget will run into an apps custom style which will then 128 | falsely respond to the styleHint() call with an invalid value. 129 | To prevent this, supporting styles *must* set a Q_CLASSINFO "X-KDE-CustomElements". 130 | 131 | 3) If any of the above traps snaps, the returned id is 0 - the QStyle default, indicating 132 | that this element is not supported by the current style. 133 | 134 | Obviously, this contains the "diminished clean" action to (temporarily) manipulate the 135 | objectName() of a const QWidget* - but this happens completely inside KStyle or the widget, if 136 | it does not make use of KStyles static convenience functions. 137 | My biggest worry here would be, that in a multithreaded environment a thread (usually not being 138 | owner of the widget) does something crucially relying on the widgets name property... 139 | This however would also have to happen during the widget construction or stylechanges, when 140 | the functions in doubt will typically be called. 141 | So this is imho unlikely causing any trouble, ever. 142 | */ 143 | 144 | /* 145 | The functions called by the real style implementation to add support for a certain element. 146 | Checks for well-formed string (containing the element prefix) and returns 0 otherwise. 147 | Checks whether the element is already supported or inserts it otherwise; Returns the proper id 148 | NOTICE: We could check for "X-KDE-CustomElements", but this would bloat style start up times 149 | (if they e.g. register 100 elements or so) 150 | */ 151 | 152 | static inline int newStyleElement(const QString &element, const char *check, int &counter, QHash *elements) 153 | { 154 | if (!element.contains(QLatin1String(check))) { 155 | return 0; 156 | } 157 | int id = elements->value(element, 0); 158 | if (!id) { 159 | ++counter; 160 | id = counter; 161 | elements->insert(element, id); 162 | } 163 | return id; 164 | } 165 | 166 | QStyle::StyleHint KStyle::newStyleHint(const QString &element) 167 | { 168 | return (StyleHint)newStyleElement(element, "SH_", d->hintCounter, &d->styleElements); 169 | } 170 | 171 | QStyle::ControlElement KStyle::newControlElement(const QString &element) 172 | { 173 | return (ControlElement)newStyleElement(element, "CE_", d->controlCounter, &d->styleElements); 174 | } 175 | 176 | KStyle::SubElement KStyle::newSubElement(const QString &element) 177 | { 178 | return (SubElement)newStyleElement(element, "SE_", d->subElementCounter, &d->styleElements); 179 | } 180 | 181 | void KStyle::polish(QWidget *w) 182 | { 183 | // Enable hover effects in all itemviews 184 | if (QAbstractItemView *itemView = qobject_cast(w)) { 185 | itemView->viewport()->setAttribute(Qt::WA_Hover); 186 | } 187 | 188 | if (QDialogButtonBox *box = qobject_cast(w)) { 189 | QPushButton *button = box->button(QDialogButtonBox::Ok); 190 | 191 | if (button) { 192 | auto shortcut = new QShortcut(Qt::CTRL | Qt::Key_Return, button); 193 | QObject::connect(shortcut, &QShortcut::activated, button, &QPushButton::click); 194 | } 195 | } 196 | if (auto messageWidget = qobject_cast(w)) { 197 | KColorScheme scheme; 198 | QColor color; 199 | QPalette palette = messageWidget->palette(); 200 | switch (messageWidget->messageType()) { 201 | case KMessageWidget::Positive: 202 | color = scheme.foreground(KColorScheme::PositiveText).color(); 203 | break; 204 | case KMessageWidget::Information: 205 | color = scheme.foreground(KColorScheme::ActiveText).color(); 206 | break; 207 | case KMessageWidget::Warning: 208 | color = scheme.foreground(KColorScheme::NeutralText).color(); 209 | break; 210 | case KMessageWidget::Error: 211 | color = scheme.foreground(KColorScheme::NegativeText).color(); 212 | break; 213 | } 214 | palette.setColor(QPalette::Window, color); 215 | messageWidget->setPalette(palette); 216 | } 217 | QCommonStyle::polish(w); 218 | } 219 | 220 | QPalette KStyle::standardPalette() const 221 | { 222 | return KColorScheme::createApplicationPalette(KSharedConfig::openConfig()); 223 | } 224 | 225 | QIcon KStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const 226 | { 227 | switch (standardIcon) { 228 | case QStyle::SP_DesktopIcon: 229 | return QIcon::fromTheme(QStringLiteral("user-desktop")); 230 | case QStyle::SP_TrashIcon: 231 | return QIcon::fromTheme(QStringLiteral("user-trash")); 232 | case QStyle::SP_ComputerIcon: 233 | return QIcon::fromTheme(QStringLiteral("computer")); 234 | case QStyle::SP_DriveFDIcon: 235 | return QIcon::fromTheme(QStringLiteral("media-floppy")); 236 | case QStyle::SP_DriveHDIcon: 237 | return QIcon::fromTheme(QStringLiteral("drive-harddisk")); 238 | case QStyle::SP_DriveCDIcon: 239 | case QStyle::SP_DriveDVDIcon: 240 | return QIcon::fromTheme(QStringLiteral("drive-optical")); 241 | case QStyle::SP_DriveNetIcon: 242 | return QIcon::fromTheme(QStringLiteral("folder-remote")); 243 | case QStyle::SP_DirHomeIcon: 244 | return QIcon::fromTheme(QStringLiteral("user-home")); 245 | case QStyle::SP_DirOpenIcon: 246 | return QIcon::fromTheme(QStringLiteral("document-open-folder")); 247 | case QStyle::SP_DirClosedIcon: 248 | return QIcon::fromTheme(QStringLiteral("folder")); 249 | case QStyle::SP_DirIcon: 250 | return QIcon::fromTheme(QStringLiteral("folder")); 251 | case QStyle::SP_DirLinkIcon: 252 | return QIcon::fromTheme(QStringLiteral("folder")); // TODO: generate (!?) folder with link emblem 253 | case QStyle::SP_FileIcon: 254 | return QIcon::fromTheme(QStringLiteral("text-plain")); // TODO: look for a better icon 255 | case QStyle::SP_FileLinkIcon: 256 | return QIcon::fromTheme(QStringLiteral("text-plain")); // TODO: generate (!?) file with link emblem 257 | case QStyle::SP_FileDialogStart: 258 | return QIcon::fromTheme(QStringLiteral("media-playback-start")); // TODO: find correct icon 259 | case QStyle::SP_FileDialogEnd: 260 | return QIcon::fromTheme(QStringLiteral("media-playback-stop")); // TODO: find correct icon 261 | case QStyle::SP_FileDialogToParent: 262 | return QIcon::fromTheme(QStringLiteral("go-up")); 263 | case QStyle::SP_FileDialogNewFolder: 264 | return QIcon::fromTheme(QStringLiteral("folder-new")); 265 | case QStyle::SP_FileDialogDetailedView: 266 | return QIcon::fromTheme(QStringLiteral("view-list-details")); 267 | case QStyle::SP_FileDialogInfoView: 268 | return QIcon::fromTheme(QStringLiteral("document-properties")); 269 | case QStyle::SP_FileDialogContentsView: 270 | return QIcon::fromTheme(QStringLiteral("view-list-icons")); 271 | case QStyle::SP_FileDialogListView: 272 | return QIcon::fromTheme(QStringLiteral("view-list-text")); 273 | case QStyle::SP_FileDialogBack: 274 | return QIcon::fromTheme(QStringLiteral("go-previous")); 275 | case QStyle::SP_MessageBoxInformation: 276 | return QIcon::fromTheme(QStringLiteral("dialog-information")); 277 | case QStyle::SP_MessageBoxWarning: 278 | return QIcon::fromTheme(QStringLiteral("dialog-warning")); 279 | case QStyle::SP_MessageBoxCritical: 280 | return QIcon::fromTheme(QStringLiteral("dialog-error")); 281 | case QStyle::SP_MessageBoxQuestion: 282 | // This used to be dialog-information for a long time, so keep it as a fallback 283 | return QIcon::fromTheme(QStringLiteral("dialog-question"), QIcon::fromTheme(QStringLiteral("dialog-information"))); 284 | case QStyle::SP_DialogOkButton: 285 | return QIcon::fromTheme(QStringLiteral("dialog-ok")); 286 | case QStyle::SP_DialogCancelButton: 287 | return QIcon::fromTheme(QStringLiteral("dialog-cancel")); 288 | case QStyle::SP_DialogHelpButton: 289 | return QIcon::fromTheme(QStringLiteral("help-contents")); 290 | case QStyle::SP_DialogOpenButton: 291 | return QIcon::fromTheme(QStringLiteral("document-open")); 292 | case QStyle::SP_DialogSaveButton: 293 | return QIcon::fromTheme(QStringLiteral("document-save")); 294 | case QStyle::SP_DialogCloseButton: 295 | return QIcon::fromTheme(QStringLiteral("dialog-close")); 296 | case QStyle::SP_DialogApplyButton: 297 | return QIcon::fromTheme(QStringLiteral("dialog-ok-apply")); 298 | case QStyle::SP_DialogResetButton: 299 | return QIcon::fromTheme(QStringLiteral("edit-undo")); 300 | case QStyle::SP_DialogDiscardButton: 301 | return QIcon::fromTheme(QStringLiteral("edit-delete")); 302 | case QStyle::SP_DialogYesButton: 303 | return QIcon::fromTheme(QStringLiteral("dialog-ok-apply")); 304 | case QStyle::SP_DialogNoButton: 305 | return QIcon::fromTheme(QStringLiteral("dialog-cancel")); 306 | case QStyle::SP_ArrowUp: 307 | return QIcon::fromTheme(QStringLiteral("go-up")); 308 | case QStyle::SP_ArrowDown: 309 | return QIcon::fromTheme(QStringLiteral("go-down")); 310 | case QStyle::SP_ArrowLeft: 311 | return QIcon::fromTheme(QStringLiteral("go-previous-view")); 312 | case QStyle::SP_ArrowRight: 313 | return QIcon::fromTheme(QStringLiteral("go-next-view")); 314 | case QStyle::SP_ArrowBack: 315 | return QIcon::fromTheme(QStringLiteral("go-previous")); 316 | case QStyle::SP_ArrowForward: 317 | return QIcon::fromTheme(QStringLiteral("go-next")); 318 | case QStyle::SP_BrowserReload: 319 | return QIcon::fromTheme(QStringLiteral("view-refresh")); 320 | case QStyle::SP_BrowserStop: 321 | return QIcon::fromTheme(QStringLiteral("process-stop")); 322 | case QStyle::SP_MediaPlay: 323 | return QIcon::fromTheme(QStringLiteral("media-playback-start")); 324 | case QStyle::SP_MediaStop: 325 | return QIcon::fromTheme(QStringLiteral("media-playback-stop")); 326 | case QStyle::SP_MediaPause: 327 | return QIcon::fromTheme(QStringLiteral("media-playback-pause")); 328 | case QStyle::SP_MediaSkipForward: 329 | return QIcon::fromTheme(QStringLiteral("media-skip-forward")); 330 | case QStyle::SP_MediaSkipBackward: 331 | return QIcon::fromTheme(QStringLiteral("media-skip-backward")); 332 | case QStyle::SP_MediaSeekForward: 333 | return QIcon::fromTheme(QStringLiteral("media-seek-forward")); 334 | case QStyle::SP_MediaSeekBackward: 335 | return QIcon::fromTheme(QStringLiteral("media-seek-backward")); 336 | case QStyle::SP_MediaVolume: 337 | return QIcon::fromTheme(QStringLiteral("audio-volume-medium")); 338 | case QStyle::SP_MediaVolumeMuted: 339 | return QIcon::fromTheme(QStringLiteral("audio-volume-muted")); 340 | case SP_LineEditClearButton: { 341 | const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft()); 342 | 343 | const QString directionalThemeName = rtl ? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl"); 344 | 345 | return QIcon::fromTheme(directionalThemeName, QIcon::fromTheme(QStringLiteral("edit-clear"))); 346 | } 347 | case QStyle::SP_DialogYesToAllButton: 348 | return QIcon::fromTheme(QStringLiteral("dialog-ok")); 349 | case QStyle::SP_DialogNoToAllButton: 350 | return QIcon::fromTheme(QStringLiteral("dialog-cancel")); 351 | case QStyle::SP_DialogSaveAllButton: 352 | return QIcon::fromTheme(QStringLiteral("document-save-all")); 353 | case QStyle::SP_DialogAbortButton: 354 | return QIcon::fromTheme(QStringLiteral("dialog-cancel")); 355 | case QStyle::SP_DialogRetryButton: 356 | return QIcon::fromTheme(QStringLiteral("view-refresh")); 357 | case QStyle::SP_DialogIgnoreButton: 358 | return QIcon::fromTheme(QStringLiteral("dialog-cancel")); 359 | case QStyle::SP_RestoreDefaultsButton: 360 | return QIcon::fromTheme(QStringLiteral("document-revert")); 361 | 362 | default: 363 | break; 364 | } 365 | 366 | return QCommonStyle::standardIcon(standardIcon, option, widget); 367 | } 368 | 369 | int KStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const 370 | { 371 | switch (hint) { 372 | case SH_DialogButtonBox_ButtonsHaveIcons: { 373 | // was KGlobalSettings::showIconsOnPushButtons() : 374 | KConfigGroup g(KSharedConfig::openConfig(), QStringLiteral("KDE")); 375 | return g.readEntry("ShowIconsOnPushButtons", true); 376 | } 377 | 378 | case SH_ItemView_ArrowKeysNavigateIntoChildren: 379 | return true; 380 | 381 | case SH_Widget_Animate: { 382 | KConfigGroup g(KSharedConfig::openConfig(), QStringLiteral("KDE-Global GUI Settings")); 383 | return g.readEntry("GraphicEffectsLevel", true); 384 | } 385 | 386 | case QStyle::SH_Menu_SubMenuSloppyCloseTimeout: 387 | return 300; 388 | 389 | case SH_ToolButtonStyle: { 390 | KConfigGroup g(KSharedConfig::openConfig(), QStringLiteral("Toolbar style")); 391 | 392 | bool useOthertoolbars = false; 393 | const QWidget *parent = widget ? widget->parentWidget() : nullptr; 394 | 395 | // If the widget parent is a QToolBar and the magic property is set 396 | if (parent && qobject_cast(parent)) { 397 | if (parent->property("otherToolbar").isValid()) { 398 | useOthertoolbars = true; 399 | } 400 | } 401 | 402 | QString buttonStyle; 403 | if (useOthertoolbars) { 404 | buttonStyle = g.readEntry("ToolButtonStyleOtherToolbars", "NoText").toLower(); 405 | } else { 406 | buttonStyle = g.readEntry("ToolButtonStyle", "TextBesideIcon").toLower(); 407 | } 408 | 409 | return buttonStyle == QLatin1String("textbesideicon") ? Qt::ToolButtonTextBesideIcon 410 | : buttonStyle == QLatin1String("icontextright") ? Qt::ToolButtonTextBesideIcon 411 | : buttonStyle == QLatin1String("textundericon") ? Qt::ToolButtonTextUnderIcon 412 | : buttonStyle == QLatin1String("icontextbottom") ? Qt::ToolButtonTextUnderIcon 413 | : buttonStyle == QLatin1String("textonly") ? Qt::ToolButtonTextOnly 414 | : Qt::ToolButtonIconOnly; 415 | } 416 | 417 | case SH_KCustomStyleElement: 418 | if (!widget) { 419 | return 0; 420 | } 421 | 422 | return d->styleElements.value(widget->objectName(), 0); 423 | 424 | case SH_ScrollBar_LeftClickAbsolutePosition: { 425 | KConfigGroup g(KSharedConfig::openConfig(), QStringLiteral("KDE")); 426 | return !g.readEntry("ScrollbarLeftClickNavigatesByPage", false); 427 | } 428 | 429 | default: 430 | break; 431 | }; 432 | 433 | return QCommonStyle::styleHint(hint, option, widget, returnData); 434 | } 435 | 436 | int KStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const 437 | { 438 | switch (metric) { 439 | case PM_SmallIconSize: 440 | case PM_ButtonIconSize: 441 | return KIconLoader::global()->currentSize(KIconLoader::Small); 442 | 443 | case PM_ToolBarIconSize: 444 | return KIconLoader::global()->currentSize(KIconLoader::Toolbar); 445 | 446 | case PM_LargeIconSize: 447 | return KIconLoader::global()->currentSize(KIconLoader::Dialog); 448 | 449 | case PM_MessageBoxIconSize: 450 | // TODO return KIconLoader::global()->currentSize(KIconLoader::MessageBox); 451 | return KIconLoader::SizeHuge; 452 | default: 453 | break; 454 | } 455 | 456 | return QCommonStyle::pixelMetric(metric, option, widget); 457 | } 458 | 459 | #include "moc_kstyle.cpp" 460 | -------------------------------------------------------------------------------- /src/kstyle/kstyle.h: -------------------------------------------------------------------------------- 1 | /* 2 | KStyle for KDE5 (KDE Integration) 3 | SPDX-FileCopyrightText: 2013 Alejandro Fiestas Olivares 4 | 5 | KStyle for KDE4 6 | SPDX-FileCopyrightText: 2004-2005 Maksim Orlovich 7 | SPDX-FileCopyrightText: 2005, 2006 Sandro Giessl 8 | 9 | Based in part on the following software: 10 | 11 | KStyle for KDE3 12 | SPDX-FileCopyrightText: 2001-2002 Karol Szwed 13 | Portions 14 | SPDX-FileCopyrightText: 1998-2000 TrollTech AS 15 | 16 | Keramik for KDE3, 17 | SPDX-FileCopyrightText: 2002 Malte Starostik 18 | SPDX-FileCopyrightText: 2002-2003 Maksim Orlovich 19 | Portions 20 | SPDX-FileCopyrightText: 2001-2002 Karol Szwed 21 | SPDX-FileCopyrightText: 2001-2002 Fredrik Höglund 22 | SPDX-FileCopyrightText: 2000 Daniel M. Duley 23 | SPDX-FileCopyrightText: 2000 Dirk Mueller 24 | SPDX-FileCopyrightText: 2001 Martijn Klingens 25 | SPDX-FileCopyrightText: 2003 Sandro Giessl 26 | 27 | SPDX-License-Identifier: LGPL-2.0-or-later 28 | */ 29 | 30 | #ifndef KDE_KSTYLE_H 31 | #define KDE_KSTYLE_H 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | class KStylePrivate; 39 | 40 | /*! 41 | * \class KStyle 42 | * \inmodule KStyle 43 | * 44 | * \brief Provides integration with KDE Plasma Workspace settings for Qt styles. 45 | * 46 | * Derive your Qt style from KStyle to automatically inherit 47 | * various settings from the KDE Plasma Workspace, providing a 48 | * consistent user experience. For example, this will ensure a 49 | * consistent single-click or double-click activation setting, 50 | * and the use of standard themed icons. 51 | */ 52 | class KSTYLE_EXPORT KStyle : public QCommonStyle 53 | { 54 | Q_OBJECT 55 | 56 | public: 57 | KStyle(); 58 | ~KStyle() override; 59 | 60 | /*! 61 | * Runtime element extension 62 | * This is just convenience and does /not/ require the using widgets style to inherit KStyle 63 | * (i.e. calling this while using cleanlooks won't segfault or so but just return 0) 64 | * Returns a unique id for an element string (e.g. "CE_CapacityBar") 65 | * 66 | * For simplicity, only StyleHints, ControlElements and their SubElements are supported 67 | * If you don't need extended SubElement functionality, just drop it 68 | * 69 | * \a element The style element, represented as string. 70 | * Naming convention: "appname.(2-char-element-type)_element" 71 | * where the 2-char-element-type is of {SH, CE, SE} 72 | * (widgets in kdelibs don't have to pass the appname) 73 | * examples: "CE_CapacityBar", "amarok.CE_Analyzer" 74 | * 75 | * \a widget Your widget ("this") passing this is mandatory, passing NULL will just return 0 76 | * 77 | * Returns a unique id for the \a element string or 0, if the element is not supported by the 78 | * widgets current style 79 | * 80 | * Important notes: 81 | * 82 | * 1) If your string lacks the matching "SH_", "CE_" or "SE_" token the element 83 | * request will be ignored (return is 0) 84 | * 85 | * 2) Try to avoid custom elements and use default ones (if possible) to get better style support 86 | * and keep UI coherency 87 | * 88 | * 3) If you cache this value (good idea, this requires a map lookup) don't (!) forget to catch 89 | * style changes in QWidget::changeEvent() 90 | */ 91 | static StyleHint customStyleHint(const QString &element, const QWidget *widget); 92 | 93 | /*! 94 | * 95 | */ 96 | static ControlElement customControlElement(const QString &element, const QWidget *widget); 97 | 98 | /*! 99 | * 100 | */ 101 | static SubElement customSubElement(const QString &element, const QWidget *widget); 102 | 103 | protected: 104 | /*! 105 | * Runtime element extension, allows inheriting styles to add support custom elements 106 | * merges supporting inherit chains 107 | * Supposed to be called e.g. in your constructor. 108 | * 109 | * NOTICE: in order to have this work, your style must provide 110 | * an "X-KDE-CustomElements" classinfo, i.e. 111 | * \code 112 | * class MyStyle : public KStyle 113 | * { 114 | * Q_OBJECT 115 | * Q_CLASSINFO ("X-KDE-CustomElements", "true") 116 | * 117 | * public: 118 | * ..... 119 | * } 120 | * \endcode 121 | * 122 | * \a element The style element, represented as string. 123 | * Suggested naming convention: appname.(2-char-element-type)_element 124 | * where the 2-char-element-type is of {SH, CE, SE} 125 | * widgets in kdelibs don't have to pass the appname 126 | * examples: "CE_CapacityBar", "amarok.CE_Analyzer" 127 | * 128 | * Important notes: 129 | * 1) If your string lacks the matching "SH_", "CE_" or "SE_" token the element 130 | * request will be ignored (return is 0) 131 | * 2) To keep UI coherency, don't support any nonsense in your style, but convince app developers 132 | * to use standard elements - if available 133 | */ 134 | StyleHint newStyleHint(const QString &element); 135 | 136 | /*! 137 | * 138 | */ 139 | ControlElement newControlElement(const QString &element); 140 | 141 | /*! 142 | * 143 | */ 144 | SubElement newSubElement(const QString &element); 145 | 146 | public: 147 | int pixelMetric(PixelMetric m, const QStyleOption *opt = nullptr, const QWidget *widget = nullptr) const override; 148 | int styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *returnData) const override; 149 | 150 | void polish(QWidget *) override; 151 | using QCommonStyle::polish; // needed to avoid warnings at compilation time 152 | 153 | QPalette standardPalette() const override; 154 | 155 | QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const override; 156 | 157 | private: 158 | KStylePrivate *const d; 159 | }; 160 | 161 | #endif // KDE_KSTYLE_H 162 | -------------------------------------------------------------------------------- /src/kstyle/kstyle.qdoc: -------------------------------------------------------------------------------- 1 | /*! 2 | \module KStyle 3 | \title KStyle C++ Classes 4 | \ingroup modules 5 | \cmakepackage KF6 6 | \cmakecomponent FrameworkIntegration 7 | \cmaketargetitem KF6::Style 8 | 9 | \brief Integration of Qt application with KDE workspaces. 10 | 11 | Provides integration with KDE Plasma Workspace 12 | settings for Qt styles. 13 | 14 | Derive your Qt style from KStyle to automatically inherit various 15 | settings from the KDE Plasma Workspace, providing a consistent user 16 | experience. For example, this will ensure a consistent single-click 17 | or double-click activation setting, and the use of standard themed 18 | icons. 19 | */ 20 | -------------------------------------------------------------------------------- /src/kstyle/kstyle.qdocconf: -------------------------------------------------------------------------------- 1 | include($KDE_DOCS/global/qt-module-defaults.qdocconf) 2 | 3 | project = KStyle 4 | description = Integration of Qt application with KDE workspaces 5 | 6 | documentationinheaders = true 7 | 8 | headerdirs += . 9 | sourcedirs += . 10 | 11 | outputformats = HTML 12 | 13 | depends += \ 14 | kde \ 15 | qtcore \ 16 | qtwidgets 17 | 18 | navigation.landingpage = "FrameworkIntegration" 19 | 20 | qhp.projects = KStyle 21 | 22 | qhp.KStyle.file = kstyle.qhp 23 | qhp.KStyle.namespace = org.kde.kstyle.$QT_VERSION_TAG 24 | qhp.KStyle.virtualFolder = kstyle 25 | qhp.KStyle.indexTitle = KStyle 26 | qhp.KStyle.indexRoot = 27 | 28 | qhp.KStyle.subprojects = classes 29 | qhp.KStyle.subprojects.classes.title = C++ Classes 30 | qhp.KStyle.subprojects.classes.indexTitle = KStyle C++ Classes 31 | qhp.KStyle.subprojects.classes.selectors = class fake:headerfile 32 | qhp.KStyle.subprojects.classes.sortPages = true 33 | 34 | tagfile = kstyle.tags 35 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(kstyletest kstyletest.cpp) 2 | target_link_libraries(kstyletest Qt6::Widgets KF6::Style) 3 | 4 | -------------------------------------------------------------------------------- /tests/kstyletest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | KStyle for KF5 3 | SPDX-FileCopyrightText: 2013 Aleix Pol Gonzalez 4 | 5 | SPDX-License-Identifier: LGPL-2.0-or-later 6 | */ 7 | 8 | #include "kstyle.h" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | void showDialog() 20 | { 21 | QDialog dialog; 22 | 23 | auto *layout = new QVBoxLayout(&dialog); 24 | 25 | QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok, &dialog); 26 | 27 | // Useful to change the text because setting the text triggers setShortcut 28 | box->button(QDialogButtonBox::Ok)->setText(QStringLiteral("Send")); 29 | QObject::connect(box, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); 30 | QObject::connect(box, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); 31 | 32 | auto usefulWidget = new QTextEdit(&dialog); 33 | layout->addWidget(usefulWidget); 34 | layout->addWidget(box); 35 | 36 | // Make sure we test ctrl+return acceptance with the focus on the button 37 | usefulWidget->setFocus(); 38 | 39 | dialog.resize(200, 200); 40 | dialog.exec(); 41 | } 42 | 43 | int main(int argc, char **argv) 44 | { 45 | QApplication app(argc, argv); 46 | app.setStyle(new KStyle); 47 | 48 | QWidget w; 49 | auto *layout = new QVBoxLayout(&w); 50 | 51 | QPushButton *showDialogButton = new QPushButton(QStringLiteral("Dialog"), &w); 52 | QObject::connect(showDialogButton, &QPushButton::clicked, &showDialog); 53 | layout->addWidget(showDialogButton); 54 | w.resize(200, 200); 55 | w.show(); 56 | 57 | return app.exec(); 58 | } 59 | --------------------------------------------------------------------------------