Plasma desktop workspace tweaks

This commit is contained in:
Raziel K. Crowe 2022-03-05 22:41:29 +05:00
parent 0a98584504
commit 0d174a3fe6
2150 changed files with 234244 additions and 0 deletions

View File

@ -0,0 +1,64 @@
# SPDX-FileCopyrightText: None
# SPDX-License-Identifier: CC0-1.0
Dependencies:
- 'on': ['@all']
'require':
'frameworks/attica': '@latest'
'frameworks/baloo': '@latest'
'frameworks/extra-cmake-modules': '@latest'
'frameworks/kactivities': '@latest'
'frameworks/kactivities-stats': '@latest'
'frameworks/kauth': '@latest'
'frameworks/kbookmarks': '@latest'
'frameworks/kcmutils': '@latest'
'frameworks/kcodecs': '@latest'
'frameworks/kcompletion': '@latest'
'frameworks/kconfig': '@latest'
'frameworks/kconfigwidgets': '@latest'
'frameworks/kcoreaddons': '@latest'
'frameworks/kcrash': '@latest'
'frameworks/kdbusaddons': '@latest'
'frameworks/kdeclarative': '@latest'
'frameworks/kfilemetadata': '@latest'
'frameworks/kglobalaccel': '@latest'
'frameworks/kguiaddons': '@latest'
'frameworks/ki18n': '@latest'
'frameworks/kiconthemes': '@latest'
'frameworks/kio': '@latest'
'frameworks/kitemmodels': '@latest'
'frameworks/kitemviews': '@latest'
'frameworks/kjobwidgets': '@latest'
'frameworks/knewstuff': '@latest'
'frameworks/knotifications': '@latest'
'frameworks/knotifyconfig': '@latest'
'frameworks/kpackage': '@latest'
'frameworks/kparts': '@latest'
'frameworks/krunner': '@latest'
'frameworks/kservice': '@latest'
'frameworks/ktextwidgets': '@latest'
'frameworks/kwallet': '@latest'
'frameworks/kwidgetsaddons': '@latest'
'frameworks/kwindowsystem': '@latest'
'frameworks/kxmlgui': '@latest'
'frameworks/plasma-framework': '@latest'
'frameworks/solid': '@latest'
'frameworks/sonnet': '@latest'
'frameworks/kholidays': '@latest'
'frameworks/kquickcharts': '@latest'
'frameworks/kded': '@latest'
'frameworks/kdesu': '@latest'
'frameworks/kpeople': '@latest'
'frameworks/prison': '@latest'
'frameworks/kinit': '@latest'
'plasma/layer-shell-qt': '@same'
'plasma/kscreenlocker': '@same'
'plasma/libkscreen': '@same'
'plasma/kwin': '@same'
'plasma/libksysguard': '@same'
'libraries/plasma-wayland-protocols': '@latest'
'libraries/kuserfeedback': '@stable'
- 'on': ['Linux']
'require':
'frameworks/networkmanager-qt': '@latest'

View File

@ -0,0 +1,298 @@
cmake_minimum_required(VERSION 3.16)
project(plasma-workspace)
set(PROJECT_VERSION "5.24.80")
set(PROJECT_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.89")
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
set(INSTALL_SDDM_THEME TRUE)
option(INSTALL_SDDM_WAYLAND_SESSION OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Svg Widgets Quick QuickWidgets Concurrent Test Network)
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMMarkNonGuiExecutable)
include(CMakePackageConfigHelpers)
include(WriteBasicConfigVersionFile)
include(CheckIncludeFiles)
include(FeatureSummary)
include(ECMOptionalAddSubdirectory)
include(ECMQtDeclareLoggingCategory)
include(ECMQueryQmake)
include(ECMInstallIcons)
include(KDEClangFormat)
include(KDEGitCommitHooks)
include(ECMConfiguredInstall)
include(ECMGenerateDBusServiceFile)
include(ECMQMLModules)
include(ECMGenerateExportHeader)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Plasma Runner Notifications NotifyConfig NewStuff Wallet IdleTime
Declarative I18n KCMUtils TextWidgets Crash GlobalAccel DBusAddons Wayland
CoreAddons People ActivitiesStats Activities KIO Prison PlasmaQuick Package
GuiAddons Archive ItemModels IconThemes UnitConversion ItemModels Init TextEditor
OPTIONAL_COMPONENTS DocTools)
find_package(KDED CONFIG REQUIRED)
find_package(KF5NetworkManagerQt ${KF5_MIN_VERSION})
set_package_properties(KF5NetworkManagerQt PROPERTIES DESCRIPTION "Qt wrapper for NetworkManager API"
TYPE OPTIONAL
PURPOSE "Needed by geolocation data engine."
)
find_package(KF5Kirigami2 ${KF5_MIN_VERSION} CONFIG)
set_package_properties(KF5Kirigami2 PROPERTIES
DESCRIPTION "A QtQuick based components set"
TYPE RUNTIME
)
find_package(KF5QuickCharts ${KF5_MIN_VERSION} CONFIG)
set_package_properties(KF5QuickCharts PROPERTIES
DESCRIPTION "Used for rendering charts"
TYPE RUNTIME
)
find_package(KUserFeedback)
find_package(KSysGuard CONFIG REQUIRED)
find_package(KF5Baloo)
set_package_properties(KF5Baloo PROPERTIES DESCRIPTION "File Searching"
TYPE RECOMMENDED
PURPOSE "Needed for the File Search runner."
)
find_package(Qalculate REQUIRED)
set_package_properties(Qalculate PROPERTIES DESCRIPTION "Qalculate Library"
URL "https://qalculate.github.io/"
PURPOSE "Needed for precise computation in the calculator runner."
)
find_package(KWinDBusInterface CONFIG REQUIRED)
find_package(KF5Screen CONFIG REQUIRED)
find_package(KScreenLocker 5.13.80 REQUIRED)
find_package(ScreenSaverDBusInterface CONFIG REQUIRED)
find_package(LayerShellQt CONFIG REQUIRED)
find_package(KF5Holidays)
set_package_properties(KF5Holidays PROPERTIES DESCRIPTION "Holidays provider for Plasma calendar"
TYPE OPTIONAL
PURPOSE "Needed to for holidays plugin for Plasma Calendar."
)
find_package(Phonon4Qt5 4.6.60 REQUIRED NO_MODULE)
set_package_properties(Phonon4Qt5 PROPERTIES
DESCRIPTION "Qt-based audio library"
TYPE REQUIRED)
find_package(Breeze ${PROJECT_VERSION} CONFIG)
set_package_properties(Breeze PROPERTIES
TYPE OPTIONAL
PURPOSE "For setting the default window decoration plugin")
find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES DESCRIPTION "Support for gzip compressed files and data streams"
URL "https://www.zlib.net"
TYPE REQUIRED
)
find_package(Fontconfig)
set_package_properties(Fontconfig PROPERTIES DESCRIPTION "Font access configuration library"
URL "https://www.freedesktop.org/wiki/Software/fontconfig"
TYPE OPTIONAL
PURPOSE "Needed to build font configuration and installation tools"
)
find_package(X11)
set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
URL "https://www.x.org"
TYPE OPTIONAL
PURPOSE "Required for building the X11 based workspace")
find_package(PkgConfig REQUIRED)
pkg_check_modules(PipeWire IMPORTED_TARGET libpipewire-0.3)
add_feature_info(PipeWire PipeWire_FOUND "Required for Wayland screencasting")
if(PipeWire_FOUND)
find_package(Libdrm REQUIRED)
endif()
find_package(QtWaylandScanner REQUIRED)
find_package(Qt5WaylandClient)
find_package(Qt5XkbCommonSupport)
find_package(PlasmaWaylandProtocols 1.6 REQUIRED)
find_package(Wayland REQUIRED COMPONENTS Client Server) # Server is used in autotests
if(FONTCONFIG_FOUND)
# kfontinst
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS PrintSupport)
endif()
if(X11_FOUND)
find_package(XCB MODULE REQUIRED COMPONENTS XCB RANDR IMAGE)
set_package_properties(XCB PROPERTIES TYPE REQUIRED)
if(NOT X11_SM_FOUND)
message(FATAL_ERROR "\nThe X11 Session Management (SM) development package could not be found.\nPlease install libSM.\n")
endif(NOT X11_SM_FOUND)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS X11Extras)
endif()
if(X11_FOUND AND XCB_XCB_FOUND)
set(HAVE_X11 1)
endif()
find_package(AppStreamQt 0.10.6)
set_package_properties(AppStreamQt PROPERTIES DESCRIPTION "Access metadata for listing available software"
URL "https://www.freedesktop.org/wiki/Distributions/AppStream/"
TYPE OPTIONAL)
if(${AppStreamQt_FOUND})
set(HAVE_APPSTREAMQT true)
endif()
find_package(PackageKitQt5)
set_package_properties(PackageKitQt5
PROPERTIES DESCRIPTION "Software Manager integration"
TYPE OPTIONAL
PURPOSE "Used to install additional language packages on demand"
)
if(PackageKitQt5_FOUND)
set(HAVE_PACKAGEKIT TRUE)
endif()
find_package(KIOExtras)
set_package_properties(KIOExtras PROPERTIES DESCRIPTION "Common KIO slaves for operations."
PURPOSE "Show thumbnails in wallpaper selection."
TYPE RUNTIME
)
find_package(KIOFuse)
set_package_properties(KIOFuse PROPERTIES DESCRIPTION "Provide KIO support to legacy applications. "
TYPE RUNTIME
)
# Clipboard applet
ecm_find_qmlmodule(org.kde.prison 1.0)
include(ConfigureChecks.cmake)
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055800)
add_definitions(-DKITEMMODELS_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054F00)
configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-workspace.h)
configure_file(config-unix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-unix.h )
configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h)
configure_file(config-appstream.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-appstream.h )
add_subdirectory(login-sessions)
plasma_install_package(lookandfeel org.kde.breeze.desktop look-and-feel lookandfeel)
plasma_install_package(lookandfeel.dark org.kde.breezedark.desktop look-and-feel lookandfeel)
plasma_install_package(lookandfeel.twilight org.kde.breezetwilight.desktop look-and-feel lookandfeel)
if (INSTALL_SDDM_THEME)
configure_file(sddm-theme/theme.conf.cmake ${CMAKE_CURRENT_BINARY_DIR}/sddm-theme/theme.conf)
# Install the login theme into the SDDM directory
# Longer term we need to look at making SDDM load from look and feel somehow.. and allow copying at runtime
#NOTE this trailing slash is important to rename the directory
install(DIRECTORY sddm-theme/ DESTINATION ${KDE_INSTALL_FULL_DATADIR}/sddm/themes/breeze PATTERN "README.txt" EXCLUDE PATTERN "components" EXCLUDE PATTERN "dummydata" EXCLUDE
PATTERN "theme.conf.cmake" EXCLUDE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sddm-theme/theme.conf DESTINATION ${KDE_INSTALL_FULL_DATADIR}/sddm/themes/breeze)
install(DIRECTORY lookandfeel/contents/components DESTINATION ${KDE_INSTALL_FULL_DATADIR}/sddm/themes/breeze PATTERN "README.txt" EXCLUDE)
endif()
if (INSTALL_SDDM_WAYLAND_SESSION)
install(FILES sddm-wayland-session/plasma-wayland.conf DESTINATION /etc/sddm.conf.d)
else()
message(STATUS "INSTALL_SDDM_WAYLAND_SESSION is disabled. As soon as it's installed, SDDM will default to use Wayland and KWin for its greeter session (BETA, do not deploy to final users yet).")
endif()
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
# locate qdbus in the Qt path because not every distro makes a symlink at /usr/bin/qdbus
query_qmake(QtBinariesDir QT_INSTALL_BINS)
option(PLASMA_WAYLAND_DEFAULT_SESSION "Use Wayland session by default for Plasma" FALSE)
if(KF5DocTools_FOUND)
add_subdirectory(doc)
endif()
add_subdirectory(libkworkspace)
add_subdirectory(libdbusmenuqt)
add_subdirectory(appmenu)
add_subdirectory(libtaskmanager)
add_subdirectory(libnotificationmanager)
add_subdirectory(libcolorcorrect)
add_subdirectory(components)
add_subdirectory(plasma-windowed)
add_subdirectory(shell)
add_subdirectory(freespacenotifier)
add_subdirectory(klipper)
add_subdirectory(krunner)
add_subdirectory(ksmserver)
add_subdirectory(logout-greeter)
add_subdirectory(ksplash)
add_subdirectory(systemmonitor)
add_subdirectory(statusnotifierwatcher)
add_subdirectory(startkde)
add_subdirectory(themes)
add_subdirectory(kcms)
add_subdirectory(containmentactions)
add_subdirectory(runners)
add_subdirectory(applets)
add_subdirectory(dataengines)
add_subdirectory(wallpapers)
add_subdirectory(kioslave)
add_subdirectory(ktimezoned)
add_subdirectory(menu)
add_subdirectory(phonon)
add_subdirectory(interactiveconsole)
# This ensures pressing the eject button on a CD drive ejects the disc
# It listens to the Solid::OpticalDrive::ejectPressed signal that is only
# supported by Solid in the HAL backend and does nothing with UDev
if(CMAKE_SYSTEM_NAME MATCHES FreeBSD)
add_subdirectory(solidautoeject)
endif()
ecm_optional_add_subdirectory(xembed-sni-proxy)
ecm_optional_add_subdirectory(gmenu-dbusmenu-proxy)
add_subdirectory(soliduiserver)
if(KF5Holidays_FOUND)
add_subdirectory(plasmacalendarintegration)
endif()
ki18n_install(po)
install(FILES plasma-workspace.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
# add clang-format target for all our real source files
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)

View File

@ -0,0 +1,9 @@
set(KWIN_BIN "kwin_x11" CACHE STRING "Name of the KWin binary")
check_include_files(limits.h HAVE_LIMITS_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H) # ksmserver, ksplashml, sftp
check_include_files(unistd.h HAVE_UNISTD_H)
set(HAVE_FONTCONFIG ${FONTCONFIG_FOUND}) # kcms/{fonts,kfontinst}
set(HAVE_XCURSOR ${X11_Xcursor_FOUND}) # many uses
set(HAVE_XFIXES ${X11_Xfixes_FOUND}) # klipper, kicker

View File

@ -0,0 +1,4 @@
#! /bin/sh
#This file outputs in a separate line each file with a .desktop syntax
#that needs to be translated but has a non .desktop extension
find -name \*.kdevtemplate -print

View File

@ -0,0 +1,22 @@
Copyright (c) <year> <owner> All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,26 @@
Copyright (c) <year> <owner>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -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.

View File

@ -0,0 +1,311 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, 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.
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public License is intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users. This General Public License applies to
most of the Free Software Foundation's software and to any other program whose
authors commit to using it. (Some other Free Software Foundation software
is covered by the GNU Lesser General Public License instead.) You can apply
it to your programs, 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 software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or
for a fee, you must give the recipients all the rights that you have. You
must make sure that they, too, receive or can get the source code. And you
must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2)
offer you this license which gives you legal permission to copy, distribute
and/or modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If
the software is modified by someone else and passed on, we want its recipients
to know that what they have is not the original, 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 redistributors of a free program will individually
obtain patent licenses, in effect making the program proprietary. To prevent
this, we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms
of this General Public License. The "Program", below, refers to any such program
or work, and a "work based on the Program" means either the Program or any
derivative work under copyright law: that is to say, a work containing the
Program or a portion of it, either verbatim or with modifications and/or translated
into another language. (Hereinafter, translation is included without limitation
in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running the Program
is not restricted, and the output from the Program is covered only if its
contents constitute a work based on the Program (independent of having been
made by running the Program). Whether that is true depends on what the Program
does.
1. You may copy and distribute verbatim copies of the Program's 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 give any other recipients of the Program a copy of this
License along with the Program.
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 Program or any portion of it,
thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices stating that
you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or
in part contains or is derived from the Program or any part thereof, to be
licensed as a whole at no charge to all third parties under the terms of this
License.
c) If the modified program normally reads commands interactively when run,
you must cause it, when started running for such interactive use in the most
ordinary way, to print or display an announcement including an appropriate
copyright notice and a notice that there is no warranty (or else, saying that
you provide a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this License.
(Exception: if the Program itself is interactive but does not normally print
such an announcement, your work based on the Program is not required to print
an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, 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 Program, 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 Program.
In addition, mere aggregation of another work not based on the Program with
the Program (or with a work based on the Program) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may copy and distribute the Program (or a work based on it, under Section
2) in object code or executable form under the terms of Sections 1 and 2 above
provided that you also do one of the following:
a) 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; or,
b) Accompany it with a written offer, valid for at least three years, to give
any third party, for a charge no more than your cost of physically performing
source distribution, a complete machine-readable copy of the corresponding
source code, to be distributed under the terms of Sections 1 and 2 above on
a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for noncommercial
distribution and only if you received the program in object code or executable
form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, 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 executable. 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.
If distribution of executable or 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 counts as distribution of the source code,
even though third parties are not compelled to copy the source along with
the object code.
4. You may not copy, modify, sublicense, or distribute the Program except
as expressly provided under this License. Any attempt otherwise to copy, modify,
sublicense or distribute the Program 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.
5. 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
Program or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the Program
(or any work based on the Program), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program),
the recipient automatically receives a license from the original licensor
to copy, distribute or modify the Program 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.
7. 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 Program at all. For example, if a
patent license would not permit royalty-free redistribution of the Program
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 Program.
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.
8. If the distribution and/or use of the Program is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Program 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.
9. The Free Software Foundation may publish revised and/or new versions of
the 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 Program 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
Program does not specify a version number of this License, you may choose
any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, 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
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
"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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 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 Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. 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 program's name and an idea of what it does. Copyright
(C) yyyy name of author
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
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.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how
to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when
it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software,
and you are welcome to redistribute it under certain conditions; type `show
c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may be
called something other than `show w' and `show c'; they could even be mouse-clicks
or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision'
(which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice

View File

@ -0,0 +1,311 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, 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.
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public License is intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users. This General Public License applies to
most of the Free Software Foundation's software and to any other program whose
authors commit to using it. (Some other Free Software Foundation software
is covered by the GNU Lesser General Public License instead.) You can apply
it to your programs, 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 software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or
for a fee, you must give the recipients all the rights that you have. You
must make sure that they, too, receive or can get the source code. And you
must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2)
offer you this license which gives you legal permission to copy, distribute
and/or modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If
the software is modified by someone else and passed on, we want its recipients
to know that what they have is not the original, 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 redistributors of a free program will individually
obtain patent licenses, in effect making the program proprietary. To prevent
this, we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms
of this General Public License. The "Program", below, refers to any such program
or work, and a "work based on the Program" means either the Program or any
derivative work under copyright law: that is to say, a work containing the
Program or a portion of it, either verbatim or with modifications and/or translated
into another language. (Hereinafter, translation is included without limitation
in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running the Program
is not restricted, and the output from the Program is covered only if its
contents constitute a work based on the Program (independent of having been
made by running the Program). Whether that is true depends on what the Program
does.
1. You may copy and distribute verbatim copies of the Program's 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 give any other recipients of the Program a copy of this
License along with the Program.
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 Program or any portion of it,
thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices stating that
you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or
in part contains or is derived from the Program or any part thereof, to be
licensed as a whole at no charge to all third parties under the terms of this
License.
c) If the modified program normally reads commands interactively when run,
you must cause it, when started running for such interactive use in the most
ordinary way, to print or display an announcement including an appropriate
copyright notice and a notice that there is no warranty (or else, saying that
you provide a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this License.
(Exception: if the Program itself is interactive but does not normally print
such an announcement, your work based on the Program is not required to print
an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, 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 Program, 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 Program.
In addition, mere aggregation of another work not based on the Program with
the Program (or with a work based on the Program) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may copy and distribute the Program (or a work based on it, under Section
2) in object code or executable form under the terms of Sections 1 and 2 above
provided that you also do one of the following:
a) 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; or,
b) Accompany it with a written offer, valid for at least three years, to give
any third party, for a charge no more than your cost of physically performing
source distribution, a complete machine-readable copy of the corresponding
source code, to be distributed under the terms of Sections 1 and 2 above on
a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for noncommercial
distribution and only if you received the program in object code or executable
form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, 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 executable. 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.
If distribution of executable or 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 counts as distribution of the source code,
even though third parties are not compelled to copy the source along with
the object code.
4. You may not copy, modify, sublicense, or distribute the Program except
as expressly provided under this License. Any attempt otherwise to copy, modify,
sublicense or distribute the Program 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.
5. 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
Program or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the Program
(or any work based on the Program), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program),
the recipient automatically receives a license from the original licensor
to copy, distribute or modify the Program 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.
7. 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 Program at all. For example, if a
patent license would not permit royalty-free redistribution of the Program
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 Program.
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.
8. If the distribution and/or use of the Program is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Program 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.
9. The Free Software Foundation may publish revised and/or new versions of
the 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 Program 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
Program does not specify a version number of this License, you may choose
any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, 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
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
"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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 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 Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. 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 program's name and an idea of what it does. Copyright
(C) yyyy name of author
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
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.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how
to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when
it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software,
and you are welcome to redistribute it under certain conditions; type `show
c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may be
called something other than `show w' and `show c'; they could even be mouse-clicks
or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision'
(which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice

View File

@ -0,0 +1,604 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software and
other kinds of works.
The licenses for most software and other practical works are designed to take
away your freedom to share and change the works. By contrast, the GNU General
Public License is intended to guarantee your freedom to share and change all
versions of a program--to make sure it remains free software for all its users.
We, the Free Software Foundation, use the GNU General Public License for most
of our software; it applies also to any other work released this way by its
authors. You can apply it to your programs, 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 them 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 prevent others from denying you these rights
or asking you to surrender the rights. Therefore, you have certain responsibilities
if you distribute copies of the software, or if you modify it: responsibilities
to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or
for a fee, you must pass on to the recipients the same freedoms that you received.
You must make sure that they, too, receive or can get the source code. And
you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert
copyright on the software, and (2) offer you this License giving you legal
permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that
there is no warranty for this free software. For both users' and authors'
sake, the GPL requires that modified versions be marked as changed, so that
their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified
versions of the software inside them, although the manufacturer can do so.
This is fundamentally incompatible with the aim of protecting users' freedom
to change the software. The systematic pattern of such abuse occurs in the
area of products for individuals to use, which is precisely where it is most
unacceptable. Therefore, we have designed this version of the GPL to prohibit
the practice for those products. If such problems arise substantially in other
domains, we stand ready to extend this provision to those domains in future
versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States
should not allow patents to restrict development and use of software on general-purpose
computers, but in those that do, we wish to avoid the special danger that
patents applied to a free program could make it effectively proprietary. To
prevent this, the GPL assures that patents cannot be used to render the program
non-free.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to version 3 of the GNU General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of works,
such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this License.
Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals
or organizations.
To “modify” a work means to copy from or adapt all or part of the work in
a fashion requiring copyright permission, other than the making of an exact
copy. The resulting work is called a “modified version” of the earlier work
or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the
Program.
To “propagate” a work means to do anything with it that, without permission,
would make you directly or secondarily liable for infringement under applicable
copyright law, except executing it on a computer or modifying a private copy.
Propagation includes copying, distribution (with or without modification),
making available to the public, and in some countries other activities as
well.
To “convey” a work means any kind of propagation that enables other parties
to make or receive copies. Mere interaction with a user through a computer
network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the
extent that it includes a convenient and prominently visible feature that
(1) displays an appropriate copyright notice, and (2) tells the user that
there is no warranty for the work (except to the extent that warranties are
provided), that licensees may convey the work under this License, and how
to view a copy of this License. If the interface presents a list of user commands
or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for making
modifications to it. “Object code” means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard
defined by a recognized standards body, or, in the case of interfaces specified
for a particular programming language, one that is widely used among developers
working in that language.
The “System Libraries” of an executable work include anything, other than
the work as a whole, that (a) is included in the normal form of packaging
a Major Component, but which is not part of that Major Component, and (b)
serves only to enable use of the work with that Major Component, or to implement
a Standard Interface for which an implementation is available to the public
in source code form. A “Major Component”, in this context, means a major essential
component (kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to produce
the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source
code needed to generate, install, and (for an executable work) run the object
code and to modify the work, including scripts to control those activities.
However, it does not include the work's System Libraries, or general-purpose
tools or generally available free programs which are used unmodified in performing
those activities but which are not part of the work. For example, Corresponding
Source includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically linked
subprograms that the work is specifically designed to require, such as by
intimate data communication or control flow between those subprograms and
other parts of the work.
The Corresponding Source need not include anything that users can regenerate
automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright
on the Program, and are irrevocable provided the stated conditions are met.
This License explicitly affirms your unlimited permission to run the unmodified
Program. The output from running a covered work is covered by this License
only if the output, given its content, constitutes a covered work. This License
acknowledges your rights of fair use or other equivalent, as provided by copyright
law.
You may make, run and propagate covered works that you do not convey, without
conditions so long as your license otherwise remains in force. You may convey
covered works to others for the sole purpose of having them make modifications
exclusively for you, or provide you with facilities for running those works,
provided that you comply with the terms of this License in conveying all material
for which you do not control copyright. Those thus making or running the covered
works for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of your copyrighted
material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions
stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure
under any applicable law fulfilling obligations under article 11 of the WIPO
copyright treaty adopted on 20 December 1996, or similar laws prohibiting
or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention
of technological measures to the extent such circumvention is effected by
exercising rights under this License with respect to the covered work, and
you disclaim any intention to limit operation or modification of the work
as a means of enforcing, against the work's users, your or third parties'
legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive
it, in any medium, provided that you conspicuously and appropriately publish
on each copy an appropriate copyright notice; keep intact all notices stating
that this License and any non-permissive terms added in accord with section
7 apply to the code; keep intact all notices of the absence of any warranty;
and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you
may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce
it from the Program, in the form of source code under the terms of section
4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and
giving a relevant date.
b) The work must carry prominent notices stating that it is released under
this License and any conditions added under section 7. This requirement modifies
the requirement in section 4 to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone
who comes into possession of a copy. This License will therefore apply, along
with any applicable section 7 additional terms, to the whole of the work,
and all its parts, regardless of how they are packaged. This License gives
no permission to license the work in any other way, but it does not invalidate
such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate
Legal Notices; however, if the Program has interactive interfaces that do
not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works,
which are not by their nature extensions of the covered work, and which are
not combined with it such as to form a larger program, in or on a volume of
a storage or distribution medium, is called an “aggregate” if the compilation
and its resulting copyright are not used to limit the access or legal rights
of the compilation's users beyond what the individual works permit. Inclusion
of a covered work in an aggregate does not cause this License to apply to
the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections
4 and 5, provided that you also convey the machine-readable Corresponding
Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including
a physical distribution medium), accompanied by the Corresponding Source fixed
on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including
a physical distribution medium), accompanied by a written offer, valid for
at least three years and valid for as long as you offer spare parts or customer
support for that product model, to give anyone who possesses the object code
either (1) a copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical medium customarily
used for software interchange, for a price no more than your reasonable cost
of physically performing this conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written
offer to provide the Corresponding Source. This alternative is allowed only
occasionally and noncommercially, and only if you received the object code
with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis
or for a charge), and offer equivalent access to the Corresponding Source
in the same way through the same place at no further charge. You need not
require recipients to copy the Corresponding Source along with the object
code. If the place to copy the object code is a network server, the Corresponding
Source may be on a different server (operated by you or a third party) that
supports equivalent copying facilities, provided you maintain clear directions
next to the object code saying where to find the Corresponding Source. Regardless
of what server hosts the Corresponding Source, you remain obligated to ensure
that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform
other peers where the object code and Corresponding Source of the work are
being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from
the Corresponding Source as a System Library, need not be included in conveying
the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible
personal property which is normally used for personal, family, or household
purposes, or (2) anything designed or sold for incorporation into a dwelling.
In determining whether a product is a consumer product, doubtful cases shall
be resolved in favor of coverage. For a particular product received by a particular
user, “normally used” refers to a typical or common use of that class of product,
regardless of the status of the particular user or of the way in which the
particular user actually uses, or expects or is expected to use, the product.
A product is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent the
only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures,
authorization keys, or other information required to install and execute modified
versions of a covered work in that User Product from a modified version of
its Corresponding Source. The information must suffice to ensure that the
continued functioning of the modified object code is in no case prevented
or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically
for use in, a User Product, and the conveying occurs as part of a transaction
in which the right of possession and use of the User Product is transferred
to the recipient in perpetuity or for a fixed term (regardless of how the
transaction is characterized), the Corresponding Source conveyed under this
section must be accompanied by the Installation Information. But this requirement
does not apply if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has been installed
in ROM).
The requirement to provide Installation Information does not include a requirement
to continue to provide support service, warranty, or updates for a work that
has been modified or installed by the recipient, or for the User Product in
which it has been modified or installed. Access to a network may be denied
when the modification itself materially and adversely affects the operation
of the network or violates the rules and protocols for communication across
the network.
Corresponding Source conveyed, and Installation Information provided, in accord
with this section must be in a format that is publicly documented (and with
an implementation available to the public in source code form), and must require
no special password or key for unpacking, reading or copying.
7. Additional Terms.
“Additional permissions” are terms that supplement the terms of this License
by making exceptions from one or more of its conditions. Additional permissions
that are applicable to the entire Program shall be treated as though they
were included in this License, to the extent that they are valid under applicable
law. If additional permissions apply only to part of the Program, that part
may be used separately under those permissions, but the entire Program remains
governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any
additional permissions from that copy, or from any part of it. (Additional
permissions may be written to require their own removal in certain cases when
you modify the work.) You may place additional permissions on material, added
by you to a covered work, for which you have or can give appropriate copyright
permission.
Notwithstanding any other provision of this License, for material you add
to a covered work, you may (if authorized by the copyright holders of that
material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of
sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author
attributions in that material or in the Appropriate Legal Notices displayed
by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring
that modified versions of such material be marked in reasonable ways as different
from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors
of the material; or
e) Declining to grant rights under trademark law for use of some trade names,
trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by
anyone who conveys the material (or modified versions of it) with contractual
assumptions of liability to the recipient, for any liability that these contractual
assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered “further restrictions”
within the meaning of section 10. If the Program as you received it, or any
part of it, contains a notice stating that it is governed by this License
along with a term that is a further restriction, you may remove that term.
If a license document contains a further restriction but permits relicensing
or conveying under this License, you may add to a covered work material governed
by the terms of that license document, provided that the further restriction
does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place,
in the relevant source files, a statement of the additional terms that apply
to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form
of a separately written license, or stated as exceptions; the above requirements
apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided
under this License. Any attempt otherwise to propagate or modify it is void,
and will automatically terminate your rights under this License (including
any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from
a particular copyright holder is reinstated (a) provisionally, unless and
until the copyright holder explicitly and finally terminates your license,
and (b) permanently, if the copyright holder fails to notify you of the violation
by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently
if the copyright holder notifies you of the violation by some reasonable means,
this is the first time you have received notice of violation of this License
(for any work) from that copyright holder, and you cure the violation prior
to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses
of parties who have received copies or rights from you under this License.
If your rights have been terminated and not permanently reinstated, you do
not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy
of the Program. Ancillary propagation of a covered work occurring solely as
a consequence of using peer-to-peer transmission to receive a copy likewise
does not require acceptance. However, nothing other than this License grants
you permission to propagate or modify any covered work. These actions infringe
copyright if you do not accept this License. Therefore, by modifying or propagating
a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives
a license from the original licensors, to run, modify and propagate that work,
subject to this License. You are not responsible for enforcing compliance
by third parties with this License.
An “entity transaction” is a transaction transferring control of an organization,
or substantially all assets of one, or subdividing an organization, or merging
organizations. If propagation of a covered work results from an entity transaction,
each party to that transaction who receives a copy of the work also receives
whatever licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the Corresponding
Source of the work from the predecessor in interest, if the predecessor has
it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights
granted or affirmed under this License. For example, you may not impose a
license fee, royalty, or other charge for exercise of rights granted under
this License, and you may not initiate litigation (including a cross-claim
or counterclaim in a lawsuit) alleging that any patent claim is infringed
by making, using, selling, offering for sale, or importing the Program or
any portion of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this License
of the Program or a work on which the Program is based. The work thus licensed
is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims owned or controlled
by the contributor, whether already acquired or hereafter acquired, that would
be infringed by some manner, permitted by this License, of making, using,
or selling its contributor version, but do not include claims that would be
infringed only as a consequence of further modification of the contributor
version. For purposes of this definition, “control” includes the right to
grant patent sublicenses in a manner consistent with the requirements of this
License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent
license under the contributor's essential patent claims, to make, use, sell,
offer for sale, import and otherwise run, modify and propagate the contents
of its contributor version.
In the following three paragraphs, a “patent license” is any express agreement
or commitment, however denominated, not to enforce a patent (such as an express
permission to practice a patent or covenant not to sue for patent infringement).
To “grant” such a patent license to a party means to make such an agreement
or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the
Corresponding Source of the work is not available for anyone to copy, free
of charge and under the terms of this License, through a publicly available
network server or other readily accessible means, then you must either (1)
cause the Corresponding Source to be so available, or (2) arrange to deprive
yourself of the benefit of the patent license for this particular work, or
(3) arrange, in a manner consistent with the requirements of this License,
to extend the patent license to downstream recipients. “Knowingly relying”
means you have actual knowledge that, but for the patent license, your conveying
the covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that country
that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement,
you convey, or propagate by procuring conveyance of, a covered work, and grant
a patent license to some of the parties receiving the covered work authorizing
them to use, propagate, modify or convey a specific copy of the covered work,
then the patent license you grant is automatically extended to all recipients
of the covered work and works based on it.
A patent license is “discriminatory” if it does not include within the scope
of its coverage, prohibits the exercise of, or is conditioned on the non-exercise
of one or more of the rights that are specifically granted under this License.
You may not convey a covered work if you are a party to an arrangement with
a third party that is in the business of distributing software, under which
you make payment to the third party based on the extent of your activity of
conveying the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by you
(or copies made from those copies), or (b) primarily for and in connection
with specific products or compilations that contain the covered work, unless
you entered into that arrangement, or that patent license was granted, prior
to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied
license or other defenses to infringement that may otherwise be available
to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a covered work so as
to satisfy simultaneously your obligations under this License and any other
pertinent obligations, then as a consequence you may not convey it at all.
For example, if you agree to terms that obligate you to collect a royalty
for further conveying from those to whom you convey the Program, the only
way you could satisfy both those terms and this License would be to refrain
entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to
link or combine any covered work with a work licensed under version 3 of the
GNU Affero General Public License into a single combined work, and to convey
the resulting work. The terms of this License will continue to apply to the
part which is the covered work, but the special requirements of the GNU Affero
General Public License, section 13, concerning interaction through a network
will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the
GNU 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 Program specifies
that a certain numbered version of the GNU General Public License “or any
later version” applies to it, you have the option of following the terms and
conditions either of that numbered version or of any later version published
by the Free Software Foundation. If the Program does not specify a version
number of the GNU General Public License, you may choose any version ever
published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of
the GNU General Public License can be used, that proxy's public statement
of acceptance of a version permanently authorizes you to choose that version
for the Program.
Later license versions may give you additional or different permissions. However,
no additional obligations are imposed on any author or copyright holder as
a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE PROGRAM “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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM
PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM
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 PROGRAM (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
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot
be given local legal effect according to their terms, reviewing courts shall
apply local law that most closely approximates an absolute waiver of all civil
liability in connection with the Program, unless a warranty or assumption
of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach
them to the start of each source file to most effectively state 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 program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
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.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like
this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain
conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands might
be different; for a GUI interface, you would use an “about box”.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a “copyright disclaimer” for the program, if necessary. For
more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General Public
License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -0,0 +1,444 @@
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!

View File

@ -0,0 +1,444 @@
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!

View File

@ -0,0 +1,462 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, 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 Lesser GPL. It also counts as
the successor of the GNU Library Public License, version 2, hence the version
number 2.1.]
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 Lesser General Public License, applies to some specially
designated software packages--typically libraries--of the Free Software Foundation
and other authors who decide to use it. You can use it too, but we suggest
you first think carefully about whether this license or the ordinary General
Public License is the better strategy to use in any particular case, based
on the explanations below.
When we speak of free software, we are referring to freedom of use, 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 and use pieces of it in new free programs; and that
you are informed that you can do these things.
To protect your rights, we need to make restrictions that forbid distributors
to deny you these rights or to ask you to surrender these 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
other code 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.
We protect your rights with a two-step method: (1) we copyright the library,
and (2) we offer you this license, which gives you legal permission to copy,
distribute and/or modify the library.
To protect each distributor, we want to make it very clear that there is no
warranty for the free library. Also, if the library is modified by someone
else and passed on, the recipients should know that what they have is not
the original version, so that the original author's reputation will not be
affected by problems that might be introduced by others.
Finally, software patents pose a constant threat to the existence of any free
program. We wish to make sure that a company cannot effectively restrict the
users of a free program by obtaining a restrictive license from a patent holder.
Therefore, we insist that any patent license obtained for a version of the
library must be consistent with the full freedom of use specified in this
license.
Most GNU software, including some libraries, is covered by the ordinary GNU
General Public License. This license, the GNU Lesser General Public License,
applies to certain designated libraries, and is quite different from the ordinary
General Public License. We use this license for certain libraries in order
to permit linking those libraries into non-free programs.
When a program is linked with a library, whether statically or using a shared
library, the combination of the two is legally speaking a combined work, a
derivative of the original library. The ordinary General Public License therefore
permits such linking only if the entire combination fits its criteria of freedom.
The Lesser General Public License permits more lax criteria for linking other
code with the library.
We call this license the "Lesser" General Public License because it does Less
to protect the user's freedom than the ordinary General Public License. It
also provides other free software developers Less of an advantage over competing
non-free programs. These disadvantages are the reason we use the ordinary
General Public License for many libraries. However, the Lesser license provides
advantages in certain special circumstances.
For example, on rare occasions, there may be a special need to encourage the
widest possible use of a certain library, so that it becomes a de-facto standard.
To achieve this, non-free programs must be allowed to use the library. A more
frequent case is that a free library does the same job as widely used non-free
libraries. In this case, there is little to gain by limiting the free library
to free software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free programs
enables a greater number of people to use a large body of free software. For
example, permission to use the GNU C Library in non-free programs enables
many more people to use the whole GNU operating system, as well as its variant,
the GNU/Linux operating system.
Although the Lesser General Public License is Less protective of the users'
freedom, it does ensure that the user of a program that is linked with the
Library has the freedom and the wherewithal to run that program using a modified
version of the Library.
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, whereas the latter must be combined with the library in
order to run.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other program
which contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Lesser 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 combine 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) Use a suitable shared library mechanism for linking with the Library. A
suitable mechanism is one that (1) uses at run time a copy of the library
already present on the user's computer system, rather than copying library
functions into the executable, and (2) will operate properly with a modified
version of the library, if the user installs one, as long as the modified
version is interface-compatible with the version that the work was made with.
c) 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.
d) 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.
e) 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 materials to be 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 with 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 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 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 Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along
with this library; if not, write to the Free Software Foundation, Inc., 51
Franklin Street, 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!

