Adding upstream version 0.9.0.

Signed-off-by: Andrew Lee (李健秋) <ajqlee@debian.org>
ubuntu/bionic upstream/0.9.0
Andrew Lee (李健秋) 9 years ago
commit 512032c43f
No known key found for this signature in database
GPG Key ID: 9D0633E1B6250985

1
.gitignore vendored

@ -0,0 +1 @@
build

@ -0,0 +1,10 @@
Upstream Authors:
LXQt team: http://lxqt.org
Razor team: http://razor-qt.org
Copyright:
Copyright (c) 2010-2012 Razor team
Copyright (c) 2012-2014 LXQt team
License: GPL-2 and LGPL-2.1+
The full text of the licenses can be found in the 'COPYING' file.

@ -0,0 +1,81 @@
cmake_minimum_required(VERSION 2.8.11)
project(lxqt-globalkeys)
# additional cmake files
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# Set default library installation path
set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Installation directory for libraries")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5DBus REQUIRED)
find_package(Qt5LinguistTools REQUIRED QUIET)
find_package(lxqt REQUIRED QUIET)
include(${LXQT_USE_FILE})
include(LXQtTranslate)
# Standard directories for installation
include(GNUInstallDirs)
set(LXQT_GLOBALKEYS_LIBRARY_NAME lxqt-globalkeys)
set(LXQT_GLOBALKEYS_UI_LIBRARY_NAME lxqt-globalkeys-ui)
set(LXQT_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/cmake)
#************************************************
# Build config.cmake files
#************************************************
#set(LXQT_SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/lxqt)
#set(LXQT_TRANSLATIONS_DIR ${LXQT_SHARE_DIR}/translations)
include(cmake/FindInstallConfigPath.cmake)
set(LXQT_GLOBALKEYS_CMAKE_NAME ${LXQT_GLOBALKEYS_LIBRARY_NAME})
set(LXQT_GLOBALKEYS_UI_CMAKE_NAME ${LXQT_GLOBALKEYS_UI_LIBRARY_NAME})
set(LXQT_GLOBALKEYS_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include/${LXQT_GLOBALKEYS_LIBRARY_NAME}")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt_globalkeys-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME}-config.cmake"
@ONLY
)
set(LXQT_GLOBALKEYS_UI_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include/${LXQT_GLOBALKEYS_UI_LIBRARY_NAME})
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt_globalkeys_ui-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME}-config.cmake"
@ONLY
)
#************************************************
# End of build config.cmake
#************************************************
set(LXQT_GLOBALKEYS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
add_subdirectory(daemon)
add_subdirectory(config)
add_subdirectory(client)
add_subdirectory(ui)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME}-config.cmake DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME})
install(FILES cmake/lxqt_globalkeys_use.cmake DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_CMAKE_NAME})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME}-config.cmake DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME})
install(FILES cmake/lxqt_globalkeys_ui_use.cmake DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_GLOBALKEYS_UI_CMAKE_NAME})
# building tarball with CPack -------------------------------------------------
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_VERSION_MAJOR ${LXQT_MAJOR_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR ${LXQT_MINOR_VERSION})
set(CPACK_PACKAGE_VERSION_PATCH ${LXQT_PATCH_VERSION})
set(CPACK_GENERATOR TBZ2)
set(CPACK_SOURCE_GENERATOR TBZ2)
set(CPACK_SOURCE_IGNORE_FILES /build/;.gitignore;.*~;.git;.kdev4;temp)
include(CPack)

@ -0,0 +1,461 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 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 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.
GNU LESSER GENERAL PUBLIC LICENSE
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

@ -0,0 +1,177 @@
set(PROJECT_NAME ${LXQT_GLOBALKEYS_LIBRARY_NAME})
project(${PROJECT_NAME})
set(QT_DBUS_PREFIX "org.qtproject")
set(${PROJECT_NAME}_HEADER_NAMESPACE "LXQtGlobalKeys")
include_directories(
${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
set(${PROJECT_NAME}_PATH_TO_DAEMON "${LXQT_GLOBALKEYS_SOURCE_DIR}/daemon")
add_definitions(-DSHARED_EXPORT=Q_DECL_EXPORT)
set(${PROJECT_NAME}_SOURCES
client.cpp
action.cpp
)
#
# WARNING: Changing stuff here implies changing this:
# install(FILES ${${PROJECT_NAME}_MAIN_HEADER} DESTINATION include/${PROJECT_NAME} COMPONENT development RENAME "lxqtglobalkeys.h")
#
set(${PROJECT_NAME}_MAIN_HEADER
lxqt-globalkeys.h
)
set(${PROJECT_NAME}_PUBLIC_CPP_HEADERS
client.h
action.h
)
set(${PROJECT_NAME}_PUBLIC_CLASSES
Client
Action
LXQtGlobalKeys
)
set(${PROJECT_NAME}_PRIVATE_CPP_HEADERS
client_p.h
action_p.h
)
set(${PROJECT_NAME}_FORMS
)
set(${PROJECT_NAME}_RESOURCES
)
set(${PROJECT_NAME}_TRANSLATIONS
)
set(${PROJECT_NAME}_DBUS_ADAPTORS
${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.client.xml
)
set_source_files_properties(${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.client.xml PROPERTIES
INCLUDE action_p.h
PARENT_CLASSNAME GlobalKeyShortcut::ActionImpl
BASENAME org.lxqt.global_key_shortcuts.client
CLASSNAME OrgLxqtActionClientAdaptor
)
set(${PROJECT_NAME}_DBUS_INTERFACES
${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.native.xml
)
set_source_files_properties(${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.native.xml PROPERTIES
BASENAME org.lxqt.global_key_shortcuts.native
)
set(${PROJECT_NAME}_PUBLIC_HEADERS
${${PROJECT_NAME}_PUBLIC_CPP_HEADERS}
)
set(${PROJECT_NAME}_PRIVATE_HEADERS
${${PROJECT_NAME}_PRIVATE_CPP_HEADERS}
)
set(${PROJECT_NAME}_CPP_HEADERS
${${PROJECT_NAME}_PUBLIC_CPP_HEADERS}
${${PROJECT_NAME}_PRIVATE_CPP_HEADERS}
)
set(${PROJECT_NAME}_HEADERS
${${PROJECT_NAME}_PUBLIC_HEADERS}
${${PROJECT_NAME}_PRIVATE_HEADERS}
)
set(${PROJECT_NAME}_TRANSLATABLE
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS}
${${PROJECT_NAME}_FORMS}
)
foreach(DBUS_ADAPTOR ${${PROJECT_NAME}_DBUS_ADAPTORS})
get_filename_component(DBUS_ADAPTOR_FILENAME ${DBUS_ADAPTOR} NAME)
configure_file(
${DBUS_ADAPTOR}
"${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}"
@ONLY
)
get_source_file_property(DBUS_ADAPTOR_INCLUDE ${DBUS_ADAPTOR} INCLUDE)
get_source_file_property(DBUS_ADAPTOR_PARENT_CLASSNAME ${DBUS_ADAPTOR} PARENT_CLASSNAME)
get_source_file_property(DBUS_ADAPTOR_BASENAME ${DBUS_ADAPTOR} BASENAME)
get_source_file_property(DBUS_ADAPTOR_CLASSNAME ${DBUS_ADAPTOR} CLASSNAME)
if(DBUS_ADAPTOR_BASENAME)
if(DBUS_ADAPTOR_CLASSNAME)
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}" ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME} ${DBUS_ADAPTOR_BASENAME} ${DBUS_ADAPTOR_CLASSNAME})
else()
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}" ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME} ${DBUS_ADAPTOR_BASENAME})
endif()
else()
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}" ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME})
endif()
endforeach()
foreach(DBUS_INTERFACE ${${PROJECT_NAME}_DBUS_INTERFACES})
get_filename_component(DBUS_INTERFACE_FILENAME ${DBUS_INTERFACE} NAME)
configure_file(
${DBUS_INTERFACE}
"${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}"
@ONLY
)
get_source_file_property(DBUS_INTERFACE_BASENAME ${DBUS_INTERFACE} BASENAME)
get_source_file_property(DBUS_INTERFACE_INCLUDE ${DBUS_INTERFACE} INCLUDE)
get_source_file_property(DBUS_INTERFACE_CLASSNAME ${DBUS_INTERFACE} CLASSNAME)
get_source_file_property(DBUS_INTERFACE_NO_NAMESPACE ${DBUS_INTERFACE} NO_NAMESPACE)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} PROPERTIES
INCLUDE ${DBUS_INTERFACE_INCLUDE}
CLASSNAME ${DBUS_INTERFACE_CLASSNAME}
NO_NAMESPACE ${DBUS_INTERFACE_NO_NAMESPACE}
)
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} ${DBUS_INTERFACE_BASENAME})
endforeach()
qt5_add_resources(${PROJECT_NAME}_RESOURCE_FILES ${${PROJECT_NAME}_RESOURCES})
qt5_wrap_ui(${PROJECT_NAME}_FORM_FILES ${${PROJECT_NAME}_FORMS})
set(${PROJECT_NAME}_GENERATED_FILES
${${PROJECT_NAME}_FORM_FILES}
${${PROJECT_NAME}_RESOURCE_FILES}
${${PROJECT_NAME}_QM_FILES}
${${PROJECT_NAME}_DBUS_INTERFACE_FILES}
${${PROJECT_NAME}_DBUS_ADAPTOR_FILES}
)
set(${PROJECT_NAME}_ALL_FILES
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS}
${${PROJECT_NAME}_GENERATED_FILES}
)
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_ALL_FILES})
target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::DBus)
set_target_properties(${PROJECT_NAME}
PROPERTIES
VERSION ${LXQT_VERSION}
SOVERSION ${LXQT_MAJOR_VERSION}
)
include(create_portable_headers)
create_portable_headers(${PROJECT_NAME}_PORTABLE_HEADERS
NAMESPACE "${${PROJECT_NAME}_NAMESPACE}/"
FILENAMES ${${PROJECT_NAME}_PUBLIC_CLASSES}
)
install(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT runtime)
install(FILES ${${PROJECT_NAME}_MAIN_HEADER} DESTINATION include/${PROJECT_NAME} COMPONENT development)
install(FILES ${${PROJECT_NAME}_MAIN_HEADER} DESTINATION include/${PROJECT_NAME} COMPONENT development RENAME "lxqtglobalkeys.h")
install(FILES ${${PROJECT_NAME}_PORTABLE_HEADERS} DESTINATION include/${PROJECT_NAME}/${${PROJECT_NAME}_HEADER_NAMESPACE} COMPONENT development)
install(FILES ${${PROJECT_NAME}_PUBLIC_HEADERS} DESTINATION include/${PROJECT_NAME} COMPONENT development)
include(create_pkgconfig_file)
create_pkgconfig_file(${PROJECT_NAME} "LXQt global key shortcuts client library")

@ -0,0 +1,130 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "action.h"
#include "action_p.h"
#include "client_p.h"
#include "org.lxqt.global_key_shortcuts.client.h"
namespace GlobalKeyShortcut
{
ActionImpl::ActionImpl(ClientImpl *client, Action *interface, const QString &path, const QString &description, QObject *parent)
: QObject(parent)
, mClient(client)
, mInterface(interface)
, mPath(path)
, mDescription(description)
{
new OrgLxqtActionClientAdaptor(this);
connect(this, SIGNAL(emitActivated()), mInterface, SIGNAL(activated()));
connect(this, SIGNAL(emitShortcutChanged(QString, QString)), mInterface, SIGNAL(shortcutChanged(QString, QString)));
}
ActionImpl::~ActionImpl()
{
mClient->removeAction(this);
}
QString ActionImpl::changeShortcut(const QString &shortcut)
{
mShortcut = mClient->changeClientActionShortcut(mPath, shortcut);
return mShortcut;
}
bool ActionImpl::changeDescription(const QString &description)
{
bool result = mClient->modifyClientAction(mPath, description);
if (result)
{
mDescription = description;
}
return result;
}
void ActionImpl::setShortcut(const QString &shortcut)
{
mShortcut = shortcut;
}
QString ActionImpl::path() const
{
return mPath;
}
QString ActionImpl::shortcut() const
{
return mShortcut;
}
QString ActionImpl::description() const
{
return mDescription;
}
void ActionImpl::setValid(bool valid)
{
mValid = valid;
}
bool ActionImpl::isValid() const
{
return mValid;
}
void ActionImpl::activated()
{
emit emitActivated();
}
void ActionImpl::shortcutChanged(const QString &oldShortcut, const QString &newShortcut)
{
emit emitShortcutChanged(oldShortcut, newShortcut);
}
Action::Action(QObject *parent)
: QObject(parent)
, impl(0)
{
}
Action::~Action()
{
}
QString Action::changeShortcut(const QString &shortcut) { return impl->changeShortcut(shortcut); }
bool Action::changeDescription(const QString &description) { return impl->changeDescription(description); }
QString Action::path() const { return impl->path(); }
QString Action::shortcut() const { return impl->shortcut(); }
QString Action::description() const { return impl->description(); }
bool Action::isValid() const { return impl->isValid(); }
}

@ -0,0 +1,78 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_KEY_SHORTCUT_CLIENT__ACTION__INCLUDED
#define GLOBAL_KEY_SHORTCUT_CLIENT__ACTION__INCLUDED
#include <QtGlobal>
#include <QObject>
#include <QString>
namespace GlobalKeyShortcut
{
class ActionImpl;
class ClientImpl;
#ifndef SHARED_EXPORT
#define SHARED_EXPORT Q_DECL_IMPORT
#endif
class SHARED_EXPORT Action : public QObject
{
Q_OBJECT
friend class ActionImpl;
friend class ClientImpl;
public:
~Action();
QString changeShortcut(const QString &shortcut);
bool changeDescription(const QString &description);
QString path() const;
QString shortcut() const;
QString description() const;
bool isValid() const;
signals:
void activated();
void shortcutChanged(const QString &oldShortcut, const QString &newShortcut);
private:
Action(QObject *parent = 0);
ActionImpl *impl;
};
}
#endif // GLOBAL_KEY_SHORTCUT_CLIENT__ACTION__INCLUDED

@ -0,0 +1,83 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_KEY_SHORTCUT_CLIENT__ACTION__IMPL__INCLUDED
#define GLOBAL_KEY_SHORTCUT_CLIENT__ACTION__IMPL__INCLUDED
#include <QObject>
#include <QString>
#include <QMap>
#include <QSharedPointer>
namespace GlobalKeyShortcut
{
class Action;
class ClientImpl;
class ActionImpl : public QObject
{
Q_OBJECT
public:
ActionImpl(ClientImpl *client, Action *interface, const QString &path, const QString &description, QObject *parent = 0);
~ActionImpl();
QString changeShortcut(const QString &shortcut);
bool changeDescription(const QString &description);
void setShortcut(const QString &shortcut);
QString path() const;
QString shortcut() const;
QString description() const;
void setValid(bool valid);
bool isValid() const;
public slots:
void activated();
void shortcutChanged(const QString &oldShortcut, const QString &newShortcut);
signals:
void emitActivated();
void emitShortcutChanged(const QString &oldShortcut, const QString &newShortcut);
private:
ClientImpl *mClient;
Action *mInterface;
QString mAlias;
QString mPath;
QString mShortcut;
QString mDescription;
bool mValid;
};
}
#endif // GLOBAL_KEY_SHORTCUT_CLIENT__ACTION__IMPL__INCLUDED

@ -0,0 +1,300 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "client.h"
#include "client_p.h"
#include "action_p.h"
#include "org.lxqt.global_key_shortcuts.native.h"
#include <QDBusConnection>
namespace GlobalKeyShortcut
{
ClientImpl::ClientImpl(Client *interface, QObject *parent)
: QObject(parent)
, mInterface(interface)
, mServiceWatcher(new QDBusServiceWatcher("org.lxqt.global_key_shortcuts", QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this))
, mDaemonPresent(false)
{
connect(mServiceWatcher, SIGNAL(serviceUnregistered(QString)), this, SLOT(daemonDisappeared(QString)));
connect(mServiceWatcher, SIGNAL(serviceRegistered(QString)), this, SLOT(daemonAppeared(QString)));
mProxy = new org::lxqt::global_key_shortcuts::native("org.lxqt.global_key_shortcuts", "/native", QDBusConnection::sessionBus(), this);
mDaemonPresent = mProxy->isValid();
connect(this, SIGNAL(emitShortcutGrabbed(QString)), mInterface, SIGNAL(shortcutGrabbed(QString)));
connect(this, SIGNAL(emitGrabShortcutFailed()), mInterface, SIGNAL(grabShortcutFailed()));
connect(this, SIGNAL(emitGrabShortcutCancelled()), mInterface, SIGNAL(grabShortcutCancelled()));
connect(this, SIGNAL(emitGrabShortcutTimedout()), mInterface, SIGNAL(grabShortcutTimedout()));
connect(this, SIGNAL(emitDaemonDisappeared()), mInterface, SIGNAL(daemonDisappeared()));
connect(this, SIGNAL(emitDaemonAppeared()), mInterface, SIGNAL(daemonAppeared()));
connect(this, SIGNAL(emitDaemonPresenceChanged(bool)), mInterface, SIGNAL(daemonPresenceChanged(bool)));
}
ClientImpl::~ClientImpl()
{
QMap<QString, Action*>::iterator M = mActions.end();
for (QMap<QString, Action*>::iterator I = mActions.begin(); I != M; ++I)
{
QDBusConnection::sessionBus().unregisterObject(QString("/global_key_shortcuts") + I.key());
delete I.value();
}
mActions.clear();
}
void ClientImpl::daemonDisappeared(const QString &)
{
mDaemonPresent = false;
emit emitDaemonDisappeared();
emit emitDaemonPresenceChanged(mDaemonPresent);
}
void ClientImpl::daemonAppeared(const QString &)
{
QMap<QString, Action*>::iterator last = mActions.end();
for (QMap<QString, Action*>::iterator I = mActions.begin(); I != last; ++I)
{
ActionImpl *globalActionImpl = I.value()->impl;
QDBusPendingReply<QString, qulonglong> reply = mProxy->addClientAction(globalActionImpl->shortcut(), QDBusObjectPath(globalActionImpl->path()), globalActionImpl->description());
reply.waitForFinished();
globalActionImpl->setValid(!reply.isError() && reply.argumentAt<1>());
if (globalActionImpl->isValid())
{
globalActionImpl->setShortcut(reply.argumentAt<0>());
}
}
mDaemonPresent = true;
emit emitDaemonAppeared();
emit emitDaemonPresenceChanged(mDaemonPresent);
}
bool ClientImpl::isDaemonPresent() const
{
return mDaemonPresent;
}
Action *ClientImpl::addClientAction(const QString &shortcut, const QString &path, const QString &description, QObject *parent)
{
if (!QRegExp("(/[A-Za-z0-9_]+){2,}").exactMatch(path))
{
return 0;
}
if (mActions.contains(path))
{
return 0;
}
Action *globalAction = new Action(parent);
ActionImpl *globalActionImpl = new ActionImpl(this, globalAction, path, description, globalAction);
globalAction->impl = globalActionImpl;
if (!QDBusConnection::sessionBus().registerObject(QString("/global_key_shortcuts") + path, globalActionImpl))
{
return 0;
}
if (mDaemonPresent)
{
QDBusPendingReply<QString, qulonglong> reply = mProxy->addClientAction(shortcut, QDBusObjectPath(path), description);
reply.waitForFinished();
globalActionImpl->setValid(!reply.isError() && reply.argumentAt<1>());
if (globalActionImpl->isValid())
{
globalActionImpl->setShortcut(reply.argumentAt<0>());
}
}
else
{
globalActionImpl->setValid(false);
}
mActions[path] = globalAction;
return globalAction;
}
void removeAction(Action *action);
QString ClientImpl::changeClientActionShortcut(const QString &path, const QString &shortcut)
{
if (!mActions.contains(path))
{
return QString();
}
QDBusPendingReply<QString> reply = mProxy->changeClientActionShortcut(QDBusObjectPath(path), shortcut);
reply.waitForFinished();
if (reply.isError())
{
return QString();
}
return reply.argumentAt<0>();
}
bool ClientImpl::modifyClientAction(const QString &path, const QString &description)
{
if (!mActions.contains(path))
{
return false;
}
QDBusPendingReply<bool> reply = mProxy->modifyClientAction(QDBusObjectPath(path), description);
reply.waitForFinished();
if (reply.isError())
{
return false;
}
return reply.argumentAt<0>();
}
bool ClientImpl::removeClientAction(const QString &path)
{
if (!mActions.contains(path))
{
return false;
}
QDBusPendingReply<bool> reply = mProxy->removeClientAction(QDBusObjectPath(path));
reply.waitForFinished();
if (reply.isError())
{
return false;
}
QDBusConnection::sessionBus().unregisterObject(QString("/global_key_shortcuts") + path);
mActions[path]->disconnect();
mActions.remove(path);
return reply.argumentAt<0>();
}
void ClientImpl::removeAction(ActionImpl *actionImpl)
{
QString path = actionImpl->path();
if (!mActions.contains(path))
{
return;
}
QDBusPendingReply<bool> reply = mProxy->deactivateClientAction(QDBusObjectPath(path));
reply.waitForFinished();
QDBusConnection::sessionBus().unregisterObject(QString("/global_key_shortcuts") + path);
mActions[path]->disconnect();
mActions.remove(path);
}
void ClientImpl::grabShortcut(uint timeout)
{
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(mProxy->grabShortcut(timeout), this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher *)), this, SLOT(grabShortcutFinished(QDBusPendingCallWatcher *)));
}
void ClientImpl::cancelShortcutGrab()
{
mProxy->cancelShortcutGrab();
}
void ClientImpl::grabShortcutFinished(QDBusPendingCallWatcher *call)
{
QDBusPendingReply<QString, bool, bool, bool> reply = *call;
if (reply.isError())
{
emit emitGrabShortcutFailed();
}
else
{
if (reply.argumentAt<1>())
{
emit emitGrabShortcutFailed();
}
else
{
if (reply.argumentAt<2>())
{
emit emitGrabShortcutCancelled();
}
else
{
if (reply.argumentAt<3>())
{
emit emitGrabShortcutTimedout();
}
else
{
emit emitShortcutGrabbed(reply.argumentAt<0>());
}
}
}
}
call->deleteLater();
}
static Client *globalActionNativeClient = 0;
Client *Client::instance()
{
if (!globalActionNativeClient)
{
globalActionNativeClient = new Client();
}
return globalActionNativeClient;
}
Client::Client()
: QObject(0)
, impl(new ClientImpl(this, this))
{
}
Client::~Client()
{
globalActionNativeClient = 0;
}
Action *Client::addAction(const QString &shortcut, const QString &path, const QString &description, QObject *parent) { return impl->addClientAction(shortcut, path, description, parent); }
bool Client::removeAction(const QString &path) { return impl->removeClientAction(path); }
void Client::grabShortcut(uint timeout) { impl->grabShortcut(timeout); }
void Client::cancelShortcutGrab() { impl->cancelShortcutGrab(); }
bool Client::isDaemonPresent() const { return impl->isDaemonPresent(); }
}

