Import Upstream version 5.92.0
|
@ -0,0 +1,2 @@
|
|||
#clang-format
|
||||
31ba7764665ccacb0a2da9c40fdc49083b5decd0
|
|
@ -0,0 +1,28 @@
|
|||
# Ignore the following files
|
||||
*~
|
||||
*.[oa]
|
||||
*.diff
|
||||
*.kate-swp
|
||||
*.kdev4
|
||||
.kdev_include_paths
|
||||
*.kdevelop.pcs
|
||||
*.moc
|
||||
*.moc.cpp
|
||||
*.orig
|
||||
*.user
|
||||
.*.swp
|
||||
.swp.*
|
||||
Doxyfile
|
||||
Makefile
|
||||
avail
|
||||
random_seed
|
||||
/build*/
|
||||
CMakeLists.txt.user*
|
||||
*.unc-backup*
|
||||
.cmake/
|
||||
/.clang-format
|
||||
/compile_commands.json
|
||||
.clangd
|
||||
.idea
|
||||
/cmake-build*
|
||||
.cache
|
|
@ -0,0 +1,7 @@
|
|||
# SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
include:
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux.yml
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux-qt6.yml
|
|
@ -0,0 +1,20 @@
|
|||
Dependencies:
|
||||
- 'on': ['Linux', 'FreeBSD', 'Windows', 'macOS']
|
||||
'require':
|
||||
'frameworks/extra-cmake-modules': '@same'
|
||||
'frameworks/ki18n' : '@same'
|
||||
'frameworks/kguiaddons' : '@same'
|
||||
'frameworks/kwidgetsaddons' : '@same'
|
||||
'frameworks/kconfigwidgets' : '@same'
|
||||
'frameworks/kitemviews' : '@same'
|
||||
'frameworks/kconfig' : '@same'
|
||||
'frameworks/kiconthemes' : '@same'
|
||||
'frameworks/knotifications' : '@same'
|
||||
'frameworks/ki18n' : '@same'
|
||||
'frameworks/kio' : '@same'
|
||||
'frameworks/oxygen-icons5' : '@same'
|
||||
'frameworks/kpackage' : '@same'
|
||||
'frameworks/knewstuff' : '@same'
|
||||
|
||||
Options:
|
||||
test-before-installing: True
|
|
@ -0,0 +1,82 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(KF_VERSION "5.92.0") # handled by release scripts
|
||||
set(KF_DEP_VERSION "5.92.0") # handled by release scripts
|
||||
project(FrameworkIntegration VERSION ${KF_VERSION})
|
||||
|
||||
include(FeatureSummary)
|
||||
find_package(ECM 5.92.0 NO_MODULE)
|
||||
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
|
||||
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
|
||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
|
||||
|
||||
|
||||
include(GenerateExportHeader)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(ECMSetupVersion)
|
||||
include(ECMGenerateHeaders)
|
||||
|
||||
include(KDEInstallDirs)
|
||||
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
|
||||
include(KDECMakeSettings)
|
||||
include(KDEGitCommitHooks)
|
||||
|
||||
set(REQUIRED_QT_VERSION 5.15.2)
|
||||
find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG REQUIRED Gui Widgets)
|
||||
|
||||
|
||||
ecm_setup_version(PROJECT VARIABLE_PREFIX FRAMEWORKINTEGRATION
|
||||
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/frameworkintegration_version.h"
|
||||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5FrameworkIntegrationConfigVersion.cmake"
|
||||
SOVERSION 5)
|
||||
|
||||
find_package(KF5Config ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF5ConfigWidgets ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF5IconThemes ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF5Notifications ${KF_DEP_VERSION} REQUIRED)
|
||||
|
||||
|
||||
option(BUILD_KPACKAGE_INSTALL_HANDLERS "Build the KPackage install handler binaries (recommended)" ON)
|
||||
if (BUILD_KPACKAGE_INSTALL_HANDLERS)
|
||||
find_package(KF5NewStuff ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF5WidgetsAddons ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF5Package ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF5I18n ${KF_DEP_VERSION} REQUIRED)
|
||||
|
||||
find_package(packagekitqt${QT_MAJOR_VERSION})
|
||||
find_package(AppStreamQt 0.10.4)
|
||||
endif()
|
||||
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f02)
|
||||
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055900)
|
||||
add_subdirectory(src)
|
||||
if (BUILD_TESTING)
|
||||
add_subdirectory(autotests)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
# create a Config.cmake and a ConfigVersion.cmake file and install them
|
||||
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5FrameworkIntegration")
|
||||
|
||||
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF5FrameworkIntegrationConfig.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/KF5FrameworkIntegrationConfig.cmake"
|
||||
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
|
||||
)
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5FrameworkIntegrationConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/KF5FrameworkIntegrationConfigVersion.cmake"
|
||||
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
|
||||
COMPONENT Devel )
|
||||
|
||||
install(EXPORT KF5FrameworkIntegrationTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5FrameworkIntegrationTargets.cmake NAMESPACE KF5:: )
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/frameworkintegration_version.h
|
||||
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/FrameworkIntegration COMPONENT Devel)
|
||||
|
||||
install(FILES plasma_workspace.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR})
|
||||
|
||||
|
||||
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
|
|
@ -0,0 +1,8 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(KF5ConfigWidgets "@KF_DEP_VERSION@")
|
||||
find_dependency(KF5IconThemes "@KF_DEP_VERSION@")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/KF5FrameworkIntegrationTargets.cmake")
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
|
@ -0,0 +1,446 @@
|
|||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is numbered 2 because
|
||||
it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public Licenses are intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some specially
|
||||
designated Free Software Foundation software, and to any other libraries whose
|
||||
authors decide to use it. You can use it for your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our
|
||||
General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish), that you receive source code or can get it if you want it, that you
|
||||
can change the software or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis or for
|
||||
a fee, you must give the recipients all the rights that we gave you. You must
|
||||
make sure that they, too, receive or can get the source code. If you link
|
||||
a program with the library, you must provide complete object files to the
|
||||
recipients so that they can relink them with the library, after making changes
|
||||
to the library and recompiling it. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright the library,
|
||||
and (2) offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain that everyone
|
||||
understands that there is no warranty for this free library. If the library
|
||||
is modified by someone else and passed on, we want its recipients to know
|
||||
that what they have is not the original version, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that companies distributing free software will individually
|
||||
obtain patent licenses, thus in effect transforming the program into proprietary
|
||||
software. To prevent this, we have made it clear that any patent must be licensed
|
||||
for everyone's free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License, which was designed for utility programs. This license,
|
||||
the GNU Library General Public License, applies to certain designated libraries.
|
||||
This license is quite different from the ordinary one; be sure to read it
|
||||
in full, and don't assume that anything in it is the same as in the ordinary
|
||||
license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that they
|
||||
blur the distinction we usually make between modifying or adding to a program
|
||||
and simply using it. Linking a program with a library, without changing the
|
||||
library, is in some sense simply using the library, and is analogous to running
|
||||
a utility program or application program. However, in a textual and legal
|
||||
sense, the linked executable is a combined work, a derivative of the original
|
||||
library, and the ordinary General Public License treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General Public License
|
||||
for libraries did not effectively promote software sharing, because most developers
|
||||
did not use the libraries. We concluded that weaker conditions might promote
|
||||
sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the users
|
||||
of those programs of all benefit from the free status of the libraries themselves.
|
||||
This Library General Public License is intended to permit developers of non-free
|
||||
programs to use free libraries, while preserving your freedom as a user of
|
||||
such programs to change the free libraries that are incorporated in them.
|
||||
(We have not seen how to achieve this as regards changes in header files,
|
||||
but we have achieved it as regards changes in the actual functions of the
|
||||
Library.) The hope is that this will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow. Pay close attention to the difference between a "work based on the
|
||||
library" and a "work that uses the library". The former contains code derived
|
||||
from the library, while the latter only works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary General
|
||||
Public License rather than by this special one.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which contains a
|
||||
notice placed by the copyright holder or other authorized party saying it
|
||||
may be distributed under the terms of this Library General Public License
|
||||
(also called "this License"). Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data prepared
|
||||
so as to be conveniently linked with application programs (which use some
|
||||
of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work which has
|
||||
been distributed under these terms. A "work based on the Library" means either
|
||||
the Library or any derivative work under copyright law: that is to say, a
|
||||
work containing the Library or a portion of it, either verbatim or with modifications
|
||||
and/or translated straightforwardly into another language. (Hereinafter, translation
|
||||
is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for making modifications
|
||||
to it. For a library, complete source code means all the source code for all
|
||||
modules it contains, plus any associated interface definition files, plus
|
||||
the scripts used to control compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running a program
|
||||
using the Library is not restricted, and output from such a program is covered
|
||||
only if its contents constitute a work based on the Library (independent of
|
||||
the use of the Library in a tool for writing it). Whether that is true depends
|
||||
on what the Library does and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and disclaimer
|
||||
of warranty; keep intact all the notices that refer to this License and to
|
||||
the absence of any warranty; and distribute a copy of this License along with
|
||||
the Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion of it,
|
||||
thus forming a work based on the Library, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge to all
|
||||
third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a table of
|
||||
data to be supplied by an application program that uses the facility, other
|
||||
than as an argument passed when the facility is invoked, then you must make
|
||||
a good faith effort to ensure that, in the event an application does not supply
|
||||
such function or table, the facility still operates, and performs whatever
|
||||
part of its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has a purpose
|
||||
that is entirely well-defined independent of the application. Therefore, Subsection
|
||||
2d requires that any application-supplied function or table used by this function
|
||||
must be optional: if the application does not supply it, the square root function
|
||||
must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Library, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Library, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library with
|
||||
the Library (or with a work based on the Library) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License
|
||||
instead of this License to a given copy of the Library. To do this, you must
|
||||
alter all the notices that refer to this License, so that they refer to the
|
||||
ordinary GNU General Public License, version 2, instead of to this License.
|
||||
(If a newer version than version 2 of the ordinary GNU General Public License
|
||||
has appeared, then you can specify that version instead if you wish.) Do not
|
||||
make any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for that copy,
|
||||
so the ordinary GNU General Public License applies to all subsequent copies
|
||||
and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the Library
|
||||
into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative of
|
||||
it, under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you accompany it with the complete corresponding
|
||||
machine-readable source code, which must be distributed under the terms of
|
||||
Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy from a designated
|
||||
place, then offering equivalent access to copy the source code from the same
|
||||
place satisfies the requirement to distribute the source code, even though
|
||||
third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library, but
|
||||
is designed to work with the Library by being compiled or linked with it,
|
||||
is called a "work that uses the Library". Such a work, in isolation, is not
|
||||
a derivative work of the Library, and therefore falls outside the scope of
|
||||
this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library creates an
|
||||
executable that is a derivative of the Library (because it contains portions
|
||||
of the Library), rather than a "work that uses the library". The executable
|
||||
is therefore covered by this License. Section 6 states terms for distribution
|
||||
of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file that
|
||||
is part of the Library, the object code for the work may be a derivative work
|
||||
of the Library even though the source code is not. Whether this is true is
|
||||
especially significant if the work can be linked without the Library, or if
|
||||
the work is itself a library. The threshold for this to be true is not precisely
|
||||
defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure layouts
|
||||
and accessors, and small macros and small inline functions (ten lines or less
|
||||
in length), then the use of the object file is unrestricted, regardless of
|
||||
whether it is legally a derivative work. (Executables containing this object
|
||||
code plus portions of the Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute
|
||||
the object code for the work under the terms of Section 6. Any executables
|
||||
containing that work also fall under Section 6, whether or not they are linked
|
||||
directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or link a "work
|
||||
that uses the Library" with the Library to produce a work containing portions
|
||||
of the Library, and distribute that work under terms of your choice, provided
|
||||
that the terms permit modification of the work for the customer's own use
|
||||
and reverse engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
You must supply a copy of this License. If the work during execution displays
|
||||
copyright notices, you must include the copyright notice for the Library among
|
||||
them, as well as a reference directing the user to the copy of this License.
|
||||
Also, you must do one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding machine-readable source
|
||||
code for the Library including whatever changes were used in the work (which
|
||||
must be distributed under Sections 1 and 2 above); and, if the work is an
|
||||
executable linked with the Library, with the complete machine-readable "work
|
||||
that uses the Library", as object code and/or source code, so that the user
|
||||
can modify the Library and then relink to produce a modified executable containing
|
||||
the modified Library. (It is understood that the user who changes the contents
|
||||
of definitions files in the Library will not necessarily be able to recompile
|
||||
the application to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at least three years,
|
||||
to give the same user the materials specified in Subsection 6a, above, for
|
||||
a charge no more than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy from a designated
|
||||
place, offer equivalent access to copy the above specified materials from
|
||||
the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these materials or
|
||||
that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the Library" must
|
||||
include any data and utility programs needed for reproducing the executable
|
||||
from it. However, as a special exception, the source code distributed need
|
||||
not include anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the operating
|
||||
system on which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license restrictions of
|
||||
other proprietary libraries that do not normally accompany the operating system.
|
||||
Such a contradiction means you cannot use both them and the Library together
|
||||
in an executable that you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the Library side-by-side
|
||||
in a single library together with other library facilities not covered by
|
||||
this License, and distribute such a combined library, provided that the separate
|
||||
distribution of the work based on the Library and of the other library facilities
|
||||
is otherwise permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities. This must be distributed
|
||||
under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact that part of
|
||||
it is a work based on the Library, and explaining where to find the accompanying
|
||||
uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library
|
||||
except as expressly provided under this License. Any attempt otherwise to
|
||||
copy, modify, sublicense, link with, or distribute the Library is void, and
|
||||
will automatically terminate your rights under this License. However, parties
|
||||
who have received copies, or rights, from you under this License will not
|
||||
have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Library or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Library
|
||||
(or any work based on the Library), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the Library),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute, link with or modify the Library subject to these terms
|
||||
and conditions. You may not impose any further restrictions on the recipients'
|
||||
exercise of the rights granted herein. You are not responsible for enforcing
|
||||
compliance by third parties to this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Library at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Library
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Library under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new versions of
|
||||
the Library General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Library does not specify a license version number, you may choose any version
|
||||
ever published by the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free programs
|
||||
whose distribution conditions are incompatible with these, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free Software
|
||||
Foundation, write to the Free Software Foundation; we sometimes make exceptions
|
||||
for this. Our decision will be guided by the two goals of preserving the free
|
||||
status of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest possible
|
||||
use to the public, we recommend making it free software that everyone can
|
||||
redistribute and change. You can do so by permitting redistribution under
|
||||
these terms (or, alternatively, under the terms of the ordinary General Public
|
||||
License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is safest
|
||||
to attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the "copyright"
|
||||
line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the library's name and an idea of what it does.
|
||||
|
||||
Copyright (C) year name of author
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Library General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
|
||||
by James Random Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1990
|
||||
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
|
@ -0,0 +1,446 @@
|
|||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is numbered 2 because
|
||||
it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public Licenses are intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some specially
|
||||
designated Free Software Foundation software, and to any other libraries whose
|
||||
authors decide to use it. You can use it for your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our
|
||||
General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish), that you receive source code or can get it if you want it, that you
|
||||
can change the software or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis or for
|
||||
a fee, you must give the recipients all the rights that we gave you. You must
|
||||
make sure that they, too, receive or can get the source code. If you link
|
||||
a program with the library, you must provide complete object files to the
|
||||
recipients so that they can relink them with the library, after making changes
|
||||
to the library and recompiling it. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright the library,
|
||||
and (2) offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain that everyone
|
||||
understands that there is no warranty for this free library. If the library
|
||||
is modified by someone else and passed on, we want its recipients to know
|
||||
that what they have is not the original version, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that companies distributing free software will individually
|
||||
obtain patent licenses, thus in effect transforming the program into proprietary
|
||||
software. To prevent this, we have made it clear that any patent must be licensed
|
||||
for everyone's free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License, which was designed for utility programs. This license,
|
||||
the GNU Library General Public License, applies to certain designated libraries.
|
||||
This license is quite different from the ordinary one; be sure to read it
|
||||
in full, and don't assume that anything in it is the same as in the ordinary
|
||||
license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that they
|
||||
blur the distinction we usually make between modifying or adding to a program
|
||||
and simply using it. Linking a program with a library, without changing the
|
||||
library, is in some sense simply using the library, and is analogous to running
|
||||
a utility program or application program. However, in a textual and legal
|
||||
sense, the linked executable is a combined work, a derivative of the original
|
||||
library, and the ordinary General Public License treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General Public License
|
||||
for libraries did not effectively promote software sharing, because most developers
|
||||
did not use the libraries. We concluded that weaker conditions might promote
|
||||
sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the users
|
||||
of those programs of all benefit from the free status of the libraries themselves.
|
||||
This Library General Public License is intended to permit developers of non-free
|
||||
programs to use free libraries, while preserving your freedom as a user of
|
||||
such programs to change the free libraries that are incorporated in them.
|
||||
(We have not seen how to achieve this as regards changes in header files,
|
||||
but we have achieved it as regards changes in the actual functions of the
|
||||
Library.) The hope is that this will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow. Pay close attention to the difference between a "work based on the
|
||||
library" and a "work that uses the library". The former contains code derived
|
||||
from the library, while the latter only works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary General
|
||||
Public License rather than by this special one.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which contains a
|
||||
notice placed by the copyright holder or other authorized party saying it
|
||||
may be distributed under the terms of this Library General Public License
|
||||
(also called "this License"). Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data prepared
|
||||
so as to be conveniently linked with application programs (which use some
|
||||
of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work which has
|
||||
been distributed under these terms. A "work based on the Library" means either
|
||||
the Library or any derivative work under copyright law: that is to say, a
|
||||
work containing the Library or a portion of it, either verbatim or with modifications
|
||||
and/or translated straightforwardly into another language. (Hereinafter, translation
|
||||
is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for making modifications
|
||||
to it. For a library, complete source code means all the source code for all
|
||||
modules it contains, plus any associated interface definition files, plus
|
||||
the scripts used to control compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running a program
|
||||
using the Library is not restricted, and output from such a program is covered
|
||||
only if its contents constitute a work based on the Library (independent of
|
||||
the use of the Library in a tool for writing it). Whether that is true depends
|
||||
on what the Library does and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and disclaimer
|
||||
of warranty; keep intact all the notices that refer to this License and to
|
||||
the absence of any warranty; and distribute a copy of this License along with
|
||||
the Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion of it,
|
||||
thus forming a work based on the Library, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge to all
|
||||
third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a table of
|
||||
data to be supplied by an application program that uses the facility, other
|
||||
than as an argument passed when the facility is invoked, then you must make
|
||||
a good faith effort to ensure that, in the event an application does not supply
|
||||
such function or table, the facility still operates, and performs whatever
|
||||
part of its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has a purpose
|
||||
that is entirely well-defined independent of the application. Therefore, Subsection
|
||||
2d requires that any application-supplied function or table used by this function
|
||||
must be optional: if the application does not supply it, the square root function
|
||||
must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Library, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Library, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library with
|
||||
the Library (or with a work based on the Library) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License
|
||||
instead of this License to a given copy of the Library. To do this, you must
|
||||
alter all the notices that refer to this License, so that they refer to the
|
||||
ordinary GNU General Public License, version 2, instead of to this License.
|
||||
(If a newer version than version 2 of the ordinary GNU General Public License
|
||||
has appeared, then you can specify that version instead if you wish.) Do not
|
||||
make any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for that copy,
|
||||
so the ordinary GNU General Public License applies to all subsequent copies
|
||||
and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the Library
|
||||
into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative of
|
||||
it, under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you accompany it with the complete corresponding
|
||||
machine-readable source code, which must be distributed under the terms of
|
||||
Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy from a designated
|
||||
place, then offering equivalent access to copy the source code from the same
|
||||
place satisfies the requirement to distribute the source code, even though
|
||||
third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library, but
|
||||
is designed to work with the Library by being compiled or linked with it,
|
||||
is called a "work that uses the Library". Such a work, in isolation, is not
|
||||
a derivative work of the Library, and therefore falls outside the scope of
|
||||
this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library creates an
|
||||
executable that is a derivative of the Library (because it contains portions
|
||||
of the Library), rather than a "work that uses the library". The executable
|
||||
is therefore covered by this License. Section 6 states terms for distribution
|
||||
of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file that
|
||||
is part of the Library, the object code for the work may be a derivative work
|
||||
of the Library even though the source code is not. Whether this is true is
|
||||
especially significant if the work can be linked without the Library, or if
|
||||
the work is itself a library. The threshold for this to be true is not precisely
|
||||
defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure layouts
|
||||
and accessors, and small macros and small inline functions (ten lines or less
|
||||
in length), then the use of the object file is unrestricted, regardless of
|
||||
whether it is legally a derivative work. (Executables containing this object
|
||||
code plus portions of the Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute
|
||||
the object code for the work under the terms of Section 6. Any executables
|
||||
containing that work also fall under Section 6, whether or not they are linked
|
||||
directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or link a "work
|
||||
that uses the Library" with the Library to produce a work containing portions
|
||||
of the Library, and distribute that work under terms of your choice, provided
|
||||
that the terms permit modification of the work for the customer's own use
|
||||
and reverse engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
You must supply a copy of this License. If the work during execution displays
|
||||
copyright notices, you must include the copyright notice for the Library among
|
||||
them, as well as a reference directing the user to the copy of this License.
|
||||
Also, you must do one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding machine-readable source
|
||||
code for the Library including whatever changes were used in the work (which
|
||||
must be distributed under Sections 1 and 2 above); and, if the work is an
|
||||
executable linked with the Library, with the complete machine-readable "work
|
||||
that uses the Library", as object code and/or source code, so that the user
|
||||
can modify the Library and then relink to produce a modified executable containing
|
||||
the modified Library. (It is understood that the user who changes the contents
|
||||
of definitions files in the Library will not necessarily be able to recompile
|
||||
the application to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at least three years,
|
||||
to give the same user the materials specified in Subsection 6a, above, for
|
||||
a charge no more than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy from a designated
|
||||
place, offer equivalent access to copy the above specified materials from
|
||||
the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these materials or
|
||||
that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the Library" must
|
||||
include any data and utility programs needed for reproducing the executable
|
||||
from it. However, as a special exception, the source code distributed need
|
||||
not include anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the operating
|
||||
system on which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license restrictions of
|
||||
other proprietary libraries that do not normally accompany the operating system.
|
||||
Such a contradiction means you cannot use both them and the Library together
|
||||
in an executable that you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the Library side-by-side
|
||||
in a single library together with other library facilities not covered by
|
||||
this License, and distribute such a combined library, provided that the separate
|
||||
distribution of the work based on the Library and of the other library facilities
|
||||
is otherwise permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities. This must be distributed
|
||||
under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact that part of
|
||||
it is a work based on the Library, and explaining where to find the accompanying
|
||||
uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library
|
||||
except as expressly provided under this License. Any attempt otherwise to
|
||||
copy, modify, sublicense, link with, or distribute the Library is void, and
|
||||
will automatically terminate your rights under this License. However, parties
|
||||
who have received copies, or rights, from you under this License will not
|
||||
have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Library or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Library
|
||||
(or any work based on the Library), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the Library),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute, link with or modify the Library subject to these terms
|
||||
and conditions. You may not impose any further restrictions on the recipients'
|
||||
exercise of the rights granted herein. You are not responsible for enforcing
|
||||
compliance by third parties to this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Library at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Library
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Library under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new versions of
|
||||
the Library General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Library does not specify a license version number, you may choose any version
|
||||
ever published by the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free programs
|
||||
whose distribution conditions are incompatible with these, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free Software
|
||||
Foundation, write to the Free Software Foundation; we sometimes make exceptions
|
||||
for this. Our decision will be guided by the two goals of preserving the free
|
||||
status of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest possible
|
||||
use to the public, we recommend making it free software that everyone can
|
||||
redistribute and change. You can do so by permitting redistribution under
|
||||
these terms (or, alternatively, under the terms of the ordinary General Public
|
||||
License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is safest
|
||||
to attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the "copyright"
|
||||
line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the library's name and an idea of what it does.
|
||||
|
||||
Copyright (C) year name of author
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Library General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
|
||||
by James Random Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1990
|
||||
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
|
@ -0,0 +1,163 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates the terms
|
||||
and conditions of version 3 of the GNU General Public License, supplemented
|
||||
by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser General
|
||||
Public License, and the "GNU GPL" refers to version 3 of the GNU General Public
|
||||
License.
|
||||
|
||||
|
||||
|
||||
"The Library" refers to a covered work governed by this License, other than
|
||||
an Application or a Combined Work as defined below.
|
||||
|
||||
|
||||
|
||||
An "Application" is any work that makes use of an interface provided by the
|
||||
Library, but which is not otherwise based on the Library. Defining a subclass
|
||||
of a class defined by the Library is deemed a mode of using an interface provided
|
||||
by the Library.
|
||||
|
||||
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an Application
|
||||
with the Library. The particular version of the Library with which the Combined
|
||||
Work was made is also called the "Linked Version".
|
||||
|
||||
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the Corresponding
|
||||
Source for the Combined Work, excluding any source code for portions of the
|
||||
Combined Work that, considered in isolation, are based on the Application,
|
||||
and not on the Linked Version.
|
||||
|
||||
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the object
|
||||
code and/or source code for the Application, including any data and utility
|
||||
programs needed for reproducing the Combined Work from the Application, but
|
||||
excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License without
|
||||
being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a facility
|
||||
refers to a function or data to be supplied by an Application that uses the
|
||||
facility (other than as an argument passed when the facility is invoked),
|
||||
then you may convey a copy of the modified version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to ensure
|
||||
that, in the event an Application does not supply the function or data, the
|
||||
facility still operates, and performs whatever part of its purpose remains
|
||||
meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of this License
|
||||
applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from a header
|
||||
file that is part of the Library. You may convey such object code under terms
|
||||
of your choice, provided that, if the incorporated material is not limited
|
||||
to numerical parameters, data structure layouts and accessors, or small macros,
|
||||
inline functions and templates (ten or fewer lines in length), you do both
|
||||
of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that, taken together,
|
||||
effectively do not restrict modification of the portions of the Library contained
|
||||
in the Combined Work and reverse engineering for debugging such modifications,
|
||||
if you also do each of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during execution, include
|
||||
the copyright notice for the Library among these notices, as well as a reference
|
||||
directing the user to the copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this License,
|
||||
and the Corresponding Application Code in a form suitable for, and under terms
|
||||
that permit, the user to recombine or relink the Application with a modified
|
||||
version of the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the Library. A
|
||||
suitable mechanism is one that (a) uses at run time a copy of the Library
|
||||
already present on the user's computer system, and (b) will operate properly
|
||||
with a modified version of the Library that is interface-compatible with the
|
||||
Linked Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise be required
|
||||
to provide such information under section 6 of the GNU GPL, and only to the
|
||||
extent that such information is necessary to install and execute a modified
|
||||
version of the Combined Work produced by recombining or relinking the Application
|
||||
with a modified version of the Linked Version. (If you use option 4d0, the
|
||||
Installation Information must accompany the Minimal Corresponding Source and
|
||||
Corresponding Application Code. If you use option 4d1, you must provide the
|
||||
Installation Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the Library side
|
||||
by side in a single library together with other library facilities that are
|
||||
not Applications and are not covered by this License, and convey such a combined
|
||||
library under terms of your choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities, conveyed under the
|
||||
terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it is a work
|
||||
based on the Library, and explaining where to find the accompanying uncombined
|
||||
form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the
|
||||
GNU Lesser General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library as you
|
||||
received it specifies that a certain numbered version of the GNU Lesser General
|
||||
Public License "or any later version" applies to it, you have the option of
|
||||
following the terms and conditions either of that published version or of
|
||||
any later version published by the Free Software Foundation. If the Library
|
||||
as you received it does not specify a version number of the GNU Lesser General
|
||||
Public License, you may choose any version of the GNU Lesser General Public
|
||||
License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide whether
|
||||
future versions of the GNU Lesser General Public License shall apply, that
|
||||
proxy's public statement of acceptance of any version is permanent authorization
|
||||
for you to choose that version for the Library.
|
|
@ -0,0 +1,12 @@
|
|||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the license or (at your option) any later version
|
||||
that is accepted by the membership of KDE e.V. (or its successor
|
||||
approved by the membership of KDE e.V.), which shall act as a
|
||||
proxy as defined in Section 6 of version 3 of the license.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
|
@ -0,0 +1,36 @@
|
|||
# Framework Integration
|
||||
|
||||
Integration of Qt application with KDE workspaces
|
||||
|
||||
## Introduction
|
||||
|
||||
Framework Integration is a set of plugins responsible for better integration of
|
||||
Qt applications when running on a KDE Plasma workspace.
|
||||
|
||||
Applications do not need to link to this directly.
|
||||
|
||||
## Components
|
||||
|
||||
### KF5Style
|
||||
|
||||
The library KF5Style provides integration with KDE Plasma Workspace
|
||||
settings for Qt styles.
|
||||
|
||||
Derive your Qt style from KStyle to automatically inherit various
|
||||
settings from the KDE Plasma Workspace, providing a consistent user
|
||||
experience. For example, this will ensure a consistent single-click
|
||||
or double-click activation setting, and the use of standard themed
|
||||
icons.
|
||||
|
||||
### infopage
|
||||
|
||||
Common data files used in info page content in various applications.
|
||||
|
||||
### FrameworkIntegrationPlugin
|
||||
|
||||
FrameworkIntegrationPlugin provides extra features to other KDE
|
||||
Frameworks to integrate with KDE Plasma.
|
||||
|
||||
It currently provides an addon to KMessageBox which stores settings
|
||||
for asking users the same question again.
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
include(ECMMarkAsTest)
|
||||
include(ECMMarkNonGuiExecutable)
|
||||
include(ECMAddTests)
|
||||
|
||||
find_package(Qt${QT_MAJOR_VERSION}Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
|
||||
|
||||
if(NOT TARGET Qt${QT_MAJOR_VERSION}::Test)
|
||||
message(STATUS "Qt${QT_MAJOR_VERSION}Test not found, autotests will not be built.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
include_directories( Qt${QT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS )
|
||||
|
||||
set(CONFIGFILE "${CMAKE_CURRENT_SOURCE_DIR}/kdeplatformtheme_kdeglobals")
|
||||
configure_file(kdeplatformtheme_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/kdeplatformtheme_config.h)
|
||||
|
||||
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
|
||||
|
||||
macro(FRAMEWORKINTEGRATION_TESTS _testname)
|
||||
ecm_add_test(${_testname}.cpp ${ARGN}
|
||||
LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::ConfigWidgets KF5::ConfigCore KF5::IconThemes KF5::Style KF5::Notifications
|
||||
TEST_NAME ${_testname}
|
||||
NAME_PREFIX "frameworkintegration-")
|
||||
set_target_properties(${_testname} PROPERTIES COMPILE_FLAGS "-DUNIT_TEST")
|
||||
endmacro()
|
||||
|
||||
frameworkintegration_tests(
|
||||
kstyle_unittest
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2013 Alejandro Fiestas Olivares <afiestas@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#ifndef KPLATFORMTHEMETEST_H
|
||||
#define KPLATFORMTHEMETEST_H
|
||||
|
||||
#define CONFIGFILE "${CONFIGFILE}"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,116 @@
|
|||
[KDE]
|
||||
CursorBlinkRate=1042
|
||||
DoubleClickInterval=4343
|
||||
StartDragDist=15
|
||||
StartDragTime=555
|
||||
SingleClick=false
|
||||
widgetStyle=non-existent-widget-style
|
||||
ShowIconsInMenuItems=false
|
||||
ShowIconsOnPushButtons=false
|
||||
GraphicEffectsLevel=0
|
||||
WheelScrollLines=1234
|
||||
ShowIconsInMenuItems=true
|
||||
|
||||
[Toolbar style]
|
||||
ToolButtonStyle=textonly
|
||||
ToolButtonStyleOtherToolbars=textundericon
|
||||
|
||||
[Icons]
|
||||
Theme=non-existent-icon-theme
|
||||
|
||||
[MainToolbarIcons]
|
||||
Size=2
|
||||
|
||||
[ColorEffects:Active]
|
||||
ChangeSelectionColor=false
|
||||
Enable=false
|
||||
|
||||
[ColorEffects:Inactive]
|
||||
ChangeSelectionColor=false
|
||||
Enable=false
|
||||
|
||||
[ColorEffects:Disabled]
|
||||
ChangeSelectionColor=false
|
||||
Enable=false
|
||||
|
||||
[Colors:Button]
|
||||
BackgroundAlternate=0,128,0
|
||||
BackgroundNormal=0,128,0
|
||||
DecorationFocus=0,128,0
|
||||
DecorationHover=0,128,0
|
||||
ForegroundActive=0,128,0
|
||||
ForegroundInactive=0,128,0
|
||||
ForegroundLink=0,128,0
|
||||
ForegroundNegative=0,128,0
|
||||
ForegroundNeutral=0,128,0
|
||||
ForegroundNormal=0,128,0
|
||||
ForegroundPositive=0,128,0
|
||||
ForegroundVisited=0,128,0
|
||||
|
||||
[Colors:Selection]
|
||||
BackgroundAlternate=0,128,0
|
||||
BackgroundNormal=0,128,0
|
||||
DecorationFocus=0,128,0
|
||||
DecorationHover=0,128,0
|
||||
ForegroundActive=0,128,0
|
||||
ForegroundInactive=0,128,0
|
||||
ForegroundLink=0,128,0
|
||||
ForegroundNegative=0,128,0
|
||||
ForegroundNeutral=0,128,0
|
||||
ForegroundNormal=0,128,0
|
||||
ForegroundPositive=0,128,0
|
||||
ForegroundVisited=0,128,0
|
||||
|
||||
[Colors:Tooltip]
|
||||
BackgroundAlternate=0,128,0
|
||||
BackgroundNormal=0,128,0
|
||||
DecorationFocus=0,128,0
|
||||
DecorationHover=0,128,0
|
||||
ForegroundActive=0,128,0
|
||||
ForegroundInactive=0,128,0
|
||||
ForegroundLink=0,128,0
|
||||
ForegroundNegative=0,128,0
|
||||
ForegroundNeutral=0,128,0
|
||||
ForegroundNormal=0,128,0
|
||||
ForegroundPositive=0,128,0
|
||||
ForegroundVisited=0,128,0
|
||||
|
||||
[Colors:View]
|
||||
BackgroundAlternate=0,128,0
|
||||
BackgroundNormal=0,128,0
|
||||
DecorationFocus=0,128,0
|
||||
DecorationHover=0,128,0
|
||||
ForegroundActive=0,128,0
|
||||
ForegroundInactive=0,128,0
|
||||
ForegroundLink=0,128,0
|
||||
ForegroundNegative=0,128,0
|
||||
ForegroundNeutral=0,128,0
|
||||
ForegroundNormal=0,128,0
|
||||
ForegroundPositive=0,128,0
|
||||
ForegroundVisited=0,128,0
|
||||
|
||||
[Colors:Window]
|
||||
BackgroundAlternate=0,128,0
|
||||
BackgroundNormal=0,128,0
|
||||
DecorationFocus=0,128,0
|
||||
DecorationHover=0,128,0
|
||||
ForegroundActive=0,128,0
|
||||
ForegroundInactive=0,128,0
|
||||
ForegroundLink=0,128,0
|
||||
ForegroundNegative=0,128,0
|
||||
ForegroundNeutral=0,128,0
|
||||
ForegroundNormal=0,128,0
|
||||
ForegroundPositive=0,128,0
|
||||
ForegroundVisited=0,128,0
|
||||
|
||||
[WM]
|
||||
activeFont=OxyActiveTest,9,-1,5,50,0,0,0,0,0
|
||||
|
||||
[General]
|
||||
desktopFont=OxyDesktopTest,9,-1,5,50,0,0,0,0,0
|
||||
fixed=OxyFixedTest Mono,10,-1,5,50,0,0,0,0,0
|
||||
font=OxyFontTest,9,-1,5,50,0,0,0,0,0
|
||||
menuFont=OxyMenuTest,9,-1,5,50,0,0,0,0,0
|
||||
smallestReadableFont=OxySmallestReadableTest,8,-1,5,50,0,0,0,0,0
|
||||
taskbarFont=OxyTaskbarTest,9,-1,5,50,0,0,0,0,0
|
||||
toolBarFont=OxyToolbarTest,8,-1,5,50,0,0,0,0,0
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2013 Alejandro Fiestas Olivares <afiestas@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#include "kdeplatformtheme_config.h"
|
||||
#include "kstyle.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QStandardPaths>
|
||||
#include <QTest>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
static void prepareEnvironment()
|
||||
{
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
|
||||
QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
|
||||
|
||||
if (!QDir(configPath).mkpath(QStringLiteral("."))) {
|
||||
qFatal("Failed to create test configuration directory.");
|
||||
}
|
||||
|
||||
configPath.append("/kdeglobals");
|
||||
|
||||
QFile::remove(configPath);
|
||||
if (!QFile::copy(CONFIGFILE, configPath)) {
|
||||
qFatal("Failed to copy kdeglobals required for tests.");
|
||||
}
|
||||
}
|
||||
|
||||
Q_COREAPP_STARTUP_FUNCTION(prepareEnvironment)
|
||||
|
||||
class KStyle_UnitTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase()
|
||||
{
|
||||
qApp->setStyle(new KStyle);
|
||||
}
|
||||
void cleanupTestCase()
|
||||
{
|
||||
QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
|
||||
configPath.append("/kdeglobals");
|
||||
QFile::remove(configPath);
|
||||
}
|
||||
|
||||
void testToolButtonStyleHint()
|
||||
{
|
||||
QToolBar *toolbar = new QToolBar();
|
||||
QToolButton *btn = new QToolButton(toolbar);
|
||||
|
||||
QCOMPARE(qApp->style()->styleHint(QStyle::SH_ToolButtonStyle, nullptr, btn), (int)Qt::ToolButtonTextOnly);
|
||||
|
||||
toolbar->setProperty("otherToolbar", true);
|
||||
QCOMPARE(qApp->style()->styleHint(QStyle::SH_ToolButtonStyle, nullptr, btn), (int)Qt::ToolButtonTextUnderIcon);
|
||||
}
|
||||
};
|
||||
|
||||
QTEST_MAIN(KStyle_UnitTest)
|
||||
|
||||
#include "kstyle_unittest.moc"
|
|
@ -0,0 +1,19 @@
|
|||
maintainer: afiestas
|
||||
description: Workspace and cross-framework integration plugins
|
||||
tier: 4
|
||||
type: integration
|
||||
platforms:
|
||||
- name: Linux
|
||||
- name: Windows
|
||||
- name: macOS
|
||||
- name: Linux
|
||||
note: XCB is needed for KStyle
|
||||
- name: FreeBSD
|
||||
note: XCB is needed for KStyle
|
||||
portingAid: false
|
||||
deprecated: false
|
||||
release: true
|
||||
|
||||
public_lib: true
|
||||
group: Frameworks
|
||||
subgroup: Tier 4
|
|
@ -0,0 +1,6 @@
|
|||
add_subdirectory(integrationplugin)
|
||||
add_subdirectory(kstyle)
|
||||
add_subdirectory(infopage)
|
||||
if (BUILD_KPACKAGE_INSTALL_HANDLERS)
|
||||
add_subdirectory(kpackage-install-handlers)
|
||||
endif()
|
|
@ -0,0 +1,27 @@
|
|||
install(FILES
|
||||
body-background.png
|
||||
bar-bottom-left.png
|
||||
bar-top-right.png
|
||||
bar-bottom-middle.png
|
||||
# bottom-left.png
|
||||
box-middle-left.png
|
||||
# top-right.png
|
||||
bar-bottom-right.png
|
||||
# bottom-middle.png
|
||||
box-middle-right.png
|
||||
top-middle.png
|
||||
bar-middle-left.png
|
||||
# bottom-right.png
|
||||
box-top-left.png
|
||||
bar-middle-right.png
|
||||
box-bottom-left.png
|
||||
box-top-middle.png
|
||||
bar-top-left.png
|
||||
box-bottom-middle.png
|
||||
box-top-right.png
|
||||
bar-top-middle.png
|
||||
box-bottom-right.png
|
||||
box-center.png
|
||||
kde_infopage.css
|
||||
kde_infopage_rtl.css
|
||||
DESTINATION ${KDE_INSTALL_DATADIR_KF}/infopage)
|
After Width: | Height: | Size: 136 B |
After Width: | Height: | Size: 128 B |
After Width: | Height: | Size: 136 B |
After Width: | Height: | Size: 125 B |
After Width: | Height: | Size: 125 B |
After Width: | Height: | Size: 136 B |
After Width: | Height: | Size: 128 B |
After Width: | Height: | Size: 136 B |
After Width: | Height: | Size: 1.4 MiB |
After Width: | Height: | Size: 149 B |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 351 B |
After Width: | Height: | Size: 360 B |
After Width: | Height: | Size: 349 B |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 456 B |
After Width: | Height: | Size: 384 B |
After Width: | Height: | Size: 328 B |
After Width: | Height: | Size: 338 B |
After Width: | Height: | Size: 363 B |
|
@ -0,0 +1,261 @@
|
|||
|
||||
/*
|
||||
* text styles
|
||||
*/
|
||||
|
||||
img {margin: 0px; padding: 0px}
|
||||
body {margin: 0px; padding: 0px; background-color: #062A4B; background-image: url(body-background.png); color: #111111; height="100%"; width="100%"}
|
||||
a { color: #1A2C36; text-decoration: none; font-weight: bold; }
|
||||
a:hover {
|
||||
color: #003B5A;
|
||||
text-decoration: none;
|
||||
text-shadow: #FFFFFF 0px 0px 6px;
|
||||
}
|
||||
<!-- .bar_text a {color: #FFFFFF;} -->
|
||||
|
||||
#subtext {
|
||||
font-size: 10pt;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#nextlink {
|
||||
margin: 0px;
|
||||
padding-top: 1em;
|
||||
text-align: center;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
/*
|
||||
* the header
|
||||
*/
|
||||
|
||||
#header {
|
||||
background-image: url(top-middle.png);
|
||||
width: 100%;
|
||||
height: 131px;
|
||||
}
|
||||
|
||||
#headerL {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
height: 131px;
|
||||
width: 147px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#headerR {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
width: 430px;
|
||||
height: 131px;
|
||||
/*background-image: url(top-right.png);*/
|
||||
}
|
||||
|
||||
/* title and tagline are part of the header diff */
|
||||
#title {
|
||||
position: absolute;
|
||||
top: 63px;
|
||||
right: 0px;
|
||||
margin-top: -1em;
|
||||
margin-right: 5%;
|
||||
text-align: right;
|
||||
font-size: xx-large;
|
||||
font-weight: bold;
|
||||
text-shadow: #FFFFFF 0px 0px 5px;
|
||||
color: #151515;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
#tagline {
|
||||
position: absolute;
|
||||
top: 70px;
|
||||
right: 0px;
|
||||
margin-right: 5%;
|
||||
text-align: right;
|
||||
font-size: large;
|
||||
font-weight: bold;
|
||||
text-shadow: #FFFFFF 0px 0px 5px;
|
||||
color: #151515;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
/*
|
||||
* the nav bar
|
||||
*/
|
||||
|
||||
#bar {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#barCenter {
|
||||
text-align: center;
|
||||
/*background-color: #F5F5F4;*/
|
||||
color: #B0B0B0;
|
||||
padding-top: 0.5ex;
|
||||
padding-bottom: 0.5ex;
|
||||
font-weight: bold;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
#barCenter a.selected, #barCenter a.selected:hover {
|
||||
color: #B0B0B0;
|
||||
text-decoration: none;
|
||||
text-shadow: #ADC1DF 0px 0px 5px;
|
||||
}
|
||||
|
||||
|
||||
#barCenter li a:link, #barCenter li a:visited, #barCenter li a:active {
|
||||
color: #B0B0B0;
|
||||
text-decoration: none;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
#barCenter li a:hover {
|
||||
color: #B0B0B0;
|
||||
text-decoration: none;
|
||||
text-shadow: #ADC1DF 0px 0px 6px;
|
||||
}
|
||||
|
||||
#barCenter ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#barCenter li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#barCenter li:not(:first-child):before { /* Aren't css3 selectors great? */
|
||||
content: " \0387 "; /* unicode for · */
|
||||
}
|
||||
|
||||
/*
|
||||
* the main box
|
||||
*/
|
||||
|
||||
#box {
|
||||
width: 90%;
|
||||
margin-left: 5%;
|
||||
margin-right: 5%;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#boxT {
|
||||
width: 100%;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
#boxTL {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
float: left;
|
||||
background-image: url(box-top-left.png);
|
||||
}
|
||||
|
||||
#boxTR {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
float: right;
|
||||
background-image: url(box-top-right.png);
|
||||
}
|
||||
|
||||
#boxTC {
|
||||
height: 16px;
|
||||
margin-left: 16px;
|
||||
margin-right: 16px;
|
||||
background-image: url(box-top-middle.png);
|
||||
-khtml-background-size: 100%;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
#boxL {
|
||||
background-image: url(box-middle-left.png);
|
||||
background-repeat: repeat-y;
|
||||
-khtml-background-size: 16px 100%;
|
||||
background-size: 16px 100%;
|
||||
background-position: left;
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
#boxCenter {
|
||||
background-image: url(box-center.png);
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
-khtml-background-size: 100%;
|
||||
background-size: 100% 100%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#boxR {
|
||||
background-image: url(box-middle-right.png);
|
||||
background-repeat: repeat-y;
|
||||
-khtml-background-size: 16px 100%;
|
||||
background-size: 16px 100%;
|
||||
background-position: right;
|
||||
padding-right: 16px;
|
||||
}
|
||||
|
||||
#boxB {
|
||||
width: 100%;
|
||||
height: 49px;
|
||||
}
|
||||
|
||||
#boxBL {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
float: left;
|
||||
background-image: url(box-bottom-left.png);
|
||||
}
|
||||
|
||||
#boxBR {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
float: right;
|
||||
background-image: url(box-bottom-right.png);
|
||||
}
|
||||
|
||||
#boxBC {
|
||||
height: 16px;
|
||||
margin-left: 16px;
|
||||
margin-right: 16px;
|
||||
background-image: url(box-bottom-middle.png);
|
||||
-khtml-background-size: 100%;
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
/*
|
||||
* the footer
|
||||
*/
|
||||
|
||||
/*
|
||||
#footer {
|
||||
position: fixed;
|
||||
background-image: url(bottom-middle.png);
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
z-index: -2;
|
||||
bottom:0;
|
||||
}
|
||||
|
||||
#footerL {
|
||||
position: fixed;
|
||||
background-image: url(bottom-left.png);
|
||||
left: 0px;
|
||||
width: 155px;
|
||||
height: 100px;
|
||||
z-index: -2;
|
||||
}
|
||||
|
||||
#footerR {
|
||||
position: fixed;
|
||||
background-image: url(bottom-right.png);
|
||||
right: 0px;
|
||||
width: 429px;
|
||||
height: 100px;
|
||||
z-index: -1;
|
||||
}
|
||||
*/
|
||||
|
||||
/* vim:set sw=2 et nocindent smartindent: */
|
|
@ -0,0 +1,11 @@
|
|||
body {direction: rtl}
|
||||
|
||||
#boxCenter {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#nextlink {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* vim:set sw=2 et nocindent smartindent: */
|
After Width: | Height: | Size: 187 B |
After Width: | Height: | Size: 183 B |
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="generator" content=
|
||||
"HTML Tidy for Linux/x86 (vers 1st August 2004), see www.w3.org" />
|
||||
|
||||
<style type="text/css">
|
||||
/*<![CDATA[*/
|
||||
@import "%1"; /* kde_infopage.css */
|
||||
%1 /* maybe @import "kde_infopage_rtl.css"; */
|
||||
/* CHANGE ME or REMOVE ME */ @import "MY_CSS_FILE.css";
|
||||
/*]]>*/
|
||||
</style>
|
||||
|
||||
<title>%1</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="header">
|
||||
<div id="headerL"/>
|
||||
<div id="headerR"/>
|
||||
|
||||
<div id="title">
|
||||
%1 <!-- title -->
|
||||
</div>
|
||||
|
||||
<div id="tagline">
|
||||
%1 <!-- tagline -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- the bar -->
|
||||
<div id="bar">
|
||||
<div id="barT"><div id="barTL"/><div id="barTR"/><div id="barTC"/></div>
|
||||
<div id="barL">
|
||||
<div id="barR">
|
||||
<div id="barCenter" class="bar_text">
|
||||
<!-- text below the header graphics, above the main box, add your own %1s -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="barB"><div id="barBL"/><div id="barBR"/><div id="barBC"/></div>
|
||||
</div>
|
||||
|
||||
<!-- the main text box -->
|
||||
<div id="box">
|
||||
<div id="boxT"><div id="boxTL"/><div id="boxTR"/><div id="boxTC"/></div>
|
||||
<div id="boxL">
|
||||
<div id="boxR">
|
||||
<div id="boxCenter">
|
||||
<!-- text in the main box, add your own %1s -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="boxB"><div id="boxBL"/><div id="boxBR"/><div id="boxBC"/></div>
|
||||
</div>
|
||||
|
||||
<div id="footer"><div id="footerL"/><div id="footerR"/></div>
|
||||
</body>
|
||||
</html>
|
||||
<!-- vim:set sw=2 et nocindent smartindent: -->
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
add_library(FrameworkIntegrationPlugin
|
||||
MODULE frameworkintegrationplugin.cpp)
|
||||
|
||||
target_link_libraries(FrameworkIntegrationPlugin
|
||||
PRIVATE
|
||||
KF5::WidgetsAddons
|
||||
KF5::ConfigCore
|
||||
KF5::Notifications
|
||||
)
|
||||
|
||||
install(TARGETS FrameworkIntegrationPlugin
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf${QT_MAJOR_VERSION})
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2012 David Faure <faure+bluesystems@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#include "frameworkintegrationplugin.h"
|
||||
#include <KConfigGroup>
|
||||
#include <KNotification>
|
||||
#include <KSharedConfig>
|
||||
|
||||
#include <QDebug>
|
||||
#include <qplugin.h>
|
||||
|
||||
bool KMessageBoxDontAskAgainConfigStorage::shouldBeShownYesNo(const QString &dontShowAgainName, KMessageBox::ButtonCode &result)
|
||||
{
|
||||
KConfigGroup cg(KMessageBox_againConfig ? KMessageBox_againConfig : KSharedConfig::openConfig().data(), "Notification Messages");
|
||||
const QString dontAsk = cg.readEntry(dontShowAgainName, QString()).toLower();
|
||||
if (dontAsk == QLatin1String("yes") || dontAsk == QLatin1String("true")) {
|
||||
result = KMessageBox::Yes;
|
||||
return false;
|
||||
}
|
||||
if (dontAsk == QLatin1String("no") || dontAsk == QLatin1String("false")) {
|
||||
result = KMessageBox::No;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool KMessageBoxDontAskAgainConfigStorage::shouldBeShownContinue(const QString &dontShowAgainName)
|
||||
{
|
||||
KConfigGroup cg(KMessageBox_againConfig ? KMessageBox_againConfig : KSharedConfig::openConfig().data(), "Notification Messages");
|
||||
return cg.readEntry(dontShowAgainName, true);
|
||||
}
|
||||
|
||||
void KMessageBoxDontAskAgainConfigStorage::saveDontShowAgainYesNo(const QString &dontShowAgainName, KMessageBox::ButtonCode result)
|
||||
{
|
||||
KConfigGroup::WriteConfigFlags flags = KConfig::Persistent;
|
||||
if (dontShowAgainName[0] == QLatin1Char(':')) {
|
||||
flags |= KConfigGroup::Global;
|
||||
}
|
||||
KConfigGroup cg(KMessageBox_againConfig ? KMessageBox_againConfig : KSharedConfig::openConfig().data(), "Notification Messages");
|
||||
cg.writeEntry(dontShowAgainName, result == KMessageBox::Yes, flags);
|
||||
cg.sync();
|
||||
}
|
||||
|
||||
void KMessageBoxDontAskAgainConfigStorage::saveDontShowAgainContinue(const QString &dontShowAgainName)
|
||||
{
|
||||
KConfigGroup::WriteConfigFlags flags = KConfigGroup::Persistent;
|
||||
if (dontShowAgainName[0] == QLatin1Char(':')) {
|
||||
flags |= KConfigGroup::Global;
|
||||
}
|
||||
KConfigGroup cg(KMessageBox_againConfig ? KMessageBox_againConfig : KSharedConfig::openConfig().data(), "Notification Messages");
|
||||
cg.writeEntry(dontShowAgainName, false, flags);
|
||||
cg.sync();
|
||||
}
|
||||
|
||||
void KMessageBoxDontAskAgainConfigStorage::enableAllMessages()
|
||||
{
|
||||
KConfig *config = KMessageBox_againConfig ? KMessageBox_againConfig : KSharedConfig::openConfig().data();
|
||||
if (!config->hasGroup("Notification Messages")) {
|
||||
return;
|
||||
}
|
||||
|
||||
KConfigGroup cg(config, "Notification Messages");
|
||||
|
||||
typedef QMap<QString, QString> configMap;
|
||||
|
||||
const configMap map = cg.entryMap();
|
||||
|
||||
configMap::ConstIterator it;
|
||||
for (it = map.begin(); it != map.end(); ++it) {
|
||||
cg.deleteEntry(it.key());
|
||||
}
|
||||
}
|
||||
|
||||
void KMessageBoxDontAskAgainConfigStorage::enableMessage(const QString &dontShowAgainName)
|
||||
{
|
||||
KConfig *config = KMessageBox_againConfig ? KMessageBox_againConfig : KSharedConfig::openConfig().data();
|
||||
if (!config->hasGroup("Notification Messages")) {
|
||||
return;
|
||||
}
|
||||
|
||||
KConfigGroup cg(config, "Notification Messages");
|
||||
|
||||
cg.deleteEntry(dontShowAgainName);
|
||||
config->sync();
|
||||
}
|
||||
|
||||
void KMessageBoxNotify::sendNotification(QMessageBox::Icon notificationType, const QString &message, QWidget *parent)
|
||||
{
|
||||
QString messageType;
|
||||
switch (notificationType) {
|
||||
case QMessageBox::Warning:
|
||||
messageType = QStringLiteral("messageWarning");
|
||||
break;
|
||||
case QMessageBox::Critical:
|
||||
messageType = QStringLiteral("messageCritical");
|
||||
break;
|
||||
case QMessageBox::Question:
|
||||
messageType = QStringLiteral("messageQuestion");
|
||||
break;
|
||||
default:
|
||||
messageType = QStringLiteral("messageInformation");
|
||||
break;
|
||||
}
|
||||
|
||||
KNotification::event(messageType, message, QPixmap(), parent, KNotification::DefaultEvent | KNotification::CloseOnTimeout);
|
||||
}
|
||||
|
||||
KFrameworkIntegrationPlugin::KFrameworkIntegrationPlugin()
|
||||
: QObject()
|
||||
{
|
||||
setProperty(KMESSAGEBOXDONTASKAGAIN_PROPERTY, QVariant::fromValue<KMessageBoxDontAskAgainInterface *>(&m_dontAskAgainConfigStorage));
|
||||
setProperty(KMESSAGEBOXNOTIFY_PROPERTY, QVariant::fromValue<KMessageBoxNotifyInterface *>(&m_notify));
|
||||
}
|
||||
|
||||
void KFrameworkIntegrationPlugin::reparseConfiguration()
|
||||
{
|
||||
KSharedConfig::openConfig()->reparseConfiguration();
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2012 David Faure <faure+bluesystems@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#ifndef FRAMEWORKINTEGRATIONPLUGIN_H
|
||||
#define FRAMEWORKINTEGRATIONPLUGIN_H
|
||||
|
||||
#include <KMessageBoxDontAskAgainInterface>
|
||||
#include <KMessageBoxNotifyInterface>
|
||||
#include <QObject>
|
||||
|
||||
class KConfig;
|
||||
|
||||
class KMessageBoxDontAskAgainConfigStorage : public KMessageBoxDontAskAgainInterface
|
||||
{
|
||||
public:
|
||||
KMessageBoxDontAskAgainConfigStorage()
|
||||
: KMessageBox_againConfig(nullptr)
|
||||
{
|
||||
}
|
||||
~KMessageBoxDontAskAgainConfigStorage() override
|
||||
{
|
||||
}
|
||||
|
||||
bool shouldBeShownYesNo(const QString &dontShowAgainName, KMessageBox::ButtonCode &result) override;
|
||||
bool shouldBeShownContinue(const QString &dontShowAgainName) override;
|
||||
void saveDontShowAgainYesNo(const QString &dontShowAgainName, KMessageBox::ButtonCode result) override;
|
||||
void saveDontShowAgainContinue(const QString &dontShowAgainName) override;
|
||||
void enableAllMessages() override;
|
||||
void enableMessage(const QString &dontShowAgainName) override;
|
||||
void setConfig(KConfig *cfg) override
|
||||
{
|
||||
KMessageBox_againConfig = cfg;
|
||||
}
|
||||
|
||||
private:
|
||||
KConfig *KMessageBox_againConfig;
|
||||
};
|
||||
|
||||
class KMessageBoxNotify : public KMessageBoxNotifyInterface
|
||||
{
|
||||
public:
|
||||
void sendNotification(QMessageBox::Icon notificationType, const QString &message, QWidget *parent) override;
|
||||
};
|
||||
|
||||
class KFrameworkIntegrationPlugin : public QObject
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "org.kde.FrameworkIntegrationPlugin")
|
||||
Q_OBJECT
|
||||
public:
|
||||
KFrameworkIntegrationPlugin();
|
||||
|
||||
public Q_SLOTS:
|
||||
void reparseConfiguration();
|
||||
|
||||
private:
|
||||
KMessageBoxDontAskAgainConfigStorage m_dontAskAgainConfigStorage;
|
||||
KMessageBoxNotify m_notify;
|
||||
};
|
||||
|
||||
#endif // FRAMEWORKINTEGRATIONPLUGIN_H
|
|
@ -0,0 +1,5 @@
|
|||
add_subdirectory(kns)
|
||||
|
||||
if(AppStreamQt_FOUND AND packagekitqt5_FOUND)
|
||||
add_subdirectory(appstream)
|
||||
endif()
|
|
@ -0,0 +1,3 @@
|
|||
add_executable(appstreamhandler main.cpp)
|
||||
target_link_libraries(appstreamhandler PK::packagekitqt5 AppStreamQt)
|
||||
install(TARGETS appstreamhandler DESTINATION ${KDE_INSTALL_LIBEXECDIR_KF}/kpackagehandlers)
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#include <AppStreamQt/pool.h>
|
||||
#include <PackageKit/Daemon>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
|
||||
using namespace AppStream;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
Q_ASSERT(app.arguments().count() == 2);
|
||||
|
||||
const QUrl url(app.arguments().last());
|
||||
Q_ASSERT(url.isValid());
|
||||
Q_ASSERT(url.scheme() == QLatin1String("appstream"));
|
||||
|
||||
const QString componentName = url.host();
|
||||
if (componentName.isEmpty()) {
|
||||
qWarning() << "wrongly formatted URI" << url;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Pool pool;
|
||||
auto b = pool.load();
|
||||
Q_ASSERT(b);
|
||||
const auto components = pool.componentsById(componentName);
|
||||
if (components.isEmpty()) {
|
||||
qWarning() << "couldn't find" << componentName;
|
||||
return 1;
|
||||
}
|
||||
|
||||
QStringList packages;
|
||||
for (const auto &component : components) {
|
||||
packages += component.packageNames();
|
||||
}
|
||||
packages.removeDuplicates();
|
||||
|
||||
if (packages.isEmpty()) {
|
||||
qWarning() << "no packages to install";
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto resolveTransaction = PackageKit::Daemon::global()->resolve(packages, PackageKit::Transaction::FilterArch);
|
||||
Q_ASSERT(resolveTransaction);
|
||||
|
||||
QHash<QString, QString> pkgs;
|
||||
|
||||
QObject::connect(resolveTransaction,
|
||||
&PackageKit::Transaction::package,
|
||||
resolveTransaction,
|
||||
[&pkgs](PackageKit::Transaction::Info info, const QString &packageID, const QString & /*summary*/) {
|
||||
if (info == PackageKit::Transaction::InfoAvailable)
|
||||
pkgs[PackageKit::Daemon::packageName(packageID)] = packageID;
|
||||
qDebug() << "resolved package" << info << packageID;
|
||||
});
|
||||
QObject::connect(resolveTransaction, &PackageKit::Transaction::finished, resolveTransaction, [&app, &pkgs](PackageKit::Transaction::Exit status) {
|
||||
if (status != PackageKit::Transaction::ExitSuccess) {
|
||||
qWarning() << "resolve failed" << status;
|
||||
QCoreApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
QStringList pkgids = pkgs.values();
|
||||
|
||||
if (pkgids.isEmpty()) {
|
||||
qDebug() << "Nothing to install";
|
||||
QCoreApplication::exit(0);
|
||||
} else {
|
||||
qDebug() << "installing..." << pkgids;
|
||||
pkgids.removeDuplicates();
|
||||
auto installTransaction = PackageKit::Daemon::global()->installPackages(pkgids);
|
||||
QObject::connect(installTransaction, &PackageKit::Transaction::finished, &app, [](PackageKit::Transaction::Exit status) {
|
||||
qDebug() << "install finished" << status;
|
||||
QCoreApplication::exit(status == PackageKit::Transaction::ExitSuccess ? 0 : 1);
|
||||
});
|
||||
}
|
||||
});
|
||||
return app.exec();
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
configure_file(knshandlerversion.h.in knshandlerversion.h)
|
||||
add_executable(knshandler main.cpp)
|
||||
target_link_libraries(knshandler KF5::NewStuffCore KF5::I18n KF5::Notifications Qt${QT_MAJOR_VERSION}::Xml)
|
||||
|
||||
install(TARGETS knshandler DESTINATION ${KDE_INSTALL_LIBEXECDIR_KF}/kpackagehandlers)
|
||||
|
||||
add_executable(knshandlertest main.cpp)
|
||||
target_link_libraries(knshandlertest KF5::NewStuffCore KF5::I18n KF5::Notifications Qt${QT_MAJOR_VERSION}::Xml)
|
||||
target_compile_definitions(knshandlertest PRIVATE -DTEST)
|
||||
|
||||
if(EXISTS "${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_CONFDIR}/colorschemes.knsrc")
|
||||
add_test(NAME test_kns-kpackage COMMAND knshandlertest kns://colorschemes.knsrc/api.kde-look.org/1136471)
|
||||
|
||||
add_test(NAME test_kns-kpackage-fail COMMAND knshandlertest kns://colorschemes.knsrc/xxx/1136471)
|
||||
set_tests_properties(test_kns-kpackage-fail PROPERTIES WILL_FAIL TRUE)
|
||||
message(STATUS "KNS-KPackage test enabled")
|
||||
endif()
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <admin@leinir.dk>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#ifndef KNSHANDLERVERSION_H
|
||||
#define KNSHANDLERVERSION_H
|
||||
|
||||
#include <QLatin1String>
|
||||
|
||||
static QLatin1String knshandlerversion("@PROJECT_VERSION@");
|
||||
|
||||
#endif//KNSHANDLERVERSION_H
|
|
@ -0,0 +1,181 @@
|
|||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||
SPDX-FileCopyrightText: 2021 Alexander Lohnau <alexander.lohnau@gmx.de>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QStandardPaths>
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
#include <QUrlQuery>
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <KNotification>
|
||||
|
||||
#include <KNSCore/Engine>
|
||||
#include <KNSCore/QuestionManager>
|
||||
|
||||
#include "knshandlerversion.h"
|
||||
|
||||
/**
|
||||
* Unfortunately there are two knsrc files for the window decorations, but only one is used in the KCM.
|
||||
* But both are used by third parties, consequently we can not remove one. To solve this we create a symlink
|
||||
* which links the old cache file to the new cache file, which is exposed on the GUI.
|
||||
* This way users can again remove window decorations that are installed as a dependency of a global theme.
|
||||
* BUG: 414570
|
||||
*/
|
||||
void createSymlinkForWindowDecorations()
|
||||
{
|
||||
QFileInfo info(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/knewstuff3/aurorae.knsregistry"));
|
||||
// If we have created the symbolic link already we can exit the function here
|
||||
if (info.isSymbolicLink()) {
|
||||
return;
|
||||
}
|
||||
// Delete this file, it the KNS entries are not exposed in any GUI
|
||||
if (info.exists()) {
|
||||
QFile::remove(info.absoluteFilePath());
|
||||
}
|
||||
QFileInfo newFileInfo(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/knewstuff3/window-decorations.knsregistry"));
|
||||
QFile file(newFileInfo.absoluteFilePath());
|
||||
// Make sure that the file exists
|
||||
if (!newFileInfo.exists()) {
|
||||
file.open(QFile::WriteOnly);
|
||||
file.close();
|
||||
}
|
||||
file.link(info.absoluteFilePath());
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
createSymlinkForWindowDecorations();
|
||||
QCoreApplication app(argc, argv);
|
||||
app.setApplicationName(QStringLiteral("kpackage-knshandler"));
|
||||
app.setApplicationVersion(knshandlerversion);
|
||||
app.setQuitLockEnabled(false);
|
||||
Q_ASSERT(app.arguments().count() == 2);
|
||||
|
||||
#ifdef TEST
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
#endif
|
||||
|
||||
const QUrl url(app.arguments().last());
|
||||
Q_ASSERT(url.isValid());
|
||||
Q_ASSERT(url.scheme() == QLatin1String("kns"));
|
||||
|
||||
QString knsname;
|
||||
const QStringList availableConfigFiles = KNSCore::Engine::availableConfigFiles();
|
||||
auto knsNameIt = std::find_if(availableConfigFiles.begin(), availableConfigFiles.end(), [&url](const QString &availableFile) {
|
||||
return availableFile.endsWith(QLatin1String("/") + url.host());
|
||||
});
|
||||
|
||||
if (knsNameIt == availableConfigFiles.end()) {
|
||||
qWarning() << "couldn't find knsrc file for" << url.host();
|
||||
return 1;
|
||||
} else {
|
||||
knsname = *knsNameIt;
|
||||
}
|
||||
|
||||
const auto pathParts = url.path().split(QLatin1Char('/'), Qt::SkipEmptyParts);
|
||||
if (pathParts.size() != 2) {
|
||||
qWarning() << "wrong format in the url path" << url << pathParts;
|
||||
return 1;
|
||||
}
|
||||
const auto providerid = pathParts.at(0);
|
||||
const auto entryid = pathParts.at(1);
|
||||
int linkid = 1;
|
||||
if (url.hasQuery()) {
|
||||
QUrlQuery query(url);
|
||||
if (query.hasQueryItem(QStringLiteral("linkid"))) {
|
||||
bool ok;
|
||||
linkid = query.queryItemValue(QStringLiteral("linkid")).toInt(&ok);
|
||||
if (!ok) {
|
||||
qWarning() << "linkid is not an integer" << url << pathParts;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KNSCore::Engine engine;
|
||||
int installedCount = 0;
|
||||
QObject::connect(KNSCore::QuestionManager::instance(), &KNSCore::QuestionManager::askQuestion, &engine, [](KNSCore::Question *question) {
|
||||
auto discardQuestion = [question]() {
|
||||
question->setResponse(KNSCore::Question::InvalidResponse);
|
||||
};
|
||||
switch (question->questionType()) {
|
||||
case KNSCore::Question::YesNoQuestion: {
|
||||
auto f = KNotification::event(KNotification::StandardEvent::Notification, question->title(), question->question());
|
||||
f->setActions({i18n("Yes"), i18n("No")});
|
||||
QObject::connect(f, &KNotification::action1Activated, question, [question]() {
|
||||
question->setResponse(KNSCore::Question::YesResponse);
|
||||
});
|
||||
QObject::connect(f, &KNotification::action2Activated, question, [question]() {
|
||||
question->setResponse(KNSCore::Question::NoResponse);
|
||||
});
|
||||
QObject::connect(f, &KNotification::closed, question, discardQuestion);
|
||||
} break;
|
||||
case KNSCore::Question::ContinueCancelQuestion: {
|
||||
auto f = KNotification::event(KNotification::StandardEvent::Notification, question->title(), question->question());
|
||||
f->setActions({i18n("Continue"), i18n("Cancel")});
|
||||
QObject::connect(f, &KNotification::action1Activated, question, [question]() {
|
||||
question->setResponse(KNSCore::Question::ContinueResponse);
|
||||
});
|
||||
QObject::connect(f, &KNotification::action2Activated, question, [question]() {
|
||||
question->setResponse(KNSCore::Question::CancelResponse);
|
||||
});
|
||||
QObject::connect(f, &KNotification::closed, question, discardQuestion);
|
||||
} break;
|
||||
case KNSCore::Question::InputTextQuestion:
|
||||
case KNSCore::Question::SelectFromListQuestion:
|
||||
case KNSCore::Question::PasswordQuestion:
|
||||
discardQuestion();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
QObject::connect(&engine, &KNSCore::Engine::signalProvidersLoaded, &engine, [&engine, entryid]() {
|
||||
engine.fetchEntryById(entryid);
|
||||
});
|
||||
|
||||
QObject::connect(&engine, &KNSCore::Engine::signalErrorCode, &engine, [](KNSCore::ErrorCode errorCode, const QString &message, const QVariant &metadata) {
|
||||
qWarning() << "kns error:" << errorCode << message << metadata;
|
||||
QCoreApplication::exit(1);
|
||||
});
|
||||
QObject::connect(&engine,
|
||||
&KNSCore::Engine::signalEntryEvent,
|
||||
&engine,
|
||||
[providerid, linkid, &engine, &installedCount](const KNSCore::EntryInternal &entry, KNSCore::EntryInternal::EntryEvent event) {
|
||||
if (event == KNSCore::EntryInternal::DetailsLoadedEvent) {
|
||||
// qDebug() << "checking..." << entry.status() << entry.providerId();
|
||||
if (providerid != QUrl(entry.providerId()).host()) {
|
||||
qWarning() << "Wrong provider" << providerid << "instead of" << QUrl(entry.providerId()).host();
|
||||
QCoreApplication::exit(1);
|
||||
} else if (entry.status() == KNS3::Entry::Downloadable) {
|
||||
qDebug() << "installing...";
|
||||
installedCount++;
|
||||
engine.install(entry, linkid);
|
||||
} else if (installedCount == 0) {
|
||||
qDebug() << "already installed.";
|
||||
QCoreApplication::exit(0);
|
||||
}
|
||||
} else if (event == KNSCore::EntryInternal::StatusChangedEvent) {
|
||||
if (entry.status() == KNS3::Entry::Installed) {
|
||||
installedCount--;
|
||||
}
|
||||
if (installedCount == 0) {
|
||||
QCoreApplication::exit(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!engine.init(knsname)) {
|
||||
qWarning() << "couldn't initialize" << knsname;
|
||||
return 1;
|
||||
}
|
||||
return app.exec();
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
# create a Config.cmake and a ConfigVersion.cmake file and install them
|
||||
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Style")
|
||||
|
||||
add_library(KF5Style kstyle.cpp)
|
||||
generate_export_header(KF5Style BASE_NAME KStyle)
|
||||
add_library(KF5::Style ALIAS KF5Style)
|
||||
|
||||
target_include_directories(KF5Style
|
||||
INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF}/FrameworkIntegration>;$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF}/KStyle>")
|
||||
|
||||
target_link_libraries(KF5Style
|
||||
PUBLIC
|
||||
Qt${QT_MAJOR_VERSION}::Widgets
|
||||
PRIVATE
|
||||
KF5::ConfigWidgets
|
||||
KF5::IconThemes
|
||||
)
|
||||
|
||||
set_target_properties(KF5Style PROPERTIES VERSION ${FRAMEWORKINTEGRATION_VERSION}
|
||||
SOVERSION ${FRAMEWORKINTEGRATION_SOVERSION}
|
||||
EXPORT_NAME Style
|
||||
)
|
||||
|
||||
ecm_generate_headers(KStyle_HEADERS
|
||||
HEADER_NAMES
|
||||
KStyle
|
||||
REQUIRED_HEADERS KStyle_HEADERS
|
||||
)
|
||||
|
||||
install(TARGETS KF5Style
|
||||
EXPORT KF5FrameworkIntegrationTargets
|
||||
${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kstyle_export.h
|
||||
${KStyle_HEADERS}
|
||||
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KStyle
|
||||
COMPONENT Devel)
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
- Vertical tabs and titles of dockwidgets are broken
|
||||
Vertical tabs are drawn as yellow rectangle (unfilled) without title
|
||||
Vertical titles of dockwidgets are not rotated
|
||||
|
||||
drawComplexControl:
|
||||
CC_SpinBox:
|
||||
Needs to honor stepEnabled
|
||||
|
||||
CC_ComboBox:
|
||||
Interaction with some of the style option flags (frameless, non-editable, etc.) seems missing.
|
||||
Frameless implemented via subControlRect, but probably best to honor in draw as well.
|
||||
Need to check frame w/designer, at least. Not clear how editable interacts with the SC flags ---
|
||||
might still pass SC_All?
|
||||
|
||||
CC_ScrollBar:
|
||||
Fallback to QCommonStyle. Should be OK...
|
||||
|
||||
CC_Slider:
|
||||
Looks fine...
|
||||
|
||||
CC_ToolButton:
|
||||
Needs to handle the QStyleOptionToolButton::Arrow feature, though perhaps in CE_ToolButtonLabel?
|
||||
|
||||
CC_TitleBar:
|
||||
Looks OK
|
||||
|
||||
CC_Q3ListView:
|
||||
Looks OK
|
||||
|
||||
CC_GroupBox:
|
||||
No handling (Qt 4.1)
|
||||
|
||||
QCommonStyle breaks it up into PE_IndicatorCheckBox, PE_FrameGroupBox, and PE_FrameFocusRect,
|
||||
along with drawItem text. Need to check with Oxy folks on what their goals are. Probably need at
|
||||
least a nice placeholder WT for the frame PE, not sure the rest can probably be pushed back to
|
||||
4.1 or 4.0.x
|
||||
|
||||
Also, need to file a Qt docs bug that drawComplexControl docs don't mention QStyleOptionGroupBox for CC_GroupBox
|
||||
|
||||
CC_Dial:
|
||||
QCommonStyle does something reasonable. No need to style this, I think, it's (thankfully) hardly ever used.
|
||||
|
||||
CC_MdiControls:
|
||||
No handling (Qt 4.3)
|
||||
Should probably integrate with CC_TitleBar handling somehow, but may need a flag or something to distinguish them, perhaps
|
||||
some sort of bevel/bevelless mode in ButtonKOpt? Definitely a lot of overlap..
|
||||
Side note: only passes in QStyleOptionComplex
|
||||
|
||||
drawControl
|
||||
CE_PushButton
|
||||
QStyleOptionButton::Flat not taken into account (thus the frame is always drawn).
|
||||
|
||||
CE_HeaderSection
|
||||
The sort indicator is the same for both ascending and descending directions.
|
||||
|
||||
sizeFromContents:
|
||||
CT_CheckBox: OK
|
||||
CT_ComboBox:
|
||||
Missing! Should compute space much like subControlRect computations do
|
||||
|
||||
CT_Q3DockWindow: Missing, along with other Q3DockWindow primitives. Need to test in
|
||||
designer to see if it's drawn OK.
|
||||
|
||||
CT_HeaderSection: Hardcodes icon size instead of using PM_SmallIconSize.
|
||||
Probably should not apply the icon - text margin when there is no icon..
|
||||
|
||||
CT_LineEdit: should probably add it, especially if Oxygen needs it;
|
||||
unfortunately the QLineEdit internals seem to do some pretty weird stuff,
|
||||
hardcoding some margins and anything. But, well, a uniform margin model
|
||||
for this would be nice..
|
||||
see also SE_LineEditContents..
|
||||
|
||||
CT_Menu: OK
|
||||
|
||||
CT_Q3Header:
|
||||
Missing. Probably share code with CT_HeaderSection, or OK as-is?
|
||||
|
||||
CT_MenuBar, CT_MenuItem: CT_MenuBarItem: OK
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,457 @@
|
|||
/**
|
||||
KStyle for KDE4
|
||||
SPDX-FileCopyrightText: 2004-2005 Maksim Orlovich <maksim@kde.org>
|
||||
SPDX-FileCopyrightText: 2005, 2006 Sandro Giessl <giessl@kde.org>
|
||||
|
||||
Based in part on the following software:
|
||||
|
||||
KStyle for KDE3
|
||||
SPDX-FileCopyrightText: 2001-2002 Karol Szwed <gallium@kde.org>
|
||||
Portions:
|
||||
SPDX-FileCopyrightText: 1998-2000 TrollTech AS
|
||||
|
||||
Keramik for KDE3,
|
||||
SPDX-FileCopyrightText: 2002 Malte Starostik <malte@kde.org>
|
||||
SPDX-FileCopyrightText: 2002-2003 Maksim Orlovich<maksim@kde.org>
|
||||
Portions:
|
||||
SPDX-FileCopyrightText: 2001-2002 Karol Szwed <gallium@kde.org>
|
||||
SPDX-FileCopyrightText: 2001-2002 Fredrik Höglund <fredrik@kde.org>
|
||||
SPDX-FileCopyrightText: 2000 Daniel M. Duley <mosfet@kde.org>
|
||||
SPDX-FileCopyrightText: 2000 Dirk Mueller <mueller@kde.org>
|
||||
SPDX-FileCopyrightText: 2001 Martijn Klingens <klingens@kde.org>
|
||||
SPDX-FileCopyrightText: 2003 Sandro Giessl <sandro@giessl.com>
|
||||
|
||||
Many thanks to Bradley T. Hughes for the 3 button scrollbar code.
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kstyle.h"
|
||||
|
||||
#include <QAbstractItemView>
|
||||
#include <QApplication>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QEvent>
|
||||
#include <QIcon>
|
||||
#include <QPushButton>
|
||||
#include <QShortcut>
|
||||
#include <QStyleOption>
|
||||
#include <QToolBar>
|
||||
|
||||
#include <KColorScheme>
|
||||
#include <KConfigGroup>
|
||||
#include <KIconLoader>
|
||||
#include <KMessageWidget>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static const QStyle::StyleHint SH_KCustomStyleElement = (QStyle::StyleHint)0xff000001;
|
||||
static const int X_KdeBase = 0xff000000;
|
||||
|
||||
class KStylePrivate
|
||||
{
|
||||
public:
|
||||
KStylePrivate();
|
||||
|
||||
QHash<QString, int> styleElements;
|
||||
int hintCounter, controlCounter, subElementCounter;
|
||||
};
|
||||
|
||||
KStylePrivate::KStylePrivate()
|
||||
{
|
||||
controlCounter = subElementCounter = X_KdeBase;
|
||||
hintCounter = X_KdeBase + 1; // sic! X_KdeBase is covered by SH_KCustomStyleElement
|
||||
}
|
||||
|
||||
/*
|
||||
The functions called by widgets that request custom element support, passed to the effective style.
|
||||
Collected in a static inline function due to similarity.
|
||||
*/
|
||||
|
||||
static inline int customStyleElement(QStyle::StyleHint type, const QString &element, QWidget *widget)
|
||||
{
|
||||
if (!widget || widget->style()->metaObject()->indexOfClassInfo("X-KDE-CustomElements") < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QString originalName = widget->objectName();
|
||||
widget->setObjectName(element);
|
||||
const int id = widget->style()->styleHint(type, nullptr, widget);
|
||||
widget->setObjectName(originalName);
|
||||
return id;
|
||||
}
|
||||
|
||||
QStyle::StyleHint KStyle::customStyleHint(const QString &element, const QWidget *widget)
|
||||
{
|
||||
return (StyleHint)customStyleElement(SH_KCustomStyleElement, element, const_cast<QWidget *>(widget));
|
||||
}
|
||||
|
||||
QStyle::ControlElement KStyle::customControlElement(const QString &element, const QWidget *widget)
|
||||
{
|
||||
return (ControlElement)customStyleElement(SH_KCustomStyleElement, element, const_cast<QWidget *>(widget));
|
||||
}
|
||||
|
||||
QStyle::SubElement KStyle::customSubElement(const QString &element, const QWidget *widget)
|
||||
{
|
||||
return (SubElement)customStyleElement(SH_KCustomStyleElement, element, const_cast<QWidget *>(widget));
|
||||
}
|
||||
|
||||
KStyle::KStyle()
|
||||
: d(new KStylePrivate)
|
||||
{
|
||||
}
|
||||
|
||||
KStyle::~KStyle()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
/*
|
||||
Custom Style Element runtime extension:
|
||||
We reserve one StyleHint to let the effective style inform widgets whether it supports certain
|
||||
string based style elements.
|
||||
As this could lead to number conflicts (i.e. an app utilizing one of the hints itself for other
|
||||
purposes) there're various safety mechanisms to rule out such interference.
|
||||
|
||||
1) It's most unlikely that a widget in some 3rd party app will accidentally call a general
|
||||
QStyle/KStyle styleHint() or draw*() and (unconditionally) expect a valid return, however:
|
||||
a. The StyleHint is not directly above Qt's custom base, assuming most 3rd party apps would
|
||||
- in case - make use of such
|
||||
b. In order to be accepted, the StyleHint query must pass a widget with a perfectly matching
|
||||
name, containing the typical element prefix ("CE_", etc.) and being supported by the current style
|
||||
c. Instead using Qt's fragile qstyleoption_cast on the QStyleOption provided to the StyleHint
|
||||
query, try to dump out a string and hope for the best, we now manipulate the widgets objectName().
|
||||
Plain Qt dependent widgets can do that themselves and if a widget uses KStyle's convenience access
|
||||
functions, it won't notice this at all
|
||||
|
||||
2) The key problem is that a common KDE widget will run into an apps custom style which will then
|
||||
falsely respond to the styleHint() call with an invalid value.
|
||||
To prevent this, supporting styles *must* set a Q_CLASSINFO "X-KDE-CustomElements".
|
||||
|
||||
3) If any of the above traps snaps, the returned id is 0 - the QStyle default, indicating
|
||||
that this element is not supported by the current style.
|
||||
|
||||
Obviously, this contains the "diminished clean" action to (temporarily) manipulate the
|
||||
objectName() of a const QWidget* - but this happens completely inside KStyle or the widget, if
|
||||
it does not make use of KStyles static convenience functions.
|
||||
My biggest worry here would be, that in a multithreaded environment a thread (usually not being
|
||||
owner of the widget) does something crucially relying on the widgets name property...
|
||||
This however would also have to happen during the widget construction or stylechanges, when
|
||||
the functions in doubt will typically be called.
|
||||
So this is imho unlikely causing any trouble, ever.
|
||||
*/
|
||||
|
||||
/*
|
||||
The functions called by the real style implementation to add support for a certain element.
|
||||
Checks for well-formed string (containing the element prefix) and returns 0 otherwise.
|
||||
Checks whether the element is already supported or inserts it otherwise; Returns the proper id
|
||||
NOTICE: We could check for "X-KDE-CustomElements", but this would bloat style start up times
|
||||
(if they e.g. register 100 elements or so)
|
||||
*/
|
||||
|
||||
static inline int newStyleElement(const QString &element, const char *check, int &counter, QHash<QString, int> *elements)
|
||||
{
|
||||
if (!element.contains(QLatin1String(check))) {
|
||||
return 0;
|
||||
}
|
||||
int id = elements->value(element, 0);
|
||||
if (!id) {
|
||||
++counter;
|
||||
id = counter;
|
||||
elements->insert(element, id);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
QStyle::StyleHint KStyle::newStyleHint(const QString &element)
|
||||
{
|
||||
return (StyleHint)newStyleElement(element, "SH_", d->hintCounter, &d->styleElements);
|
||||
}
|
||||
|
||||
QStyle::ControlElement KStyle::newControlElement(const QString &element)
|
||||
{
|
||||
return (ControlElement)newStyleElement(element, "CE_", d->controlCounter, &d->styleElements);
|
||||
}
|
||||
|
||||
KStyle::SubElement KStyle::newSubElement(const QString &element)
|
||||
{
|
||||
return (SubElement)newStyleElement(element, "SE_", d->subElementCounter, &d->styleElements);
|
||||
}
|
||||
|
||||
void KStyle::polish(QWidget *w)
|
||||
{
|
||||
// Enable hover effects in all itemviews
|
||||
if (QAbstractItemView *itemView = qobject_cast<QAbstractItemView *>(w)) {
|
||||
itemView->viewport()->setAttribute(Qt::WA_Hover);
|
||||
}
|
||||
|
||||
if (QDialogButtonBox *box = qobject_cast<QDialogButtonBox *>(w)) {
|
||||
QPushButton *button = box->button(QDialogButtonBox::Ok);
|
||||
|
||||
if (button) {
|
||||
auto shortcut = new QShortcut(Qt::CTRL | Qt::Key_Return, button);
|
||||
QObject::connect(shortcut, &QShortcut::activated, button, &QPushButton::click);
|
||||
}
|
||||
}
|
||||
if (auto messageWidget = qobject_cast<KMessageWidget *>(w)) {
|
||||
KColorScheme scheme;
|
||||
QColor color;
|
||||
QPalette palette = messageWidget->palette();
|
||||
switch (messageWidget->messageType()) {
|
||||
case KMessageWidget::Positive:
|
||||
color = scheme.foreground(KColorScheme::PositiveText).color();
|
||||
break;
|
||||
case KMessageWidget::Information:
|
||||
color = scheme.foreground(KColorScheme::ActiveText).color();
|
||||
break;
|
||||
case KMessageWidget::Warning:
|
||||
color = scheme.foreground(KColorScheme::NeutralText).color();
|
||||
break;
|
||||
case KMessageWidget::Error:
|
||||
color = scheme.foreground(KColorScheme::NegativeText).color();
|
||||
break;
|
||||
}
|
||||
palette.setColor(QPalette::Window, color);
|
||||
messageWidget->setPalette(palette);
|
||||
}
|
||||
QCommonStyle::polish(w);
|
||||
}
|
||||
|
||||
QPalette KStyle::standardPalette() const
|
||||
{
|
||||
return KColorScheme::createApplicationPalette(KSharedConfig::openConfig());
|
||||
}
|
||||
|
||||
QIcon KStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
|
||||
{
|
||||
switch (standardIcon) {
|
||||
case QStyle::SP_DesktopIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("user-desktop"));
|
||||
case QStyle::SP_TrashIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("user-trash"));
|
||||
case QStyle::SP_ComputerIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("computer"));
|
||||
case QStyle::SP_DriveFDIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("media-floppy"));
|
||||
case QStyle::SP_DriveHDIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("drive-harddisk"));
|
||||
case QStyle::SP_DriveCDIcon:
|
||||
case QStyle::SP_DriveDVDIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("drive-optical"));
|
||||
case QStyle::SP_DriveNetIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("folder-remote"));
|
||||
case QStyle::SP_DirHomeIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("user-home"));
|
||||
case QStyle::SP_DirOpenIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("document-open-folder"));
|
||||
case QStyle::SP_DirClosedIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("folder"));
|
||||
case QStyle::SP_DirIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("folder"));
|
||||
case QStyle::SP_DirLinkIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("folder")); // TODO: generate (!?) folder with link emblem
|
||||
case QStyle::SP_FileIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("text-plain")); // TODO: look for a better icon
|
||||
case QStyle::SP_FileLinkIcon:
|
||||
return QIcon::fromTheme(QStringLiteral("text-plain")); // TODO: generate (!?) file with link emblem
|
||||
case QStyle::SP_FileDialogStart:
|
||||
return QIcon::fromTheme(QStringLiteral("media-playback-start")); // TODO: find correct icon
|
||||
case QStyle::SP_FileDialogEnd:
|
||||
return QIcon::fromTheme(QStringLiteral("media-playback-stop")); // TODO: find correct icon
|
||||
case QStyle::SP_FileDialogToParent:
|
||||
return QIcon::fromTheme(QStringLiteral("go-up"));
|
||||
case QStyle::SP_FileDialogNewFolder:
|
||||
return QIcon::fromTheme(QStringLiteral("folder-new"));
|
||||
case QStyle::SP_FileDialogDetailedView:
|
||||
return QIcon::fromTheme(QStringLiteral("view-list-details"));
|
||||
case QStyle::SP_FileDialogInfoView:
|
||||
return QIcon::fromTheme(QStringLiteral("document-properties"));
|
||||
case QStyle::SP_FileDialogContentsView:
|
||||
return QIcon::fromTheme(QStringLiteral("view-list-icons"));
|
||||
case QStyle::SP_FileDialogListView:
|
||||
return QIcon::fromTheme(QStringLiteral("view-list-text"));
|
||||
case QStyle::SP_FileDialogBack:
|
||||
return QIcon::fromTheme(QStringLiteral("go-previous"));
|
||||
case QStyle::SP_MessageBoxInformation:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-information"));
|
||||
case QStyle::SP_MessageBoxWarning:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-warning"));
|
||||
case QStyle::SP_MessageBoxCritical:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-error"));
|
||||
case QStyle::SP_MessageBoxQuestion:
|
||||
// This used to be dialog-information for a long time, so keep it as a fallback
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-question"), QIcon::fromTheme(QStringLiteral("dialog-information")));
|
||||
case QStyle::SP_DialogOkButton:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-ok"));
|
||||
case QStyle::SP_DialogCancelButton:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-cancel"));
|
||||
case QStyle::SP_DialogHelpButton:
|
||||
return QIcon::fromTheme(QStringLiteral("help-contents"));
|
||||
case QStyle::SP_DialogOpenButton:
|
||||
return QIcon::fromTheme(QStringLiteral("document-open"));
|
||||
case QStyle::SP_DialogSaveButton:
|
||||
return QIcon::fromTheme(QStringLiteral("document-save"));
|
||||
case QStyle::SP_DialogCloseButton:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-close"));
|
||||
case QStyle::SP_DialogApplyButton:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-ok-apply"));
|
||||
case QStyle::SP_DialogResetButton:
|
||||
return QIcon::fromTheme(QStringLiteral("edit-undo"));
|
||||
case QStyle::SP_DialogDiscardButton:
|
||||
return QIcon::fromTheme(QStringLiteral("edit-delete"));
|
||||
case QStyle::SP_DialogYesButton:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-ok-apply"));
|
||||
case QStyle::SP_DialogNoButton:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-cancel"));
|
||||
case QStyle::SP_ArrowUp:
|
||||
return QIcon::fromTheme(QStringLiteral("go-up"));
|
||||
case QStyle::SP_ArrowDown:
|
||||
return QIcon::fromTheme(QStringLiteral("go-down"));
|
||||
case QStyle::SP_ArrowLeft:
|
||||
return QIcon::fromTheme(QStringLiteral("go-previous-view"));
|
||||
case QStyle::SP_ArrowRight:
|
||||
return QIcon::fromTheme(QStringLiteral("go-next-view"));
|
||||
case QStyle::SP_ArrowBack:
|
||||
return QIcon::fromTheme(QStringLiteral("go-previous"));
|
||||
case QStyle::SP_ArrowForward:
|
||||
return QIcon::fromTheme(QStringLiteral("go-next"));
|
||||
case QStyle::SP_BrowserReload:
|
||||
return QIcon::fromTheme(QStringLiteral("view-refresh"));
|
||||
case QStyle::SP_BrowserStop:
|
||||
return QIcon::fromTheme(QStringLiteral("process-stop"));
|
||||
case QStyle::SP_MediaPlay:
|
||||
return QIcon::fromTheme(QStringLiteral("media-playback-start"));
|
||||
case QStyle::SP_MediaStop:
|
||||
return QIcon::fromTheme(QStringLiteral("media-playback-stop"));
|
||||
case QStyle::SP_MediaPause:
|
||||
return QIcon::fromTheme(QStringLiteral("media-playback-pause"));
|
||||
case QStyle::SP_MediaSkipForward:
|
||||
return QIcon::fromTheme(QStringLiteral("media-skip-forward"));
|
||||
case QStyle::SP_MediaSkipBackward:
|
||||
return QIcon::fromTheme(QStringLiteral("media-skip-backward"));
|
||||
case QStyle::SP_MediaSeekForward:
|
||||
return QIcon::fromTheme(QStringLiteral("media-seek-forward"));
|
||||
case QStyle::SP_MediaSeekBackward:
|
||||
return QIcon::fromTheme(QStringLiteral("media-seek-backward"));
|
||||
case QStyle::SP_MediaVolume:
|
||||
return QIcon::fromTheme(QStringLiteral("audio-volume-medium"));
|
||||
case QStyle::SP_MediaVolumeMuted:
|
||||
return QIcon::fromTheme(QStringLiteral("audio-volume-muted"));
|
||||
case SP_LineEditClearButton: {
|
||||
const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
|
||||
|
||||
const QString directionalThemeName = rtl ? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl");
|
||||
|
||||
return QIcon::fromTheme(directionalThemeName, QIcon::fromTheme(QStringLiteral("edit-clear")));
|
||||
}
|
||||
case QStyle::SP_DialogYesToAllButton:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-ok"));
|
||||
case QStyle::SP_DialogNoToAllButton:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-cancel"));
|
||||
case QStyle::SP_DialogSaveAllButton:
|
||||
return QIcon::fromTheme(QStringLiteral("document-save-all"));
|
||||
case QStyle::SP_DialogAbortButton:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-cancel"));
|
||||
case QStyle::SP_DialogRetryButton:
|
||||
return QIcon::fromTheme(QStringLiteral("view-refresh"));
|
||||
case QStyle::SP_DialogIgnoreButton:
|
||||
return QIcon::fromTheme(QStringLiteral("dialog-cancel"));
|
||||
case QStyle::SP_RestoreDefaultsButton:
|
||||
return QIcon::fromTheme(QStringLiteral("document-revert"));
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return QCommonStyle::standardIcon(standardIcon, option, widget);
|
||||
}
|
||||
|
||||
int KStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
|
||||
{
|
||||
switch (hint) {
|
||||
case SH_DialogButtonBox_ButtonsHaveIcons: {
|
||||
// was KGlobalSettings::showIconsOnPushButtons() :
|
||||
KConfigGroup g(KSharedConfig::openConfig(), "KDE");
|
||||
return g.readEntry("ShowIconsOnPushButtons", true);
|
||||
}
|
||||
|
||||
case SH_ItemView_ArrowKeysNavigateIntoChildren:
|
||||
return true;
|
||||
|
||||
case SH_Widget_Animate: {
|
||||
KConfigGroup g(KSharedConfig::openConfig(), "KDE-Global GUI Settings");
|
||||
return g.readEntry("GraphicEffectsLevel", true);
|
||||
}
|
||||
|
||||
case QStyle::SH_Menu_SubMenuSloppyCloseTimeout:
|
||||
return 300;
|
||||
|
||||
case SH_ToolButtonStyle: {
|
||||
KConfigGroup g(KSharedConfig::openConfig(), "Toolbar style");
|
||||
|
||||
bool useOthertoolbars = false;
|
||||
const QWidget *parent = widget ? widget->parentWidget() : nullptr;
|
||||
|
||||
// If the widget parent is a QToolBar and the magic property is set
|
||||
if (parent && qobject_cast<const QToolBar *>(parent)) {
|
||||
if (parent->property("otherToolbar").isValid()) {
|
||||
useOthertoolbars = true;
|
||||
}
|
||||
}
|
||||
|
||||
QString buttonStyle;
|
||||
if (useOthertoolbars) {
|
||||
buttonStyle = g.readEntry("ToolButtonStyleOtherToolbars", "NoText").toLower();
|
||||
} else {
|
||||
buttonStyle = g.readEntry("ToolButtonStyle", "TextBesideIcon").toLower();
|
||||
}
|
||||
|
||||
return buttonStyle == QLatin1String("textbesideicon") ? Qt::ToolButtonTextBesideIcon
|
||||
: buttonStyle == QLatin1String("icontextright") ? Qt::ToolButtonTextBesideIcon
|
||||
: buttonStyle == QLatin1String("textundericon") ? Qt::ToolButtonTextUnderIcon
|
||||
: buttonStyle == QLatin1String("icontextbottom") ? Qt::ToolButtonTextUnderIcon
|
||||
: buttonStyle == QLatin1String("textonly") ? Qt::ToolButtonTextOnly
|
||||
: Qt::ToolButtonIconOnly;
|
||||
}
|
||||
|
||||
case SH_KCustomStyleElement:
|
||||
if (!widget) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return d->styleElements.value(widget->objectName(), 0);
|
||||
|
||||
case SH_ScrollBar_LeftClickAbsolutePosition: {
|
||||
KConfigGroup g(KSharedConfig::openConfig(), "KDE");
|
||||
return !g.readEntry("ScrollbarLeftClickNavigatesByPage", true);
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
return QCommonStyle::styleHint(hint, option, widget, returnData);
|
||||
}
|
||||
|
||||
int KStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
|
||||
{
|
||||
switch (metric) {
|
||||
case PM_SmallIconSize:
|
||||
case PM_ButtonIconSize:
|
||||
return KIconLoader::global()->currentSize(KIconLoader::Small);
|
||||
|
||||
case PM_ToolBarIconSize:
|
||||
return KIconLoader::global()->currentSize(KIconLoader::Toolbar);
|
||||
|
||||
case PM_LargeIconSize:
|
||||
return KIconLoader::global()->currentSize(KIconLoader::Dialog);
|
||||
|
||||
case PM_MessageBoxIconSize:
|
||||
// TODO return KIconLoader::global()->currentSize(KIconLoader::MessageBox);
|
||||
return KIconLoader::SizeHuge;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return QCommonStyle::pixelMetric(metric, option, widget);
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
KStyle for KDE5 (KDE Integration)
|
||||
SPDX-FileCopyrightText: 2013 Alejandro Fiestas Olivares <afiestas@kde.org>
|
||||
|
||||
KStyle for KDE4
|
||||
SPDX-FileCopyrightText: 2004-2005 Maksim Orlovich <maksim@kde.org>
|
||||
SPDX-FileCopyrightText: 2005, 2006 Sandro Giessl <giessl@kde.org>
|
||||
|
||||
Based in part on the following software:
|
||||
|
||||
KStyle for KDE3
|
||||
SPDX-FileCopyrightText: 2001-2002 Karol Szwed <gallium@kde.org>
|
||||
Portions
|
||||
SPDX-FileCopyrightText: 1998-2000 TrollTech AS
|
||||
|
||||
Keramik for KDE3,
|
||||
SPDX-FileCopyrightText: 2002 Malte Starostik <malte@kde.org>
|
||||
SPDX-FileCopyrightText: 2002-2003 Maksim Orlovich <maksim@kde.org>
|
||||
Portions
|
||||
SPDX-FileCopyrightText: 2001-2002 Karol Szwed <gallium@kde.org>
|
||||
SPDX-FileCopyrightText: 2001-2002 Fredrik Höglund <fredrik@kde.org>
|
||||
SPDX-FileCopyrightText: 2000 Daniel M. Duley <mosfet@kde.org>
|
||||
SPDX-FileCopyrightText: 2000 Dirk Mueller <mueller@kde.org>
|
||||
SPDX-FileCopyrightText: 2001 Martijn Klingens <klingens@kde.org>
|
||||
SPDX-FileCopyrightText: 2003 Sandro Giessl <sandro@giessl.com>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef KDE_KSTYLE_H
|
||||
#define KDE_KSTYLE_H
|
||||
|
||||
#include <kstyle_export.h>
|
||||
|
||||
#include <QCommonStyle>
|
||||
#include <QPalette>
|
||||
|
||||
class KStylePrivate;
|
||||
/**
|
||||
* Provides integration with KDE Plasma Workspace settings for Qt styles.
|
||||
*
|
||||
* Derive your Qt style from KStyle to automatically inherit
|
||||
* various settings from the KDE Plasma Workspace, providing a
|
||||
* consistent user experience. For example, this will ensure a
|
||||
* consistent single-click or double-click activation setting,
|
||||
* and the use of standard themed icons.
|
||||
*
|
||||
* @author Maksim Orlovich (maksim\@kde.org)
|
||||
* @author Sandro Giessl (giessl\@kde.org)
|
||||
* @author Àlex Fiestas (afiestas\@kde.org)
|
||||
*/
|
||||
|
||||
class KSTYLE_EXPORT KStyle : public QCommonStyle
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KStyle();
|
||||
~KStyle() override;
|
||||
|
||||
/**
|
||||
* Runtime element extension
|
||||
* This is just convenience and does /not/ require the using widgets style to inherit KStyle
|
||||
* (i.e. calling this while using cleanlooks won't segfault or so but just return 0)
|
||||
* Returns a unique id for an element string (e.g. "CE_CapacityBar")
|
||||
*
|
||||
* For simplicity, only StyleHints, ControlElements and their SubElements are supported
|
||||
* If you don't need extended SubElement functionality, just drop it
|
||||
*
|
||||
* @param element The style element, represented as string.
|
||||
* Naming convention: "appname.(2-char-element-type)_element"
|
||||
* where the 2-char-element-type is of {SH, CE, SE}
|
||||
* (widgets in kdelibs don't have to pass the appname)
|
||||
* examples: "CE_CapacityBar", "amarok.CE_Analyzer"
|
||||
* @param widget Your widget ("this") passing this is mandatory, passing NULL will just return 0
|
||||
* @returns a unique id for the @p element string or 0, if the element is not supported by the
|
||||
* widgets current style
|
||||
*
|
||||
* Important notes:
|
||||
* 1) If your string lacks the matching "SH_", "CE_" or "SE_" token the element
|
||||
* request will be ignored (return is 0)
|
||||
* 2) Try to avoid custom elements and use default ones (if possible) to get better style support
|
||||
* and keep UI coherency
|
||||
* 3) If you cache this value (good idea, this requires a map lookup) don't (!) forget to catch
|
||||
* style changes in QWidget::changeEvent()
|
||||
*/
|
||||
static StyleHint customStyleHint(const QString &element, const QWidget *widget);
|
||||
static ControlElement customControlElement(const QString &element, const QWidget *widget);
|
||||
static SubElement customSubElement(const QString &element, const QWidget *widget);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Runtime element extension, allows inheriting styles to add support custom elements
|
||||
* merges supporting inherit chains
|
||||
* Supposed to be called e.g. in your constructor.
|
||||
*
|
||||
* NOTICE: in order to have this work, your style must provide
|
||||
* an "X-KDE-CustomElements" classinfo, i.e.
|
||||
* class MyStyle : public KStyle
|
||||
* {
|
||||
* Q_OBJECT
|
||||
* Q_CLASSINFO ("X-KDE-CustomElements", "true")
|
||||
*
|
||||
* public:
|
||||
* .....
|
||||
* }
|
||||
*
|
||||
* @param element The style element, represented as string.
|
||||
* Suggested naming convention: appname.(2-char-element-type)_element
|
||||
* where the 2-char-element-type is of {SH, CE, SE}
|
||||
* widgets in kdelibs don't have to pass the appname
|
||||
* examples: "CE_CapacityBar", "amarok.CE_Analyzer"
|
||||
*
|
||||
* Important notes:
|
||||
* 1) If your string lacks the matching "SH_", "CE_" or "SE_" token the element
|
||||
* request will be ignored (return is 0)
|
||||
* 2) To keep UI coherency, don't support any nonsense in your style, but convince app developers
|
||||
* to use standard elements - if available
|
||||
*/
|
||||
StyleHint newStyleHint(const QString &element);
|
||||
ControlElement newControlElement(const QString &element);
|
||||
SubElement newSubElement(const QString &element);
|
||||
|
||||
public:
|
||||
//@{
|
||||
int pixelMetric(PixelMetric m, const QStyleOption *opt = nullptr, const QWidget *widget = nullptr) const override;
|
||||
virtual int styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *returnData) const override;
|
||||
|
||||
void polish(QWidget *) override;
|
||||
using QCommonStyle::polish; //! needed to avoid warnings at compilation time
|
||||
|
||||
QPalette standardPalette() const override;
|
||||
|
||||
virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const override;
|
||||
//@}
|
||||
private:
|
||||
KStylePrivate *const d;
|
||||
};
|
||||
|
||||
#endif // KDE_KSTYLE_H
|
|
@ -0,0 +1,3 @@
|
|||
add_executable(kstyletest kstyletest.cpp)
|
||||
target_link_libraries(kstyletest Qt${QT_MAJOR_VERSION}::Widgets KF5::Style)
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
KStyle for KF5
|
||||
SPDX-FileCopyrightText: 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kstyle.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLayout>
|
||||
#include <QPushButton>
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
void showDialog()
|
||||
{
|
||||
QScopedPointer<QDialog> dialog(new QDialog);
|
||||
|
||||
auto *layout = new QVBoxLayout(dialog.data());
|
||||
|
||||
QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok, dialog.data());
|
||||
|
||||
// Useful to change the text because setting the text triggers setShortcut
|
||||
box->button(QDialogButtonBox::Ok)->setText(QStringLiteral("Send"));
|
||||
QObject::connect(box, &QDialogButtonBox::accepted, dialog.data(), &QDialog::accept);
|
||||
QObject::connect(box, &QDialogButtonBox::rejected, dialog.data(), &QDialog::reject);
|
||||
|
||||
auto usefulWidget = new QTextEdit(dialog.data());
|
||||
layout->addWidget(usefulWidget);
|
||||
layout->addWidget(box);
|
||||
|
||||
// Make sure we test ctrl+return acceptance with the focus on the button
|
||||
usefulWidget->setFocus();
|
||||
|
||||
dialog->resize(200, 200);
|
||||
dialog->exec();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
app.setStyle(new KStyle);
|
||||
|
||||
QWidget w;
|
||||
auto *layout = new QVBoxLayout(&w);
|
||||
|
||||
QPushButton *showDialogButton = new QPushButton(QStringLiteral("Dialog"), &w);
|
||||
QObject::connect(showDialogButton, &QPushButton::clicked, &showDialog);
|
||||
layout->addWidget(showDialogButton);
|
||||
w.resize(200, 200);
|
||||
w.show();
|
||||
|
||||
return app.exec();
|
||||
}
|