View File

@ -0,0 +1,462 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, 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 Lesser GPL. It also counts as
the successor of the GNU Library Public License, version 2, hence the version
number 2.1.]
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 Lesser General Public License, applies to some specially
designated software packages--typically libraries--of the Free Software Foundation
and other authors who decide to use it. You can use it too, but we suggest
you first think carefully about whether this license or the ordinary General
Public License is the better strategy to use in any particular case, based
on the explanations below.
When we speak of free software, we are referring to freedom of use, 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 and use pieces of it in new free programs; and that
you are informed that you can do these things.
To protect your rights, we need to make restrictions that forbid distributors
to deny you these rights or to ask you to surrender these 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
other code 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.
We protect your rights with a two-step method: (1) we copyright the library,
and (2) we offer you this license, which gives you legal permission to copy,
distribute and/or modify the library.
To protect each distributor, we want to make it very clear that there is no
warranty for the free library. Also, if the library is modified by someone
else and passed on, the recipients should know that what they have is not
the original version, so that the original author's reputation will not be
affected by problems that might be introduced by others.
Finally, software patents pose a constant threat to the existence of any free
program. We wish to make sure that a company cannot effectively restrict the
users of a free program by obtaining a restrictive license from a patent holder.
Therefore, we insist that any patent license obtained for a version of the
library must be consistent with the full freedom of use specified in this
license.
Most GNU software, including some libraries, is covered by the ordinary GNU
General Public License. This license, the GNU Lesser General Public License,
applies to certain designated libraries, and is quite different from the ordinary
General Public License. We use this license for certain libraries in order
to permit linking those libraries into non-free programs.
When a program is linked with a library, whether statically or using a shared
library, the combination of the two is legally speaking a combined work, a
derivative of the original library. The ordinary General Public License therefore
permits such linking only if the entire combination fits its criteria of freedom.
The Lesser General Public License permits more lax criteria for linking other
code with the library.
We call this license the "Lesser" General Public License because it does Less
to protect the user's freedom than the ordinary General Public License. It
also provides other free software developers Less of an advantage over competing
non-free programs. These disadvantages are the reason we use the ordinary
General Public License for many libraries. However, the Lesser license provides
advantages in certain special circumstances.
For example, on rare occasions, there may be a special need to encourage the
widest possible use of a certain library, so that it becomes a de-facto standard.
To achieve this, non-free programs must be allowed to use the library. A more
frequent case is that a free library does the same job as widely used non-free
libraries. In this case, there is little to gain by limiting the free library
to free software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free programs
enables a greater number of people to use a large body of free software. For
example, permission to use the GNU C Library in non-free programs enables
many more people to use the whole GNU operating system, as well as its variant,
the GNU/Linux operating system.
Although the Lesser General Public License is Less protective of the users'
freedom, it does ensure that the user of a program that is linked with the
Library has the freedom and the wherewithal to run that program using a modified
version of the Library.
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, whereas the latter must be combined with the library in
order to run.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other program
which contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Lesser 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 combine 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) Use a suitable shared library mechanism for linking with the Library. A
suitable mechanism is one that (1) uses at run time a copy of the library
already present on the user's computer system, rather than copying library
functions into the executable, and (2) will operate properly with a modified
version of the library, if the user installs one, as long as the modified
version is interface-compatible with the version that the work was made with.
c) 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.
d) 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.
e) 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 materials to be 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 with 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 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 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 Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along
with this library; if not, write to the Free Software Foundation, Inc., 51
Franklin Street, 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!

View File

@ -0,0 +1,144 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://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.

View File

@ -0,0 +1,71 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://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.

View File

@ -0,0 +1,12 @@
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3 of
the license or (at your option) at 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 14 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.

View File

@ -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.

View File

@ -0,0 +1,20 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,25 @@
plasma_install_package(activitybar org.kde.plasma.activitybar)
add_subdirectory(icon)
plasma_install_package(analog-clock org.kde.plasma.analogclock)
plasma_install_package(mediacontroller org.kde.plasma.mediacontroller)
plasma_install_package(lock_logout org.kde.plasma.lock_logout)
plasma_install_package(manage-inputmethod org.kde.plasma.manage-inputmethod)
add_subdirectory(appmenu)
add_subdirectory(systemmonitor)
add_subdirectory(batterymonitor)
add_subdirectory(calendar)
add_subdirectory(devicenotifier)
add_subdirectory(digital-clock)
add_subdirectory(kicker)
add_subdirectory(panelspacer)
plasma_install_package(clipboard org.kde.plasma.clipboard)
if(NOT WIN32)
# #notifications
# #should compile also on windows? (even if doesn't really make sense)
add_subdirectory(notifications)
add_subdirectory(systemtray)
endif()

View File

@ -0,0 +1,10 @@
/**
* @mainpage Applets
*
* Plasma Applets
*
*/
// DOXYGEN_SET_PROJECT_NAME = Applets
// DOXYGEN_SET_RECURSIVE = YES
// vim:ts=4:sw=4:expandtab:filetype=doxygen

View File

@ -0,0 +1,2 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.activitybar.pot

View File

@ -0,0 +1,80 @@
/*
SPDX-FileCopyrightText: 2013 Bhushan Shah <bhush94@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents // PC3 Tabbar only has top and bottom tab positions, not left and right
import org.kde.activities 0.1 as Activities
Item {
Layout.minimumWidth: tabBar.implicitWidth
Layout.minimumHeight: tabBar.implicitHeight
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
PlasmaComponents.TabBar {
id: tabBar
anchors.fill: parent
tabPosition: {
switch (plasmoid.location) {
case PlasmaCore.Types.LeftEdge:
return Qt.LeftEdge;
case PlasmaCore.Types.RightEdge:
return Qt.RightEdge;
case PlasmaCore.Types.TopEdge:
return Qt.TopEdge;
default:
return Qt.BottomEdge;
}
}
Repeater {
model: Activities.ActivityModel {
id: activityModel
shownStates: "Running"
}
delegate: PlasmaComponents.TabButton {
id: tab
checked: model.current
text: model.name
activeFocusOnTab: true
Keys.onPressed: {
switch (event.key) {
case Qt.Key_Space:
case Qt.Key_Enter:
case Qt.Key_Return:
case Qt.Key_Select:
activityModel.setCurrentActivity(model.id, function() {});
break;
}
}
Accessible.checked: model.current
Accessible.name: model.name
Accessible.description: i18n("Switch to activity %1", model.name)
Accessible.role: Accessible.Button
onClicked: {
activityModel.setCurrentActivity(model.id, function() {});
}
Component.onCompleted: {
if(model.current) {
tabBar.currentTab = tab;
}
}
onCheckedChanged: {
if(model.current) {
tabBar.currentTab = tab;
}
}
}
}
}
Component.onCompleted: {
plasmoid.removeAction("configure");
}
}

View File

@ -0,0 +1,166 @@
{
"KPlugin": {
"Authors": [
{
"Email": "bhush94@gmail.com",
"Name": "Bhushan Shah",
"Name[ar]": "Bhushan Shah",
"Name[az]": "Bhushan Shah",
"Name[ca]": "Bhushan Shah",
"Name[cs]": "Bhushan Shah",
"Name[de]": "Bhushan Shah",
"Name[en_GB]": "Bhushan Shah",
"Name[es]": "Bhushan Shah",
"Name[eu]": "Bhushan Shah",
"Name[fi]": "Bhushan Shah",
"Name[fr]": "Bhushan Shah",
"Name[hu]": "Bhushan Shah",
"Name[ia]": "Bhushan Shah",
"Name[it]": "Bhushan Shah",
"Name[ko]": "Bhushan Shah",
"Name[lt]": "Bhushan Shah",
"Name[nl]": "Bhushan Shah",
"Name[nn]": "Bhushan Shah",
"Name[pa]": "ਭੂਸ਼ਨ ਸ਼ਾਹ",
"Name[pl]": "Bhushan Shah",
"Name[pt_BR]": "Bhushan Shah",
"Name[ro]": "Bhushan Shah",
"Name[ru]": "Bhushan Shah",
"Name[sk]": "Bhushan Shah",
"Name[sl]": "Bhushan Shah",
"Name[sv]": "Bhushan Shah",
"Name[ta]": "புஷன் ஷா",
"Name[tr]": "Buşan Şah",
"Name[uk]": "Bhushan Shah",
"Name[vi]": "Bhushan Shah",
"Name[x-test]": "xxBhushan Shahxx",
"Name[zh_CN]": "Bhushan Shah"
}
],
"Category": "Windows and Tasks",
"Description": "Tab bar to switch activities",
"Description[ar]": "شريط ألسنة لتبديل الأنشطة",
"Description[az]": "İş Otaqlarına keçid üçün vərəq zolağı",
"Description[ca]": "Barra de pestanyes per a canviar d'activitat",
"Description[cs]": "Panel pro přepínání aktivit",
"Description[de]": "Leiste zum Wechseln von Aktivitäten",
"Description[en_GB]": "Tab bar to switch activities",
"Description[es]": "Barra de pestañas para cambiar actividades",
"Description[eu]": "Jardueraz aldatzeko fitxa-barra",
"Description[fi]": "Välilehtipalkki aktiviteettivaihtoon",
"Description[fr]": "Barre d'onglets permettant le basculement entre activités",
"Description[hu]": "Aktivitások közötti váltásra szolgáló lapozóelem",
"Description[ia]": "Barra de scheda pro commutar activitates",
"Description[it]": "Barra a schede per cambiare attività",
"Description[ko]": "활동 사이를 전환할 수 있는 탭 표시줄",
"Description[lt]": "Kortelių juosta, skirta perjungti veiklas",
"Description[nl]": "Tabbladbalk om van activiteit te wisselen",
"Description[nn]": "Fanelinje for å byta mellom aktivitetar",
"Description[pa]": "ਸਰਗਰਮੀਆਂ ਨੂੰ ਬਦਲਣ ਲਈ ਟੈਬ ਪੱਟੀ",
"Description[pl]": "Pasek kart do przełączania aktywności",
"Description[pt_BR]": "Barra de abas para alternar atividades",
"Description[ro]": "Bară cu file pentru comutarea activităților",
"Description[ru]": "Переключение комнат",
"Description[sk]": "Panel na prepínanie aktivít",
"Description[sl]": "Vrstica zavihkov za preklapljanje med dejavnostmi",
"Description[sv]": "Flikrad för att byta aktiviteter",
"Description[ta]": "செயல்பாடுகளுக்கிடையே தாவ உதவும் கீற்றுப் பட்டை",
"Description[tr]": "Etkinlikleri değiştirmek için sekme çubuğu",
"Description[uk]": "Панель з вкладками для перемикання дій",
"Description[vi]": "Thanh thẻ để chuyển Hoạt động",
"Description[x-test]": "xxTab bar to switch activitiesxx",
"Description[zh_CN]": "切换活动的标签栏",
"EnabledByDefault": true,
"FormFactors": [
"desktop"
],
"Icon": "tab-new",
"Id": "org.kde.plasma.activitybar",
"License": "GPL-2.0+",
"Name": "Activity Bar",
"Name[ar]": "شريط أنشطة",
"Name[ast]": "Barra d'actividaes",
"Name[az]": "İş Otağı paneli",
"Name[be@latin]": "Panel zaniatkaŭ",
"Name[bg]": "Лента за активност",
"Name[bs]": "Traka aktivnosti",
"Name[ca@valencia]": "Barra d'activitat",
"Name[ca]": "Barra d'activitat",
"Name[cs]": "Pruh aktivit",
"Name[da]": "Aktivitetslinje",
"Name[de]": "Aktivitätsleiste",
"Name[el]": "Γραμμή δραστηριότητας",
"Name[en_GB]": "Activity Bar",
"Name[eo]": "Aktiveca Nivelo",
"Name[es]": "Barra de actividad",
"Name[et]": "Tegevusriba",
"Name[eu]": "Jarduera-barra",
"Name[fi]": "Aktiviteettipalkki",
"Name[fr]": "Barre d'activités",
"Name[fy]": "Aktiviteitsbalke",
"Name[ga]": "Barra Gníomhaíochta",
"Name[gl]": "Barra de actividades",
"Name[gu]": "ક્રિયા પટ્ટી",
"Name[he]": "סרגל פעילויות",
"Name[hi]": "गतिविधि पट्टी",
"Name[hne]": "सक्रियता पट्टी",
"Name[hr]": "Traka aktivnosti",
"Name[hsb]": "Pas aktiwitow",
"Name[hu]": "Aktivitásjelző",
"Name[ia]": "Barra de activitate",
"Name[id]": "Bilah Aktivitas",
"Name[is]": "Virknislá",
"Name[it]": "Barra delle attività",
"Name[ja]": "アクティビティバー",
"Name[kk]": "Белсенділік панелі",
"Name[km]": "របារ​សកម្មភាព",
"Name[kn]": "ಚಟುವಟಿಕೆ ಪಟ್ಟಿ",
"Name[ko]": "활동 표시줄",
"Name[ku]": "Darika Çalakiyan",
"Name[lt]": "Veiklų juosta",
"Name[lv]": "Aktivitāšu josla",
"Name[mk]": "Лента за активности",
"Name[ml]": "ആക്ടിവിറ്റി ബാര്‍",
"Name[mr]": "कार्यपध्दती पट्टी",
"Name[nb]": "Aktivitetsstolpe",
"Name[nds]": "Aktivitetenbalken",
"Name[nl]": "Activiteitenbalk",
"Name[nn]": "Aktivitetslinje",
"Name[pa]": "ਸਰਗਰਮੀ ਪੱਟੀ",
"Name[pl]": "Pasek aktywności",
"Name[pt]": "Barra de Actividades",
"Name[pt_BR]": "Barra de atividades",
"Name[ro]": "Bară de activitate",
"Name[ru]": "Панель комнат",
"Name[si]": "ක්‍රියා තීරුව",
"Name[sk]": "Panel aktivít",
"Name[sl]": "Pas z dejavnostmi",
"Name[sr@ijekavian]": "трака активности",
"Name[sr@ijekavianlatin]": "traka aktivnosti",
"Name[sr@latin]": "traka aktivnosti",
"Name[sr]": "трака активности",
"Name[sv]": "Aktivitetsrad",
"Name[ta]": "செயல்பாடு பட்டை",
"Name[te]": "క్రియాశీలత పట్టీ",
"Name[tg]": "Навори фаъолият",
"Name[th]": "แถบกิจกรรม",
"Name[tr]": "Etkinlik Çubuğu",
"Name[ug]": "پائالىيەت بالدىقى",
"Name[uk]": "Панель дій",
"Name[vi]": "Thanh Hoạt động",
"Name[wa]": "Bår d' activité",
"Name[x-test]": "xxActivity Barxx",
"Name[zh_CN]": "活动栏",
"Name[zh_TW]": "活動列",
"ServiceTypes": [
"Plasma/Applet"
],
"Version": "1.0",
"Website": "https://www.kde.org/plasma-desktop"
},
"X-Plasma-API": "declarativeappletscript",
"X-Plasma-MainScript": "ui/main.qml",
"X-Plasma-Provides": [
"org.kde.plasma.activities"
]
}

View File

@ -0,0 +1,2 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.analogclock.pot

View File

@ -0,0 +1,17 @@
/*
SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import org.kde.plasma.configuration 2.0
ConfigModel {
ConfigCategory {
name: i18n("Appearance")
icon: "preferences-desktop-color"
source: "configGeneral.qml"
}
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="General">
<entry name="showSecondHand" type="Bool">
<default>false</default>
</entry>
<entry name="showTimezoneString" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>

View File

@ -0,0 +1,67 @@
/*
SPDX-FileCopyrightText: 2012 Viranch Mehta <viranch.mehta@gmail.com>
SPDX-FileCopyrightText: 2012 Marco Martin <mart@kde.org>
SPDX-FileCopyrightText: 2013 David Edmundson <davidedmundson@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
PlasmaCore.SvgItem {
id: handRoot
property alias rotation: rotation.angle
property double svgScale
property double horizontalRotationOffset: 0
property double verticalRotationOffset: 0
property string rotationCenterHintId
readonly property double horizontalRotationCenter: {
if (svg.hasElement(rotationCenterHintId)) {
var hintedCenterRect = svg.elementRect(rotationCenterHintId),
handRect = svg.elementRect(elementId),
hintedX = hintedCenterRect.x - handRect.x + hintedCenterRect.width/2;
return Math.round(hintedX * svgScale) + Math.round(hintedX * svgScale) % 2;
}
return width/2;
}
readonly property double verticalRotationCenter: {
if (svg.hasElement(rotationCenterHintId)) {
var hintedCenterRect = svg.elementRect(rotationCenterHintId),
handRect = svg.elementRect(elementId),
hintedY = hintedCenterRect.y - handRect.y + hintedCenterRect.height/2;
return Math.round(hintedY * svgScale) + width % 2;
}
return width/2;
}
width: Math.round(naturalSize.width * svgScale) + Math.round(naturalSize.width * svgScale) % 2
height: Math.round(naturalSize.height * svgScale) + width % 2
anchors {
top: clock.verticalCenter
topMargin: -verticalRotationCenter + verticalRotationOffset
left: clock.horizontalCenter
leftMargin: -horizontalRotationCenter + horizontalRotationOffset
}
svg: clockSvg
transform: Rotation {
id: rotation
angle: 0
origin {
x: handRoot.horizontalRotationCenter
y: handRoot.verticalRotationCenter
}
Behavior on angle {
RotationAnimation {
id: anim
duration: PlasmaCore.Units.longDuration
direction: RotationAnimation.Clockwise
easing.type: Easing.OutElastic
easing.overshoot: 0.5
}
}
}
}

View File

@ -0,0 +1,229 @@
/*
SPDX-FileCopyrightText: 2012 Viranch Mehta <viranch.mehta@gmail.com>
SPDX-FileCopyrightText: 2012 Marco Martin <mart@kde.org>
SPDX-FileCopyrightText: 2013 David Edmundson <davidedmundson@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.0
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.calendar 2.0 as PlasmaCalendar
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents
Item {
id: analogclock
width: PlasmaCore.Units.gridUnit * 15
height: PlasmaCore.Units.gridUnit * 15
property int hours
property int minutes
property int seconds
property bool showSecondsHand: plasmoid.configuration.showSecondHand
property bool showTimezone: plasmoid.configuration.showTimezoneString
property int tzOffset
Plasmoid.backgroundHints: "NoBackground";
Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation
Plasmoid.toolTipMainText: Qt.formatDate(dataSource.data["Local"]["DateTime"],"dddd")
Plasmoid.toolTipSubText: Qt.formatTime(dataSource.data["Local"]["DateTime"], Qt.locale().timeFormat(Locale.LongFormat)) + "\n" +
Qt.formatDate(dataSource.data["Local"]["DateTime"], Qt.locale().dateFormat(Locale.LongFormat).replace(/(^dddd.?\s)|(,?\sdddd$)/, ""))
PlasmaCore.DataSource {
id: dataSource
engine: "time"
connectedSources: "Local"
interval: showSecondsHand ? 1000 : 30000
onDataChanged: {
var date = new Date(data["Local"]["DateTime"]);
hours = date.getHours();
minutes = date.getMinutes();
seconds = date.getSeconds();
}
Component.onCompleted: {
onDataChanged();
}
}
function dateTimeChanged()
{
//console.log("Date/time changed!");
var currentTZOffset = dataSource.data["Local"]["Offset"] / 60;
if (currentTZOffset !== tzOffset) {
tzOffset = currentTZOffset;
//console.log("TZ offset changed: " + tzOffset);
Date.timeZoneUpdated(); // inform the QML JS engine about TZ change
}
}
Component.onCompleted: {
tzOffset = new Date().getTimezoneOffset();
//console.log("Initial TZ offset: " + tzOffset);
dataSource.onDataChanged.connect(dateTimeChanged);
}
Plasmoid.compactRepresentation: Item {
id: representation
Layout.minimumWidth: plasmoid.formFactor !== PlasmaCore.Types.Vertical ? representation.height : PlasmaCore.Units.gridUnit
Layout.minimumHeight: plasmoid.formFactor === PlasmaCore.Types.Vertical ? representation.width : PlasmaCore.Units.gridUnit
MouseArea {
anchors.fill: parent
onClicked: plasmoid.expanded = !plasmoid.expanded
}
PlasmaCore.Svg {
id: clockSvg
imagePath: "widgets/clock"
function estimateHorizontalHandShadowOffset() {
var id = "hint-hands-shadow-offset-to-west";
if (hasElement(id)) {
return -elementSize(id).width;
}
id = "hint-hands-shadows-offset-to-east";
if (hasElement(id)) {
return elementSize(id).width;
}
return 0;
}
function estimateVerticalHandShadowOffset() {
var id = "hint-hands-shadow-offset-to-north";
if (hasElement(id)) {
return -elementSize(id).height;
}
id = "hint-hands-shadow-offset-to-south";
if (hasElement(id)) {
return elementSize(id).height;
}
return 0;
}
property double naturalHorizontalHandShadowOffset: estimateHorizontalHandShadowOffset()
property double naturalVerticalHandShadowOffset: estimateVerticalHandShadowOffset()
onRepaintNeeded: {
naturalHorizontalHandShadowOffset = estimateHorizontalHandShadowOffset();
naturalVerticalHandShadowOffset = estimateVerticalHandShadowOffset();
}
}
Item {
id: clock
width: parent.width
anchors {
top: parent.top
bottom: showTimezone ? timezoneBg.top : parent.bottom
}
readonly property double svgScale: face.width / face.naturalSize.width
readonly property double horizontalShadowOffset:
Math.round(clockSvg.naturalHorizontalHandShadowOffset * svgScale) + Math.round(clockSvg.naturalHorizontalHandShadowOffset * svgScale) % 2
readonly property double verticalShadowOffset:
Math.round(clockSvg.naturalVerticalHandShadowOffset * svgScale) + Math.round(clockSvg.naturalVerticalHandShadowOffset * svgScale) % 2
PlasmaCore.SvgItem {
id: face
anchors.centerIn: parent
width: Math.min(parent.width, parent.height)
height: Math.min(parent.width, parent.height)
svg: clockSvg
elementId: "ClockFace"
}
Hand {
elementId: "HourHandShadow"
rotationCenterHintId: "hint-hourhandshadow-rotation-center-offset"
horizontalRotationOffset: clock.horizontalShadowOffset
verticalRotationOffset: clock.verticalShadowOffset
rotation: 180 + hours * 30 + (minutes/2)
svgScale: clock.svgScale
}
Hand {
elementId: "HourHand"
rotationCenterHintId: "hint-hourhand-rotation-center-offset"
rotation: 180 + hours * 30 + (minutes/2)
svgScale: clock.svgScale
}
Hand {
elementId: "MinuteHandShadow"
rotationCenterHintId: "hint-minutehandshadow-rotation-center-offset"
horizontalRotationOffset: clock.horizontalShadowOffset
verticalRotationOffset: clock.verticalShadowOffset
rotation: 180 + minutes * 6
svgScale: clock.svgScale
}
Hand {
elementId: "MinuteHand"
rotationCenterHintId: "hint-minutehand-rotation-center-offset"
rotation: 180 + minutes * 6
svgScale: clock.svgScale
}
Hand {
elementId: "SecondHandShadow"
rotationCenterHintId: "hint-secondhandshadow-rotation-center-offset"
horizontalRotationOffset: clock.horizontalShadowOffset
verticalRotationOffset: clock.verticalShadowOffset
rotation: 180 + seconds * 6
visible: showSecondsHand
svgScale: clock.svgScale
}
Hand {
elementId: "SecondHand"
rotationCenterHintId: "hint-secondhand-rotation-center-offset"
rotation: 180 + seconds * 6
visible: showSecondsHand
svgScale: clock.svgScale
}
PlasmaCore.SvgItem {
id: center
width: naturalSize.width * clock.svgScale
height: naturalSize.height * clock.svgScale
anchors.centerIn: clock
svg: clockSvg
elementId: "HandCenterScrew"
z: 1000
}
PlasmaCore.SvgItem {
anchors.fill: face
svg: clockSvg
elementId: "Glass"
width: naturalSize.width * clock.svgScale
height: naturalSize.height * clock.svgScale
}
}
PlasmaCore.FrameSvgItem {
id: timezoneBg
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: 10
}
imagePath: "widgets/background"
width: childrenRect.width + margins.right + margins.left
height: childrenRect.height + margins.top + margins.bottom
visible: showTimezone
PlasmaComponents.Label {
id: timezoneText
x: timezoneBg.margins.left
y: timezoneBg.margins.top
text: dataSource.data["Local"]["Timezone"]
}
}
}
Plasmoid.fullRepresentation: PlasmaCalendar.MonthView {
Layout.minimumWidth: PlasmaCore.Units.gridUnit * 20
Layout.minimumHeight: PlasmaCore.Units.gridUnit * 20
today: dataSource.data["Local"]["DateTime"]
}
}

View File

@ -0,0 +1,30 @@
/*
SPDX-FileCopyrightText: 2013 David Edmundson <davidedmundson@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import QtQuick.Controls 2.0
import org.kde.kirigami 2.5 as Kirigami
Kirigami.FormLayout {
property alias cfg_showSecondHand: showSecondHandCheckBox.checked
property alias cfg_showTimezoneString: showTimezoneCheckBox.checked
anchors {
left: parent.left
right: parent.right
}
CheckBox {
id: showSecondHandCheckBox
text: i18n("Show seconds hand")
Kirigami.FormData.label: i18n("General:")
}
CheckBox {
id: showTimezoneCheckBox
text: i18n("Show time zone")
}
}

View File

@ -0,0 +1,181 @@
{
"KPlugin": {
"Authors": [
{
"Email": "mart@kde.org",
"Name": "Marco Martin",
"Name[ar]": "Marco Martin",
"Name[az]": "Marco Martin",
"Name[ca]": "Marco Martin",
"Name[cs]": "Marco Martin",
"Name[de]": "Marco Martin",
"Name[en_GB]": "Marco Martin",
"Name[es]": "Marco Martin",
"Name[eu]": "Marco Martin",
"Name[fi]": "Marco Martin",
"Name[fr]": "Marco Martin",
"Name[hu]": "Marco Martin",
"Name[ia]": "Marco Martin",
"Name[it]": "Marco Martin",
"Name[ko]": "Marco Martin",
"Name[lt]": "Marco Martin",
"Name[nl]": "Marco Martin",
"Name[nn]": "Marco Martin",
"Name[pa]": "ਮਾਰਕੋ ਮਾਰਟਿਨ",
"Name[pl]": "Marco Martin",
"Name[pt_BR]": "Marco Martin",
"Name[ro]": "Marco Martin",
"Name[ru]": "Marco Martin",
"Name[sk]": "Marco Martin",
"Name[sl]": "Marco Martin",
"Name[sv]": "Marco Martin",
"Name[ta]": "மார்க்கோ மார்ட்டின்",
"Name[tr]": "Marco Martin",
"Name[uk]": "Marco Martin",
"Name[vi]": "Marco Martin",
"Name[x-test]": "xxMarco Martinxx",
"Name[zh_CN]": "Marco Martin"
}
],
"Category": "Date and Time",
"Description": "A clock with hands",
"Description[ar]": "ساعة بِعقارب",
"Description[az]": "Əqrəbli saat",
"Description[ca]": "Un rellotge amb manetes",
"Description[cs]": "Ručičkové hodiny",
"Description[de]": "Eine Uhr mit Zeigern",
"Description[en_GB]": "A clock with hands",
"Description[es]": "Un reloj con manecillas",
"Description[eu]": "Erloju orraztuna",
"Description[fi]": "Viisarikello",
"Description[fr]": "Une horloge avec des mains",
"Description[hu]": "Óra mutatókkal",
"Description[ia]": "Un horologio con manos",
"Description[it]": "Un orologio con lancette",
"Description[ko]": "시침과 분침이 있는 시계",
"Description[lt]": "Laikrodis su rodyklėmis",
"Description[nl]": "Een klok met wijzers",
"Description[nn]": "Ei klokke med visarar",
"Description[pa]": "ਸੂਈਆਂ ਵਾਲੀ ਘੜੀ",
"Description[pl]": "Zegar ze wskazówkami",
"Description[pt_BR]": "Um relógio com ponteiros",
"Description[ro]": "Ceas cu săgeți",
"Description[ru]": "Часы со стрелками",
"Description[sk]": "Ručičkové hodiny",
"Description[sl]": "Ura s kazalci",
"Description[sv]": "En klocka med visare",
"Description[ta]": "முட்களை கொண்ட கடிகாரம்",
"Description[tr]": "İbreli bir saat",
"Description[uk]": "Годинник зі стрілками",
"Description[vi]": "Một đồng hồ với các kim",
"Description[x-test]": "xxA clock with handsxx",
"Description[zh_CN]": "带指针的时钟",
"EnabledByDefault": true,
"FormFactors": [
"tablet",
"handset",
"desktop"
],
"Icon": "preferences-system-time",
"Id": "org.kde.plasma.analogclock",
"License": "GPL-2.0+",
"Name": "Analog Clock",
"Name[af]": "Analooghorlosie",
"Name[ar]": "ساعة تناظرية",
"Name[ast]": "Reló analóxicu",
"Name[az]": "Əqrəbli saat",
"Name[be@latin]": "Analahavy hadzińnik",
"Name[be]": "Аналагавы гадзіннік",
"Name[bg]": "Аналогов часовник",
"Name[bn]": "অ্যানালগ ঘড়ি",
"Name[bs]": "Analogni sat",
"Name[ca@valencia]": "Rellotge analògic",
"Name[ca]": "Rellotge analògic",
"Name[cs]": "Analogové hodiny",
"Name[csb]": "Analogòwi zédżer",
"Name[da]": "Analogt ur",
"Name[de]": "Analoge Uhr",
"Name[el]": "Αναλογικό ρολόι",
"Name[en_GB]": "Analogue Clock",
"Name[eo]": "Analoga horloĝo",
"Name[es]": "Reloj analógico",
"Name[et]": "Analoogkell",
"Name[eu]": "Erloju analogikoa",
"Name[fa]": "ساعت قیاسی",
"Name[fi]": "Analoginen kello",
"Name[fr]": "Horloge analogique",
"Name[fy]": "Analoge klok",
"Name[ga]": "Clog Analógach",
"Name[gl]": "Reloxo analóxico",
"Name[gu]": "સાદી ઘડિયાળ",
"Name[he]": "שעון מחוגים",
"Name[hi]": "एनॉलॉग घड़ी",
"Name[hne]": "एनालाग घड़ी",
"Name[hr]": "Analogni sat",
"Name[hsb]": "Analogny časnik",
"Name[hu]": "Mutatós óra",
"Name[ia]": "Horologio analogic",
"Name[id]": "Jam Analog",
"Name[is]": "Skífuklukka",
"Name[it]": "Orologio analogico",
"Name[ja]": "アナログ時計",
"Name[kk]": "Аналогты сағат",
"Name[km]": "នាឡិកា​អាណាឡូក",
"Name[kn]": "ಅವಿಚ್ಛಿನ್ನಾತ್ಮಕ (ಅನಲಾಗ್, ಸಾಂಪ್ರದಾಯಿಕ) ಗಡಿಯಾರ",
"Name[ko]": "아날로그 시계",
"Name[ku]": "Demjimêra Analog",
"Name[lt]": "Analoginis laikrodis",
"Name[lv]": "Rādītāju pulkstenis",
"Name[mai]": "एनालाग घडी",
"Name[mk]": "Аналоген часовник",
"Name[ml]": "അനലോഗ് ഘടികാരം",
"Name[mr]": "एनॉलॉग घड्याळ",
"Name[nb]": "Analog klokke",
"Name[nds]": "Analoog Klock",
"Name[ne]": "एनालग घडी",
"Name[nl]": "Analoge klok",
"Name[nn]": "Analog klokke",
"Name[oc]": "Relòtge analogic",
"Name[pa]": "ਐਨਾਲਾਗ ਘੜੀ",
"Name[pl]": "Zegar analogowy",
"Name[pt]": "Relógio Analógico",
"Name[pt_BR]": "Relógio Analógico",
"Name[ro]": "Ceas analog",
"Name[ru]": "Часы с циферблатом",
"Name[se]": "Analogalaš diibmu",
"Name[si]": "ප්‍රතිසම ඔරලෝසුව",
"Name[sk]": "Analógové hodiny",
"Name[sl]": "Analogna ura",
"Name[sr@ijekavian]": "аналогни сат",
"Name[sr@ijekavianlatin]": "analogni sat",
"Name[sr@latin]": "analogni sat",
"Name[sr]": "аналогни сат",
"Name[sv]": "Analog klocka",
"Name[ta]": "சுழல் கடிகாரம்",
"Name[te]": "ఎనలాగ్ గడియారం",
"Name[tg]": "Соати аналогӣ",
"Name[th]": "นาฬิกาแอนะล็อก",
"Name[tr]": "Analog Saat",
"Name[ug]": "ئانالوگ سائەت",
"Name[uk]": "Аналоговий годинник",
"Name[uz@cyrillic]": "Аналог соат",
"Name[uz]": "Analog soat",
"Name[vi]": "Đồng hồ kim",
"Name[wa]": "Ôrlodje analodjike",
"Name[x-test]": "xxAnalog Clockxx",
"Name[zh_CN]": "模拟时钟",
"Name[zh_TW]": "類比時鐘",
"ServiceTypes": [
"Plasma/Applet"
],
"Version": "3.0",
"Website": "https://userbase.kde.org/Plasma/Clocks"
},
"X-Plasma-API": "declarativeappletscript",
"X-Plasma-MainScript": "ui/analogclock.qml",
"X-Plasma-Provides": [
"org.kde.plasma.time",
"org.kde.plasma.date"
],
"X-Plasma-StandAloneApp": true
}

View File

@ -0,0 +1,6 @@
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.appmenu\")
add_subdirectory(lib)
add_subdirectory(plugin)
plasma_install_package(package org.kde.plasma.appmenu)

View File

@ -0,0 +1,2 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.appmenu.pot

View File

@ -0,0 +1,9 @@
kcoreaddons_add_plugin(plasma_applet_appmenu SOURCES appmenuapplet.cpp INSTALL_NAMESPACE "plasma/applets")
target_link_libraries(plasma_applet_appmenu
Qt::Widgets
Qt::Quick
Qt::DBus
KF5::Plasma
KF5::WindowSystem
PW::LibTaskManager)

View File

@ -0,0 +1,292 @@
/*
SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "appmenuapplet.h"
#include "../plugin/appmenumodel.h"
#include <QAction>
#include <QDBusConnection>
#include <QDBusConnectionInterface>
#include <QKeyEvent>
#include <QMenu>
#include <QMouseEvent>
#include <QQuickItem>
#include <QQuickWindow>
#include <QScreen>
#include <QTimer>
int AppMenuApplet::s_refs = 0;
namespace
{
QString viewService()
{
return QStringLiteral("org.kde.kappmenuview");
}
}
AppMenuApplet::AppMenuApplet(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
: Plasma::Applet(parent, data, args)
{
++s_refs;
// if we're the first, register the service
if (s_refs == 1) {
QDBusConnection::sessionBus().interface()->registerService(viewService(),
QDBusConnectionInterface::QueueService,
QDBusConnectionInterface::DontAllowReplacement);
}
/*it registers or unregisters the service when the destroyed value of the applet change,
and not in the dtor, because:
when we "delete" an applet, it just hides it for about a minute setting its status
to destroyed, in order to be able to do a clean undo: if we undo, there will be
another destroyedchanged and destroyed will be false.
When this happens, if we are the only appmenu applet existing, the dbus interface
will have to be registered again*/
connect(this, &Applet::destroyedChanged, this, [](bool destroyed) {
if (destroyed) {
// if we were the last, unregister
if (--s_refs == 0) {
QDBusConnection::sessionBus().interface()->unregisterService(viewService());
}
} else {
// if we're the first, register the service
if (++s_refs == 1) {
QDBusConnection::sessionBus().interface()->registerService(viewService(),
QDBusConnectionInterface::QueueService,
QDBusConnectionInterface::DontAllowReplacement);
}
}
});
}
AppMenuApplet::~AppMenuApplet() = default;
void AppMenuApplet::init()
{
}
AppMenuModel *AppMenuApplet::model() const
{
return m_model;
}
void AppMenuApplet::setModel(AppMenuModel *model)
{
if (m_model != model) {
m_model = model;
Q_EMIT modelChanged();
}
}
int AppMenuApplet::view() const
{
return m_viewType;
}
void AppMenuApplet::setView(int type)
{
if (m_viewType != type) {
m_viewType = type;
Q_EMIT viewChanged();
}
}
int AppMenuApplet::currentIndex() const
{
return m_currentIndex;
}
void AppMenuApplet::setCurrentIndex(int currentIndex)
{
if (m_currentIndex != currentIndex) {
m_currentIndex = currentIndex;
Q_EMIT currentIndexChanged();
}
}
QQuickItem *AppMenuApplet::buttonGrid() const
{
return m_buttonGrid;
}
void AppMenuApplet::setButtonGrid(QQuickItem *buttonGrid)
{
if (m_buttonGrid != buttonGrid) {
m_buttonGrid = buttonGrid;
Q_EMIT buttonGridChanged();
}
}
QMenu *AppMenuApplet::createMenu(int idx) const
{
QMenu *menu = nullptr;
QAction *action = nullptr;
if (view() == CompactView) {
menu = new QMenu();
for (int i = 0; i < m_model->rowCount(); i++) {
const QModelIndex index = m_model->index(i, 0);
const QVariant data = m_model->data(index, AppMenuModel::ActionRole);
action = (QAction *)data.value<void *>();
menu->addAction(action);
}
menu->setAttribute(Qt::WA_DeleteOnClose);
} else if (view() == FullView) {
const QModelIndex index = m_model->index(idx, 0);
const QVariant data = m_model->data(index, AppMenuModel::ActionRole);
action = (QAction *)data.value<void *>();
if (action) {
menu = action->menu();
}
}
return menu;
}
void AppMenuApplet::onMenuAboutToHide()
{
setCurrentIndex(-1);
}
void AppMenuApplet::trigger(QQuickItem *ctx, int idx)
{
if (m_currentIndex == idx) {
return;
}
if (!ctx || !ctx->window() || !ctx->window()->screen()) {
return;
}
QMenu *actionMenu = createMenu(idx);
if (actionMenu) {
// this is a workaround where Qt will fail to realize a mouse has been released
// this happens if a window which does not accept focus spawns a new window that takes focus and X grab
// whilst the mouse is depressed
// https://bugreports.qt.io/browse/QTBUG-59044
// this causes the next click to go missing
// by releasing manually we avoid that situation
auto ungrabMouseHack = [ctx]() {
if (ctx && ctx->window() && ctx->window()->mouseGrabberItem()) {
// FIXME event forge thing enters press and hold move mode :/
ctx->window()->mouseGrabberItem()->ungrabMouse();
}
};
QTimer::singleShot(0, ctx, ungrabMouseHack);
// end workaround
const auto &geo = ctx->window()->screen()->availableVirtualGeometry();
QPoint pos = ctx->window()->mapToGlobal(ctx->mapToScene(QPointF()).toPoint());
if (location() == Plasma::Types::TopEdge) {
actionMenu->setProperty("_breeze_menu_is_top", true);
pos.setY(pos.y() + ctx->height());
}
actionMenu->adjustSize();
pos = QPoint(qBound(geo.x(), pos.x(), geo.x() + geo.width() - actionMenu->width()),
qBound(geo.y(), pos.y(), geo.y() + geo.height() - actionMenu->height()));
if (view() == FullView) {
actionMenu->installEventFilter(this);
}
actionMenu->winId(); // create window handle
actionMenu->windowHandle()->setTransientParent(ctx->window());
// hide the old menu only after showing the new one to avoid brief focus flickering on X11.
// on wayland, you can't have more than one grabbing popup at a time so we show it after
// the menu has hidden. thankfully, wayland doesn't have this flickering.
if (!KWindowSystem::isPlatformWayland()) {
actionMenu->popup(pos);
}
if (view() == FullView) {
QMenu *oldMenu = m_currentMenu;
m_currentMenu = actionMenu;
if (oldMenu && oldMenu != actionMenu) {
// don't initialize the currentIndex when another menu is already shown
disconnect(oldMenu, &QMenu::aboutToHide, this, &AppMenuApplet::onMenuAboutToHide);
oldMenu->hide();
}
}
if (KWindowSystem::isPlatformWayland()) {
actionMenu->popup(pos);
}
setCurrentIndex(idx);
// FIXME TODO connect only once
connect(actionMenu, &QMenu::aboutToHide, this, &AppMenuApplet::onMenuAboutToHide, Qt::UniqueConnection);
} else { // is it just an action without a menu?
const QVariant data = m_model->index(idx, 0).data(AppMenuModel::ActionRole);
QAction *action = static_cast<QAction *>(data.value<void *>());
if (action) {
Q_ASSERT(!action->menu());
action->trigger();
}
}
}
// FIXME TODO doesn't work on submenu
bool AppMenuApplet::eventFilter(QObject *watched, QEvent *event)
{
auto *menu = qobject_cast<QMenu *>(watched);
if (!menu) {
return false;
}
if (event->type() == QEvent::KeyPress) {
auto *e = static_cast<QKeyEvent *>(event);
// TODO right to left languages
if (e->key() == Qt::Key_Left) {
int desiredIndex = m_currentIndex - 1;
Q_EMIT requestActivateIndex(desiredIndex);
return true;
} else if (e->key() == Qt::Key_Right) {
if (menu->activeAction() && menu->activeAction()->menu()) {
return false;
}
int desiredIndex = m_currentIndex + 1;
Q_EMIT requestActivateIndex(desiredIndex);
return true;
}
} else if (event->type() == QEvent::MouseMove) {
auto *e = static_cast<QMouseEvent *>(event);
if (!m_buttonGrid || !m_buttonGrid->window()) {
return false;
}
// FIXME the panel margin breaks Fitt's law :(
const QPointF &windowLocalPos = m_buttonGrid->window()->mapFromGlobal(e->globalPos());
const QPointF &buttonGridLocalPos = m_buttonGrid->mapFromScene(windowLocalPos);
auto *item = m_buttonGrid->childAt(buttonGridLocalPos.x(), buttonGridLocalPos.y());
if (!item) {
return false;
}
bool ok;
const int buttonIndex = item->property("buttonIndex").toInt(&ok);
if (!ok) {
return false;
}
Q_EMIT requestActivateIndex(buttonIndex);
}
return false;
}
K_PLUGIN_CLASS_WITH_JSON(AppMenuApplet, "../package/metadata.json")
#include "appmenuapplet.moc"