@ -0,0 +1,82 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_KEY_SHORTCUT_CLIENT__CLIENT__INCLUDED
#define GLOBAL_KEY_SHORTCUT_CLIENT__CLIENT__INCLUDED
#include <QtGlobal>
#include <QObject>
#include <QString>
namespace GlobalKeyShortcut
{
class Action;
class ClientImpl;
#ifndef SHARED_EXPORT
#define SHARED_EXPORT Q_DECL_IMPORT
#endif
class SHARED_EXPORT Client : public QObject
{
Q_OBJECT
public:
static Client *instance();
~Client();
Action *addAction(const QString &shortcut, const QString &path, const QString &description, QObject *parent = 0);
bool removeAction(const QString &path);
bool isDaemonPresent() const;
public slots:
void grabShortcut(uint timeout);
void cancelShortcutGrab();
signals:
void shortcutGrabbed(const QString &);
void grabShortcutFailed();
void grabShortcutCancelled();
void grabShortcutTimedout();
void daemonDisappeared();
void daemonAppeared();
void daemonPresenceChanged(bool);
private:
Client();
ClientImpl *impl;
};
}
#endif // GLOBAL_KEY_SHORTCUT_CLIENT__CLIENT__INCLUDED

@ -0,0 +1,47 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "client_adaptor.hpp"
#include "org.lxqt.global_action.client.h"
ClientAdaptor::ClientAdaptor(const QString &path, QObject *parent)
: QObject(parent)
, mPath(path)
{
}
void ClientAdaptor::activated()
{
emit on_activated(mPath);
}
void ClientAdaptor::shortcutChanged(const QString &oldShortcut, const QString &newShortcut)
{
emit on_shortcutChanged(mPath, oldShortcut, newShortcut);
}

@ -0,0 +1,51 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_ACTION_NATIVE_CLIENT__CLIENT_ADAPTOR__INCLUDED
#define GLOBAL_ACTION_NATIVE_CLIENT__CLIENT_ADAPTOR__INCLUDED
#include <QObject>
class ClientAdaptor : public QObject
{
Q_OBJECT
public:
explicit ClientAdaptor(const QString &path, QObject *parent = 0);
signals:
void on_activated(const QString &path);
void on_shortcutChanged(const QString &path, const QString &oldShortcut, const QString &newShortcut);
public slots:
void activated();
void shortcutChanged(const QString &oldShortcut, const QString &newShortcut);
private:
QString mPath;
};
#endif // GLOBAL_ACTION_NATIVE_CLIENT__CLIENT_ADAPTOR__INCLUDED

@ -0,0 +1,105 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_KEY_SHORTCUT_CLIENT__CLIENT__IMPL__INCLUDED
#define GLOBAL_KEY_SHORTCUT_CLIENT__CLIENT__IMPL__INCLUDED
#include <QObject>
#include <QString>
#include <QMap>
#include <QDBusPendingCallWatcher>
#include "action.h"
class OrgLxqtGlobal_key_shortcutsNativeInterface;
namespace org
{
namespace lxqt
{
namespace global_key_shortcuts
{
typedef ::OrgLxqtGlobal_key_shortcutsNativeInterface native;
}
}
}
class QDBusServiceWatcher;
namespace GlobalKeyShortcut
{
class Client;
class ClientAdaptor;
class ClientImpl : public QObject
{
Q_OBJECT
public:
ClientImpl(Client *interface, QObject *parent = 0);
~ClientImpl();
Action *addClientAction(const QString &shortcut, const QString &path, const QString &description, QObject *parent);
QString changeClientActionShortcut(const QString &path, const QString &shortcut);
bool modifyClientAction(const QString &path, const QString &description);
bool removeClientAction(const QString &path);
void removeAction(ActionImpl *action);
void grabShortcut(uint timeout);
void cancelShortcutGrab();
bool isDaemonPresent() const;
public slots:
void grabShortcutFinished(QDBusPendingCallWatcher *call);
void daemonDisappeared(const QString &);
void daemonAppeared(const QString &);
signals:
void emitShortcutGrabbed(const QString &);
void emitGrabShortcutFailed();
void emitGrabShortcutCancelled();
void emitGrabShortcutTimedout();
void emitDaemonDisappeared();
void emitDaemonAppeared();
void emitDaemonPresenceChanged(bool);
private:
Client *mInterface;
org::lxqt::global_key_shortcuts::native *mProxy;
QMap<QString, Action*> mActions;
QDBusServiceWatcher *mServiceWatcher;
bool mDaemonPresent;
};
}
#endif // GLOBAL_KEY_SHORTCUT_CLIENT__CLIENT__IMPL__INCLUDED

@ -0,0 +1,34 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_KEY_SHORTCUT_CLIENT__INCLUDED
#define GLOBAL_KEY_SHORTCUT_CLIENT__INCLUDED
#include <LXQtGlobalKeys/Action>
#include <LXQtGlobalKeys/Client>
#endif // GLOBAL_KEY_SHORTCUT_CLIENT__INCLUDED

@ -0,0 +1,20 @@
# XDG standards expects system-wide configuration files in the /etc/xdg/lxqt location.
# Unfortunately QSettings we are using internally can be overriden in the Qt compilation
# time to use different path for system-wide configs. (for example configure ... -sysconfdir /etc/settings ...)
# This path can be found calling Qt4's qmake:
# qmake -query QT_INSTALL_CONFIGURATION
#
if(NOT DEFINED LXQT_ETC_XDG_DIR)
if(NOT QT_QMAKE_EXECUTABLE)
message(FATAL_ERROR "LXQT_ETC_XDG_DIR: qmake not found or wrongly detected (inlude before qt configured?)")
endif()
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_CONFIGURATION
OUTPUT_VARIABLE LXQT_ETC_XDG_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "LXQT_ETC_XDG_DIR autodetected as '${LXQT_ETC_XDG_DIR}'")
message(STATUS "You can set it manually with -DLXQT_ETC_XDG_DIR=<value>")
message(STATUS "")
endif ()

@ -0,0 +1,33 @@
#
# Write a pkg-config pc file for given "name" with "decription"
# Arguments:
# name: a library name (withoud "lib" prefix and "so" suffixes
# desc: a desription string
#
macro (create_pkgconfig_file name desc)
set(_pkgfname "${CMAKE_CURRENT_BINARY_DIR}/${name}.pc")
#message(STATUS "${name}: writing pkgconfig file ${_pkgfname}")
file(WRITE "${_pkgfname}"
"# file generated by LXQt cmake build\n"
"prefix=${CMAKE_INSTALL_PREFIX}\n"
"libdir=\${prefix}/lib${LIB_SUFFIX}\n"
"includedir=\${prefix}/include\n"
"\n"
"Name: ${name}\n"
"Description: ${desc}\n"
"Version: ${LXQT_VERSION}\n"
"Libs: -L\${libdir} -l${name}\n"
"Cflags: -I\${includedir}\n"
"\n"
)
# FreeBSD loves to install files to different locations
# http://www.freebsd.org/doc/handbook/dirstructure.html
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
install(FILES ${_pkgfname} DESTINATION libdata/pkgconfig)
else()
install(FILES ${_pkgfname} DESTINATION lib${LIB_SUFFIX}/pkgconfig)
endif()
endmacro()

@ -0,0 +1,30 @@
# Creates portable headers; e.g.:
# Creates XdgAction from xdgaction.h
# XdgAction contents:
# #include "xdgaction.h"
#
# Use:
# set(PUBLIC_CLASSES MyClass YourClass)
# create_portable_headers(PORTABLE_HEADERS ${PUBLIC_CLASSES})
# PORTABLE_HEADER is an return value that contains the full name of the
# generated headers.
function(create_portable_headers outfiles)
set(options)
set(oneValueArgs NAMESPACE)
set(multiValueArgs FILENAMES)
cmake_parse_arguments(_CREATE_PORTABLE_HEADERS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(prefix ${_CREATE_PORTABLE_HEADERS_NAMESPACE})
set(class_list ${_CREATE_PORTABLE_HEADERS_FILENAMES})
foreach(f ${class_list})
string(TOLOWER "${f}.h" _filename)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${f}
"#include \"../${_filename}\"")
list(APPEND ${outfiles} ${CMAKE_CURRENT_BINARY_DIR}/${f})
endforeach()
set(${outfiles} ${${outfiles}} PARENT_SCOPE)
endfunction()

