This commit is contained in:
Valeria Fadeeva 2023-04-17 20:56:22 +05:00
commit 6f29c89d7e
43 changed files with 6368 additions and 0 deletions

15
.github/FUNDING.yml vendored Executable file
View File

@ -0,0 +1,15 @@
# These are supported funding model platforms
#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
#patreon: # Replace with a single Patreon username
#open_collective: # Replace with a single Open Collective username
#ko_fi: # Replace with a single Ko-fi username
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
#liberapay: # Replace with a single Liberapay username
#issuehunt: # Replace with a single IssueHunt username
#otechie: # Replace with a single Otechie username
#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
#github: [Valeria-Fadeeva]
custom: ["https://www.tinkoff.ru/rm/fadeeva.valeriya96/9bLRi79066", "https://yoomoney.ru/to/4100115921160758", "https://qiwi.com/n/VALERIAFADEEVA", "valeria.fadeeva.me"]

661
LICENSE Normal file
View File

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

11
README.md Normal file
View File

@ -0,0 +1,11 @@
# melawy-plasma-plasmoid-OnzeMenuKDE
OnzeMenuKDE plasmoid
### Donate
[Tinkoff](https://www.tinkoff.ru/rm/fadeeva.valeriya96/9bLRi79066)
[YooMoney](https://yoomoney.ru/to/4100115921160758)
[Qiwi](https://qiwi.com/n/VALERIAFADEEVA)
Etherium 0x981FBf878fe451BDB83BEaF68078394d4B13213f

View File

@ -0,0 +1,30 @@
/***************************************************************************
* Copyright (C) 2014 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.0
import org.kde.plasma.configuration 2.0
ConfigModel {
ConfigCategory {
name: i18n("General")
icon: "kde"
source: "ConfigGeneral.qml"
}
}

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="General">
<entry name="displayPosition" type="Enum">
<label>Position.</label>
<choices name="Settings::displayPosition">
<choice name="Default" />
<choice name="Center" />
<choice name="CenterBottom" />
</choices>
<default>2</default>
</entry>
<entry name="icon" type="String">
<default>start-here-kde</default>
</entry>
<entry name="useCustomButtonImage" type="Bool">
<default>false</default>
</entry>
<entry name="customButtonImage" type="Url">
<default></default>
</entry>
<entry name="showFilterList" type="Bool">
<default>true</default>
</entry>
<entry name="appNameFormat" type="Int">
<default>0</default>
</entry>
<entry name="limitDepth" type="Bool">
<default>false</default>
</entry>
<entry name="numberColumns" type="Int">
<default>6</default>
</entry>
<entry name="numberRows" type="Int">
<default>3</default>
</entry>
<entry name="defaultSize" type="String">
<default>Medium</default>
</entry>
<entry name="favoriteApps" type="StringList">
<default>preferred://browser,kontact.desktop,systemsettings.desktop,org.kde.dolphin.desktop,ktp-contactlist.desktop,org.kde.kate.desktop</default>
</entry>
<entry name="favoriteSystemActions" type="StringList">
<default>logout,lock-screen,reboot,shutdown</default>
</entry>
<entry name="hiddenApplications" type="StringList">
<default></default>
</entry>
<entry name="useExtraRunners" type="Bool">
<default>true</default>
</entry>
<entry name="extraRunners" type="StringList">
<default>bookmarks,baloosearch</default>
</entry>
<entry name="alignResultsToBottom" type="Bool">
<default>true</default>
</entry>
<entry name="switchCategoriesOnHover" type="Bool">
<label>Whether to switch between menu categories by hovering them.</label>
<default>true</default>
</entry>
<entry name="labels2lines" type="Bool">
<default>true</default>
</entry>
<entry name="removeApplicationCommand" type="String">
<default>muon-discover --application</default>
</entry>
<entry name="showAtCenter" type="Bool">
<default>true</default>
</entry>
<entry name="showFavoritesFirst" type="Bool">
<default>false</default>
</entry>
<entry name="favoritesPortedToKAstats" type="Bool">
<label>Are the favorites ported to use KActivitiesStats to allow per-activity favorites</label>
<default>false</default>
</entry>
<entry name="viewUser" type="Bool">
<default>true</default>
</entry>
</group>
</kcfg>

View File

@ -0,0 +1,54 @@
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
Rectangle{
id:item
implicitHeight: units.gridUnit * 1.8
width: lb.implicitWidth + units.smallSpacing * 5 + icon.width
border.width: 1
border.color: mouseItem.containsMouse ? theme.highlightColor : colorWithAlpha(theme.textColor,0.2)
radius: 4
color: theme.backgroundColor
property alias text: lb.text
property bool flat: false
property alias iconName: icon.source
property bool mirror: false
signal clicked
RowLayout{
id: row
anchors.fill: parent
anchors.leftMargin: units.smallSpacing * 2
anchors.rightMargin: units.smallSpacing * 2
spacing: units.smallSpacing
LayoutMirroring.enabled: mirror
Label{
id: lb
color: theme.textColor
}
PlasmaCore.IconItem {
id: icon
implicitHeight: units.gridUnit
implicitWidth: implicitHeight
}
}
MouseArea {
id: mouseItem
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: item.clicked()
}
}

View File

@ -0,0 +1,138 @@
/***************************************************************************
* Copyright (C) 2013 by Aurélien Gâteau <agateau@kde.org> *
* Copyright (C) 2014-2015 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
id: root
property QtObject menu
property Item visualParent
property variant actionList
property bool opened: menu ? (menu.status != PlasmaComponents.DialogStatus.Closed) : false
signal actionClicked(string actionId, variant actionArgument)
signal closed
onActionListChanged: refreshMenu();
onOpenedChanged: {
if (!opened) {
closed();
}
}
function open(x, y) {
if (!actionList) {
return;
}
if (x && y) {
menu.open(x, y);
} else {
menu.open();
}
}
function refreshMenu() {
if (menu) {
menu.destroy();
}
if (!actionList) {
return;
}
menu = contextMenuComponent.createObject(root);
fillMenu(menu, actionList);
}
function fillMenu(menu, items) {
items.forEach(function(actionItem) {
if (actionItem.subActions) {
// This is a menu
var submenuItem = contextSubmenuItemComponent.createObject(
menu, { "actionItem" : actionItem });
fillMenu(submenuItem.submenu, actionItem.subActions);
} else {
var item = contextMenuItemComponent.createObject(
menu,
{
"actionItem": actionItem,
}
);
}
});
}
Component {
id: contextMenuComponent
PlasmaComponents.ContextMenu {
visualParent: root.visualParent
}
}
Component {
id: contextSubmenuItemComponent
PlasmaComponents.MenuItem {
id: submenuItem
property variant actionItem
text: actionItem.text ? actionItem.text : ""
icon: actionItem.icon ? actionItem.icon : null
property variant submenu : submenu_
PlasmaComponents.ContextMenu {
id: submenu_
visualParent: submenuItem.action
}
}
}
Component {
id: contextMenuItemComponent
PlasmaComponents.MenuItem {
property variant actionItem
text : actionItem.text ? actionItem.text : ""
enabled : actionItem.type != "title" && ("enabled" in actionItem ? actionItem.enabled : true)
separator : actionItem.type == "separator"
section : actionItem.type == "title"
icon : actionItem.icon ? actionItem.icon : null
checkable : actionItem.checkable ? actionItem.checkable : false
checked : actionItem.checked ? actionItem.checked : false
onClicked: {
actionClicked(actionItem.actionId, actionItem.actionArgument);
}
}
}
}

View File

@ -0,0 +1,113 @@
/***************************************************************************
* Copyright (C) 2013-2014 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
Item {
id: root
readonly property var screenGeometry: plasmoid.screenGeometry
readonly property bool inPanel: (plasmoid.location == PlasmaCore.Types.TopEdge
|| plasmoid.location == PlasmaCore.Types.RightEdge
|| plasmoid.location == PlasmaCore.Types.BottomEdge
|| plasmoid.location == PlasmaCore.Types.LeftEdge)
readonly property bool vertical: (plasmoid.formFactor == PlasmaCore.Types.Vertical)
readonly property bool useCustomButtonImage: (plasmoid.configuration.useCustomButtonImage
&& plasmoid.configuration.customButtonImage.length != 0)
property QtObject dashWindow: null
Plasmoid.status: dashWindow && dashWindow.visible ? PlasmaCore.Types.RequiresAttentionStatus : PlasmaCore.Types.PassiveStatus
onWidthChanged: updateSizeHints()
onHeightChanged: updateSizeHints()
function updateSizeHints() {
if (useCustomButtonImage) {
if (vertical) {
var scaledHeight = Math.floor(parent.width * (buttonIcon.implicitHeight / buttonIcon.implicitWidth));
root.Layout.minimumHeight = scaledHeight;
root.Layout.maximumHeight = scaledHeight;
root.Layout.minimumWidth = units.iconSizes.small;
root.Layout.maximumWidth = inPanel ? units.iconSizeHints.panel : -1;
} else {
var scaledWidth = Math.floor(parent.height * (buttonIcon.implicitWidth / buttonIcon.implicitHeight));
root.Layout.minimumWidth = scaledWidth;
root.Layout.maximumWidth = scaledWidth;
root.Layout.minimumHeight = units.iconSizes.small;
root.Layout.maximumHeight = inPanel ? units.iconSizeHints.panel : -1;
}
} else {
root.Layout.minimumWidth = units.iconSizes.small;
root.Layout.maximumWidth = inPanel ? units.iconSizeHints.panel : -1;
root.Layout.minimumHeight = units.iconSizes.small
root.Layout.maximumHeight = inPanel ? units.iconSizeHints.panel : -1;
}
}
Connections {
target: units.iconSizeHints
onPanelChanged: updateSizeHints()
}
PlasmaCore.IconItem {
id: buttonIcon
anchors.fill: parent
readonly property double aspectRatio: (vertical ? implicitHeight / implicitWidth
: implicitWidth / implicitHeight)
source: useCustomButtonImage ? plasmoid.configuration.customButtonImage : plasmoid.configuration.icon
active: mouseArea.containsMouse
smooth: true
// A custom icon could also be rectangular. However, if a square, custom, icon is given, assume it
// to be an icon and round it to the nearest icon size again to avoid scaling artefacts.
roundToIconSize: !useCustomButtonImage || aspectRatio === 1
onSourceChanged: updateSizeHints()
}
MouseArea
{
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
dashWindow.visible = !dashWindow.visible;
}
}
Component.onCompleted: {
dashWindow = Qt.createQmlObject("MenuRepresentation {}", root);
plasmoid.activated.connect(function() {
dashWindow.visible = !dashWindow.visible;
});
}
}

View File

@ -0,0 +1,216 @@
/***************************************************************************
* Copyright (C) 2014 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
import org.kde.draganddrop 2.0 as DragDrop
import org.kde.plasma.private.kicker 0.1 as Kicker
import "code/tools.js" as Logic
import org.kde.kirigami 2.4 as Kirigami
Kirigami.FormLayout {
id: configGeneral
width: childrenRect.width
height: childrenRect.height
property string cfg_icon: plasmoid.configuration.icon
property bool cfg_useCustomButtonImage: plasmoid.configuration.useCustomButtonImage
property string cfg_customButtonImage: plasmoid.configuration.customButtonImage
//property alias cfg_appNameFormat: appNameFormat.currentIndex
//property alias cfg_switchCategoriesOnHover: switchCategoriesOnHover.checked
property alias cfg_useExtraRunners: useExtraRunners.checked
property alias cfg_numberColumns: numberColumns.value
property alias cfg_numberRows: numberRows.value
property alias cfg_labels2lines: labels2lines.checked
property alias cfg_displayPosition: displayPosition.currentIndex
property string cfg_defaultSize
// ----------------- Icon -----------------
Button {
Kirigami.FormData.label: i18n("Icon:")
id: iconButton
//Layout.minimumWidth: previewFrame.width + units.smallSpacing * 2
//Layout.maximumWidth: Layout.minimumWidth
//Layout.minimumHeight: previewFrame.height + units.smallSpacing * 2
//Layout.maximumHeight: Layout.minimumWidth
implicitWidth: previewFrame.width + units.smallSpacing * 2
implicitHeight: previewFrame.height + units.smallSpacing * 2
DragDrop.DropArea {
id: dropArea
property bool containsAcceptableDrag: false
anchors.fill: parent
onDragEnter: {
// Cannot use string operations (e.g. indexOf()) on "url" basic type.
var urlString = event.mimeData.url.toString();
// This list is also hardcoded in KIconDialog.
var extensions = [".png", ".xpm", ".svg", ".svgz"];
containsAcceptableDrag = urlString.indexOf("file:///") === 0 && extensions.some(function (extension) {
return urlString.indexOf(extension) === urlString.length - extension.length; // "endsWith"
});
if (!containsAcceptableDrag) {
event.ignore();
}
}
onDragLeave: containsAcceptableDrag = false
onDrop: {
if (containsAcceptableDrag) {
// Strip file:// prefix, we already verified in onDragEnter that we have only local URLs.
iconDialog.setCustomButtonImage(event.mimeData.url.toString().substr("file://".length));
}
containsAcceptableDrag = false;
}
}
KQuickAddons.IconDialog {
id: iconDialog
function setCustomButtonImage(image) {
cfg_customButtonImage = image || cfg_icon || "start-here-kde"
cfg_useCustomButtonImage = true;
}
onIconNameChanged: setCustomButtonImage(iconName);
}
// just to provide some visual feedback, cannot have checked without checkable enabled
checkable: true
checked: dropArea.containsAcceptableDrag
onClicked: {
checked = Qt.binding(function() { // never actually allow it being checked
return iconMenu.status === PlasmaComponents.DialogStatus.Open || dropArea.containsAcceptableDrag;
})
iconMenu.open(0, height)
}
PlasmaCore.FrameSvgItem {
id: previewFrame
anchors.centerIn: parent
imagePath: plasmoid.location === PlasmaCore.Types.Vertical || plasmoid.location === PlasmaCore.Types.Horizontal
? "widgets/panel-background" : "widgets/background"
width: units.iconSizes.large + fixedMargins.left + fixedMargins.right
height: units.iconSizes.large + fixedMargins.top + fixedMargins.bottom
PlasmaCore.IconItem {
anchors.centerIn: parent
width: units.iconSizes.large
height: width
source: cfg_useCustomButtonImage ? cfg_customButtonImage : cfg_icon
}
}
}
// QQC Menu can only be opened at cursor position, not a random one
PlasmaComponents.ContextMenu {
id: iconMenu
visualParent: iconButton
PlasmaComponents.MenuItem {
text: i18nc("@item:inmenu Open icon chooser dialog", "Choose...")
icon: "document-open-folder"
onClicked: iconDialog.open()
}
PlasmaComponents.MenuItem {
text: i18nc("@item:inmenu Reset icon to default", "Clear Icon")
icon: "edit-clear"
onClicked: {
cfg_useCustomButtonImage = false;
}
}
}
ComboBox {
id: displayPosition
Kirigami.FormData.label: i18n("Menu position")
model: [
i18n("Default"),
i18n("Center"),
i18n("Center bottom"),
]
onActivated: cfg_displayPosition = currentIndex
}
// title: i18n("Search")
//
//
CheckBox {
id: useExtraRunners
text: i18n("Expand search to bookmarks, files and emails")
}
CheckBox {
id: labels2lines
text: i18n("Show labels in two lines")
}
SpinBox{
id: numberColumns
minimumValue: 4
maximumValue: 10
Kirigami.FormData.label: i18n("Number of columns (main grid)")
}
SpinBox{
id: numberRows
minimumValue: 1
maximumValue: 10
Kirigami.FormData.label: i18n("Number of rows (main grid)")
}
ComboBox {
id: defaultFormatCombo
Kirigami.FormData.label: i18n("Size of icons")
model: Logic.formats
currentIndex: defaultFormatCombo.model.indexOf(cfg_defaultSize)
onActivated: cfg_defaultSize = model[index]
}
}

View File

@ -0,0 +1,120 @@
import QtQuick 2.4
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.12
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.private.kicker 0.1 as Kicker
import org.kde.kcoreaddons 1.0 as KCoreAddons // kuser
import org.kde.plasma.private.shell 2.0
import org.kde.kwindowsystem 1.0
import QtGraphicalEffects 1.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.private.quicklaunch 1.0
RowLayout{
spacing: units.largeSpacing
KCoreAddons.KUser { id: kuser }
Logic { id: logic }
PlasmaCore.DataSource {
id: pmEngine
engine: "powermanagement"
connectedSources: ["PowerDevil", "Sleep States"]
function performOperation(what) {
var service = serviceForSource("PowerDevil")
var operation = service.operationDescription(what)
service.startOperationCall(operation)
}
}
Image {
id: iconUser
source: kuser.faceIconUrl.toString() || "user-identity"
cache: false
visible: source !== ""
Layout.leftMargin: 10
sourceSize.height: parent.height * 0.7
sourceSize.width: parent.height * 0.7
fillMode: Image.PreserveAspectFit
// Crop the avatar to fit in a circle, like the lock and login screens
// but don't on software rendering where this won't render
layer.enabled:true // iconUser.GraphicsInfo.api !== GraphicsInfo.Software
layer.effect: OpacityMask {
// this Rectangle is a circle due to radius size
maskSource: Rectangle {
width: iconUser.width
height: iconUser.height
radius: height / 2
visible: false
}
}
}
PlasmaExtras.Heading {
wrapMode: Text.NoWrap
color: theme.textColor
level: 3
font.bold: true
//font.weight: Font.Bold
text: qsTr(kuser.fullName)
}
Item{
Layout.fillWidth: true
}
PlasmaComponents3.ToolButton {
icon.name: "user-home"
onClicked: logic.openUrl("file:///usr/share/applications/org.kde.dolphin.desktop")
ToolTip.delay: 1000
ToolTip.timeout: 1000
ToolTip.visible: hovered
ToolTip.text: i18n("User Home")
}
PlasmaComponents3.ToolButton {
icon.name: "configure"
onClicked: logic.openUrl("file:///usr/share/applications/systemsettings.desktop")
ToolTip.delay: 1000
ToolTip.timeout: 1000
ToolTip.visible: hovered
ToolTip.text: i18n("System Preferences")
}
PlasmaComponents3.ToolButton {
icon.name: "system-lock-screen"
onClicked: pmEngine.performOperation("lockScreen")
ToolTip.delay: 1000
ToolTip.timeout: 1000
ToolTip.visible: hovered
ToolTip.text: i18n("Lock Screen")
visible: pmEngine.data["Sleep States"]["LockScreen"]
}
PlasmaComponents3.ToolButton {
icon.name: "system-shutdown"
onClicked: pmEngine.performOperation("requestShutDown")
Layout.rightMargin: 10
ToolTip.delay: 1000
ToolTip.timeout: 1000
ToolTip.visible: hovered
ToolTip.text: i18n("Leave ...")
}
}

View File

@ -0,0 +1,139 @@
/***************************************************************************
* Copyright (C) 2015 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import "code/tools.js" as Tools
Item {
id: item
width: GridView.view.cellWidth
height: GridView.view.cellHeight
property bool showLabel: true
property int itemIndex: model.index
property string favoriteId: model.favoriteId !== undefined ? model.favoriteId : ""
property url url: model.url !== undefined ? model.url : ""
property variant icon: model.decoration !== undefined ? model.decoration : ""
property var m: model
property bool hasActionList: ((model.favoriteId !== null)
|| (("hasActionList" in model) && (model.hasActionList === true)))
Accessible.role: Accessible.MenuItem
Accessible.name: model.display
function openActionMenu(x, y) {
var actionList = hasActionList ? model.actionList : [];
Tools.fillActionMenu(i18n, actionMenu, actionList, GridView.view.model.favoritesModel, model.favoriteId);
actionMenu.visualParent = item;
actionMenu.open(x, y);
}
function actionTriggered(actionId, actionArgument) {
var close = (Tools.triggerAction(GridView.view.model, model.index, actionId, actionArgument) === true);
if (close) {
root.toggle();
}
}
PlasmaCore.IconItem {
id: icon
anchors.left: parent.left
anchors.leftMargin: units.smallSpacing
anchors.verticalCenter: parent.verticalCenter
width: iconSize
height: width
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
animated: false
usesPlasmaTheme: item.GridView.view.usesPlasmaTheme
source: {
return model.decoration
//if (model.display.indexOf(".") === -1 ) {
// var s = "-" + model.url
// if( s[s.length - 8 ] == "."){
// return model.decoration
// }
// return "folder"
//}else{
// return model.decoration
//}
}
}
PlasmaComponents.Label {
id: label
visible: showLabel
anchors {
left: icon.right
leftMargin: units.smallSpacing
//top: icon.top
verticalCenter: icon.verticalCenter
}
maximumLineCount: 1
elide: Text.ElideRight
wrapMode: Text.Wrap
color: theme.textColor
width: parent.width - icon.width - units.largeSpacing
text: ("name" in model ? model.name : model.display)
}
PlasmaComponents.Label {
anchors.right: parent.right
anchors.rightMargin: units.smallSpacing
anchors.verticalCenter: label.verticalCenter
visible: showLabel
horizontalAlignment: Text.AlignRight
maximumLineCount: 1
width: parent.width - label.implicitWidth - icon.width * 2
elide: Text.ElideRight
wrapMode: Text.Wrap
color: colorWithAlpha(theme.textColor,0.6)
text: model.description
}
PlasmaCore.ToolTipArea {
id: toolTip
property string text: model.display
anchors.fill: parent
active: root.visible && label.truncated
mainItem: toolTipDelegate
onContainsMouseChanged: item.GridView.view.itemContainsMouseChanged(containsMouse)
}
Keys.onPressed: {
if (event.key === Qt.Key_Menu && hasActionList) {
event.accepted = true;
openActionMenu(item);
} else if ((event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) {
event.accepted = true;
if ("trigger" in GridView.view.model) {
GridView.view.model.trigger(index, "", null);
root.toggle();
}
itemGrid.itemActivated(index, "", null);
}
}
}

View File

@ -0,0 +1,122 @@
/***************************************************************************
* Copyright (C) 2015 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import "code/tools.js" as Tools
Item {
id: item
height: GridView.view.cellHeight
width: GridView.view.cellWidth // height
property int iconSize: 22
property bool showLabel: true
property int itemIndex: model.index
property string favoriteId: model.favoriteId !== undefined ? model.favoriteId : ""
property url url: model.url !== undefined ? model.url : ""
property variant icon: model.decoration !== undefined ? model.decoration : ""
property var m: model
property bool hasActionList: ((model.favoriteId !== null)
|| (("hasActionList" in model) && (model.hasActionList === true)))
Accessible.role: Accessible.MenuItem
Accessible.name: model.display
function openActionMenu(x, y) {
var actionList = hasActionList ? model.actionList : [];
Tools.fillActionMenu(i18n, actionMenu, actionList, GridView.view.model.favoritesModel, model.favoriteId);
actionMenu.visualParent = item;
actionMenu.open(x, y);
}
function actionTriggered(actionId, actionArgument) {
var close = (Tools.triggerAction(GridView.view.model, model.index, actionId, actionArgument) === true);
if (close) {
root.toggle();
}
}
PlasmaCore.IconItem {
id: icon
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -units.gridUnit
width: iconSize
height: width
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
animated: false
usesPlasmaTheme: item.GridView.view.usesPlasmaTheme
source: model.decoration
}
PlasmaComponents.Label {
id: label
visible: showLabel
anchors {
horizontalCenter: icon.horizontalCenter
top: icon.bottom
topMargin: units.smallSpacing
}
width: parent.width - units.largeSpacing
maximumLineCount: 2
height: units.gridUnit * 2
elide: Text.ElideRight
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignTop
wrapMode: Text.Wrap
color: theme.textColor
text: ("name" in model ? model.name : model.display)
}
PlasmaCore.ToolTipArea {
id: toolTip
property string text: model.display
anchors.fill: parent
active: root.visible && label.truncated
mainItem: toolTipDelegate
onContainsMouseChanged: item.GridView.view.itemContainsMouseChanged(containsMouse)
}
Keys.onPressed: {
if (event.key === Qt.Key_Menu && hasActionList) {
event.accepted = true;
openActionMenu(item);
} else if ((event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) {
event.accepted = true;
if ("trigger" in GridView.view.model) {
GridView.view.model.trigger(index, "", null);
root.toggle();
}
itemGrid.itemActivated(index, "", null);
}
}
}

View File

@ -0,0 +1,139 @@
/***************************************************************************
* Copyright (C) 2015 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import QtQuick.Layouts 1.0
import "code/tools.js" as Tools
Item {
id: item
width: GridView.view.cellWidth
height: GridView.view.cellHeight
property bool showLabel: true
property int numColumns: 1
property int itemIndex: model.index
property string favoriteId: model.favoriteId !== undefined ? model.favoriteId : ""
property url url: model.url !== undefined ? model.url : ""
property variant icon: model.decoration !== undefined ? model.decoration : ""
property var m: model
property bool hasActionList: ((model.favoriteId !== null)
|| (("hasActionList" in model) && (model.hasActionList === true)))
Accessible.role: Accessible.MenuItem
Accessible.name: model.display
function openActionMenu(x, y) {
var actionList = hasActionList ? model.actionList : [];
Tools.fillActionMenu(i18n, actionMenu, actionList, GridView.view.model.favoritesModel, model.favoriteId);
actionMenu.visualParent = item;
actionMenu.open(x, y);
}
function colorWithAlpha(color, alpha) {
return Qt.rgba(color.r, color.g, color.b, alpha)
}
function actionTriggered(actionId, actionArgument) {
var close = (Tools.triggerAction(GridView.view.model, model.index, actionId, actionArgument) === true);
if (close) root.toggle();
}
PlasmaCore.IconItem {
id: icon
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: units.smallSpacing
width: units.iconSizes.medium
height: width
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
animated: false
usesPlasmaTheme: item.GridView.view.usesPlasmaTheme
source: model.decoration
}
GridLayout {
columns: numColumns
anchors.left: icon.right
anchors.right: parent.right
anchors.leftMargin: units.largeSpacing
anchors.rightMargin: units.largeSpacing
anchors.verticalCenter: parent.verticalCenter
columnSpacing: 1
rowSpacing: 1
PlasmaComponents.Label {
id: label
Layout.fillWidth: true
visible: showLabel
maximumLineCount: 1
elide: Text.ElideRight
wrapMode: Text.Wrap
color: theme.textColor
text: ("name" in model ? model.name : model.display)
width: parent.width * 0.4
}
PlasmaComponents.Label {
visible: showLabel
Layout.fillWidth: true
horizontalAlignment: numColumns > 1 ? Text.AlignRight : Text.AlignLeft
maximumLineCount: 1
width: 10
elide: Text.ElideRight
wrapMode: Text.Wrap
color: colorWithAlpha(theme.textColor,0.6)
text: model.description
font.pixelSize: label.font.pixelSize - 2
}
}
PlasmaCore.ToolTipArea {
id: toolTip
property string text: model.display
anchors.fill: parent
active: root.visible && label.truncated
mainItem: toolTipDelegate
onContainsMouseChanged: item.GridView.view.itemContainsMouseChanged(containsMouse)
}
Keys.onPressed: {
if (event.key === Qt.Key_Menu && hasActionList) {
event.accepted = true;
openActionMenu(item);
} else if ((event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) {
event.accepted = true;
if ("trigger" in GridView.view.model) {
GridView.view.model.trigger(index, "", null);
root.toggle();
}
itemGrid.itemActivated(index, "", null);
}
}
}

View File

@ -0,0 +1,485 @@
/***************************************************************************
* Copyright (C) 2015 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.4
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kquickcontrolsaddons 2.0
import org.kde.draganddrop 2.0
FocusScope {
id: itemGrid
signal keyNavLeft
signal keyNavRight
signal keyNavUp
signal keyNavDown
signal itemActivated(int index, string actionId, string argument)
property bool dragEnabled: true
property bool dropEnabled: false
property bool showLabels: true
property alias usesPlasmaTheme: gridView.usesPlasmaTheme
property alias currentIndex: gridView.currentIndex
property alias currentItem: gridView.currentItem
property alias contentItem: gridView.contentItem
property alias count: gridView.count
property alias model: gridView.model
property alias square: gridView.square
property alias cellWidth: gridView.cellWidth
property alias cellHeight: gridView.cellHeight
property alias iconSize: gridView.iconSize
property alias horizontalScrollBarPolicy: scrollArea.horizontalScrollBarPolicy
property alias verticalScrollBarPolicy: scrollArea.verticalScrollBarPolicy
onDropEnabledChanged: {
if (!dropEnabled && "dropPlaceHolderIndex" in model) {
model.dropPlaceHolderIndex = -1;
}
}
onFocusChanged: {
if (!focus) {
currentIndex = -1;
}
}
function currentRow() {
if (currentIndex == -1) {
return -1;
}
return Math.floor(currentIndex / Math.floor(width / itemGrid.cellWidth));
}
function currentCol() {
if (currentIndex == -1) {
return -1;
}
return currentIndex - (currentRow() * Math.floor(width / itemGrid.cellWidth));
}
function lastRow() {
var columns = Math.floor(width / itemGrid.cellWidth);
return Math.ceil(count / columns) - 1;
}
function tryActivate(row, col) {
if (count) {
var columns = Math.floor(width / itemGrid.cellWidth);
var rows = Math.ceil(count / columns);
row = Math.min(row, rows - 1);
col = Math.min(col, columns - 1);
currentIndex = Math.min(row ? ((Math.max(1, row) * columns) + col)
: col,
count - 1);
focus = true;
}
}
function forceLayout() {
gridView.forceLayout();
}
ActionMenu {
id: actionMenu
onActionClicked: {
visualParent.actionTriggered(actionId, actionArgument);
}
}
DropArea {
id: dropArea
anchors.fill: parent
onDragMove: {
if (!itemGrid.dropEnabled || gridView.animating || !kicker.dragSource) {
return;
}
var x = Math.max(0, event.x - (width % itemGrid.cellWidth));
var cPos = mapToItem(gridView.contentItem, x, event.y);
var item = gridView.itemAt(cPos.x, cPos.y);
if (item) {
if (kicker.dragSource.parent === gridView.contentItem) {
if (item !== kicker.dragSource) {
item.GridView.view.model.moveRow(dragSource.itemIndex, item.itemIndex);
}
} else if (kicker.dragSource.GridView.view.model.favoritesModel === itemGrid.model
&& !itemGrid.model.isFavorite(kicker.dragSource.favoriteId)) {
var hasPlaceholder = (itemGrid.model.dropPlaceholderIndex !== -1);
itemGrid.model.dropPlaceholderIndex = item.itemIndex;
if (!hasPlaceholder) {
gridView.currentIndex = (item.itemIndex - 1);
}
}
} else if (kicker.dragSource.parent !== gridView.contentItem
&& kicker.dragSource.GridView.view.model.favoritesModel === itemGrid.model
&& !itemGrid.model.isFavorite(kicker.dragSource.favoriteId)) {
var hasPlaceholder = (itemGrid.model.dropPlaceholderIndex !== -1);
itemGrid.model.dropPlaceholderIndex = hasPlaceholder ? itemGrid.model.count - 1 : itemGrid.model.count;
if (!hasPlaceholder) {
gridView.currentIndex = (itemGrid.model.count - 1);
}
} else {
itemGrid.model.dropPlaceholderIndex = -1;
gridView.currentIndex = -1;
}
}
onDragLeave: {
if ("dropPlaceholderIndex" in itemGrid.model) {
itemGrid.model.dropPlaceholderIndex = -1;
gridView.currentIndex = -1;
}
}
onDrop: {
if (kicker.dragSource && kicker.dragSource.parent !== gridView.contentItem && kicker.dragSource.GridView.view.model.favoritesModel === itemGrid.model) {
itemGrid.model.addFavorite(kicker.dragSource.favoriteId, itemGrid.model.dropPlaceholderIndex);
gridView.currentIndex = -1;
}
}
Timer {
id: resetAnimationDurationTimer
interval: 120
repeat: false
onTriggered: {
gridView.animationDuration = interval - 20;
}
}
Component{
id: aItemGridDelegate2
ItemGridDelegate2 {
showLabel: showLabels
iconSize: itemGrid.iconSize
}
}
Component{
id: aItemGridDelegate
ItemGridDelegate {
showLabel: itemGrid.showLabels
}
}
PlasmaExtras.ScrollArea {
id: scrollArea
anchors.fill: parent
focus: true
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
GridView {
id: gridView
signal itemContainsMouseChanged(bool containsMouse)
property bool usesPlasmaTheme: false
property int iconSize: units.iconSizes.huge
property bool animating: false
property int animationDuration: itemGrid.dropEnabled ? resetAnimationDurationTimer.interval : 0
property bool square: false
focus: true
currentIndex: -1
move: Transition {
enabled: itemGrid.dropEnabled
SequentialAnimation {
PropertyAction { target: gridView; property: "animating"; value: true }
NumberAnimation {
duration: gridView.animationDuration
properties: "x, y"
easing.type: Easing.OutQuad
}
PropertyAction { target: gridView; property: "animating"; value: false }
}
}
moveDisplaced: Transition {
enabled: itemGrid.dropEnabled
SequentialAnimation {
PropertyAction { target: gridView; property: "animating"; value: true }
NumberAnimation {
duration: gridView.animationDuration
properties: "x, y"
easing.type: Easing.OutQuad
}
PropertyAction { target: gridView; property: "animating"; value: false }
}
}
keyNavigationWraps: false
boundsBehavior: Flickable.StopAtBounds
delegate: square ? aItemGridDelegate2 : aItemGridDelegate
highlight: Item {
property bool isDropPlaceHolder: "dropPlaceholderIndex" in itemGrid.model && itemGrid.currentIndex === itemGrid.model.dropPlaceholderIndex
PlasmaComponents.Highlight {
visible: gridView.currentItem && !isDropPlaceHolder
anchors.fill: parent
}
PlasmaCore.FrameSvgItem {
visible: gridView.currentItem && isDropPlaceHolder
anchors.fill: parent
imagePath: "widgets/viewitem"
prefix: "selected"
opacity: 0.5
PlasmaCore.IconItem {
anchors {
right: parent.right
rightMargin: parent.margins.right
bottom: parent.bottom
bottomMargin: parent.margins.bottom
}
width: units.iconSizes.smallMedium
height: width
source: "list-add"
active: false
}
}
}
highlightFollowsCurrentItem: true
highlightMoveDuration: 0
onCurrentIndexChanged: {
if (currentIndex != -1) {
hoverArea.hoverEnabled = false
focus = true;
}
}
onCountChanged: {
animationDuration = 0;
resetAnimationDurationTimer.start();
}
onModelChanged: {
currentIndex = -1;
}
Keys.onLeftPressed: {
if (itemGrid.currentCol() !== 0) {
event.accepted = true;
moveCurrentIndexLeft();
} else {
itemGrid.keyNavLeft();
}
}
Keys.onRightPressed: {
var columns = Math.floor(width / cellWidth);
if (itemGrid.currentCol() !== columns - 1 && currentIndex != count -1) {
event.accepted = true;
moveCurrentIndexRight();
} else {
itemGrid.keyNavRight();
}
}
Keys.onUpPressed: {
if (itemGrid.currentRow() !== 0) {
event.accepted = true;
moveCurrentIndexUp();
positionViewAtIndex(currentIndex, GridView.Contain);
} else {
itemGrid.keyNavUp();
}
}
Keys.onDownPressed: {
if (itemGrid.currentRow() < itemGrid.lastRow()) {
// Fix moveCurrentIndexDown()'s lack of proper spatial nav down
// into partial columns.
event.accepted = true;
var columns = Math.floor(width / cellWidth);
var newIndex = currentIndex + columns;
currentIndex = Math.min(newIndex, count - 1);
positionViewAtIndex(currentIndex, GridView.Contain);
} else {
itemGrid.keyNavDown();
}
}
onItemContainsMouseChanged: {
if (!containsMouse) {
if (!actionMenu.opened) {
gridView.currentIndex = -1;
}
hoverArea.pressX = -1;
hoverArea.pressY = -1;
hoverArea.lastX = -1;
hoverArea.lastY = -1;
hoverArea.pressedItem = null;
hoverArea.hoverEnabled = true;
}
}
}
}
MouseArea {
id: hoverArea
anchors.fill: parent
property int pressX: -1
property int pressY: -1
property int lastX: -1
property int lastY: -1
property Item pressedItem: null
acceptedButtons: Qt.LeftButton | Qt.RightButton
hoverEnabled: true
function updatePositionProperties(x, y) {
// Prevent hover event synthesis in QQuickWindow interfering
// with keyboard navigation by ignoring repeated events with
// identical coordinates. As the work done here would be re-
// dundant in any case, these are safe to ignore.
if (lastX === x && lastY === y) {
return;
}
lastX = x;
lastY = y;
var cPos = mapToItem(gridView.contentItem, x, y);
var item = gridView.itemAt(cPos.x, cPos.y);
if (!item) {
gridView.currentIndex = -1;
pressedItem = null;
} else {
gridView.currentIndex = item.itemIndex;
itemGrid.focus = (itemGrid.currentIndex != -1)
}
return item;
}
onPressed: mouse => {
mouse.accepted = true;
updatePositionProperties(mouse.x, mouse.y);
pressX = mouse.x;
pressY = mouse.y;
if (mouse.button == Qt.RightButton) {
if (gridView.currentItem) {
if (gridView.currentItem.hasActionList) {
var mapped = mapToItem(gridView.currentItem, mouse.x, mouse.y);
gridView.currentItem.openActionMenu(mapped.x, mapped.y);
}
} else {
var mapped = mapToItem(rootItem, mouse.x, mouse.y);
contextMenu.open(mapped.x, mapped.y);
}
} else {
pressedItem = gridView.currentItem;
}
}
onReleased: mouse => {
mouse.accepted = true;
updatePositionProperties(mouse.x, mouse.y);
if (gridView.currentItem && gridView.currentItem == pressedItem) {
if ("trigger" in gridView.model) {
gridView.model.trigger(pressedItem.itemIndex, "", null);
root.toggle();
}
itemGrid.itemActivated(pressedItem.itemIndex, "", null);
} else if (!dragHelper.dragging && !pressedItem && mouse.button == Qt.LeftButton) {
root.toggle();
}
pressX = -1;
pressY = -1;
pressedItem = null;
}
onPositionChanged: mouse => {
var item = pressedItem? pressedItem : updatePositionProperties(mouse.x, mouse.y);
if (gridView.currentIndex != -1) {
if (itemGrid.dragEnabled && pressX != -1 && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) {
if ("pluginName" in item.m) {
dragHelper.startDrag(kicker, item.url, item.icon,
"text/x-plasmoidservicename", item.m.pluginName);
} else {
dragHelper.startDrag(kicker, item.url, item.icon);
}
kicker.dragSource = item;
pressX = -1;
pressY = -1;
}
}
}
}
}
}

View File

@ -0,0 +1,484 @@
/***************************************************************************
* Copyright (C) 2015 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.4
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kquickcontrolsaddons 2.0
import org.kde.draganddrop 2.0
FocusScope {
id: itemGrid
signal keyNavLeft
signal keyNavRight
signal keyNavUp
signal keyNavDown
signal itemActivated(int index, string actionId, string argument)
property bool dragEnabled: true
property bool dropEnabled: false
property bool showLabels: true
property alias usesPlasmaTheme: gridView.usesPlasmaTheme
property alias currentIndex: gridView.currentIndex
property alias currentItem: gridView.currentItem
property alias contentItem: gridView.contentItem
property alias count: gridView.count
property alias model: gridView.model
property alias square: gridView.square
property alias cellWidth: gridView.cellWidth
property alias cellHeight: gridView.cellHeight
property alias iconSize: gridView.iconSize
property alias horizontalScrollBarPolicy: scrollArea.horizontalScrollBarPolicy
property alias verticalScrollBarPolicy: scrollArea.verticalScrollBarPolicy
onDropEnabledChanged: {
if (!dropEnabled && model && model.hasOwnProperty("dropPlaceholderIndex")) {
model.dropPlaceholderIndex = -1;
}
}
onFocusChanged: {
if (!focus) {
currentIndex = -1;
}
}
function currentRow() {
if (currentIndex == -1) {
return -1;
}
return Math.floor(currentIndex / Math.floor(width / cellWidth));
}
function currentCol() {
if (currentIndex == -1) {
return -1;
}
return currentIndex - (currentRow() * Math.floor(width / cellWidth));
}
function lastRow() {
var columns = Math.floor(width / cellWidth);
return Math.ceil(count / columns) - 1;
}
function tryActivate(row, col) {
if (count) {
var columns = Math.floor(width / cellWidth);
var rows = Math.ceil(count / columns);
row = Math.min(row, rows - 1);
col = Math.min(col, columns - 1);
currentIndex = Math.min(row ? ((Math.max(1, row) * columns) + col)
: col,
count - 1);
focus = true;
}
}
function forceLayout() {
gridView.forceLayout();
}
ActionMenu {
id: actionMenu
onActionClicked: {
visualParent.actionTriggered(actionId, actionArgument);
}
}
DropArea {
id: dropArea
anchors.fill: parent
onDragMove: {
if (!dropEnabled || gridView.animating || !kicker.dragSource) {
return;
}
var x = Math.max(0, event.x - (width % cellWidth));
var cPos = mapToItem(gridView.contentItem, x, event.y);
var item = gridView.itemAt(cPos.x, cPos.y);
if (item) {
if (kicker.dragSource.parent === gridView.contentItem) {
if (item !== kicker.dragSource) {
item.GridView.view.model.moveRow(dragSource.itemIndex, item.itemIndex);
}
} else if (kicker.dragSource.GridView.view.model.favoritesModel === model
&& !model.isFavorite(kicker.dragSource.favoriteId)) {
var hasPlaceholder = (model.dropPlaceholderIndex !== -1);
model.dropPlaceholderIndex = item.itemIndex;
if (!hasPlaceholder) {
gridView.currentIndex = (item.itemIndex - 1);
}
}
} else if (kicker.dragSource.parent !== gridView.contentItem
&& kicker.dragSource.GridView.view.model.favoritesModel === model
&& !model.isFavorite(kicker.dragSource.favoriteId)) {
var hasPlaceholder = (model.dropPlaceholderIndex !== -1);
model.dropPlaceholderIndex = hasPlaceholder ? model.count - 1 : model.count;
if (!hasPlaceholder) {
gridView.currentIndex = (model.count - 1);
}
} else {
model.dropPlaceholderIndex = -1;
gridView.currentIndex = -1;
}
}
onDragLeave: {
if ("dropPlaceholderIndex" in model) {
model.dropPlaceholderIndex = -1;
gridView.currentIndex = -1;
}
}
onDrop: {
if (kicker.dragSource && kicker.dragSource.parent !== gridView.contentItem && kicker.dragSource.GridView.view.model.favoritesModel === model) {
model.addFavorite(kicker.dragSource.favoriteId, model.dropPlaceholderIndex);
gridView.currentIndex = -1;
}
}
Timer {
id: resetAnimationDurationTimer
interval: 120
repeat: false
onTriggered: {
gridView.animationDuration = interval - 20;
}
}
Component{
id: aItemGridDelegate
ItemGridDelegate3 {
showLabel: showLabels
}
}
PlasmaExtras.ScrollArea {
id: scrollArea
anchors.fill: parent
focus: true
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
GridView {
id: gridView
signal itemContainsMouseChanged(bool containsMouse)
property bool usesPlasmaTheme: false
property int iconSize: units.iconSizes.huge
property bool animating: false
property int animationDuration: dropEnabled ? resetAnimationDurationTimer.interval : 0
property bool square: false
property int numColumns: 1
focus: true
currentIndex: -1
move: Transition {
enabled: itemGrid.dropEnabled
SequentialAnimation {
PropertyAction { target: gridView; property: "animating"; value: true }
NumberAnimation {
duration: gridView.animationDuration
properties: "x, y"
easing.type: Easing.OutQuad
}
PropertyAction { target: gridView; property: "animating"; value: false }
}
}
moveDisplaced: Transition {
enabled: itemGrid.dropEnabled
SequentialAnimation {
PropertyAction { target: gridView; property: "animating"; value: true }
NumberAnimation {
duration: gridView.animationDuration
properties: "x, y"
easing.type: Easing.OutQuad
}
PropertyAction { target: gridView; property: "animating"; value: false }
}
}
keyNavigationWraps: false
boundsBehavior: Flickable.StopAtBounds
delegate: aItemGridDelegate
highlight: Item {
property bool isDropPlaceHolder: model && model.hasOwnProperty("dropPlaceholderIndex") && currentIndex === model.dropPlaceholderIndex
PlasmaComponents.Highlight {
visible: gridView.currentItem && !isDropPlaceHolder
anchors.fill: parent
}
PlasmaCore.FrameSvgItem {
visible: gridView.currentItem && isDropPlaceHolder
anchors.fill: parent
imagePath: "widgets/viewitem"
prefix: "selected"
opacity: 0.5
PlasmaCore.IconItem {
anchors {
right: parent.right
rightMargin: parent.margins.right
bottom: parent.bottom
bottomMargin: parent.margins.bottom
}
width: units.iconSizes.smallMedium
height: width
source: "list-add"
active: false
}
}
}
highlightFollowsCurrentItem: true
highlightMoveDuration: 0
onCurrentIndexChanged: {
if (currentIndex != -1) {
hoverArea.hoverEnabled = false
focus = true;currentRow
}
}
onCountChanged: {
animationDuration = 0;
resetAnimationDurationTimer.start();
}
onModelChanged: {
currentIndex = -1;
}
Keys.onLeftPressed: {
if (currentCol() !== 0) {
event.accepted = true;
moveCurrentIndexLeft();
} else {
itemGrid.keyNavLeft();
}
}
Keys.onRightPressed: {
var columns = Math.floor(width / cellWidth);
if (currentCol() !== columns - 1 && currentIndex != count -1) {
event.accepted = true;
moveCurrentIndexRight();
} else {
itemGrid.keyNavRight();
}
}
Keys.onUpPressed: {
if (currentRow() !== 0) {
event.accepted = true;
moveCurrentIndexUp();
positionViewAtIndex(currentIndex, GridView.Contain);
} else {
itemGrid.keyNavUp();
}
}
Keys.onDownPressed: {
if (currentRow() < itemGrid.lastRow()) {
// Fix moveCurrentIndexDown()'s lack of proper spatial nav down
// into partial columns.
event.accepted = true;
var columns = Math.floor(width / cellWidth);
var newIndex = currentIndex + columns;
currentIndex = Math.min(newIndex, count - 1);
positionViewAtIndex(currentIndex, GridView.Contain);
} else {
itemGrid.keyNavDown();currentRow
}
}
onItemContainsMouseChanged: {
if (!containsMouse) {
if (!actionMenu.opened) {
gridView.currentIndex = -1;
}
hoverArea.pressX = -1;
hoverArea.pressY = -1;
hoverArea.lastX = -1;
hoverArea.lastY = -1;
hoverArea.pressedItem = null;
hoverArea.hoverEnabled = true;
}
}
}
}
MouseArea {
id: hoverArea
anchors.fill: parent
property int pressX: -1
property int pressY: -1
property int lastX: -1
property int lastY: -1
property Item pressedItem: null
acceptedButtons: Qt.LeftButton | Qt.RightButton
hoverEnabled: true
function updatePositionProperties(x, y) {
// Prevent hover event synthesis in QQuickWindow interfering
// with keyboard navigation by ignoring repeated events with
// identical coordinates. As the work done here would be re-
// dundant in any case, these are safe to ignore.
if (lastX === x && lastY === y) {
return;
}
lastX = x;
lastY = y;
var cPos = mapToItem(gridView.contentItem, x, y);
var item = gridView.itemAt(cPos.x, cPos.y);
if (!item) {
gridView.currentIndex = -1;
pressedItem = null;
} else {
gridView.currentIndex = item.itemIndex;
itemGrid.focus = (currentIndex != -1)
}
return item;
}
onPressed: {
mouse.accepted = true;
updatePositionProperties(mouse.x, mouse.y);false
pressX = mouse.x;
pressY = mouse.y;
if (mouse.button == Qt.RightButton) {
if (gridView.currentItem) {
if (gridView.currentItem.hasActionList) {
var mapped = mapToItem(gridView.currentItem, mouse.x, mouse.y);
gridView.currentItem.openActionMenu(mapped.x, mapped.y);
}
} else {
var mapped = mapToItem(rootItem, mouse.x, mouse.y);
contextMenu.open(mapped.x, mapped.y);
}
} else {
pressedItem = gridView.currentItem;
}
}
onReleased: {
mouse.accepted = true;
updatePositionProperties(mouse.x, mouse.y);
if (gridView.currentItem && gridView.currentItem == pressedItem) {
if ("trigger" in gridView.model) {
gridView.model.trigger(pressedItem.itemIndex, "", null);
root.toggle();
}
itemGrid.itemActivated(pressedItem.itemIndex, "", null);
} else if (!dragHelper.dragging && !pressedItem && mouse.button == Qt.LeftButton) {
root.toggle();
}
pressX = -1;
pressY = -1;
pressedItem = null;
}
onPositionChanged: {
var item = pressedItem? pressedItem : updatePositionProperties(mouse.x, mouse.y);
if (gridView.currentIndex != -1) {
if (dragEnabled && pressX != -1 && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) {
if ("pluginName" in item.m) {
dragHelper.startDrag(kicker, item.url, item.icon,
"text/x-plasmoidservicename", item.m.pluginName);
} else {
dragHelper.startDrag(kicker, item.url, item.icon);
}
kicker.dragSource = item;
pressX = -1;
pressY = -1;
}
}
}
}
}
}

View File

@ -0,0 +1,284 @@
/***************************************************************************
* Copyright (C) 2013-2015 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import "code/tools.js" as Tools
Item {
id: item
height: isSeparator ? separatorHeight : itemHeight
width: ListView.view.width
enabled: !isSeparator
signal actionTriggered(string actionId, variant actionArgument)
signal aboutToShowActionMenu(variant actionMenu)
readonly property real fullTextWidth: Math.ceil(icon.width + label.implicitWidth + arrow.width + row.anchors.leftMargin + row.anchors.rightMargin + row.actualSpacing)
property bool isSeparator: (model.isSeparator === true)
property bool hasChildren: (model.hasChildren === true)
property bool hasActionList: ((model.favoriteId !== null)
|| (("hasActionList" in model) && (model.hasActionList === true)))
property QtObject childDialog: null
property Item menu: actionMenu
Accessible.role: isSeparator ? Accessible.Separator: Accessible.MenuItem
Accessible.name: label.text
onHasChildrenChanged: {
if (!hasChildren && ListView.view.currentItem === item) {
ListView.view.currentIndex = -1;
}
}
onAboutToShowActionMenu: {
var actionList = hasActionList ? model.actionList : [];
Tools.fillActionMenu(i18n, actionMenu, actionList, ListView.view.model.favoritesModel, model.favoriteId);
}
onActionTriggered: {
if (Tools.triggerAction(ListView.view.model, model.index, actionId, actionArgument) === true) {
plasmoid.expanded = false;
}
}
function openActionMenu(visualParent, x, y) {
aboutToShowActionMenu(actionMenu);
actionMenu.visualParent = visualParent;
actionMenu.open(x, y);
}
ActionMenu {
id: actionMenu
onActionClicked: {
actionTriggered(actionId, actionArgument);
}
}
MouseArea {
id: mouseArea
anchors {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
}
height: parent.height
property int mouseCol
property bool pressed: false
property int pressX: -1
property int pressY: -1
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed: {
if (mouse.buttons & Qt.RightButton) {
if (hasActionList) {
openActionMenu(mouseArea, mouse.x, mouse.y);
}
} else {
pressed = true;
pressX = mouse.x;
pressY = mouse.y;
}
}
onReleased: {
if (pressed && !hasChildren) {
item.ListView.view.model.trigger(index, "", null);
plasmoid.expanded = false;
}
pressed = false;
pressX = -1;
pressY = -1;
}
onPositionChanged: {
if (pressX != -1 && model.url && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) {
dragHelper.startDrag(kicker, model.url, model.decoration);
pressed = false;
pressX = -1;
pressY = -1;
return;
}
// FIXME: Correct escape angle calc for right screen edge.
if (justOpenedTimer.running || !hasChildren) {
item.ListView.view.currentIndex = index;
} else {
mouseCol = mouse.x;
if (index === item.ListView.view.currentIndex) {
updateCurrentItem();
} else if ((index == item.ListView.view.currentIndex - 1) && mouse.y < (itemHeight - 6)
|| (index == item.ListView.view.currentIndex + 1) && mouse.y > 5) {
if ((childDialog != null && childDialog.facingLeft)
? mouse.x > item.ListView.view.eligibleWidth - 5 : mouse.x < item.ListView.view.eligibleWidth + 5) {
updateCurrentItem();
}
} else if ((childDialog != null && childDialog.facingLeft)
? mouse.x > item.ListView.view.eligibleWidth : mouse.x < item.ListView.view.eligibleWidth) {
updateCurrentItem();
}
updateCurrentItemTimer.start();
}
}
onContainsMouseChanged: {
if (!containsMouse) {
pressed = false;
pressX = -1;
pressY = -1;
updateCurrentItemTimer.stop();
}
}
function updateCurrentItem() {
item.ListView.view.currentIndex = index;
item.ListView.view.eligibleWidth = Math.min(width, mouseCol);
}
Timer {
id: updateCurrentItemTimer
interval: 50
repeat: false
onTriggered: parent.updateCurrentItem()
}
}
Row {
id: row
anchors.left: parent.left
anchors.leftMargin: highlightItemSvg.margins.left
anchors.right: parent.right
anchors.rightMargin: highlightItemSvg.margins.right
height: parent.height
spacing: units.smallSpacing * 2
readonly property real actualSpacing: ((icon.visible ? 1 : 0) * spacing) + ((arrow.visible ? 1 : 0) * spacing)
LayoutMirroring.enabled: (Qt.application.layoutDirection == Qt.RightToLeft)
PlasmaCore.IconItem {
id: icon
anchors.verticalCenter: parent.verticalCenter
width: visible ? units.iconSizes.small : 0
height: width
visible: iconsEnabled
animated: false
usesPlasmaTheme: false
source: model.decoration
}
PlasmaComponents.Label {
id: label
enabled: !isParent || (isParent && hasChildren)
anchors.verticalCenter: parent.verticalCenter
width: parent.width - icon.width - arrow.width - parent.actualSpacing
verticalAlignment: Text.AlignVCenter
textFormat: Text.PlainText
wrapMode: Text.NoWrap
elide: Text.ElideRight
text: model.display
}
PlasmaCore.SvgItem {
id: arrow
anchors.verticalCenter: parent.verticalCenter
width: visible ? units.iconSizes.small : 0
height: width
visible: hasChildren
opacity: (item.ListView.view.currentIndex === index) ? 1.0 : 0.4
svg: arrows
elementId: (Qt.application.layoutDirection == Qt.RightToLeft) ? "left-arrow" : "right-arrow"
}
}
Component {
id: separatorComponent
PlasmaCore.SvgItem {
width: parent.width
height: lineSvg.horLineHeight
svg: lineSvg
elementId: "horizontal-line"
}
}
Loader {
id: separatorLoader
anchors.left: parent.left
anchors.leftMargin: highlightItemSvg.margins.left
anchors.right: parent.right
anchors.rightMargin: highlightItemSvg.margins.right
anchors.verticalCenter: parent.verticalCenter
active: isSeparator
asynchronous: false
sourceComponent: separatorComponent
}
Keys.onPressed: {
if (event.key === Qt.Key_Menu && hasActionList) {
event.accepted = true;
openActionMenu(mouseArea);
} else if ((event.key === Qt.Key_Enter || event.key === Qt.Key_Return) && !hasChildren) {
if (!hasChildren) {
event.accepted = true;
item.ListView.view.model.trigger(index, "", null);
plasmoid.expanded = false;
}
}
}
}

View File

@ -0,0 +1,235 @@
/***************************************************************************
* Copyright (C) 2015 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.4
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.private.kicker 0.1 as Kicker
PlasmaExtras.ScrollArea {
id: itemMultiGrid
//anchors {
// top: parent.top
//}
anchors.fill: parent
//width: parent.width
implicitHeight: itemColumn.implicitHeight
signal keyNavLeft(int subGridIndex)
signal keyNavRight(int subGridIndex)
signal keyNavUp()
signal keyNavDown()
property bool grabFocus: false
property alias model: repeater.model
property alias count: repeater.count
property bool isSquare: false
property int aCellHeight
property int aCellWidth
verticalScrollBarPolicy: Qt.ScrollBarAsNeeded
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
flickableItem.flickableDirection: Flickable.VerticalFlick
onFocusChanged: {
if (!focus) {
for (var i = 0; i < repeater.count; i++) {
subGridAt(i).focus = false;
}
}
}
function subGridAt(index) {
return repeater.itemAt(index).itemGrid;
}
function tryActivate(row, col) { // FIXME TODO: Cleanup messy algo.
if (flickableItem.contentY > 0) {
row = 0;
}
var target = null;
var rows = 0;
for (var i = 0; i < repeater.count; i++) {
var grid = subGridAt(i);
if (rows <= row) {
target = grid;
rows += grid.lastRow() + 2; // Header counts as one.
} else {
break;
}
}
if (target) {
rows -= (target.lastRow() + 2);
target.tryActivate(row - rows, col);
}
}
Column {
id: itemColumn
width: itemMultiGrid.width //- units.gridUnit
Repeater {
id: repeater
delegate: Item {
width: itemColumn.width
height: gridViewLabel.height + gridView.height + (index == repeater.count - 1 ? 0 : units.smallSpacing)
//visible: gridView.count > 0
property Item itemGrid: gridView
PlasmaExtras.Heading {
id: gridViewLabel
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: units.smallSpacing * 4
height: dummyHeading.height
wrapMode: Text.NoWrap
color: theme.textColor
font.bold: true
font.weight: Font.DemiBold
level: 5
verticalAlignment: Qt.AlignVCenter
text: repeater.model.modelForRow(index).description
}
Rectangle{
anchors.right: parent.right
anchors.verticalCenter: gridViewLabel.verticalCenter
height: 1
width: parent.width - gridViewLabel.implicitWidth - units.largeSpacing*2
color: theme.textColor
opacity: 0.15
}
MouseArea {
width: parent.width
height: parent.height
onClicked: root.toggle()
}
ItemGridView {
id: gridView
anchors {
top: gridViewLabel.bottom
topMargin: units.smallSpacing
}
width: parent.width
//height: Math.ceil(count / Math.floor(width / root.tileSide)) * root.tileSide
height: gridView.count ? gridView.count * aCellHeight : 0
cellWidth: isSquare ? root.tileSide : aCellWidth
cellHeight: isSquare ? root.tileSide : aCellHeight
iconSize: root.iconSize
square: isSquare
verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff
model: repeater.model.modelForRow(index)
onFocusChanged: {
if (focus) {
itemMultiGrid.focus = true;
}
}
onCountChanged: {
if (itemMultiGrid.grabFocus && index == 0 && count > 0) {
currentIndex = 0;
focus = true;
}
}
onCurrentItemChanged: {
if (!currentItem) {
return;
}
if (index == 0 && currentRow() === 0) {
itemMultiGrid.flickableItem.contentY = 0;
return;
}
var y = currentItem.y;
y = contentItem.mapToItem(itemMultiGrid.flickableItem.contentItem, 0, y).y;
if (y < itemMultiGrid.flickableItem.contentY) {
itemMultiGrid.flickableItem.contentY = y;
} else {
y += isSquare ? root.tileSide : aCellHeight;
y -= itemMultiGrid.flickableItem.contentY;
y -= itemMultiGrid.viewport.height;
if (y > 0) {
itemMultiGrid.flickableItem.contentY += y;
}
}
}
onKeyNavLeft: {
itemMultiGrid.keyNavLeft(index);
}
onKeyNavRight: {
itemMultiGrid.keyNavRight(index);
}
onKeyNavUp: {
if (index > 0) {
var prevGrid = subGridAt(index - 1);
prevGrid.tryActivate(prevGrid.lastRow(), currentCol());
} else {
itemMultiGrid.keyNavUp();
}
}
onKeyNavDown: {
if (index < repeater.count - 1) {
subGridAt(index + 1).tryActivate(0, currentCol());
} else {
itemMultiGrid.keyNavDown();
}
}
}
// HACK: Steal wheel events from the nested grid view and forward them to
// the ScrollView's internal WheelArea.
Kicker.WheelInterceptor {
anchors.fill: gridView
z: 1
destination: findWheelArea(itemMultiGrid.flickableItem)
}
}
}
}
}

View File

@ -0,0 +1,701 @@
/***************************************************************************
* Copyright (C) 2014 by Weng Xuetian <wengxt@gmail.com>
* Copyright (C) 2013-2017 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.4
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.private.kicker 0.1 as Kicker
import org.kde.kcoreaddons 1.0 as KCoreAddons // kuser
import org.kde.plasma.private.shell 2.0
import QtQuick.Controls.Styles 1.4
import org.kde.kwindowsystem 1.0
import QtGraphicalEffects 1.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.components 3.0 as PlasmaComponents3
PlasmaCore.Dialog {
id: root
objectName: "popupWindow"
flags: Qt.WindowStaysOnTopHint
location: PlasmaCore.Types.Floating
hideOnWindowDeactivate: true
property int defaultSize: {
switch(plasmoid.configuration.defaultSize){
case "SmallMedium": return units.iconSizes.smallMedium;
case "Medium": return units.iconSizes.medium;
case "Large": return units.iconSizes.large;
case "Huge": return units.iconSizes.huge;
default: return 64
}
}
property int iconSize: defaultSize
property int iconSizeSquare: defaultSize
property int tileSideHeight: defaultSize + theme.mSize(theme.defaultFont).height * 2
+ (2 * Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom,
highlightItemSvg.margins.left + highlightItemSvg.margins.right))
property int tileSideWidth: tileSideHeight + units.smallSpacing*2
property int tileHeightDocuments: units.gridUnit * 2 + units.smallSpacing * 4
property bool searching: (searchField.text != "")
property bool readySearch: false
property bool viewDocuments: false
property int _margin: iconSizeSquare > 33 ? units.largeSpacing : units.largeSpacing * 0.5
function colorWithAlpha(color, alpha) {
return Qt.rgba(color.r, color.g, color.b, alpha)
}
onVisibleChanged: {
if (visible) {
reset();
var pos = popupPosition(width, height);
x = pos.x;
y = pos.y;
requestActivate();
//animation1.start()
}else{
reset()
}
}
onHeightChanged: {
var pos = popupPosition(width, height);
x = pos.x;
y = pos.y;
}
onWidthChanged: {
var pos = popupPosition(width, height);
x = pos.x;
y = pos.y;
}
onSearchingChanged: {
if (!searching) {
reset();
}else{
viewDocuments = false
readySearch = false
}
}
function reset() {
preloadAllAppsTimer.restart();
globalFavoritesGrid.tryActivate(0,0)
searchField.clear();
readySearch = false
viewDocuments = false
}
function toggle(){
root.visible = false;
}
function popupPosition(width, height) {
var screenAvail = plasmoid.availableScreenRect;
var screenGeom = plasmoid.screenGeometry;
var screen = Qt.rect(screenAvail.x + screenGeom.x,
screenAvail.y + screenGeom.y,
screenAvail.width,
screenAvail.height);
var offset = units.smallSpacing;
// Fall back to bottom-left of screen area when the applet is on the desktop or floating.
var x = offset;
var y = screen.height - height - offset;
var appletTopLeft;
var horizMidPoint;
var vertMidPoint;
if (plasmoid.configuration.displayPosition === 1) {
horizMidPoint = screen.x + (screen.width / 2);
vertMidPoint = screen.y + (screen.height / 2);
x = horizMidPoint - width / 2;
y = vertMidPoint - height / 2;
} else if (plasmoid.configuration.displayPosition === 2) {
horizMidPoint = screen.x + (screen.width / 2);
vertMidPoint = screen.y + (screen.height / 2);
x = horizMidPoint - width / 2;
y = screen.y + screen.height - height - offset - panelSvg.margins.top;
} else if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
horizMidPoint = screen.x + (screen.width / 2);
appletTopLeft = parent.mapToGlobal(0, 0);
x = (appletTopLeft.x < horizMidPoint) ? screen.x + offset : (screen.x + screen.width) - width - offset;
y = screen.y + screen.height - height - offset - panelSvg.margins.top;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
horizMidPoint = screen.x + (screen.width / 2);
var appletBottomLeft = parent.mapToGlobal(0, parent.height);
x = (appletBottomLeft.x < horizMidPoint) ? screen.x + offset : (screen.x + screen.width) - width - offset;
y = screen.y + parent.height + panelSvg.margins.bottom + offset;
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
vertMidPoint = screen.y + (screen.height / 2);
appletTopLeft = parent.mapToGlobal(0, 0);
x = parent.width + panelSvg.margins.right + offset;
y = screen.y + (appletTopLeft.y < vertMidPoint) ? screen.y + offset : (screen.y + screen.height) - height - offset;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
vertMidPoint = screen.y + (screen.height / 2);
appletTopLeft = parent.mapToGlobal(0, 0);
x = appletTopLeft.x - panelSvg.margins.left - offset - width;
y = screen.y + (appletTopLeft.y < vertMidPoint) ? screen.y + offset : (screen.y + screen.height) - height - offset;
}
return Qt.point(x, y);
}
FocusScope {
id: focusScope
Layout.maximumWidth: (tileSideWidth * plasmoid.configuration.numberColumns) + units.largeSpacing * 2
Layout.minimumWidth: (tileSideWidth * plasmoid.configuration.numberColumns) + units.largeSpacing * 2
Layout.minimumHeight: searchField.implicitHeight + topRow.height + firstPage.height + footer.height + _margin * 5
Layout.maximumHeight: Layout.minimumHeight
property bool done: false
ScaleAnimator{id: animation1 ; target: globalFavoritesGrid ; from: 0.9; to: 1; duration: units.shortDuration*2; easing.type: Easing.InOutQuad }
XAnimator{id: animation2; target: mainColumn ; from: focusScope.width; to: units.smallSpacing; duration: units.shortDuration*2; easing.type: Easing.OutCubic }
focus: true
PlasmaExtras.Heading {
id: dummyHeading
visible: false
width: 0
level: 1
}
TextMetrics {
id: headingMetrics
font: dummyHeading.font
}
PlasmaComponents.Menu {
id: contextMenu
PlasmaComponents.MenuItem {
action: plasmoid.action("configure")
}
}
Timer {
id: preloadAllAppsTimer
property bool done: false
interval: 1000
repeat: false
onTriggered: {
if (done) {
return;
}
for (var i = 0; i < rootModel.count; ++i) {
var model = rootModel.modelForRow(i);
if (model.description === "KICKER_ALL_MODEL") {
allAppsGrid.model = model;
done = true;
break;
}
}
}
function defer() {
if (!running && !done) {
restart();
}
}
}
PlasmaComponents3.TextField {
id: searchField
anchors.top: parent.top
anchors.margins: _margin
anchors.horizontalCenter: parent.horizontalCenter
focus: true
width: tileSideWidth * plasmoid.configuration.numberColumns
implicitHeight: units.gridUnit * 2
placeholderText: i18n("Type here to search ...")
placeholderTextColor: colorWithAlpha(theme.textColor,0.7)
leftPadding: units.largeSpacing + units.iconSizes.small
topPadding: units.gridUnit * 0.5
verticalAlignment: Text.AlignTop
background: Rectangle {
color: theme.backgroundColor
radius: 3
border.width: 1
border.color: colorWithAlpha(theme.textColor,0.05)
}
onTextChanged: {
runnerModel.query = text;
}
function clear() {
text = "";
}
function backspace() {
focus = true;
if(searching) text = text.slice(0, -1);
}
function appendText(newText) {
if (!root.visible) {
return;
}
focus = true;
text = text + newText;
}
Keys.onPressed: {
if (event.key == Qt.Key_Down || event.key == Qt.Key_Tab) {
event.accepted = true;
if( searching || readySearch)
mainColumn.visibleGrid.tryActivate(0,0);
else if(viewDocuments)
documentsFavoritesGrid.tryActivate(0,0);
else
globalFavoritesGrid.tryActivate(0,0);
}
}
}
Rectangle{
height: 2
width: searchField.width
anchors.bottom: searchField.bottom
anchors.horizontalCenter: parent.horizontalCenter
color: theme.highlightColor
}
PlasmaCore.IconItem {
source: 'search'
anchors {
left: searchField.left
verticalCenter: searchField.verticalCenter
leftMargin: units.smallSpacing * 2
}
height: units.iconSizes.small
width: height
}
//
//
//
//
RowLayout{
id: topRow
anchors.top: searchField.bottom
anchors.topMargin: _margin
width: tileSideWidth * plasmoid.configuration.numberColumns
anchors.horizontalCenter: parent.horizontalCenter
height: btnAction.implicitHeight
PlasmaCore.IconItem {
source: searching || readySearch ? 'application-menu' : 'favorite'
implicitHeight: units.iconSizes.smallMedium
implicitWidth: units.iconSizes.smallMedium
}
PlasmaExtras.Heading {
id: headLabelFavorites
color: colorWithAlpha(theme.textColor, 0.8)
level: 5
text: searching || readySearch ? i18n("Search results"): i18n("Pinned")
Layout.leftMargin: units.smallSpacing
font.weight: Font.Bold
}
Item{
Layout.fillWidth: true
}
AToolButton {
id: btnAction
flat: false
mirror: searching || readySearch
iconName: searching || readySearch ? 'go-previous' : "go-next"
text: searching || readySearch ? i18n("Pinned") : i18n("All apps")
onClicked: {
if(readySearch || searching){
readySearch = false
searchField.text = ''
}
else{
readySearch = true
//searchField.focus = true
}
}
}
states: [
State {
name: "small"
when: !viewDocuments
PropertyChanges { target: topRow; opacity: 1 }
},
State {
name: "large"
when: viewDocuments
PropertyChanges { target:topRow; opacity: 0 }
}
]
transitions: Transition {
OpacityAnimator{ duration: units.shortDuration*2 }
}
}
//
//
//
//
Column{
id: firstPage
width: tileSideWidth * plasmoid.configuration.numberColumns
height: tileSideHeight * plasmoid.configuration.numberRows + btnAction.implicitHeight + tileHeightDocuments * 3 + _margin
anchors.top: topRow.bottom
anchors.topMargin: _margin
anchors.horizontalCenter: parent.horizontalCenter
spacing: _margin
visible: !readySearch && !searching
ItemGridView {
id: globalFavoritesGrid
width: tileSideWidth * plasmoid.configuration.numberColumns
height: tileSideHeight * plasmoid.configuration.numberRows
cellWidth: tileSideWidth
cellHeight: tileSideHeight
iconSize: root.iconSizeSquare
square: true
model: globalFavorites
dropEnabled: true
usesPlasmaTheme: true
verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff
//visible: !viewDocuments
state: 'small'
onKeyNavDown: documentsFavoritesGrid.tryActivate(0,0)
onKeyNavUp: searchField.focus = true
onCurrentIndexChanged: {
preloadAllAppsTimer.defer();
}
states: [
State {
name: "small"
when: !viewDocuments
PropertyChanges { target: globalFavoritesGrid; height: tileSideHeight * plasmoid.configuration.numberRows }
},
State {
name: "large"
when: viewDocuments
PropertyChanges { target:globalFavoritesGrid; height: 0 }
}
]
transitions: Transition {
PropertyAnimation { property: "height"; duration: units.shortDuration*2;}
}
Keys.onPressed: {
if (event.key == Qt.Key_Tab) {
event.accepted = true;
documentsFavoritesGrid.tryActivate(0,0)
} else if (event.key == Qt.Key_Backspace) {
event.accepted = true;
if(searching)
searchField.backspace();
else
searchField.focus = true
} else if (event.key == Qt.Key_Escape) {
event.accepted = true;
if(searching){
searchField.clear()
} else {
root.toggle()
}
} else if (event.text != "") {
event.accepted = true;
searchField.appendText(event.text);
}
}
}
RowLayout{
width: parent.width
height: btnAction.implicitHeight
PlasmaCore.IconItem {
source: 'tag' // 'format-list-unordered'
implicitHeight: units.iconSizes.smallMedium
implicitWidth: units.iconSizes.smallMedium
}
PlasmaExtras.Heading {
id: headLabelDocuments
color: colorWithAlpha(theme.textColor, 0.8)
level: 5
text: i18n("Recommended")
Layout.leftMargin: units.smallSpacing
font.weight: Font.Bold
}
Item{
Layout.fillWidth: true
}
AToolButton {
flat: false
iconName: viewDocuments ? 'go-previous' : "go-next"
mirror: viewDocuments
text: viewDocuments ? i18n("Back") : i18n("More")
onClicked: viewDocuments = !viewDocuments
}
}
ItemGridView3 {
id: documentsFavoritesGrid
width: parent.width
height: tileHeightDocuments * 3
cellWidth: Math.floor(parent.width * 0.5)
cellHeight: tileHeightDocuments
square: false
model: rootModel.modelForRow(1)
dropEnabled: true
usesPlasmaTheme: false
verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff
state: 'small'
onKeyNavUp: {
if (viewDocuments) searchField.focus = true
else globalFavoritesGrid.tryActivate(0,0);
}
onCurrentIndexChanged: {
preloadAllAppsTimer.defer();
}
states: [
State {
name: "small"
when: !viewDocuments
PropertyChanges { target: documentsFavoritesGrid; height: tileHeightDocuments * 3 }
},
State {
name: "large"
when: viewDocuments
PropertyChanges { target:documentsFavoritesGrid; height: (Math.floor(tileSideHeight * plasmoid.configuration.numberRows/tileHeightDocuments) + 3) * tileHeightDocuments }
}
]
transitions: Transition {
PropertyAnimation { property: "height"; duration: units.shortDuration*2 }
}
Keys.onPressed: {
if (event.key == Qt.Key_Tab) {
event.accepted = true;
if (viewDocuments) searchField.focus = true
else globalFavoritesGrid.tryActivate(0,0);
} else if (event.key == Qt.Key_Backspace) {
event.accepted = true;
if(searching)
searchField.backspace();
else
searchField.focus = true
} else if (event.key == Qt.Key_Escape) {
event.accepted = true;
if(searching){
searchField.clear()
} else {
root.toggle()
}
} else if (event.text != "") {
event.accepted = true;
searchField.appendText(event.text);
}
}
}
Item{
Layout.fillHeight: true
}
}
Item{
anchors.top: topRow.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.fill: firstPage
visible: searching || readySearch
onVisibleChanged: {
if(visible) animation2.start()
}
Item {
id: mainColumn
width: parent.width
height: parent.height
anchors {
top: parent.top
topMargin: units.smallSpacing
}
property Item visibleGrid: allAppsGrid
function tryActivate(row, col) {
if (visibleGrid) {
visibleGrid.tryActivate(row, col);
}
}
ItemMultiGridView {
id: allAppsGrid
anchors.top: parent.top
z: (opacity == 1.0) ? 1 : 0
width: parent.width
height: parent.height
enabled: (opacity == 1.0) ? 1 : 0
opacity: searching ? 0 : 1
aCellWidth: parent.width - units.largeSpacing
aCellHeight: iconSize + units.smallSpacing*2
model: rootModel.modelForRow(2);
onOpacityChanged: {
if (opacity == 1.0) {
allAppsGrid.flickableItem.contentY = 0;
mainColumn.visibleGrid = allAppsGrid;
}
}
onKeyNavRight: globalFavoritesGrid.tryActivate(0,0)
}
ItemMultiGridView {
id: runnerGrid
anchors.fill: parent
z: (opacity == 1.0) ? 1 : 0
aCellWidth: parent.width - units.largeSpacing
aCellHeight: iconSize + units.smallSpacing * 2
enabled: (opacity == 1.0) ? 1 : 0
isSquare: false
model: runnerModel
grabFocus: true
opacity: searching ? 1.0 : 0.0
onOpacityChanged: {
if (opacity == 1.0) {
mainColumn.visibleGrid = runnerGrid;
}
}
onKeyNavRight: globalFavoritesGrid.tryActivate(0,0)
}
Keys.onPressed: {
if (event.key == Qt.Key_Tab) {
event.accepted = true;
globalFavoritesGrid.tryActivate(0,0)
} else if (event.key == Qt.Key_Backspace) {
event.accepted = true;
if(searching)
searchField.backspace();
else
searchField.focus = true
} else if (event.key == Qt.Key_Escape) {
event.accepted = true;
if(searching){
searchField.clear()
} else {
root.toggle()
}
} else if (event.text != "") {
event.accepted = true;
searchField.appendText(event.text);
}
}
}
}
Rectangle{
id: footer
width: parent.width + backgroundSvg.margins.right + backgroundSvg.margins.left
height: root.iconSizeSquare + units.smallSpacing*2 // units.gridUnit * 3
x: - backgroundSvg.margins.left
y: parent.height - height + backgroundSvg.margins.bottom
color: colorWithAlpha(theme.textColor,0.05)
Footer{
anchors.fill: parent
anchors.leftMargin: _margin*2
anchors.rightMargin: _margin*2
}
Rectangle{
anchors.top: parent.top
width: parent.width
height: 1
color: theme.textColor
opacity: 0.15
z:2
}
}
Keys.onPressed: {
if (event.key === Qt.Key_Escape) {
event.accepted = true;
root.toggle()
}
}
}
Component.onCompleted: {
rootModel.refreshed.connect(reset)
kicker.reset.connect(reset);
reset();
}
}

View File

@ -0,0 +1,209 @@
/***************************************************************************
* Copyright (C) 2013 by Aurélien Gâteau <agateau@kde.org> *
* Copyright (C) 2013-2015 by Eike Hein <hein@kde.org> *
* Copyright (C) 2017 by Ivan Cukic <ivan.cukic@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
.pragma library
var formats = [
"SmallMedium",
"Medium",
"Large",
"Huge"
]
function fillActionMenu(i18n, actionMenu, actionList, favoriteModel, favoriteId) {
// Accessing actionList can be a costly operation, so we don't
// access it until we need the menu.
var actions = createFavoriteActions(i18n, favoriteModel, favoriteId);
if (actions) {
if (actionList && actionList.length > 0) {
var separator = { "type": "separator" };
actionList.push(separator);
// actionList = actions.concat(actionList); // this crashes Qt O.o
actionList.push.apply(actionList, actions);
} else {
actionList = actions;
}
}
actionMenu.actionList = actionList;
}
function createFavoriteActions(i18n, favoriteModel, favoriteId) {
if (favoriteModel === null || !favoriteModel.enabled || favoriteId == null) {
return null;
}
if (favoriteModel.activities === undefined ||
favoriteModel.activities.runningActivities.length <= 1) {
var action = {};
if (favoriteModel.isFavorite(favoriteId)) {
action.text = i18n("Remove from Favorites");
action.icon = "bookmark-remove";
action.actionId = "_kicker_favorite_remove";
} else if (favoriteModel.maxFavorites == -1 || favoriteModel.count < favoriteModel.maxFavorites) {
action.text = i18n("Add to Favorites");
action.icon = "bookmark-new";
action.actionId = "_kicker_favorite_add";
} else {
return null;
}
action.actionArgument = { favoriteModel: favoriteModel, favoriteId: favoriteId };
return [action];
} else {
var actions = [];
var linkedActivities = favoriteModel.linkedActivitiesFor(favoriteId);
var activities = favoriteModel.activities.runningActivities;
// Adding the item to link/unlink to all activities
var linkedToAllActivities =
!(linkedActivities.indexOf(":global") === -1);
actions.push({
text : i18n("On All Activities"),
checkable : true,
actionId : linkedToAllActivities ?
"_kicker_favorite_remove_from_activity" :
"_kicker_favorite_set_to_activity",
checked : linkedToAllActivities,
actionArgument : {
favoriteModel: favoriteModel,
favoriteId: favoriteId,
favoriteActivity: ""
}
});
// Adding items for each activity separately
var addActivityItem = function(activityId, activityName) {
var linkedToThisActivity =
!(linkedActivities.indexOf(activityId) === -1);
actions.push({
text : activityName,
checkable : true,
checked : linkedToThisActivity && !linkedToAllActivities,
actionId :
// If we are on all activities, and the user clicks just one
// specific activity, unlink from everything else
linkedToAllActivities ? "_kicker_favorite_set_to_activity" :
// If we are linked to the current activity, just unlink from
// that single one
linkedToThisActivity ? "_kicker_favorite_remove_from_activity" :
// Otherwise, link to this activity, but do not unlink from
// other ones
"_kicker_favorite_add_to_activity",
actionArgument : {
favoriteModel : favoriteModel,
favoriteId : favoriteId,
favoriteActivity : activityId
}
});
};
// Adding the item to link/unlink to the current activity
addActivityItem(favoriteModel.activities.currentActivity, i18n("On the Current Activity"));
actions.push({
type: "separator",
actionId: "_kicker_favorite_separator"
});
// Adding the items for each activity
activities.forEach(function(activityId) {
addActivityItem(activityId, favoriteModel.activityNameForId(activityId));
});
return [{
text : i18n("Show in Favorites"),
icon : "favorite",
subActions : actions
}];
}
}
function triggerAction(model, index, actionId, actionArgument) {
function startsWith(txt, needle) {
return txt.substr(0, needle.length) === needle;
}
if (startsWith(actionId, "_kicker_favorite_")) {
handleFavoriteAction(actionId, actionArgument);
return;
}
var closeRequested = model.trigger(index, actionId, actionArgument);
if (closeRequested) {
return true;
}
return false;
}
function handleFavoriteAction(actionId, actionArgument) {
var favoriteId = actionArgument.favoriteId;
var favoriteModel = actionArgument.favoriteModel;
console.log(actionId);
if (favoriteModel === null || favoriteId == null) {
return null;
}
if (actionId == "_kicker_favorite_remove") {
console.log("Removing from all activities");
favoriteModel.removeFavorite(favoriteId);
} else if (actionId == "_kicker_favorite_add") {
console.log("Adding to global activity");
favoriteModel.addFavorite(favoriteId);
} else if (actionId == "_kicker_favorite_remove_from_activity") {
console.log("Removing from a specific activity");
favoriteModel.removeFavoriteFrom(favoriteId, actionArgument.favoriteActivity);
} else if (actionId == "_kicker_favorite_add_to_activity") {
console.log("Adding to another activity");
favoriteModel.addFavoriteTo(favoriteId, actionArgument.favoriteActivity);
} else if (actionId == "_kicker_favorite_set_to_activity") {
console.log("Removing the item from the favourites, and re-adding it just to be on a specific activity");
favoriteModel.setFavoriteOn(favoriteId, actionArgument.favoriteActivity);
}
}

View File

@ -0,0 +1,227 @@
/***************************************************************************
* Copyright (C) 2014-2015 by Eike Hein <hein@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.private.kicker 0.1 as Kicker
Item {
id: kicker
anchors.fill: parent
signal reset
property bool isDash: false
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
Plasmoid.compactRepresentation: null
Plasmoid.fullRepresentation: compactRepresentation
property Item dragSource: null
property QtObject globalFavorites: rootModel.favoritesModel
property QtObject systemFavorites: rootModel.systemFavoritesModel
function action_menuedit() {
processRunner.runMenuEditor();
}
Component {
id: compactRepresentation
CompactRepresentation {}
}
Component {
id: menuRepresentation
MenuRepresentation {}
}
Kicker.RootModel {
id: rootModel
autoPopulate: false
appNameFormat: 0
flat: true
showSeparators: false
appletInterface: plasmoid
showAllApps: true
showAllAppsCategorized: true
showTopLevelItems: false
showRecentApps: true
showRecentDocs: true
showRecentContacts: false
Component.onCompleted: {
if ("initForClient" in favoritesModel) {
favoritesModel.initForClient("org.kde.plasma.kicker.favorites.instance-" + plasmoid.id)
if (!plasmoid.configuration.favoritesPortedToKAstats) {
favoritesModel.portOldFavorites(plasmoid.configuration.favoriteApps);
plasmoid.configuration.favoritesPortedToKAstats = true;
}
} else {
favoritesModel.favorites = plasmoid.configuration.favoriteApps;
}
favoritesModel.maxFavorites = pageSize;
rootModel.refresh();
}
}
Connections {
target: globalFavorites
onFavoritesChanged: {
plasmoid.configuration.favoriteApps = target.favorites;
}
}
Connections {
target: systemFavorites
onFavoritesChanged: {
plasmoid.configuration.favoriteSystemActions = target.favorites;
}
}
Connections {
target: plasmoid.configuration
onFavoriteAppsChanged: {
globalFavorites.favorites = plasmoid.configuration.favoriteApps;
}
onFavoriteSystemActionsChanged: {
systemFavorites.favorites = plasmoid.configuration.favoriteSystemActions;
}
}
Kicker.RunnerModel {
id: runnerModel
appletInterface: plasmoid
favoritesModel: globalFavorites
//mergeResults: true
//runners: plasmoid.configuration.useExtraRunners ? new Array("services").concat(plasmoid.configuration.extraRunners) : "services"
runners: {
var runners = new Array("services", "krunner_systemsettings");
runners = runners.concat(new Array("desktopsessions", "PowerDevil",
"calculator", "unitconverter"));
if (plasmoid.configuration.useExtraRunners) {
runners = runners.concat(plasmoid.configuration.extraRunners);
}
return runners;
}
deleteWhenEmpty: true
}
Kicker.DragHelper {
id: dragHelper
}
Kicker.ProcessRunner {
id: processRunner;
}
Kicker.WindowSystem {
id: windowSystem
}
PlasmaCore.FrameSvgItem {
id : highlightItemSvg
visible: false
imagePath: "widgets/viewitem"
prefix: "hover"
}
PlasmaCore.FrameSvgItem {
id : panelSvg
visible: false
imagePath: "widgets/panel-background"
}
PlasmaCore.FrameSvgItem {
id : backgroundSvg
visible: false
imagePath: "dialogs/background"
}
PlasmaComponents.Label {
id: toolTipDelegate
width: contentWidth
height: contentHeight
property Item toolTip
text: (toolTip != null) ? toolTip.text : ""
}
function resetDragSource() {
dragSource = null;
}
function enableHideOnWindowDeactivate() {
plasmoid.hideOnWindowDeactivate = true;
}
Component.onCompleted: {
//plasmoid.setAction("menuedit", i18n("Edit Applications..."));
//rootModel.refreshed.connect(reset);
//dragHelper.dropped.connect(resetDragSource);
if (plasmoid.hasOwnProperty("activationTogglesExpanded")) {
plasmoid.activationTogglesExpanded = false//!kicker.isDash
}
windowSystem.focusIn.connect(enableHideOnWindowDeactivate);
plasmoid.hideOnWindowDeactivate = true;
if (plasmoid.immutability !== PlasmaCore.Types.SystemImmutable) {
plasmoid.setAction("menuedit", i18n("Edit Applications…"), "kmenuedit");
}
//updateSvgMetrics();
PlasmaCore.Theme.themeChanged.connect(updateSvgMetrics);
rootModel.refreshed.connect(reset);
dragHelper.dropped.connect(resetDragSource);
}
}

View File

@ -0,0 +1,28 @@
{
"KPlugin": {
"Authors": [
{
"Email": "adhemarks@gmail.com",
"Name": "adhe"
}
],
"Category": "Application Launchers",
"Dependencies": [
],
"Description": "A configurable launcher menu 11",
"EnabledByDefault": true,
"Icon": "start-here-kde",
"Id": "com.github.adhec.OnzeMenuKDE",
"License": "GPL-2.0+",
"Name": "OnzeMenuKDE",
"ServiceTypes": [
"Plasma/Applet"
],
"Version": "8.0"
},
"X-Plasma-API": "declarativeappletscript",
"X-Plasma-MainScript": "ui/main.qml",
"X-Plasma-Provides": [
"org.kde.plasma.launchermenu"
]
}

View File

@ -0,0 +1,45 @@
> Zren based translation template, i18n scripts. [link](https://github.com/Zren/plasma-applet-tiledmenu)
## Install Translations
Go to `~/.local/share/plasma/plasmoids/OnzeMenu/translate/` and run `sh ./build --restartplasma`.
## New Translations
1. Fill out [`template.pot`](template.pot) with your translations then open a [new issue](https://github.com/adhec/dittoMenuKDE/issues), name the file `spanish.txt`, attach the txt file to the issue (drag and drop).
Or if you know how to make a pull request
1. Copy the `template.pot` file and name it your locale's code (Eg: `en`/`de`/`fr`) with the extension `.po`. Then fill out all the `msgstr ""`.
## Scripts
* `sh ./merge` will parse the `i18n()` calls in the `*.qml` files and write it to the `template.pot` file. Then it will merge any changes into the `*.po` language files.
* `sh ./build` will convert the `*.po` files to it's binary `*.mo` version and move it to `contents/locale/...` which will bundle the translations in the `*.plasmoid` without needing the user to manually install them.
* `sh ./plasmoidlocaletest` will run `./build` then `plasmoidviewer` (part of `plasma-sdk`).
## Links
* https://zren.github.io/kde/docs/widget/#translations-i18n
* https://techbase.kde.org/Development/Tutorials/Localization/i18n_Build_Systems
* https://api.kde.org/frameworks/ki18n/html/prg_guide.html
## Examples
* https://l10n.kde.org/stats/gui/trunk-kf5/team/fr/plasma-desktop/
* https://github.com/psifidotos/nowdock-plasmoid/tree/master/po
* https://github.com/kotelnik/plasma-applet-redshift-control/tree/master/translations
## Status
| Locale | Lines | % Done|
|----------|---------|-------|
| Template | 33 | |
| de | 32/33 | 96% |
| fr | 32/33 | 96% |
| ko | 32/33 | 96% |
| nl | 32/33 | 96% |
| pt-br | 32/33 | 96% |
| ru | 32/33 | 96% |
| tr | 28/33 | 84% |
| zh_CN | 30/33 | 90% |

View File

@ -0,0 +1,151 @@
# Translation of OnzeMenu in German
# Copyright (C) 2022
# This file is distributed under the same license as the OnzeMenu package.
# Pascal Dietrich <pascal.1.dietrich@hotmail.com>, 2022.
#
msgid ""
msgstr ""
"Project-Id-Version: OnzeMenu\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-02 23:21-0300\n"
"PO-Revision-Date: 2022-11-06 15:+0200\n"
"Last-Translator: Pascal Dietrich <pascal.1.dietrich@hotmail.com>\n"
"Language-Team: \n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../metadata.desktop
msgid "OnzeMenu 11"
msgstr "OnzeMenu 11"
#: ../metadata.desktop
msgid "A configurable launcher menu 11"
msgstr "Ein konfigurierbares Launcher-Menü 11"
#: ../contents/config/config.qml
msgid "General"
msgstr "Allgemein"
#: ../contents/ui/code/tools.js
msgid "Remove from Favorites"
msgstr "Von Favoriten entfernen"
#: ../contents/ui/code/tools.js
msgid "Add to Favorites"
msgstr "Zu Favoriten hinzufügen"
#: ../contents/ui/code/tools.js
msgid "On All Activities"
msgstr "Für alle Aktivitäten"
#: ../contents/ui/code/tools.js
msgid "On the Current Activity"
msgstr "Für die aktuelle Aktivität"
#: ../contents/ui/code/tools.js
msgid "Show in Favorites"
msgstr "In Favoriten anzeigen"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icon:"
msgstr "Symbol:"
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Open icon chooser dialog"
msgid "Choose..."
msgstr "Auswählen..."
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Reset icon to default"
msgid "Clear Icon"
msgstr "Symbol entfernen"
#: ../contents/ui/ConfigGeneral.qml
msgid "Menu position"
msgstr "Position des Menüs"
#: ../contents/ui/ConfigGeneral.qml
msgid "Default"
msgstr "Standard"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center"
msgstr "Mitte"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center bottom"
msgstr "Mitte unten"
#: ../contents/ui/ConfigGeneral.qml
msgid "Expand search to bookmarks, files and emails"
msgstr "Suche auf Lesezeichen, Dateien und E-Mails erweitern"
#: ../contents/ui/ConfigGeneral.qml
msgid "Show labels in two lines"
msgstr "Beschriftungen in zwei Zeilen anzeigen"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of columns (main grid)"
msgstr "Anzahl der Spalten (Hauptraster)"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of rows (main grid)"
msgstr "Anzahl der Reihen (Hauptraster)"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icons smooth"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Size of icons"
msgstr "Größe der Symbole"
#: ../contents/ui/Footer.qml
msgid "User Home"
msgstr "Benutzerordner"
#: ../contents/ui/Footer.qml
msgid "System Preferences"
msgstr "Systemeinstellungen"
#: ../contents/ui/Footer.qml
msgid "Lock Screen"
msgstr "Bildschirm sperren"
#: ../contents/ui/Footer.qml
msgid "Leave ..."
msgstr "Herunterfahren"
#: ../contents/ui/main.qml
msgid "Edit Applications…"
msgstr "Apps bearbeiten"
#: ../contents/ui/MenuRepresentation.qml
msgid "Type here to search ..."
msgstr "Suchbegriff hier eingeben"
#: ../contents/ui/MenuRepresentation.qml
msgid "Search results"
msgstr "Suchergebnisse"
#: ../contents/ui/MenuRepresentation.qml
msgid "Pinned"
msgstr "Angeheftet"
#: ../contents/ui/MenuRepresentation.qml
msgid "All apps"
msgstr "Alle Apps"
#: ../contents/ui/MenuRepresentation.qml
msgid "Recommended"
msgstr "Empfohlen"
#: ../contents/ui/MenuRepresentation.qml
msgid "Back"
msgstr "Zurück"
#: ../contents/ui/MenuRepresentation.qml
msgid "More"
msgstr "Mehr"

View File

@ -0,0 +1,152 @@
# Translation of OnzeMenu in fr
# Copyright (C) 2022
# This file is distributed under the same license as the OnzeMenu package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: OnzeMenu\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-02 23:21-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../metadata.desktop
msgid "OnzeMenu 11"
msgstr "OnzeMenu 11"
#: ../metadata.desktop
msgid "A configurable launcher menu 11"
msgstr "Un lanceur configurable style Win11"
#: ../contents/config/config.qml
msgid "General"
msgstr "Général"
#: ../contents/ui/code/tools.js
msgid "Remove from Favorites"
msgstr "Retirer des Favoris"
#: ../contents/ui/code/tools.js
msgid "Add to Favorites"
msgstr "Ajouter aux Favoris"
#: ../contents/ui/code/tools.js
msgid "On All Activities"
msgstr "Pour toute les sessions"
#: ../contents/ui/code/tools.js
msgid "On the Current Activity"
msgstr "Pour la session en cours"
#: ../contents/ui/code/tools.js
msgid "Show in Favorites"
msgstr "Montrer dans les favoris"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icon:"
msgstr "Icône:"
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Open icon chooser dialog"
msgid "Choose..."
msgstr "Choisissez..."
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Reset icon to default"
msgid "Clear Icon"
msgstr "Effacer l'icône"
#: ../contents/ui/ConfigGeneral.qml
msgid "Menu position"
msgstr "Position du menu"
#: ../contents/ui/ConfigGeneral.qml
msgid "Default"
msgstr "Par défaut"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center"
msgstr "Centré"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center bottom"
msgstr "Centré en bas"
#: ../contents/ui/ConfigGeneral.qml
msgid "Expand search to bookmarks, files and emails"
msgstr "Étendre la recherche dans les marques-pages, les fichiers et les emails"
#: ../contents/ui/ConfigGeneral.qml
msgid "Show labels in two lines"
msgstr "Montrer les étiquettes sur 2 lignes"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of columns (main grid)"
msgstr "Nombre de colonnes (grille principale)"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of rows (main grid)"
msgstr "Nombre de lignes (grille principale)"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icons smooth"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Size of icons"
msgstr "Taille des icônes"
#: ../contents/ui/Footer.qml
msgid "User Home"
msgstr "Dossier utilisateur (Home)"
#: ../contents/ui/Footer.qml
msgid "System Preferences"
msgstr "Préférences système"
#: ../contents/ui/Footer.qml
msgid "Lock Screen"
msgstr "Verrouiller l'écran"
#: ../contents/ui/Footer.qml
msgid "Leave ..."
msgstr "Quitter ..."
#: ../contents/ui/main.qml
msgid "Edit Applications…"
msgstr "Éditer les applications"
#: ../contents/ui/MenuRepresentation.qml
msgid "Type here to search ..."
msgstr "Rechercher ..."
#: ../contents/ui/MenuRepresentation.qml
msgid "Search results"
msgstr "Résultats de la recherche"
#: ../contents/ui/MenuRepresentation.qml
msgid "Pinned"
msgstr "Applications épinglées"
#: ../contents/ui/MenuRepresentation.qml
msgid "All apps"
msgstr "Toutes les applications"
#: ../contents/ui/MenuRepresentation.qml
msgid "Recommended"
msgstr "Applications recommandées"
#: ../contents/ui/MenuRepresentation.qml
msgid "Back"
msgstr "Retour"
#: ../contents/ui/MenuRepresentation.qml
msgid "More"
msgstr "Plus"

View File

@ -0,0 +1,153 @@
# Translation of OnzeMenu in ko
# Copyright (C) 2022
# This file is distributed under the same license as the OnzeMenu package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: OnzeMenu\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-02 23:21-0300\n"
"PO-Revision-Date: 2022-06-22 14:28+0900\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: ko\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.0.1\n"
#: ../metadata.desktop
msgid "OnzeMenu 11"
msgstr "Onze 메뉴 11"
#: ../metadata.desktop
msgid "A configurable launcher menu 11"
msgstr "설정 가능한 Win11 스타일 프로그램 실행기"
#: ../contents/config/config.qml
msgid "General"
msgstr "일반"
#: ../contents/ui/code/tools.js
msgid "Remove from Favorites"
msgstr "즐겨찾기에서 제거"
#: ../contents/ui/code/tools.js
msgid "Add to Favorites"
msgstr "즐겨찾기에 추가"
#: ../contents/ui/code/tools.js
msgid "On All Activities"
msgstr "모든 활동에서"
#: ../contents/ui/code/tools.js
msgid "On the Current Activity"
msgstr "현재 활동에서"
#: ../contents/ui/code/tools.js
msgid "Show in Favorites"
msgstr "즐겨찾기에 표시"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icon:"
msgstr "아이콘:"
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Open icon chooser dialog"
msgid "Choose..."
msgstr "선택..."
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Reset icon to default"
msgid "Clear Icon"
msgstr "아이콘 초기화"
#: ../contents/ui/ConfigGeneral.qml
msgid "Menu position"
msgstr "메뉴 위치"
#: ../contents/ui/ConfigGeneral.qml
msgid "Default"
msgstr "기본"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center"
msgstr "가운데"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center bottom"
msgstr "가운데 밑"
#: ../contents/ui/ConfigGeneral.qml
msgid "Expand search to bookmarks, files and emails"
msgstr "책갈피, 파일, 이메일에서도 찾기"
#: ../contents/ui/ConfigGeneral.qml
msgid "Show labels in two lines"
msgstr "두 줄로 레이블 표시"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of columns (main grid)"
msgstr "열 수 (메인 그리드)"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of rows (main grid)"
msgstr "행 수 (메인 그리드)"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icons smooth"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Size of icons"
msgstr "아이콘 크기"
#: ../contents/ui/Footer.qml
msgid "User Home"
msgstr "홈 폴더"
#: ../contents/ui/Footer.qml
msgid "System Preferences"
msgstr "시스템 설정"
#: ../contents/ui/Footer.qml
msgid "Lock Screen"
msgstr "잠금"
#: ../contents/ui/Footer.qml
msgid "Leave ..."
msgstr "떠나기..."
#: ../contents/ui/main.qml
msgid "Edit Applications…"
msgstr "프로그램 편집…"
#: ../contents/ui/MenuRepresentation.qml
msgid "Type here to search ..."
msgstr "검색하려면 입력..."
#: ../contents/ui/MenuRepresentation.qml
msgid "Search results"
msgstr "검색 결과"
#: ../contents/ui/MenuRepresentation.qml
msgid "Pinned"
msgstr "고정됨"
#: ../contents/ui/MenuRepresentation.qml
msgid "All apps"
msgstr "모든 프로그램"
#: ../contents/ui/MenuRepresentation.qml
msgid "Recommended"
msgstr "추천"
#: ../contents/ui/MenuRepresentation.qml
msgid "Back"
msgstr "뒤로"
#: ../contents/ui/MenuRepresentation.qml
msgid "More"
msgstr "더 보기"

View File

@ -0,0 +1,223 @@
#!/bin/sh
# Version: 20
# https://techbase.kde.org/Development/Tutorials/Localization/i18n_Build_Systems
# https://techbase.kde.org/Development/Tutorials/Localization/i18n_Build_Systems/Outside_KDE_repositories
# https://invent.kde.org/sysadmin/l10n-scripty/-/blob/master/extract-messages.sh
DIR=`cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd`
plasmoidName=`kreadconfig5 --file="$DIR/../metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Name"`
widgetName="${plasmoidName##*.}" # Strip namespace
website=`kreadconfig5 --file="$DIR/../metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Website"`
bugAddress="$website"
packageRoot=".." # Root of translatable sources
projectName="plasma_applet_${plasmoidName}" # project name
#---
if [ -z "$plasmoidName" ]; then
echo "[merge] Error: Couldn't read plasmoidName."
exit
fi
if [ -z "$(which xgettext)" ]; then
echo "[merge] Error: xgettext command not found. Need to install gettext"
echo "[merge] Running 'sudo apt install gettext'"
sudo apt install gettext
echo "[merge] gettext installation should be finished. Going back to merging translations."
fi
#---
echo "[merge] Extracting messages"
potArgs="--from-code=UTF-8 --width=200 --add-location=file"
find "${packageRoot}" -name '*.desktop' | sort > "${DIR}/infiles.list"
xgettext \
${potArgs} \
--files-from="${DIR}/infiles.list" \
--language=Desktop \
-D "${packageRoot}" \
-D "${DIR}" \
-o "template.pot.new" \
|| \
{ echo "[merge] error while calling xgettext. aborting."; exit 1; }
sed -i 's/"Content-Type: text\/plain; charset=CHARSET\\n"/"Content-Type: text\/plain; charset=UTF-8\\n"/' "template.pot.new"
# See Ki18n's extract-messages.sh for a full example:
# https://invent.kde.org/sysadmin/l10n-scripty/-/blob/master/extract-messages.sh#L25
# The -kN_ and -kaliasLocale keywords are mentioned in the Outside_KDE_repositories wiki.
# We don't need -kN_ since we don't use intltool-extract but might as well keep it.
# I have no idea what -kaliasLocale is used for. Googling aliasLocale found only listed kde1 code.
# We don't need to parse -ki18nd since that'll extract messages from other domains.
find "${packageRoot}" -name '*.cpp' -o -name '*.h' -o -name '*.c' -o -name '*.qml' -o -name '*.js' | sort > "${DIR}/infiles.list"
xgettext \
${potArgs} \
--files-from="${DIR}/infiles.list" \
-C -kde \
-ci18n \
-ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 \
-kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \
-kxi18n:1 -kxi18nc:1c,2 -kxi18np:1,2 -kxi18ncp:1c,2,3 \
-kkxi18n:1 -kkxi18nc:1c,2 -kkxi18np:1,2 -kkxi18ncp:1c,2,3 \
-kI18N_NOOP:1 -kI18NC_NOOP:1c,2 \
-kI18N_NOOP2:1c,2 -kI18N_NOOP2_NOSTRIP:1c,2 \
-ktr2i18n:1 -ktr2xi18n:1 \
-kN_:1 \
-kaliasLocale \
--package-name="${widgetName}" \
--msgid-bugs-address="${bugAddress}" \
-D "${packageRoot}" \
-D "${DIR}" \
--join-existing \
-o "template.pot.new" \
|| \
{ echo "[merge] error while calling xgettext. aborting."; exit 1; }
sed -i 's/# SOME DESCRIPTIVE TITLE./'"# Translation of ${widgetName} in LANGUAGE"'/' "template.pot.new"
sed -i 's/# Copyright (C) YEAR THE PACKAGE'"'"'S COPYRIGHT HOLDER/'"# Copyright (C) $(date +%Y)"'/' "template.pot.new"
if [ -f "template.pot" ]; then
newPotDate=`grep "POT-Creation-Date:" template.pot.new | sed 's/.\{3\}$//'`
oldPotDate=`grep "POT-Creation-Date:" template.pot | sed 's/.\{3\}$//'`
sed -i 's/'"${newPotDate}"'/'"${oldPotDate}"'/' "template.pot.new"
changes=`diff "template.pot" "template.pot.new"`
if [ ! -z "$changes" ]; then
# There's been changes
sed -i 's/'"${oldPotDate}"'/'"${newPotDate}"'/' "template.pot.new"
mv "template.pot.new" "template.pot"
addedKeys=`echo "$changes" | grep "> msgid" | cut -c 9- | sort`
removedKeys=`echo "$changes" | grep "< msgid" | cut -c 9- | sort`
echo ""
echo "Added Keys:"
echo "$addedKeys"
echo ""
echo "Removed Keys:"
echo "$removedKeys"
echo ""
else
# No changes
rm "template.pot.new"
fi
else
# template.pot didn't already exist
mv "template.pot.new" "template.pot"
fi
potMessageCount=`expr $(grep -Pzo 'msgstr ""\n(\n|$)' "template.pot" | grep -c 'msgstr ""')`
echo "| Locale | Lines | % Done|" > "./Status.md"
echo "|----------|---------|-------|" >> "./Status.md"
entryFormat="| %-8s | %7s | %5s |"
templateLine=`perl -e "printf(\"$entryFormat\", \"Template\", \"${potMessageCount}\", \"\")"`
echo "$templateLine" >> "./Status.md"
rm "${DIR}/infiles.list"
echo "[merge] Done extracting messages"
#---
echo "[merge] Merging messages"
catalogs=`find . -name '*.po' | sort`
for cat in $catalogs; do
echo "[merge] $cat"
catLocale=`basename ${cat%.*}`
widthArg=""
catUsesGenerator=`grep "X-Generator:" "$cat"`
if [ -z "$catUsesGenerator" ]; then
widthArg="--width=400"
fi
cp "$cat" "$cat.new"
sed -i 's/"Content-Type: text\/plain; charset=CHARSET\\n"/"Content-Type: text\/plain; charset=UTF-8\\n"/' "$cat.new"
msgmerge \
${widthArg} \
--add-location=file \
--no-fuzzy-matching \
-o "$cat.new" \
"$cat.new" "${DIR}/template.pot"
sed -i 's/# SOME DESCRIPTIVE TITLE./'"# Translation of ${widgetName} in ${catLocale}"'/' "$cat.new"
sed -i 's/# Translation of '"${widgetName}"' in LANGUAGE/'"# Translation of ${widgetName} in ${catLocale}"'/' "$cat.new"
sed -i 's/# Copyright (C) YEAR THE PACKAGE'"'"'S COPYRIGHT HOLDER/'"# Copyright (C) $(date +%Y)"'/' "$cat.new"
poEmptyMessageCount=`expr $(grep -Pzo 'msgstr ""\n(\n|$)' "$cat.new" | grep -c 'msgstr ""')`
poMessagesDoneCount=`expr $potMessageCount - $poEmptyMessageCount`
poCompletion=`perl -e "printf(\"%d\", $poMessagesDoneCount * 100 / $potMessageCount)"`
poLine=`perl -e "printf(\"$entryFormat\", \"$catLocale\", \"${poMessagesDoneCount}/${potMessageCount}\", \"${poCompletion}%\")"`
echo "$poLine" >> "./Status.md"
# mv "$cat" "$cat.old"
mv "$cat.new" "$cat"
done
echo "[merge] Done merging messages"
#---
echo "[merge] Updating .desktop file"
# Generate LINGUAS for msgfmt
if [ -f "$DIR/LINGUAS" ]; then
rm "$DIR/LINGUAS"
fi
touch "$DIR/LINGUAS"
for cat in $catalogs; do
catLocale=`basename ${cat%.*}`
echo "${catLocale}" >> "$DIR/LINGUAS"
done
cp -f "$DIR/../metadata.desktop" "$DIR/template.desktop"
sed -i '/^Name\[/ d; /^GenericName\[/ d; /^Comment\[/ d; /^Keywords\[/ d' "$DIR/template.desktop"
msgfmt \
--desktop \
--template="$DIR/template.desktop" \
-d "$DIR/" \
-o "$DIR/new.desktop"
# Delete empty msgid messages that used the po header
if [ ! -z "$(grep '^Name=$' "$DIR/new.desktop")" ]; then
echo "[merge] Name in metadata.desktop is empty!"
sed -i '/^Name\[/ d' "$DIR/new.desktop"
fi
if [ ! -z "$(grep '^GenericName=$' "$DIR/new.desktop")" ]; then
echo "[merge] GenericName in metadata.desktop is empty!"
sed -i '/^GenericName\[/ d' "$DIR/new.desktop"
fi
if [ ! -z "$(grep '^Comment=$' "$DIR/new.desktop")" ]; then
echo "[merge] Comment in metadata.desktop is empty!"
sed -i '/^Comment\[/ d' "$DIR/new.desktop"
fi
if [ ! -z "$(grep '^Keywords=$' "$DIR/new.desktop")" ]; then
echo "[merge] Keywords in metadata.desktop is empty!"
sed -i '/^Keywords\[/ d' "$DIR/new.desktop"
fi
# Place translations at the bottom of the desktop file.
translatedLines=`cat "$DIR/new.desktop" | grep "]="`
if [ ! -z "${translatedLines}" ]; then
sed -i '/^Name\[/ d; /^GenericName\[/ d; /^Comment\[/ d; /^Keywords\[/ d' "$DIR/new.desktop"
if [ "$(tail -c 2 "$DIR/new.desktop" | wc -l)" != "2" ]; then
# Does not end with 2 empty lines, so add an empty line.
echo "" >> "$DIR/new.desktop"
fi
echo "${translatedLines}" >> "$DIR/new.desktop"
fi
# Cleanup
mv "$DIR/new.desktop" "$DIR/../metadata.desktop"
rm "$DIR/template.desktop"
rm "$DIR/LINGUAS"
#---
# Populate ReadMe.md
echo "[merge] Updating translate/ReadMe.md"
sed -i -E 's`share\/plasma\/plasmoids\/(.+)\/translate`share/plasma/plasmoids/'"${plasmoidName}"'/translate`' ./ReadMe.md
if [[ "$website" == *"github.com"* ]]; then
sed -i -E 's`\[new issue\]\(https:\/\/github\.com\/(.+)\/(.+)\/issues\/new\)`[new issue]('"${website}"'/issues/new)`' ./ReadMe.md
fi
sed -i '/^|/ d' ./ReadMe.md # Remove status table from ReadMe
cat ./Status.md >> ./ReadMe.md
rm ./Status.md
echo "[merge] Done"

View File

@ -0,0 +1,168 @@
# Translation of OnzeMenu in nl
# Copyright (C) 2022
# This file is distributed under the same license as the OnzeMenu package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: OnzeMenu\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-02 23:21-0300\n"
"PO-Revision-Date: 2022-04-27 17:59+0200\n"
"Last-Translator: Heimen Stoffels <vistausss@fastmail.com>\n"
"Language-Team: \n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.0.1\n"
#: ../metadata.desktop
msgid "OnzeMenu 11"
msgstr "OnzeMenu 11"
#: ../metadata.desktop
msgid "A configurable launcher menu 11"
msgstr "Een instelbare programmastarter 11"
#: ../contents/config/config.qml
msgid "General"
msgstr "Algemeen"
#: ../contents/ui/code/tools.js
msgid "Remove from Favorites"
msgstr "Verwijderen uit favorieten"
#: ../contents/ui/code/tools.js
msgid "Add to Favorites"
msgstr "Toevoegen aan favorieten"
#: ../contents/ui/code/tools.js
msgid "On All Activities"
msgstr "Op alle activiteiten"
#: ../contents/ui/code/tools.js
msgid "On the Current Activity"
msgstr "Op de huidige activiteit"
#: ../contents/ui/code/tools.js
msgid "Show in Favorites"
msgstr "Toevoegen aan favorieten"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icon:"
msgstr "Pictogram:"
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Open icon chooser dialog"
msgid "Choose..."
msgstr "Kiezen…"
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Reset icon to default"
msgid "Clear Icon"
msgstr "Pictogram verwijderen"
#: ../contents/ui/ConfigGeneral.qml
msgid "Menu position"
msgstr "Menulocatie"
#: ../contents/ui/ConfigGeneral.qml
msgid "Default"
msgstr "Standaard"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center"
msgstr "Gecentreerd"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center bottom"
msgstr "Gecentreerd (onderaan)"
#: ../contents/ui/ConfigGeneral.qml
msgid "Expand search to bookmarks, files and emails"
msgstr "Ook bladwijzers, bestanden en e-mails doorzoeken"
#: ../contents/ui/ConfigGeneral.qml
msgid "Show labels in two lines"
msgstr "Labeltekst verdelen over twee regels"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of columns (main grid)"
msgstr "Aantal kolommen op overzicht"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of rows (main grid)"
msgstr "Aantal rijen op overzicht"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icons smooth"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Size of icons"
msgstr "Pictogramgrootte"
#: ../contents/ui/Footer.qml
msgid "User Home"
msgstr "Persoonlijke map"
#: ../contents/ui/Footer.qml
msgid "System Preferences"
msgstr "Systeeminstellingen"
#: ../contents/ui/Footer.qml
msgid "Lock Screen"
msgstr "Scherm vergrendelen"
#: ../contents/ui/Footer.qml
msgid "Leave ..."
msgstr "Verlaten…"
#: ../contents/ui/main.qml
msgid "Edit Applications…"
msgstr "Programma's bewerken…"
#: ../contents/ui/MenuRepresentation.qml
msgid "Type here to search ..."
msgstr "Typ hier om te zoeken…"
#: ../contents/ui/MenuRepresentation.qml
msgid "Search results"
msgstr "Zoekresultaten"
#: ../contents/ui/MenuRepresentation.qml
msgid "Pinned"
msgstr "Vastgemaakt"
#: ../contents/ui/MenuRepresentation.qml
msgid "All apps"
msgstr "Alle programma's"
#: ../contents/ui/MenuRepresentation.qml
msgid "Recommended"
msgstr "Aanbevolen"
#: ../contents/ui/MenuRepresentation.qml
msgid "Back"
msgstr "Terug"
#: ../contents/ui/MenuRepresentation.qml
msgid "More"
msgstr "Meer"
#~ msgid "Menu position:"
#~ msgstr "Menulocatie:"
#~ msgid "Search"
#~ msgstr "Zoeken"
#~ msgid "Grid"
#~ msgstr "Rooster"
#~ msgid "Number of columns in grid"
#~ msgstr "Aantal kolommen op rooster"
#~ msgid "Number of rows in grid"
#~ msgstr "Aantal rijen op rooster"

View File

@ -0,0 +1,181 @@
#!/bin/bash
# Version 9
# Requires plasmoidviewer v5.13.0
function checkIfLangInstalled {
if [ -x "$(command -v dpkg)" ]; then
dpkg -l ${1} >/dev/null 2>&1 || ( \
echo -e "${1} not installed.\nInstalling now before continuing.\n" \
; sudo apt install ${1} \
) || ( \
echo -e "\nError trying to install ${1}\nPlease run 'sudo apt install ${1}'\n" \
; exit 1 \
)
elif [ -x "$(command -v pacman)" ]; then
# TODO: run `locale -a` and check if the locale is enabled.
if false; then
# https://wiki.archlinux.org/index.php/Locale
# Uncomment the locale in /etc/locale.gen
# Then run `locale-gen`
echo -e "\nPlease install this locale in System Settings first.\n"
exit 1
else
echo ""
fi
else
echo -e "\nPackage manager not recognized. If the widget is not translated, please install the package '${1}'\n"
fi
}
langInput="${1}"
lang=""
languagePack=""
if [[ "$langInput" =~ ":" ]]; then # String contains a colon so assume it's a locale code.
lang="${langInput}"
IFS=: read -r l1 l2 <<< "${lang}"
languagePack="language-pack-${l2}"
fi
# https://stackoverflow.com/questions/3191664/list-of-all-locales-and-their-short-codes/28357857#28357857
declare -a langArr=(
"af_ZA:af:Afrikaans (South Africa)"
"ak_GH:ak:Akan (Ghana)"
"am_ET:am:Amharic (Ethiopia)"
"ar_EG:ar:Arabic (Egypt)"
"as_IN:as:Assamese (India)"
"az_AZ:az:Azerbaijani (Azerbaijan)"
"be_BY:be:Belarusian (Belarus)"
"bem_ZM:bem:Bemba (Zambia)"
"bg_BG:bg:Bulgarian (Bulgaria)"
"bo_IN:bo:Tibetan (India)"
"bs_BA:bs:Bosnian (Bosnia and Herzegovina)"
"ca_ES:ca:Catalan (Spain)"
"chr_US:ch:Cherokee (United States)"
"cs_CZ:cs:Czech (Czech Republic)"
"cy_GB:cy:Welsh (United Kingdom)"
"da_DK:da:Danish (Denmark)"
"de_DE:de:German (Germany)"
"el_GR:el:Greek (Greece)"
"es_MX:es:Spanish (Mexico)"
"et_EE:et:Estonian (Estonia)"
"eu_ES:eu:Basque (Spain)"
"fa_IR:fa:Persian (Iran)"
"ff_SN:ff:Fulah (Senegal)"
"fi_FI:fi:Finnish (Finland)"
"fo_FO:fo:Faroese (Faroe Islands)"
"fr_CA:fr:French (Canada)"
"ga_IE:ga:Irish (Ireland)"
"gl_ES:gl:Galician (Spain)"
"gu_IN:gu:Gujarati (India)"
"gv_GB:gv:Manx (United Kingdom)"
"ha_NG:ha:Hausa (Nigeria)"
"he_IL:he:Hebrew (Israel)"
"hi_IN:hi:Hindi (India)"
"hr_HR:hr:Croatian (Croatia)"
"hu_HU:hu:Hungarian (Hungary)"
"hy_AM:hy:Armenian (Armenia)"
"id_ID:id:Indonesian (Indonesia)"
"ig_NG:ig:Igbo (Nigeria)"
"is_IS:is:Icelandic (Iceland)"
"it_IT:it:Italian (Italy)"
"ja_JP:ja:Japanese (Japan)"
"ka_GE:ka:Georgian (Georgia)"
"kk_KZ:kk:Kazakh (Kazakhstan)"
"kl_GL:kl:Kalaallisut (Greenland)"
"km_KH:km:Khmer (Cambodia)"
"kn_IN:kn:Kannada (India)"
"ko_KR:ko:Korean (South Korea)"
"ko_KR:ko:Korean (South Korea)"
"lg_UG:lg:Ganda (Uganda)"
"lt_LT:lt:Lithuanian (Lithuania)"
"lv_LV:lv:Latvian (Latvia)"
"mg_MG:mg:Malagasy (Madagascar)"
"mk_MK:mk:Macedonian (Macedonia)"
"ml_IN:ml:Malayalam (India)"
"mr_IN:mr:Marathi (India)"
"ms_MY:ms:Malay (Malaysia)"
"mt_MT:mt:Maltese (Malta)"
"my_MM:my:Burmese (Myanmar [Burma])"
"nb_NO:nb:Norwegian Bokmål (Norway)"
"ne_NP:ne:Nepali (Nepal)"
"nl_NL:nl:Dutch (Netherlands)"
"nn_NO:nn:Norwegian Nynorsk (Norway)"
"om_ET:om:Oromo (Ethiopia)"
"or_IN:or:Oriya (India)"
"pa_PK:pa:Punjabi (Pakistan)"
"pl_PL:pl:Polish (Poland)"
"ps_AF:ps:Pashto (Afghanistan)"
"pt_BR:pt:Portuguese (Brazil)"
"ro_RO:ro:Romanian (Romania)"
"ru_RU:ru:Russian (Russia)"
"rw_RW:rw:Kinyarwanda (Rwanda)"
"si_LK:si:Sinhala (Sri Lanka)"
"sk_SK:sk:Slovak (Slovakia)"
"sl_SI:sl:Slovenian (Slovenia)"
"so_SO:so:Somali (Somalia)"
"sq_AL:sq:Albanian (Albania)"
"sr_RS:sr:Serbian (Serbia)"
"sv_SE:sv:Swedish (Sweden)"
"sw_KE:sw:Swahili (Kenya)"
"ta_IN:ta:Tamil (India)"
"te_IN:te:Telugu (India)"
"th_TH:th:Thai (Thailand)"
"ti_ER:ti:Tigrinya (Eritrea)"
"to_TO:to:Tonga (Tonga)"
"tr_TR:tr:Turkish (Turkey)"
"uk_UA:uk:Ukrainian (Ukraine)"
"ur_IN:ur:Urdu (India)"
"uz_UZ:uz:Uzbek (Uzbekistan)"
"vi_VN:vi:Vietnamese (Vietnam)"
"yo_NG:yo:Yoruba (Nigeria)"
"yo_NG:yo:Yoruba (Nigeria)"
"yue_HK:yu:Cantonese (Hong Kong)"
"zh_CN:zh:Chinese (China)"
"zu_ZA:zu:Zulu (South Africa)"
)
for i in "${langArr[@]}"; do
IFS=: read -r l1 l2 l3 <<< "$i"
if [ "$langInput" == "$l2" ]; then
lang="${l1}:${l2}"
languagePack="language-pack-${l2}"
fi
done
if [ -z "$lang" ]; then
echo "plasmoidlocaletest doesn't recognize the language '$lang'"
echo "Eg:"
scriptcmd='sh ./plasmoidlocaletest'
for i in "${langArr[@]}"; do
IFS=: read -r l1 l2 l3 <<< "$i"
echo " ${scriptcmd} ${l2} | ${l3}"
done
echo ""
echo "Or use a the full locale code:"
echo " ${scriptcmd} ar_EG:ar"
exit 1
fi
IFS=: read -r l1 l2 <<< "${lang}"
l1="${l1}.UTF-8"
# Check if language is installed
if [ ! -z "$languagePack" ]; then
if [ "$lang" == "zh_CN:zh" ]; then languagePack="language-pack-zh-hans"
fi
checkIfLangInstalled "$languagePack" || exit 1
fi
echo "LANGUAGE=\"${lang}\""
echo "LANG=\"${l1}\""
scriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
packageDir="${scriptDir}/.."
# Build local translations for plasmoidviewer
sh "${scriptDir}/build"
LANGUAGE="${lang}" LANG="${l1}" LC_TIME="${l1}" QML_DISABLE_DISK_CACHE=true plasmoidviewer -a "$packageDir" -l topedge -f horizontal -x 0 -y 0

View File

@ -0,0 +1,154 @@
# Translation of OnzeMenu in pt
# Copyright (C) 2022
# This file is distributed under the same license as the OnzeMenu package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: OnzeMenu\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-02 23:21-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: mateussmb mt.moreirabarros@gmail.com\n"
"Language-Team: \n"
"Language: PT-BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Language: pt-br\n"
#: ../metadata.desktop
msgid "OnzeMenu 11"
msgstr "OnzeMenu 11"
#: ../metadata.desktop
msgid "A configurable launcher menu 11"
msgstr "Um menu de lançador configurável 11"
#: ../contents/config/config.qml
msgid "General"
msgstr "Geral"
#: ../contents/ui/code/tools.js
msgid "Remove from Favorites"
msgstr "Remover dos Favoritos"
#: ../contents/ui/code/tools.js
msgid "Add to Favorites"
msgstr "Adicionar aos Favoritos"
#: ../contents/ui/code/tools.js
msgid "On All Activities"
msgstr "Em Todas as Atividades"
#: ../contents/ui/code/tools.js
msgid "On the Current Activity"
msgstr "Na Atividade Atual"
#: ../contents/ui/code/tools.js
msgid "Show in Favorites"
msgstr "Mostrar nos Favoritos"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icon:"
msgstr "Ícone:"
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Open icon chooser dialog"
msgid "Choose..."
msgstr "Escolher..."
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Reset icon to default"
msgid "Clear Icon"
msgstr "Limpar Ícone"
#: ../contents/ui/ConfigGeneral.qml
msgid "Menu position"
msgstr "Posição do menu"
#: ../contents/ui/ConfigGeneral.qml
msgid "Default"
msgstr "Padrão"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center"
msgstr "Centro"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center bottom"
msgstr "Centro inferior"
#: ../contents/ui/ConfigGeneral.qml
msgid "Expand search to bookmarks, files and emails"
msgstr "Expandir a pesquisa para favoritos, arquivos e e-mails"
#: ../contents/ui/ConfigGeneral.qml
msgid "Show labels in two lines"
msgstr "Mostrar rótulos em duas linhas"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of columns (main grid)"
msgstr "Número de colunas (grade principal)"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of rows (main grid)"
msgstr "Número de linhas (grade principal)"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icons smooth"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Size of icons"
msgstr "Tamanho dos ícones"
#: ../contents/ui/Footer.qml
msgid "User Home"
msgstr "Página inicial do usuário"
#: ../contents/ui/Footer.qml
msgid "System Preferences"
msgstr "Preferências do sistema"
#: ../contents/ui/Footer.qml
msgid "Lock Screen"
msgstr "Tela de bloqueio"
#: ../contents/ui/Footer.qml
msgid "Leave ..."
msgstr "Sair ..."
#: ../contents/ui/main.qml
msgid "Edit Applications…"
msgstr "Editar aplicativos..."
#: ../contents/ui/MenuRepresentation.qml
msgid "Type here to search ..."
msgstr "Digite aqui para pesquisar..."
#: ../contents/ui/MenuRepresentation.qml
msgid "Search results"
msgstr "Resultados da busca"
#: ../contents/ui/MenuRepresentation.qml
msgid "Pinned"
msgstr "Fixado"
#: ../contents/ui/MenuRepresentation.qml
msgid "All apps"
msgstr "Todos os aplicativos"
#: ../contents/ui/MenuRepresentation.qml
msgid "Recommended"
msgstr "Recomendado"
#: ../contents/ui/MenuRepresentation.qml
msgid "Back"
msgstr "Voltar"
#: ../contents/ui/MenuRepresentation.qml
msgid "More"
msgstr "Mais"

View File

@ -0,0 +1,152 @@
# Translation of OnzeMenu in ru
# Copyright (C) 2022
# This file is distributed under the same license as the OnzeMenu package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: OnzeMenu\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-02 23:21-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../metadata.desktop
msgid "OnzeMenu 11"
msgstr ""
#: ../metadata.desktop
msgid "A configurable launcher menu 11"
msgstr "Настраиваемое меню запуска OnzeMenu 11"
#: ../contents/config/config.qml
msgid "General"
msgstr "Основное"
#: ../contents/ui/code/tools.js
msgid "Remove from Favorites"
msgstr "Удалить из избранного"
#: ../contents/ui/code/tools.js
msgid "Add to Favorites"
msgstr "Добавить в избранное"
#: ../contents/ui/code/tools.js
msgid "On All Activities"
msgstr "Во всех комнатах"
#: ../contents/ui/code/tools.js
msgid "On the Current Activity"
msgstr "В текущей комнате"
#: ../contents/ui/code/tools.js
msgid "Show in Favorites"
msgstr "Показать в избранном"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icon:"
msgstr "Значок:"
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Open icon chooser dialog"
msgid "Choose..."
msgstr "Выбрать..."
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Reset icon to default"
msgid "Clear Icon"
msgstr "Удалить значок"
#: ../contents/ui/ConfigGeneral.qml
msgid "Menu position"
msgstr "Позиция меню"
#: ../contents/ui/ConfigGeneral.qml
msgid "Default"
msgstr "По умолчанию"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center"
msgstr "Центр"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center bottom"
msgstr "Центр снизу"
#: ../contents/ui/ConfigGeneral.qml
msgid "Expand search to bookmarks, files and emails"
msgstr "Поиск по закладкам, файлам и электронным письмам"
#: ../contents/ui/ConfigGeneral.qml
msgid "Show labels in two lines"
msgstr "Показывать метки в две строки"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of columns (main grid)"
msgstr "Количество столбцов"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of rows (main grid)"
msgstr "Количество строк"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icons smooth"
msgstr "Сглаживание значков"
#: ../contents/ui/ConfigGeneral.qml
msgid "Size of icons"
msgstr "Размер значков"
#: ../contents/ui/Footer.qml
msgid "User Home"
msgstr "Домашний каталог"
#: ../contents/ui/Footer.qml
msgid "System Preferences"
msgstr "Параметры системы"
#: ../contents/ui/Footer.qml
msgid "Lock Screen"
msgstr "Заблокировать"
#: ../contents/ui/Footer.qml
msgid "Leave ..."
msgstr "Выход..."
#: ../contents/ui/main.qml
msgid "Edit Applications…"
msgstr "Изменить Приложения…"
#: ../contents/ui/MenuRepresentation.qml
msgid "Type here to search ..."
msgstr "Введите для поиска"
#: ../contents/ui/MenuRepresentation.qml
msgid "Search results"
msgstr "Результаты поиска"
#: ../contents/ui/MenuRepresentation.qml
msgid "Pinned"
msgstr "Закреплено"
#: ../contents/ui/MenuRepresentation.qml
msgid "All apps"
msgstr "Все приложения"
#: ../contents/ui/MenuRepresentation.qml
msgid "Recommended"
msgstr "Рекомендуемое"
#: ../contents/ui/MenuRepresentation.qml
msgid "Back"
msgstr "Назад"
#: ../contents/ui/MenuRepresentation.qml
msgid "More"
msgstr "Еще"

View File

@ -0,0 +1,152 @@
# Translation of OnzeMenu in LANGUAGE
# Copyright (C) 2023
# This file is distributed under the same license as the OnzeMenu package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: OnzeMenu\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-02 23:21-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../metadata.desktop
msgid "OnzeMenu 11"
msgstr ""
#: ../metadata.desktop
msgid "A configurable launcher menu 11"
msgstr ""
#: ../contents/config/config.qml
msgid "General"
msgstr ""
#: ../contents/ui/code/tools.js
msgid "Remove from Favorites"
msgstr ""
#: ../contents/ui/code/tools.js
msgid "Add to Favorites"
msgstr ""
#: ../contents/ui/code/tools.js
msgid "On All Activities"
msgstr ""
#: ../contents/ui/code/tools.js
msgid "On the Current Activity"
msgstr ""
#: ../contents/ui/code/tools.js
msgid "Show in Favorites"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Icon:"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Open icon chooser dialog"
msgid "Choose..."
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Reset icon to default"
msgid "Clear Icon"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Menu position"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Default"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Center"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Center bottom"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Expand search to bookmarks, files and emails"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Show labels in two lines"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of columns (main grid)"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of rows (main grid)"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Icons smooth"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Size of icons"
msgstr ""
#: ../contents/ui/Footer.qml
msgid "User Home"
msgstr ""
#: ../contents/ui/Footer.qml
msgid "System Preferences"
msgstr ""
#: ../contents/ui/Footer.qml
msgid "Lock Screen"
msgstr ""
#: ../contents/ui/Footer.qml
msgid "Leave ..."
msgstr ""
#: ../contents/ui/main.qml
msgid "Edit Applications…"
msgstr ""
#: ../contents/ui/MenuRepresentation.qml
msgid "Type here to search ..."
msgstr ""
#: ../contents/ui/MenuRepresentation.qml
msgid "Search results"
msgstr ""
#: ../contents/ui/MenuRepresentation.qml
msgid "Pinned"
msgstr ""
#: ../contents/ui/MenuRepresentation.qml
msgid "All apps"
msgstr ""
#: ../contents/ui/MenuRepresentation.qml
msgid "Recommended"
msgstr ""
#: ../contents/ui/MenuRepresentation.qml
msgid "Back"
msgstr ""
#: ../contents/ui/MenuRepresentation.qml
msgid "More"
msgstr ""

View File

@ -0,0 +1,153 @@
# Translation of OnzeMenu in tr_TR
# Copyright (C) 2022
# This file is distributed under the same license as the OnzeMenu package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-02 23:21-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Language-Team:\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Language: tr_TR\n"
"X-Source-Language: C\n"
#: ../metadata.desktop
msgid "OnzeMenu 11"
msgstr "OnzeMenu 11"
#: ../metadata.desktop
msgid "A configurable launcher menu 11"
msgstr "Yapılandırılabilir başlatıcı menüsü 11"
#: ../contents/config/config.qml
msgid "General"
msgstr "Genel"
#: ../contents/ui/code/tools.js
msgid "Remove from Favorites"
msgstr "Favorilerden Çıkar"
#: ../contents/ui/code/tools.js
msgid "Add to Favorites"
msgstr "Favorilere Ekle"
#: ../contents/ui/code/tools.js
msgid "On All Activities"
msgstr "Tüm Etkinliklerde"
#: ../contents/ui/code/tools.js
msgid "On the Current Activity"
msgstr "Mevcut Etkinliklerde"
#: ../contents/ui/code/tools.js
msgid "Show in Favorites"
msgstr "Favorilerde Göster"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icon:"
msgstr "Simge:"
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Open icon chooser dialog"
msgid "Choose..."
msgstr "Seçmek..."
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Reset icon to default"
msgid "Clear Icon"
msgstr "Simgeyi Temizle"
#: ../contents/ui/ConfigGeneral.qml
msgid "Menu position"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Default"
msgstr "Varsayılan"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center"
msgstr "Orta"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center bottom"
msgstr "Orta alt"
#: ../contents/ui/ConfigGeneral.qml
msgid "Expand search to bookmarks, files and emails"
msgstr "Aramayı yer imlerine, dosyalara ve e-postalara genişletin"
#: ../contents/ui/ConfigGeneral.qml
msgid "Show labels in two lines"
msgstr "Etiketleri iki satırda göster"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of columns (main grid)"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of rows (main grid)"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Icons smooth"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Size of icons"
msgstr ""
#: ../contents/ui/Footer.qml
msgid "User Home"
msgstr "Kullanıcı Ana Sayfası"
#: ../contents/ui/Footer.qml
msgid "System Preferences"
msgstr "Sistem Tercihleri"
#: ../contents/ui/Footer.qml
msgid "Lock Screen"
msgstr "Kilit Ekranı"
#: ../contents/ui/Footer.qml
msgid "Leave ..."
msgstr "Çıkış ..."
#: ../contents/ui/main.qml
msgid "Edit Applications…"
msgstr "Uygulamaları Düzenle…"
#: ../contents/ui/MenuRepresentation.qml
msgid "Type here to search ..."
msgstr "Aramak için buraya yazınız ..."
#: ../contents/ui/MenuRepresentation.qml
msgid "Search results"
msgstr "Arama Sonuçları"
#: ../contents/ui/MenuRepresentation.qml
msgid "Pinned"
msgstr "Sabitlenmiş"
#: ../contents/ui/MenuRepresentation.qml
msgid "All apps"
msgstr "Tüm uygulamalar"
#: ../contents/ui/MenuRepresentation.qml
msgid "Recommended"
msgstr "Tavsiye edilen"
#: ../contents/ui/MenuRepresentation.qml
msgid "Back"
msgstr "Geri"
#: ../contents/ui/MenuRepresentation.qml
msgid "More"
msgstr "Daha"

View File

@ -0,0 +1,152 @@
# Translation of OnzeMenu in zh_CN
# Copyright (C) 2022
# This file is distributed under the same license as the OnzeMenu package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: OnzeMenu\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-02 23:21-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../metadata.desktop
msgid "OnzeMenu 11"
msgstr ""
#: ../metadata.desktop
msgid "A configurable launcher menu 11"
msgstr "一个可自定义的类Win11开始菜单"
#: ../contents/config/config.qml
msgid "General"
msgstr "通用"
#: ../contents/ui/code/tools.js
msgid "Remove from Favorites"
msgstr "从收藏中移除"
#: ../contents/ui/code/tools.js
msgid "Add to Favorites"
msgstr "加入收藏"
#: ../contents/ui/code/tools.js
msgid "On All Activities"
msgstr "在所有活动中"
#: ../contents/ui/code/tools.js
msgid "On the Current Activity"
msgstr "在当前活动中"
#: ../contents/ui/code/tools.js
msgid "Show in Favorites"
msgstr "在收藏中显示"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icon:"
msgstr "图标:"
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Open icon chooser dialog"
msgid "Choose..."
msgstr "选择..."
#: ../contents/ui/ConfigGeneral.qml
msgctxt "@item:inmenu Reset icon to default"
msgid "Clear Icon"
msgstr "清除图标"
#: ../contents/ui/ConfigGeneral.qml
msgid "Menu position"
msgstr "菜单位置"
#: ../contents/ui/ConfigGeneral.qml
msgid "Default"
msgstr "默认"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center"
msgstr "屏幕中央"
#: ../contents/ui/ConfigGeneral.qml
msgid "Center bottom"
msgstr "底部居中"
#: ../contents/ui/ConfigGeneral.qml
msgid "Expand search to bookmarks, files and emails"
msgstr "扩大搜索范围,包括书签、文件和电子邮件"
#: ../contents/ui/ConfigGeneral.qml
msgid "Show labels in two lines"
msgstr "在两行间显示标签"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of columns (main grid)"
msgstr "主网格列数"
#: ../contents/ui/ConfigGeneral.qml
msgid "Number of rows (main grid)"
msgstr "主网格行数"
#: ../contents/ui/ConfigGeneral.qml
msgid "Icons smooth"
msgstr ""
#: ../contents/ui/ConfigGeneral.qml
msgid "Size of icons"
msgstr "图标大小"
#: ../contents/ui/Footer.qml
msgid "User Home"
msgstr "主目录"
#: ../contents/ui/Footer.qml
msgid "System Preferences"
msgstr "系统设置"
#: ../contents/ui/Footer.qml
msgid "Lock Screen"
msgstr "锁定屏幕"
#: ../contents/ui/Footer.qml
msgid "Leave ..."
msgstr ""
#: ../contents/ui/main.qml
msgid "Edit Applications…"
msgstr "编辑应用程序"
#: ../contents/ui/MenuRepresentation.qml
msgid "Type here to search ..."
msgstr "搜索..."
#: ../contents/ui/MenuRepresentation.qml
msgid "Search results"
msgstr "搜索结果"
#: ../contents/ui/MenuRepresentation.qml
msgid "Pinned"
msgstr "已固定"
#: ../contents/ui/MenuRepresentation.qml
msgid "All apps"
msgstr "所有应用"
#: ../contents/ui/MenuRepresentation.qml
msgid "Recommended"
msgstr "推荐"
#: ../contents/ui/MenuRepresentation.qml
msgid "Back"
msgstr "返回"
#: ../contents/ui/MenuRepresentation.qml
msgid "More"
msgstr "更多"

23
make.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
if [[ "$UID" != 0 ]]; then
echo "USER NOT ROOT"
sudo $0
exit
else
echo "USER IS ROOT"
fi
PWD=$(dirname $0)
THEME_PATH="/usr/share/plasma/plasmoids"
if [[ ! -d "$THEME_PATH" ]];then
mkdir -p "$THEME_PATH"
fi
THEME_NAME="com.github.adhec.OnzeMenuKDE"
rm -rf $THEME_PATH/$THEME_NAME
cp -vrf --remove-destination --no-dereference --preserve=links "$PWD/$THEME_NAME" "$THEME_PATH/"