View File

@ -0,0 +1,74 @@
/*
SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#pragma once
#include <Plasma/Applet>
#include <QPointer>
class QQuickItem;
class QMenu;
class AppMenuModel;
class AppMenuApplet : public Plasma::Applet
{
Q_OBJECT
Q_PROPERTY(AppMenuModel *model READ model WRITE setModel NOTIFY modelChanged)
Q_PROPERTY(int view READ view WRITE setView NOTIFY viewChanged)
Q_PROPERTY(int currentIndex READ currentIndex NOTIFY currentIndexChanged)
Q_PROPERTY(QQuickItem *buttonGrid READ buttonGrid WRITE setButtonGrid NOTIFY buttonGridChanged)
public:
enum ViewType {
FullView,
CompactView,
};
explicit AppMenuApplet(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
~AppMenuApplet() override;
void init() override;
int currentIndex() const;
QQuickItem *buttonGrid() const;
void setButtonGrid(QQuickItem *buttonGrid);
AppMenuModel *model() const;
void setModel(AppMenuModel *model);
int view() const;
void setView(int type);
Q_SIGNALS:
void modelChanged();
void viewChanged();
void currentIndexChanged();
void buttonGridChanged();
void requestActivateIndex(int index);
public Q_SLOTS:
void trigger(QQuickItem *ctx, int idx);
protected:
bool eventFilter(QObject *watched, QEvent *event) override;
private:
QMenu *createMenu(int idx) const;
void setCurrentIndex(int currentIndex);
void onMenuAboutToHide();
int m_currentIndex = -1;
int m_viewType = FullView;
QPointer<QMenu> m_currentMenu;
QPointer<QQuickItem> m_buttonGrid;
QPointer<AppMenuModel> m_model;
static int s_refs;
};

View File

@ -0,0 +1,17 @@
/*
SPDX-FileCopyrightText: 2016 Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.0
import org.kde.plasma.configuration 2.0
ConfigModel {
ConfigCategory {
name: i18n("Appearance")
icon: "preferences-desktop-color"
source: "configGeneral.qml"
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="Appearance">
<entry name="compactView" type="Bool">
<label>If true it only shows a button for the application menu.</label>
<default>false</default>
</entry>
</group>
</kcfg>

View File

@ -0,0 +1,70 @@
/*
* SPDX-FileCopyrightText: 2020 Carson Black <uhhadd@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.10
import QtQuick.Controls 2.10
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PC3
import org.kde.kirigami 2.12 as Kirigami
AbstractButton {
id: controlRoot
hoverEnabled: true
enum State {
Rest,
Hover,
Down
}
Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.SecondaryControl
Kirigami.MnemonicData.label: controlRoot.text
leftPadding: rest.margins.left
topPadding: rest.margins.top
rightPadding: rest.margins.right
bottomPadding: rest.margins.bottom
background: Item {
id: background
property int state: {
if (controlRoot.down) {
return MenuDelegate.State.Down
} else if (controlRoot.hovered) {
return MenuDelegate.State.Hover
}
return MenuDelegate.State.Rest
}
PlasmaCore.FrameSvgItem {
id: rest
anchors.fill: parent
visible: background.state == MenuDelegate.State.Rest
imagePath: "widgets/menubaritem"
prefix: "normal"
}
PlasmaCore.FrameSvgItem {
id: hover
anchors.fill: parent
visible: background.state == MenuDelegate.State.Hover
imagePath: "widgets/menubaritem"
prefix: "hover"
}
PlasmaCore.FrameSvgItem {
id: down
anchors.fill: parent
visible: background.state == MenuDelegate.State.Down
imagePath: "widgets/menubaritem"
prefix: "pressed"
}
}
contentItem: PC3.Label {
text: controlRoot.Kirigami.MnemonicData.richTextLabel
}
}

View File

@ -0,0 +1,30 @@
/*
SPDX-FileCopyrightText: 2016 Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.0
import QtQuick.Controls 2.5
import org.kde.kirigami 2.5 as Kirigami
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
Kirigami.FormLayout {
anchors.left: parent.left
anchors.right: parent.right
property alias cfg_compactView: compactViewRadioButton.checked
RadioButton {
id: compactViewRadioButton
text: i18n("Use single button for application menu")
}
RadioButton {
id: fullViewRadioButton
checked: !compactViewRadioButton.checked
text: i18n("Show full application menu")
}
}

View File

@ -0,0 +1,145 @@
/*
SPDX-FileCopyrightText: 2013 Heena Mahour <heena393@gmail.com>
SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.8
import org.kde.plasma.plasmoid 2.0
import org.kde.kquickcontrolsaddons 2.0 // For KCMShell
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.private.appmenu 1.0 as AppMenuPrivate
import org.kde.kirigami 2.5 as Kirigami
Item {
id: root
readonly property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
readonly property bool view: plasmoid.configuration.compactView
readonly property bool menuAvailable: appMenuModel.menuAvailable
readonly property bool kcmAuthorized: KCMShell.authorize(["style.desktop"]).length > 0
onViewChanged: {
plasmoid.nativeInterface.view = view
}
Plasmoid.constraintHints: PlasmaCore.Types.CanFillArea
Plasmoid.preferredRepresentation: (plasmoid.configuration.compactView) ? Plasmoid.compactRepresentation : Plasmoid.fullRepresentation
Plasmoid.compactRepresentation: PlasmaComponents3.ToolButton {
readonly property int fakeIndex: 0
Layout.fillWidth: false
Layout.fillHeight: false
Layout.minimumWidth: implicitWidth
Layout.maximumWidth: implicitWidth
enabled: menuAvailable
checkable: menuAvailable && plasmoid.nativeInterface.currentIndex === fakeIndex
checked: checkable
icon.name: "application-menu"
onClicked: plasmoid.nativeInterface.trigger(this, 0);
}
Plasmoid.fullRepresentation: GridLayout {
id: buttonGrid
Plasmoid.status: {
if (menuAvailable && plasmoid.nativeInterface.currentIndex > -1 && buttonRepeater.count > 0) {
return PlasmaCore.Types.NeedsAttentionStatus;
} else {
//when we're not enabled set to active to show the configure button
return buttonRepeater.count > 0 ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.HiddenStatus;
}
}
Layout.minimumWidth: implicitWidth
Layout.minimumHeight: implicitHeight
flow: root.vertical ? GridLayout.TopToBottom : GridLayout.LeftToRight
rowSpacing: 0
columnSpacing: 0
Component.onCompleted: {
plasmoid.nativeInterface.buttonGrid = buttonGrid
// using a Connections {} doesn't work for some reason in Qt >= 5.8
plasmoid.nativeInterface.requestActivateIndex.connect(function (index) {
var idx = Math.max(0, Math.min(buttonRepeater.count - 1, index))
var button = buttonRepeater.itemAt(index)
if (button) {
button.clicked()
}
});
plasmoid.activated.connect(function () {
var button = buttonRepeater.itemAt(0);
if (button) {
button.clicked();
}
});
}
// So we can show mnemonic underlines only while Alt is pressed
PlasmaCore.DataSource {
id: keystateSource
engine: "keystate"
connectedSources: ["Alt"]
}
PlasmaComponents3.ToolButton {
id: noMenuPlaceholder
visible: buttonRepeater.count == 0
text: plasmoid.title
Layout.fillWidth: root.vertical
Layout.fillHeight: !root.vertical
}
Repeater {
id: buttonRepeater
model: appMenuModel.visible ? appMenuModel : null
MenuDelegate {
readonly property int buttonIndex: index
Layout.fillWidth: root.vertical
Layout.fillHeight: !root.vertical
text: activeMenu
// TODO: Alt and other modifiers might be unavailable on Wayland
Kirigami.MnemonicData.active: keystateSource.data.Alt !== undefined && keystateSource.data.Alt.Pressed
down: pressed || plasmoid.nativeInterface.currentIndex === index
visible: text !== ""
onClicked: {
plasmoid.nativeInterface.trigger(this, index)
checked = Qt.binding(function() {
return plasmoid.nativeInterface.currentIndex === index;
});
}
// QMenu opens on press, so we'll replicate that here
MouseArea {
anchors.fill: parent
hoverEnabled: plasmoid.nativeInterface.currentIndex !== -1
onPressed: parent.clicked()
onEntered: parent.clicked()
}
}
}
}
AppMenuPrivate.AppMenuModel {
id: appMenuModel
screenGeometry: plasmoid.screenGeometry
onRequestActivateIndex: plasmoid.nativeInterface.requestActivateIndex(index)
Component.onCompleted: {
plasmoid.nativeInterface.model = appMenuModel
}
}
}

View File

@ -0,0 +1,136 @@
{
"KPlugin": {
"Authors": [
{
"Email": "kde@privat.broulik.de",
"Name": "Kai Uwe Broulik",
"Name[ar]": "Kai Uwe Broulik",
"Name[az]": "Kai Uwe Broulik",
"Name[ca]": "Kai Uwe Broulik",
"Name[cs]": "Kai Uwe Broulik",
"Name[de]": "Kai Uwe Broulik",
"Name[en_GB]": "Kai Uwe Broulik",
"Name[es]": "Kai Uwe Broulik",
"Name[eu]": "Kai Uwe Broulik",
"Name[fi]": "Kai Uwe Broulik",
"Name[fr]": "Kai Uwe Broulik",
"Name[hu]": "Kai Uwe Broulik",
"Name[ia]": "Kai Uwe Broulik",
"Name[it]": "Kai Uwe Broulik",
"Name[ko]": "Kai Uwe Broulik",
"Name[lt]": "Kai Uwe Broulik",
"Name[nl]": "Kai Uwe Broulik",
"Name[nn]": "Kai Uwe Broulik",
"Name[pl]": "Kai Uwe Broulik",
"Name[pt_BR]": "Kai Uwe Broulik",
"Name[ro]": "Kai Uwe Broulik",
"Name[ru]": "Kai Uwe Broulik",
"Name[sk]": "Kai Uwe Broulik",
"Name[sl]": "Kai Uwe Broulik",
"Name[sv]": "Kai Uwe Broulik",
"Name[ta]": "காய் ஊவே புரோலிக்",
"Name[tr]": "Kai Uwe Broulik",
"Name[uk]": "Kai Uwe Broulik",
"Name[vi]": "Kai Uwe Broulik",
"Name[x-test]": "xxKai Uwe Broulikxx",
"Name[zh_CN]": "Kai Uwe Broulik"
}
],
"Category": "Windows and Tasks",
"Description": "Global menubar in your Plasma Desktop",
"Description[ar]": "شريط القائمة الشاملة في سطح مكتب بلازما",
"Description[az]": "Plasma iş masanızın qlobal menyu zolağı",
"Description[ca]": "Barra de menús global a l'escriptori Plasma",
"Description[de]": "Globale Menüleiste auf der Plasma-Arbeitsfläche",
"Description[en_GB]": "Global menubar in your Plasma Desktop",
"Description[es]": "Barra de menú global para el escritorio Plasma",
"Description[eu]": "Zure Plasma mahaigaineko menu-barra orokorra",
"Description[fi]": "Työpöydänlaajuinen valikkorivi Plasma-työpöydälle",
"Description[fr]": "Barre globale de menus de votre bureau Plasma",
"Description[hu]": "Globális menüsáv a Plasma asztalon",
"Description[ia]": "Barra de menu global in tu Scriptorio de Plasma",
"Description[it]": "Barra dei menu globale nel tuo desktop Plasma",
"Description[ko]": "Plasma 데스크톱에 전역 메뉴 표시줄 표시",
"Description[lt]": "Visuotinė meniu juosta jūsų Plasma darbalaukyje",
"Description[nl]": "Globale menubalk in uw Plasma-bureaublad",
"Description[nn]": "Global menylinje på Plasma-skrivebordet",
"Description[pa]": "ਤੁਹਾਡੇ ਪਲਾਜ਼ਮਾ ਡੈਸਕਟਾਪ ਵਿੱਚ ਗਲੋਬਲ ਮੇਨੂ-ਪੱਟੀ",
"Description[pl]": "Globalny pasek menu na pulpicie Plazmy",
"Description[pt_BR]": "Barra de menu global na sua área de trabalho Plasma",
"Description[ro]": "Bară de meniu globală în biroul Plasma",
"Description[ru]": "Строка меню приложения на рабочем столе Plasma",
"Description[sk]": "Globálna ponuka na vašej Ploche Plasma",
"Description[sl]": "Splošna menijska vrstica na vašem namizju Plasma",
"Description[sv]": "Global menyrad på Plasmaskrivbordet",
"Description[ta]": "பணிமேடையிலேயே செயலிகளின் பட்டிகளை காட்டும்",
"Description[tr]": "Plazma Masaüstünüzde global menü çubuğu",
"Description[uk]": "Загальна панель меню у вашій стільниці Плазми",
"Description[vi]": "Thanh trình đơn toàn cục ở bàn làm việc Plasma của bạn",
"Description[x-test]": "xxGlobal menubar in your Plasma Desktopxx",
"Description[zh_CN]": "Plasma 桌面上的全局菜单",
"FormFactors": [
"desktop"
],
"Icon": "show-menu",
"Id": "org.kde.plasma.appmenu",
"License": "GPL-2.0+",
"Name": "Global Menu",
"Name[ar]": "القائمة العموميّة",
"Name[ast]": "Menú global",
"Name[az]": "Qlobal menyu",
"Name[ca@valencia]": "Menú global",
"Name[ca]": "Menú global",
"Name[cs]": "Globální nabídka",
"Name[da]": "Global menu",
"Name[de]": "Globales Menü",
"Name[el]": "Καθολικό μενού",
"Name[en_GB]": "Global Menu",
"Name[es]": "Menú global",
"Name[et]": "Globaalne menüü",
"Name[eu]": "Menu orokorra",
"Name[fi]": "Yleisvalikko",
"Name[fr]": "Menu global",
"Name[gl]": "Menú global",
"Name[he]": "תפריט גלובלי",
"Name[hi]": "वैश्विक मेन्यू",
"Name[hsb]": "Globalny meni",
"Name[hu]": "Globális menü",
"Name[ia]": "Menu Global",
"Name[id]": "Menu Global",
"Name[it]": "Menu globale",
"Name[ko]": "전역 메뉴",
"Name[lt]": "Visuotinis meniu",
"Name[lv]": "Globālā izvēlne",
"Name[ml]": "പൊതു മെനു",
"Name[nl]": "Globaal menu",
"Name[nn]": "Global meny",
"Name[pa]": "ਗਲੋਬਲ ਮੇਨੂ",
"Name[pl]": "Menu globalne",
"Name[pt]": "Menu Global",
"Name[pt_BR]": "Menu global",
"Name[ro]": "Meniu global",
"Name[ru]": "Меню приложения",
"Name[sk]": "Globálna ponuka",
"Name[sl]": "Splošni meni",
"Name[sr@ijekavian]": "Глобални мени",
"Name[sr@ijekavianlatin]": "Globalni meni",
"Name[sr@latin]": "Globalni meni",
"Name[sr]": "Глобални мени",
"Name[sv]": "Global meny",
"Name[ta]": "பொதுவான பட்டி",
"Name[tg]": "Феҳристи умумӣ",
"Name[tr]": "Genel Menü",
"Name[uk]": "Загальне меню",
"Name[vi]": "Trình đơn toàn cục",
"Name[x-test]": "xxGlobal Menuxx",
"Name[zh_CN]": "全局菜单",
"Name[zh_TW]": "全域選單",
"ServiceTypes": [
"Plasma/Applet"
],
"Version": "2.0",
"Website": "https://kde.org/plasma-desktop"
},
"X-Plasma-API": "declarativeappletscript",
"X-Plasma-MainScript": "ui/main.qml"
}

View File

@ -0,0 +1,19 @@
set(appmenuapplet_SRCS
appmenumodel.cpp
appmenuplugin.cpp
)
add_library(appmenuplugin SHARED ${appmenuapplet_SRCS})
target_link_libraries(appmenuplugin
Qt::Core
Qt::Widgets
Qt::Quick
KF5::Plasma
KF5::WindowSystem
KF5::I18n
PW::LibTaskManager
dbusmenuqt)
install(TARGETS appmenuplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/appmenu)
install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/appmenu)

View File

@ -0,0 +1,327 @@
/*
SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-FileCopyrightText: 2016 Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "appmenumodel.h"
#include <QAction>
#include <QDBusConnection>
#include <QDBusConnectionInterface>
#include <QDBusServiceWatcher>
#include <QGuiApplication>
#include <QMenu>
// Includes for the menu search.
#include <KLocalizedString>
#include <QLineEdit>
#include <QListView>
#include <QWidgetAction>
#include <abstracttasksmodel.h>
#include <dbusmenuimporter.h>
class KDBusMenuImporter : public DBusMenuImporter
{
public:
KDBusMenuImporter(const QString &service, const QString &path, QObject *parent)
: DBusMenuImporter(service, path, parent)
{
}
protected:
QIcon iconForName(const QString &name) override
{
return QIcon::fromTheme(name);
}
};
AppMenuModel::AppMenuModel(QObject *parent)
: QAbstractListModel(parent)
, m_serviceWatcher(new QDBusServiceWatcher(this))
, m_tasksModel(new TaskManager::TasksModel(this))
{
m_tasksModel->setFilterByScreen(true);
connect(m_tasksModel, &TaskManager::TasksModel::activeTaskChanged, this, &AppMenuModel::onActiveWindowChanged);
connect(m_tasksModel,
&TaskManager::TasksModel::dataChanged,
[=](const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) {
Q_UNUSED(topLeft)
Q_UNUSED(bottomRight)
if (roles.contains(TaskManager::AbstractTasksModel::ApplicationMenuObjectPath)
|| roles.contains(TaskManager::AbstractTasksModel::ApplicationMenuServiceName) || roles.isEmpty()) {
onActiveWindowChanged();
}
});
connect(m_tasksModel, &TaskManager::TasksModel::activityChanged, this, &AppMenuModel::onActiveWindowChanged);
connect(m_tasksModel, &TaskManager::TasksModel::virtualDesktopChanged, this, &AppMenuModel::onActiveWindowChanged);
connect(m_tasksModel, &TaskManager::TasksModel::countChanged, this, &AppMenuModel::onActiveWindowChanged);
connect(m_tasksModel, &TaskManager::TasksModel::screenGeometryChanged, this, &AppMenuModel::screenGeometryChanged);
connect(this, &AppMenuModel::modelNeedsUpdate, this, [this] {
if (!m_updatePending) {
m_updatePending = true;
QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection);
}
});
onActiveWindowChanged();
m_serviceWatcher->setConnection(QDBusConnection::sessionBus());
// if our current DBus connection gets lost, close the menu
// we'll select the new menu when the focus changes
connect(m_serviceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, [this](const QString &serviceName) {
if (serviceName == m_serviceName) {
setMenuAvailable(false);
Q_EMIT modelNeedsUpdate();
}
});
// X11 has funky menu behaviour that prevents this from working properly.
if (KWindowSystem::isPlatformWayland()) {
m_searchAction = new QAction(this);
m_searchAction->setText(i18n("Search"));
m_searchAction->setObjectName(QStringLiteral("appmenu"));
m_searchMenu.reset(new QMenu);
auto searchAction = new QWidgetAction(this);
auto searchBar = new QLineEdit;
searchBar->setClearButtonEnabled(true);
searchBar->setPlaceholderText(i18n("Search…"));
searchBar->setMinimumWidth(200);
searchBar->setContentsMargins(4, 4, 4, 4);
connect(m_tasksModel, &TaskManager::TasksModel::activeTaskChanged, [=]() {
searchBar->setText(QString());
});
connect(searchBar, &QLineEdit::textChanged, [=]() mutable {
insertSearchActionsIntoMenu(searchBar->text());
});
connect(searchBar, &QLineEdit::returnPressed, [=]() mutable {
if (m_currentSearchActions.first()) {
m_currentSearchActions.first()->trigger();
}
});
connect(this, &AppMenuModel::modelNeedsUpdate, this, [this, searchBar]() mutable {
insertSearchActionsIntoMenu(searchBar->text());
});
searchAction->setDefaultWidget(searchBar);
m_searchMenu->addAction(searchAction);
m_searchMenu->addSeparator();
m_searchAction->setMenu(m_searchMenu.get());
}
}
AppMenuModel::~AppMenuModel() = default;
bool AppMenuModel::menuAvailable() const
{
return m_menuAvailable;
}
void AppMenuModel::setMenuAvailable(bool set)
{
if (m_menuAvailable != set) {
m_menuAvailable = set;
setVisible(true);
Q_EMIT menuAvailableChanged();
}
}
bool AppMenuModel::visible() const
{
return m_visible;
}
void AppMenuModel::setVisible(bool visible)
{
if (m_visible != visible) {
m_visible = visible;
Q_EMIT visibleChanged();
}
}
QRect AppMenuModel::screenGeometry() const
{
return m_tasksModel->screenGeometry();
}
void AppMenuModel::setScreenGeometry(QRect geometry)
{
m_tasksModel->setScreenGeometry(geometry);
}
int AppMenuModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
if (!m_menuAvailable || !m_menu) {
return 0;
}
return m_menu->actions().count() + (KWindowSystem::isPlatformWayland() ? 1 : 0);
}
void AppMenuModel::removeSearchActionsFromMenu()
{
for (const auto &action : m_currentSearchActions) {
m_searchAction->menu()->removeAction(action);
}
m_currentSearchActions = QList<QAction *>();
}
void AppMenuModel::insertSearchActionsIntoMenu(const QString &filter)
{
removeSearchActionsFromMenu();
if (filter.isEmpty()) {
return;
}
const auto actions = flatActionList();
for (const auto &action : actions) {
if (action->text().contains(filter, Qt::CaseInsensitive)) {
m_searchAction->menu()->addAction(action);
m_currentSearchActions << action;
}
}
}
void AppMenuModel::update()
{
beginResetModel();
endResetModel();
m_updatePending = false;
}
void AppMenuModel::onActiveWindowChanged()
{
const QModelIndex activeTaskIndex = m_tasksModel->activeTask();
const QString objectPath = m_tasksModel->data(activeTaskIndex, TaskManager::AbstractTasksModel::ApplicationMenuObjectPath).toString();
const QString serviceName = m_tasksModel->data(activeTaskIndex, TaskManager::AbstractTasksModel::ApplicationMenuServiceName).toString();
if (!objectPath.isEmpty() && !serviceName.isEmpty()) {
setMenuAvailable(true);
updateApplicationMenu(serviceName, objectPath);
setVisible(true);
Q_EMIT modelNeedsUpdate();
} else {
setMenuAvailable(false);
setVisible(false);
}
}
QHash<int, QByteArray> AppMenuModel::roleNames() const
{
QHash<int, QByteArray> roleNames;
roleNames[MenuRole] = QByteArrayLiteral("activeMenu");
roleNames[ActionRole] = QByteArrayLiteral("activeActions");
return roleNames;
}
QList<QAction *> AppMenuModel::flatActionList()
{
QList<QAction *> ret;
if (!m_menuAvailable || !m_menu) {
return ret;
}
const auto actions = m_menu->findChildren<QAction *>();
for (auto &action : actions) {
if (action->menu() == nullptr) {
ret << action;
}
}
return ret;
}
QVariant AppMenuModel::data(const QModelIndex &index, int role) const
{
const int row = index.row();
if (row < 0 || !m_menuAvailable || !m_menu) {
return QVariant();
}
const auto actions = m_menu->actions();
if (row == actions.count() && KWindowSystem::isPlatformWayland()) {
if (role == MenuRole) {
return m_searchAction->text();
} else if (role == ActionRole) {
return QVariant::fromValue((void *)m_searchAction);
}
}
if (row >= actions.count()) {
return QVariant();
}
if (role == MenuRole) { // TODO this should be Qt::DisplayRole
return actions.at(row)->text();
} else if (role == ActionRole) {
return QVariant::fromValue((void *)actions.at(row));
}
return QVariant();
}
void AppMenuModel::updateApplicationMenu(const QString &serviceName, const QString &menuObjectPath)
{
if (m_serviceName == serviceName && m_menuObjectPath == menuObjectPath) {
if (m_importer) {
QMetaObject::invokeMethod(m_importer, "updateMenu", Qt::QueuedConnection);
}
return;
}
m_serviceName = serviceName;
m_serviceWatcher->setWatchedServices(QStringList({m_serviceName}));
m_menuObjectPath = menuObjectPath;
if (m_importer) {
m_importer->deleteLater();
}
m_importer = new KDBusMenuImporter(serviceName, menuObjectPath, this);
QMetaObject::invokeMethod(m_importer, "updateMenu", Qt::QueuedConnection);
connect(m_importer.data(), &DBusMenuImporter::menuUpdated, this, [=](QMenu *menu) {
m_menu = m_importer->menu();
if (m_menu.isNull() || menu != m_menu) {
return;
}
// cache first layer of sub menus, which we'll be popping up
const auto actions = m_menu->actions();
for (QAction *a : actions) {
// signal dataChanged when the action changes
connect(a, &QAction::changed, this, [this, a] {
if (m_menuAvailable && m_menu) {
const int actionIdx = m_menu->actions().indexOf(a);
if (actionIdx > -1) {
const QModelIndex modelIdx = index(actionIdx, 0);
Q_EMIT dataChanged(modelIdx, modelIdx);
}
}
});
connect(a, &QAction::destroyed, this, &AppMenuModel::modelNeedsUpdate);
if (a->menu()) {
m_importer->updateMenu(a->menu());
}
}
setMenuAvailable(true);
Q_EMIT modelNeedsUpdate();
});
connect(m_importer.data(), &DBusMenuImporter::actionActivationRequested, this, [this](QAction *action) {
// TODO submenus
if (!m_menuAvailable || !m_menu) {
return;
}
const auto actions = m_menu->actions();
auto it = std::find(actions.begin(), actions.end(), action);
if (it != actions.end()) {
Q_EMIT requestActivateIndex(it - actions.begin());
}
});
}

View File

@ -0,0 +1,95 @@
/*
SPDX-FileCopyrightText: 2016 Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#pragma once
#include <KWindowSystem>
#include <QAbstractListModel>
#include <QAction>
#include <QPointer>
#include <QRect>
#include <QStringList>
#include <tasksmodel.h>
class QMenu;
class QModelIndex;
class QDBusServiceWatcher;
class KDBusMenuImporter;
class AppMenuModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(bool menuAvailable READ menuAvailable WRITE setMenuAvailable NOTIFY menuAvailableChanged)
Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
Q_PROPERTY(QRect screenGeometry READ screenGeometry WRITE setScreenGeometry NOTIFY screenGeometryChanged)
public:
explicit AppMenuModel(QObject *parent = nullptr);
~AppMenuModel() override;
enum AppMenuRole {
MenuRole = Qt::UserRole + 1, // TODO this should be Qt::DisplayRole
ActionRole,
};
QVariant data(const QModelIndex &index, int role) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QHash<int, QByteArray> roleNames() const override;
void updateApplicationMenu(const QString &serviceName, const QString &menuObjectPath);
bool menuAvailable() const;
void setMenuAvailable(bool set);
bool visible() const;
QRect screenGeometry() const;
void setScreenGeometry(QRect geometry);
QList<QAction *> flatActionList();
Q_SIGNALS:
void requestActivateIndex(int index);
void bringToFocus(int index);
private Q_SLOTS:
void onActiveWindowChanged();
void setVisible(bool visible);
void update();
Q_SIGNALS:
void menuAvailableChanged();
void modelNeedsUpdate();
void screenGeometryChanged();
void visibleChanged();
private:
bool m_menuAvailable;
bool m_updatePending = false;
bool m_visible = true;
TaskManager::TasksModel *m_tasksModel;
//! current active window used
WId m_currentWindowId = 0;
//! window that its menu initialization may be delayed
WId m_delayedMenuWindowId = 0;
QScopedPointer<QMenu> m_searchMenu;
QPointer<QMenu> m_menu;
QPointer<QAction> m_searchAction;
QList<QAction *> m_currentSearchActions;
void removeSearchActionsFromMenu();
void insertSearchActionsIntoMenu(const QString &filter = QString());
QDBusServiceWatcher *m_serviceWatcher;
QString m_serviceName;
QString m_menuObjectPath;
QPointer<KDBusMenuImporter> m_importer;
};

View File

@ -0,0 +1,15 @@
/*
SPDX-FileCopyrightText: 2016 Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "appmenuplugin.h"
#include "appmenumodel.h"
#include <QQmlEngine>
void AppmenuPlugin::registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.appmenu"));
qmlRegisterType<AppMenuModel>(uri, 1, 0, "AppMenuModel");
}

View File

@ -0,0 +1,18 @@
/*
SPDX-FileCopyrightText: 2016 Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#pragma once
#include <QQmlExtensionPlugin>
class AppmenuPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public:
void registerTypes(const char *uri) override;
};

View File

@ -0,0 +1,3 @@
module org.kde.plasma.private.appmenu
plugin appmenuplugin

View File

@ -0,0 +1 @@
plasma_install_package(package org.kde.plasma.battery)

View File

@ -0,0 +1,2 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.battery.pot

View File

@ -0,0 +1,32 @@
Obviously, this is a battery monitor applet for Plasma.
The catch of those four .svg files is the following:
battery-inkscape.svg is an so-called "Inkscape SVG", it's the one
you want to edit end export to
battery.svg as plain .svg file.
Likewise, for the Oxygen theme.
This file contains various layers:
* Battery The "background", an empty battery
* AcAdapter A flash, saying "Ac is plugged in"
* Fill10 10% filled, red
* Fill20 20% filled, orange
* Fill20 30% filled, green (and so on...)
* Fill30
* Fill40
* Fill50
* Fill60
* Fill70
* Fill80
* Fill90
* Fill010
* Shadow An Oxygen-style shadow under the battery
The Battery layer is always rendered as the first step. On top
of that, we render only one of the FillN layers. If the AC
Adapter is plugged in, we paint that layer on top of the cake.
It makes no difference when we paint the Shadow, there's no
overlap between shadow and other layers.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="General">
<entry name="showPercentage" type="bool">
<label>If true, the battery will display a little charge percentage label inside.</label>
<default>false</default>
</entry>
</group>
</kcfg>

View File

@ -0,0 +1,38 @@
/*
SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.15
import QtGraphicalEffects 1.15
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.core 2.1 as PlasmaCore
Rectangle {
property alias text: label.text
property Item icon
color: PlasmaCore.ColorScope.backgroundColor
width: Math.max(PlasmaCore.Units.gridUnit, label.width + PlasmaCore.Units.devicePixelRatio * 2)
height: label.height
radius: PlasmaCore.Units.devicePixelRatio * 3
opacity: 0.9
PlasmaComponents3.Label {
id: label
anchors.centerIn: parent
font.pixelSize: Math.max(icon.height / 4, PlasmaCore.Theme.smallestFont.pixelSize * 0.8)
}
layer.enabled: true
layer.effect: DropShadow {
horizontalOffset: 0
verticalOffset: 0
radius: PlasmaCore.Units.devicePixelRatio * 2
samples: radius * 2
color: Qt.rgba(0, 0, 0, 0.5)
}
}

View File

@ -0,0 +1,199 @@
/*
SPDX-FileCopyrightText: 2012-2013 Daniel Nicoletti <dantti12@gmail.com>
SPDX-FileCopyrightText: 2013-2015 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import org.kde.kcoreaddons 1.0 as KCoreAddons
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.workspace.components 2.0
import "logic.js" as Logic
RowLayout {
id: root
// We'd love to use `required` properties, especially since the model provides role names for them;
// but unfortunately some of those roles have whitespaces in their name, which QML doesn't have any
// workaround for (raw identifiers like r#try in Rust would've helped here).
//
// type: {
// Capacity: int,
// Energy: real,
// "Is Power Supply": bool,
// Percent: int,
// "Plugged In": bool,
// "Pretty Name": string,
// Product: string,
// State: "Discharging"|"Charging"|"FullyCharged"|etc.,
// Type: string,
// Vendor: string,
// }?
property var battery
// NOTE: According to the UPower spec this property is only valid for primary batteries, however
// UPower seems to set the Present property false when a device is added but not probed yet
readonly property bool isPresent: root.battery["Plugged in"]
readonly property bool isBroken: root.battery.Capacity > 0 && root.battery.Capacity < 50
property int remainingTime: 0
// Existing instance of a slider to use as a reference to calculate extra
// margins for a progress bar, so that the row of labels on top of it
// could visually look as if it were on the same distance from the bar as
// they are from the slider.
property PlasmaComponents3.Slider matchHeightOfSlider: PlasmaComponents3.Slider {}
readonly property real extraMargin: Math.max(0, Math.floor((matchHeightOfSlider.height - chargeBar.height) / 2))
spacing: PlasmaCore.Units.gridUnit
BatteryIcon {
id: batteryIcon
Layout.alignment: Qt.AlignTop
Layout.preferredWidth: PlasmaCore.Units.iconSizes.medium
Layout.preferredHeight: PlasmaCore.Units.iconSizes.medium
batteryType: root.battery.Type
percent: root.battery.Percent
hasBattery: root.isPresent
pluggedIn: root.battery.State === "Charging" && root.battery["Is Power Supply"]
}
ColumnLayout {
Layout.fillWidth: true
Layout.alignment: root.isPresent ? Qt.AlignTop : Qt.AlignVCenter
spacing: 0
RowLayout {
spacing: PlasmaCore.Units.smallSpacing
PlasmaComponents3.Label {
Layout.fillWidth: true
elide: Text.ElideRight
text: root.battery["Pretty Name"]
}
PlasmaComponents3.Label {
text: Logic.stringForBatteryState(root.battery)
visible: root.battery["Is Power Supply"]
enabled: false
}
PlasmaComponents3.Label {
horizontalAlignment: Text.AlignRight
visible: root.isPresent
text: i18nc("Placeholder is battery percentage", "%1%", root.battery.Percent)
}
}
PlasmaComponents3.ProgressBar {
id: chargeBar
Layout.fillWidth: true
Layout.topMargin: root.extraMargin
Layout.bottomMargin: root.extraMargin
from: 0
to: 100
visible: root.isPresent
value: Number(root.battery.Percent)
}
// This gridLayout basically emulates an at-most-two-rows table with a
// single wide fillWidth/columnSpan header. Not really worth it trying
// to refactor it into some more clever fancy model-delegate stuff.
GridLayout {
id: details
Layout.fillWidth: true
Layout.topMargin: PlasmaCore.Units.smallSpacing
columns: 2
columnSpacing: PlasmaCore.Units.smallSpacing
rowSpacing: 0
component LeftLabel : PlasmaComponents3.Label {
// fillWidth is true, so using internal alignment
horizontalAlignment: Text.AlignLeft
Layout.fillWidth: true
font: PlasmaCore.Theme.smallestFont
wrapMode: Text.WordWrap
enabled: false
}
component RightLabel : PlasmaComponents3.Label {
// fillWidth is false, so using external (grid-cell-internal) alignment
Layout.alignment: Qt.AlignRight
Layout.fillWidth: false
font: PlasmaCore.Theme.smallestFont
enabled: false
}
PlasmaComponents3.Label {
Layout.fillWidth: true
Layout.columnSpan: 2
text: root.isBroken && typeof root.battery.Capacity !== "undefined"
? i18n("This battery's health is at only %1% and it should be replaced. Contact the manufacturer.", root.battery.Capacity)
: ""
font: PlasmaCore.Theme.smallestFont
color: PlasmaCore.Theme.neutralTextColor
visible: root.isBroken
wrapMode: Text.WordWrap
}
readonly property bool remainingTimeRowVisible: root.battery !== null
&& root.remainingTime > 0
&& root.battery["Is Power Supply"]
&& ["Discharging", "Charging"].includes(root.battery.State)
LeftLabel {
text: root.battery.State === "Charging"
? i18n("Time To Full:")
: i18n("Remaining Time:")
visible: details.remainingTimeRowVisible
}
RightLabel {
text: KCoreAddons.Format.formatDuration(root.remainingTime, KCoreAddons.FormatTypes.HideSeconds)
visible: details.remainingTimeRowVisible
}
readonly property bool healthRowVisible: root.battery !== null
&& root.battery["Is Power Supply"]
&& root.battery.Capacity !== ""
&& typeof root.battery.Capacity === "number"
&& !root.isBroken
LeftLabel {
text: i18n("Battery Health:")
visible: details.healthRowVisible
}
RightLabel {
text: details.healthRowVisible
? i18nc("Placeholder is battery health percentage", "%1%", root.battery.Capacity)
: ""
visible: details.healthRowVisible
}
}
InhibitionHint {
Layout.fillWidth: true
Layout.topMargin: PlasmaCore.Units.smallSpacing
readonly property var chargeStopThreshold: pmSource.data["Battery"] ? pmSource.data["Battery"]["Charge Stop Threshold"] : undefined
readonly property bool pluggedIn: pmSource.data["AC Adapter"] !== undefined && pmSource.data["AC Adapter"]["Plugged in"]
visible: pluggedIn && typeof chargeStopThreshold === "number" && chargeStopThreshold > 0 && chargeStopThreshold < 100
iconSource: "kt-speed-limits" // FIXME good icon
text: i18n("Battery is configured to charge up to approximately %1%.", chargeStopThreshold || 0)
}
}
}

View File

@ -0,0 +1,69 @@
/*
SPDX-FileCopyrightText: 2012-2013 Daniel Nicoletti <dantti12@gmail.com>
SPDX-FileCopyrightText: 2013, 2015 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.core 2.1 as PlasmaCore
RowLayout {
id: root
property alias icon: image.source
property alias label: title.text
property alias slider: control
property alias value: control.value
property alias maximumValue: control.to
property alias stepSize: control.stepSize
property alias showPercentage: percent.visible
readonly property real percentage: Math.round(100 * value / maximumValue)
signal moved()
spacing: PlasmaCore.Units.gridUnit
PlasmaCore.IconItem {
id: image
Layout.alignment: Qt.AlignTop
Layout.preferredWidth: PlasmaCore.Units.iconSizes.medium
Layout.preferredHeight: PlasmaCore.Units.iconSizes.medium
}
ColumnLayout {
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
spacing: 0
RowLayout {
Layout.fillWidth: true
spacing: PlasmaCore.Units.smallSpacing
PlasmaComponents3.Label {
id: title
Layout.fillWidth: true
}
PlasmaComponents3.Label {
id: percent
Layout.alignment: Qt.AlignRight
text: i18nc("Placeholder is brightness percentage", "%1%", root.percentage)
}
}
PlasmaComponents3.Slider {
id: control
Layout.fillWidth: true
// Don't allow the slider to turn off the screen
// Please see https://git.reviewboard.kde.org/r/122505/ for more information
from: to > 100 ? 1 : 0
stepSize: 1
onMoved: root.moved()
}
}
}

View File

@ -0,0 +1,81 @@
/*
SPDX-FileCopyrightText: 2011 Sebastian Kügler <sebas@kde.org>
SPDX-FileCopyrightText: 2011 Viranch Mehta <viranch.mehta@gmail.com>
SPDX-FileCopyrightText: 2013 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.workspace.components 2.0 as WorkspaceComponents
MouseArea {
id: root
property real itemSize: Math.min(root.height, root.width/view.count)
readonly property bool isConstrained: plasmoid.formFactor === PlasmaCore.Types.Vertical || plasmoid.formFactor === PlasmaCore.Types.Horizontal
property real brightnessError: 0
property QtObject batteries
property bool hasBatteries: false
hoverEnabled: true
onClicked: plasmoid.expanded = !plasmoid.expanded
// "No Batteries" case
PlasmaCore.IconItem {
anchors.fill: parent
visible: !root.hasBatteries
source: plasmoid.icon
active: parent.containsMouse
}
// We have any batteries; show their status
//Should we consider turning this into a Flow item?
Row {
visible: root.hasBatteries
anchors.centerIn: parent
Repeater {
id: view
model: root.isConstrained ? 1 : root.batteries
Item {
id: batteryContainer
property int percent: root.isConstrained ? pmSource.data["Battery"]["Percent"] : model["Percent"]
property bool pluggedIn: pmSource.data["AC Adapter"] && pmSource.data["AC Adapter"]["Plugged in"] && (root.isConstrained || model["Is Power Supply"])
height: root.itemSize
width: root.width/view.count
property real iconSize: Math.min(width, height)
WorkspaceComponents.BatteryIcon {
id: batteryIcon
anchors.centerIn: parent
height: batteryContainer.iconSize
width: height
hasBattery: root.hasBatteries
percent: batteryContainer.percent
pluggedIn: batteryContainer.pluggedIn
}
BadgeOverlay {
anchors.bottom: parent.bottom
anchors.right: parent.right
visible: plasmoid.configuration.showPercentage
text: i18nc("battery percentage below battery icon", "%1%", percent)
icon: batteryIcon
}
}
}
}
}

View File

@ -0,0 +1,34 @@
/*
SPDX-FileCopyrightText: 2015 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.core 2.1 as PlasmaCore
RowLayout {
property alias iconSource: iconItem.source
property alias text: label.text
spacing: PlasmaCore.Units.smallSpacing
PlasmaCore.IconItem {
id: iconItem
Layout.preferredWidth: PlasmaCore.Units.iconSizes.small
Layout.preferredHeight: PlasmaCore.Units.iconSizes.small
visible: valid
}
PlasmaComponents3.Label {
id: label
Layout.fillWidth: true
font: PlasmaCore.Theme.smallestFont
wrapMode: Text.WordWrap
elide: Text.ElideRight
maximumLineCount: 4
}
}

View File

@ -0,0 +1,170 @@
/*
SPDX-FileCopyrightText: 2011 Viranch Mehta <viranch.mehta@gmail.com>
SPDX-FileCopyrightText: 2013-2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import org.kde.kquickcontrolsaddons 2.1
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
PlasmaComponents3.Page {
id: dialog
property alias model: batteryList.model
property bool pluggedIn
property int remainingTime
property bool isBrightnessAvailable
property bool isKeyboardBrightnessAvailable
property string activeProfile
property var profiles
// List of active power management inhibitions (applications that are
// blocking sleep and screen locking).
//
// type: [{
// Icon: string,
// Name: string,
// Reason: string,
// }]
property var inhibitions: []
property bool inhibitsLidAction
property string inhibitionReason
property string degradationReason
// type: [{ Name: string, Icon: string, Profile: string, Reason: string }]
required property var profileHolds
signal powerManagementChanged(bool disabled)
signal activateProfileRequested(string profile)
header: PlasmaExtras.PlasmoidHeading {
leftPadding: PlasmaCore.Units.smallSpacing
contentItem: PowerManagementItem {
id: pmSwitch
inhibitions: dialog.inhibitions
inhibitsLidAction: dialog.inhibitsLidAction
pluggedIn: dialog.pluggedIn
onDisabledChanged: powerManagementChanged(disabled)
KeyNavigation.tab: batteryList
KeyNavigation.backtab: keyboardBrightnessSlider
}
}
FocusScope {
anchors.fill: parent
focus: true
ColumnLayout {
anchors {
fill: parent
topMargin: PlasmaCore.Units.smallSpacing * 2
leftMargin: PlasmaCore.Units.smallSpacing
rightMargin: PlasmaCore.Units.smallSpacing
}
spacing: PlasmaCore.Units.smallSpacing * 2
BrightnessItem {
id: brightnessSlider
Layout.fillWidth: true
icon: "video-display-brightness"
label: i18n("Display Brightness")
visible: isBrightnessAvailable
value: batterymonitor.screenBrightness
maximumValue: batterymonitor.maximumScreenBrightness
KeyNavigation.tab: keyboardBrightnessSlider
KeyNavigation.backtab: batteryList
stepSize: batterymonitor.maximumScreenBrightness/100
onMoved: batterymonitor.screenBrightness = value
// Manually dragging the slider around breaks the binding
Connections {
target: batterymonitor
function onScreenBrightnessChanged() {
brightnessSlider.value = batterymonitor.screenBrightness;
}
}
}
BrightnessItem {
id: keyboardBrightnessSlider
Layout.fillWidth: true
icon: "input-keyboard-brightness"
label: i18n("Keyboard Brightness")
showPercentage: false
value: batterymonitor.keyboardBrightness
maximumValue: batterymonitor.maximumKeyboardBrightness
visible: isKeyboardBrightnessAvailable
KeyNavigation.tab: pmSwitch
KeyNavigation.backtab: brightnessSlider
onMoved: batterymonitor.keyboardBrightness = value
// Manually dragging the slider around breaks the binding
Connections {
target: batterymonitor
function onKeyboardBrightnessChanged() {
keyboardBrightnessSlider.value = batterymonitor.keyboardBrightness;
}
}
}
PowerProfileItem {
Layout.fillWidth: true
activeProfile: dialog.activeProfile
inhibitionReason: dialog.inhibitionReason
visible: dialog.profiles.length > 0
degradationReason: dialog.degradationReason
profileHolds: dialog.profileHolds
onActivateProfileRequested: dialog.activateProfileRequested(profile)
}
PlasmaComponents3.ScrollView {
id: batteryScrollView
// HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890
PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff
// additional margin, because the bottom of PowerProfileItem
// and the top of BatteryItem are more dense.
Layout.topMargin: PlasmaCore.Units.smallSpacing * 2
Layout.fillWidth: true
Layout.fillHeight: true
ListView {
id: batteryList
boundsBehavior: Flickable.StopAtBounds
spacing: PlasmaCore.Units.smallSpacing * 2
KeyNavigation.tab: brightnessSlider
KeyNavigation.backtab: pmSwitch
delegate: BatteryItem {
width: ListView.view.width
battery: model
remainingTime: dialog.remainingTime
matchHeightOfSlider: brightnessSlider.slider
}
}
}
}
}
}

View File

@ -0,0 +1,104 @@
/*
SPDX-FileCopyrightText: 2012-2013 Daniel Nicoletti <dantti12@gmail.com>
SPDX-FileCopyrightText: 2013, 2015 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import org.kde.kquickcontrolsaddons 2.1
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.core 2.1 as PlasmaCore
ColumnLayout {
id: root
property alias disabled: pmCheckBox.checked
property bool pluggedIn
// List of active power management inhibitions (applications that are
// blocking sleep and screen locking).
//
// type: [{
// Icon: string,
// Name: string,
// Reason: string,
// }]
property var inhibitions: []
property bool inhibitsLidAction
// UI to manually inhibit sleep and screen locking
PlasmaComponents3.CheckBox {
id: pmCheckBox
Layout.fillWidth: true
text: i18nc("Minimize the length of this string as much as possible", "Manually block sleep and screen locking")
checked: false
}
// Separator line
PlasmaCore.SvgItem {
Layout.fillWidth: true
visible: inhibitionReasonsLayout.visible
elementId: "horizontal-line"
svg: PlasmaCore.Svg {
imagePath: "widgets/line"
}
}
// list of automatic inhibitions
ColumnLayout {
id: inhibitionReasonsLayout
Layout.fillWidth: true
visible: root.inhibitsLidAction || (root.inhibitions.length > 0 && !root.disabled)
InhibitionHint {
Layout.fillWidth: true
visible: root.inhibitsLidAction
iconSource: "computer-laptop"
text: i18nc("Minimize the length of this string as much as possible", "Your laptop is configured not to sleep when closing the lid while an external monitor is connected.")
}
PlasmaComponents3.Label {
id: inhibitionExplanation
Layout.fillWidth: true
// Don't need to show the inhibitions when power management
// isn't enabled anyway
visible: root.inhibitions.length > 1 && !root.disabled
font: PlasmaCore.Theme.smallestFont
wrapMode: Text.WordWrap
elide: Text.ElideRight
maximumLineCount: 3
text: i18np("%1 application is currently blocking sleep and screen locking:",
"%1 applications are currently blocking sleep and screen locking:",
root.inhibitions.length)
}
Repeater {
// Don't need to show the inhibitions when power management
// is manually disabled anyway
visible: !root.disabled
model: !root.disabled ? root.inhibitions : null
InhibitionHint {
property string icon: modelData.Icon
property string name: modelData.Name
property string reason: modelData.Reason
Layout.fillWidth: true
iconSource: icon
text: (root.inhibitions.length === 1)
? (reason
? i18n("%1 is currently blocking sleep and screen locking (%2)", name, reason)
: i18n("%1 is currently blocking sleep and screen locking (unknown reason)", name))
: (reason
? i18nc("Application name: reason for preventing sleep and screen locking", "%1: %2", name, reason)
: i18nc("Application name: reason for preventing sleep and screen locking", "%1: unknown reason", name))
}
}
}
}

View File

@ -0,0 +1,190 @@
/*
* SPDX-FileCopyrightText: 2021 Kai Uwe Broulik <kde@broulik.de>
* SPDX-FileCopyrightText: 2021 David Redondo <kde@david-redondo.de>
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.core 2.1 as PlasmaCore
RowLayout {
id: root
property string activeProfile
property string inhibitionReason
readonly property bool inhibited: inhibitionReason !== ""
property string degradationReason
// type: [{ Name: string, Icon: string, Profile: string, Reason: string }]
required property var profileHolds
// The canBeInhibited property mean that this profile's availability
// depends on root.inhibited value (and thus on the
// inhibitionReason string).
readonly property var profileData: [
{
label: i18n("Power Save"),
profile: "power-saver",
canBeInhibited: false,
}, {
label: i18n("Balanced"),
profile: "balanced",
canBeInhibited: false,
}, {
label: i18n("Performance"),
profile: "performance",
canBeInhibited: true,
}
]
readonly property int activeProfileIndex: profileData.findIndex(data => data.profile === activeProfile)
// type: typeof(profileData[])?
readonly property var activeProfileData: activeProfileIndex !== -1 ? profileData[activeProfileIndex] : undefined
// type: typeof(profileHolds)
readonly property var activeHolds: profileHolds.filter(hold => hold.Profile === activeProfile)
signal activateProfileRequested(string profile)
spacing: PlasmaCore.Units.gridUnit
PlasmaCore.IconItem {
source: "speedometer"
Layout.alignment: Qt.AlignTop
Layout.preferredWidth: PlasmaCore.Units.iconSizes.medium
Layout.preferredHeight: PlasmaCore.Units.iconSizes.medium
}
ColumnLayout {
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
spacing: 0
PlasmaComponents3.Label {
text: i18n("Power Profile")
}
PlasmaComponents3.Slider {
Layout.fillWidth: true
from: 0
to: 2
stepSize: 1
value: root.activeProfileIndex
snapMode: PlasmaComponents3.Slider.SnapAlways
onMoved: {
const { canBeInhibited, profile } = root.profileData[value];
if (!(canBeInhibited && root.inhibited)) {
activateProfileRequested(profile);
} else {
value = Qt.binding(() => root.activeProfileIndex);
}
}
// fake having a disabled second half
Rectangle {
z: -1
visible: root.inhibited
color: PlasmaCore.Theme.backgroundColor
anchors {
top: parent.background.top
left: parent.horizontalCenter
leftMargin: 1
right: parent.right
bottom: parent.background.bottom
}
opacity: 0.4
}
}
RowLayout {
Layout.fillWidth: true
spacing: PlasmaCore.Units.smallSpacing
Repeater {
id: repeater
model: root.profileData
PlasmaComponents3.Label {
// Same preferredWidth combined with fillWidth results in equal sizes for all
Layout.fillWidth: true
Layout.preferredWidth: 1
horizontalAlignment: switch (index) {
case 0:
return Text.AlignLeft; // first
case repeater.count - 1:
return Text.AlignRight; // last
default:
return Text.AlignHCenter; // middle
}
elide: Text.ElideMiddle
// Disable label for inhibited items to reinforce unavailability
enabled: !(root.profileData[index].canBeInhibited && root.inhibited)
text: modelData.label
}
}
}
// NOTE Only one of these will be visible at a time since the daemon will only set one depending
// on its version
InhibitionHint {
Layout.fillWidth: true
visible: root.inhibited
iconSource: "dialog-information"
text: switch(root.inhibitionReason) {
case "lap-detected":
return i18n("Performance mode has been disabled to reduce heat generation because the computer has detected that it may be sitting on your lap.")
case "high-operating-temperature":
return i18n("Performance mode is unavailable because the computer is running too hot.")
default:
return i18n("Performance mode is unavailable.")
}
}
InhibitionHint {
Layout.fillWidth: true
visible: root.activeProfile === "performance" && root.degradationReason !== ""
iconSource: "dialog-information"
text: switch(root.degradationReason) {
case "lap-detected":
return i18n("Performance may be lowered to reduce heat generation because the computer has detected that it may be sitting on your lap.")
case "high-operating-temperature":
return i18n("Performance may be reduced because the computer is running too hot.")
default:
return i18n("Performance may be reduced.")
}
}
InhibitionHint {
Layout.fillWidth: true
visible: root.activeHolds.length > 0 && root.activeProfileData !== undefined
text: root.activeProfileData !== undefined
? i18np("One application has requested activating %2:",
"%1 applications have requested activating %2:",
root.activeHolds.length,
i18n(root.activeProfileData.label))
: ""
}
Repeater {
model: root.activeHolds
InhibitionHint {
Layout.fillWidth: true
x: PlasmaCore.Units.smallSpacing
iconSource: modelData.Icon
text: i18nc("%1 is the name of the application, %2 is the reason provided by it for activating performance mode",
"%1: %2", modelData.Name, modelData.Reason)
}
}
}
}

View File

@ -0,0 +1,57 @@
/*
SPDX-FileCopyrightText: 2011 Sebastian Kügler <sebas@kde.org>
SPDX-FileCopyrightText: 2012 Viranch Mehta <viranch.mehta@gmail.com>
SPDX-FileCopyrightText: 2014-2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function stringForBatteryState(batteryData) {
if (batteryData["Plugged in"]) {
switch(batteryData["State"]) {
case "Discharging": return i18n("Discharging");
case "FullyCharged": return i18n("Fully Charged");
case "Charging": return i18n("Charging");
// when in doubt we're not charging
default: return i18n("Not Charging");
}
} else {
return i18nc("Battery is currently not present in the bay", "Not present");
}
}
function updateBrightness(rootItem, source) {
if (rootItem.updateScreenBrightnessJob || rootItem.updateKeyboardBrightnessJob)
return;
if (!source.data["PowerDevil"]) {
return;
}
// we don't want passive brightness change send setBrightness call
rootItem.disableBrightnessUpdate = true;
if (typeof source.data["PowerDevil"]["Screen Brightness"] === 'number') {
rootItem.screenBrightness = source.data["PowerDevil"]["Screen Brightness"];
}
if (typeof source.data["PowerDevil"]["Keyboard Brightness"] === 'number') {
rootItem.keyboardBrightness = source.data["PowerDevil"]["Keyboard Brightness"];
}
rootItem.disableBrightnessUpdate = false;
}
function updateInhibitions(rootItem, source) {
const inhibitions = [];
if (source.data["Inhibitions"]) {
for (let key in pmSource.data["Inhibitions"]) {
if (key === "plasmashell" || key === "plasmoidviewer") { // ignore our own inhibition
continue;
}
inhibitions.push(pmSource.data["Inhibitions"][key]);
}
}
rootItem.inhibitions = inhibitions;
}

View File

@ -0,0 +1,348 @@
/*
SPDX-FileCopyrightText: 2011 Sebastian Kügler <sebas@kde.org>
SPDX-FileCopyrightText: 2011 Viranch Mehta <viranch.mehta@gmail.com>
SPDX-FileCopyrightText: 2013-2015 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import org.kde.kcoreaddons 1.0 as KCoreAddons
import org.kde.kquickcontrolsaddons 2.1 // For KCMShell
import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.plasmoid 2.0
import "logic.js" as Logic
Item {
id: batterymonitor
property QtObject pmSource: PlasmaCore.DataSource {
id: pmSource
engine: "powermanagement"
connectedSources: sources
onSourceAdded: {
disconnectSource(source);
connectSource(source);
}
onSourceRemoved: {
disconnectSource(source);
}
onDataChanged: {
Logic.updateBrightness(batterymonitor, pmSource);
Logic.updateInhibitions(batterymonitor, pmSource);
}
}
property QtObject batteries: PlasmaCore.SortFilterModel {
id: batteries
filterRole: "Is Power Supply"
sortOrder: Qt.DescendingOrder
sourceModel: PlasmaCore.SortFilterModel {
sortRole: "Pretty Name"
sortOrder: Qt.AscendingOrder
sortCaseSensitivity: Qt.CaseInsensitive
sourceModel: PlasmaCore.DataModel {
dataSource: pmSource
sourceFilter: "Battery[0-9]+"
}
}
}
property QtObject updateScreenBrightnessJob
property QtObject updateKeyboardBrightnessJob
readonly property bool isBrightnessAvailable: pmSource.data["PowerDevil"] && pmSource.data["PowerDevil"]["Screen Brightness Available"] ? true : false
readonly property bool isKeyboardBrightnessAvailable: pmSource.data["PowerDevil"] && pmSource.data["PowerDevil"]["Keyboard Brightness Available"] ? true : false
readonly property bool hasBatteries: batteries.count > 0 && pmSource.data["Battery"]["Has Cumulative"]
readonly property bool hasBrightness: isBrightnessAvailable || isKeyboardBrightnessAvailable
readonly property bool kcmAuthorized: KCMShell.authorize("powerdevilprofilesconfig.desktop").length > 0
readonly property bool kcmEnergyInformationAuthorized: KCMShell.authorize("kcm_energyinfo.desktop").length > 0
readonly property int maximumScreenBrightness: pmSource.data["PowerDevil"] ? pmSource.data["PowerDevil"]["Maximum Screen Brightness"] || 0 : 0
readonly property int maximumKeyboardBrightness: pmSource.data["PowerDevil"] ? pmSource.data["PowerDevil"]["Maximum Keyboard Brightness"] || 0 : 0
readonly property int remainingTime: Number(pmSource.data["Battery"]["Remaining msec"])
property bool powermanagementDisabled: false
property bool disableBrightnessUpdate: true
property int screenBrightness
property int keyboardBrightness
// List of active power management inhibitions (applications that are
// blocking sleep and screen locking).
//
// type: [{
// Icon: string,
// Name: string,
// Reason: string,
// }]
property var inhibitions: []
function action_configure() {
KCMShell.openSystemSettings("kcm_powerdevilprofilesconfig");
}
function action_energyinformationkcm() {
KCMShell.openInfoCenter("kcm_energyinfo");
}
function action_showPercentage() {
if (!plasmoid.configuration.showPercentage) {
plasmoid.configuration.showPercentage = true;
} else {
plasmoid.configuration.showPercentage = false;
}
}
Plasmoid.switchWidth: PlasmaCore.Units.gridUnit * 10
Plasmoid.switchHeight: PlasmaCore.Units.gridUnit * 10
Plasmoid.title: (hasBatteries && hasBrightness ? i18n("Battery and Brightness") :
hasBrightness ? i18n("Brightness") :
hasBatteries ? i18n("Battery") : i18n("Power Management"))
LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
LayoutMirroring.childrenInherit: true
Plasmoid.status: {
if (powermanagementDisabled) {
return PlasmaCore.Types.ActiveStatus;
}
if (pmSource.data.Battery["Has Cumulative"]
&& !((pmSource.data["AC Adapter"]["Plugged in"] && pmSource.data["Battery"]["State"] === "FullyCharged") ||
// When we are using a charge threshold, the kernel
// may stop charging within a percentage point of the actual threshold
// and this is considered correct behavior, so we have to handle
// that. See https://bugzilla.kernel.org/show_bug.cgi?id=215531.
(pmSource.data["AC Adapter"]["Plugged in"]
&& typeof pmSource.data["Battery"]["Charge Stop Threshold"] === "number"
&& (pmSource.data.Battery.Percent >= pmSource.data["Battery"]["Charge Stop Threshold"] - 1
&& pmSource.data.Battery.Percent <= pmSource.data["Battery"]["Charge Stop Threshold"] + 1)
// Also, Upower may give us a status of "Not charging" rather than
// "Fully charged", so we need to account for that as well. See
// https://gitlab.freedesktop.org/upower/upower/-/issues/142.
&& (pmSource.data["Battery"]["State"] === "NoCharge" || pmSource.data["Battery"]["State"] === "FullyCharged"))
)){
return PlasmaCore.Types.ActiveStatus;
}
return PlasmaCore.Types.PassiveStatus;
}
Plasmoid.toolTipMainText: {
if (!hasBatteries) {
return plasmoid.title
} else if (pmSource.data["Battery"]["State"] === "FullyCharged") {
return i18n("Fully Charged");
}
const percent = pmSource.data.Battery.Percent;
if (pmSource.data["AC Adapter"] && pmSource.data["AC Adapter"]["Plugged in"]) {
const state = pmSource.data.Battery.State;
if (state === "NoCharge") {
return i18n("Battery at %1%, not Charging", percent);
} else if (state === "Discharging") {
return i18n("Battery at %1%, plugged in but still discharging", percent);
} else if (state === "Charging") {
return i18n("Battery at %1%, Charging", percent);
}
}
return i18n("Battery at %1%", percent);
}
Plasmoid.toolTipSubText: {
const parts = [];
// Add special text for the "plugged in but still discharging" case
if (pmSource.data["AC Adapter"] && pmSource.data["AC Adapter"]["Plugged in"] && pmSource.data.Battery.State === "Discharging") {
parts.push(i18n("The power supply is not powerful enough to charge the battery"));
}
if (batteries.count === 0) {
parts.push("No Batteries Available");
} else if (remainingTime > 0) {
const remainingTimeString = KCoreAddons.Format.formatDuration(remainingTime, KCoreAddons.FormatTypes.HideSeconds);
if (pmSource.data["Battery"]["State"] === "FullyCharged") {
// Don't add anything
} else if (pmSource.data["AC Adapter"] && pmSource.data["AC Adapter"]["Plugged in"]) {
parts.push(i18nc("time until fully charged - HH:MM","%1 until fully charged", remainingTimeString));
} else {
parts.push(i18nc("remaining time left of battery usage - HH:MM","%1 remaining", remainingTimeString));
}
} else if (pmSource.data.Battery.State === "NoCharge") {
parts.push(i18n("Not charging"));
} // otherwise, don't add anything
if (powermanagementDisabled) {
parts.push(i18n("Automatic sleep and screen locking are disabled"));
}
return parts.join("\n");
}
Plasmoid.icon: !hasBatteries ? "video-display-brightness" : "battery"
onScreenBrightnessChanged: {
if (disableBrightnessUpdate) {
return;
}
const service = pmSource.serviceForSource("PowerDevil");
const operation = service.operationDescription("setBrightness");
operation.brightness = screenBrightness;
// show OSD only when the plasmoid isn't expanded since the moving slider is feedback enough
operation.silent = plasmoid.expanded;
updateScreenBrightnessJob = service.startOperationCall(operation);
updateScreenBrightnessJob.finished.connect(job => {
Logic.updateBrightness(batterymonitor, pmSource);
});
}
onKeyboardBrightnessChanged: {
if (disableBrightnessUpdate) {
return;
}
var service = pmSource.serviceForSource("PowerDevil");
var operation = service.operationDescription("setKeyboardBrightness");
operation.brightness = keyboardBrightness;
// show OSD only when the plasmoid isn't expanded since the moving slider is feedback enough
operation.silent = plasmoid.expanded;
updateKeyboardBrightnessJob = service.startOperationCall(operation);
updateKeyboardBrightnessJob.finished.connect(job => {
Logic.updateBrightness(batterymonitor, pmSource);
});
}
Plasmoid.compactRepresentation: CompactRepresentation {
hasBatteries: batterymonitor.hasBatteries
batteries: batterymonitor.batteries
onWheel: {
const delta = wheel.angleDelta.y || wheel.angleDelta.x
const maximumBrightness = batterymonitor.maximumScreenBrightness
// Don't allow the UI to turn off the screen
// Please see https://git.reviewboard.kde.org/r/122505/ for more information
const minimumBrightness = (maximumBrightness > 100 ? 1 : 0)
const stepSize = Math.max(1, maximumBrightness / 20)
let newBrightness;
if (Math.abs(delta) < 120) {
// Touchpad scrolling
brightnessError += delta * stepSize / 120;
const change = Math.round(brightnessError);
brightnessError -= change;
newBrightness = batterymonitor.screenBrightness + change;
} else {
// Discrete/wheel scrolling
newBrightness = Math.round(batterymonitor.screenBrightness/stepSize + delta/120) * stepSize;
}
batterymonitor.screenBrightness = Math.max(minimumBrightness, Math.min(maximumBrightness, newBrightness));
}
}
Plasmoid.fullRepresentation: PopupDialog {
id: dialogItem
Layout.minimumWidth: PlasmaCore.Units.iconSizes.medium * 9
Layout.minimumHeight: PlasmaCore.Units.gridUnit * 15
// TODO Probably needs a sensible preferredHeight too
model: plasmoid.expanded ? batteries : null
focus: true
isBrightnessAvailable: batterymonitor.isBrightnessAvailable
isKeyboardBrightnessAvailable: batterymonitor.isKeyboardBrightnessAvailable
pluggedIn: pmSource.data["AC Adapter"] !== undefined && pmSource.data["AC Adapter"]["Plugged in"]
remainingTime: batterymonitor.remainingTime
readonly property string actuallyActiveProfile: pmSource.data["Power Profiles"] ? (pmSource.data["Power Profiles"]["Current Profile"] || "") : ""
activeProfile: actuallyActiveProfile
inhibitions: batterymonitor.inhibitions
inhibitsLidAction: pmSource.data["PowerDevil"] && pmSource.data["PowerDevil"]["Is Lid Present"] && !pmSource.data["PowerDevil"]["Triggers Lid Action"] ? true : false
profiles: pmSource.data["Power Profiles"] ? (pmSource.data["Power Profiles"]["Profiles"] || []) : []
inhibitionReason: pmSource.data["Power Profiles"] ? (pmSource.data["Power Profiles"]["Performance Inhibited Reason"] || "") : ""
degradationReason: pmSource.data["Power Profiles"] ? (pmSource.data["Power Profiles"]["Performance Degraded Reason"] || "") : ""
profileHolds: pmSource.data["Power Profiles"] ? (pmSource.data["Power Profiles"]["Profile Holds"] || []) : []
property int cookie1: -1
property int cookie2: -1
onPowerManagementChanged: disabled => {
const service = pmSource.serviceForSource("PowerDevil");
if (disabled) {
const reason = i18n("The battery applet has enabled system-wide inhibition");
const op1 = service.operationDescription("beginSuppressingSleep");
op1.reason = reason;
const op2 = service.operationDescription("beginSuppressingScreenPowerManagement");
op2.reason = reason;
const job1 = service.startOperationCall(op1);
job1.finished.connect(job => {
cookie1 = job.result;
});
const job2 = service.startOperationCall(op2);
job2.finished.connect(job => {
cookie2 = job.result;
});
} else {
const op1 = service.operationDescription("stopSuppressingSleep");
op1.cookie = cookie1;
const op2 = service.operationDescription("stopSuppressingScreenPowerManagement");
op2.cookie = cookie2;
const job1 = service.startOperationCall(op1);
job1.finished.connect(job => {
cookie1 = -1;
});
const job2 = service.startOperationCall(op2);
job2.finished.connect(job => {
cookie2 = -1;
});
}
batterymonitor.powermanagementDisabled = disabled
}
PlasmaCore.DataSource {
id: notificationSource
engine: "notifications"
}
onActivateProfileRequested: {
dialogItem.activeProfile = profile;
const service = pmSource.serviceForSource("PowerDevil");
const op = service.operationDescription("setPowerProfile");
op.profile = profile;
const job = service.startOperationCall(op);
job.finished.connect(job => {
dialogItem.activeProfile = Qt.binding(() => actuallyActiveProfile);
if (!job.result) {
const notifications = notificationSource.serviceForSource("notification")
const operation = notifications.operationDescription("createNotification");
operation.appName = i18n("Battery and Brightness");
operation.appIcon = "dialog-error";
operation.icon = "dialog-error";
operation.body = i18n("Failed to activate %1 mode", profile);
notifications.startOperationCall(operation);
}
});
}
}
Component.onCompleted: {
Logic.updateBrightness(batterymonitor, pmSource);
Logic.updateInhibitions(batterymonitor, pmSource)
if (batterymonitor.kcmEnergyInformationAuthorized) {
plasmoid.setAction("energyinformationkcm", i18n("&Show Energy Information…"), "documentinfo");
}
plasmoid.setAction("showPercentage", i18n("Show Battery Percentage on Icon"), "format-number-percent");
plasmoid.action("showPercentage").checkable = true;
plasmoid.action("showPercentage").checked = Qt.binding(() =>
plasmoid !== null && plasmoid.configuration.showPercentage);
if (batterymonitor.kcmAuthorized) {
plasmoid.removeAction("configure");
plasmoid.setAction("configure", i18n("&Configure Energy Saving…"), "configure", "alt+d, s");
}
}
}

View File

@ -0,0 +1,202 @@
{
"KPlugin": {
"Authors": [
{
"Email": "sebas@kde.org, kde@privat.broulik.de",
"Name": "Sebastian Kügler, Kai Uwe Broulik",
"Name[ar]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[az]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[ca]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[cs]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[de]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[en_GB]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[es]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[eu]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[fi]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[fr]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[hu]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[ia]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[it]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[ko]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[lt]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[nl]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[nn]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[pl]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[pt_BR]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[ro]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[ru]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[sk]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[sl]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[sv]": "Sebastian Kügler",
"Name[ta]": "ஸெபாஸ்டியன் கூக்லர், காய் ஊவே புரோலிக்",
"Name[tr]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[uk]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[vi]": "Sebastian Kügler, Kai Uwe Broulik",
"Name[x-test]": "xxSebastian Kügler, Kai Uwe Broulikxx",
"Name[zh_CN]": "Sebastian Kügler, Kai Uwe Broulik"
}
],
"Category": "System Information",
"Description": "See the power status of your battery",
"Description[ar]": "طالع حالة طاقة البطارية",
"Description[az]": "Batareyanızın enerji səviyyəsinə baxın",
"Description[ca]": "Vegeu l'estat d'energia de la bateria",
"Description[cs]": "Zobrazí stav nabití vaší baterie",
"Description[de]": "Den Ladestatus des Akkus anzeigen",
"Description[en_GB]": "See the power status of your battery",
"Description[es]": "Ver el estado de energía de su batería",
"Description[eu]": "Ikusi zure bateriaren energia-egoera",
"Description[fi]": "Näyttää akun virtatilanteen",
"Description[fr]": "Consulter le niveau d'énergie de votre batterie",
"Description[hu]": "Az akkumulátorok állapotának megjelenítése",
"Description[ia]": "Vide le stato de energia de tu batteria",
"Description[it]": "Indica lo stato di carica della batteria",
"Description[ko]": "배터리 상태를 표시합니다",
"Description[lt]": "Rodyti akumuliatoriaus įkrovą",
"Description[nl]": "Zie de capaciteitsstatus van uw accu",
"Description[nn]": "Sjå straum­nivået på batteriet",
"Description[pa]": "ਆਪਣੀ ਬੈਟਰੀ ਦੀ ਊਰਜਾ ਹਾਲਤ ਵੇਖੋ",
"Description[pl]": "Monitoruje stan naładowania baterii",
"Description[pt_BR]": "Mostra o estado da carga da sua bateria",
"Description[ro]": "Vedeți starea acumulatorului dumneavoastră",
"Description[ru]": "Просмотр уровня заряда батареи",
"Description[sk]": "Zobrazenie stavu nabitia vašej batérie",
"Description[sl]": "Oglejte si stanje napolnjenosti baterije",
"Description[sv]": "Se batteriets laddningsstatus",
"Description[ta]": "உங்கள் மின்கலத்தின் ஆற்றல் நிலையைப் பாருங்கள்",
"Description[tr]": "Pilinizin güç durumunu görün",
"Description[uk]": "Перегляньте стан заряду акумулятора",
"Description[vi]": "Xem tình trạng nguồn điện của pin",
"Description[x-test]": "xxSee the power status of your batteryxx",
"Description[zh_CN]": "查看电池的电量状态",
"EnabledByDefault": true,
"FormFactors": [
"desktop"
],
"Icon": "battery-full",
"Id": "org.kde.plasma.battery",
"License": "GPL-2.0+",
"Name": "Battery and Brightness",
"Name[ar]": "البطّاريّة والسّطوع",
"Name[ast]": "Batería y brillu",
"Name[az]": "Batareya və Parlaqlıq",
"Name[ca@valencia]": "Bateria i brillantor",
"Name[ca]": "Bateria i lluminositat",
"Name[cs]": "Baterie a Jas",
"Name[da]": "Batteri og lysstyrke",
"Name[de]": "Akku und Bildschirmhelligkeit",
"Name[el]": "Μπαταρία και λαμπρότητα",
"Name[en_GB]": "Battery and Brightness",
"Name[es]": "Batería y brillo",
"Name[et]": "Aku ja heledus",
"Name[eu]": "Bateria eta distira",
"Name[fi]": "Akku ja kirkkaus",
"Name[fr]": "Batterie et luminosité",
"Name[gl]": "Batería e brillo",
"Name[he]": "סוללה ובהירות",
"Name[hi]": "बैटरी और चमक ",
"Name[hsb]": "Akuw a swětłosć",
"Name[hu]": "Akkumulátor és fényerő",
"Name[ia]": "Intensitate de illumination e batteria",
"Name[id]": "Baterai dan Kecerahan",
"Name[is]": "Rafhlaða og skjábirta",
"Name[it]": "Batteria e luminosità",
"Name[ja]": "バッテリーと明るさ",
"Name[ko]": "배터리와 밝기",
"Name[lt]": "Akumuliatorius ir ryškumas",
"Name[lv]": "Baterija un gaišums",
"Name[ml]": "ബാറ്ററിയും തെളിച്ചവും",
"Name[nl]": "Batterij en helderheid",
"Name[nn]": "Batteri og lysstyrke",
"Name[pa]": "ਬੈਟਰੀ ਤੇ ਚਮਕ",
"Name[pl]": "Bateria i jasność",
"Name[pt]": "Bateria e Brilho",
"Name[pt_BR]": "Bateria e brilho da tela",
"Name[ro]": "Acumulator și luminozitate",
"Name[ru]": "Батарея и яркость",
"Name[sk]": "Batéria a jas",
"Name[sl]": "Baterija in svetlost",
"Name[sr@ijekavian]": "Батерија и освјетљај",
"Name[sr@ijekavianlatin]": "Baterija i osvjetljaj",
"Name[sr@latin]": "Baterija i osvetljaj",
"Name[sr]": "Батерија и осветљај",
"Name[sv]": "Batteri och ljusstyrka",
"Name[ta]": "மின்கலமும் பிரகாசமும்",
"Name[tg]": "Батарея ва дурахшонӣ",
"Name[tr]": "Pil ve Ekran Parlaklığı",
"Name[uk]": "Акумулятор і яскравість дисплея",
"Name[vi]": "Pin và độ sáng",
"Name[x-test]": "xxBattery and Brightnessxx",
"Name[zh_CN]": "电池和亮度",
"Name[zh_TW]": "電池與亮度",
"ServiceTypes": [
"Plasma/Applet"
],
"Version": "3.0",
"Website": "https://vizzzion.org"
},
"Keywords": "Power Management;Battery;System;Energy;",
"Keywords[ar]": "إدارة الطاقة;بطارية;نظام;طاقة;",
"Keywords[ast]": "Xestión enerxética;Xestión d'enerxía;Batería;Sistema;Enerxía;",
"Keywords[az]": "El. Enerjisi İdarəsi;Batareya;Enerji",
"Keywords[bs]": "Upravljanje napajenjem;Baterija;Sistem;Energija;",
"Keywords[ca@valencia]": "Sistema de gestió d'energia;Bateria;Sistema;Energia;",
"Keywords[ca]": "Sistema de gestió d'energia;Bateria;Sistema;Energia;",
"Keywords[cs]": "Správa napájení;Baterie;Systém;Energie;",
"Keywords[da]": "Strømstyring;battery;system;energi;",
"Keywords[de]": "Energieverwaltungssystem;Akku;System;Energie;",
"Keywords[el]": "Διαχείριση ισχύος;Μπαταρία;Σύστημα;Ενέργεια;",
"Keywords[en_GB]": "Power Management;Battery;System;Energy;",
"Keywords[es]": "Gestión de energía;Batería;Sistema;Energía;",
"Keywords[et]": "Toitehaldus;aku;süsteem;energia;",
"Keywords[eu]": "energia kudeaketa;bateria;sistema;energia;",
"Keywords[fi]": "Virranhallinta;Akku;Järjestelmä;Virransäästö;",
"Keywords[fr]": "Gestion de l'énergie;Batterie;Système;Énergie;",
"Keywords[gl]": "Xestión da enerxía;batería;sistema;enerxía;",
"Keywords[he]": "Power Management; Battery; System; Energy;ניהול חשמל;חשמל; סוללה; מערכת;אנרגיה; בטריה;",
"Keywords[hi]": "विद्युत प्रबंधन;बैटरी;तंत्र;ऊर्जा;",
"Keywords[hsb]": "Power Management;Battery;System;Energy;akuw;energija;milina;",
"Keywords[hu]": "Energiakezelés;Akkumulátor;Rendszer;Energia;",
"Keywords[ia]": "Gestion de energia;Batteria;Systema; Energia;",
"Keywords[id]": "Pengelolaan Daya;Baterai;Sistem;Energi;",
"Keywords[is]": "Orkustjórnun;Rafhlaða;Kerfi;Afl;",
"Keywords[it]": "Gestione energetica;Batteria;Sistema;Energia;",
"Keywords[ja]": "電源管理;バッテリー;システム;エネルギー;",
"Keywords[kk]": "Power Management;Battery;System;Energy;",
"Keywords[ko]": "Power Management;Battery;System;Energy;전원 관리;전력 관리;배터리;시스템;에너지;",
"Keywords[lt]": "Energijos valdymas;Baterija;Sistema;Energija;Akumuliatorius;Maitinimo valdymas;",
"Keywords[ml]": "ഊർജ്ജനിയന്ത്രണം;ബാറ്ററി;സിസ്റ്റം;ഊ‍ർജ്ജം",
"Keywords[mr]": "वीज व्यवस्थापन; बॅटरी; प्रणाली; ऊर्जा;",
"Keywords[nb]": "Strømstyring; Batteri; System; Energi;",
"Keywords[nds]": "Stroompleeg,Batterie,Systeem,Energie",
"Keywords[nl]": "Energiebeheer;Batterij;Accu;Systeem;Energie;",
"Keywords[nn]": "straumstyring;batteri;system;energi;",
"Keywords[pa]": "ਪਾਵਰ ਪਰਬੰਧ;ਬੈਟਰੀ;ਸਿਸਟਮ;ਊਰਜਾ;",
"Keywords[pl]": "Zarządzanie Energią;Bateria;System;Energia;",
"Keywords[pt]": "Gestão de Energia;Bateria;Sistema;Energia;",
"Keywords[pt_BR]": "Gerenciamento de energia;Bateria;Sistema;Energia;",
"Keywords[ro]": "gestiunea alimentării;acumulator;sistem;energie;",
"Keywords[ru]": "Power Management;Battery;System;Energy;управление питанием;батарея;система;энергия;энергопотребление;",
"Keywords[sk]": "Správa napájania;Batéria;Systém;Energia;",
"Keywords[sl]": "Upravljanje z energijo;Baterija;Sistem;Energija;",
"Keywords[sr@ijekavian]": "Power Management;Battery;System;Energy;управљање напајањем;батерија; систем;енергија;",
"Keywords[sr@ijekavianlatin]": "Power Management;Battery;System;Energy;upravljanje napajanjem;baterija; sistem;energija;",
"Keywords[sr@latin]": "Power Management;Battery;System;Energy;upravljanje napajanjem;baterija; sistem;energija;",
"Keywords[sr]": "Power Management;Battery;System;Energy;управљање напајањем;батерија; систем;енергија;",
"Keywords[sv]": "Strömhantering;Batteri;System;Energi;",
"Keywords[ta]": "Power Management;Battery;System;Energy;ஆற்றல்;மின்கலம்;கணினி;ஆற்றல் மேலாண்மை;",
"Keywords[tr]": "Güç Yönetimi;Pil;Sistem;Enerji;",
"Keywords[uk]": "Power Management;Battery;System;Energy;керування живленням;акумулятор;система;енергія;батарея;батарейка;живлення;",
"Keywords[vi]": "Power Management;Battery;System;Energy;Quản lí nguồn điện;Pin;Hệ thống;Năng lượng;",
"Keywords[x-test]": "xxPower Managementxx;xxBatteryxx;xxSystemxx;xxEnergyxx;",
"Keywords[zh_CN]": "电源管理;电池;系统;能源;",
"Keywords[zh_TW]": "Power Management;Battery;System;Energy;",
"X-Plasma-API": "declarativeappletscript",
"X-Plasma-DBusActivationService": "org.kde.Solid.PowerManagement",
"X-Plasma-MainScript": "ui/main.qml",
"X-Plasma-NotificationArea": "true",
"X-Plasma-NotificationAreaCategory": "Hardware",
"X-Plasma-Provides": [
"org.kde.plasma.powermanagement"
]
}

View File

@ -0,0 +1,6 @@
kcoreaddons_add_plugin(plasma_applet_calendar SOURCES calendarapplet.cpp INSTALL_NAMESPACE "plasma/applets")
target_link_libraries(plasma_applet_calendar
KF5::Plasma)
plasma_install_package(package org.kde.plasma.calendar)

View File

@ -0,0 +1,2 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.calendar.pot

View File

@ -0,0 +1,27 @@
/*
SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "calendarapplet.h"
#include <QDateTime>
CalendarApplet::CalendarApplet(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
: Plasma::Applet(parent, data, args)
{
}
CalendarApplet::~CalendarApplet()
{
}
int CalendarApplet::weekNumber(const QDateTime &dateTime) const
{
return dateTime.date().weekNumber();
}
K_PLUGIN_CLASS_WITH_JSON(CalendarApplet, "package/metadata.json")
#include "calendarapplet.moc"

View File

@ -0,0 +1,22 @@
/*
SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#pragma once
#include <Plasma/Applet>
class QDateTime;
class CalendarApplet : public Plasma::Applet
{
Q_OBJECT
public:
explicit CalendarApplet(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
~CalendarApplet() override;
Q_INVOKABLE int weekNumber(const QDateTime &dateTime) const;
};

View File

@ -0,0 +1,17 @@
/*
SPDX-FileCopyrightText: 2013 Bhushan Shah <bhush94@gmail.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.0
import org.kde.plasma.configuration 2.0
ConfigModel {
ConfigCategory {
name: i18n("General")
icon: "preferences-desktop-plasma"
source: "configGeneral.qml"
}
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="Agenda">
<entry name="startOfWorkingDay" type="int">
<default>9</default>
</entry>
<entry name="endOfWorkingDay" type="int">
<default>17</default>
</entry>
<entry name="showWeekNumbers" type="Bool">
<default>false</default>
</entry>
<entry name="compactDisplay" type="String">
<default>d</default>
</entry>
</group>
</kcfg>

View File

@ -0,0 +1,49 @@
/*
SPDX-FileCopyrightText: 2015 Martin Klapetek <mklapetek@kde.org>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.5
import QtQuick.Controls 2.5 as QtControls
import org.kde.kirigami 2.5 as Kirigami
Kirigami.FormLayout {
id: generalPage
anchors.left: parent.left
anchors.right: parent.right
property alias cfg_showWeekNumbers: showWeekNumbers.checked
property string cfg_compactDisplay
QtControls.CheckBox {
id: showWeekNumbers
Kirigami.FormData.label: i18n("Calendar version:")
text: i18n("Show week numbers")
}
Item {
Kirigami.FormData.isSection: true
}
QtControls.RadioButton {
Kirigami.FormData.label: i18nc("What information is shown in the calendar icon", "Compact version:")
text: i18nc("Show the number of the day (eg. 31) in the icon", "Show day of the month")
checked: cfg_compactDisplay == "d"
onCheckedChanged: if (checked) cfg_compactDisplay = "d"
}
QtControls.RadioButton {
text: i18nc("Show the week number (eg. 50) in the icon", "Show week number")
checked: cfg_compactDisplay == "w"
onCheckedChanged: if (checked) cfg_compactDisplay = "w"
}
}

View File

@ -0,0 +1,119 @@
/*
SPDX-FileCopyrightText: 2013 Heena Mahour <heena393@gmail.com>
SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.12
import QtQuick.Layouts 1.12
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.calendar 2.0
Item {
Plasmoid.switchWidth: PlasmaCore.Units.gridUnit * 12
Plasmoid.switchHeight: PlasmaCore.Units.gridUnit * 12
Plasmoid.toolTipMainText: Qt.formatDate(dataSource.data.Local.DateTime, "dddd")
Plasmoid.toolTipSubText: {
// this logic is taken from digital-clock:
// remove "dddd" from the locale format string
// /all/ locales in LongFormat have "dddd" either
// at the beginning or at the end. so we just
// remove it + the delimiter and space
var format = Qt.locale().dateFormat(Locale.LongFormat);
format = format.replace(/(^dddd.?\s)|(,?\sdddd$)/, "");
return Qt.formatDate(dataSource.data.Local.DateTime, format)
}
Layout.minimumWidth: PlasmaCore.Units.iconSizes.large
Layout.minimumHeight: PlasmaCore.Units.iconSizes.large
PlasmaCore.DataSource {
id: dataSource
engine: "time"
connectedSources: ["Local"]
interval: 60000
intervalAlignment: PlasmaCore.Types.AlignToMinute
}
Plasmoid.compactRepresentation: MouseArea {
onClicked: plasmoid.expanded = !plasmoid.expanded
PlasmaCore.IconItem {
anchors.fill: parent
source: Qt.resolvedUrl("../images/mini-calendar.svgz")
PlasmaComponents3.Label {
id: monthLabel
y: parent.y + parent.height * 0.05;
x: 0
width: parent.width
height: parent.height * 0.2
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom
fontSizeMode: Text.Fit
minimumPointSize: 1
/* color must be black because it's set on top of a white icon */
color: "black"
text: {
var d = new Date(dataSource.data.Local.DateTime);
return Qt.formatDate(d, "MMM");
}
visible: parent.width > PlasmaCore.Units.gridUnit * 3
}
PlasmaComponents3.Label {
anchors.top: monthLabel.bottom
x: 0
width: parent.width
height: parent.height * 0.6
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignTop
minimumPointSize: 1
font.pixelSize: 1000
fontSizeMode: Text.Fit
/* color must be black because it's set on top of a white icon */
color: "black"
text: {
var d = new Date(dataSource.data.Local.DateTime)
var format = plasmoid.configuration.compactDisplay
if (format === "w") {
return plasmoid.nativeInterface.weekNumber(d)
}
return Qt.formatDate(d, format)
}
}
}
}
Plasmoid.fullRepresentation: Item {
// sizing taken from digital clock
readonly property int _minimumWidth: calendar.showWeekNumbers ? Math.round(_minimumHeight * 1.75) : Math.round(_minimumHeight * 1.5)
readonly property int _minimumHeight: PlasmaCore.Units.gridUnit * 14
Layout.preferredWidth: _minimumWidth
Layout.preferredHeight: Math.round(_minimumHeight * 1.5)
MonthView {
id: calendar
today: dataSource.data["Local"]["DateTime"]
showWeekNumbers: plasmoid.configuration.showWeekNumbers
anchors.fill: parent
}
}
}