@ -0,0 +1,43 @@
# - Find the lxqt-globalkeys include and library dirs and define a some macros
#
# The module defines the following variables
# LXQT_GLOBALKEYS_FOUND - Set to TRUE if all of the above has been found
#
# LXQT_GLOBALKEYS_INCLUDE_DIR - The lxqt-globalkeys include directory
#
# LXQT_GLOBALKEYS_INCLUDE_DIRS - The lxqt-globalkeys include directory
#
# LXQT_GLOBALKEYS_LIBRARY_DIRS - The lxqt-globalkeys include directory
#
# LXQT_GLOBALKEYS_LIBRARIES - The libraries needed to use lxqt-globalkeys
#
# LXQT_GLOBALKEYS_USE_FILE - The variable LXQT_GLOBALKEYS_USE_FILE is set which is the path
# to a CMake file that can be included to compile lxqt-globalkeys
# applications and libraries. It sets up the compilation
# environment for include directories and populates a
# LXQT_GLOBALKEYS_LIBRARIES variable.
#
# LXQT_GLOBALKEYS_QT_LIBRARIES - The Qt libraries needed by lxqt-globalkeys
#
# Typical usage:
# find_package(lxqt-globalkeys)
# include(${LXQT_GLOBALKEYS_USE_FILE})
# add_executable(use-lxqt-globalkeys main.cpp)
# target_link_libraries(use-qtxdg ${LXQT_GLOBALKEYS_QT_LIBRARIES} ${LXQT_GLOBALKEYS_LIBRARIES})
set(LXQT_GLOBALKEYS_INCLUDE_DIR @LXQT_GLOBALKEYS_INCLUDE_DIR@)
set(LXQT_GLOBALKEYS_LIBRARY @LXQT_GLOBALKEYS_LIBRARY_NAME@)
set(LXQT_GLOBALKEYS_LIBRARIES "${LXQT_GLOBALKEYS_LIBRARY}")
set(LXQT_GLOBALKEYS_INCLUDE_DIRS "${LXQT_GLOBALKEYS_INCLUDE_DIR}")
set(LXQT_GLOBALKEYS_LIBRARY_DIRS @CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@)
set(LXQT_GLOBALKEYS_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/lxqt_globalkeys_use.cmake")
set(LXQT_GLOBALKEYS_FOUND 1)
set(LXQT_GLOBALKEYS_MAJOR_VERSION @LXQT_MAJOR_VERSION@)
set(LXQT_GLOBALKEYS_MINOR_VERSION @LXQT_MINOR_VERSION@)
set(LXQT_GLOBALKEYS_PATCH_VERSION @LXQT_PATCH_VERSION@)
set(LXQT_GLOBALKEYS_VERSION @LXQT_VERSION@)
mark_as_advanced(LXQT_GLOBALKEYS_LIBRARY LXQT_GLOBALKEYS_INCLUDE_DIR)

@ -0,0 +1,43 @@
# - Find the lxqt-globalkeys-ui include and library dirs and define a some macros
#
# The module defines the following variables
# LXQT_GLOBALKEYS_UI_FOUND - Set to TRUE if all of the above has been found
#
# LXQT_GLOBALKEYS_UI_INCLUDE_DIR - The lxqt-globalkeys-ui include directory
#
# LXQT_GLOBALKEYS_UI_INCLUDE_DIRS - The lxqt-globalkeys-ui include directory
#
# LXQT_GLOBALKEYS_LIBRARY_DIRS - The lxqt-globalkeys include directory
#
# LXQT_GLOBALKEYS_UI_LIBRARIES - The libraries needed to use lxqt-globalkeys-ui
#
# LXQT_GLOBALKEYS_UI_USE_FILE - The variable LXQT_GLOBALKEYS_UI_USE_FILE is set which is the path
# to a CMake file that can be included to compile lxqt-globalkeys-ui
# applications and libraries. It sets up the compilation
# environment for include directories and populates a
# LXQT_GLOBALKEYS_UI_LIBRARIES variable.
#
# LXQT_GLOBALKEYS_UI_QT_LIBRARIES - The Qt libraries needed by lxqt-globalkeys-ui
#
# Typical usage:
# find_package(lxqt-globalkeys-ui)
# include(${LXQT_GLOBALKEYS_UI_USE_FILE})
# add_executable(use-lxqt-globalkeys-ui main.cpp)
# target_link_libraries(use-qtxdg ${LXQT_GLOBALKEYS_UI_QT_LIBRARIES} ${LXQT_GLOBALKEYS_UI_LIBRARIES})
set(LXQT_GLOBALKEYS_UI_INCLUDE_DIR @LXQT_GLOBALKEYS_UI_INCLUDE_DIR@)
set(LXQT_GLOBALKEYS_UI_LIBRARY @LXQT_GLOBALKEYS_UI_LIBRARY_NAME@)
set(LXQT_GLOBALKEYS_UI_LIBRARIES "${LXQT_GLOBALKEYS_UI_LIBRARY}")
set(LXQT_GLOBALKEYS_UI_INCLUDE_DIRS "${LXQT_GLOBALKEYS_UI_INCLUDE_DIR}")
set(LXQT_GLOBALKEYS_UI_LIBRARY_DIRS @CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@)
set(LXQT_GLOBALKEYS_UI_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/lxqt_globalkeys_ui_use.cmake")
set(LXQT_GLOBALKEYS_UI_FOUND 1)
set(LXQT_GLOBALKEYS_UI_MAJOR_VERSION @LXQT_MAJOR_VERSION@)
set(LXQT_GLOBALKEYS_UI_MINOR_VERSION @LXQT_MINOR_VERSION@)
set(LXQT_GLOBALKEYS_UI_PATCH_VERSION @LXQT_PATCH_VERSION@)
set(LXQT_GLOBALKEYS_UI_VERSION @LXQT_VERSION@)
mark_as_advanced(LXQT_GLOBALKEYS_UI_LIBRARY LXQT_GLOBALKEYS_UI_INCLUDE_DIR)

@ -0,0 +1,2 @@
include_directories(${LXQT_GLOBALKEYS_UI_INCLUDE_DIRS})
link_directories(${LXQT_GLOBALKEYS_UI_LIBRARY_DIRS})

@ -0,0 +1,2 @@
include_directories(${LXQT_GLOBALKEYS_INCLUDE_DIRS})
link_directories(${LXQT_GLOBALKEYS_LIBRARY_DIRS})

@ -0,0 +1,151 @@
set(PROJECT_NAME lxqt-config-globalkeyshortcuts)
project(${PROJECT_NAME})
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
find_package(KF5WindowSystem REQUIRED QUIET)
set(QTX_INCLUDE_DIRS "")
set(QTX_LIBRARIES Qt5::Widgets Qt5::DBus)
set(QT_DBUS_PREFIX "org.qtproject")
include_directories(
"${PROJECT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
${QTX_INCLUDE_DIRS}
${LXQT_INCLUDE_DIRS}
)
set(${PROJECT_NAME}_PATH_TO_DAEMON "${LXQT_GLOBALKEYS_SOURCE_DIR}/daemon")
set(${PROJECT_NAME}_SOURCES
main.cpp
main_window.cpp
actions.cpp
default_model.cpp
shortcut_selector.cpp
${${PROJECT_NAME}_PATH_TO_DAEMON}/meta_types.cpp
edit_action_dialog.cpp
shortcut_delegate.cpp
)
set(${PROJECT_NAME}_FORMS
main_window.ui
edit_action_dialog.ui
)
set(${PROJECT_NAME}_RESOURCES
)
set(${PROJECT_NAME}_TRANSLATIONS
)
set(${PROJECT_NAME}_CPP_HEADERS
${${PROJECT_NAME}_PATH_TO_DAEMON}/meta_types.h
)
set(${PROJECT_NAME}_DBUS_ADAPTORS
)
set(${PROJECT_NAME}_DBUS_INTERFACES
${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.daemon.xml
)
set_source_files_properties(${${PROJECT_NAME}_PATH_TO_DAEMON}/org.lxqt.global_key_shortcuts.daemon.xml PROPERTIES
BASENAME org.lxqt.global_key_shortcuts.daemon
INCLUDE ${${PROJECT_NAME}_PATH_TO_DAEMON}/meta_types.h
)
set(${PROJECT_NAME}_HEADERS
${${PROJECT_NAME}_CPP_HEADERS}
)
set(${PROJECT_NAME}_TRANSLATABLE
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS}
${${PROJECT_NAME}_FORMS}
)
foreach(DBUS_ADAPTOR ${${PROJECT_NAME}_DBUS_ADAPTORS})
get_filename_component(DBUS_ADAPTOR_FILENAME ${DBUS_ADAPTOR} NAME)
configure_file(
${DBUS_ADAPTOR}
"${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}"
@ONLY
)
get_source_file_property(DBUS_ADAPTOR_INCLUDE ${DBUS_ADAPTOR} INCLUDE)
get_source_file_property(DBUS_ADAPTOR_PARENT_CLASSNAME ${DBUS_ADAPTOR} PARENT_CLASSNAME)
get_source_file_property(DBUS_ADAPTOR_BASENAME ${DBUS_ADAPTOR} BASENAME)
get_source_file_property(DBUS_ADAPTOR_CLASSNAME ${DBUS_ADAPTOR} CLASSNAME)
if(DBUS_ADAPTOR_BASENAME)
if(DBUS_ADAPTOR_CLASSNAME)
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}" ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME} ${DBUS_ADAPTOR_BASENAME} ${DBUS_ADAPTOR_CLASSNAME})
else()
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}" ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME} ${DBUS_ADAPTOR_BASENAME})
endif()
else()
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}" ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME})
endif()
endforeach()
foreach(DBUS_INTERFACE ${${PROJECT_NAME}_DBUS_INTERFACES})
get_filename_component(DBUS_INTERFACE_FILENAME ${DBUS_INTERFACE} NAME)
configure_file(
${DBUS_INTERFACE}
${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}
@ONLY
)
get_source_file_property(DBUS_INTERFACE_BASENAME ${DBUS_INTERFACE} BASENAME)
get_source_file_property(DBUS_INTERFACE_INCLUDE ${DBUS_INTERFACE} INCLUDE)
get_source_file_property(DBUS_INTERFACE_CLASSNAME ${DBUS_INTERFACE} CLASSNAME)
get_source_file_property(DBUS_INTERFACE_NO_NAMESPACE ${DBUS_INTERFACE} NO_NAMESPACE)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} PROPERTIES
INCLUDE ${DBUS_INTERFACE_INCLUDE}
CLASSNAME ${DBUS_INTERFACE_CLASSNAME}
NO_NAMESPACE ${DBUS_INTERFACE_NO_NAMESPACE}
)
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} ${DBUS_INTERFACE_BASENAME})
endforeach()
qt5_add_resources(${PROJECT_NAME}_RESOURCE_FILES ${${PROJECT_NAME}_RESOURCES})
qt5_wrap_ui(${PROJECT_NAME}_FORM_FILES ${${PROJECT_NAME}_FORMS})
# Translations **********************************
lxqt_translate_ts(${PROJECT_NAME}_QM_FILES
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
SOURCES
${${PROJECT_NAME}_TRANSLATABLE}
INSTALL_DIR
${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}
)
lxqt_app_translation_loader(${PROJECT_NAME}_QM_LOADER ${PROJECT_NAME})
lxqt_translate_desktop(${PROJECT_NAME}_DESKTOP_FILES
SOURCES
${PROJECT_NAME}.desktop.in
)
#************************************************
set(${PROJECT_NAME}_GENERATED_FILES
${${PROJECT_NAME}_FORM_FILES}
${${PROJECT_NAME}_RESOURCE_FILES}
${${PROJECT_NAME}_QM_FILES}
${${PROJECT_NAME}_DBUS_INTERFACE_FILES}
${${PROJECT_NAME}_DBUS_ADAPTOR_FILES}
${${PROJECT_NAME}_DESKTOP_FILES}
${${PROJECT_NAME}_QM_LOADER}
)
set(${PROJECT_NAME}_ALL_FILES
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS}
${${PROJECT_NAME}_GENERATED_FILES}
)
add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_ALL_FILES})
target_link_libraries(${PROJECT_NAME} KF5::WindowSystem ${QTX_LIBRARIES} ${LXQT_LIBRARIES})
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
install(FILES ${${PROJECT_NAME}_DESKTOP_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)

@ -0,0 +1,680 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "actions.h"
#include "org.lxqt.global_key_shortcuts.daemon.h"
Actions::Actions(QObject *parent)
: QObject(parent)
, mServiceWatcher(new QDBusServiceWatcher("org.lxqt.global_key_shortcuts", QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this))
, mMultipleActionsBehaviour(MULTIPLE_ACTIONS_BEHAVIOUR_FIRST)
{
connect(mServiceWatcher, SIGNAL(serviceUnregistered(QString)), this, SLOT(on_daemonDisappeared(QString)));
connect(mServiceWatcher, SIGNAL(serviceRegistered(QString)), this, SLOT(on_daemonAppeared(QString)));
mDaemonProxy = new org::lxqt::global_key_shortcuts::daemon("org.lxqt.global_key_shortcuts", "/daemon", QDBusConnection::sessionBus(), this);
connect(mDaemonProxy, SIGNAL(actionAdded(qulonglong)), this, SLOT(on_actionAdded(qulonglong)));
connect(mDaemonProxy, SIGNAL(actionEnabled(qulonglong, bool)), this, SLOT(on_actionEnabled(qulonglong, bool)));
connect(mDaemonProxy, SIGNAL(clientActionSenderChanged(qulonglong, QString)), this, SLOT(on_clientActionSenderChanged(qulonglong, QString)));
connect(mDaemonProxy, SIGNAL(actionModified(qulonglong)), this, SLOT(on_actionModified(qulonglong)));
connect(mDaemonProxy, SIGNAL(actionRemoved(qulonglong)), this, SLOT(on_actionRemoved(qulonglong)));
connect(mDaemonProxy, SIGNAL(actionShortcutChanged(qulonglong)), this, SLOT(on_actionShortcutChanged(qulonglong)));
connect(mDaemonProxy, SIGNAL(actionsSwapped(qulonglong, qulonglong)), this, SLOT(on_actionsSwapped(qulonglong, qulonglong)));
connect(mDaemonProxy, SIGNAL(multipleActionsBehaviourChanged(uint)), this, SLOT(on_multipleActionsBehaviourChanged(uint)));
QTimer::singleShot(0, this, SLOT(delayedInit()));
}
Actions::~Actions()
{
}
void Actions::delayedInit()
{
if (mDaemonProxy->isValid())
{
on_daemonAppeared(QString());
}
}
void Actions::on_daemonDisappeared(const QString &)
{
clear();
emit daemonDisappeared();
}
void Actions::on_daemonAppeared(const QString &)
{
init();
emit daemonAppeared();
}
void Actions::init()
{
clear();
mGeneralActionInfo = getAllActions();
GeneralActionInfos::const_iterator M = mGeneralActionInfo.constEnd();
for (GeneralActionInfos::const_iterator I = mGeneralActionInfo.constBegin(); I != M; ++I)
{
if (I.value().type == "client")
{
QString shortcut;
QString description;
bool enabled;
QDBusObjectPath path;
if (getClientActionInfoById(I.key(), shortcut, description, enabled, path))
{
ClientActionInfo info;
info.shortcut = shortcut;
info.description = description;
info.enabled = enabled;
info.path = path;
mClientActionInfo[I.key()] = info;
updateClientActionSender(I.key());
}
}
else if (I.value().type == "method")
{
QString shortcut;
QString description;
bool enabled;
QString service;
QDBusObjectPath path;
QString interface;
QString method;
if (getMethodActionInfoById(I.key(), shortcut, description, enabled, service, path, interface, method))
{
MethodActionInfo info;
info.shortcut = shortcut;
info.description = description;
info.enabled = enabled;
info.service = service;
info.path = path;
info.interface = interface;
info.method = method;
mMethodActionInfo[I.key()] = info;
}
}
else if (I.value().type == "command")
{
QString shortcut;
QString description;
bool enabled;
QString command;
QStringList arguments;
if (getCommandActionInfoById(I.key(), shortcut, description, enabled, command, arguments))
{
CommandActionInfo info;
info.shortcut = shortcut;
info.description = description;
info.enabled = enabled;
info.command = command;
info.arguments = arguments;
mCommandActionInfo[I.key()] = info;
}
}
}
mMultipleActionsBehaviour = static_cast<MultipleActionsBehaviour>(getMultipleActionsBehaviour());
}
void Actions::clear()
{
mGeneralActionInfo.clear();
mClientActionInfo.clear();
mMethodActionInfo.clear();
mCommandActionInfo.clear();
mMultipleActionsBehaviour = MULTIPLE_ACTIONS_BEHAVIOUR_FIRST;
}
QList<qulonglong> Actions::allActionIds() const
{
return mGeneralActionInfo.keys();
}
QPair<bool, GeneralActionInfo> Actions::actionById(qulonglong id) const
{
GeneralActionInfos::const_iterator I = mGeneralActionInfo.constFind(id);
if (I == mGeneralActionInfo.constEnd())
{
return qMakePair(false, GeneralActionInfo());
}
return qMakePair(true, I.value());
}
QList<qulonglong> Actions::allClientActionIds() const
{
return mClientActionInfo.keys();
}
QPair<bool, ClientActionInfo> Actions::clientActionInfoById(qulonglong id) const
{
ClientActionInfos::const_iterator I = mClientActionInfo.constFind(id);
if (I == mClientActionInfo.constEnd())
{
return qMakePair(false, ClientActionInfo());
}
return qMakePair(true, I.value());
}
QList<qulonglong> Actions::allMethodActionIds() const
{
return mMethodActionInfo.keys();
}
QPair<bool, MethodActionInfo> Actions::methodActionInfoById(qulonglong id) const
{
MethodActionInfos::const_iterator I = mMethodActionInfo.constFind(id);
if (I == mMethodActionInfo.constEnd())
{
return qMakePair(false, MethodActionInfo());
}
return qMakePair(true, I.value());
}
QList<qulonglong> Actions::allCommandActionIds() const
{
return mCommandActionInfo.keys();
}
QPair<bool, CommandActionInfo> Actions::commandActionInfoById(qulonglong id) const
{
CommandActionInfos::const_iterator I = mCommandActionInfo.constFind(id);
if (I == mCommandActionInfo.constEnd())
{
return qMakePair(false, CommandActionInfo());
}
return qMakePair(true, I.value());
}
MultipleActionsBehaviour Actions::multipleActionsBehaviour() const
{
return mMultipleActionsBehaviour;
}
void Actions::do_actionAdded(qulonglong id)
{
QString shortcut;
QString description;
bool enabled;
QString type;
QString info;
if (getActionById(id, shortcut, description, enabled, type, info))
{
GeneralActionInfo generalActionInfo;
generalActionInfo.shortcut = shortcut;
generalActionInfo.description = description;
generalActionInfo.enabled = enabled;
generalActionInfo.type = type;
generalActionInfo.info = info;
mGeneralActionInfo[id] = generalActionInfo;
}
if (type == "client")
{
QDBusObjectPath path;
if (getClientActionInfoById(id, shortcut, description, enabled, path))
{
ClientActionInfo clientActionInfo;
clientActionInfo.shortcut = shortcut;
clientActionInfo.description = description;
clientActionInfo.enabled = enabled;
clientActionInfo.path = path;
mClientActionInfo[id] = clientActionInfo;
}
}
else if (type == "method")
{
QString service;
QDBusObjectPath path;
QString interface;
QString method;
if (getMethodActionInfoById(id, shortcut, description, enabled, service, path, interface, method))
{
MethodActionInfo methodActionInfo;
methodActionInfo.shortcut = shortcut;
methodActionInfo.description = description;
methodActionInfo.enabled = enabled;
methodActionInfo.service = service;
methodActionInfo.path = path;
methodActionInfo.interface = interface;
methodActionInfo.method = method;
mMethodActionInfo[id] = methodActionInfo;
}
}
else if (type == "command")
{
QString command;
QStringList arguments;
if (getCommandActionInfoById(id, shortcut, description, enabled, command, arguments))
{
CommandActionInfo commandActionInfo;
commandActionInfo.shortcut = shortcut;
commandActionInfo.description = description;
commandActionInfo.enabled = enabled;
commandActionInfo.command = command;
commandActionInfo.arguments = arguments;
mCommandActionInfo[id] = commandActionInfo;
}
}
}
void Actions::on_actionAdded(qulonglong id)
{
do_actionAdded(id);
emit actionAdded(id);
}
void Actions::on_actionEnabled(qulonglong id, bool enabled)
{
GeneralActionInfos::iterator GI = mGeneralActionInfo.find(id);
if (GI != mGeneralActionInfo.end())
{
GI.value().enabled = enabled;
if (GI.value().type == "client")
{
ClientActionInfos::iterator DI = mClientActionInfo.find(id);
if (DI != mClientActionInfo.end())
{
DI.value().enabled = enabled;
}
}
else if (GI.value().type == "method")
{
MethodActionInfos::iterator MI = mMethodActionInfo.find(id);
if (MI != mMethodActionInfo.end())
{
MI.value().enabled = enabled;
}
}
else if (GI.value().type == "command")
{
CommandActionInfos::iterator CI = mCommandActionInfo.find(id);
if (CI != mCommandActionInfo.end())
{
CI.value().enabled = enabled;
}
}
}
emit actionEnabled(id, enabled);
}
void Actions::on_clientActionSenderChanged(qulonglong id, const QString &sender)
{
mClientActionSenders[id] = sender;
emit actionModified(id);
}
void Actions::on_actionModified(qulonglong id)
{
do_actionAdded(id);
emit actionModified(id);
}
void Actions::on_actionShortcutChanged(qulonglong id)
{
do_actionAdded(id);
emit actionModified(id);
}
void Actions::on_actionsSwapped(qulonglong id1, qulonglong id2)
{
GeneralActionInfos::iterator GI1 = mGeneralActionInfo.find(id1);
GeneralActionInfos::iterator GI2 = mGeneralActionInfo.find(id2);
if ((GI1 != mGeneralActionInfo.end()) && (GI2 != mGeneralActionInfo.end()))
{
bool swapped = false;
if (GI1.value().type == GI2.value().type)
{
if (GI1.value().type == "client")
{
ClientActionInfos::iterator DI1 = mClientActionInfo.find(id1);
ClientActionInfos::iterator DI2 = mClientActionInfo.find(id2);
if ((DI1 != mClientActionInfo.end()) && (DI2 != mClientActionInfo.end()))
{
ClientActionInfo clientActionInfo = DI1.value();
DI1.value() = DI2.value();
DI2.value() = clientActionInfo;
swapped = true;
}
}
else if (GI1.value().type == "method")
{
MethodActionInfos::iterator MI1 = mMethodActionInfo.find(id1);
MethodActionInfos::iterator MI2 = mMethodActionInfo.find(id2);
if ((MI1 != mMethodActionInfo.end()) && (MI2 != mMethodActionInfo.end()))
{
MethodActionInfo methodActionInfo = MI1.value();
MI1.value() = MI2.value();
MI2.value() = methodActionInfo;
swapped = true;
}
}
else if (GI1.value().type == "command")
{
CommandActionInfos::iterator CI1 = mCommandActionInfo.find(id1);
CommandActionInfos::iterator CI2 = mCommandActionInfo.find(id2);
if ((CI1 != mCommandActionInfo.end()) && (CI2 != mCommandActionInfo.end()))
{
CommandActionInfo commandActionInfo = CI1.value();
CI1.value() = CI2.value();
CI2.value() = commandActionInfo;
swapped = true;
}
}
}
if (swapped)
{
GeneralActionInfo generalActionInfo = GI1.value();
GI1.value() = GI2.value();
GI2.value() = generalActionInfo;
}
else
{
do_actionRemoved(id1);
do_actionRemoved(id2);
do_actionAdded(id1);
do_actionAdded(id2);
}
}
emit actionsSwapped(id1, id2);
}
void Actions::do_actionRemoved(qulonglong id)
{
mGeneralActionInfo.remove(id);
mClientActionInfo.remove(id);
mMethodActionInfo.remove(id);
mCommandActionInfo.remove(id);
}
void Actions::on_actionRemoved(qulonglong id)
{
do_actionRemoved(id);
emit actionRemoved(id);
}
void Actions::on_multipleActionsBehaviourChanged(uint behaviour)
{
mMultipleActionsBehaviour = static_cast<MultipleActionsBehaviour>(behaviour);
emit multipleActionsBehaviourChanged(mMultipleActionsBehaviour);
}
bool Actions::getClientActionInfoById(qulonglong id, QString &shortcut, QString &description, bool &enabled, QDBusObjectPath &path)
{
return mDaemonProxy->getClientActionInfoById(id, shortcut, description, enabled, path);
}
bool Actions::getMethodActionInfoById(qulonglong id, QString &shortcut, QString &description, bool &enabled, QString &service, QDBusObjectPath &path, QString &interface, QString &method)
{
return mDaemonProxy->getMethodActionInfoById(id, shortcut, description, enabled, service, path, interface, method);
}
bool Actions::getCommandActionInfoById(qulonglong id, QString &shortcut, QString &description, bool &enabled, QString &command, QStringList &arguments)
{
return mDaemonProxy->getCommandActionInfoById(id, shortcut, description, enabled, command, arguments);
}
QList<qulonglong> Actions::getAllActionIds()
{
QDBusPendingReply<QList<qulonglong> > reply = mDaemonProxy->getAllActionIds();
reply.waitForFinished();
if (reply.isError())
{
return QList<qulonglong>();
}
return reply.argumentAt<0>();
}
bool Actions::getActionById(qulonglong id, QString &shortcut, QString &description, bool &enabled, QString &type, QString &info)
{
return mDaemonProxy->getActionById(id, shortcut, description, enabled, type, info);
}
QMap<qulonglong, GeneralActionInfo> Actions::getAllActions()
{
QDBusPendingReply<QMap<qulonglong, GeneralActionInfo> > reply = mDaemonProxy->getAllActions();
reply.waitForFinished();
if (reply.isError())
{
return QMap<qulonglong, GeneralActionInfo>();
}
return reply.argumentAt<0>();
}
uint Actions::getMultipleActionsBehaviour()
{
QDBusPendingReply<uint> reply = mDaemonProxy->getMultipleActionsBehaviour();
reply.waitForFinished();
if (reply.isError())
{
return 0;
}
return reply.argumentAt<0>();
}
QPair<QString, qulonglong> Actions::addMethodAction(const QString &shortcut, const QString &service, const QDBusObjectPath &path, const QString &interface, const QString &method, const QString &description)
{
QDBusPendingReply<QString, qulonglong> reply = mDaemonProxy->addMethodAction(shortcut, service, path, interface, method, description);
reply.waitForFinished();
if (reply.isError())
{
return qMakePair<QString, qulonglong>(QString(), 0ull);
}
return qMakePair<QString, qulonglong>(reply.argumentAt<0>(), reply.argumentAt<1>());
}
QPair<QString, qulonglong> Actions::addCommandAction(const QString &shortcut, const QString &command, const QStringList &arguments, const QString &description)
{
QDBusPendingReply<QString, qulonglong> reply = mDaemonProxy->addCommandAction(shortcut, command, arguments, description);
reply.waitForFinished();
if (reply.isError())
{
return qMakePair<QString, qulonglong>(QString(), 0ull);
}
return qMakePair<QString, qulonglong>(reply.argumentAt<0>(), reply.argumentAt<1>());
}
bool Actions::modifyActionDescription(const qulonglong &id, const QString &description)
{
QDBusPendingReply<bool> reply = mDaemonProxy->modifyActionDescription(id, description);
reply.waitForFinished();
if (reply.isError())
{
return false;
}
return reply.argumentAt<0>();
}
bool Actions::modifyMethodAction(const qulonglong &id, const QString &service, const QDBusObjectPath &path, const QString &interface, const QString &method, const QString &description)
{
QDBusPendingReply<bool> reply = mDaemonProxy->modifyMethodAction(id, service, path, interface, method, description);
reply.waitForFinished();
if (reply.isError())
{
return false;
}
return reply.argumentAt<0>();
}
bool Actions::modifyCommandAction(const qulonglong &id, const QString &command, const QStringList &arguments, const QString &description)
{
QDBusPendingReply<bool> reply = mDaemonProxy->modifyCommandAction(id, command, arguments, description);
reply.waitForFinished();
if (reply.isError())
{
return false;
}
return reply.argumentAt<0>();
}
bool Actions::enableAction(qulonglong id, bool enabled)
{
QDBusPendingReply<bool> reply = mDaemonProxy->enableAction(id, enabled);
reply.waitForFinished();
if (reply.isError())
{
return false;
}
return reply.argumentAt<0>();
}
bool Actions::isActionEnabled(qulonglong id)
{
QDBusPendingReply<bool> reply = mDaemonProxy->isActionEnabled(id);
reply.waitForFinished();
if (reply.isError())
{
return false;
}
return reply.argumentAt<0>();
}
QString Actions::getClientActionSender(qulonglong id)
{
return mClientActionSenders[id];
}
QString Actions::updateClientActionSender(qulonglong id)
{
QDBusPendingReply<QString> reply = mDaemonProxy->getClientActionSender(id);
reply.waitForFinished();
if (reply.isError())
{
return QString();
}
QString sender = reply.argumentAt<0>();
mClientActionSenders[id] = sender;
return sender;
}
QString Actions::changeShortcut(const qulonglong &id, const QString &shortcut)
{
QDBusPendingReply<QString> reply = mDaemonProxy->changeShortcut(id, shortcut);
reply.waitForFinished();
if (reply.isError())
{
return QString();
}
return reply.argumentAt<0>();
}
bool Actions::swapActions(const qulonglong &id1, const qulonglong &id2)
{
QDBusPendingReply<bool> reply = mDaemonProxy->swapActions(id1, id2);
reply.waitForFinished();
if (reply.isError())
{
return false;
}
return reply.argumentAt<0>();
}
bool Actions::removeAction(const qulonglong &id)
{
QDBusPendingReply<bool> reply = mDaemonProxy->removeAction(id);
reply.waitForFinished();
if (reply.isError())
{
return false;
}
return reply.argumentAt<0>();
}
void Actions::setMultipleActionsBehaviour(const MultipleActionsBehaviour &behaviour)
{
QDBusPendingReply<bool> reply = mDaemonProxy->setMultipleActionsBehaviour(behaviour);
reply.waitForFinished();
}
void Actions::grabShortcut(uint timeout)
{
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(mDaemonProxy->grabShortcut(timeout), this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher *)), this, SLOT(grabShortcutFinished(QDBusPendingCallWatcher *)));
}
void Actions::cancelShortcutGrab()
{
mDaemonProxy->cancelShortcutGrab();
}
void Actions::grabShortcutFinished(QDBusPendingCallWatcher *call)
{
QDBusPendingReply<QString, bool, bool, bool> reply = *call;
if (reply.isError())
{
emit grabShortcutFailed();
}
else
{
if (reply.argumentAt<1>())
{
emit grabShortcutFailed();
}
else
{
if (reply.argumentAt<2>())
{
emit grabShortcutCancelled();
}
else
{
if (reply.argumentAt<3>())
{
emit grabShortcutTimedout();
}
else
{
emit shortcutGrabbed(reply.argumentAt<0>());
}
}
}
}
call->deleteLater();
}

@ -0,0 +1,182 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_ACTION_CONFIG__ACTIONS__INCLUDED
#define GLOBAL_ACTION_CONFIG__ACTIONS__INCLUDED
#include <QObject>
#include <QtGlobal>
#include <QString>
#include <QList>
#include <QStringList>
#include <QMap>
#include <QPair>
#include <QDBusObjectPath>
#include "../daemon/meta_types.h"
class OrgLxqtGlobal_key_shortcutsDaemonInterface;
namespace org
{
namespace lxqt
{
namespace global_key_shortcuts
{
typedef ::OrgLxqtGlobal_key_shortcutsDaemonInterface daemon;
}
}
}
class QDBusServiceWatcher;
class QDBusPendingCallWatcher;
class Actions : public QObject
{
Q_OBJECT
public:
Actions(QObject *parent = 0);
~Actions();
QList<qulonglong> allActionIds() const;
QPair<bool, GeneralActionInfo> actionById(qulonglong id) const;
QList<qulonglong> allClientActionIds() const;
QPair<bool, ClientActionInfo> clientActionInfoById(qulonglong id) const;
QList<qulonglong> allMethodActionIds() const;
QPair<bool, MethodActionInfo> methodActionInfoById(qulonglong id) const;
QList<qulonglong> allCommandActionIds() const;
QPair<bool, CommandActionInfo> commandActionInfoById(qulonglong id) const;
QPair<QString, qulonglong> addMethodAction(const QString &shortcut, const QString &service, const QDBusObjectPath &path, const QString &interface, const QString &method, const QString &description);
QPair<QString, qulonglong> addCommandAction(const QString &shortcut, const QString &command, const QStringList &arguments, const QString &description);
bool modifyActionDescription(const qulonglong &id, const QString &description);
bool modifyMethodAction(const qulonglong &id, const QString &service, const QDBusObjectPath &path, const QString &interface, const QString &method, const QString &description);
bool modifyCommandAction(const qulonglong &id, const QString &command, const QStringList &arguments, const QString &description);
bool enableAction(qulonglong id, bool enabled);
bool isActionEnabled(qulonglong id);
QString getClientActionSender(qulonglong id);
QString updateClientActionSender(qulonglong id);
QString changeShortcut(const qulonglong &id, const QString &shortcut);
bool swapActions(const qulonglong &id1, const qulonglong &id2);
bool removeAction(const qulonglong &id);
MultipleActionsBehaviour multipleActionsBehaviour() const;
void setMultipleActionsBehaviour(const MultipleActionsBehaviour &behaviour);
void grabShortcut(uint timeout);
void cancelShortcutGrab();
signals:
void daemonDisappeared();
void daemonAppeared();
void actionAdded(qulonglong id);
void actionEnabled(qulonglong id, bool enabled);
void actionModified(qulonglong id);
void actionsSwapped(qulonglong id1, qulonglong id2);
void actionRemoved(qulonglong id);
void multipleActionsBehaviourChanged(MultipleActionsBehaviour behaviour);
void shortcutGrabbed(const QString &);
void grabShortcutFailed();
void grabShortcutCancelled();
void grabShortcutTimedout();
private:
void init();
void clear();
QList<qulonglong> getAllActionIds();
bool getActionById(qulonglong id, QString &shortcut, QString &description, bool &enabled, QString &type, QString &info);
QMap<qulonglong, GeneralActionInfo> getAllActions();
bool getClientActionInfoById(qulonglong id, QString &shortcut, QString &description, bool &enabled, QDBusObjectPath &path);
bool getMethodActionInfoById(qulonglong id, QString &shortcut, QString &description, bool &enabled, QString &service, QDBusObjectPath &path, QString &interface, QString &method);
bool getCommandActionInfoById(qulonglong id, QString &shortcut, QString &description, bool &enabled, QString &command, QStringList &arguments);
uint getMultipleActionsBehaviour();
private slots:
void delayedInit();
void on_daemonDisappeared(const QString &);
void on_daemonAppeared(const QString &);
void on_actionAdded(qulonglong id);
void on_actionEnabled(qulonglong id, bool enabled);
void on_clientActionSenderChanged(qulonglong id, const QString &sender);
void on_actionModified(qulonglong id);
void on_actionShortcutChanged(qulonglong id);
void on_actionsSwapped(qulonglong id1, qulonglong id2);
void on_actionRemoved(qulonglong id);
void on_multipleActionsBehaviourChanged(uint behaviour);
void grabShortcutFinished(QDBusPendingCallWatcher *call);
private:
void do_actionAdded(qulonglong id);
void do_actionRemoved(qulonglong id);
private:
org::lxqt::global_key_shortcuts::daemon *mDaemonProxy;
QDBusServiceWatcher *mServiceWatcher;
typedef QMap<qulonglong, GeneralActionInfo> GeneralActionInfos;
GeneralActionInfos mGeneralActionInfo;
typedef QMap<qulonglong, ClientActionInfo> ClientActionInfos;
ClientActionInfos mClientActionInfo;
typedef QMap<qulonglong, QString> ClientActionSenders;
ClientActionSenders mClientActionSenders;
typedef QMap<qulonglong, MethodActionInfo> MethodActionInfos;
MethodActionInfos mMethodActionInfo;
typedef QMap<qulonglong, CommandActionInfo> CommandActionInfos;
CommandActionInfos mCommandActionInfo;
MultipleActionsBehaviour mMultipleActionsBehaviour;
};
#endif // GLOBAL_ACTION_CONFIG__ACTIONS__INCLUDED

@ -0,0 +1,354 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "default_model.h"
#include "actions.h"
DefaultModel::DefaultModel(Actions *actions, const QColor &grayedOutColour, const QFont &highlightedFont, const QFont &italicFont, const QFont &highlightedItalicFont, QObject *parent)
: QAbstractTableModel(parent)
, mActions(actions)
, mGrayedOutColour(grayedOutColour)
, mHighlightedFont(highlightedFont)
, mItalicFont(italicFont)
, mHighlightedItalicFont(highlightedItalicFont)
{
connect(actions, SIGNAL(daemonDisappeared()), SLOT(daemonDisappeared()));
connect(actions, SIGNAL(daemonAppeared()), SLOT(daemonAppeared()));
connect(actions, SIGNAL(actionAdded(qulonglong)), SLOT(actionAdded(qulonglong)));
connect(actions, SIGNAL(actionModified(qulonglong)), SLOT(actionModified(qulonglong)));
connect(actions, SIGNAL(actionEnabled(qulonglong, bool)), SLOT(actionEnabled(qulonglong, bool)));
connect(actions, SIGNAL(actionsSwapped(qulonglong, qulonglong)), SLOT(actionsSwapped(qulonglong, qulonglong)));
connect(actions, SIGNAL(actionRemoved(qulonglong)), SLOT(actionRemoved(qulonglong)));
mVerboseType["command"] = tr("Command");
mVerboseType["method"] = tr("DBus call");
mVerboseType["client"] = tr("Client");
}
DefaultModel::~DefaultModel()
{
}
int DefaultModel::rowCount(const QModelIndex &/*parent*/) const
{
return mContent.size();
}
int DefaultModel::columnCount(const QModelIndex &/*parent*/) const
{
return 5;
}
QVariant DefaultModel::data(const QModelIndex &index, int role) const
{
switch (role)
{
case Qt::DisplayRole:
if ((index.row() >= 0) && (index.row() < rowCount()) && (index.column() >= 0) && (index.column() < columnCount()))
switch (index.column())
{
case 0:
return mContent.keys()[index.row()];
case 1:
return mContent[mContent.keys()[index.row()]].shortcut;
case 2:
return mContent[mContent.keys()[index.row()]].description;
case 3:
return mVerboseType[mContent[mContent.keys()[index.row()]].type];
case 4:
return mContent[mContent.keys()[index.row()]].info;
}
break;
case Qt::EditRole:
if ((index.row() >= 0) && (index.row() < rowCount()) && (index.column() >= 0) && (index.column() < columnCount()))
switch (index.column())
{
case 1:
return mContent[mContent.keys()[index.row()]].shortcut;
}
break;
case Qt::FontRole:
{
if ((index.row() >= 0) && (index.row() < rowCount()))
{
qulonglong id = mContent.keys()[index.row()];
bool multiple = (index.column() == 1) && (mShortcuts[mContent[id].shortcut].size() > 1);
bool inactive = (mContent[id].type == "client") && (mActions->getClientActionSender(id).isEmpty());
if (multiple || inactive)
return multiple ? (inactive ? mHighlightedItalicFont : mHighlightedFont) : mItalicFont;
}
}
break;
case Qt::ForegroundRole:
if (!mContent[mContent.keys()[index.row()]].enabled)
{
return mGrayedOutColour;
}
break;
case Qt::CheckStateRole:
if ((index.row() >= 0) && (index.row() < rowCount()) && (index.column() == 0))
{
return mContent[mContent.keys()[index.row()]].enabled ? Qt::Checked : Qt::Unchecked;
}
break;
default:
;
}
return QVariant();
}
QVariant DefaultModel::headerData(int section, Qt::Orientation orientation, int role) const
{
switch (role)
{
case Qt::DisplayRole:
switch (orientation)
{
case Qt::Horizontal:
switch (section)
{
case 0:
return tr("Id");
case 1:
return tr("Shortcut");
case 2:
return tr("Description");
case 3:
return tr("Type");
case 4:
return tr("Info");
}
break;
default:
;
}
break;
default:
;
}
return QAbstractTableModel::headerData(section, orientation, role);
}
Qt::ItemFlags DefaultModel::flags(const QModelIndex &index) const
{
Qt::ItemFlags result = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
if (index.column() == 0)
{
result |= Qt::ItemIsUserCheckable;
}
if (index.column() == 1)
{
result |= Qt::ItemIsEditable;
}
return result;
}
bool DefaultModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
switch (role)
{
case Qt::EditRole:
if ((index.row() >= 0) && (index.row() < rowCount()) && index.column() == 1)
{
mActions->changeShortcut(mContent.keys()[index.row()], value.toString());
return true;
}
break;
}
return false;
}
qulonglong DefaultModel::id(const QModelIndex &index) const
{
if ((index.row() >= 0) && (index.row() < rowCount()))
{
return mContent.keys()[index.row()];
}
return 0ull;
}
void DefaultModel::daemonDisappeared()
{
beginResetModel();
mContent.clear();
mShortcuts.clear();
endResetModel();
}
void DefaultModel::daemonAppeared()
{
QList<qulonglong> allIds = mActions->allActionIds();
beginInsertRows(QModelIndex(), 0, allIds.size() - 1);
foreach(qulonglong id, allIds)
{
mContent[id] = mActions->actionById(id).second;
mShortcuts[mContent[id].shortcut].insert(id);
}
endInsertRows();
}
void DefaultModel::actionAdded(qulonglong id)
{
if (!mContent.contains(id))
{
QPair<bool, GeneralActionInfo> result = mActions->actionById(id);
if (result.first)
{
QList<qulonglong> keys = mContent.keys();
int row = qBinaryFind(keys, mContent.lowerBound(id).key()) - keys.constBegin();
beginInsertRows(QModelIndex(), row, row);
mContent[id] = result.second;
mShortcuts[mContent[id].shortcut].insert(id);
endInsertRows();
keys = mContent.keys();
foreach(qulonglong siblingId, mShortcuts[mContent[id].shortcut])
{
if (id != siblingId)
{
int siblingRow = qBinaryFind(keys, siblingId) - keys.constBegin();
emit dataChanged(index(siblingRow, 1), index(siblingRow, 1));
}
}
}
}
}
void DefaultModel::actionEnabled(qulonglong id, bool enabled)
{
if (mContent.contains(id))
{
QList<qulonglong> keys = mContent.keys();
int row = qBinaryFind(keys, id) - keys.constBegin();
mContent[id].enabled = enabled;
emit dataChanged(index(row, 0), index(row, 3));
}
}
void DefaultModel::actionModified(qulonglong id)
{
if (mContent.contains(id))
{
QPair<bool, GeneralActionInfo> result = mActions->actionById(id);
if (result.first)
{
QList<qulonglong> keys = mContent.keys();
int row = qBinaryFind(keys, id) - keys.constBegin();
if (mContent[id].shortcut != result.second.shortcut)
{
mShortcuts[result.second.shortcut].insert(id);
mShortcuts[mContent[id].shortcut].remove(id);
foreach(qulonglong siblingId, mShortcuts[mContent[id].shortcut])
{
int siblingRow = qBinaryFind(keys, siblingId) - keys.constBegin();
emit dataChanged(index(siblingRow, 1), index(siblingRow, 1));
}
foreach(qulonglong siblingId, mShortcuts[result.second.shortcut])
{
int siblingRow = qBinaryFind(keys, siblingId) - keys.constBegin();
emit dataChanged(index(siblingRow, 1), index(siblingRow, 1));
}
}
mContent[id] = result.second;
emit dataChanged(index(row, 0), index(row, 3));
}
}
}
void DefaultModel::actionsSwapped(qulonglong id1, qulonglong id2)
{
if (mContent.contains(id1) && mContent.contains(id2))
{
QList<qulonglong> keys = mContent.keys();
int row1 = qBinaryFind(keys, id1) - keys.constBegin();
int row2 = qBinaryFind(keys, id2) - keys.constBegin();
// swap
GeneralActionInfo tmp = mContent[id1];
mContent[id1] = mContent[id2];
mContent[id2] = tmp;
emit dataChanged(index(row1, 0), index(row1, 3));
emit dataChanged(index(row2, 0), index(row2, 3));
}
}
void DefaultModel::actionRemoved(qulonglong id)
{
if (mContent.contains(id))
{
QList<qulonglong> keys = mContent.keys();
int row = qBinaryFind(keys, id) - keys.constBegin();
beginRemoveRows(QModelIndex(), row, row);
mShortcuts[mContent[id].shortcut].remove(id);
QString shortcut = mContent[id].shortcut;
mContent.remove(id);
endRemoveRows();
foreach(qulonglong siblingId, mShortcuts[shortcut])
{
int siblingRow = qBinaryFind(keys, siblingId) - keys.constBegin();
emit dataChanged(index(siblingRow, 1), index(siblingRow, 1));
}
}
}

@ -0,0 +1,93 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_ACTION_CONFIG__DEFAULT_MODEL__INCLUDED
#define GLOBAL_ACTION_CONFIG__DEFAULT_MODEL__INCLUDED
#include <QAbstractTableModel>
#include <QMap>
#include <QColor>
#include <QFont>
#include "../daemon/meta_types.h"
class Actions;
template<class Key>
class QOrderedSet : public QMap<Key, Key>
{
public:
typename QMap<Key, Key>::iterator insert(const Key &akey)
{
return QMap<Key, Key>::insert(akey, akey);
}
};
class DefaultModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit DefaultModel(Actions *actions, const QColor &grayedOutColour, const QFont &highlightedFont, const QFont &italicFont, const QFont &highlightedItalicFont, QObject *parent = 0);
~DefaultModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
qulonglong id(const QModelIndex &index) const;
public slots:
void daemonDisappeared();
void daemonAppeared();
void actionAdded(qulonglong id);
void actionEnabled(qulonglong id, bool enabled);
void actionModified(qulonglong id);
void actionsSwapped(qulonglong id1, qulonglong id2);
void actionRemoved(qulonglong id);
private:
Actions *mActions;
QMap<qulonglong, GeneralActionInfo> mContent;
QMap<QString, QOrderedSet<qulonglong> > mShortcuts;
QColor mGrayedOutColour;
QFont mHighlightedFont;
QFont mItalicFont;
QFont mHighlightedItalicFont;
QMap<QString, QString> mVerboseType;
};
#endif // GLOBAL_ACTION_CONFIG__DEFAULT_MODEL__INCLUDED

@ -0,0 +1,252 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "edit_action_dialog.h"
#include "actions.h"
EditActionDialog::EditActionDialog(Actions *actions, QWidget *parent)
: QDialog(parent)
, mActions(actions)
{
setupUi(this);
shortcut_SS->setActions(mActions);
connect(this, SIGNAL(accepted()), SLOT(when_accepted()));
}
void EditActionDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type())
{
case QEvent::LanguageChange:
retranslateUi(this);
break;
default:
break;
}
}
static QString joinCommandLine(const QString &command, QStringList arguments)
{
arguments.prepend(command);
int m = arguments.length();
for (int i = 0; i < m; ++i)
{
QString &item = arguments[i];
if (item.contains(QRegExp("[ \r\n\t\"']")))
{
item.prepend("'").append("'");
}
else if (item.isEmpty())
{
item = QString("''");
}
}
return arguments.join(" ");
}
static QStringList splitCommandLine(QString commandLine)
{
commandLine.prepend(" ").append(" ");
QStringList result;
QRegExp spacePattern("\\s+");
QRegExp itemPattern("([^ \r\n\t\"']+)|((\"([^\"]|\\\")*\")|('([^']|\\')*'))(?=\\s)");
for (int pos = 0; ;)
{
if (commandLine.indexOf(spacePattern, pos) != pos)
{
return QStringList();
}
pos += spacePattern.matchedLength();
if (pos == commandLine.length())
{
break;
}
if (commandLine.indexOf(itemPattern, pos) != pos)
{
return QStringList();
}
pos += itemPattern.matchedLength();
QString item = itemPattern.cap(2);
if (item.length())
{
result << item.mid(1, item.length() - 2);
}
else
{
result << itemPattern.cap(1);
}
}
return result;
}
void EditActionDialog::when_accepted()
{
if (mId)
{
if (command_RB->isChecked())
{
QStringList commandLine = splitCommandLine(command_PTE->toPlainText());
if (!commandLine.length())
{
return;
}
mActions->modifyCommandAction(mId, commandLine[0], commandLine.mid(1), description_LE->text());
}
else if (dbus_method_RB->isChecked())
{
mActions->modifyMethodAction(mId, service_LE->text(), QDBusObjectPath(path_LE->text()), interface_LE->text(), method_LE->text(), description_LE->text());
}
mActions->changeShortcut(mId, mShortcut);
mActions->enableAction(mId, enabled_CB->isChecked());
}
else
{
QPair<QString, qulonglong> result = qMakePair(QString(), 0ull);
if (command_RB->isChecked())
{
QStringList commandLine = splitCommandLine(command_PTE->toPlainText());
if (!commandLine.length())
{
return;
}
result = mActions->addCommandAction(mShortcut, commandLine[0], commandLine.mid(1), description_LE->text());
}
else if (dbus_method_RB->isChecked())
{
result = mActions->addMethodAction(mShortcut, service_LE->text(), QDBusObjectPath(path_LE->text()), interface_LE->text(), method_LE->text(), description_LE->text());
}
if (result.second && !enabled_CB->isChecked())
{
mActions->enableAction(result.second, false);
}
}
}
bool EditActionDialog::load(qulonglong id)
{
mId = id;
if (mId)
{
QPair<bool, GeneralActionInfo> info = mActions->actionById(id);
if (!info.first)
{
return false;
}
bool canEdit = ((info.second.type == "command") || (info.second.type == "method"));
mShortcut = info.second.shortcut;
shortcut_SS->setText(mShortcut);
description_LE->setText(info.second.description);
enabled_CB->setChecked(info.second.enabled);
command_RB->setChecked(info.second.type == "command");
dbus_method_RB->setChecked(info.second.type == "method");
action_SW->setCurrentWidget((info.second.type == "method") ? dbus_method_P : command_P);
if (info.second.type == "command")
{
QPair<bool, CommandActionInfo> commandInfo = mActions->commandActionInfoById(id);
if (!commandInfo.first)
{
return false;
}
command_PTE->setPlainText(joinCommandLine(commandInfo.second.command, commandInfo.second.arguments));
}
else if (info.second.type == "method")
{
QPair<bool, MethodActionInfo> methodInfo = mActions->methodActionInfoById(id);
if (!methodInfo.first)
{
return false;
}
service_LE->setText(methodInfo.second.service);
path_LE->setText(methodInfo.second.path.path());
interface_LE->setText(methodInfo.second.interface);
method_LE->setText(methodInfo.second.method);
}
else
{
command_PTE->clear();
}
description_LE->setEnabled(canEdit);
command_RB->setEnabled(false);
dbus_method_RB->setEnabled(false);
action_SW->setEnabled(canEdit);
}
else
{
shortcut_SS->setText(QString());
description_LE->clear();
enabled_CB->setChecked(true);
command_RB->setChecked(false);
dbus_method_RB->setChecked(false);
action_SW->setCurrentWidget(command_P);
command_PTE->clear();
service_LE->clear();
path_LE->clear();
interface_LE->clear();
method_LE->clear();
description_LE->setEnabled(true);
command_RB->setEnabled(true);
dbus_method_RB->setEnabled(true);
action_SW->setEnabled(false);
}
return true;
}
void EditActionDialog::on_shortcut_SS_shortcutGrabbed(const QString &shortcut)
{
mShortcut = shortcut;
shortcut_SS->setText(shortcut);
}
void EditActionDialog::on_command_RB_clicked(bool checked)
{
if (checked)
{
action_SW->setCurrentWidget(command_P);
action_SW->setEnabled(true);
}
}
void EditActionDialog::on_dbus_method_RB_clicked(bool checked)
{
if (checked)
{
action_SW->setCurrentWidget(dbus_method_P);
action_SW->setEnabled(true);
}
}