View File

@ -0,0 +1,171 @@
{
"KPlugin": {
"Authors": [
{
"Email": "sebas@kde.org",
"Name": "Sebastian Kügler",
"Name[ar]": "Sebastian Kügler",
"Name[az]": "Sebastian Kügler",
"Name[ca]": "Sebastian Kügler",
"Name[cs]": "Sebastian Kügler",
"Name[de]": "Sebastian Kügler",
"Name[en_GB]": "Sebastian Kügler",
"Name[es]": "Sebastian Kügler",
"Name[eu]": "Sebastian Kügler",
"Name[fi]": "Sebastian Kügler",
"Name[fr]": "Sebastian Kügler",
"Name[hu]": "Sebastian Kügler",
"Name[ia]": "Sebastian Kügler",
"Name[it]": "Sebastian Kügler",
"Name[ko]": "Sebastian Kügler",
"Name[lt]": "Sebastian Kügler",
"Name[nl]": "Sebastian Kügler",
"Name[nn]": "Sebastian Kügler",
"Name[pa]": "Sebastian Kügler",
"Name[pl]": "Sebastian Kügler",
"Name[pt_BR]": "Sebastian Kügler",
"Name[ro]": "Sebastian Kügler",
"Name[ru]": "Sebastian Kügler",
"Name[sk]": "Sebastian Kügler",
"Name[sl]": "Sebastian Kügler",
"Name[sv]": "Sebastian Kügler",
"Name[ta]": "ஸெபாஸ்டியன் கூக்லர்",
"Name[tr]": "Sebastian Kügler",
"Name[uk]": "Sebastian Kügler",
"Name[vi]": "Sebastian Kügler",
"Name[x-test]": "xxSebastian Küglerxx",
"Name[zh_CN]": "Sebastian Kügler"
}
],
"Category": "Date and Time",
"Description": "Month display with your appointments and events",
"Description[ar]": "عرض للشّهر فيه المواعيد والأحداث",
"Description[az]": "Hər aya planlaşdırılmış işlərin və tədbirlərinizin təqvimi",
"Description[ca]": "Mostra el mes amb les cites i els esdeveniments",
"Description[de]": "Monatsanzeige mit Ihren Verabredungen und Terminen",
"Description[en_GB]": "Month display with your appointments and events",
"Description[es]": "Calendario mensual con sus citas y eventos",
"Description[eu]": "Hileko ikuspegia zure hitzordu eta gertaerekin",
"Description[fi]": "Kalenterimerkintöjen kuukausinäkymä",
"Description[fr]": "Affichage par mois de vos rendez-vous et évènements",
"Description[hu]": "Megjeleníti a hónapban esedékes időpontokat és eseményeket",
"Description[ia]": "Monstrator de mense con tu appunctamentos e eventos",
"Description[it]": "Visualizzazione del mese con i tuoi appuntamenti ed eventi",
"Description[ko]": "내 약속과 이벤트가 있는 달력 표시",
"Description[lt]": "Jūsų užduotys ir įvykiai mėnesiui",
"Description[nl]": "Maandweergave met uw afspraken en gebeurtenissen",
"Description[nn]": "Månadsvising med avtaler og hendingar",
"Description[pa]": "ਤੁਹਾਡੀਆਂ ਮੁਲਾਕਾਤਾਂ ਤੇ ਸਮਾਗਮਾਂ ਨਾਲ ਮਹੀਨਾ ਵੇਖੋ",
"Description[pl]": "Wyświetlanie miesiąca z twoimi spotkaniami i wydarzeniami",
"Description[pt_BR]": "Exibição mensal com seus compromissos e eventos",
"Description[ro]": "Afișarea lunii cu programări și evenimente",
"Description[ru]": "Календарь на месяц с запланированными делами и событиями",
"Description[sk]": "Zobrazenie mesiaca s vašimi schôdzkami a udalosťami",
"Description[sl]": "Mesečni prikaz z vašimi sestanki in dogodki",
"Description[sv]": "Månatlig visning av möten och händelser",
"Description[ta]": "நிகழ்வுகள் மற்றும் சந்திப்புகளைக் காட்டும் மாத நாள்காட்டி",
"Description[tr]": "Randevularınız ve etkinliklerinizle birlikte ay görünümü",
"Description[uk]": "Показ розкладу місяця із вашими записами зустрічей і подій",
"Description[vi]": "Hiển thị tháng với các buổi hẹn và sự kiện của bạn",
"Description[x-test]": "xxMonth display with your appointments and eventsxx",
"Description[zh_CN]": "按月显示您的预约和事件",
"FormFactors": [
"tablet",
"handset",
"desktop"
],
"Icon": "office-calendar",
"Id": "org.kde.plasma.calendar",
"License": "GPL-2.0+",
"Name": "Calendar",
"Name[ar]": "التقويم",
"Name[ast]": "Calendariu",
"Name[az]": "Təqvim",
"Name[be@latin]": "Kalandar",
"Name[bg]": "Календар",
"Name[bn]": "ক্যালেণ্ডার",
"Name[bn_IN]": "বর্ষপঞ্জি",
"Name[bs]": "Kalendar",
"Name[ca@valencia]": "Calendari",
"Name[ca]": "Calendari",
"Name[cs]": "Kalendář",
"Name[csb]": "Kalãdôrz",
"Name[da]": "Kalender",
"Name[de]": "Kalender",
"Name[el]": "Ημερολόγιο",
"Name[en_GB]": "Calendar",
"Name[eo]": "Kalendaro",
"Name[es]": "Calendario",
"Name[et]": "Kalender",
"Name[eu]": "Egutegia",
"Name[fa]": "تقویم",
"Name[fi]": "Kalenteri",
"Name[fr]": "Calendrier",
"Name[fy]": "Aginda",
"Name[ga]": "Féilire",
"Name[gl]": "Calendario",
"Name[gu]": "કેલેન્ડર",
"Name[he]": "לוח שנה",
"Name[hi]": "कैलेन्डर",
"Name[hne]": "कलेन्डर",
"Name[hr]": "Kalendar",
"Name[hsb]": "Protyka",
"Name[hu]": "Naptár",
"Name[ia]": "Calendario",
"Name[id]": "Kalender",
"Name[is]": "Dagatal",
"Name[it]": "Calendario",
"Name[ja]": "カレンダー",
"Name[kk]": "Күнтізбе",
"Name[km]": "ប្រតិទិន",
"Name[kn]": "ದಿನಸೂಚಿ",
"Name[ko]": "달력",
"Name[ku]": "Salname",
"Name[lt]": "Kalendorius",
"Name[lv]": "Kalendārs",
"Name[mai]": "कैलेंडर",
"Name[mk]": "Календар",
"Name[ml]": "കലണ്ടര്‍",
"Name[mr]": "दिनदर्शिका",
"Name[nb]": "Kalender",
"Name[nds]": "Kalenner",
"Name[nl]": "Kalender",
"Name[nn]": "Kalender",
"Name[pa]": "ਕੈਲੰਡਰ",
"Name[pl]": "Kalendarz",
"Name[pt]": "Calendário",
"Name[pt_BR]": "Calendário",
"Name[ro]": "Calendar",
"Name[ru]": "Календарь",
"Name[si]": "දිනදර්ශනය",
"Name[sk]": "Kalendár",
"Name[sl]": "Koledar",
"Name[sr@ijekavian]": "календар",
"Name[sr@ijekavianlatin]": "kalendar",
"Name[sr@latin]": "kalendar",
"Name[sr]": "календар",
"Name[sv]": "Kalender",
"Name[ta]": "நாட்காட்டி",
"Name[tg]": "Тақвим",
"Name[th]": "ปฏิทิน",
"Name[tr]": "Takvim",
"Name[ug]": "يىلنامە",
"Name[uk]": "Календар",
"Name[vi]": "Lịch",
"Name[wa]": "Calindrî",
"Name[x-test]": "xxCalendarxx",
"Name[zh_CN]": "日历",
"Name[zh_TW]": "行事曆",
"ServiceTypes": [
"Plasma/Applet"
],
"Version": "2.0",
"Website": "https://kde.org/plasma-desktop"
},
"X-Plasma-API": "declarativeappletscript",
"X-Plasma-MainScript": "ui/main.qml",
"X-Plasma-Provides": [
"org.kde.plasma.date"
],
"X-Plasma-StandAloneApp": true
}