@ -0,0 +1,62 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_ACTION_CONFIG__EDIT_ACTION_DIALOG__INCLUDED
#define GLOBAL_ACTION_CONFIG__EDIT_ACTION_DIALOG__INCLUDED
#include "ui_edit_action_dialog.h"
class Actions;
class EditActionDialog : public QDialog, private Ui::EditActionDialog
{
Q_OBJECT
public:
explicit EditActionDialog(Actions *actions, QWidget *parent = 0);
bool load(qulonglong id);
protected slots:
void when_accepted();
void on_shortcut_SS_shortcutGrabbed(const QString &);
void on_command_RB_clicked(bool);
void on_dbus_method_RB_clicked(bool);
protected:
void changeEvent(QEvent *e);
private:
Actions *mActions;
qulonglong mId;
QString mShortcut;
};
#endif // GLOBAL_ACTION_CONFIG__EDIT_ACTION_DIALOG__INCLUDED

@ -0,0 +1,328 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditActionDialog</class>
<widget class="QDialog" name="EditActionDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>286</height>
</rect>
</property>
<property name="windowTitle">
<string>Edit Action</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1,0">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="shortcut_L">
<property name="text">
<string>&amp;Shortcut:</string>
</property>
<property name="buddy">
<cstring>shortcut_SS</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="ShortcutSelector" name="shortcut_SS">
<property name="minimumSize">
<size>
<width>81</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="description_L">
<property name="text">
<string>&amp;Description:</string>
</property>
<property name="buddy">
<cstring>description_LE</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="description_LE"/>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="enabled_CB">
<property name="text">
<string>&amp;Enabled</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="command_RB">
<property name="text">
<string>&amp;Command</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="dbus_method_RB">
<property name="text">
<string>&amp;DBus message</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="type_L">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="action_SW">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="command_P">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QFormLayout" name="formLayout_3">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="command_L">
<property name="text">
<string>Co&amp;mmand:</string>
</property>
<property name="buddy">
<cstring>command_PTE</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPlainTextEdit" name="command_PTE"/>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="dbus_method_P">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QFormLayout" name="formLayout_2">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="service_L">
<property name="text">
<string>S&amp;ervice:</string>
</property>
<property name="buddy">
<cstring>service_LE</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="service_LE"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="path_L">
<property name="text">
<string>&amp;Path:</string>
</property>
<property name="buddy">
<cstring>path_LE</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="path_LE"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="interface_L">
<property name="text">
<string>&amp;Interface:</string>
</property>
<property name="buddy">
<cstring>interface_LE</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="interface_LE"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="method_L">
<property name="text">
<string>&amp;Method:</string>
</property>
<property name="buddy">
<cstring>method_LE</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="method_LE"/>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ShortcutSelector</class>
<extends>QToolButton</extends>
<header>shortcut_selector.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>shortcut_SS</tabstop>
<tabstop>description_LE</tabstop>
<tabstop>enabled_CB</tabstop>
<tabstop>command_RB</tabstop>
<tabstop>dbus_method_RB</tabstop>
<tabstop>command_PTE</tabstop>
<tabstop>service_LE</tabstop>
<tabstop>path_LE</tabstop>
<tabstop>interface_LE</tabstop>
<tabstop>method_LE</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>EditActionDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>EditActionDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Name=Shortcut Keys
GenericName=Keyboard Shortcut Settings
Comment=Configure shortcut keys in LXQt
Exec=lxqt-config-globalkeyshortcuts
Icon=preferences-desktop-keyboard
Categories=Settings;DesktopSettings;Qt;LXQt;
OnlyShowIn=LXQt;LXDE;
#TRANSLATIONS_DIR=translations

@ -0,0 +1,41 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include <LXQt/SingleApplication>
#include "main_window.h"
int main(int argc, char *argv[])
{
LxQt::SingleApplication a(argc, argv);
MainWindow w;
a.setActivationWindow(&w);
w.show();
return a.exec();
}

@ -0,0 +1,202 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "main_window.h"
#include "actions.h"
#include "default_model.h"
#include "edit_action_dialog.h"
#include "shortcut_delegate.h"
#include <QItemSelectionModel>
#include <QSortFilterProxyModel>
MainWindow::MainWindow(QWidget *parent)
: QDialog(parent)
, mEditActionDialog(0)
{
setupUi(this);
QColor grayedOutColour(actions_TV->palette().color(actions_TV->foregroundRole()));
QColor backgroundColour(actions_TV->palette().color(actions_TV->backgroundRole()));
grayedOutColour.toHsl();
backgroundColour.toHsl();
grayedOutColour.setHslF(grayedOutColour.hslHueF(), grayedOutColour.hslSaturationF(), (grayedOutColour.lightnessF() + backgroundColour.lightnessF() * 3) / 4.0);
grayedOutColour.toRgb();
QFont highlightedFont(actions_TV->font());
QFont italicFont(actions_TV->font());
QFont highlightedItalicFont(actions_TV->font());
highlightedFont.setBold(!highlightedFont.bold());
italicFont.setItalic(!italicFont.italic());
highlightedItalicFont.setItalic(!highlightedItalicFont.italic());
highlightedItalicFont.setBold(!highlightedItalicFont.bold());
mActions = new Actions(this);
mDefaultModel = new DefaultModel(mActions, grayedOutColour, highlightedFont, italicFont, highlightedItalicFont, this);
mSortFilterProxyModel = new QSortFilterProxyModel(this);
mSortFilterProxyModel->setSourceModel(mDefaultModel);
actions_TV->setModel(mSortFilterProxyModel);
mSelectionModel = new QItemSelectionModel(actions_TV->model());
actions_TV->setSelectionModel(mSelectionModel);
actions_TV->setItemDelegateForColumn(1, new ShortcutDelegate(mActions, this));
connect(mSelectionModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(selectionChanged(QItemSelection, QItemSelection)));
connect(mActions, SIGNAL(daemonDisappeared()), SLOT(daemonDisappeared()));
connect(mActions, SIGNAL(daemonAppeared()), SLOT(daemonAppeared()));
connect(mActions, SIGNAL(multipleActionsBehaviourChanged(MultipleActionsBehaviour)), SLOT(multipleActionsBehaviourChanged(MultipleActionsBehaviour)));
}
void MainWindow::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type())
{
case QEvent::LanguageChange:
retranslateUi(this);
break;
default:
break;
}
}
void MainWindow::daemonDisappeared()
{
add_PB->setEnabled(false);
actions_TV->setEnabled(false);
multipleActionsBehaviour_CB->setEnabled(false);
}
void MainWindow::daemonAppeared()
{
add_PB->setEnabled(true);
actions_TV->setEnabled(true);
multipleActionsBehaviour_CB->setEnabled(true);
multipleActionsBehaviour_CB->setCurrentIndex(mActions->multipleActionsBehaviour());
actions_TV->horizontalHeader()->setSortIndicator(0, Qt::AscendingOrder);
int m = actions_TV->model()->columnCount() - 1;
for (int i = 0; i < m; ++i)
{
actions_TV->resizeColumnToContents(i);
actions_TV->setColumnWidth(i, actions_TV->columnWidth(i) + 20);
}
}
void MainWindow::multipleActionsBehaviourChanged(MultipleActionsBehaviour behaviour)
{
multipleActionsBehaviour_CB->setCurrentIndex(behaviour);
}
void MainWindow::on_multipleActionsBehaviour_CB_currentIndexChanged(int index)
{
mActions->setMultipleActionsBehaviour(static_cast<MultipleActionsBehaviour>(index));
}
void MainWindow::selectionChanged(const QItemSelection &/*selected*/, const QItemSelection &/*deselected*/)
{
QModelIndexList rows = mSelectionModel->selectedRows();
modify_PB->setEnabled(rows.length() == 1);
remove_PB->setEnabled(rows.length() != 0);
bool enableSwap = (rows.length() == 2);
if (enableSwap)
{
QPair<bool, GeneralActionInfo> info0 = mActions->actionById(mDefaultModel->id(mSortFilterProxyModel->mapToSource(rows[0])));
QPair<bool, GeneralActionInfo> info1 = mActions->actionById(mDefaultModel->id(mSortFilterProxyModel->mapToSource(rows[1])));
enableSwap = (info0.first && info1.first && (info0.second.shortcut == info1.second.shortcut));
}
swap_PB->setEnabled(enableSwap);
}
void MainWindow::on_add_PB_clicked()
{
editAction(QModelIndex());
}
void MainWindow::on_modify_PB_clicked()
{
editAction(mSelectionModel->currentIndex());
}
void MainWindow::on_swap_PB_clicked()
{
QModelIndexList rows = mSelectionModel->selectedRows();
mActions->swapActions(mDefaultModel->id(mSortFilterProxyModel->mapToSource(rows[0])), mDefaultModel->id(mSortFilterProxyModel->mapToSource(rows[1])));
}
void MainWindow::on_remove_PB_clicked()
{
foreach(QModelIndex rowIndex, mSelectionModel->selectedRows())
mActions->removeAction(mDefaultModel->id(mSortFilterProxyModel->mapToSource(rowIndex)));
}
void MainWindow::on_actions_TV_doubleClicked(const QModelIndex &index)
{
switch (index.column())
{
case 0:
{
qulonglong id = mDefaultModel->id(mSortFilterProxyModel->mapToSource(index));
mActions->enableAction(id, !mActions->isActionEnabled(id));
}
break;
case 1:
break;
default:
editAction(index);
}
}
void MainWindow::editAction(const QModelIndex &index)
{
qulonglong id = 0;
if (index.isValid())
{
id = mDefaultModel->id(mSortFilterProxyModel->mapToSource(index));
}
if (!mEditActionDialog)
{
mEditActionDialog = new EditActionDialog(mActions, this);
}
if (mEditActionDialog->load(id))
{
mEditActionDialog->exec();
}
}

@ -0,0 +1,80 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_ACTION_CONFIG__MAIN_WINDOW__INCLUDED
#define GLOBAL_ACTION_CONFIG__MAIN_WINDOW__INCLUDED
#include "ui_main_window.h"
#include "../daemon/meta_types.h"
class Actions;
class DefaultModel;
class QItemSelectionModel;
class QSortFilterProxyModel;
class EditActionDialog;
class MainWindow : public QDialog, private Ui::MainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
public slots:
void daemonDisappeared();
void daemonAppeared();
void multipleActionsBehaviourChanged(MultipleActionsBehaviour behaviour);
protected:
void changeEvent(QEvent *e);
protected slots:
void selectionChanged(const QItemSelection &, const QItemSelection &);
void on_add_PB_clicked();
void on_modify_PB_clicked();
void on_swap_PB_clicked();
void on_remove_PB_clicked();
void on_multipleActionsBehaviour_CB_currentIndexChanged(int);
void on_actions_TV_doubleClicked(const QModelIndex &);
private:
Actions *mActions;
DefaultModel *mDefaultModel;
QSortFilterProxyModel *mSortFilterProxyModel;
QItemSelectionModel *mSelectionModel;
EditActionDialog *mEditActionDialog;
void editAction(const QModelIndex &);
};
#endif // GLOBAL_ACTION_CONFIG__MAIN_WINDOW__INCLUDED

@ -0,0 +1,212 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QDialog" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>720</width>
<height>314</height>
</rect>
</property>
<property name="windowTitle">
<string>Global Actions Manager</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QTableView" name="actions_TV">
<property name="editTriggers">
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="add_PB">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Add ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="remove_PB">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="modify_PB">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Modify ...</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="swap_PB">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Swap</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="multipleActionsBehaviour_L">
<property name="text">
<string>Multiple actions behaviour:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="multipleActionsBehaviour_CB">
<item>
<property name="text">
<string>First</string>
</property>
</item>
<item>
<property name="text">
<string>Last</string>
</property>
</item>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>All</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="close_PB">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>actions_TV</tabstop>
<tabstop>add_PB</tabstop>
<tabstop>remove_PB</tabstop>
<tabstop>modify_PB</tabstop>
<tabstop>swap_PB</tabstop>
<tabstop>close_PB</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>close_PB</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>476</x>
<y>281</y>
</hint>
<hint type="destinationlabel">
<x>488</x>
<y>260</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -0,0 +1,72 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "shortcut_delegate.h"
#include "shortcut_selector.h"
#include "actions.h"
#include <QTimer>
ShortcutDelegate::ShortcutDelegate(Actions *actions, QObject *parent)
: QItemDelegate(parent)
, mActions(actions)
{
}
QWidget *ShortcutDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */) const
{
ShortcutSelector *button = new ShortcutSelector(mActions, parent);
button->autoApplyShortcut();
QTimer::singleShot(0, button, SLOT(click()));
return button;
}
void ShortcutDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
ShortcutSelector *button = static_cast<ShortcutSelector*>(editor);
if (button->isGrabbing())
button->cancelNow();
model->setData(index, button->text(), Qt::EditRole);
}
void ShortcutDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
{
editor->setGeometry(option.rect);
}
void ShortcutDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
static_cast<QAbstractButton*>(editor)->setText(index.model()->data(index, Qt::EditRole).toString());
}
QSize ShortcutDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QSize sizeHint = QItemDelegate::sizeHint(option , index);
sizeHint.setHeight(sizeHint.height() + 15);
return sizeHint;
}

@ -0,0 +1,57 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_ACTION_CONFIG__SHORTCUT_DELEGATE__INCLUDED
#define GLOBAL_ACTION_CONFIG__SHORTCUT_DELEGATE__INCLUDED
#include <QItemDelegate>
class Actions;
class ShortcutDelegate : public QItemDelegate
{
Q_OBJECT
public:
explicit ShortcutDelegate(Actions *actions, QObject *parent = 0);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void setEditorData(QWidget *editor, const QModelIndex &index) const;
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
private:
Actions *mActions;
};
#endif // GLOBAL_ACTION_CONFIG__SHORTCUT_DELEGATE__INCLUDED

@ -0,0 +1,164 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "shortcut_selector.h"
#include "actions.h"
#include <QTimer>
#include <QMenu>
ShortcutSelector::ShortcutSelector(Actions *actions, QWidget *parent)
: QToolButton(parent)
, mActions(0)
, mShortcutTimer(new QTimer(this))
, mAutoApplyShortcut(false)
{
init();
setActions(actions);
}
ShortcutSelector::ShortcutSelector(QWidget *parent)
: QToolButton(parent)
, mActions(0)
, mShortcutTimer(new QTimer(this))
, mAutoApplyShortcut(false)
{
init();
}
void ShortcutSelector::init()
{
setCheckable(true);
setFocusPolicy(Qt::StrongFocus);
mShortcutTimer->setInterval(1000);
mShortcutTimer->setSingleShot(false);
connect(this, SIGNAL(clicked()), this, SLOT(grabShortcut()));
connect(mShortcutTimer, SIGNAL(timeout()), this, SLOT(shortcutTimer_timeout()));
}
void ShortcutSelector::setActions(Actions *actions)
{
if (mActions)
{
return;
}
mActions = actions;
connect(mActions, SIGNAL(grabShortcutCancelled()), this, SLOT(grabShortcut_fail()));
connect(mActions, SIGNAL(grabShortcutTimedout()), this, SLOT(grabShortcut_fail()));
connect(mActions, SIGNAL(grabShortcutFailed()), this, SLOT(grabShortcut_fail()));
connect(mActions, SIGNAL(shortcutGrabbed(QString)), this, SLOT(newShortcutGrabbed(QString)));
}
void ShortcutSelector::grabShortcut(int timeout)
{
if (!mActions)
{
return;
}
if (!isChecked())
{
mActions->cancelShortcutGrab();
return;
}
mTimeoutCounter = timeout;
mOldShortcut = text();
setText(QString::number(mTimeoutCounter));
mShortcutTimer->start();
mActions->grabShortcut(mTimeoutCounter * mShortcutTimer->interval());
}
void ShortcutSelector::shortcutTimer_timeout()
{
if (mTimeoutCounter > 0)
{
--mTimeoutCounter;
setText(QString::number(mTimeoutCounter));
}
else
setText(QString());
}
void ShortcutSelector::grabShortcut_fail()
{
if (isChecked())
{
setChecked(false);
mShortcutTimer->stop();
setText(mOldShortcut);
emit shortcutGrabbed(mOldShortcut);
}
}
void ShortcutSelector::newShortcutGrabbed(const QString &newShortcut)
{
setChecked(false);
mShortcutTimer->stop();
if (mAutoApplyShortcut)
setText(newShortcut);
else
setText(QString());
emit shortcutGrabbed(newShortcut);
}
void ShortcutSelector::clear()
{
setText(QString());
}
QAction * ShortcutSelector::addMenuAction(const QString &title)
{
QMenu *subMenu = menu();
if (!subMenu)
{
setPopupMode(QToolButton::MenuButtonPopup);
subMenu = new QMenu(this);
setMenu(subMenu);
}
QAction *action = new QAction(title, subMenu);
subMenu->addAction(action);
return action;
}
bool ShortcutSelector::isGrabbing() const
{
return isChecked();
}
void ShortcutSelector::cancelNow()
{
if (isChecked())
{
grabShortcut_fail();
mActions->cancelShortcutGrab();
}
}

@ -0,0 +1,80 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_ACTION_CONFIG__SHORTCUT_SELECTOR__INCLUDED
#define GLOBAL_ACTION_CONFIG__SHORTCUT_SELECTOR__INCLUDED
#include <QToolButton>
#include <QWidget>
#include <QString>
class Actions;
class QTimer;
class ShortcutSelector : public QToolButton
{
Q_OBJECT
public:
explicit ShortcutSelector(Actions *actions, QWidget *parent = 0);
explicit ShortcutSelector(QWidget *parent = 0);
void setActions(Actions *actions);
QAction *addMenuAction(const QString &title);
bool shortcutAutoApplied(void) const { return mAutoApplyShortcut; }
bool isGrabbing() const;
signals:
void shortcutGrabbed(const QString &);
public slots:
void grabShortcut(int timeout = 10);
void clear();
void autoApplyShortcut(bool value = true) { mAutoApplyShortcut = value; }
void cancelNow();
private slots:
void shortcutTimer_timeout();
void grabShortcut_fail();
void newShortcutGrabbed(const QString &);
private:
Actions *mActions;
QString mOldShortcut;
int mTimeoutCounter;
QTimer *mShortcutTimer;
bool mAutoApplyShortcut;
void init();
};
#endif // GLOBAL_ACTION_CONFIG__SHORTCUT_SELECTOR__INCLUDED

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="en_US">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Find a command</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shortcut</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Command</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add New</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reset</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Shortcut</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>New Group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reset Changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Question</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete group: %1? (everything inside will be removed altogether)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete %1?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Binding for %1 already exists. Replace old one?</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="ar" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation type="unfinished"/>
</message>
<message>
<source>Find a command</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation type="unfinished"/>
</message>
<message>
<source>Description</source>
<translation>الوصف</translation>
</message>
<message>
<source>Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Command</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add New</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>إزالة</translation>
</message>
<message>
<source>Add Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset</source>
<translation type="unfinished"/>
</message>
<message>
<source>Close</source>
<translation>إغلاق</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>شيء</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>إزالة</translation>
</message>
<message>
<source>New Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset Changes</source>
<translation type="unfinished"/>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[cs]=Nastavení klávesových zkratek
Comment[cs]=Nastavit celkové klávesové zkratky pro prostředí LxQt
GenericName[cs]=Nastavení celkových klávesových zkratek

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="cs" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Najít příkaz</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>Editor zkratek</translation>
</message>
<message>
<source>Description</source>
<translation>Popis</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Zkratka</translation>
</message>
<message>
<source>Command</source>
<translation>Příkaz</translation>
</message>
<message>
<source>Add New</source>
<translation>Přidat novou</translation>
</message>
<message>
<source>Remove</source>
<translation>Odstranit</translation>
</message>
<message>
<source>Add Group</source>
<translation>Přidat skupinu</translation>
</message>
<message>
<source>Reset</source>
<translation>Vynulovat</translation>
</message>
<message>
<source>Close</source>
<translation>Zavřít</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Žádná</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Přidat zkratku</translation>
</message>
<message>
<source>Remove</source>
<translation>Odstranit</translation>
</message>
<message>
<source>New Group</source>
<translation>Nová skupina</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Vynulovat změny</translation>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[cs_CZ]=Nastavení klávesových zkratek
Comment[cs_CZ]=Nastavit celkové klávesové zkratky pro prostředí LxQt
GenericName[cs_CZ]=Nastavení celkových klávesových zkratek

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="cs_CZ" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Najít příkaz</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>Editor zkratek</translation>
</message>
<message>
<source>Description</source>
<translation>Popis</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Zkratka</translation>
</message>
<message>
<source>Command</source>
<translation>Příkaz</translation>
</message>
<message>
<source>Add New</source>
<translation>Přidat novou</translation>
</message>
<message>
<source>Remove</source>
<translation>Odstranit</translation>
</message>
<message>
<source>Add Group</source>
<translation>Přidat skupinu</translation>
</message>
<message>
<source>Reset</source>
<translation>Vynulovat</translation>
</message>
<message>
<source>Close</source>
<translation>Zavřít</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Žádná</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Přidat zkratku</translation>
</message>
<message>
<source>Remove</source>
<translation>Odstranit</translation>
</message>
<message>
<source>New Group</source>
<translation>Nová skupina</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Vynulovat změny</translation>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[da]=Konfiguration af LxQt Tastaturgenveje
Comment[da]=Konfigurer globale tastaturgenveje for LxQt-skrivebordet
GenericName[da]=Konfiguration af LxQt Globale Tastaturgenveje

@ -0,0 +1,4 @@
# Translations
Name[da_DK]=Konfiguration af LxQt Tastaturgenveje
Comment[da_DK]=Konfigurer globale tastaturgenveje for LxQt-skrivebordet
GenericName[da_DK]=Konfiguration af LxQt Globale Tastaturgenveje

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="da_DK" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Find en kommando</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>LxQt Tastaturgenveje</translation>
</message>
<message>
<source>Description</source>
<translation>Beskrivelse</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Genvej</translation>
</message>
<message>
<source>Command</source>
<translation>Kommando</translation>
</message>
<message>
<source>Add New</source>
<translation>Tilføj ny</translation>
</message>
<message>
<source>Remove</source>
<translation>Fjern</translation>
</message>
<message>
<source>Add Group</source>
<translation>Tilføj gruppe</translation>
</message>
<message>
<source>Reset</source>
<translation>Nulstil</translation>
</message>
<message>
<source>Close</source>
<translation>Afslut</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Ingen</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Tilføj genvej</translation>
</message>
<message>
<source>Remove</source>
<translation>Fjern</translation>
</message>
<message>
<source>New Group</source>
<translation>Ny gruppe</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Nulstil ændringer</translation>
</message>
</context>
</TS>

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="de" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation type="unfinished"/>
</message>
<message>
<source>Find a command</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation type="unfinished"/>
</message>
<message>
<source>Description</source>
<translation type="unfinished"/>
</message>
<message>
<source>Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Command</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add New</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Entfernen</translation>
</message>
<message>
<source>Add Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset</source>
<translation type="unfinished"/>
</message>
<message>
<source>Close</source>
<translation>Schließen</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Entfernen</translation>
</message>
<message>
<source>New Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset Changes</source>
<translation type="unfinished"/>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[de_DE]=LxQt Hotkey Konfiguration
Comment[de_DE]=Globalen Hotkey für LxQt Desktop definieren
GenericName[de_DE]=LxQt Globale Hotkey Konfiguration

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="de_DE" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Finde einen Befehl</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>LxQt Hotkey Editor</translation>
</message>
<message>
<source>Description</source>
<translation>Beschreibung</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Hotkey</translation>
</message>
<message>
<source>Command</source>
<translation>Befehl</translation>
</message>
<message>
<source>Add New</source>
<translation>Hinzufügen</translation>
</message>
<message>
<source>Remove</source>
<translation>Entfernen</translation>
</message>
<message>
<source>Add Group</source>
<translation>Gruppe hinzufügen</translation>
</message>
<message>
<source>Reset</source>
<translation>Verwerfen</translation>
</message>
<message>
<source>Close</source>
<translation>Schließen</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Kein</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Hotkey hinzufügen</translation>
</message>
<message>
<source>Remove</source>
<translation>Entfernen</translation>
</message>
<message>
<source>New Group</source>
<translation>Neue Gruppe</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Änderungen verwerfen</translation>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[el_GR]=Διαμόρφωση συντομεύσεων LxQt
Comment[el_GR]=Διαμόρφωση των καθολικών συντομεύσεων του LxQt
GenericName[el_GR]=Διαμόρφωση καθολικών συντομεύσεων LxQt

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="el_GR" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Εύρεση εντολής</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>Επεξεργασία συντομεύσεων LxQt</translation>
</message>
<message>
<source>Description</source>
<translation>Περιγραφή</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Συντόμευση</translation>
</message>
<message>
<source>Command</source>
<translation>Εντολή</translation>
</message>
<message>
<source>Add New</source>
<translation>Προσθήκη νέας</translation>
</message>
<message>
<source>Remove</source>
<translation>Αφαίρεση</translation>
</message>
<message>
<source>Add Group</source>
<translation>Προσθήκη ομάδας</translation>
</message>
<message>
<source>Reset</source>
<translation>Επαναφορά</translation>
</message>
<message>
<source>Close</source>
<translation>Κλείσιμο</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Κανένα</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Προσθήκη συντόμευσης</translation>
</message>
<message>
<source>Remove</source>
<translation>Αφαίρεση</translation>
</message>
<message>
<source>New Group</source>
<translation>Νέα ομάδα</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Επαναφορά αλλαγών</translation>
</message>
</context>
</TS>

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="eo" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation type="unfinished"/>
</message>
<message>
<source>Find a command</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation type="unfinished"/>
</message>
<message>
<source>Description</source>
<translation>Priskribo</translation>
</message>
<message>
<source>Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Command</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add New</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Forigi</translation>
</message>
<message>
<source>Add Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset</source>
<translation type="unfinished"/>
</message>
<message>
<source>Close</source>
<translation>Fermi</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Nenio</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Forigi</translation>
</message>
<message>
<source>New Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset Changes</source>
<translation type="unfinished"/>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[es]=Configuración de Atajos de LxQt
Comment[es]=Configure atajos globales del Escritorio de LxQt
GenericName[es]=Configuración de Atajos Globales de LxQt

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="es" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Encontrar un comando</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>Editor de Atajos de LxQt</translation>
</message>
<message>
<source>Description</source>
<translation>Descripción</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Atajo</translation>
</message>
<message>
<source>Command</source>
<translation>Comando</translation>
</message>
<message>
<source>Add New</source>
<translation>Agregar nuevo</translation>
</message>
<message>
<source>Remove</source>
<translation>Borrar</translation>
</message>
<message>
<source>Add Group</source>
<translation>Agregar Grupo</translation>
</message>
<message>
<source>Reset</source>
<translation>Reiniciar</translation>
</message>
<message>
<source>Close</source>
<translation>Cerrar</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Ninguno</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Agregar Atajo</translation>
</message>
<message>
<source>Remove</source>
<translation>Borrar</translation>
</message>
<message>
<source>New Group</source>
<translation>Nuevo Grupo</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Reiniciar Cambios</translation>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[es_VE]=Configuracion de atajos de LxQt
Comment[es_VE]=Configura atajos de teclado para el escritorio LxQt
GenericName[es_VE]=Configuracion de Atajos globales de LxQt

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="es_VE" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Encontrar un comando</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>Editor de atajos</translation>
</message>
<message>
<source>Description</source>
<translation>Descripcion</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Atajo</translation>
</message>
<message>
<source>Command</source>
<translation>Comando</translation>
</message>
<message>
<source>Add New</source>
<translation>Agregar Nuevo</translation>
</message>
<message>
<source>Remove</source>
<translation>Remover</translation>
</message>
<message>
<source>Add Group</source>
<translation>Agregar Grupo</translation>
</message>
<message>
<source>Reset</source>
<translation>Reiniciar</translation>
</message>
<message>
<source>Close</source>
<translation>Cerrar</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Nada</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Nuevo atajo</translation>
</message>
<message>
<source>Remove</source>
<translation>Remover</translation>
</message>
<message>
<source>New Group</source>
<translation>Nuevo Grupo</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Reiniciar cambios</translation>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[eu]=LxQt lasterbideen konfigurazioa
Comment[eu]=Konfiguratu LxQt mahaigainaren lasterbide globalak
GenericName[eu]=LxQt lasterbide globalen konfigurazioa

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="eu" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Bilatu komando bat</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>LxQt lasterbide-editorea</translation>
</message>
<message>
<source>Description</source>
<translation>Deskribapena</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Lasterbidea</translation>
</message>
<message>
<source>Command</source>
<translation>Komandoa</translation>
</message>
<message>
<source>Add New</source>
<translation>Gehitu berria</translation>
</message>
<message>
<source>Remove</source>
<translation>Kendu</translation>
</message>
<message>
<source>Add Group</source>
<translation>Gehitu taldea</translation>
</message>
<message>
<source>Reset</source>
<translation>Berrezarri</translation>
</message>
<message>
<source>Close</source>
<translation>Itxi</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Bat ere ez</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Gehitu lasterbidea</translation>
</message>
<message>
<source>Remove</source>
<translation>Kendu</translation>
</message>
<message>
<source>New Group</source>
<translation>Talde berria</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Berrezarri aldaketak</translation>
</message>
</context>
</TS>

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="fi" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation type="unfinished"/>
</message>
<message>
<source>Find a command</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation type="unfinished"/>
</message>
<message>
<source>Description</source>
<translation>Kuvaus</translation>
</message>
<message>
<source>Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Command</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add New</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Poista</translation>
</message>
<message>
<source>Add Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset</source>
<translation type="unfinished"/>
</message>
<message>
<source>Close</source>
<translation>Sulje</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Poista</translation>
</message>
<message>
<source>New Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset Changes</source>
<translation type="unfinished"/>
</message>
</context>
</TS>

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="fr_FR" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation type="unfinished"/>
</message>
<message>
<source>Find a command</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation type="unfinished"/>
</message>
<message>
<source>Description</source>
<translation type="unfinished"/>
</message>
<message>
<source>Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Command</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add New</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Supprimer</translation>
</message>
<message>
<source>Add Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset</source>
<translation type="unfinished"/>
</message>
<message>
<source>Close</source>
<translation>Fermer</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Aucun(e)</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Supprimer</translation>
</message>
<message>
<source>New Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset Changes</source>
<translation type="unfinished"/>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[it_IT]=Configurazione delle scorciatoie di LxQt
Comment[it_IT]=Configura le scorciatoie globali del desktop LxQt
GenericName[it_IT]=Configurazione delle scorciatoie globali di LxQt

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="it_IT" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Trova un comando</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>Editor delle scorciatoie di LxQt</translation>
</message>
<message>
<source>Description</source>
<translation>Descrizione</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Scorciatoie</translation>
</message>
<message>
<source>Command</source>
<translation>Comando</translation>
</message>
<message>
<source>Add New</source>
<translation>Aggiungi nuova</translation>
</message>
<message>
<source>Remove</source>
<translation>Rimuovi</translation>
</message>
<message>
<source>Add Group</source>
<translation>Aggiungi gruppo</translation>
</message>
<message>
<source>Reset</source>
<translation>Azzera</translation>
</message>
<message>
<source>Close</source>
<translation>Chiudi</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Nessuna</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Aggiungi scorciatoia</translation>
</message>
<message>
<source>Remove</source>
<translation>Rimuovi</translation>
</message>
<message>
<source>New Group</source>
<translation>Nuovo gruppo</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Azzera le modifiche</translation>
</message>
</context>
</TS>

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="ja" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation type="unfinished"/>
</message>
<message>
<source>Find a command</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation type="unfinished"/>
</message>
<message>
<source>Description</source>
<translation type="unfinished"/>
</message>
<message>
<source>Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Command</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add New</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset</source>
<translation type="unfinished"/>
</message>
<message>
<source>Close</source>
<translation></translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation></translation>
</message>
<message>
<source>Add Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation type="unfinished"/>
</message>
<message>
<source>New Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset Changes</source>
<translation type="unfinished"/>
</message>
</context>
</TS>

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="lt" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation type="unfinished"/>
</message>
<message>
<source>Find a command</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation type="unfinished"/>
</message>
<message>
<source>Description</source>
<translation type="unfinished"/>
</message>
<message>
<source>Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Command</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add New</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Pašalinti</translation>
</message>
<message>
<source>Add Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset</source>
<translation type="unfinished"/>
</message>
<message>
<source>Close</source>
<translation>Uždaryti</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Nieko</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Pašalinti</translation>
</message>
<message>
<source>New Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset Changes</source>
<translation type="unfinished"/>
</message>
</context>
</TS>

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="nl" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation type="unfinished"/>
</message>
<message>
<source>Find a command</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation type="unfinished"/>
</message>
<message>
<source>Description</source>
<translation type="unfinished"/>
</message>
<message>
<source>Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Command</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add New</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Verwijderen</translation>
</message>
<message>
<source>Add Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset</source>
<translation type="unfinished"/>
</message>
<message>
<source>Close</source>
<translation>Sluiten</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Geen</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Verwijderen</translation>
</message>
<message>
<source>New Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset Changes</source>
<translation type="unfinished"/>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[pl_PL]=Konfiguracja skrótów pulpitu LxQt
Comment[pl_PL]=Określ globalny skrót pulpitu LxQt
GenericName[pl_PL]=Konfiguracja globalnych skrótów pulpitu LxQt

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="pl_PL" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Znajdź polecenie</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>Edytor Skrótów LxQt</translation>
</message>
<message>
<source>Description</source>
<translation>Opis</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Skrót</translation>
</message>
<message>
<source>Command</source>
<translation>Polecenie</translation>
</message>
<message>
<source>Add New</source>
<translation>Dodaj</translation>
</message>
<message>
<source>Remove</source>
<translation>Usuń</translation>
</message>
<message>
<source>Add Group</source>
<translation>Dodaj grupę</translation>
</message>
<message>
<source>Reset</source>
<translation>Reset</translation>
</message>
<message>
<source>Close</source>
<translation>Zamknij</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Brak</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Dodaj skrót</translation>
</message>
<message>
<source>Remove</source>
<translation>Usuń</translation>
</message>
<message>
<source>New Group</source>
<translation>Dodaj grupę</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Resetuj zmiany</translation>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[pt]=Teclas de atalho
GenericName[pt]=Definições das teclas de atalho
Comment[pt]=Configurar as teclas de atalho do LxQt

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="pt" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Encontrar um comando</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>Editor de atalhos do LxQt</translation>
</message>
<message>
<source>Description</source>
<translation>Descrição</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Atalho</translation>
</message>
<message>
<source>Command</source>
<translation>Comando</translation>
</message>
<message>
<source>Add New</source>
<translation>Adicionar</translation>
</message>
<message>
<source>Remove</source>
<translation>Remover</translation>
</message>
<message>
<source>Add Group</source>
<translation>Adicionar grupo</translation>
</message>
<message>
<source>Reset</source>
<translation>Restaurar</translation>
</message>
<message>
<source>Close</source>
<translation>Fechar</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Nada</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Adicionar atalho</translation>
</message>
<message>
<source>Remove</source>
<translation>Remover</translation>
</message>
<message>
<source>New Group</source>
<translation>Novo grupo</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Restaurar alterações</translation>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[pt_BR]=Configuração Do Atalho
Comment[pt_BR]=Configurar atalhos globais do desktop LxQt
GenericName[pt_BR]=Configurações Dos Atalhos Globais

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="pt_BR" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Encontrar um comando</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>Editor De Atalhos</translation>
</message>
<message>
<source>Description</source>
<translation>Descrição</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Atalho</translation>
</message>
<message>
<source>Command</source>
<translation>Comando</translation>
</message>
<message>
<source>Add New</source>
<translation>Adicionar Novo</translation>
</message>
<message>
<source>Remove</source>
<translation>Remover</translation>
</message>
<message>
<source>Add Group</source>
<translation>Adicionar Grupo</translation>
</message>
<message>
<source>Reset</source>
<translation>Redefinir</translation>
</message>
<message>
<source>Close</source>
<translation>Fechar</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Nenhum</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Adicionat Atalho</translation>
</message>
<message>
<source>Remove</source>
<translation>Remover</translation>
</message>
<message>
<source>New Group</source>
<translation>Novo Grupo</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Redefinir Alterações</translation>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[ro_RO]=Configurație acceleratori LxQt
Comment[ro_RO]=Configurează acceleratorii globali pentru LxQt
GenericName[ro_RO]=Configurație acceleratori globali LxQt

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="ro_RO" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Caută o comandă</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>Editor acceleratori LxQt</translation>
</message>
<message>
<source>Description</source>
<translation>Descriere</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Accelerator</translation>
</message>
<message>
<source>Command</source>
<translation>Comandă</translation>
</message>
<message>
<source>Add New</source>
<translation>Adaugă nou</translation>
</message>
<message>
<source>Remove</source>
<translation>Elimină</translation>
</message>
<message>
<source>Add Group</source>
<translation>Adaugă grup</translation>
</message>
<message>
<source>Reset</source>
<translation>Resetează</translation>
</message>
<message>
<source>Close</source>
<translation>Închide</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Nimic</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Adaugă accelerator</translation>
</message>
<message>
<source>Remove</source>
<translation>Elimină</translation>
</message>
<message>
<source>New Group</source>
<translation>Grup nou</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Resetează modificările</translation>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[ru]=Сочетания клавиш
Comment[ru]=Настроить сочетание клавиш в LxQt
GenericName[ru]=Настроить сочетания клавиш

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru">
<context>
<name>DefaultModel</name>
<message>
<location filename="../default_model.cpp" line="49"/>
<source>Command</source>
<translation>Команда</translation>
</message>
<message>
<location filename="../default_model.cpp" line="50"/>
<source>DBus call</source>
<translation>Вызов DBus</translation>
</message>
<message>
<location filename="../default_model.cpp" line="51"/>
<source>Client</source>
<translation>Клиент</translation>
</message>
<message>
<location filename="../default_model.cpp" line="147"/>
<source>Id</source>
<translation>id</translation>
</message>
<message>
<location filename="../default_model.cpp" line="150"/>
<source>Shortcut</source>
<translation>Сочетание клавиш</translation>
</message>
<message>
<location filename="../default_model.cpp" line="153"/>
<source>Description</source>
<translation>Описание</translation>
</message>
<message>
<location filename="../default_model.cpp" line="156"/>
<source>Type</source>
<translation>Тип</translation>
</message>
<message>
<location filename="../default_model.cpp" line="159"/>
<source>Info</source>
<translation>Информация</translation>
</message>
</context>
<context>
<name>EditActionDialog</name>
<message>
<location filename="../edit_action_dialog.ui" line="14"/>
<source>Edit Action</source>
<translation>Изменить действие</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="31"/>
<source>&amp;Shortcut:</source>
<translation>&amp;Сочетание клавиш:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="74"/>
<source>&amp;Description:</source>
<translation>&amp;Описание:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="87"/>
<source>&amp;Enabled</source>
<translation>&amp;Разрешено</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="102"/>
<source>&amp;Command</source>
<translation>&amp;Команда</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="109"/>
<source>&amp;DBus message</source>
<translation>Сообщение &amp;DBus</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="118"/>
<source>Type:</source>
<translation>Тип:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="164"/>
<source>Co&amp;mmand:</source>
<translation>Ко&amp;манда:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="206"/>
<source>S&amp;ervice:</source>
<translation>С&amp;ервис:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="219"/>
<source>&amp;Path:</source>
<translation>&amp;Путь:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="232"/>
<source>&amp;Interface:</source>
<translation>&amp;Интерфейс:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="245"/>
<source>&amp;Method:</source>
<translation>&amp;Метод:</translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<location filename="../main_window.ui" line="14"/>
<source>Global Actions Manager</source>
<translation>Управление глобальными действиями</translation>
</message>
<message>
<location filename="../main_window.ui" line="52"/>
<source>Add ...</source>
<translation>Добавить</translation>
</message>
<message>
<location filename="../main_window.ui" line="62"/>
<source>Remove</source>
<translation>Удалить</translation>
</message>
<message>
<location filename="../main_window.ui" line="72"/>
<source>Modify ...</source>
<translation>Изменить</translation>
</message>
<message>
<location filename="../main_window.ui" line="89"/>
<source>Swap</source>
<translation>Заменить</translation>
</message>
<message>
<location filename="../main_window.ui" line="115"/>
<source>Multiple actions behaviour:</source>
<translation>Поведение нескольких действий:</translation>
</message>
<message>
<location filename="../main_window.ui" line="123"/>
<source>First</source>
<translation>Первое</translation>
</message>
<message>
<location filename="../main_window.ui" line="128"/>
<source>Last</source>
<translation>Последнее</translation>
</message>
<message>
<location filename="../main_window.ui" line="133"/>
<source>None</source>
<translation>Не задано</translation>
</message>
<message>
<location filename="../main_window.ui" line="138"/>
<source>All</source>
<translation>Все</translation>
</message>
<message>
<location filename="../main_window.ui" line="176"/>
<source>Close</source>
<translation>Закрыть</translation>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[ru_RU]=Сочетания клавиш
Comment[ru_RU]=Настроить сочетание клавиш в LxQt
GenericName[ru_RU]=Настроить сочетания клавиш

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru_RU">
<context>
<name>DefaultModel</name>
<message>
<location filename="../default_model.cpp" line="49"/>
<source>Command</source>
<translation>Команда</translation>
</message>
<message>
<location filename="../default_model.cpp" line="50"/>
<source>DBus call</source>
<translation>Вызов DBus</translation>
</message>
<message>
<location filename="../default_model.cpp" line="51"/>
<source>Client</source>
<translation>Клиент</translation>
</message>
<message>
<location filename="../default_model.cpp" line="147"/>
<source>Id</source>
<translation>id</translation>
</message>
<message>
<location filename="../default_model.cpp" line="150"/>
<source>Shortcut</source>
<translation>Сочетание клавиш</translation>
</message>
<message>
<location filename="../default_model.cpp" line="153"/>
<source>Description</source>
<translation>Описание</translation>
</message>
<message>
<location filename="../default_model.cpp" line="156"/>
<source>Type</source>
<translation>Тип</translation>
</message>
<message>
<location filename="../default_model.cpp" line="159"/>
<source>Info</source>
<translation>Информация</translation>
</message>
</context>
<context>
<name>EditActionDialog</name>
<message>
<location filename="../edit_action_dialog.ui" line="14"/>
<source>Edit Action</source>
<translation>Изменить действие</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="31"/>
<source>&amp;Shortcut:</source>
<translation>&amp;Сочетание клавиш:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="74"/>
<source>&amp;Description:</source>
<translation>&amp;Описание:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="87"/>
<source>&amp;Enabled</source>
<translation>&amp;Разрешено</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="102"/>
<source>&amp;Command</source>
<translation>&amp;Команда</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="109"/>
<source>&amp;DBus message</source>
<translation>Сообщение &amp;DBus</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="118"/>
<source>Type:</source>
<translation>Тип:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="164"/>
<source>Co&amp;mmand:</source>
<translation>Ко&amp;манда:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="206"/>
<source>S&amp;ervice:</source>
<translation>С&amp;ервис:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="219"/>
<source>&amp;Path:</source>
<translation>&amp;Путь:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="232"/>
<source>&amp;Interface:</source>
<translation>&amp;Интерфейс:</translation>
</message>
<message>
<location filename="../edit_action_dialog.ui" line="245"/>
<source>&amp;Method:</source>
<translation>&amp;Метод:</translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<location filename="../main_window.ui" line="14"/>
<source>Global Actions Manager</source>
<translation>Управление глобальными действиями</translation>
</message>
<message>
<location filename="../main_window.ui" line="52"/>
<source>Add ...</source>
<translation>Добавить</translation>
</message>
<message>
<location filename="../main_window.ui" line="62"/>
<source>Remove</source>
<translation>Удалить</translation>
</message>
<message>
<location filename="../main_window.ui" line="72"/>
<source>Modify ...</source>
<translation>Изменить</translation>
</message>
<message>
<location filename="../main_window.ui" line="89"/>
<source>Swap</source>
<translation>Заменить</translation>
</message>
<message>
<location filename="../main_window.ui" line="115"/>
<source>Multiple actions behaviour:</source>
<translation>Поведение нескольких действий:</translation>
</message>
<message>
<location filename="../main_window.ui" line="123"/>
<source>First</source>
<translation>Первое</translation>
</message>
<message>
<location filename="../main_window.ui" line="128"/>
<source>Last</source>
<translation>Последнее</translation>
</message>
<message>
<location filename="../main_window.ui" line="133"/>
<source>None</source>
<translation>Не задано</translation>
</message>
<message>
<location filename="../main_window.ui" line="138"/>
<source>All</source>
<translation>Все</translation>
</message>
<message>
<location filename="../main_window.ui" line="176"/>
<source>Close</source>
<translation>Закрыть</translation>
</message>
</context>
</TS>

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="sl" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation type="unfinished"/>
</message>
<message>
<source>Find a command</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation type="unfinished"/>
</message>
<message>
<source>Description</source>
<translation type="unfinished"/>
</message>
<message>
<source>Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Command</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add New</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Odstrani</translation>
</message>
<message>
<source>Add Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset</source>
<translation type="unfinished"/>
</message>
<message>
<source>Close</source>
<translation>Zapri</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Brez</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation>Odstrani</translation>
</message>
<message>
<source>New Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset Changes</source>
<translation type="unfinished"/>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[th_TH]=การตั้งค่าปุ่มลัด LxQt
Comment[th_TH]=ตั้งค่าปุ่มลัดหลักของ LxQt เดกส์ท็อป
GenericName[th_TH]=การตั้งค่าปุ่มลัดหลัก LxQt

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="th_TH" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation></translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation> LxQt</translation>
</message>
<message>
<source>Description</source>
<translation></translation>
</message>
<message>
<source>Shortcut</source>
<translation></translation>
</message>
<message>
<source>Command</source>
<translation></translation>
</message>
<message>
<source>Add New</source>
<translation></translation>
</message>
<message>
<source>Remove</source>
<translation></translation>
</message>
<message>
<source>Add Group</source>
<translation></translation>
</message>
<message>
<source>Reset</source>
<translation></translation>
</message>
<message>
<source>Close</source>
<translation></translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation></translation>
</message>
<message>
<source>Add Shortcut</source>
<translation></translation>
</message>
<message>
<source>Remove</source>
<translation></translation>
</message>
<message>
<source>New Group</source>
<translation></translation>
</message>
<message>
<source>Reset Changes</source>
<translation></translation>
</message>
</context>
</TS>

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="tr" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation type="unfinished"/>
</message>
<message>
<source>Find a command</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation type="unfinished"/>
</message>
<message>
<source>Description</source>
<translation type="unfinished"/>
</message>
<message>
<source>Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Command</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add New</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation type="unfinished"/>
</message>
<message>
<source>Add Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset</source>
<translation type="unfinished"/>
</message>
<message>
<source>Close</source>
<translation>Kapat</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Yok</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation type="unfinished"/>
</message>
<message>
<source>Remove</source>
<translation type="unfinished"/>
</message>
<message>
<source>New Group</source>
<translation type="unfinished"/>
</message>
<message>
<source>Reset Changes</source>
<translation type="unfinished"/>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[uk]=Налаштування скорочень LxQt
Comment[uk]=Налаштувати глобальні скорочення стільниці LxQt
GenericName[uk]=Налаштування глобальних скорочень LxQt

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="uk" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation>Знайти команду</translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>Редактор скорочень LxQt</translation>
</message>
<message>
<source>Description</source>
<translation>Опис</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Cкорочення</translation>
</message>
<message>
<source>Command</source>
<translation>Команда</translation>
</message>
<message>
<source>Add New</source>
<translation>Додати нове</translation>
</message>
<message>
<source>Remove</source>
<translation>Вилучити</translation>
</message>
<message>
<source>Add Group</source>
<translation>Додати групу</translation>
</message>
<message>
<source>Reset</source>
<translation>Cкинути</translation>
</message>
<message>
<source>Close</source>
<translation>Закрити</translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation>Нічого</translation>
</message>
<message>
<source>Add Shortcut</source>
<translation>Додати скорочення</translation>
</message>
<message>
<source>Remove</source>
<translation>Вилучити</translation>
</message>
<message>
<source>New Group</source>
<translation>Нова група</translation>
</message>
<message>
<source>Reset Changes</source>
<translation>Скинути зміни</translation>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[zh_CN]=LxQt 快捷键配置
Comment[zh_CN]=配置 LxQt 桌面全局快捷键
GenericName[zh_CN]=LxQt 全局快捷键配置

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="zh_CN" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation></translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>LxQt </translation>
</message>
<message>
<source>Description</source>
<translation></translation>
</message>
<message>
<source>Shortcut</source>
<translation></translation>
</message>
<message>
<source>Command</source>
<translation></translation>
</message>
<message>
<source>Add New</source>
<translation></translation>
</message>
<message>
<source>Remove</source>
<translation></translation>
</message>
<message>
<source>Add Group</source>
<translation></translation>
</message>
<message>
<source>Reset</source>
<translation></translation>
</message>
<message>
<source>Close</source>
<translation></translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation></translation>
</message>
<message>
<source>Add Shortcut</source>
<translation></translation>
</message>
<message>
<source>Remove</source>
<translation></translation>
</message>
<message>
<source>New Group</source>
<translation></translation>
</message>
<message>
<source>Reset Changes</source>
<translation></translation>
</message>
</context>
</TS>