View File

@ -0,0 +1,2 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.clipboard.pot

View File

@ -0,0 +1,122 @@
/*
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents // For ContextMenu
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.prison 1.0 as Prison
ColumnLayout {
id: barcodeView
property alias text: barcodeItem.content
Keys.onPressed: {
if (event.key == Qt.Key_Escape) {
stack.pop()
event.accepted = true;
}
}
property var header: PlasmaExtras.PlasmoidHeading {
RowLayout {
anchors.fill: parent
PlasmaComponents3.Button {
Layout.fillWidth: true
icon.name: "go-previous-view"
text: i18n("Return to Clipboard")
onClicked: stack.pop()
}
Component {
id: menuItemComponent
PlasmaComponents.MenuItem { }
}
PlasmaComponents.ContextMenu {
id: menu
visualParent: configureButton
placement: PlasmaCore.Types.BottomPosedLeftAlignedPopup
onStatusChanged: {
if (status == PlasmaComponents.DialogStatus.Closed) {
configureButton.checked = false;
}
}
Component.onCompleted: {
[
{text: i18n("QR Code"), type: Prison.Barcode.QRCode},
{text: i18n("Data Matrix"), type: Prison.Barcode.DataMatrix},
{text: i18nc("Aztec barcode", "Aztec"), type: Prison.Barcode.Aztec},
{text: i18n("Code 39"), type: Prison.Barcode.Code39},
{text: i18n("Code 93"), type: Prison.Barcode.Code93},
{text: i18n("Code 128"), type: Prison.Barcode.Code128}
].forEach((item) => {
let menuItem = menuItemComponent.createObject(menu, {
text: item.text,
checkable: true,
checked: Qt.binding(() => {
return barcodeItem.barcodeType === item.type;
})
});
menuItem.clicked.connect(() => {
barcodeItem.barcodeType = item.type;
});
menu.addMenuItem(menuItem);
});
}
}
PlasmaComponents3.ToolButton {
id: configureButton
checkable: true
icon.name: "configure"
onClicked: menu.openRelative()
PlasmaComponents3.ToolTip {
text: i18n("Change the QR code type")
}
}
}
}
Item {
Layout.fillWidth: parent
Layout.fillHeight: parent
Layout.topMargin: PlasmaCore.Units.smallSpacing
Prison.Barcode {
id: barcodeItem
readonly property bool valid: implicitWidth > 0 && implicitHeight > 0 && implicitWidth <= width && implicitHeight <= height
anchors.fill: parent
barcodeType: Prison.Barcode.QRCode
// Cannot set visible to false as we need it to re-render when changing its size
opacity: valid ? 1 : 0
}
PlasmaComponents3.Label {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: i18n("Creating QR code failed")
wrapMode: Text.WordWrap
visible: barcodeItem.implicitWidth === 0 && barcodeItem.implicitHeight === 0
}
PlasmaComponents3.Label {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: i18n("The QR code is too large to be displayed")
wrapMode: Text.WordWrap
visible: barcodeItem.implicitWidth > barcodeItem.width || barcodeItem.implicitHeight > barcodeItem.height
}
}
}

View File

@ -0,0 +1,137 @@
/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2014 Sebastian Kügler <sebas@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents2
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
PlasmaComponents2.ListItem {
id: menuItem
property bool supportsBarcodes
property int maximumNumberOfPreviews: Math.floor(width / (PlasmaCore.Units.gridUnit * 4 + PlasmaCore.Units.smallSpacing))
readonly property real gradientThreshold: (label.width - toolButtonsLoader.width) / label.width
// Consider tall to be > about 1.5x the default height for purposes of top-aligning
// the buttons to preserve Fitts' Law when deleting multiple items in a row,
// or else the top-alignment doesn't look deliberate enough and people will think
// it's a bug
readonly property bool isTall: height > Math.round(PlasmaCore.Units.gridUnit * 2.5)
signal itemSelected(string uuid)
signal remove(string uuid)
signal edit(string uuid)
signal barcode(string text)
signal action(string uuid)
// the 1.6 comes from ToolButton's default height
height: Math.max(label.height, Math.round(PlasmaCore.Units.gridUnit * 1.6)) + 2 * PlasmaCore.Units.smallSpacing
enabled: true
onClicked: {
menuItem.itemSelected(UuidRole);
if (plasmoid.hideOnWindowDeactivate) {
plasmoid.expanded = false;
} else {
forceActiveFocus(); // Or activeFocus will always be false after clicking buttons in the heading
}
}
Keys.onDeletePressed: {
remove(UuidRole);
}
ListView.onIsCurrentItemChanged: {
if (ListView.isCurrentItem) {
labelMask.source = label // calculate on demand
}
}
// this stuff here is used so we can fade out the text behind the tool buttons
Item {
id: labelMaskSource
anchors.fill: label
visible: false
Rectangle {
anchors.centerIn: parent
rotation: LayoutMirroring.enabled ? 90 : -90 // you cannot even rotate gradients without QtGraphicalEffects
width: parent.height
height: parent.width
gradient: Gradient {
GradientStop { position: 0.0; color: "white" }
GradientStop { position: gradientThreshold - 0.25; color: "white"}
GradientStop { position: gradientThreshold; color: "transparent"}
GradientStop { position: 1; color: "transparent"}
}
}
}
OpacityMask {
id: labelMask
anchors.fill: label
cached: true
maskSource: labelMaskSource
visible: !!source && menuItem.ListView.isCurrentItem
}
Item {
id: label
height: childrenRect.height
visible: !menuItem.ListView.isCurrentItem
anchors {
left: parent.left
leftMargin: PlasmaCore.Units.gridUnit / 2 - listMargins.left
right: parent.right
verticalCenter: parent.verticalCenter
}
Loader {
width: parent.width
source: ["Text", "Image", "Url"][TypeRole] + "ItemDelegate.qml"
}
}
Loader {
id: toolButtonsLoader
anchors {
right: label.right
verticalCenter: parent.verticalCenter
}
source: "DelegateToolButtons.qml"
active: menuItem.ListView.isCurrentItem
// It's not recommended to change anchors via conditional bindings, use AnchorChanges instead.
// See https://doc.qt.io/qt-5/qtquick-positioning-anchors.html#changing-anchors
states: [
State {
when: menuItem.isTall
AnchorChanges {
target: toolButtonsLoader
anchors.top: parent.top
anchors.verticalCenter: undefined
}
}
]
onActiveChanged: {
if (active) {
menuItem.KeyNavigation.tab = toolButtonsLoader.item.children[0]
menuItem.KeyNavigation.right = toolButtonsLoader.item.children[0]
// break binding, once it was loaded, never unload
active = true;
}
}
}
}

View File

@ -0,0 +1,202 @@
/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2014 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.4
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kirigami 2.19 as Kirigami // for InputMethod.willShowOnActive
Menu {
id: clipboardMenu
Keys.onPressed: {
function forwardToFilter() {
if (event.text !== "" && !filter.activeFocus) {
clipboardMenu.view.currentIndex = -1
if (event.matches(StandardKey.Paste)) {
filter.paste();
} else {
filter.text = "";
filter.text += event.text;
}
filter.forceActiveFocus();
event.accepted = true;
}
}
if (stack.currentItem !== clipboardMenu) {
event.accepted = false;
return;
}
switch(event.key) {
case Qt.Key_Enter:
case Qt.Key_Return: {
if (clipboardMenu.view.currentIndex >= 0) {
var uuid = clipboardMenu.model.get(clipboardMenu.view.currentIndex).UuidRole
if (uuid) {
clipboardSource.service(uuid, "select")
if (plasmoid.hideOnWindowDeactivate) {
plasmoid.expanded = false;
}
}
}
break;
}
case Qt.Key_Escape: {
if (filter.text != "") {
filter.text = "";
event.accepted = true;
}
break;
}
case Qt.Key_F: {
if (event.modifiers & Qt.ControlModifier) {
filter.forceActiveFocus();
filter.selectAll();
event.accepted = true;
} else {
forwardToFilter();
}
break;
}
case Qt.Key_Tab:
case Qt.Key_Backtab: {
// prevent search filter from getting Tab key events
break;
}
case Qt.Key_Backspace: {
// filter.text += event.text wil break if the key is backspace
filter.forceActiveFocus();
filter.text = filter.text.slice(0, -1);
event.accepted = true;
break;
}
default: {
forwardToFilter();
}
}
}
Keys.forwardTo: [stack.currentItem]
property var header: PlasmaExtras.PlasmoidHeading {
RowLayout {
anchors.fill: parent
enabled: clipboardMenu.model.count > 0 || filter.text.length > 0
PlasmaComponents3.TextField {
id: filter
placeholderText: i18n("Search…")
clearButtonShown: true
Layout.fillWidth: true
inputMethodHints: Qt.ImhNoPredictiveText
Keys.onUpPressed: clipboardMenu.arrowKeyPressed(event)
Keys.onDownPressed: clipboardMenu.arrowKeyPressed(event)
Connections {
target: main
function onClearSearchField() {
filter.clear()
}
}
}
PlasmaComponents3.ToolButton {
visible: !(plasmoid.containmentDisplayHints & PlasmaCore.Types.ContainmentDrawsPlasmoidHeading) && plasmoid.action("clearHistory").visible
icon.name: "edit-clear-history"
onClicked: {
clipboardSource.service("", "clearHistory")
filter.clear()
}
PlasmaComponents3.ToolTip {
text: i18n("Clear history")
}
}
}
}
model: PlasmaCore.SortFilterModel {
sourceModel: clipboardSource.models.clipboard
filterRole: "DisplayRole"
filterRegExp: filter.text
}
supportsBarcodes: {
try {
let prisonTest = Qt.createQmlObject("import QtQml 2.0; import org.kde.prison 1.0; QtObject {}", this);
prisonTest.destroy();
} catch (e) {
console.log("Barcodes not supported:", e);
return false;
}
return true;
}
onItemSelected: clipboardSource.service(uuid, "select")
onRemove: clipboardSource.service(uuid, "remove")
onEdit: {
stack.push(Qt.resolvedUrl("EditPage.qml"), {
text: clipboardMenu.model.get(clipboardMenu.view.currentIndex).DisplayRole,
uuid: uuid
});
}
onBarcode: {
stack.push(Qt.resolvedUrl("BarcodePage.qml"), {
text: text
});
}
onAction: clipboardSource.service(uuid, "action")
Component.onCompleted: {
// Intercept up/down key to prevent ListView from accepting the key event.
clipboardMenu.view.Keys.upPressed.connect(clipboardMenu.arrowKeyPressed);
clipboardMenu.view.Keys.downPressed.connect(clipboardMenu.arrowKeyPressed);
// Focus on the search field when the applet is opened for the first time
// but only when doing so wouldn't make the virtual keyboar appear, since
// that's annoying!
if (!Kirigami.InputMethod.willShowOnActive) {
filter.forceActiveFocus();
}
}
function goToCurrent() {
clipboardMenu.view.positionViewAtIndex(clipboardMenu.view.currentIndex, ListView.Contain);
if (clipboardMenu.view.currentIndex !== -1) {
clipboardMenu.view.currentItem.forceActiveFocus();
}
}
function arrowKeyPressed(event) {
switch (event.key) {
case Qt.Key_Up: {
if (clipboardMenu.view.currentIndex === 0) {
clipboardMenu.view.currentIndex = -1;
filter.forceActiveFocus();
filter.selectAll();
} else {
clipboardMenu.view.decrementCurrentIndex();
goToCurrent();
}
event.accepted = true;
break;
}
case Qt.Key_Down: {
clipboardMenu.view.incrementCurrentIndex();
goToCurrent();
event.accepted = true;
break;
}
default:
break;
}
}
}

View File

@ -0,0 +1,60 @@
/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2014 Sebastian Kügler <sebas@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.components 3.0 as PlasmaComponents3
RowLayout {
id: toolButtonsLayout
visible: menuItem.ListView.isCurrentItem
PlasmaComponents3.ToolButton {
id: actionToolButton
// TODO: only show for items supporting actions?
icon.name: "system-run"
onClicked: menuItem.action(UuidRole)
PlasmaComponents3.ToolTip {
text: i18n("Invoke action")
}
KeyNavigation.right: barcodeToolButton
}
PlasmaComponents3.ToolButton {
id: barcodeToolButton
icon.name: "view-barcode-qr"
visible: supportsBarcodes
onClicked: menuItem.barcode(DisplayRole)
PlasmaComponents3.ToolTip {
text: i18n("Show QR code")
}
KeyNavigation.right: editToolButton
}
PlasmaComponents3.ToolButton {
id: editToolButton
icon.name: "document-edit"
enabled: !clipboardSource.editing
visible: TypeRole === 0
onClicked: menuItem.edit(UuidRole)
PlasmaComponents3.ToolTip {
text: i18n("Edit contents")
}
KeyNavigation.right: deleteToolButton
}
PlasmaComponents3.ToolButton {
id: deleteToolButton
icon.name: "edit-delete"
onClicked: menuItem.remove(UuidRole)
PlasmaComponents3.ToolTip {
text: i18n("Remove from history")
}
}
}

View File

@ -0,0 +1,87 @@
/*
SPDX-FileCopyrightText: 2021 Bharadwaj Raju <bharadwaj.raju777@protonmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import QtQuick.Controls 2.15 as QQC2 // For StackView
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.extras 2.0 as PlasmaExtras
ColumnLayout {
spacing: 0
property alias text: textArea.text
property string uuid
property var header: Item {}
Keys.onPressed: {
if (event.key === Qt.Key_Escape) {
stack.pop()
event.accepted = true;
}
}
function saveAndExit() {
clipboardSource.edit(uuid, text);
stack.pop();
done();
}
function done() {
// The modified item will be pushed to the top, and we would like to highlight the real first item
Qt.callLater(() => {stack.initialItem.view.currentIndex = 0;});
}
QQC2.StackView.onStatusChanged: {
if (QQC2.StackView.status === QQC2.StackView.Active) {
textArea.forceActiveFocus();
textArea.cursorPosition = textArea.text.length;
}
}
PlasmaComponents3.ScrollView {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2
Layout.rightMargin: PlasmaComponents3.ScrollBar.vertical.visible ? 0 : PlasmaCore.Units.smallSpacing * 2
Layout.topMargin: PlasmaCore.Units.smallSpacing * 2
// HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890
PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff
PlasmaComponents3.TextArea {
id: textArea
wrapMode: Text.Wrap
textFormat: TextEdit.PlainText
Keys.onPressed: {
if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && !(event.modifiers & Qt.ShiftModifier)) {
saveAndExit();
event.accepted = true;
} else {
event.accepted = false;
}
}
}
}
RowLayout {
Layout.alignment: Qt.AlignRight
Layout.margins: PlasmaCore.Units.smallSpacing * 2
PlasmaComponents3.Button {
text: i18nc("@action:button", "Save")
icon.name: "document-save"
onClicked: saveAndExit()
}
PlasmaComponents3.Button {
text: i18nc("@action:button", "Cancel")
icon.name: "dialog-cancel"
onClicked: stack.pop()
}
}
}

View File

@ -0,0 +1,30 @@
/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2014 Sebastian Kügler <sebas@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
import org.kde.plasma.core 2.0 as PlasmaCore
Item {
height: childrenRect.height
KQuickControlsAddons.QPixmapItem {
id: previewPixmap
width: Math.min(Math.round(height * nativeWidth/nativeHeight), parent.width)
height: Math.min(nativeHeight, PlasmaCore.Units.gridUnit * 4 + PlasmaCore.Units.smallSpacing * 2)
// align left
// right in RTL
anchors.left: parent.left
pixmap: DecorationRole
smooth: true
fillMode: KQuickControlsAddons.QPixmapItem.PreserveAspectFit
}
}

View File

@ -0,0 +1,82 @@
/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.15
import QtQml 2.15
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents // For Highlight
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.kirigami 2.12 as Kirigami
PlasmaComponents3.ScrollView {
id: menu
property alias view: menuListView
property alias model: menuListView.model
property bool supportsBarcodes
background: null
signal itemSelected(string uuid)
signal remove(string uuid)
signal edit(string uuid)
signal barcode(string text)
signal action(string uuid)
// HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890
PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff
contentWidth: availableWidth - contentItem.leftMargin - contentItem.rightMargin
contentItem: ListView {
id: menuListView
focus: true
highlight: PlasmaComponents.Highlight { }
highlightMoveDuration: 0
highlightResizeDuration: 0
currentIndex: -1
topMargin: PlasmaCore.Units.smallSpacing * 2
bottomMargin: PlasmaCore.Units.smallSpacing * 2
leftMargin: PlasmaCore.Units.smallSpacing * 2
rightMargin: PlasmaCore.Units.smallSpacing * 2
spacing: PlasmaCore.Units.smallSpacing
reuseItems: true
delegate: ClipboardItemDelegate {
// FIXME: removing this causes a binding loop
width: menuListView.width - menuListView.leftMargin - menuListView.rightMargin
supportsBarcodes: menu.supportsBarcodes
onItemSelected: menu.itemSelected(uuid)
onRemove: menu.remove(uuid)
onEdit: menu.edit(uuid)
onBarcode: menu.barcode(text)
onAction: menu.action(uuid)
Binding {
target: menuListView; when: containsMouse
property: "currentIndex"; value: index
restoreMode: Binding.RestoreBinding
}
}
PlasmaExtras.PlaceholderMessage {
id: emptyHint
anchors.centerIn: parent
width: parent.width - (PlasmaCore.Units.largeSpacing * 4)
visible: menuListView.count === 0
text: model.filterRegExp.length > 0 ? i18n("No matches") : i18n("Clipboard is empty")
}
}
}

View File

@ -0,0 +1,43 @@
/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2014 Sebastian Kügler <sebas@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
PlasmaComponents3.Label {
maximumLineCount: 3
verticalAlignment: Text.AlignVCenter
text: {
var highlightFontTag = "<font color='" + PlasmaCore.Theme.highlightColor + "'>%1</font>"
var text = DisplayRole.slice(0, 100)
// first escape any HTML characters to prevent privacy issues
text = text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")
// color code leading or trailing whitespace
// the first regex is basically "trim"
text = text.replace(/^\s+|\s+$/gm, function(match) {
// then inside the trimmed characters ("match") we replace each one individually
match = match.replace(/ /g, "␣") // space
.replace(/\t/g, "↹") // tab
.replace(/\n/g, "↵") // return
return highlightFontTag.arg(match)
})
// finally turn line breaks into HTML br tags
text = text.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, "<br>")
return text
}
elide: Text.ElideRight
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
textFormat: Text.StyledText
}

View File

@ -0,0 +1,111 @@
/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2014 Sebastian Kügler <sebas@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
Item {
id: previewItem
height: PlasmaCore.Units.gridUnit * 4 + PlasmaCore.Units.smallSpacing * 2
ListView {
id: previewList
model: DisplayRole.split(" ", maximumNumberOfPreviews)
property int itemWidth: PlasmaCore.Units.gridUnit * 4
property int itemHeight: PlasmaCore.Units.gridUnit * 4
interactive: false
spacing: PlasmaCore.Units.smallSpacing
orientation: Qt.Horizontal
width: (itemWidth + spacing) * model.length
anchors {
top: parent.top
left: parent.left
bottom: parent.bottom
}
delegate: Item {
width: previewList.itemWidth
height: previewList.itemHeight
y: Math.round((parent.height - previewList.itemHeight) / 2)
clip: true
KQuickControlsAddons.QPixmapItem {
id: previewPixmap
anchors.centerIn: parent
Component.onCompleted: {
function result(job) {
if (!job.error) {
pixmap = job.result.preview;
previewPixmap.width = job.result.previewWidth
previewPixmap.height = job.result.previewHeight
}
}
var service = clipboardSource.serviceForSource(UuidRole)
var operation = service.operationDescription("preview");
operation.url = modelData;
// We request a bigger size and then clip out a square in the middle
// so we get uniform delegate sizes without distortion
operation.previewWidth = previewList.itemWidth * 2;
operation.previewHeight = previewList.itemHeight * 2;
var serviceJob = service.startOperationCall(operation);
serviceJob.finished.connect(result);
}
}
Rectangle {
id: overlay
color: PlasmaCore.Theme.textColor
opacity: 0.6
height: PlasmaCore.Units.gridUnit
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
}
PlasmaComponents3.Label {
font: PlasmaCore.Theme.smallestFont
color: PlasmaCore.Theme.backgroundColor
maximumLineCount: 1
anchors {
verticalCenter: overlay.verticalCenter
left: overlay.left
right: overlay.right
leftMargin: PlasmaCore.Units.smallSpacing
rightMargin: PlasmaCore.Units.smallSpacing
}
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
text: {
var u = modelData.split("/");
return decodeURIComponent(u[u.length - 1]);
}
}
}
}
PlasmaComponents3.Label {
property int additionalItems: DisplayRole.split(" ").length - maximumNumberOfPreviews
visible: additionalItems > 0
opacity: 0.6
text: i18nc("Indicator that there are more urls in the clipboard than previews shown", "+%1", additionalItems)
anchors {
left: previewList.right
right: parent.right
bottom: parent.bottom
margins: PlasmaCore.Units.smallSpacing
}
verticalAlignment: Text.AlignBottom
horizontalAlignment: Text.AlignCenter
font: PlasmaCore.Theme.smallestFont
}
}

View File

@ -0,0 +1,112 @@
/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2014 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.15 as QQC2 // For StackView
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
id: main
property bool isClipboardEmpty: clipboardSource.data["clipboard"]["empty"]
signal clearSearchField
Plasmoid.switchWidth: PlasmaCore.Units.gridUnit * 5
Plasmoid.switchHeight: PlasmaCore.Units.gridUnit * 5
Plasmoid.status: isClipboardEmpty ? PlasmaCore.Types.PassiveStatus : PlasmaCore.Types.ActiveStatus
Plasmoid.toolTipMainText: i18n("Clipboard Contents")
Plasmoid.toolTipSubText: isClipboardEmpty ? i18n("Clipboard is empty") : clipboardSource.data["clipboard"]["current"]
Plasmoid.toolTipTextFormat: Text.PlainText
Plasmoid.icon: "klipper"
function action_configure() {
clipboardSource.service("", "configureKlipper");
}
function action_clearHistory() {
clipboardSource.service("", "clearHistory")
clearSearchField()
}
onIsClipboardEmptyChanged: {
if (isClipboardEmpty) {
// We need to hide the applet before changing its status to passive
// because only the active applet can hide itself
if (plasmoid.hideOnWindowDeactivate)
plasmoid.expanded = false;
Plasmoid.status = PlasmaCore.Types.PassiveStatus;
} else {
Plasmoid.status = PlasmaCore.Types.ActiveStatus
}
}
Component.onCompleted: {
plasmoid.removeAction("configure");
plasmoid.setAction("configure", i18n("Configure Clipboard…"), "configure", "alt+d, s");
plasmoid.setAction("clearHistory", i18n("Clear History"), "edit-clear-history");
plasmoid.action("clearHistory").visible = Qt.binding(() => {
return !main.isClipboardEmpty;
});
}
PlasmaCore.DataSource {
id: clipboardSource
property bool editing: false;
engine: "org.kde.plasma.clipboard"
connectedSources: "clipboard"
function service(uuid, op) {
var service = clipboardSource.serviceForSource(uuid);
var operation = service.operationDescription(op);
return service.startOperationCall(operation);
}
function edit(uuid, text) {
clipboardSource.editing = true;
const service = clipboardSource.serviceForSource(uuid);
const operation = service.operationDescription("edit");
operation.text = text;
const job = service.startOperationCall(operation);
job.finished.connect(function() {
clipboardSource.editing = false;
});
}
}
Plasmoid.fullRepresentation: PlasmaExtras.Representation {
id: dialogItem
Layout.minimumWidth: PlasmaCore.Units.gridUnit * 5
Layout.minimumHeight: PlasmaCore.Units.gridUnit * 5
collapseMarginsHint: true
focus: true
header: stack.currentItem.header
property alias listMargins: listItemSvg.margins
PlasmaCore.FrameSvgItem {
id : listItemSvg
imagePath: "widgets/listitem"
prefix: "normal"
visible: false
}
Keys.forwardTo: [stack.currentItem]
QQC2.StackView {
id: stack
anchors.fill: parent
initialItem: ClipboardPage {}
}
}
}

View File

@ -0,0 +1,144 @@
{
"KPlugin": {
"Authors": [
{
"Email": "mgraesslin@kde.org",
"Name": "Martin Gräßlin",
"Name[ar]": "Martin Gräßlin",
"Name[az]": "Martin Gräßlin",
"Name[ca]": "Martin Gräßlin",
"Name[cs]": "Martin Gräßlin",
"Name[de]": "Martin Gräßlin",
"Name[en_GB]": "Martin Gräßlin",
"Name[es]": "Martin Gräßlin",
"Name[eu]": "Martin Gräßlin",
"Name[fi]": "Martin Gräßlin",
"Name[fr]": "Martin Gräßlin",
"Name[hu]": "Martin Gräßlin",
"Name[ia]": "Martin Gräßlin",
"Name[it]": "Martin Gräßlin",
"Name[ko]": "Martin Gräßlin",
"Name[lt]": "Martin Gräßlin",
"Name[nl]": "Martin Gräßlin",
"Name[nn]": "Martin Gräßlin",
"Name[pl]": "Martin Gräßlin",
"Name[pt_BR]": "Martin Gräßlin",
"Name[ro]": "Martin Gräßlin",
"Name[ru]": "Martin Gräßlin",
"Name[sk]": "Martin Gräßlin",
"Name[sl]": "Martin Gräßlin",
"Name[sv]": "Martin Gräßlin",
"Name[ta]": "மார்ட்டின் கிராஸ்லின்",
"Name[tr]": "Martin Gräßlin",
"Name[uk]": "Martin Gräßlin",
"Name[vi]": "Martin Gräßlin",
"Name[x-test]": "xxMartin Gräßlinxx",
"Name[zh_CN]": "Martin Gräßlin"
}
],
"Category": "Clipboard",
"Description": "Provides access to the clipboard history",
"Description[ar]": "اطّلع على تاريخ الحافظة",
"Description[az]": "Mübadilə yaddaşı tarixçəsinə girirşi təmin edir",
"Description[ca]": "Proporciona accés a l'historial del porta-retalls",
"Description[cs]": "Poskytuje přístup k historii schránky",
"Description[de]": "Ermöglicht den Zugriff auf den Verlauf der Zwischenablage",
"Description[en_GB]": "Provides access to the clipboard history",
"Description[es]": "Proporciona acceso al historial del portapapeles",
"Description[eu]": "Arbeleko historialera sarbidea ematen du",
"Description[fi]": "Tarjoaa pääsyn leikepöytähistoriaan",
"Description[fr]": "Donne accès à l'historique du presse-papier",
"Description[hu]": "Hozzáférést nyújt a vágólap előzményeihez",
"Description[ia]": "Forni accesso al chronologia del area de transferentia",
"Description[it]": "Fornisce l'accesso alla cronologia degli appunti",
"Description[ko]": "클립보드 기록 표시",
"Description[lt]": "Suteikia prieigą prie iškarpinės istorijos",
"Description[nl]": "Biedt toegang tot de geschiedenis van klembord",
"Description[nn]": "Få tilgang til utklippstavle­loggen",
"Description[pa]": "ਕਲਿੱਪਬੋਰਡ ਅਤੀਤ ਲਈ ਪਹੁੰਚ ਦਿੰਦਾ ਹੈ",
"Description[pl]": "Zapewnia dostęp do historii schowka",
"Description[pt_BR]": "Fornece acesso ao histórico da área de transferência",
"Description[ro]": "Oferă acces la istoricul clipboard-ului",
"Description[ru]": "Предоставляет доступ к журналу буфера обмена",
"Description[sk]": "Poskytuje prístup k histórii schránky",
"Description[sl]": "Ponuja dostop do zgodovine odložišča",
"Description[sv]": "Ger tillgång till klippbordshistoriken",
"Description[ta]": "பிடிப்புப்பலகையின் வரலாற்றை அணுக உதவும்",
"Description[tr]": "Pano geçmişine erişim sağlar",
"Description[uk]": "Надає доступ до журналу буфера обміну даними",
"Description[vi]": "Cho phép truy cập lịch sử bảng nháp",
"Description[x-test]": "xxProvides access to the clipboard historyxx",
"Description[zh_CN]": "访问剪贴板历史",
"EnabledByDefault": true,
"FormFactors": [
"desktop"
],
"Icon": "klipper",
"Id": "org.kde.plasma.clipboard",
"License": "GPL-2.0+",
"Name": "Clipboard",
"Name[ar]": "الحافظة",
"Name[ast]": "Cartafueyu",
"Name[az]": "Mübadilə buferi",
"Name[bs]": "Klipbord",
"Name[ca@valencia]": "Porta-retalls",
"Name[ca]": "Porta-retalls",
"Name[cs]": "Schránka",
"Name[da]": "Udklipsholder",
"Name[de]": "Zwischenablage",
"Name[el]": "Πρόχειρο",
"Name[en_GB]": "Clipboard",
"Name[es]": "Portapapeles",
"Name[et]": "Lõikepuhver",
"Name[eu]": "Arbela",
"Name[fi]": "Leikepöytä",
"Name[fr]": "Presse-papiers",
"Name[gl]": "Portapapeis",
"Name[he]": "לוח העתקה",
"Name[hi]": "क्लिपबोर्ड",
"Name[hsb]": "Zapisnik (Clipboard)",
"Name[hu]": "Vágólap",
"Name[ia]": "Area de transferentia",
"Name[id]": "PapanKlip",
"Name[is]": "Klippispjald",
"Name[it]": "Appunti",
"Name[ja]": "クリップボード",
"Name[ko]": "클립보드",
"Name[lt]": "Iškarpinė",
"Name[lv]": "Starpliktuve",
"Name[ml]": "ക്ലിപ്ബോര്‍ഡ്",
"Name[nb]": "Utklippstavle",
"Name[nds]": "Twischenaflaag",
"Name[nl]": "Klembord",
"Name[nn]": "Utklippstavle",
"Name[pa]": "ਕਲਿੱਪਬੋਰਡ",
"Name[pl]": "Schowek",
"Name[pt]": "Área de Transferência",
"Name[pt_BR]": "Área de transferência",
"Name[ro]": "Clipboard",
"Name[ru]": "Буфер обмена",
"Name[sk]": "Schránka",
"Name[sl]": "Odložišče",
"Name[sr@ijekavian]": "клипборд",
"Name[sr@ijekavianlatin]": "klipbord",
"Name[sr@latin]": "klipbord",
"Name[sr]": "клипборд",
"Name[sv]": "Klippbord",
"Name[ta]": "பிடிப்புப்பலகை",
"Name[tg]": "Ҳофизаи муваққатӣ",
"Name[tr]": "Pano",
"Name[uk]": "Буфер обміну",
"Name[vi]": "Bảng nháp",
"Name[x-test]": "xxClipboardxx",
"Name[zh_CN]": "剪贴板",
"Name[zh_TW]": "剪貼簿",
"ServiceTypes": [
"Plasma/Applet"
],
"Version": "1.0"
},
"X-Plasma-API": "declarativeappletscript",
"X-Plasma-MainScript": "ui/clipboard.qml",
"X-Plasma-NotificationArea": "true",
"X-Plasma-NotificationAreaCategory": "SystemServices"
}

View File

@ -0,0 +1,3 @@
plasma_install_package(package org.kde.plasma.devicenotifier)
install(FILES test-predicate-openinwindow.desktop DESTINATION ${KDE_INSTALL_DATADIR}/solid/actions )

View File

@ -0,0 +1,2 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.devicenotifier.pot

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="General">
<entry name="removableDevices" type="Bool">
<label>If true it lists removable devices, such as USB thumbdrives. Only one between removableDevices, nonRemovableDevices and allDevices should be set.</label>
<default>true</default>
</entry>
<entry name="nonRemovableDevices" type="Bool">
<label>If true it lists non removable devices, such as internal harddrives. Only one between removableDevices, nonRemovableDevices and allDevices should be set.</label>
<default>false</default>
</entry>
<entry name="allDevices" type="Bool">
<label>If true it lists all kind of devices. Only one between removableDevices, nonRemovableDevices and allDevices should be set.</label>
<default>false</default>
</entry>
<entry name="popupOnNewDevice" type="Bool">
<label>If true it tries to open the plasmoid when a new device is inserted, as a kind of notification.</label>
<default>true</default>
</entry>
</group>
</kcfg>

View File

@ -0,0 +1,283 @@
/*
SPDX-FileCopyrightText: 2011 Viranch Mehta <viranch.mehta@gmail.com>
SPDX-FileCopyrightText: 2012 Jacopo De Simoi <wilderkde@gmail.com>
SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-FileCopyrightText: 2020 Nate Graham <nate@kde.org>
SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.0
import QtQuick.Controls 2.12 as QQC2
import QtQml.Models 2.14
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kquickcontrolsaddons 2.0
PlasmaExtras.ExpandableListItem {
id: deviceItem
property string udi
readonly property int state: sdSource.data[udi] ? sdSource.data[udi].State : 0
readonly property int operationResult: (model["Operation result"])
readonly property bool isMounted: devicenotifier.isMounted(udi)
readonly property bool hasMessage: statusSource.lastUdi == udi && statusSource.data[statusSource.last] ? true : false
readonly property var message: hasMessage ? statusSource.data[statusSource.last] || ({}) : ({})
readonly property var types: model["Device Types"]
readonly property bool hasStorageAccess: types && types.indexOf("Storage Access") !== -1
readonly property bool hasPortableMediaPlayer: types && types.indexOf("Portable Media Player") !== -1
readonly property var supportedProtocols: model["Supported Protocols"]
readonly property double freeSpace: sdSource.data[udi] && sdSource.data[udi]["Free Space"] ? sdSource.data[udi]["Free Space"] : -1.0
readonly property double totalSpace: sdSource.data[udi] && sdSource.data[udi]["Size"] ? sdSource.data[udi]["Size"] : -1.0
property bool freeSpaceKnown: freeSpace > 0 && totalSpace > 0
readonly property bool isRootVolume: sdSource.data[udi] && sdSource.data[udi]["File Path"] ? sdSource.data[udi]["File Path"] == "/" : false
readonly property bool isRemovable: sdSource.data[udi] && sdSource.data[udi]["Removable"] ? sdSource.data[udi]["Removable"] : false
onOperationResultChanged: {
if (!popupIconTimer.running) {
if (operationResult == 1) {
devicenotifier.popupIcon = "dialog-ok"
popupIconTimer.restart()
} else if (operationResult == 2) {
devicenotifier.popupIcon = "dialog-error"
popupIconTimer.restart()
}
}
}
onHasMessageChanged: {
if (deviceItem.hasMessage) {
messageHighlight.highlight(this)
}
}
Connections {
target: unmountAll
function onClicked() {
removableActionTriggered();
}
}
Connections {
target: plasmoid.action("unmountAllDevices")
function onTriggered() {
removableActionTriggered();
}
}
// this keeps the delegate around for 5 seconds after the device has been
// removed in case there was a message, such as "you can now safely remove this"
ListView.onRemove: SequentialAnimation {
PropertyAction { target: deviceItem; property: "ListView.delayRemove"; value: deviceItem.hasMessage }
PropertyAction { target: deviceItem; property: "isEnabled"; value: false }
// Reset action model to hide the arrow
PropertyAction { target: deviceItem; property: "contextualActionsModel"; value: [] }
PropertyAction { target: deviceItem; property: "icon"; value: statusSource.lastIcon }
PropertyAction { target: deviceItem; property: "title"; value: statusSource.lastDescription }
PropertyAction { target: deviceItem; property: "subtitle"; value: statusSource.lastMessage }
PauseAnimation { duration: messageHighlightAnimator.duration }
// Otherwise the last message will show again when this device reappears
ScriptAction { script: statusSource.clearMessage(); }
// Otherwise there are briefly multiple highlight effects
PropertyAction { target: devicenotifier; property: "currentIndex"; value: -1 }
PropertyAction { target: deviceItem; property: "ListView.delayRemove"; value: false }
}
Timer {
id: updateStorageSpaceTimer
interval: 5000
repeat: true
running: isMounted && plasmoid.expanded
triggeredOnStart: true // Update the storage space as soon as we open the plasmoid
onTriggered: {
const service = sdSource.serviceForSource(udi);
const operation = service.operationDescription("updateFreespace");
service.startOperationCall(operation);
}
}
Timer {
id: unmountTimer
interval: 1000
repeat: false
}
Component {
id: deviceActionComponent
QQC2.Action { }
}
function removableActionTriggered() {
if (model["Removable"] && isMounted) {
actionTriggered();
}
}
function actionTriggered() {
let service
let operationName
let operation
const wasMounted = isMounted;
if (!hasStorageAccess || !isRemovable || !isMounted) {
service = hpSource.serviceForSource(udi);
operation = service.operationDescription('invokeAction');
const supportsMTP = supportedProtocols && supportedProtocols.indexOf("mtp") !== -1
if (!hasStorageAccess && hasPortableMediaPlayer && supportsMTP) {
operation.predicate = "solid_mtp.desktop" // this lives in kio-extras!
} else {
operation.predicate = "test-predicate-openinwindow.desktop";
}
} else {
service = sdSource.serviceForSource(udi);
operation = service.operationDescription("unmount");
unmountTimer.restart();
}
service.startOperationCall(operation);
if (wasMounted) {
deviceItem.collapse();
}
}
// When there's no better icon available, show a placeholder icon instead
// of nothing
icon: sdSource.data[udi] ? sdSource.data[udi].Icon : "device-notifier"
iconEmblem: {
if (deviceItem.hasMessage) {
if (deviceItem.message.solidError === 0) {
return "emblem-information"
} else {
return "emblem-error"
}
} else if (deviceItem.state == 0 && Emblems && Emblems[0]) {
return Emblems[0]
} else {
return ""
}
}
title: sdSource.data[udi] ? sdSource.data[udi].Description : ""
subtitle: {
if (deviceItem.hasMessage) {
return deviceItem.message.error
}
if (deviceItem.state == 0) {
if (!hpSource.data[udi]) {
return ""
}
if (freeSpaceKnown) {
const freeSpaceText = sdSource.data[udi]["Free Space Text"]
const totalSpaceText = sdSource.data[udi]["Size Text"]
return i18nc("@info:status Free disk space", "%1 free of %2", freeSpaceText, totalSpaceText)
}
return ""
} else if (deviceItem.state == 1) {
return i18nc("Accessing is a less technical word for Mounting; translation should be short and mean \'Currently mounting this device\'", "Accessing…")
} else if (unmountTimer.running) {
// Unmounting, shown if unmount takes less than 1 second
return i18nc("Removing is a less technical word for Unmounting; translation should be short and mean \'Currently unmounting this device\'", "Removing…")
} else {
// Unmounting; shown if unmount takes longer than 1 second
return i18n("Don't unplug yet! Files are still being transferred...")
}
}
subtitleCanWrap: true
// Color the subtitle red for disks with less than 5% free space
subtitleColor: {
if (freeSpaceKnown) {
if (freeSpace / totalSpace <= 0.05) {
return PlasmaCore.Theme.negativeTextColor
}
}
return PlasmaCore.Theme.textColor
}
defaultActionButtonAction: QQC2.Action {
icon.name: {
if (isRemovable) {
return isMounted ? "media-eject" : "document-open-folder"
} else {
return "document-open-folder"
}
}
text: {
// TODO: this entire logic and the semi-replication thereof in actionTriggered is really silly.
// We have a fairly exhaustive predicate system, we should use it to assertain if a given udi is actionable
// and then we simply pick the sensible default action of a suitable predicate.
// - It's possible for there to be no StorageAccess (e.g. MTP devices don't have one)
// - It's possible for the root volume to be on a removable disk
if (!hasStorageAccess || !isRemovable || isRootVolume) {
return i18n("Open in File Manager")
} else {
if (!isMounted) {
return i18n("Mount and Open")
} else if (types && types.indexOf("OpticalDisc") !== -1) {
return i18n("Eject")
} else {
return i18n("Safely remove")
}
}
}
onTriggered: actionTriggered()
}
isBusy: deviceItem.state != 0
// We need a JS array full of QQC2 actions; this Instantiator creates them
// from the actions list of the data source
Instantiator {
model: hpSource.data[udi] ? hpSource.data[udi].actions : []
delegate: QQC2.Action {
text: modelData.text
icon.name: modelData.icon
// We only want to show the "Show in file manager" action for
// mounted removable disks (for everything else, this action is
// already the primary one shown on the list item)
enabled: {
if (modelData.predicate != "test-predicate-openinwindow.desktop") {
return true;
}
return deviceItem.isRemovable && deviceItem.isMounted;
}
onTriggered: {
const service = hpSource.serviceForSource(udi);
const operation = service.operationDescription('invokeAction');
operation.predicate = modelData.predicate;
service.startOperationCall(operation);
devicenotifier.currentIndex = -1;
}
}
onObjectAdded: contextualActionsModel.push(object)
}
// "Mount" action that does not open it in the file manager
QQC2.Action {
id: mountWithoutOpeningAction
text: i18n("Mount")
icon.name: "media-mount"
// Only show for unmounted removable devices
enabled: deviceItem.isRemovable && !deviceItem.isMounted
onTriggered: {
const service = sdSource.serviceForSource(udi);
const operation = service.operationDescription("mount");
service.startOperationCall(operation);
}
}
Component.onCompleted: {
contextualActionsModel.push(mountWithoutOpeningAction);
}
}

View File

@ -0,0 +1,173 @@
/*
SPDX-FileCopyrightText: 2011 Viranch Mehta <viranch.mehta@gmail.com>
SPDX-FileCopyrightText: 2012 Jacopo De Simoi <wilderkde@gmail.com>
SPDX-FileCopyrightText: 2014 David Edmundson <davidedmundson@kde.org>
SPDX-FileCopyrightText: 2014 Marco Martin <mart@kde.org>
SPDX-FileCopyrightText: 2020 Nate Graham <nate@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.2
import QtQuick.Window 2.2
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents // For Highlight
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
PlasmaExtras.Representation {
id: fullRep
property bool spontaneousOpen: false
Layout.minimumWidth: PlasmaCore.Units.gridUnit * 12
Layout.minimumHeight: PlasmaCore.Units.gridUnit * 12
collapseMarginsHint: true
header: PlasmaExtras.PlasmoidHeading {
visible: !(plasmoid.containmentDisplayHints & PlasmaCore.Types.ContainmentDrawsPlasmoidHeading) && devicenotifier.mountedRemovables > 1
PlasmaComponents3.ToolButton {
id: unmountAll
anchors.right: parent.right
visible: devicenotifier.mountedRemovables > 1;
icon.name: "media-eject"
text: i18n("Remove All")
PlasmaComponents3.ToolTip {
text: i18n("Click to safely remove all devices")
}
}
}
MouseArea {
id: fullRepMouseArea
hoverEnabled: true
}
PlasmaCore.DataSource {
id: userActivitySource
engine: "powermanagement"
connectedSources: "UserActivity"
property int polls: 0
//poll only on plasmoid expanded
interval: !fullRepMouseArea.containsMouse && !fullRep.Window.active && spontaneousOpen && plasmoid.expanded ? 3000 : 0
onIntervalChanged: polls = 0;
onDataChanged: {
//only do when polling
if (interval == 0 || polls++ < 1) {
return;
}
if (userActivitySource.data["UserActivity"]["IdleTime"] < interval) {
plasmoid.expanded = false;
spontaneousOpen = false;
}
}
}
// this item is reparented to a delegate that is showing a message to draw focus to it
PlasmaComponents.Highlight {
id: messageHighlight
visible: false
OpacityAnimator {
id: messageHighlightAnimator
target: messageHighlight
from: 1
to: 0
duration: PlasmaCore.Units.veryLongDuration * 8
easing.type: Easing.InOutQuad
Component.onCompleted: devicenotifier.isMessageHighlightAnimatorRunning = Qt.binding(() => running);
}
Connections {
target: statusSource
function onLastChanged() {
if (!statusSource.last) {
messageHighlightAnimator.stop()
messageHighlight.visible = false
}
}
}
function highlight(item) {
parent = item
width = Qt.binding(function() { return item.width })
height = Qt.binding(function() { return item.height })
opacity = 1 // Animator is threaded so the old opacity might be visible for a frame or two
visible = true
messageHighlightAnimator.start()
}
}
Connections {
target: plasmoid
function onExpandedChanged() {
if (!plasmoid.expanded) {
statusSource.clearMessage();
}
}
}
PlasmaComponents3.ScrollView {
id: scrollView
// HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890
PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff
anchors.fill: parent
contentWidth: availableWidth - contentItem.leftMargin - contentItem.rightMargin
contentItem: ListView {
id: notifierDialog
focus: true
model: filterModel
delegate: DeviceItem {
udi: DataEngineSource
}
highlight: PlasmaComponents.Highlight { }
highlightMoveDuration: 0
highlightResizeDuration: 0
topMargin: PlasmaCore.Units.smallSpacing * 2
bottomMargin: PlasmaCore.Units.smallSpacing * 2
leftMargin: PlasmaCore.Units.smallSpacing * 2
rightMargin: PlasmaCore.Units.smallSpacing * 2
spacing: PlasmaCore.Units.smallSpacing
currentIndex: devicenotifier.currentIndex
//this is needed to make SectionScroller actually work
//acceptable since one doesn't have a billion of devices
cacheBuffer: 1000
// FIXME: the model is sorted by timestamp, not type, this results in sections possibly getting listed
// multiple times
section {
property: "Type Description"
delegate: Item {
height: Math.floor(childrenRect.height)
width: notifierDialog.width - (scrollView.PlasmaComponents3.ScrollBar.vertical.visible ? PlasmaCore.Units.smallSpacing * 4 : 0)
PlasmaExtras.Heading {
level: 3
opacity: 0.6
text: section
}
}
}
PlasmaExtras.PlaceholderMessage {
anchors.centerIn: parent
width: parent.width - (PlasmaCore.Units.largeSpacing * 4)
text: plasmoid.configuration.removableDevices ? i18n("No removable devices attached") : i18n("No disks available")
visible: notifierDialog.count === 0 && !messageHighlightAnimator.running
}
}
}
}

View File

@ -0,0 +1,347 @@
/*
SPDX-FileCopyrightText: 2011 Viranch Mehta <viranch.mehta@gmail.com>
SPDX-FileCopyrightText: 2012 Jacopo De Simoi <wilderkde@gmail.com>
SPDX-FileCopyrightText: 2014 David Edmundson <davidedmundson@kde.org>
SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kquickcontrolsaddons 2.0 // For KCMShell
Item {
id: devicenotifier
readonly property bool openAutomounterKcmAuthorized: KCMShell.authorize("device_automounter_kcm.desktop").length > 0
property string devicesType: {
if (plasmoid.configuration.allDevices) {
return "all"
} else if (plasmoid.configuration.removableDevices) {
return "removable"
} else {
return "nonRemovable"
}
}
property string popupIcon: "device-notifier"
property bool itemClicked: false
property int currentIndex: -1
property var connectedRemovables: []
property int mountedRemovables: 0
// QTBUG-50380: As soon as the item gets removed from the model, all of ListView's
// properties (count, contentHeight) pretend the delegate doesn't exist anymore
// causing our "No devices" heading to overlap with the remaining device
property bool isMessageHighlightAnimatorRunning: false
Plasmoid.switchWidth: PlasmaCore.Units.gridUnit * 10
Plasmoid.switchHeight: PlasmaCore.Units.gridUnit * 10
Plasmoid.toolTipMainText: filterModel.count > 0 && filterModel.get(0) ? i18n("Most Recent Device") : i18n("No Devices Available")
Plasmoid.toolTipSubText: {
if (filterModel.count > 0) {
var data = filterModel.get(0)
if (data && data.Description) {
return data.Description
}
}
return ""
}
Plasmoid.icon: {
if (filterModel.count > 0) {
var data = filterModel.get(0)
if (data && data.Icon) {
return data.Icon
}
}
return "device-notifier"
}
Plasmoid.status: (filterModel.count > 0 || isMessageHighlightAnimatorRunning) ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus
PlasmaCore.DataSource {
id: hpSource
engine: "hotplug"
connectedSources: sources
interval: 0
onSourceAdded: {
disconnectSource(source);
connectSource(source);
sdSource.connectedSources = sources
}
onSourceRemoved: {
disconnectSource(source);
}
}
Plasmoid.compactRepresentation: PlasmaCore.IconItem {
source: devicenotifier.popupIcon
width: PlasmaCore.Units.iconSizes.medium;
height: PlasmaCore.Units.iconSizes.medium;
active: compactMouse.containsMouse
MouseArea {
id: compactMouse
anchors.fill: parent
hoverEnabled: true
onClicked: plasmoid.expanded = !plasmoid.expanded
}
}
Plasmoid.fullRepresentation: FullRepresentation {}
PlasmaCore.DataSource {
id: sdSource
engine: "soliddevice"
interval: 0
property string last
onSourceAdded: {
disconnectSource(source);
connectSource(source);
last = source;
processLastDevice(true);
if (data[source].Removable) {
devicenotifier.connectedRemovables.push(source);
devicenotifier.connectedRemovables = devicenotifier.connectedRemovables;
}
}
onSourceRemoved: {
disconnectSource(source);
var index = devicenotifier.connectedRemovables.indexOf(source);
if (index >= 0) {
devicenotifier.connectedRemovables.splice(index, 1);
devicenotifier.connectedRemovables = devicenotifier.connectedRemovables;
}
}
onDataChanged: {
processLastDevice(true);
var counter = 0;
for (var i = 0; i < devicenotifier.connectedRemovables.length; i++) {
if (isMounted(devicenotifier.connectedRemovables[i])) {
counter++;
}
}
if (counter !== devicenotifier.mountedRemovables) {
devicenotifier.mountedRemovables = counter;
}
}
onNewData: {
last = sourceName;
processLastDevice(false);
}
function isViableDevice(udi) {
if (devicesType === "all") {
return true;
}
var device = data[udi];
if (!device) {
return false;
}
return (devicesType === "removable" && device.Removable)
|| (devicesType === "nonRemovable" && !device.Removable);
}
function processLastDevice(expand) {
if (last && isViableDevice(last)) {
if (expand && hpSource.data[last] && hpSource.data[last].added) {
devicenotifier.popupIcon = "preferences-desktop-notification";
expandTimer.restart();
popupIconTimer.restart();
}
last = "";
}
}
}
PlasmaCore.SortFilterModel {
id: filterModel
sourceModel: PlasmaCore.DataModel {
dataSource: sdSource
}
filterRole: "Removable"
filterRegExp: {
if (devicesType === "removable") {
return "true"
} else if (devicesType === "nonRemovable") {
return "false"
} else {
return ""
}
}
sortRole: "Timestamp"
sortOrder: Qt.DescendingOrder
}
PlasmaCore.DataSource {
id: statusSource
engine: "devicenotifications"
property string last
property string lastUdi
property string lastDescription
property string lastMessage
property string lastIcon
onSourceAdded: {
last = source;
disconnectSource(source);
connectSource(source);
}
onSourceRemoved: disconnectSource(source)
onDataChanged: {
if (last) {
lastUdi = data[last].udi
lastDescription = sdSource.data[lastUdi] ? sdSource.data[lastUdi].Description : ""
lastMessage = data[last].error
lastIcon = sdSource.data[lastUdi] ? sdSource.data[lastUdi].Icon : "device-notifier"
if (sdSource.isViableDevice(lastUdi)) {
plasmoid.expanded = true
plasmoid.fullRepresentationItem.spontaneousOpen = true;
}
}
}
function clearMessage() {
last = ""
lastUdi = ""
lastDescription = ""
lastMessage = ""
lastIcon = ""
}
}
property var showRemovableDevicesAction
property var showNonRemovableDevicesAction
property var showAllDevicesAction
property var openAutomaticallyAction
Component.onCompleted: {
if (sdSource.connectedSources.count === 0) {
Plasmoid.status = PlasmaCore.Types.PassiveStatus;
}
plasmoid.setAction("unmountAllDevices", i18n("Remove All"), "media-eject");
plasmoid.action("unmountAllDevices").visible = Qt.binding(() => {
return devicenotifier.mountedRemovables > 1;
});
plasmoid.setActionSeparator("sep0");
plasmoid.setAction("showRemovableDevices", i18n("Removable Devices"), "drive-removable-media");
devicenotifier.showRemovableDevicesAction = plasmoid.action("showRemovableDevices");
devicenotifier.showRemovableDevicesAction.checkable = true;
devicenotifier.showRemovableDevicesAction.checked = Qt.binding(() => {return plasmoid.configuration.removableDevices;});
plasmoid.setActionGroup("showRemovableDevices", "devicesShown");
plasmoid.setAction("showNonRemovableDevices", i18n("Non Removable Devices"), "drive-harddisk");
devicenotifier.showNonRemovableDevicesAction = plasmoid.action("showNonRemovableDevices");
devicenotifier.showNonRemovableDevicesAction.checkable = true;
devicenotifier.showNonRemovableDevicesAction.checked = Qt.binding(() => {return plasmoid.configuration.nonRemovableDevices;});
plasmoid.setActionGroup("showNonRemovableDevices", "devicesShown");
plasmoid.setAction("showAllDevices", i18n("All Devices"));
devicenotifier.showAllDevicesAction = plasmoid.action("showAllDevices");
devicenotifier.showAllDevicesAction.checkable = true;
devicenotifier.showAllDevicesAction.checked = Qt.binding(() => {return plasmoid.configuration.allDevices;});
plasmoid.setActionGroup("showAllDevices", "devicesShown");
plasmoid.setActionSeparator("sep");
plasmoid.setAction("openAutomatically", i18n("Show popup when new device is plugged in"));
devicenotifier.openAutomaticallyAction = plasmoid.action("openAutomatically");
devicenotifier.openAutomaticallyAction.checkable = true;
devicenotifier.openAutomaticallyAction.checked = Qt.binding(() => {return plasmoid.configuration.popupOnNewDevice;});
plasmoid.setActionSeparator("sep2");
if (devicenotifier.openAutomounterKcmAuthorized) {
plasmoid.removeAction("configure");
plasmoid.setAction("configure", i18nc("Open auto mounter kcm", "Configure Removable Devices…"), "configure")
}
}
function action_configure() {
KCMShell.openSystemSettings("kcm_device_automounter")
}
function action_showRemovableDevices() {
plasmoid.configuration.removableDevices = true;
plasmoid.configuration.nonRemovableDevices = false;
plasmoid.configuration.allDevices = false;
}
function action_showNonRemovableDevices() {
plasmoid.configuration.removableDevices = false;
plasmoid.configuration.nonRemovableDevices = true;
plasmoid.configuration.allDevices = false;
}
function action_showAllDevices() {
plasmoid.configuration.removableDevices = false;
plasmoid.configuration.nonRemovableDevices = false;
plasmoid.configuration.allDevices = true;
}
function action_openAutomatically() {
plasmoid.configuration.popupOnNewDevice = !plasmoid.configuration.popupOnNewDevice;
}
Plasmoid.onExpandedChanged: {
popupEventSlot(plasmoid.expanded);
}
function popupEventSlot(popped) {
if (!popped) {
// reset the property that lets us remember if an item was clicked
// (versus only hovered) for autohide purposes
devicenotifier.itemClicked = true;
devicenotifier.currentIndex = -1;
}
}
function isMounted(udi) {
if (!sdSource.data[udi]) {
return false;
}
var types = sdSource.data[udi]["Device Types"];
if (types.indexOf("Storage Access") >= 0) {
return sdSource.data[udi]["Accessible"];
}
return (types.indexOf("Storage Volume") >= 0 && types.indexOf("OpticalDisc") >= 0)
}
Timer {
id: popupIconTimer
interval: 3000
onTriggered: devicenotifier.popupIcon = "device-notifier";
}
Timer {
id: expandTimer
interval: 250
onTriggered: {
// We don't show a UI for it, but there is a hidden option to not
// show the popup on new device attachment if the user has added
// the text "popupOnNewDevice=false" to their
// plasma-org.kde.plasma.desktop-appletsrc file.
if (plasmoid.configuration.popupOnNewDevice) { // Bug 351592
plasmoid.expanded = true;
plasmoid.fullRepresentationItem.spontaneousOpen = true;
}
}
}
}

View File

@ -0,0 +1,133 @@
{
"KPlugin": {
"Authors": [
{
"Email": "wilderkde@gmail.com",
"Name": "Viranch Mehta, Jacopo De Simoi",
"Name[ar]": "Viranch Mehta, Jacopo De Simoi",
"Name[az]": "Viranch Mehta, Jacopo De Simoi",
"Name[ca]": "Viranch Mehta, Jacopo De Simoi",
"Name[cs]": "Viranch Mehta, Jacopo De Simoi",
"Name[de]": "Viranch Mehta, Jacopo De Simoi",
"Name[en_GB]": "Viranch Mehta, Jacopo De Simoi",
"Name[es]": "Viranch Mehta, Jacopo De Simoi",
"Name[eu]": "Viranch Mehta, Jacopo De Simoi",
"Name[fi]": "Viranch Mehta, Jacopo De Simoi",
"Name[fr]": "Viranch Mehta, Jacopo De Simoi",
"Name[hu]": "Viranch Mehta, Jacopo De Simoi",
"Name[ia]": "Viranch Mehta, Jacopo De Simoi",
"Name[it]": "Viranch Mehta, Jacopo De Simoi",
"Name[ko]": "Viranch Mehta, Jacopo De Simoi",
"Name[lt]": "Viranch Mehta, Jacopo De Simoi",
"Name[nl]": "Viranch Mehta, Jacopo De Simoi",
"Name[nn]": "Viranch Mehta, Jacopo De Simoi",
"Name[pl]": "Viranch Mehta, Jacopo De Simoi",
"Name[pt_BR]": "Viranch Mehta, Jacopo De Simoi",
"Name[ro]": "Viranch Mehta, Jacopo De Simoi",
"Name[ru]": "Viranch Mehta, Jacopo De Simoi",
"Name[sk]": "Viranch Mehta, Jacopo De Simoi",
"Name[sl]": "Viranch Mehta, Jacopo De Simoi",
"Name[sv]": "Viranch Mehta",
"Name[tr]": "Viranch Mehta, Jacopo De Simoi",
"Name[uk]": "Viranch Mehta, Jacopo De Simoi",
"Name[vi]": "Viranch Mehta, Jacopo De Simoi",
"Name[x-test]": "xxViranch Mehta, Jacopo De Simoixx",
"Name[zh_CN]": "Viranch Mehta, Jacopo De Simoi"
}
],
"Category": "System Information",
"Description": "Notifications and access for devices",
"Description[ar]": "إخطارات ووصول الأجهزة",
"Description[az]": "Cihazlar üçün bildirişlər və onlara giriş",
"Description[ca]": "Notificacions i accés als dispositius",
"Description[cs]": "Upozorňování a přístup k zařízením",
"Description[de]": "Benachrichtigungen und Zugriff für Geräte",
"Description[en_GB]": "Notifications and access for devices",
"Description[es]": "Notificaciones y accesos de dispositivos",
"Description[eu]": "Gailuetarako jakinarazpenak eta sarbidea",
"Description[fi]": "Ilmoitukset ja pääsy laitteisiin",
"Description[fr]": "Notifications et accès aux périphériques",
"Description[hu]": "Eszközök elérése, értesítő üzenetek kezelése",
"Description[ia]": "Notificationes e accesso pro dispositivos",
"Description[it]": "Notifiche e accesso per dispositivi",
"Description[ko]": "장치가 연결된 것을 알려 주고 접근할 수 있도록 합니다",
"Description[lt]": "Pranešimai apie įrenginius ir prieiga prie jų",
"Description[nl]": "Meldingen en toegang voor apparaten",
"Description[nn]": "Varsling og tilgang til einingar",
"Description[pa]": "ਡਿਵਾਈਸਾਂ ਲਈ ਨੋਟੀਫਿਕੇਸ਼ਨ ਅਤੇ ਪਹੁੰਚ",
"Description[pl]": "Powiadomienia i dostęp do urządzeń",
"Description[pt_BR]": "Notificações e acesso aos dispositivos",
"Description[ro]": "Notificări și acces pentru dispozitive",
"Description[ru]": "Уведомление о подключаемых устройствах и доступ к ним",
"Description[sk]": "Upozornenia a prístup k zariadeniam",
"Description[sl]": "Obvestila in dostop do naprav",
"Description[sv]": "Underrättelser och åtkomst av enheter",
"Description[ta]": "புதிய சாதனங்களுக்கான அறிவிப்புகள் மற்றும் அணுகல்",
"Description[tr]": "Aygıt erişimi ve bildirimler",
"Description[uk]": "Сповіщення і доступ до пристроїв",
"Description[vi]": "Thông báo và cách truy cập cho các thiết bị",
"Description[x-test]": "xxNotifications and access for devicesxx",
"Description[zh_CN]": "设备的通知和访问",
"EnabledByDefault": true,
"FormFactors": [
"tablet",
"desktop"
],
"Icon": "device-notifier",
"Id": "org.kde.plasma.devicenotifier",
"License": "GPL-2.0+",
"Name": "Disks & Devices",
"Name[ar]": "الأجهزة والأقراص",
"Name[ast]": "Discos y preseos",
"Name[az]": "Disklər və Qurğular",
"Name[ca]": "Discs i dispositius",
"Name[cs]": "Disky & Zařízení",
"Name[da]": "Diske og enheder",
"Name[de]": "Datenträger & Geräte",
"Name[en_GB]": "Disks & Devices",
"Name[es]": "Discos y dispositivos",
"Name[et]": "Kettad ja seadmed",
"Name[eu]": "Diskoak eta gailuak",
"Name[fi]": "Levyt ja laitteet",
"Name[fr]": "Disques & périphériques",
"Name[hi]": "डिस्क और उपकरण",
"Name[hsb]": "Tačele a graty",
"Name[hu]": "Lemezek és eszközök",
"Name[ia]": "Discos & Dispositivos",
"Name[id]": "Perangkat & Disk",
"Name[it]": "Dischi e dispositivi",
"Name[ko]": "디스크와 장치",
"Name[lt]": "Diskai ir įrenginiai",
"Name[ml]": "ഡിസ്കുകളും ഉപകരണങ്ങളും",
"Name[nl]": "Schijven & apparaten",
"Name[nn]": "Diskar og einingar",
"Name[pa]": "ਡਿਸਕ ਤੇ ਡਿਵਾਈਸ",
"Name[pl]": "Dyski i urządzenia",
"Name[pt]": "Discos & Dispositivos",
"Name[pt_BR]": "Discos e dispositivos",
"Name[ro]": "Disc și dispozitive",
"Name[ru]": "Диски и устройства",
"Name[sk]": "Disky a zariadenia",
"Name[sl]": "Diski in naprave",
"Name[sv]": "Diskar och enheter",
"Name[ta]": "வட்டுகளும் சாதனங்களும்",
"Name[tg]": "Дискҳо ва дастгоҳҳо",
"Name[tr]": "Diskler ve Cihazlar",
"Name[uk]": "Диски і пристрої",
"Name[vi]": "Đĩa & Thiết bị",
"Name[x-test]": "xxDisks & Devicesxx",
"Name[zh_CN]": "磁盘和设备",
"ServiceTypes": [
"Plasma/Applet"
],
"Version": "1.0",
"Website": "https://userbase.kde.org/Plasma/DeviceNotifier"
},
"X-Plasma-API": "declarativeappletscript",
"X-Plasma-MainScript": "ui/devicenotifier.qml",
"X-Plasma-NotificationArea": "true",
"X-Plasma-NotificationAreaCategory": "Hardware",
"X-Plasma-Provides": [
"org.kde.plasma.removabledevices"
]
}

View File

@ -0,0 +1,78 @@
[Desktop Entry]
X-KDE-Solid-Predicate=[ [ [ StorageVolume.ignored == false AND StorageVolume.usage == 'FileSystem' ] OR [ IS StorageAccess AND StorageDrive.driveType == 'Floppy' ] ] OR StorageAccess.ignored == false ]
Type=Service
Actions=open;
[Desktop Action open]
Name=Open with File Manager
Name[ar]=افتح بمدير الملفات
Name[az]=Fayl menecerində açmaq
Name[bg]=Отваряне с файлов мениджър
Name[bs]=Otvori menadžerom datoteka
Name[ca]=Obre amb el gestor de fitxers
Name[ca@valencia]=Obri amb el gestor de fitxers
Name[cs]=Otevřít ve správci souborů
Name[csb]=Òtemkni w &menadzerze lopków
Name[da]=Åbn med filhåndtering
Name[de]=Mit Dateiverwaltung öffnen
Name[el]=Άνοιγμα με τον διαχειριστή αρχείων
Name[en_GB]=Open with File Manager
Name[es]=Abrir con el navegador de archivos
Name[et]=Ava failihalduriga
Name[eu]=Ireki fitxategi-kudeatzailearekin
Name[fi]=Avaa tiedostonhallinnassa
Name[fr]=Ouvrir dans le gestionnaire de fichiers
Name[fy]=Iepenje mei triembehearder
Name[ga]=Oscail le Bainisteoir na gComhad
Name[gl]=Abrir co xestor de ficheiros
Name[gu]=
Name[he]=פתיחה באמצעות מנהל הקבצים
Name[hi]=
Name[hr]=Otvori pomoću upravitelja datoteka
Name[hsb]=Z datajowym rjadowakom wočinić
Name[hu]=Megnyitás a fájlkezelővel
Name[ia]=Aperi con le gerente de files
Name[id]=Buka dengan Pengelola File
Name[is]=Opna með skráastjóra
Name[it]=Apri con il gestore dei file
Name[ja]=
Name[kk]=Файл менеджерінде ашу
Name[km]=
Name[kn]= ಿ
Name[ko]=
Name[lt]=Atverti naudojant failų tvarkytuvę
Name[lv]=Atvērt datņu pārvaldniekā
Name[mk]=Отвори со менаџер на датотеки
Name[ml]= ിി
Name[mr]=
Name[nb]=Åpne med filbehandler
Name[nds]=Mit Dateipleger opmaken
Name[nl]=Openen met bestandsbeheerder
Name[nn]=Opna i filhandsamar
Name[pa]=
Name[pl]=Otwórz w przeglądarce plików
Name[pt]=Abrir com o Gestor de Ficheiros
Name[pt_BR]=Abrir com o gerenciador de arquivos
Name[ro]=Deschide cu gestionarul de fișiere
Name[ru]=Открыть в диспетчере файлов
Name[si]=
Name[sk]=Otvoriť v správcovi súborov
Name[sl]=Odpri v upravljalniku datotek
Name[sr]=Отвори менаџером фајлова
Name[sr@ijekavian]=Отвори менаџером фајлова
Name[sr@ijekavianlatin]=Otvori menadžerom fajlova
Name[sr@latin]=Otvori menadžerom fajlova
Name[sv]=Öppna med filhanterare
Name[ta]= ி
Name[tg]=Кушодан ба воситаи мудири файлҳо
Name[th]=
Name[tr]=Dosya Yöneticisi ile aç
Name[ug]=ھۆججەت باشقۇرغۇدا ئاچ
Name[uk]=Відкрити за допомогою менеджера файлів
Name[vi]=M bng Trình qun lí tp
Name[wa]=Drovi avou l' manaedjeu des fitchîs
Name[x-test]=xxOpen with File Managerxx
Name[zh_CN]=
Name[zh_TW]=使
Exec=kde-open5 "%f"
Icon=system-file-manager

View File

@ -0,0 +1,3 @@
add_subdirectory(plugin)
plasma_install_package(package org.kde.plasma.digitalclock)

View File

@ -0,0 +1,2 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.digitalclock.pot

View File

@ -0,0 +1,45 @@
/*
SPDX-FileCopyrightText: 2013 Bhushan Shah <bhush94@gmail.com>
SPDX-FileCopyrightText: 2015 Martin Klapetek <mklapetek@kde.org>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.0
import QtQml 2.2
import org.kde.plasma.configuration 2.0
import org.kde.plasma.calendar 2.0 as PlasmaCalendar
ConfigModel {
id: configModel
ConfigCategory {
name: i18n("Appearance")
icon: "preferences-desktop-color"
source: "configAppearance.qml"
}
ConfigCategory {
name: i18n("Calendar")
icon: "office-calendar"
source: "configCalendar.qml"
}
ConfigCategory {
name: i18n("Time Zones")
icon: "preferences-system-time"
source: "configTimeZones.qml"
}
property Instantiator __eventPlugins: Instantiator {
model: PlasmaCalendar.EventPluginsManager.model
delegate: ConfigCategory {
name: model.display
icon: model.decoration
source: model.configUi
visible: plasmoid.configuration.enabledCalendarPlugins.indexOf(model.pluginPath) > -1
}
onObjectAdded: configModel.appendCategory(object)
onObjectRemoved: configModel.removeCategory(object)
}
}

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="Appearance">
<entry name="showLocalTimezone" type="Bool">
<label>Whether the timezone should be displayed when the clock is showing the local timezone.</label>
<default>false</default>
</entry>
<entry name="showSeconds" type="Bool">
<label>Whether seconds should be shown in the clock.</label>
<default>false</default>
</entry>
<entry name="showDate" type="Bool">
<label>Whether the date should be shown next to the clock.</label>
<default>true</default>
</entry>
<entry name="dateFormat" type="string">
<label>The date format to display. Options are: shortDate, longDate, isoDate or custom.</label>
<default>shortDate</default>
</entry>
<entry name="customDateFormat" type="string">
<label>Custom date format string.</label>
<default>ddd d</default>
</entry>
<entry name="fontFamily" type="string">
<label>Font family. e.g "arial". The system font is used if this is not set.</label>
<default></default>
</entry>
<entry name="boldText" type="Bool">
<label>Sets the font to bold.</label>
<default>false</default>
</entry>
<entry name="italicText" type="Bool">
<label>Sets the font to italic.</label>
<default>false</default>
</entry>
<entry name="timeFormat" type="string">
<default>default</default>
</entry>
<entry name="selectedTimeZones" type="StringList">
<label>A list of the configured time zones. Format is "Europe/London". Special entry "Local" indicates system time zone.</label>
<default>Local</default>
</entry>
<entry name="lastSelectedTimezone" type="String">
<label>When multiple time zones are configured, this is the one shown on widget restore. Typically the system's current timezone.</label>
<default>Local</default>
</entry>
<entry name="wheelChangesTimezone" type="Bool">
<label>Whether the mouse wheel switches between the timezones configured in selectedTimeZones.</label>
<default>false</default>
</entry>
<entry name="displayTimezoneFormat" type="Enum">
<label>Whether the timezone is displayed as a code i.e. "GMT", full text i.e. "London" or UTC offset "+1".</label>
<choices name="Settings::displayTimezoneFormat">
<choice name="Code" />
<choice name="FullText" />
<choice name="UTCOffset" />
</choices>
<default>Code</default>
</entry>
<entry name="showWeekNumbers" type="Bool">
<label>Whether the calendar should show week numbers.</label>
<default>false</default>
</entry>
<entry name="use24hFormat" type="UInt">
<label>Force the clock to use 12/24 hour time, instead of following the user locale.</label>
<default>1</default>
</entry>
<entry name="firstDayOfWeek" type="Int">
<label>Force the calendar to use a specific week day as first day of a week. -1 means follow user locale, 0 is Sunday, 1 is Monday, etc.</label>
<default>-1</default>
</entry>
<entry name="enabledCalendarPlugins" type="StringList">
<label>A list of plugins where additional calendar event data can be sourced.</label>
<default></default>
</entry>
<entry name="pin" type="Bool">
<label>Whether the popup should remain open when another window is activated</label>
<default>false</default>
</entry>
<entry name="dateDisplayFormat" type="Enum">
<label>Whether the date should be shown below or beside the time</label>
<choices name="Settings::dateDisplayFormat">
<choice name="Adaptive" />
<choice name="BesideTime" />
<choice name="BelowTime" />
</choices>
<default>Adaptive</default>
</entry>
</group>
</kcfg>

View File

@ -0,0 +1,633 @@
/*
SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
SPDX-FileCopyrightText: 2015 Martin Klapetek <mklapetek@kde.org>
SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.4
import QtQuick.Layouts 1.1
import QtQml 2.15
import org.kde.kquickcontrolsaddons 2.0 // For kcmshell
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.calendar 2.0 as PlasmaCalendar
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.private.digitalclock 1.0
// Top-level layout containing:
// - Left column with world clock and agenda view
// - Right column with current date header and calendar
PlasmaExtras.Representation {
id: calendar
// The "sensible" values
property int _minimumWidth: (calendar.showAgenda || calendar.showClocks) ? PlasmaCore.Units.gridUnit * 45 : PlasmaCore.Units.gridUnit * 22
property int _minimumHeight: PlasmaCore.Units.gridUnit * 25
PlasmaCore.ColorScope.inherit: false
PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.NormalColorGroup
Layout.minimumWidth: _minimumWidth
Layout.minimumHeight: _minimumHeight
Layout.preferredWidth: _minimumWidth
Layout.preferredHeight: _minimumHeight
Layout.maximumWidth: _minimumWidth
Layout.maximumHeight: _minimumHeight
collapseMarginsHint: true
readonly property int paddings: PlasmaCore.Units.smallSpacing
readonly property bool showAgenda: PlasmaCalendar.EventPluginsManager.enabledPlugins.length > 0
readonly property bool showClocks: plasmoid.configuration.selectedTimeZones.length > 1
property alias borderWidth: monthView.borderWidth
property alias monthView: monthView
property bool debug: false
property bool isExpanded: plasmoid.expanded
onIsExpandedChanged: {
// clear all the selections when the plasmoid is showing/hiding
monthView.resetToToday();
}
// Header containing date and pin button
header: PlasmaExtras.PlasmoidHeading {
id: headerArea
implicitHeight: calendarHeader.implicitHeight
// Agenda view header
// -----------------
ColumnLayout {
id: eventHeader
anchors.left: parent.left
width: visible ? parent.width / 2 - 1 : 0
visible: calendar.showAgenda || calendar.showClocks
RowLayout {
PlasmaExtras.Heading {
Layout.fillWidth: true
Layout.leftMargin: calendar.paddings // Match calendar title
text: monthView.currentDate.toLocaleDateString(Qt.locale(), Locale.LongFormat)
}
}
RowLayout {
// Heading text
PlasmaExtras.Heading {
visible: agenda.visible
Layout.fillWidth: true
Layout.leftMargin: calendar.paddings
level: 2
text: i18n("Events")
maximumLineCount: 1
elide: Text.ElideRight
}
PlasmaComponents3.ToolButton {
visible: agenda.visible && ApplicationIntegration.calendarInstalled
text: i18nc("@action:button Add event", "Add…")
Layout.rightMargin: calendar.paddings
icon.name: "list-add"
onClicked: ApplicationIntegration.launchCalendar()
}
}
}
// Vertical separator line between columns
// =======================================
PlasmaCore.SvgItem {
id: headerSeparator
anchors.left: eventHeader.right
anchors.bottomMargin: PlasmaCore.Units.smallSpacing * 2
width: visible ? 1 : 0
height: calendarHeader.height - PlasmaCore.Units.smallSpacing * 2
visible: eventHeader.visible
elementId: "vertical-line"
svg: PlasmaCore.Svg {
imagePath: "widgets/line"
}
}
GridLayout {
id: calendarHeader
width: calendar.showAgenda || calendar.showClocks ? parent.width / 2 : parent.width
anchors.left: headerSeparator.right
columns: 6
rows: 2
PlasmaExtras.Heading {
Layout.row: 0
Layout.column: 0
Layout.columnSpan: 3
Layout.fillWidth: true
Layout.leftMargin: calendar.paddings + PlasmaCore.Units.smallSpacing
text: monthView.selectedYear === (new Date()).getFullYear() ? monthView.selectedMonth : i18nc("Format: month year", "%1 %2", monthView.selectedMonth, monthView.selectedYear.toString())
}
PlasmaComponents3.ToolButton {
Layout.row: 0
Layout.column: 4
Layout.alignment: Qt.AlignRight
visible: plasmoid.action("configure").enabled
icon.name: "configure"
onClicked: plasmoid.action("configure").trigger()
PlasmaComponents3.ToolTip {
text: plasmoid.action("configure").text
}
}
// Allows the user to keep the calendar open for reference
PlasmaComponents3.ToolButton {
Layout.row: 0
Layout.column: 5
checkable: true
checked: plasmoid.configuration.pin
onToggled: plasmoid.configuration.pin = checked
icon.name: "window-pin"
PlasmaComponents3.ToolTip {
text: i18n("Keep Open")
}
}
PlasmaComponents3.TabBar {
id: tabbar
currentIndex: monthView.currentIndex
Layout.row: 1
Layout.column: 0
Layout.columnSpan: 3
Layout.topMargin: PlasmaCore.Units.smallSpacing
Layout.fillWidth: true
Layout.leftMargin: PlasmaCore.Units.smallSpacing
PlasmaComponents3.TabButton {
text: i18n("Days");
onClicked: monthView.showMonthView();
display: PlasmaComponents3.AbstractButton.TextOnly
}
PlasmaComponents3.TabButton {
text: i18n("Months");
onClicked: monthView.showYearView();
display: PlasmaComponents3.AbstractButton.TextOnly
}
PlasmaComponents3.TabButton {
text: i18n("Years");
onClicked: monthView.showDecadeView();
display: PlasmaComponents3.AbstractButton.TextOnly
}
}
PlasmaComponents3.ToolButton {
id: previousButton
property string tooltip
Layout.row: 1
Layout.column: 3
Layout.leftMargin: PlasmaCore.Units.smallSpacing
Layout.bottomMargin: PlasmaCore.Units.smallSpacing
icon.name: Qt.application.layoutDirection === Qt.RightToLeft ? "go-next" : "go-previous"
onClicked: monthView.previousView()
Accessible.name: tooltip
PlasmaComponents3.ToolTip {
text: {
switch(monthView.calendarViewDisplayed) {
case PlasmaCalendar.MonthView.CalendarView.DayView:
return i18n("Previous month")
case PlasmaCalendar.MonthView.CalendarView.MonthView:
return i18n("Previous year")
case PlasmaCalendar.MonthView.CalendarView.YearView:
return i18n("Previous decade")
default:
return "";
}
}
}
}
PlasmaComponents3.ToolButton {
Layout.bottomMargin: PlasmaCore.Units.smallSpacing
Layout.row: 1
Layout.column: 4
onClicked: monthView.resetToToday()
text: i18ndc("libplasma5", "Reset calendar to today", "Today")
Accessible.description: i18nd("libplasma5", "Reset calendar to today")
}
PlasmaComponents3.ToolButton {
id: nextButton
property string tooltip
Layout.bottomMargin: PlasmaCore.Units.smallSpacing
Layout.row: 1
Layout.column: 5
icon.name: Qt.application.layoutDirection === Qt.RightToLeft ? "go-previous" : "go-next"
onClicked: monthView.nextView()
Accessible.name: tooltip
PlasmaComponents3.ToolTip {
text: {
switch(monthView.calendarViewDisplayed) {
case PlasmaCalendar.MonthView.CalendarView.DayView:
return i18n("Next month")
case PlasmaCalendar.MonthView.CalendarView.MonthView:
return i18n("Next year")
case PlasmaCalendar.MonthView.CalendarView.YearView:
return i18n("Next decade")
default:
return "";
}
}
}
}
}
}
// Left column containing agenda view and time zones
// ==================================================
ColumnLayout {
id: leftColumn
visible: calendar.showAgenda || calendar.showClocks
width: parent.width / 2 - 1
anchors {
left: parent.left
top: parent.top
bottom: parent.bottom
}
// Agenda view itself
Item {
id: agenda
visible: calendar.showAgenda
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumHeight: PlasmaCore.Units.gridUnit * 4
function formatDateWithoutYear(date) {
// Unfortunatelly Qt overrides ECMA's Date.toLocaleDateString(),
// which is able to return locale-specific date-and-month-only date
// formats, with its dumb version that only supports Qt::DateFormat
// enum subset. So to get a day-and-month-only date format string we
// must resort to this magic and hope there are no locales that use
// other separators...
var format = Qt.locale().dateFormat(Locale.ShortFormat).replace(/[./ ]*Y{2,4}[./ ]*/i, '');
return Qt.formatDate(date, format);
}
function dateEquals(date1, date2) {
const values1 = [
date1.getFullYear(),
date1.getMonth(),
date1.getDate()
];
const values2 = [
date2.getFullYear(),
date2.getMonth(),
date2.getDate()
];
return values1.every((value, index) => {
return (value === values2[index]);
}, false)
}
Connections {
target: monthView
function onCurrentDateChanged() {
// Apparently this is needed because this is a simple QList being
// returned and if the list for the current day has 1 event and the
// user clicks some other date which also has 1 event, QML sees the
// sizes match and does not update the labels with the content.
// Resetting the model to null first clears it and then correct data
// are displayed.
holidaysList.model = null;
holidaysList.model = monthView.daysModel.eventsForDate(monthView.currentDate);
}
}
Connections {
target: monthView.daysModel
function onAgendaUpdated(updatedDate) {
if (agenda.dateEquals(updatedDate, monthView.currentDate)) {
holidaysList.model = null;
holidaysList.model = monthView.daysModel.eventsForDate(monthView.currentDate);
}
}
}
Connections {
target: plasmoid.configuration
onEnabledCalendarPluginsChanged: {
PlasmaCalendar.EventPluginsManager.enabledPlugins = plasmoid.configuration.enabledCalendarPlugins;
}
}
Binding {
target: plasmoid
property: "hideOnWindowDeactivate"
value: !plasmoid.configuration.pin
restoreMode: Binding.RestoreBinding
}
TextMetrics {
id: dateLabelMetrics
// Date/time are arbitrary values with all parts being two-digit
readonly property string timeString: Qt.formatTime(new Date(2000, 12, 12, 12, 12, 12, 12))
readonly property string dateString: agenda.formatDateWithoutYear(new Date(2000, 12, 12, 12, 12, 12))
font: PlasmaCore.Theme.defaultFont
text: timeString.length > dateString.length ? timeString : dateString
}
PlasmaComponents3.ScrollView {
id: holidaysView
anchors.fill: parent
// HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890
PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff
ListView {
id: holidaysList
highlight: Item {}
delegate: PlasmaComponents3.ItemDelegate {
id: eventItem
width: holidaysList.width
padding: calendar.paddings
leftPadding: calendar.paddings + PlasmaCore.Units.smallSpacing * 2
text: eventTitle.text
hoverEnabled: true
property bool hasTime: {
// Explicitly all-day event
if (modelData.isAllDay) {
return false;
}
// Multi-day event which does not start or end today (so
// is all-day from today's point of view)
if (modelData.startDateTime - monthView.currentDate < 0 &&
modelData.endDateTime - monthView.currentDate > 86400000) { // 24hrs in ms
return false;
}
// Non-explicit all-day event
const startIsMidnight = modelData.startDateTime.getHours() === 0
&& modelData.startDateTime.getMinutes() === 0;
const endIsMidnight = modelData.endDateTime.getHours() === 0
&& modelData.endDateTime.getMinutes() === 0;
const sameDay = modelData.startDateTime.getDate() === modelData.endDateTime.getDate()
&& modelData.startDateTime.getDay() === modelData.endDateTime.getDay()
return !(startIsMidnight && endIsMidnight && sameDay);
}
PlasmaComponents3.ToolTip {
text: modelData.description
visible: text !== "" && eventItem.hovered
}
contentItem: GridLayout {
id: eventGrid
columns: 3
rows: 2
rowSpacing: 0
columnSpacing: 2 * PlasmaCore.Units.smallSpacing
Rectangle {
id: eventColor
Layout.row: 0
Layout.column: 0
Layout.rowSpan: 2
Layout.fillHeight: true
color: modelData.eventColor
width: 5 * PlasmaCore.Units.devicePixelRatio
visible: modelData.eventColor !== ""
}
PlasmaComponents3.Label {
id: startTimeLabel
readonly property bool startsToday: modelData.startDateTime - monthView.currentDate >= 0
readonly property bool startedYesterdayLessThan12HoursAgo: modelData.startDateTime - monthView.currentDate >= -43200000 //12hrs in ms
Layout.row: 0
Layout.column: 1
Layout.minimumWidth: dateLabelMetrics.width
text: startsToday || startedYesterdayLessThan12HoursAgo
? Qt.formatTime(modelData.startDateTime)
: agenda.formatDateWithoutYear(modelData.startDateTime)
horizontalAlignment: Qt.AlignRight
visible: eventItem.hasTime
}
PlasmaComponents3.Label {
id: endTimeLabel
readonly property bool endsToday: modelData.endDateTime - monthView.currentDate <= 86400000 // 24hrs in ms
readonly property bool endsTomorrowInLessThan12Hours: modelData.endDateTime - monthView.currentDate <= 86400000 + 43200000 // 36hrs in ms
Layout.row: 1
Layout.column: 1
Layout.minimumWidth: dateLabelMetrics.width
text: endsToday || endsTomorrowInLessThan12Hours
? Qt.formatTime(modelData.endDateTime)
: agenda.formatDateWithoutYear(modelData.endDateTime)
horizontalAlignment: Qt.AlignRight
opacity: 0.7
visible: eventItem.hasTime
}
PlasmaComponents3.Label {
id: eventTitle
Layout.row: 0
Layout.column: 2
Layout.fillWidth: true
elide: Text.ElideRight
text: modelData.title
verticalAlignment: Text.AlignVCenter
maximumLineCount: 2
}
}
}
}
}
PlasmaExtras.Heading {
anchors.fill: holidaysView
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.leftMargin: PlasmaCore.Units.largeSpacing
anchors.rightMargin: PlasmaCore.Units.largeSpacing
text: monthView.isToday(monthView.currentDate) ? i18n("No events for today")
: i18n("No events for this day");
level: 3
enabled: false
visible: holidaysList.count == 0
}
}
// Horizontal separator line between events and time zones
PlasmaCore.SvgItem {
visible: worldClocks.visible && agenda.visible
Layout.fillWidth: true
Layout.preferredHeight: naturalSize.height
elementId: "horizontal-line"
svg: PlasmaCore.Svg {
imagePath: "widgets/line"
}
}
// Clocks stuff
// ------------
// Header text + button to change time & timezone
PlasmaExtras.PlasmoidHeading {
visible: worldClocks.visible
leftInset: 0
rightInset: 0
rightPadding: PlasmaCore.Units.smallSpacing
contentItem: RowLayout {
PlasmaExtras.Heading {
Layout.leftMargin: calendar.paddings + PlasmaCore.Units.smallSpacing * 2
Layout.fillWidth: true
level: 2
text: i18n("Time Zones")
maximumLineCount: 1
elide: Text.ElideRight
}
PlasmaComponents3.ToolButton {
visible: KCMShell.authorize("kcm_clock.desktop").length > 0
text: i18n("Switch…")
icon.name: "preferences-system-time"
onClicked: KCMShell.openSystemSettings("kcm_clock")
PlasmaComponents3.ToolTip {
text: i18n("Switch to another timezone")
}
}
}
}
// Clocks view itself
PlasmaComponents3.ScrollView {
id: worldClocks
visible: calendar.showClocks
Layout.fillWidth: true
Layout.fillHeight: !agenda.visible
Layout.minimumHeight: visible ? PlasmaCore.Units.gridUnit * 7 : 0
Layout.maximumHeight: agenda.visible ? PlasmaCore.Units.gridUnit * 10 : -1
// HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890
PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff
ListView {
id: clocksList
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: PlasmaCore.Units.smallSpacing * 2
highlight: Item {}
model: {
let timezones = [];
for (let i = 0; i < plasmoid.configuration.selectedTimeZones.length; i++) {
timezones.push(plasmoid.configuration.selectedTimeZones[i]);
}
return timezones;
}
delegate: PlasmaComponents3.ItemDelegate {
id: listItem
readonly property bool isCurrentTimeZone: modelData === plasmoid.configuration.lastSelectedTimezone
width: clocksList.width
padding: calendar.paddings
leftPadding: calendar.paddings + PlasmaCore.Units.smallSpacing * 2
contentItem: RowLayout {
PlasmaComponents3.Label {
text: root.nameForZone(modelData)
font.weight: listItem.isCurrentTimeZone ? Font.Bold : Font.Normal
maximumLineCount: 1
elide: Text.ElideRight
}
PlasmaComponents3.Label {
Layout.fillWidth: true
horizontalAlignment: Qt.AlignRight
text: root.timeForZone(modelData)
font.weight: listItem.isCurrentTimeZone ? Font.Bold : Font.Normal
elide: Text.ElideRight
maximumLineCount: 1
}
}
}
}
}
}
// Vertical separator line between columns
// =======================================
PlasmaCore.SvgItem {
id: mainSeparator
visible: leftColumn.visible
anchors {
right: monthViewWrapper.left
top: parent.top
bottom: parent.bottom
}
width: 1
elementId: "vertical-line"
svg: PlasmaCore.Svg {
imagePath: "widgets/line"
}
}
// Right column containing calendar
// ===============================
FocusScope {
id: monthViewWrapper
width: calendar.showAgenda || calendar.showClocks ? parent.width / 2 : parent.width
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
PlasmaCalendar.MonthView {
id: monthView
anchors.margins: PlasmaCore.Units.smallSpacing
borderOpacity: 0.25
today: root.tzDate
firstDayOfWeek: plasmoid.configuration.firstDayOfWeek > -1
? plasmoid.configuration.firstDayOfWeek
: Qt.locale().firstDayOfWeek
showWeekNumbers: plasmoid.configuration.showWeekNumbers
showCustomHeader: true
}
}
}