@ -0,0 +1,4 @@
# Translations
Name[zh_TW]=LxQt快捷鍵設定
Comment[zh_TW]=設定LxQt桌面的全域快捷鍵
GenericName[zh_TW]=LxQt全域快捷鍵設定

@ -0,0 +1,75 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS language="zh_TW" version="2.0">
<context>
<name>CommandFinder</name>
<message>
<source>...</source>
<translation>...</translation>
</message>
<message>
<source>Find a command</source>
<translation></translation>
</message>
</context>
<context>
<name>ShortcutConfigWindow</name>
<message>
<source>LxQt Shortcut Editor</source>
<translation>LxQt</translation>
</message>
<message>
<source>Description</source>
<translation></translation>
</message>
<message>
<source>Shortcut</source>
<translation></translation>
</message>
<message>
<source>Command</source>
<translation></translation>
</message>
<message>
<source>Add New</source>
<translation></translation>
</message>
<message>
<source>Remove</source>
<translation></translation>
</message>
<message>
<source>Add Group</source>
<translation></translation>
</message>
<message>
<source>Reset</source>
<translation></translation>
</message>
<message>
<source>Close</source>
<translation></translation>
</message>
</context>
<context>
<name>ShortcutEditor</name>
<message>
<source>None</source>
<translation></translation>
</message>
<message>
<source>Add Shortcut</source>
<translation></translation>
</message>
<message>
<source>Remove</source>
<translation></translation>
</message>
<message>
<source>New Group</source>
<translation></translation>
</message>
<message>
<source>Reset Changes</source>
<translation></translation>
</message>
</context>
</TS>

@ -0,0 +1,152 @@
set(PROJECT_NAME lxqt-globalkeysd)
project(${PROJECT_NAME})
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
find_package(X11)
include_directories(${X11_INCLUDE_DIR})
set(QT_DBUS_PREFIX "org.qtproject")
include_directories(
${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
set(${PROJECT_NAME}_SOURCES
main.cpp
core.cpp
daemon_adaptor.cpp
native_adaptor.cpp
client_proxy.cpp
log_target.cpp
pipe_utils.cpp
string_utils.cpp
base_action.cpp
method_action.cpp
client_action.cpp
command_action.cpp
meta_types.cpp
)
set(${PROJECT_NAME}_CPP_HEADERS
log_target.h
pipe_utils.h
string_utils.h
base_action.h
method_action.h
client_action.h
command_action.h
meta_types.h
)
set(${PROJECT_NAME}_FORMS
)
set(${PROJECT_NAME}_RESOURCES
)
set(${PROJECT_NAME}_TRANSLATIONS
)
set(${PROJECT_NAME}_DBUS_ADAPTORS
org.lxqt.global_key_shortcuts.daemon.xml
org.lxqt.global_key_shortcuts.native.xml
)
set_source_files_properties(org.lxqt.global_key_shortcuts.daemon.xml PROPERTIES
INCLUDE daemon_adaptor.h
PARENT_CLASSNAME DaemonAdaptor
BASENAME org.lxqt.global_key_shortcuts.daemon
CLASSNAME OrgLxqtGlobalActionDaemonAdaptor
)
set_source_files_properties(org.lxqt.global_key_shortcuts.native.xml PROPERTIES
INCLUDE native_adaptor.h
PARENT_CLASSNAME NativeAdaptor
BASENAME org.lxqt.global_key_shortcuts.native
CLASSNAME OrgLxqtGlobalActionNativeAdaptor
)
set(${PROJECT_NAME}_DBUS_INTERFACES
org.lxqt.global_key_shortcuts.client.xml
)
set_source_files_properties(org.lxqt.global_key_shortcuts.client.xml PROPERTIES
BASENAME org.lxqt.global_key_shortcuts.client
)
set(${PROJECT_NAME}_HEADERS
${${PROJECT_NAME}_CPP_HEADERS}
)
set(${PROJECT_NAME}_TRANSLATABLE
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS}
${${PROJECT_NAME}_FORMS}
)
foreach(DBUS_ADAPTOR ${${PROJECT_NAME}_DBUS_ADAPTORS})
get_filename_component(DBUS_ADAPTOR_FILENAME ${DBUS_ADAPTOR} NAME)
configure_file(
${DBUS_ADAPTOR}
${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}
@ONLY
)
get_source_file_property(DBUS_ADAPTOR_INCLUDE ${DBUS_ADAPTOR} INCLUDE)
get_source_file_property(DBUS_ADAPTOR_PARENT_CLASSNAME ${DBUS_ADAPTOR} PARENT_CLASSNAME)
get_source_file_property(DBUS_ADAPTOR_BASENAME ${DBUS_ADAPTOR} BASENAME)
get_source_file_property(DBUS_ADAPTOR_CLASSNAME ${DBUS_ADAPTOR} CLASSNAME)
if(DBUS_ADAPTOR_BASENAME)
if(DBUS_ADAPTOR_CLASSNAME)
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME} ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME} ${DBUS_ADAPTOR_BASENAME} ${DBUS_ADAPTOR_CLASSNAME})
else()
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME} ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME} ${DBUS_ADAPTOR_BASENAME})
endif()
else()
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME} ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME})
endif()
endforeach()
foreach(DBUS_INTERFACE ${${PROJECT_NAME}_DBUS_INTERFACES})
get_filename_component(DBUS_INTERFACE_FILENAME ${DBUS_INTERFACE} NAME)
configure_file(
${DBUS_INTERFACE}
${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}
@ONLY
)
get_source_file_property(DBUS_INTERFACE_BASENAME ${DBUS_INTERFACE} BASENAME)
get_source_file_property(DBUS_INTERFACE_INCLUDE ${DBUS_INTERFACE} INCLUDE)
get_source_file_property(DBUS_INTERFACE_CLASSNAME ${DBUS_INTERFACE} CLASSNAME)
get_source_file_property(DBUS_INTERFACE_NO_NAMESPACE ${DBUS_INTERFACE} NO_NAMESPACE)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} PROPERTIES
INCLUDE ${DBUS_INTERFACE_INCLUDE}
CLASSNAME ${DBUS_INTERFACE_CLASSNAME}
NO_NAMESPACE ${DBUS_INTERFACE_NO_NAMESPACE}
)
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} ${DBUS_INTERFACE_BASENAME})
endforeach()
qt5_add_resources(${PROJECT_NAME}_RESOURCE_FILES ${${PROJECT_NAME}_RESOURCES})
qt5_wrap_ui(${PROJECT_NAME}_FORM_FILES ${${PROJECT_NAME}_FORMS})
set(${PROJECT_NAME}_GENERATED_FILES
${${PROJECT_NAME}_FORM_FILES}
${${PROJECT_NAME}_RESOURCE_FILES}
${${PROJECT_NAME}_QM_FILES}
${${PROJECT_NAME}_DBUS_INTERFACE_FILES}
${${PROJECT_NAME}_DBUS_ADAPTOR_FILES}
)
set(${PROJECT_NAME}_ALL_FILES
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS}
${${PROJECT_NAME}_GENERATED_FILES}
)
add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_ALL_FILES})
target_link_libraries(${PROJECT_NAME} ${X11_LIBRARIES} Qt5::Widgets Qt5::DBus)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

@ -0,0 +1,41 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "base_action.h"
#include "log_target.h"
BaseAction::BaseAction(LogTarget *logTarget, const QString &description)
: mLogTarget(logTarget)
, mDescription(description)
, mEnabled(true)
{
}
BaseAction::~BaseAction()
{
}

@ -0,0 +1,62 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_ACTION_DAEMON__BASE_ACTION__INCLUDED
#define GLOBAL_ACTION_DAEMON__BASE_ACTION__INCLUDED
#include <QString>
class LogTarget;
class BaseAction
{
public:
BaseAction(LogTarget *logTarget, const QString &description);
virtual ~BaseAction();
virtual const char *type() const = 0;
virtual bool call() = 0;
const QString &description() const { return mDescription; }
void setDescription(const QString &description) { mDescription = description; }
void setEnabled(bool value = true) { mEnabled = value; }
void setDisabled(bool value = true) { mEnabled = !value; }
bool isEnabled() const { return mEnabled; }
protected:
LogTarget *mLogTarget;
private:
QString mDescription;
bool mEnabled;
};
#endif // GLOBAL_ACTION_DAEMON__BASE_ACTION__INCLUDED

@ -0,0 +1,94 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "client_action.h"
#include "client_proxy.h"
#include "log_target.h"
ClientAction::ClientAction(LogTarget *logTarget, const QDBusObjectPath &path, const QString &description)
: BaseAction(logTarget, description)
, mProxy(0)
, mPath(path)
{
}
ClientAction::ClientAction(LogTarget *logTarget, const QDBusConnection &connection, const QString &service, const QDBusObjectPath &path, const QString &description)
: BaseAction(logTarget, description)
, mProxy(0)
, mPath(path)
{
appeared(connection, service);
}
ClientAction::~ClientAction()
{
delete mProxy;
}
bool ClientAction::call()
{
if (!isEnabled())
{
return false;
}
if (!mProxy)
{
mLogTarget->log(LOG_WARNING, "No native client: \"%s\"", qPrintable(mService));
return false;
}
mProxy->emitActivated();
return true;
}
void ClientAction::appeared(const QDBusConnection &connection, const QString &service)
{
if (mProxy) // should never happen
{
return;
}
mService = service;
mProxy = new ClientProxy(mService, QDBusObjectPath("/global_key_shortcuts" + mPath.path()), connection);
}
void ClientAction::disappeared()
{
mService.clear();
delete mProxy;
mProxy = 0;
}
void ClientAction::shortcutChanged(const QString &oldShortcut, const QString &newShortcut)
{
if (mProxy)
{
mProxy->emitShortcutChanged(oldShortcut, newShortcut);
}
}