View File

@ -0,0 +1,720 @@
/*
SPDX-FileCopyrightText: 2013 Heena Mahour <heena393@gmail.com>
SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
SPDX-FileCopyrightText: 2013 Martin Klapetek <mklapetek@kde.org>
SPDX-FileCopyrightText: 2014 David Edmundson <davidedmundson@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.6
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as Components // Date label height breaks on vertical panel with PC3 version
import org.kde.plasma.private.digitalclock 1.0
Item {
id: main
property string timeFormat
property date currentTime
property bool showSeconds: plasmoid.configuration.showSeconds
property bool showLocalTimezone: plasmoid.configuration.showLocalTimezone
property bool showDate: plasmoid.configuration.showDate
property var dateFormat: {
if (plasmoid.configuration.dateFormat === "custom") {
return plasmoid.configuration.customDateFormat; // str
} else if (plasmoid.configuration.dateFormat === "longDate") {
return Qt.SystemLocaleLongDate; // int
} else if (plasmoid.configuration.dateFormat === "isoDate") {
return Qt.ISODate; // int
} else { // "shortDate"
return Qt.SystemLocaleShortDate; // int
}
}
property string lastSelectedTimezone: plasmoid.configuration.lastSelectedTimezone
property int displayTimezoneFormat: plasmoid.configuration.displayTimezoneFormat
property int use24hFormat: plasmoid.configuration.use24hFormat
property string lastDate: ""
property int tzOffset
// This is the index in the list of user selected timezones
property int tzIndex: 0
// if showing the date and the time in one line or
// if the date/timezone cannot be fit with the smallest font to its designated space
property bool oneLineMode: {
if (plasmoid.configuration.dateDisplayFormat === 1) {
// BesideTime
return true;
} else if (plasmoid.configuration.dateDisplayFormat === 2) {
// BelowTime
return false;
} else {
// Adaptive
return plasmoid.formFactor === PlasmaCore.Types.Horizontal &&
main.height <= 2 * PlasmaCore.Theme.smallestFont.pixelSize &&
(main.showDate || timezoneLabel.visible);
}
}
onDateFormatChanged: {
setupLabels();
}
onDisplayTimezoneFormatChanged: { setupLabels(); }
onStateChanged: { setupLabels(); }
onLastSelectedTimezoneChanged: { timeFormatCorrection(Qt.locale().timeFormat(Locale.ShortFormat)) }
onShowSecondsChanged: { timeFormatCorrection(Qt.locale().timeFormat(Locale.ShortFormat)) }
onShowLocalTimezoneChanged: { timeFormatCorrection(Qt.locale().timeFormat(Locale.ShortFormat)) }
onShowDateChanged: { timeFormatCorrection(Qt.locale().timeFormat(Locale.ShortFormat)) }
onUse24hFormatChanged: { timeFormatCorrection(Qt.locale().timeFormat(Locale.ShortFormat)) }
Connections {
target: plasmoid
function onContextualActionsAboutToShow() {
ClipboardMenu.secondsIncluded = main.showSeconds;
ClipboardMenu.currentDate = main.currentTime;
}
}
Connections {
target: plasmoid.configuration
function onSelectedTimeZonesChanged() {
// If the currently selected timezone was removed,
// default to the first one in the list
var lastSelectedTimezone = plasmoid.configuration.lastSelectedTimezone;
if (plasmoid.configuration.selectedTimeZones.indexOf(lastSelectedTimezone) === -1) {
plasmoid.configuration.lastSelectedTimezone = plasmoid.configuration.selectedTimeZones[0];
}
setupLabels();
setTimezoneIndex();
}
}
states: [
State {
name: "horizontalPanel"
when: plasmoid.formFactor === PlasmaCore.Types.Horizontal && !main.oneLineMode
PropertyChanges {
target: main
Layout.fillHeight: true
Layout.fillWidth: false
Layout.minimumWidth: contentItem.width
Layout.maximumWidth: Layout.minimumWidth
}
PropertyChanges {
target: contentItem
height: timeLabel.height + (main.showDate || timezoneLabel.visible ? 0.8 * timeLabel.height : 0)
width: Math.max(timeLabel.paintedWidth + (main.showDate ? timezoneLabel.paintedWidth : 0),
timezoneLabel.paintedWidth, dateLabel.paintedWidth) + PlasmaCore.Units.smallSpacing * 2
}
PropertyChanges {
target: labelsGrid
rows: main.showDate ? 1 : 2
}
AnchorChanges {
target: labelsGrid
anchors.horizontalCenter: contentItem.horizontalCenter
}
PropertyChanges {
target: timeLabel
height: sizehelper.height
width: sizehelper.contentWidth
font.pixelSize: timeLabel.height
}
PropertyChanges {
target: timezoneLabel
height: main.showDate ? 0.7 * timeLabel.height : 0.8 * timeLabel.height
width: main.showDate ? timezoneLabel.paintedWidth : timeLabel.width
font.pixelSize: timezoneLabel.height
}
PropertyChanges {
target: dateLabel
height: 0.8 * timeLabel.height
width: dateLabel.paintedWidth
verticalAlignment: Text.AlignVCenter
font.pixelSize: dateLabel.height
}
AnchorChanges {
target: dateLabel
anchors.top: labelsGrid.bottom
anchors.horizontalCenter: labelsGrid.horizontalCenter
}
PropertyChanges {
target: sizehelper
/*
* The value 0.71 was picked by testing to give the clock the right
* size (aligned with tray icons).
* Value 0.56 seems to be chosen rather arbitrary as well such that
* the time label is slightly larger than the date or timezone label
* and still fits well into the panel with all the applied margins.
*/
height: Math.min(main.showDate || timezoneLabel.visible ? main.height * 0.56 : main.height * 0.71,
3 * PlasmaCore.Theme.defaultFont.pixelSize)
font.pixelSize: sizehelper.height
}
},
State {
name: "oneLineDate"
// the one-line mode has no effect on a vertical panel because it would never fit
when: plasmoid.formFactor !== PlasmaCore.Types.Vertical && main.oneLineMode
PropertyChanges {
target: main
Layout.fillHeight: true
Layout.fillWidth: false
Layout.minimumWidth: contentItem.width
Layout.maximumWidth: Layout.minimumWidth
}
PropertyChanges {
target: contentItem
height: sizehelper.height
width: dateLabel.width + dateLabel.anchors.rightMargin + labelsGrid.width
}
AnchorChanges {
target: labelsGrid
anchors.right: contentItem.right
}
PropertyChanges {
target: dateLabel
height: timeLabel.height
width: dateLabel.paintedWidth + PlasmaCore.Units.smallSpacing
font.pixelSize: 1024
verticalAlignment: Text.AlignVCenter
anchors.rightMargin: labelsGrid.columnSpacing
fontSizeMode: Text.VerticalFit
}
AnchorChanges {
target: dateLabel
anchors.right: labelsGrid.left
anchors.verticalCenter: labelsGrid.verticalCenter
}
PropertyChanges {
target: timeLabel
height: sizehelper.height
width: sizehelper.contentWidth
fontSizeMode: Text.VerticalFit
}
PropertyChanges {
target: timezoneLabel
height: 0.7 * timeLabel.height
width: timezoneLabel.paintedWidth
fontSizeMode: Text.VerticalFit
horizontalAlignment: Text.AlignHCenter
}
PropertyChanges {
target: sizehelper
height: Math.min(main.height, 3 * PlasmaCore.Theme.defaultFont.pixelSize)
fontSizeMode: Text.VerticalFit
font.pixelSize: 3 * PlasmaCore.Theme.defaultFont.pixelSize
}
},
State {
name: "verticalPanel"
when: plasmoid.formFactor === PlasmaCore.Types.Vertical
PropertyChanges {
target: main
Layout.fillHeight: false
Layout.fillWidth: true
Layout.maximumHeight: contentItem.height
Layout.minimumHeight: Layout.maximumHeight
}
PropertyChanges {
target: contentItem
height: main.showDate ? labelsGrid.height + dateLabel.contentHeight : labelsGrid.height
width: main.width
}
PropertyChanges {
target: labelsGrid
rows: 2
}
PropertyChanges {
target: timeLabel
height: sizehelper.contentHeight
width: main.width
font.pixelSize: Math.min(timeLabel.height, 3 * PlasmaCore.Theme.defaultFont.pixelSize)
fontSizeMode: Text.HorizontalFit
}
PropertyChanges {
target: timezoneLabel
height: Math.max(0.7 * timeLabel.height, minimumPixelSize)
width: main.width
fontSizeMode: Text.Fit
minimumPixelSize: dateLabel.minimumPixelSize
elide: Text.ElideRight
}
PropertyChanges {
target: dateLabel
width: main.width
//NOTE: in order for Text.Fit to work as intended, the actual height needs to be quite big, in order for the font to enlarge as much it needs for the available width, and then request a sensible height, for which contentHeight will need to be considered as opposed to height
height: PlasmaCore.Units.gridUnit * 10
fontSizeMode: Text.Fit
verticalAlignment: Text.AlignTop
// Those magic numbers are purely what looks nice as maximum size, here we have it the smallest
// between slightly bigger than the default font (1.4 times) and a bit smaller than the time font
font.pixelSize: Math.min(0.7 * timeLabel.height, PlasmaCore.Theme.defaultFont.pixelSize * 1.4)
elide: Text.ElideRight
wrapMode: Text.WordWrap
}
AnchorChanges {
target: dateLabel
anchors.top: labelsGrid.bottom
anchors.horizontalCenter: labelsGrid.horizontalCenter
}
PropertyChanges {
target: sizehelper
width: main.width
fontSizeMode: Text.HorizontalFit
font.pixelSize: 3 * PlasmaCore.Theme.defaultFont.pixelSize
}
},
State {
name: "other"
when: plasmoid.formFactor !== PlasmaCore.Types.Vertical && plasmoid.formFactor !== PlasmaCore.Types.Horizontal
PropertyChanges {
target: main
Layout.fillHeight: false
Layout.fillWidth: false
Layout.minimumWidth: PlasmaCore.Units.gridUnit * 3
Layout.minimumHeight: PlasmaCore.Units.gridUnit * 3
}
PropertyChanges {
target: contentItem
height: main.height
width: main.width
}
PropertyChanges {
target: labelsGrid
rows: 2
}
PropertyChanges {
target: timeLabel
height: sizehelper.height
width: main.width
fontSizeMode: Text.Fit
}
PropertyChanges {
target: timezoneLabel
height: 0.7 * timeLabel.height
width: main.width
fontSizeMode: Text.Fit
minimumPixelSize: 1
}
PropertyChanges {
target: dateLabel
height: 0.7 * timeLabel.height
font.pixelSize: 1024
width: Math.max(timeLabel.contentWidth, PlasmaCore.Units.gridUnit * 3)
verticalAlignment: Text.AlignVCenter
fontSizeMode: Text.Fit
minimumPixelSize: 1
wrapMode: Text.WordWrap
}
AnchorChanges {
target: dateLabel
anchors.top: labelsGrid.bottom
anchors.horizontalCenter: labelsGrid.horizontalCenter
}
PropertyChanges {
target: sizehelper
height: {
if (main.showDate) {
if (timezoneLabel.visible) {
return 0.4 * main.height
}
return 0.56 * main.height
} else if (timezoneLabel.visible) {
return 0.59 * main.height
}
return main.height
}
width: main.width
fontSizeMode: Text.Fit
font.pixelSize: 1024
}
}
]
MouseArea {
anchors.fill: parent
property int wheelDelta: 0
onClicked: plasmoid.expanded = !plasmoid.expanded
onWheel: {
if (!plasmoid.configuration.wheelChangesTimezone) {
return;
}
var delta = wheel.angleDelta.y || wheel.angleDelta.x
var newIndex = main.tzIndex;
wheelDelta += delta;
// magic number 120 for common "one click"
// See: https://doc.qt.io/qt-5/qml-qtquick-wheelevent.html#angleDelta-prop
while (wheelDelta >= 120) {
wheelDelta -= 120;
newIndex--;
}
while (wheelDelta <= -120) {
wheelDelta += 120;
newIndex++;
}
if (newIndex >= plasmoid.configuration.selectedTimeZones.length) {
newIndex = 0;
} else if (newIndex < 0) {
newIndex = plasmoid.configuration.selectedTimeZones.length - 1;
}
if (newIndex !== main.tzIndex) {
plasmoid.configuration.lastSelectedTimezone = plasmoid.configuration.selectedTimeZones[newIndex];
main.tzIndex = newIndex;
dataSource.dataChanged();
setupLabels();
}
}
}
/*
* Visible elements
*
*/
Item {
id: contentItem
anchors.verticalCenter: main.verticalCenter
Grid {
id: labelsGrid
rows: 1
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
flow: Grid.TopToBottom
columnSpacing: PlasmaCore.Units.smallSpacing
Components.Label {
id: timeLabel
font {
family: plasmoid.configuration.fontFamily || PlasmaCore.Theme.defaultFont.family
weight: plasmoid.configuration.boldText ? Font.Bold : PlasmaCore.Theme.defaultFont.weight
italic: plasmoid.configuration.italicText
pixelSize: 1024
pointSize: -1 // Because we're setting the pixel size instead
// TODO: remove once this label is ported to PC3
}
minimumPixelSize: 1
text: {
// get the time for the given timezone from the dataengine
var now = dataSource.data[plasmoid.configuration.lastSelectedTimezone]["DateTime"];
// get current UTC time
var msUTC = now.getTime() + (now.getTimezoneOffset() * 60000);
// add the dataengine TZ offset to it
var currentTime = new Date(msUTC + (dataSource.data[plasmoid.configuration.lastSelectedTimezone]["Offset"] * 1000));
main.currentTime = currentTime;
return Qt.formatTime(currentTime, main.timeFormat);
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
Components.Label {
id: timezoneLabel
font.weight: timeLabel.font.weight
font.italic: timeLabel.font.italic
font.pixelSize: 1024
font.pointSize: -1 // Because we're setting the pixel size instead
// TODO: remove once this label is ported to PC3
minimumPixelSize: 1
visible: text.length > 0
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
Components.Label {
id: dateLabel
visible: main.showDate
font.family: timeLabel.font.family
font.weight: timeLabel.font.weight
font.italic: timeLabel.font.italic
font.pixelSize: 1024
font.pointSize: -1 // Because we're setting the pixel size instead
// TODO: remove once this label is ported to PC3
minimumPixelSize: 1
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
/*
* end: Visible Elements
*
*/
Components.Label {
id: sizehelper
font.family: timeLabel.font.family
font.weight: timeLabel.font.weight
font.italic: timeLabel.font.italic
minimumPixelSize: 1
visible: false
}
FontMetrics {
id: timeMetrics
font.family: timeLabel.font.family
font.weight: timeLabel.font.weight
font.italic: timeLabel.font.italic
}
// Qt's QLocale does not offer any modular time creating like Klocale did
// eg. no "gimme time with seconds" or "gimme time without seconds and with timezone".
// QLocale supports only two formats - Long and Short. Long is unusable in many situations
// and Short does not provide seconds. So if seconds are enabled, we need to add it here.
//
// What happens here is that it looks for the delimiter between "h" and "m", takes it
// and appends it after "mm" and then appends "ss" for the seconds.
function timeFormatCorrection(timeFormatString) {
var regexp = /(hh*)(.+)(mm)/i
var match = regexp.exec(timeFormatString);
var hours = match[1];
var delimiter = match[2];
var minutes = match[3]
var seconds = "ss";
var amPm = "AP";
var uses24hFormatByDefault = timeFormatString.toLowerCase().indexOf("ap") === -1;
// because QLocale is incredibly stupid and does not convert 12h/24h clock format
// when uppercase H is used for hours, needs to be h or hh, so toLowerCase()
var result = hours.toLowerCase() + delimiter + minutes;
if (main.showSeconds) {
result += delimiter + seconds;
}
// add "AM/PM" either if the setting is the default and locale uses it OR if the user unchecked "use 24h format"
if ((main.use24hFormat == Qt.PartiallyChecked && !uses24hFormatByDefault) || main.use24hFormat == Qt.Unchecked) {
result += " " + amPm;
}
main.timeFormat = result;
setupLabels();
}
function setupLabels() {
var showTimezone = main.showLocalTimezone || (plasmoid.configuration.lastSelectedTimezone !== "Local"
&& dataSource.data["Local"]["Timezone City"] !== dataSource.data[plasmoid.configuration.lastSelectedTimezone]["Timezone City"]);
var timezoneString = "";
if (showTimezone) {
// format timezone as tz code, city or UTC offset
if (displayTimezoneFormat === 0) {
timezoneString = dataSource.data[lastSelectedTimezone]["Timezone Abbreviation"]
} else if (displayTimezoneFormat === 1) {
timezoneString = TimezonesI18n.i18nCity(dataSource.data[lastSelectedTimezone]["Timezone City"]);
} else if (displayTimezoneFormat === 2) {
var lastOffset = dataSource.data[lastSelectedTimezone]["Offset"];
var symbol = lastOffset > 0 ? '+' : '';
var hours = Math.floor(lastOffset / 3600);
var minutes = Math.floor(lastOffset % 3600 / 60);
timezoneString = "UTC" + symbol + hours.toString().padStart(2, '0') + ":" + minutes.toString().padStart(2, '0');
}
timezoneLabel.text = (main.showDate || main.oneLineMode) && plasmoid.formFactor === PlasmaCore.Types.Horizontal ? "(" + timezoneString + ")" : timezoneString;
} else {
// this clears the label and that makes it hidden
timezoneLabel.text = timezoneString;
}
if (main.showDate) {
dateLabel.text = Qt.formatDate(main.currentTime, main.dateFormat);
} else {
// clear it so it doesn't take space in the layout
dateLabel.text = "";
}
// find widest character between 0 and 9
var maximumWidthNumber = 0;
var maximumAdvanceWidth = 0;
for (var i = 0; i <= 9; i++) {
var advanceWidth = timeMetrics.advanceWidth(i);
if (advanceWidth > maximumAdvanceWidth) {
maximumAdvanceWidth = advanceWidth;
maximumWidthNumber = i;
}
}
// replace all placeholders with the widest number (two digits)
var format = main.timeFormat.replace(/(h+|m+|s+)/g, "" + maximumWidthNumber + maximumWidthNumber); // make sure maximumWidthNumber is formatted as string
// build the time string twice, once with an AM time and once with a PM time
var date = new Date(2000, 0, 1, 1, 0, 0);
var timeAm = Qt.formatTime(date, format);
var advanceWidthAm = timeMetrics.advanceWidth(timeAm);
date.setHours(13);
var timePm = Qt.formatTime(date, format);
var advanceWidthPm = timeMetrics.advanceWidth(timePm);
// set the sizehelper's text to the widest time string
if (advanceWidthAm > advanceWidthPm) {
sizehelper.text = timeAm;
} else {
sizehelper.text = timePm;
}
}
function dateTimeChanged()
{
var doCorrections = false;
if (main.showDate) {
// If the date has changed, force size recalculation, because the day name
// or the month name can now be longer/shorter, so we need to adjust applet size
const currentDate = Qt.formatDateTime(dataSource.data["Local"]["DateTime"], "yyyy-MM-dd");
if (main.lastDate !== currentDate) {
doCorrections = true;
main.lastDate = currentDate
}
}
var currentTZOffset = dataSource.data["Local"]["Offset"] / 60;
if (currentTZOffset !== tzOffset) {
doCorrections = true;
tzOffset = currentTZOffset;
Date.timeZoneUpdated(); // inform the QML JS engine about TZ change
}
if (doCorrections) {
timeFormatCorrection(Qt.locale().timeFormat(Locale.ShortFormat));
}
}
function setTimezoneIndex() {
for (var i = 0; i < plasmoid.configuration.selectedTimeZones.length; i++) {
if (plasmoid.configuration.selectedTimeZones[i] === plasmoid.configuration.lastSelectedTimezone) {
main.tzIndex = i;
break;
}
}
}
Component.onCompleted: {
// Sort the timezones according to their offset
// Calling sort() directly on plasmoid.configuration.selectedTimeZones
// has no effect, so sort a copy and then assign the copy to it
var sortArray = plasmoid.configuration.selectedTimeZones;
sortArray.sort(function(a, b) {
return dataSource.data[a]["Offset"] - dataSource.data[b]["Offset"];
});
plasmoid.configuration.selectedTimeZones = sortArray;
setTimezoneIndex();
tzOffset = -(new Date().getTimezoneOffset());
dateTimeChanged();
timeFormatCorrection(Qt.locale().timeFormat(Locale.ShortFormat));
dataSource.onDataChanged.connect(dateTimeChanged);
}
}

View File

@ -0,0 +1,9 @@
/*
SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import org.kde.plasma.calendar 2.0 as PlasmaCalendar
PlasmaCalendar.MonthMenu { }

Some files were not shown because too many files have changed in this diff Show More