@ -0,0 +1,71 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_ACTION_DAEMON__DBUS_ACTION__INCLUDED
#define GLOBAL_ACTION_DAEMON__DBUS_ACTION__INCLUDED
#include "base_action.h"
#include <QString>
#include <QDBusObjectPath>
#include <QDBusConnection>
class ClientProxy;
class ClientAction : public BaseAction
{
public:
ClientAction(LogTarget *logTarget, const QDBusObjectPath &path, const QString &description);
ClientAction(LogTarget *logTarget, const QDBusConnection &connection, const QString &service, const QDBusObjectPath &path, const QString &description);
~ClientAction();
static const char *id() { return "client"; }
virtual const char *type() const { return id(); }
virtual bool call();
void shortcutChanged(const QString &oldShortcut, const QString &newShortcut);
const QString &service() const { return mService; }
const QDBusObjectPath &path() const { return mPath; }
void appeared(const QDBusConnection &connection, const QString &service);
void disappeared();
bool isPresent() const { return mProxy; }
private:
ClientProxy *mProxy;
QString mService;
QDBusObjectPath mPath;
};
#endif // GLOBAL_ACTION_DAEMON__DBUS_ACTION__INCLUDED

@ -0,0 +1,50 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "client_proxy.h"
#include "org.lxqt.global_key_shortcuts.client.h"
ClientProxy::ClientProxy(const QString &service, const QDBusObjectPath &path, const QDBusConnection &connection, QObject *parent)
: QObject(parent)
{
org::lxqt::global_key_shortcuts::client *iface = new org::lxqt::global_key_shortcuts::client(service, path.path(), connection, this);
connect(this, SIGNAL(activated()), iface, SLOT(activated()));
connect(this, SIGNAL(shortcutChanged(QString, QString)), iface, SLOT(shortcutChanged(QString, QString)));
}
void ClientProxy::emitActivated()
{
emit activated();
}
void ClientProxy::emitShortcutChanged(const QString &oldShortcut, const QString &newShortcut)
{
emit shortcutChanged(oldShortcut, newShortcut);
}

@ -0,0 +1,57 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_ACTION_DAEMON__CLIENT_PROXY__INCLUDED
#define GLOBAL_ACTION_DAEMON__CLIENT_PROXY__INCLUDED
#include <QObject>
#include <QDBusObjectPath>
#include <QDBusConnection>
class ClientAction;
class ClientProxy : public QObject
{
Q_OBJECT
friend class ClientAction;
public:
ClientProxy(const QString &service, const QDBusObjectPath &path, const QDBusConnection &connection, QObject *parent = 0);
signals:
void activated();
void shortcutChanged(const QString &oldShortcut, const QString &newShortcut);
protected:
void emitActivated();
void emitShortcutChanged(const QString &oldShortcut, const QString &newShortcut);
};
#endif // GLOBAL_ACTION_DAEMON__CLIENT_PROXY__INCLUDED

@ -0,0 +1,60 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "command_action.h"
#include <QProcess>
#include <errno.h>
#include <string.h>
#include "log_target.h"
#include "string_utils.h"
CommandAction::CommandAction(LogTarget *logTarget, const QString &command, const QStringList &args, const QString &description)
: BaseAction(logTarget, description)
, mCommand(command)
, mArgs(args)
{
}
bool CommandAction::call()
{
if (!isEnabled())
{
return false;
}
bool result = QProcess::startDetached(mCommand, mArgs);
if (!result)
{
mLogTarget->log(LOG_WARNING, "Failed to launch command \"%s\"%s", qPrintable(mCommand), qPrintable(joinToString(mArgs, " \"", "\" \"", "\"")));
}
return result;
}

@ -0,0 +1,58 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_ACTION_DAEMON__COMMAND_ACTION__INCLUDED
#define GLOBAL_ACTION_DAEMON__COMMAND_ACTION__INCLUDED
#include "base_action.h"
#include <QString>
#include <QStringList>
class CommandAction : public BaseAction
{
public:
CommandAction(LogTarget *logTarget, const QString &command, const QStringList &args, const QString &description);
static const char *id() { return "command"; }
virtual const char *type() const { return id(); }
virtual bool call();
QString command() const { return mCommand; }
QStringList args() const { return mArgs; }
private:
QString mCommand;
QStringList mArgs;
};
#endif // GLOBAL_ACTION_DAEMON__COMMAND_ACTION__INCLUDED

File diff suppressed because it is too large Load Diff

@ -0,0 +1,254 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef GLOBAL_ACTION_DAEMON__CORE__INCLUDED
#define GLOBAL_ACTION_DAEMON__CORE__INCLUDED
#include <QThread>
#include <QMap>
#include <QSet>
#include <QString>
#include <QQueue>
#include <QMutex>
#include <QList>
#include <QPair>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDBusObjectPath>
#include "meta_types.h"
#include "log_target.h"
extern "C" {
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xproto.h>
#undef Bool
}
class QTimer;
class DaemonAdaptor;
class NativeAdaptor;
class DBusProxy;
class BaseAction;
template<class Key>
class QOrderedSet : public QMap<Key, Key>
{
public:
typename QMap<Key, Key>::iterator insert(const Key &akey)
{
return QMap<Key, Key>::insert(akey, akey);
}
};
class Core : public QThread, public LogTarget
{
Q_OBJECT
public:
Core(bool useSyslog, bool minLogLevelSet, int minLogLevel, const QStringList &configFiles, bool multipleActionsBehaviourSet, MultipleActionsBehaviour multipleActionsBehaviour, QObject *parent = 0);
~Core();
bool ready() const { return mReady; }
virtual void log(int level, const char *format, ...) const;
signals:
void onShortcutGrabbed();
private:
Core(const Core &);
Core &operator = (const Core &);
private:
typedef QPair<KeyCode, unsigned int> X11Shortcut;
typedef QMap<X11Shortcut, QString> ShortcutByX11;
typedef QMap<QString, X11Shortcut> X11ByShortcut;
typedef QOrderedSet<qulonglong> Ids;
typedef QMap<QString, Ids> IdsByShortcut;
typedef QDBusObjectPath ClientPath;
typedef QMap<ClientPath, qulonglong> IdByClientPath;
typedef QPair<QString, BaseAction *> ShortcutAndAction;
typedef QMap<qulonglong, ShortcutAndAction> ShortcutAndActionById;
typedef QMap<ClientPath, QString> SenderByClientPath;
typedef QSet<ClientPath> ClientPaths;
typedef QMap<QString, ClientPaths> ClientPathsBySender;
private slots:
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
void serviceDisappeared(const QString &sender);
void addClientAction(QPair<QString, qulonglong> &result, const QString &shortcut, const QDBusObjectPath &path, const QString &description, const QString &sender);
void addMethodAction(QPair<QString, qulonglong> &result, const QString &shortcut, const QString &service, const QDBusObjectPath &path, const QString &interface, const QString &method, const QString &description);
void addCommandAction(QPair<QString, qulonglong> &result, const QString &shortcut, const QString &command, const QStringList &arguments, const QString &description);
void modifyClientAction(qulonglong &result, const QDBusObjectPath &path, const QString &description, const QString &sender);
void modifyActionDescription(bool &result, const qulonglong &id, const QString &description);
void modifyMethodAction(bool &result, const qulonglong &id, const QString &service, const QDBusObjectPath &path, const QString &interface, const QString &method, const QString &description);
void modifyCommandAction(bool &result, const qulonglong &id, const QString &command, const QStringList &arguments, const QString &description);
void enableClientAction(bool &result, const QDBusObjectPath &path, bool enabled, const QString &sender);
void isClientActionEnabled(bool &enabled, const QDBusObjectPath &path, const QString &sender);
void enableAction(bool &result, qulonglong id, bool enabled);
void isActionEnabled(bool &enabled, qulonglong id);
void getClientActionSender(QString &sender, qulonglong id);
void changeClientActionShortcut(QPair<QString, qulonglong> &result, const QDBusObjectPath &path, const QString &shortcut, const QString &sender);
void changeShortcut(QString &result, const qulonglong &id, const QString &shortcut);
void swapActions(bool &result, const qulonglong &id1, const qulonglong &id2);
void removeClientAction(bool &result, const QDBusObjectPath &path, const QString &sender);
void removeAction(bool &result, const qulonglong &id);
void deactivateClientAction(bool &result, const QDBusObjectPath &path, const QString &sender);
void setMultipleActionsBehaviour(const MultipleActionsBehaviour &behaviour);
void getMultipleActionsBehaviour(MultipleActionsBehaviour &result) const;
void getAllActionIds(QList<qulonglong> &result) const;
void getActionById(QPair<bool, GeneralActionInfo> &result, const qulonglong &id) const;
void getAllActions(QMap<qulonglong, GeneralActionInfo> &result) const;
void getClientActionInfoById(QPair<bool, ClientActionInfo> &result, const qulonglong &id) const;
void getMethodActionInfoById(QPair<bool, MethodActionInfo> &result, const qulonglong &id) const;
void getCommandActionInfoById(QPair<bool, CommandActionInfo> &result, const qulonglong &id) const;
void grabShortcut(const uint &timeout, QString &shortcut, bool &failed, bool &cancelled, bool &timedout, const QDBusMessage &message);
void cancelShortcutGrab();
void shortcutGrabbed();
void shortcutGrabTimedout();
private:
QPair<QString, qulonglong> addOrRegisterClientAction(const QString &shortcut, const QDBusObjectPath &path, const QString &description, const QString &sender);
qulonglong registerClientAction(const QString &shortcut, const QDBusObjectPath &path, const QString &description);
qulonglong registerMethodAction(const QString &shortcut, const QString &service, const QDBusObjectPath &path, const QString &interface, const QString &method, const QString &description);
qulonglong registerCommandAction(const QString &shortcut, const QString &command, const QStringList &arguments, const QString &description);
GeneralActionInfo actionInfo(const ShortcutAndAction &shortcutAndAction) const;
friend void unixSignalHandler(int signalNumber);
void unixSignalHandler(int signalNumber);
friend int x11ErrorHandler(Display *display, XErrorEvent *errorEvent);
int x11ErrorHandler(Display *display, XErrorEvent *errorEvent);
X11Shortcut ShortcutToX11(const QString &shortcut);
QString X11ToShortcut(const X11Shortcut &X11shortcut);
void wakeX11Thread();
void run();
KeyCode remoteStringToKeycode(const QString &str);
QString remoteKeycodeToString(KeyCode keyCode);
bool remoteXGrabKey(const X11Shortcut &X11shortcut);
bool remoteXUngrabKey(const X11Shortcut &X11shortcut);
QString grabOrReuseKey(const X11Shortcut &X11shortcut, const QString &shortcut);
QString checkShortcut(const QString &shortcut, X11Shortcut &X11shortcut);
bool isEscape(KeySym keySym, unsigned int modifiers);
bool isModifier(KeySym keySym);
bool isAllowed(KeySym keySym, unsigned int modifiers);
void saveConfig();
void lockX11Error();
bool checkX11Error(int level = LOG_NOTICE, uint timeout = 10);
bool waitForX11Error(int level, uint timeout);
private:
bool mReady;
bool mUseSyslog;
int mMinLogLevel;
int mX11ErrorPipe[2];
int mX11RequestPipe[2];
int mX11ResponsePipe[2];
Display *mDisplay;
Window mInterClientCommunicationWindow;
bool mX11EventLoopActive;
mutable QMutex mX11ErrorMutex;
QDBusConnection *mSessionConnection;
DaemonAdaptor *mDaemonAdaptor;
NativeAdaptor *mNativeAdaptor;
mutable QMutex mDataMutex;
qulonglong mLastId;
bool mGrabbingShortcut;
X11ByShortcut mX11ByShortcut;
ShortcutByX11 mShortcutByX11;
IdsByShortcut mIdsByShortcut;
ShortcutAndActionById mShortcutAndActionById;
IdByClientPath mIdByClientPath;
SenderByClientPath mSenderByClientPath; // add: path->sender
ClientPathsBySender mClientPathsBySender; // disappear: sender->[path]
unsigned int NumLockMask;
unsigned int ScrollLockMask;
unsigned int CapsLockMask;
unsigned int AltMask;
unsigned int MetaMask;
unsigned int Level3Mask;
unsigned int Level5Mask;
MultipleActionsBehaviour mMultipleActionsBehaviour;
bool mAllowGrabLocks;
bool mAllowGrabBaseSpecial;
bool mAllowGrabMiscSpecial;
bool mAllowGrabBaseKeypad;
bool mAllowGrabMiscKeypad;
bool mAllowGrabPrintable;
QString mConfigFile;
bool mSaveAllowed;
QTimer *mShortcutGrabTimeout;
QDBusMessage mShortcutGrabRequest;
bool mShortcutGrabRequested;
bool mSuppressX11ErrorMessages;
};
#endif // GLOBAL_ACTION_DAEMON__CORE__INCLUDED

@ -0,0 +1,299 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2013 Razor team
* Authors:
* Kuzma Shapran <kuzma.shapran@gmail.com>
*
* This program or 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
*
* END_COMMON_COPYRIGHT_HEADER */
#include "daemon_adaptor.h"
#include "org.lxqt.global_key_shortcuts.daemon.h"
DaemonAdaptor::DaemonAdaptor(QObject *parent)
: QObject(parent)
, QDBusContext()
{
new OrgLxqtGlobalActionDaemonAdaptor(this);
}
QString DaemonAdaptor::addMethodAction(const QString &shortcut, const QString &service, const QDBusObjectPath &path, const QString &interface, const QString &method, const QString &description, qulonglong &id)
{
QPair<QString, qulonglong> result;
emit onAddMethodAction(result, shortcut, service, path, interface, method, description);
QString usedShortcut = result.first;
id = result.second;
if (id)
{
emit actionAdded(id);
}
return usedShortcut;
}
QString DaemonAdaptor::addCommandAction(const QString &shortcut, const QString &command, const QStringList &arguments, const QString &description, qulonglong &id)
{
QPair<QString, qulonglong> result;
emit onAddCommandAction(result, shortcut, command, arguments, description);
QString usedShortcut = result.first;
id = result.second;
if (id)
{
emit actionAdded(id);
}
return usedShortcut;
}
bool DaemonAdaptor::modifyActionDescription(qulonglong id, const QString &description)
{
bool result;
emit onModifyActionDescription(result, id, description);
if (result)
{
emit actionModified(id);
}
return result;
}
bool DaemonAdaptor::modifyMethodAction(qulonglong id, const QString &service, const QDBusObjectPath &path, const QString &interface, const QString &method, const QString &description)
{
bool result;
emit onModifyMethodAction(result, id, service, path, interface, method, description);
if (result)
{
emit actionModified(id);
}
return result;
}
bool DaemonAdaptor::modifyCommandAction(qulonglong id, const QString &command, const QStringList &arguments, const QString &description)
{
bool result;
emit onModifyCommandAction(result, id, command, arguments, description);
if (result)
{
emit actionModified(id);
}
return result;
}
bool DaemonAdaptor::enableAction(qulonglong id, bool enabled)
{
bool result;
emit onEnableAction(result, id, enabled);
if (result)
{
emit actionEnabled(id, enabled);
}
return result;
}
bool DaemonAdaptor::isActionEnabled(qulonglong id)
{
bool enabled;
emit onIsActionEnabled(enabled, id);
return enabled;
}
QString DaemonAdaptor::getClientActionSender(qulonglong id)
{
QString sender;
emit onGetClientActionSender(sender, id);
return sender;
}
QString DaemonAdaptor::changeShortcut(qulonglong id, const QString &shortcut)
{
QString result;
emit onChangeShortcut(result, id, shortcut);
if (!result.isEmpty())
{
emit actionShortcutChanged(id);
}
return result;
}
bool DaemonAdaptor::swapActions(qulonglong id1, qulonglong id2)
{
bool result;
emit onSwapActions(result, id1, id2);
if (result)
{
emit actionsSwapped(id1, id2);
}
return result;
}
bool DaemonAdaptor::removeAction(qulonglong id)
{
bool result;
emit onRemoveAction(result, id);
if (result)
{
emit actionRemoved(id);
}
return result;
}
bool DaemonAdaptor::setMultipleActionsBehaviour(uint behaviour)
{
if (behaviour >= MULTIPLE_ACTIONS_BEHAVIOUR__COUNT)
{
return false;
}
emit onSetMultipleActionsBehaviour(static_cast<MultipleActionsBehaviour>(behaviour));
emit multipleActionsBehaviourChanged(behaviour);
return true;
}
uint DaemonAdaptor::getMultipleActionsBehaviour()
{
MultipleActionsBehaviour result;
emit onGetMultipleActionsBehaviour(result);
return result;
}
QList<qulonglong> DaemonAdaptor::getAllActionIds()
{
QList<qulonglong> result;
emit onGetAllActionIds(result);
return result;
}
bool DaemonAdaptor::getActionById(qulonglong id, QString &shortcut, QString &description, bool &enabled, QString &type, QString &info)
{
QPair<bool, GeneralActionInfo> result;
emit onGetActionById(result, id);
bool success = result.first;
if (success)
{
shortcut = result.second.shortcut;
description = result.second.description;
enabled = result.second.enabled;
type = result.second.type;
info = result.second.info;
}
return success;
}
QMap<qulonglong, GeneralActionInfo> DaemonAdaptor::getAllActions()
{
QMap<qulonglong, GeneralActionInfo> result;
emit onGetAllActions(result);
return result;
}
bool DaemonAdaptor::getClientActionInfoById(qulonglong id, QString &shortcut, QString &description, bool &enabled, QDBusObjectPath &path)
{
QPair<bool, ClientActionInfo> result;
emit onGetClientActionInfoById(result, id);
bool success = result.first;
if (success)
{
shortcut = result.second.shortcut;
description = result.second.description;
enabled = result.second.enabled;
path = result.second.path;
}
return success;
}
bool DaemonAdaptor::getMethodActionInfoById(qulonglong id, QString &shortcut, QString &description, bool &enabled, QString &service, QDBusObjectPath &path, QString &interface, QString &method)
{
QPair<bool, MethodActionInfo> result;
emit onGetMethodActionInfoById(result, id);
bool success = result.first;
if (success)
{
shortcut = result.second.shortcut;
description = result.second.description;
enabled = result.second.enabled;
service = result.second.service;
path = result.second.path;
interface = result.second.interface;
method = result.second.method;
}
return success;
}
bool DaemonAdaptor::getCommandActionInfoById(qulonglong id, QString &shortcut, QString &description, bool &enabled, QString &command, QStringList &arguments)
{
QPair<bool, CommandActionInfo> result;
emit onGetCommandActionInfoById(result, id);
bool success = result.first;
if (success)
{
shortcut = result.second.shortcut;
description = result.second.description;
enabled = result.second.enabled;
command = result.second.command;
arguments = result.second.arguments;
}
return success;
}
QString DaemonAdaptor::grabShortcut(uint timeout, bool &failed, bool &cancelled, bool &timedout)
{
QString shortcut;
emit onGrabShortcut(timeout, shortcut, failed, cancelled, timedout, message());
return shortcut;
}
void DaemonAdaptor::cancelShortcutGrab()
{
emit onCancelShortcutGrab();
}
void DaemonAdaptor::quit()
{
emit onQuit();
}
void DaemonAdaptor::emit_actionAdded(qulonglong id)
{
emit actionAdded(id);
}
void DaemonAdaptor::emit_actionModified(qulonglong id)
{
emit actionModified(id);
}
void DaemonAdaptor::emit_actionRemoved(qulonglong id)
{
emit actionRemoved(id);
}
void DaemonAdaptor::emit_actionShortcutChanged(qulonglong id)
{
emit actionShortcutChanged(id);
}
void DaemonAdaptor::emit_actionEnabled(qulonglong id, bool enabled)
{
emit actionEnabled(id, enabled);
}
void DaemonAdaptor::emit_clientActionSenderChanged(qulonglong id, const QString &sender)
{
emit clientActionSenderChanged(id, sender);
}

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

Loading…
Cancel
Save