pax_global_header00006660000000000000000000000064145616071470014525gustar00rootroot0000000000000052 comment=cc4f18322ac0d881c4adb8a2bd3298799e8064db ukui-app-widget-4.0.0.2/000077500000000000000000000000001456160714700147025ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/LICENSE000066400000000000000000001057551456160714700157240ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ukui-app-widget-4.0.0.2/README.md000066400000000000000000000111461456160714700161640ustar00rootroot00000000000000## ukui-app-widget ukui-app-widget是UKUI桌é�¢çŽ¯å¢ƒçš„å°�æ�’件框架, æ�’件用户å�¯ä»¥ä½¿ç”¨å°�æ�’件框架实现桌é�¢çŽ¯å¢ƒå°�æ�’ä»¶UIï¼› ### ä¾�èµ– ------ ### 编译ä¾�èµ– - debhelper-compat - qt5-qmake - qtbase5-dev - qtbase5-dev-tools - qtdeclarative5-dev - qtquickcontrols2-5-dev - libglib2.0-dev - libgsettings-qt-dev - libukui-log4qt-dev ### 编译 ------ ```shell $ cd ukui-app-widget $ mkdir build $ cd build $ qmake .. $ make ``` ### 安装 ------ ```shell $ sudo make install ``` ### 框架组æˆ� - **InProgress** - å°�æ�’件管ç�†æœ�务 - å°�æ�’件使用端 - å°�æ�’ä»¶æ��供端 - **TROUBLE** - æ—  ### SDK组æˆ� - **InProgress** - libukui-appwidget-manager - libukui-appwidget-plugin - libukui-appwidget-provider - AppWidget.qml - **TROUBLE** - æ—  ### 模å�—介ç»� #### 框架 - **管ç�†æœ�务模å�—** å°�æ�’件框架中的å�Žå�°ç®¡ç�†æœ�务,主è¦�æ��ä¾›æ��供端与使用端 的通信能力。 - **使用端** 用于显示å°�æ�’件的应用组件,使用端å�¯ä»¥ä¸�唯一,å°�æ�’件使 用端å�¯ä»¥é€šè¿‡å°�æ�’件框架æ��供的sdk获å�–到对应的å°�æ�’ä»¶ä¿¡æ�¯ 以å�Šui文件。 - **æ��供端** 应用组件作为æ��供端为å°�æ�’ä»¶æœ�务æ��ä¾›å°�æ�’ä»¶ui界é�¢ï¼Œå°�æ�’ä»¶ çš„é…�置信æ�¯ï¼Œå°�æ�’件的更新数æ�®æœ�务。 - **ukui-appwidget-test** å°�æ�’件框架应用的demo ##### SDK - **libukui-appwidget-manager** å°�æ�’件管ç�†æœ�务接å�£SDK,用户å�¯ä»¥é€šè¿‡è¯¥æŽ¥å�£èŽ·å�–到å°�æ�’ä»¶ 的信æ�¯ï¼Œæ��供端å�¯ä»¥é€šè¿‡ç®¡ç�†æœ�务接å�£æŽ¨é€�æ›´æ–°æ•°æ�®ã€‚ - **libukui-appwidget-plugin** å°�装为qmlå�¯ä»¥ä½¿ç”¨çš„内部æ�’件库,由Appwidget.qml控件导入 使用,是qml与å°�æ�’件使用端的通信类,å°�装为点击事件消æ�¯ã€� 自定义事件消æ�¯ã€�使用端注册dbus的接å�£ä»¥å�Šæ•°æ�®æ›´æ–°çš„函数。 - **libukui-appwidget-provider** å°�æ�’ä»¶æ��供端SDK,æ��供端å�¯ä»¥é€šè¿‡ç»§æ‰¿è¯¥ç±»å®žçްæ��供端的æœ�务。 接收由管ç�†æœ�务传æ�¥çš„æ¶ˆæ�¯ã€‚ - **AppWidget.qml** qml控件的å°�装,用于å°�æ�’件实例使用,负责连接qml与内部æ�’ä»¶ 库函数,作为中间控件实现å°�æ�’件实例与使用端的通信。 ### 接å�£ä½¿ç”¨ #### 使用端接å�£ - **获å�–å°�æ�’件列表** QStringList getAppWidgetList(); 功能说明:获å�–å�¯åŠ è½½çš„å°�æ�’件列表(列表形å¼�如:("clock", "search"),列表内容为å°�æ�’ä»¶å��字)。 - **获å�–å°�æ�’ä»¶ui文件路径** QString getAppWidgetUiFile(const QString &appwidgetname); 功能说明:通过å°�æ�’ä»¶å��字获å�–å°�æ�’ä»¶qml ui布局文件(ui路径如:"/usr/share/appwidget/qml/search.qml") - **获å�–å°�æ�’ä»¶çš„config属性** QString getAppWidgetConfig(const QString &appwidgetname,const AppWidgetConfig& config) 功能说明:通过å°�æ�’ä»¶å��称,以å�Šå°�æ�’件的属性config获å�–å°�æ�’ä»¶çš„é…�置信æ�¯ - **获å�–å°�æ�’件的所有属性** QMap getAppWidgetConfigs(const QString &appwidgetname); 功能说明:用于一次性获å�–å°�æ�’件的所有é…�置信æ�¯ - **更新使用端状æ€�** void updateUserStatus(const QString &username, const UserStatus& userstatus); 功能说明:用于使用端通知å°�æ�’件使用端状æ€� - **使用端注册å°�æ�’ä»¶** register(QString appname, QString usrname); 功能说明:用户使用端qml界é�¢æ³¨å†Œå°�æ�’件,在使用端加载å°�æ�’件时调用 #### æ��供端接å�£ 创建æ��供端类,该类需è¦�继承KAppWidgetProviderç±» - **å°�æ�’件自定义事件** void appWidgetRecevie(const QString &eventname, const QString &widgetname, const QDBusVariant &value); 功能说明:用于å“�应å°�æ�’ä»¶qml中å�‘é€�的自定义事件 - **å°�æ�’件更新函数** void appWidgetUpdate(); 功能说明:用于å“�应由管ç�†æœ�务å�‘é€�æ�¥çš„æ›´æ–°é€šçŸ¥ - **å°�æ�’ä»¶ç¦�用函数** void appWidgetDisable(); 功能说明:用于å“�应由管ç�†æœ�务å�‘é€�æ�¥çš„å°�æ�’ä»¶ç¦�用通知(当该æ��供端的所有å°�æ�’件都被移除å�Žå�‘é€�) - **å°�æ�’件删除函数** void appWidgetDeleted(); 功能说明:用于å“�应由管ç�†æœ�务å�‘é€�æ�¥çš„使用端å°�æ�’件删除通知 - **å°�æ�’ä»¶å�¯ç”¨å‡½æ•°** void appWidgetEnable(); 功能说明:用于å“�应由管ç�†æœ�务å�‘é€�æ�¥çš„å°�æ�’件通知(当该æ��供端的å°�æ�’件第一次被添加时å�‘é€�) - **å°�æ�’件点击函数** void appWidgetClicked(const QString &widgetname, const QDBusVariant &value); 功能说明:用于å“�应由管ç�†æœ�务å�‘é€�æ�¥çš„å°�æ�’件点击事件通知 ukui-app-widget-4.0.0.2/libukui-app-widget/000077500000000000000000000000001456160714700204055ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-app-widget.pro000066400000000000000000000006571456160714700246420ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS += \ libukui-appwidget-plugin \ libukui-appwidget-manager \ libukui-appwidget-provider #编译ä¾�赖顺åº� libukui-appwidget-plugin.depends += libukui-appwidget-manager unix { installPath = $$[QT_INSTALL_LIBS]/qt5/qml/org/ukui/appwidget/ # installPath = /usr/share/appwidget/qml/ template.files = org.ukui.appwidget/* template.path = $$installPath INSTALLS += template } ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-manager/000077500000000000000000000000001456160714700254435ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-manager/kappwidgetmanager.cpp000066400000000000000000000204241456160714700316430ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "kappwidgetmanager.h" #include #include #include #include #include namespace AppWidget { KAppWidgetManager::KAppWidgetManager(QObject *parent) :QDBusInterface(KAppWidgetCommon::getManagerDbusObject(), KAppWidgetCommon::getManagerDbusPath(), KAppWidgetCommon::getManagerDbusInterface(),QDBusConnection::sessionBus(),parent) { qDBusRegisterMetaType>(); } QStringList KAppWidgetManager::getAppWidgetList() { qDebug() << "KAppWidgetManager::getAppWidgetList"; QStringList appWidgetList; QDBusMessage response = call("getAppWidgetList"); if (response.type() == QDBusMessage::ErrorMessage ) { qCritical() << "ERROR" << response.errorMessage(); return QStringList(); } if (response.type() == QDBusMessage::ReplyMessage) { appWidgetList = response.arguments().takeFirst().toStringList(); } return appWidgetList; } QString KAppWidgetManager::getAppWidgetUiFile(const QString &appwidgetname) { qDebug() << "KAppWidgetManager::getAppWidgetUiFile"; if(appwidgetname.isEmpty()) { qWarning() << "parameter is empty"; return QString(); } QString uiFile; QDBusMessage response = call("getAppWidgetUiFile", appwidgetname); if (response.type() == QDBusMessage::ErrorMessage ) { qCritical() << "ERROR" << response.errorMessage(); return QString(); } if (response.type() == QDBusMessage::ReplyMessage) { uiFile = response.arguments().takeFirst().toString(); } return uiFile; } QString KAppWidgetManager::getAppWidgetConfig(const QString &appwidgetname, const AppWidgetConfig& config) { qDebug() << "KAppWidgetManager::getAppWidgetConfig"; if(appwidgetname.isEmpty()) { qWarning() << "parameter is empty"; return QString(); } QString uiFile; QDBusMessage response = call("getAppWidgetConfig", appwidgetname, enumToSTring(config)); if (response.type() == QDBusMessage::ErrorMessage ) { qCritical() << "ERROR" << response.errorMessage(); return QString(); } if (response.type() == QDBusMessage::ReplyMessage) { uiFile = response.arguments().takeFirst().toString(); } return uiFile; } QMap KAppWidgetManager::getAppWidgetConfigs(const QString &appwidgetname) { qDebug() << "KAppWidgetManager::getAppWidgetConfigs"; if(appwidgetname.isEmpty()) { qWarning() << "parameter is empty"; return QMap(); } QMap confs; QDBusPendingReply> reply = call("getAppWidgetConfigs", appwidgetname); confs =reply.value(); return confs; } int KAppWidgetManager::registerAppWidget(const QString &appwidgetname, const QString &username) { qDebug() << "KAppWidgetManager::registerAppWidget"; if(appwidgetname.isEmpty() || username.isEmpty()) { qWarning() << "parameter is empty"; return -1; } int id = -1; QDBusMessage response = call("registerAppWidget", appwidgetname, username); if (response.type() == QDBusMessage::ErrorMessage ) { qCritical() << "ERROR" << response.errorMessage(); return -1; } if (response.type() == QDBusMessage::ReplyMessage) { id = response.arguments().takeFirst().toInt(); } return id; } bool KAppWidgetManager::unregisterAppWidget(const int &appwidgetid) { qDebug() << "KAppWidgetManager::unregisterAppWidget"; if(appwidgetid < 0) { qWarning() << "parameter is error"; return false; } bool unregister = false; QDBusMessage response = call("unregisterAppWidget", appwidgetid); if (response.type() == QDBusMessage::ErrorMessage ) { qCritical() << __FUNCTION__ << __LINE__ << response.errorMessage(); return false; } if (response.type() == QDBusMessage::ReplyMessage) { unregister = response.arguments().takeFirst().toBool(); } return unregister; } QMap KAppWidgetManager::getAppWidgetData(const int &appwidgetid) { qDebug() << "KAppWidgetManager::getAppWidgetData"; if(appwidgetid < 0) { qWarning() << __FUNCTION__ << __LINE__ << "get invalid id :" << appwidgetid; return QMap(); } QDBusPendingReply> reply = asyncCall("getAppWidgetData", appwidgetid); reply.waitForFinished(); if (reply.isError()) { qDebug() << __FUNCTION__ << __LINE__ << reply.error().message(); return QMap(); } QMap map = reply.value(); return map; } void KAppWidgetManager::updateAppWidget(const QString &providername, const QMap &data) { qDebug() << "KAppWidgetManager::updateAppWidget" << providername << data; if(providername.isEmpty()) { qWarning() << "parameter is empty"; return ; } asyncCall("updateAppWidget", providername, data); } QString KAppWidgetManager::enumToSTring(const AppWidgetConfig& config) { QString conf; switch (config) { case AppWidgetConfig::NAME: conf = "name"; break; case AppWidgetConfig::PROVIDER_NAME: conf = "providerName"; break; case AppWidgetConfig::PREVIEW_PATH: conf = "previewPath"; break; case AppWidgetConfig::ZOOM: conf = "zoom"; break; case AppWidgetConfig::RIGHT_BUTTON: conf = "rightButton"; break; case AppWidgetConfig::REPEAT_PLACEMENT: conf = "repeatPlacement"; break; case AppWidgetConfig::MIN_WIDTH: conf = "minWidget"; break; case AppWidgetConfig::MIN_HEIGHT: conf = "minHeight"; break; case AppWidgetConfig::TARGET_CELL_WIDTH: conf = "targetCellWidth"; break; case AppWidgetConfig::TARGET_CELL_HEIGHT: conf = "targetCellHeight"; break; case AppWidgetConfig::UPDATE_PERIODMILLIS: conf = "updatePeriodMillis"; break; case AppWidgetConfig::DESCRIBE: conf = "describe"; break; default: break; } return conf; } QString KAppWidgetManager::enumUserStatusToSTring(const UserStatus& userstatus) { QString status = "Normal"; switch (userstatus) { case UserStatus::NORMAL: status = "Normal"; break; case UserStatus::EDITABLE: status = "Editable"; break; default: break; } return status; } void KAppWidgetManager::updateUserStatus(const QString &username, const UserStatus& userstatus) { if(username.isEmpty()) { qWarning() << __FUNCTION__ << __LINE__ << "å�‚æ•°ä¸�能为空"; return; } QString status = enumUserStatusToSTring(userstatus); asyncCall("updateUserStatus", username, status); } void KAppWidgetManager::notifyProviderUpdate(int id) { asyncCall("notifyProviderUpdate", id); } QMap KAppWidgetManager::getAppWidgetLanguageFiles(const QString &appwidgetname) { if(appwidgetname.isEmpty()) { qWarning() << __FILE__ << __FUNCTION__ << "appwidgetname is empty"; return QMap(); } QDBusReply> reply = call("getAppWidgetLanguageFiles", appwidgetname); if (!reply.isValid()) { qWarning() << __FUNCTION__ << __LINE__ << reply.error(); return QMap(); } return reply.value(); } }// namespace AppWidget ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-manager/kappwidgetmanager.h000066400000000000000000000110301456160714700313010ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef KAPPWIDGETMANAGER_H #define KAPPWIDGETMANAGER_H #include "libukui-appwidget-manager_global.h" #include namespace AppWidget { /** * @defgroup å°�æ�’件管ç�†æœ�务接å�£æ¨¡å�— */ /** * @brief å°�æ�’件属性枚举 */ enum AppWidgetConfig { NAME = 1, //å°�æ�’ä»¶å��å­— PROVIDER_NAME, //æ��供端å�� PREVIEW_PATH, //预览图 ZOOM, //是å�¦æ”¯æŒ�缩放 RIGHT_BUTTON, //是å�¦æ”¯æŒ�å�³é”® REPEAT_PLACEMENT, //是å�¦å�¯ä»¥é‡�å¤�放置 MIN_WIDTH, //最å°�宽度 MIN_HEIGHT, //最å°�高度 TARGET_CELL_WIDTH, //å°�æ�’件默认宽度所å� å±�幕的å�•ä½�格数 TARGET_CELL_HEIGHT, //å°�æ�’件默认高度所å� å±�幕的å�•ä½�格数 UPDATE_PERIODMILLIS, //是å�¦å®šæ—¶æ›´æ–° DESCRIBE, //å°�æ�’ä»¶æ��è¿° }; /** * @brief 使用端状æ€�属性枚举 */ enum UserStatus { NORMAL = 1, //正常状æ€� EDITABLE = 2, //编辑状æ€� }; class LIBUKUIAPPWIDGETMANAGER_EXPORT KAppWidgetManager : public QDBusInterface { Q_OBJECT public: KAppWidgetManager(QObject *parent = nullptr); static KAppWidgetManager* getInstance() { static KAppWidgetManager s_instance; return &s_instance; } /** * @brief 获å�–å°�æ�’件列表 * @return app widget list */ QStringList getAppWidgetList(); /** * @brief 获å�–å°�æ�’ä»¶ui文件路径 * @param appwidgetname * @return path of ui file */ QString getAppWidgetUiFile(const QString &appwidgetname); /** * @brief 获å�–å°�æ�’ä»¶çš„config属性 * @param appwidgetname config * @return config value of appwidgetname */ QString getAppWidgetConfig(const QString &appwidgetname, const AppWidgetConfig& config); /** * @brief 获å�–å°�æ�’件的所有属性 * @param appwidgetname * @return config list of widget */ QMap getAppWidgetConfigs(const QString &appwidgetname); /** * @brief 注册å°�æ�’ä»¶ * @param appwidgetname username * @return appwidget id */ int registerAppWidget(const QString &appwidgetname, const QString &username); /** * @brief 注销å°�æ�’ä»¶ * @param appwidgetid * @return unregister success return true, else false */ bool unregisterAppWidget(const int &appwidgetid); /** * @brief 获å�–å°�æ�’件共享数æ�® * @param appwidgetid * @return data from provider */ QMap getAppWidgetData(const int &appwidgetid); /** * @brief æ›´æ–°å°�æ�’件共享数æ�® * @param providername data */ void updateAppWidget(const QString &providername, const QMap &data); /** *@brief 更新使用端状æ€� *@param username userstatus * */ void updateUserStatus(const QString &username, const UserStatus& userstatus); void notifyProviderUpdate(int id); QMap getAppWidgetLanguageFiles(const QString &appwidgetname); signals: /** * @brief å°�æ�’件资æº�文件增加信å�· * @param appwidget name */ void appWidgetAdded(QString appwidgetname); /** * @brief å°�æ�’件资æº�文件删除信å�· * @param appwidget name */ void appWidgetDeleted (QString appwidgetname); private: /** * @brief 转æ�¢AppWidgetConfig枚举为字符串 * @param AppWidgetConfig config * @return config of string */ static QString enumToSTring(const AppWidgetConfig& config); /** * @brief 转æ�¢UserStatus枚举为字符串 * @param UserStatus config * @return config of string */ static QString enumUserStatusToSTring(const UserStatus& userstatus); }; }// namespace AppWidget #endif // KAPPWIDGETMANAGER_H ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-manager/libukui-appwidget-manager.pro000066400000000000000000000021601456160714700332220ustar00rootroot00000000000000QT -= gui QT += dbus TEMPLATE = lib DEFINES += LIBUKUIAPPWIDGETMANAGER_LIBRARY TARGET = ukui-appwidget-manager VERSION = 0.0.0 CONFIG += c++11 # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS include(../../libukui-appwidget-common/libukui-appwidget-common.pri) # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ kappwidgetmanager.cpp HEADERS += \ libukui-appwidget-manager_global.h \ kappwidgetmanager.h # Default rules for deployment. unix { target.path = /usr/lib apifile.files = *.h apifile.path = /usr/include/ukui/ } !isEmpty(target.path): INSTALLS += target apifile libukui-appwidget-manager_global.h000066400000000000000000000020601456160714700341110ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-manager/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef LIBUKUIAPPWIDGETMANAGER_GLOBAL_H #define LIBUKUIAPPWIDGETMANAGER_GLOBAL_H #include #if defined(LIBUKUIAPPWIDGETMANAGER_LIBRARY) # define LIBUKUIAPPWIDGETMANAGER_EXPORT Q_DECL_EXPORT #else # define LIBUKUIAPPWIDGETMANAGER_EXPORT Q_DECL_IMPORT #endif #endif // LIBUKUIAPPWIDGETMANAGER_GLOBAL_H ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-plugin/000077500000000000000000000000001456160714700253275ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-plugin/kappwidgetconnect.cpp000066400000000000000000000134051456160714700315470ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "kappwidgetconnect.h" #include #include #include #include #include using namespace AppWidget; KAppWidgetConnect::KAppWidgetConnect(QObject *parent) : QObject(parent) { } KAppWidgetConnect::~KAppWidgetConnect() { KAppWidgetManager::getInstance()->unregisterAppWidget(m_id); if(m_gsettingmap.count() > 0) { qDeleteAll(m_gsettingmap); m_gsettingmap.clear(); } } void KAppWidgetConnect::onClickedEvent(const QString &widgetname, const QVariant &value) { qDebug() << __FILE__ << __FUNCTION__ << widgetname << " send clicked signal"; QDBusVariant variant; variant.setVariant(value); Q_EMIT clickedSignal(widgetname, variant); } void KAppWidgetConnect::onDefineEvent(const QString &eventname, const QString &widgetname, const QVariant &value) { qDebug() << __FILE__ << __FUNCTION__ << widgetname << "Send DefineEvent Signal" << value; QDBusVariant variant; variant.setVariant(value); Q_EMIT defineEventSignal(eventname, widgetname, variant); } void KAppWidgetConnect::registerAppWidget(const QString &appname, const QString &username) { initConnToManager(appname, username); registerAppWidgetDbus(username); KAppWidgetManager::getInstance()->notifyProviderUpdate(m_id); } void KAppWidgetConnect::initConnToManager(const QString &appname, const QString &username) { qDebug() << __FILE__ << __FUNCTION__ << "Register Appwidget Service: " << username << "," << appname; m_appname = appname; m_username = username; m_id = KAppWidgetManager::getInstance()->registerAppWidget(m_appname, m_username); updateAppWidget(); } void KAppWidgetConnect::registerAppWidgetDbus(const QString &username) { if (m_id == -1) { qCritical() << __FILE__ << __FUNCTION__ << "Init AppWidget Id Error: id = " << m_id; } QString object = KAppWidgetCommon::getAppWidgetDbusObject(username, m_id); QString objectpath = KAppWidgetCommon::getAppWidgetDbusPath(username, m_id); QDBusConnection sessionBus = QDBusConnection::sessionBus(); if (sessionBus.registerService(object)) { qDebug() << "Regist Dbus Service success"; sessionBus.registerObject(objectpath, this, QDBusConnection :: ExportAllSlots | QDBusConnection :: ExportAllSignals | QDBusConnection::ExportAllInvokables); } else { qCritical() << "Register DBus Service Error:" << sessionBus.lastError().message(); } } QMap KAppWidgetConnect::getData() { QMap reply = KAppWidgetManager::getInstance()->getAppWidgetData(m_id); qDebug() << __FILE__ << __FUNCTION__ << ": " << reply; return reply; } void KAppWidgetConnect::updateAppWidget() { Q_EMIT updatesignal(); } void KAppWidgetConnect::updateUserStatus(const QString &status) { Q_EMIT userStatusChanged(status); } bool KAppWidgetConnect::creatGsetting(const QString &gsetting) { if(gsetting.isEmpty()) { qWarning() << __FILE__ << __FUNCTION__ << "parameter is null"; return false; } if(m_gsettingmap.contains(gsetting)) { qWarning() << __FILE__ << __FUNCTION__ << gsetting << " gsetting isalready exists"; return false; } QByteArray id(gsetting.toLatin1()); if(QGSettings::isSchemaInstalled(id)) { QGSettings *gsettings = new QGSettings(id); m_gsettingmap.insert(gsetting, gsettings); connect(gsettings, &QGSettings::changed, [ = ](const QString & key) { qDebug() << "gsettings changed" << key; emit gsettingChanged(key, gsettings->get(key)); }); return true; } else { qDebug() << __FILE__ << __FUNCTION__ << gsetting << " gsetting is not install"; return false; } return true; } bool KAppWidgetConnect::deleteGsetting(const QString &gsetting) { if(gsetting.isEmpty()) { qWarning() << __FILE__ << __FUNCTION__ << "parameter is null"; return false; } if(!m_gsettingmap.contains(gsetting)) { qWarning() << __FILE__ << __FUNCTION__ << gsetting << " gsetting is not exists"; return false; } QGSettings *gsettings = m_gsettingmap.value(gsetting); gsettings->disconnect(); gsettings->deleteLater(); m_gsettingmap.remove(gsetting); return true; } QVariant KAppWidgetConnect::getGsettingValue(const QString &gsetting , const QString &key) { if(gsetting.isEmpty()) { qWarning() << __FILE__ << __FUNCTION__ << "first parameter is null"; return QVariant(); } if(key.isEmpty()) { qWarning() << __FILE__ << __FUNCTION__ << "second parameter is null"; return QVariant(); } QVariant value; QByteArray id(gsetting.toLatin1()); if(QGSettings::isSchemaInstalled(id)) { QGSettings *gsettings = new QGSettings(id); value = gsettings->get(key); gsettings->deleteLater(); }else { qWarning() << __FILE__ << __FUNCTION__ << gsetting << " gsetting is uninstall"; } return value; } ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-plugin/kappwidgetconnect.h000066400000000000000000000047671456160714700312270ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef KAPPWIDGETCOMMUNICATION_H #define KAPPWIDGETCOMMUNICATION_H #include #include class QGSettings; namespace AppWidget { class KAppWidgetManager; class KAppWidgetConnect : public QObject { Q_OBJECT public: Q_CLASSINFO("D-Bus Interface", "org.ukui.appwidget") explicit KAppWidgetConnect(QObject *parent = nullptr); ~KAppWidgetConnect(); Q_INVOKABLE QMap getData(); Q_INVOKABLE bool creatGsetting(const QString &gsetting); Q_INVOKABLE bool deleteGsetting(const QString &gsetting); Q_INVOKABLE QVariant getGsettingValue(const QString &gsetting , const QString &key); Q_INVOKABLE void registerAppWidget(const QString &appname, const QString &username); signals: void clickedSignal(const QString &widgetname, const QDBusVariant &value); void defineEventSignal(const QString &eventname, const QString &widgetname, const QDBusVariant &value); void updatesignal(); void gsettingChanged(const QString &key, const QVariant &value); void userStatusChanged(const QString &status); public slots: void onClickedEvent(const QString &widgetname, const QVariant &value); void onDefineEvent(const QString &eventname, const QString &widgetname, const QVariant &value); void updateAppWidget(); void updateUserStatus(const QString &status); private: void initConnToManager(const QString &appname, const QString &username); void registerAppWidgetDbus(const QString &username); QString m_appname; QString m_username; int m_id = -1; /** * @brief gsettings容器,QMap键值对说明<生æˆ�çš„QGSettingsçš„schema_id, 生æˆ�çš„QGSettings *对象> */ QMap m_gsettingmap; }; } // namespace AppWidget #endif // KAPPWIDGETCOMMUNICATION_H ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-plugin/kappwidgetplugin.cpp000066400000000000000000000022441456160714700314130ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "kappwidgetplugin.h" #include #include "kappwidgetconnect.h" #include "translatorhelper.h" void KAppWidgetPlugin::registerTypes(const char *uri) { Q_ASSERT(QLatin1String(uri) == QLatin1String("org.ukui.appwidget.private")); // @uri org.ukui.appwidget.private qmlRegisterType(uri, 1, 0, "Connection"); qmlRegisterType(uri, 1, 0, "Translator"); } ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-plugin/kappwidgetplugin.h000066400000000000000000000020551456160714700310600ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef LIBUKUIAPPWIDGET_PLUGIN_H #define LIBUKUIAPPWIDGET_PLUGIN_H #include class KAppWidgetPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: void registerTypes(const char *uri) override; }; #endif // LIBUKUIAPPWIDGET_PLUGIN_H ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-plugin/libukui-appwidget-plugin.pro000066400000000000000000000023211456160714700327710ustar00rootroot00000000000000TEMPLATE = lib TARGET = ukui-appwidget-plugin VERSION = 0.0.0 QT += qml quick dbus CONFIG += plugin c++11 link_pkgconfig PKGCONFIG += gsettings-qt LIBS +=-L../libukui-appwidget-manager/ -lukui-appwidget-manager INCLUDEPATH += ../libukui-appwidget-manager/ DEPENDPATH += ../libukui-appwidget-manager/ TARGET = $$qtLibraryTarget($$TARGET) uri = org.ukui.appwidget.private include(../../libukui-appwidget-common/libukui-appwidget-common.pri) # Input SOURCES += \ kappwidgetconnect.cpp \ kappwidgetplugin.cpp \ translatorhelper.cpp HEADERS += \ kappwidgetconnect.h \ kappwidgetplugin.h \ translatorhelper.h DISTFILES = qmldir !equals(_PRO_FILE_PWD_, $$OUT_PWD) { copy_qmldir.target = $$OUT_PWD/qmldir copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir copy_qmldir.commands = $(COPY_FILE) "$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)" "$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)" QMAKE_EXTRA_TARGETS += copy_qmldir PRE_TARGETDEPS += $$copy_qmldir.target } qmldir.files = qmldir unix { installPath = $$[QT_INSTALL_LIBS]/qt5/qml/org/ukui/appwidget/private qmldir.path = $$installPath target.path = $$installPath INSTALLS += target qmldir } ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-plugin/qmldir000066400000000000000000000000771456160714700265460ustar00rootroot00000000000000module org.ukui.appwidget.private plugin ukui-appwidget-plugin ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-plugin/translatorhelper.cpp000066400000000000000000000025471456160714700314340ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "translatorhelper.h" #include #include #include #include using namespace AppWidget; TranslatorHelper::TranslatorHelper(QObject *parent) : QObject(parent) { } void TranslatorHelper::installTranslators(const QString &appname) { QTranslator* translator = new QTranslator(this); QString key = QLocale::system().name(); QMap languageFiles = KAppWidgetManager::getInstance()->getAppWidgetLanguageFiles(appname); QString qmFile = languageFiles.value(key); translator->load(qmFile); qApp->installTranslator(translator); } ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-plugin/translatorhelper.h000066400000000000000000000021751456160714700310760ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef TRANSLATORHELPER_H #define TRANSLATORHELPER_H #include namespace AppWidget { class KAppWidgetManager; class TranslatorHelper : public QObject { Q_OBJECT public: explicit TranslatorHelper(QObject *parent = nullptr); ~TranslatorHelper() = default; Q_INVOKABLE void installTranslators(const QString &appname); }; } //namespace AppWidget #endif // TRANSLATORHELPER_H ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-provider/000077500000000000000000000000001456160714700256635ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-provider/kappwidgetprovider.cpp000066400000000000000000000050761456160714700323110ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "kappwidgetprovider.h" #include #include #include #include namespace AppWidget { KAppWidgetProvider::KAppWidgetProvider(QString providername, QObject *parent): QObject(parent) { if(providername.isEmpty()) { qWarning() << "providername isEmpty!"; return; } QString servicename = KAppWidgetCommon::getProviderDbusObject(providername); QString objectpath = KAppWidgetCommon::getProviderDbusPath(providername); QString objectinterface = KAppWidgetCommon::getProviderDbusInterface(providername); QDBusConnection connection = QDBusConnection::sessionBus(); if (connection.registerService(servicename)) { connection.registerObject(objectpath, objectinterface, this, QDBusConnection::ExportAllSlots); qDebug() << "Regist Dbus Service success"; }else { qCritical() << "Register DBus Service Error:" << connection.lastError().message(); } } void KAppWidgetProvider::appWidgetRecevie(const QString &eventname, const QString &widgetname, const QDBusVariant &value) { Q_UNUSED(eventname); Q_UNUSED(widgetname); Q_UNUSED(value); qDebug() << "KAppWidgetProvider::appWidgetRecevie"; } void KAppWidgetProvider::appWidgetUpdate() { qDebug() << "KAppWidgetProvider::appWidgetUpdate"; } void KAppWidgetProvider::appWidgetDisable() { qDebug() << "KAppWidgetProvider::appWidgetDisable"; } void KAppWidgetProvider::appWidgetDeleted() { qDebug() << "KAppWidgetProvider::appWidgetDeleted"; } void KAppWidgetProvider::appWidgetEnable() { qDebug() << "KAppWidgetProvider::appWidgetEnable"; } void KAppWidgetProvider::appWidgetClicked(const QString &widgetname, const QDBusVariant &value) { Q_UNUSED(widgetname); Q_UNUSED(value); qDebug() << "KAppWidgetProvider::appWidgetClicked"; } }// namespace AppWidget ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-provider/kappwidgetprovider.h000066400000000000000000000035271456160714700317550ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef KAPPWIDGETPROVIDER_H #define KAPPWIDGETPROVIDER_H #include "libukui-appwidget-provider_global.h" #include class QDBusVariant; namespace AppWidget { /** @defgroup å°�æ�’ä»¶æ��供端模å�— * @{ */ class LIBUKUIAPPWIDGETPROVIDER_EXPORT KAppWidgetProvider : public QObject { Q_OBJECT public: KAppWidgetProvider(QString providername, QObject *parent = nullptr) ; public slots: /** * @brief å°�æ�’件自定义事件 */ virtual void appWidgetRecevie(const QString &eventname, const QString &widgetname, const QDBusVariant &value); /** * @brief å°�æ�’件更新函数 */ virtual void appWidgetUpdate(); /** * @brief å°�æ�’ä»¶ç¦�用函数 */ virtual void appWidgetDisable(); /** * @brief å°�æ�’件删除函数 */ virtual void appWidgetDeleted(); /** * @brief å°�æ�’ä»¶å�¯ç”¨å‡½æ•° */ virtual void appWidgetEnable(); /** * @brief å°�æ�’件点击函数 */ virtual void appWidgetClicked(const QString &widgetname, const QDBusVariant &value); }; }// namespace AppWidget #endif // KAPPWIDGETPROVIDER_H ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-provider/libukui-appwidget-provider.pro000066400000000000000000000021701456160714700336630ustar00rootroot00000000000000QT -= gui QT += dbus TEMPLATE = lib DEFINES += LIBUKUIAPPWIDGETPROVIDER_LIBRARY TARGET = ukui-appwidget-provider VERSION = 0.0.0 CONFIG += c++11 # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 include(../../libukui-appwidget-common/libukui-appwidget-common.pri) SOURCES += \ kappwidgetprovider.cpp HEADERS += \ libukui-appwidget-provider_global.h \ kappwidgetprovider.h # Default rules for deployment. unix { target.path = /usr/lib apifile.files = *.h apifile.path = /usr/include/ukui/ } !isEmpty(target.path): INSTALLS += target apifile libukui-appwidget-provider_global.h000066400000000000000000000020661456160714700345570ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/libukui-app-widget/libukui-appwidget-provider/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef LIBUKUIAPPWIDGETPROVIDER_GLOBAL_H #define LIBUKUIAPPWIDGETPROVIDER_GLOBAL_H #include #if defined(LIBUKUIAPPWIDGETPROVIDER_LIBRARY) # define LIBUKUIAPPWIDGETPROVIDER_EXPORT Q_DECL_EXPORT #else # define LIBUKUIAPPWIDGETPROVIDER_EXPORT Q_DECL_IMPORT #endif #endif // LIBUKUIAPPWIDGETPROVIDER_GLOBAL_H ukui-app-widget-4.0.0.2/libukui-app-widget/org.ukui.appwidget/000077500000000000000000000000001456160714700241335ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/libukui-app-widget/org.ukui.appwidget/AppWidget.qml000066400000000000000000000065531456160714700265430ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ import QtQuick 2.0 import org.ukui.appwidget.private 1.0 as UKUIAppWidget Item { id:controlroot UKUIAppWidget.Connection { id:appwidget } UKUIAppWidget.Translator { id:translator } signal qmldefineeventchangedsignal(string eventname, string widgetname, var value); signal qmlclickedsignal(string widgetname, var value); signal update(); signal gsettingUpdate(string key, var value); /* @deprecated 此信å�·æŽ¥å�£ä¼šåœ¨åº”用å�Œæ­¥å�Žå¼ƒç”¨ */ signal userStatusChangedSignal(string status); property string appname property string username property var datavalue property string userstatus: "Normal" onAppnameChanged: { translator.installTranslators(appname) } onUserstatusChanged: { userStatusChangedSignal(userstatus) } Component.onCompleted: { appwidget.updatesignal.connect(controlroot.qmlUpdate) qmlclickedsignal.connect(appwidget.onClickedEvent) qmldefineeventchangedsignal.connect(appwidget.onDefineEvent) appwidget.gsettingChanged.connect(controlroot.gsettingChanged) appwidget.userStatusChanged.connect(controlroot.setUserStatus) } function qmlUpdate() { datavalue = appwidget.getData(); update(); } function register(appname, username) { appwidget.registerAppWidget(appname, username); console.log(" QML AppWidget register dbus"); } function creatGsetting(gsettingname) { console.log(" QML AppWidget creatGsetting", gsettingname); if(appwidget.creatGsetting(gsettingname)) { console.log(" QML AppWidget register gsetting successful"); }else { console.log(" QML AppWidget register gsetting fail"); } } function deleteGsetting(gsettingname) { console.log(" QML AppWidget deleteGsetting", gsettingname); if(appwidget.deleteGsetting(gsettingname)) { console.log(" QML AppWidget delete gsetting successful"); }else { console.log(" QML AppWidget delete gsetting fail"); } } function getGsettingValue(gsettingname, key) { console.log(" QML AppWidget getGsettingValue", gsettingname, key, appwidget.getGsettingValue(gsettingname, key)); return appwidget.getGsettingValue(gsettingname, key); } function gsettingChanged(key, value) { console.log(" QML AppWidget gsettingChanged", key,value) gsettingUpdate(key, value); } function setUserStatus(status) { console.log(" QML AppWidget setUserStatus", status, " appname: ", appwidget.appname) userstatus = status } } ukui-app-widget-4.0.0.2/libukui-app-widget/org.ukui.appwidget/qmldir000066400000000000000000000000661456160714700253500ustar00rootroot00000000000000module org.ukui.appwidget AppWidget 1.0 AppWidget.qml ukui-app-widget-4.0.0.2/libukui-appwidget-common/000077500000000000000000000000001456160714700216165ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/libukui-appwidget-common/kappwidgetcommon.cpp000066400000000000000000000053421456160714700256760ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "kappwidgetcommon.h" #include namespace AppWidget { KAppWidgetCommon::KAppWidgetCommon(QObject *parent) : QObject(parent) { } QString KAppWidgetCommon::getProviderDbusObject(const QString &providername) { if(providername.isEmpty()) { qWarning() << "providername isEmpty!"; return QString(); } QString object = QString("org.ukui.appwidget.provider.%1").arg(providername); return object; } QString KAppWidgetCommon::getProviderDbusPath(const QString &providername) { if(providername.isEmpty()) { qWarning() << "providername isEmpty!"; return QString(); } QString objectpath = QString("/org/ukui/appwidget/provider"); return objectpath; } QString KAppWidgetCommon::getProviderDbusInterface(const QString &providername) { if(providername.isEmpty()) { qWarning() << "providername isEmpty!"; return QString(); } QString interface = QString("org.ukui.appwidget.provider.%1").arg(providername); return interface; } QString KAppWidgetCommon::getManagerDbusObject() { QString object = QString("org.ukui.appwidget.manager"); return object; } QString KAppWidgetCommon::getManagerDbusPath() { QString objectpath = QString("/"); return objectpath; } QString KAppWidgetCommon::getManagerDbusInterface() { QString interface = QString("org.ukui.appwidget.manager"); return interface; } QString KAppWidgetCommon::getAppWidgetDbusObject(const QString &username, const int &id) { Q_UNUSED(id); QString object = QString("org.ukui.appwidget.%1").arg(username); return object; } QString KAppWidgetCommon::getAppWidgetDbusPath(const QString &username, const int &id) { Q_UNUSED(username); QString objectpath = QString("/%1").arg(id); return objectpath; } QString KAppWidgetCommon::getAppWidgetDbusInterface(const QString &username, const int &id) { Q_UNUSED(username); Q_UNUSED(id); QString interface = QString("org.ukui.appwidget"); return interface; } }// namespace AppWidget ukui-app-widget-4.0.0.2/libukui-appwidget-common/kappwidgetcommon.h000066400000000000000000000055731456160714700253510ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef KAPPWIDGETCOMMON_H #define KAPPWIDGETCOMMON_H #include "libukui-appwidget-common_global.h" #include namespace AppWidget { /** * @defgroup 公共接å�£æ¨¡å�— */ class LIBUKUIAPPWIDGETCOMMON_EXPORT KAppWidgetCommon : public QObject { Q_OBJECT public: explicit KAppWidgetCommon(QObject *parent = nullptr); /** * @brief 获å�–Providernameçš„æ��供端Dbus Object name * @param providername * @return Provider dbus object name */ static QString getProviderDbusObject(const QString &providername); /** * @brief 获å�–Providernameçš„æ��供端Dbus Path * @param providername * @return Provider dbus path name */ static QString getProviderDbusPath(const QString &providername); /** * @brief 获å�–Providernameçš„æ��供端Dbus Interface * @param providername * @return Provider dbus interface name */ static QString getProviderDbusInterface(const QString &providername); /** * @brief 获å�–Managerçš„æ��供端Dbus Object name * @return Manager dbus object name */ static QString getManagerDbusObject(); /** * @brief 获å�–Managerçš„æ��供端Dbus Path * @return Manager dbus path name */ static QString getManagerDbusPath(); /** * @brief 获å�–Managerçš„æ��供端Dbus Interface * @return Manager dbus interface name */ static QString getManagerDbusInterface(); /** * @brief 获å�–AppWidgetçš„æ��供端Dbus Object name * @param username appwidget`id * @return Widget dbus object name */ static QString getAppWidgetDbusObject(const QString &username, const int &id); /** * @brief 获å�–AppWidgetçš„æ��供端Dbus Object name * @param username appwidget`id * @return Widget dbus path name */ static QString getAppWidgetDbusPath(const QString &username, const int &id); /** * @brief 获å�–AppWidgetçš„æ��供端Dbus Object name * @param username appwidget`id * @return Widget dbus interface name */ static QString getAppWidgetDbusInterface(const QString &username, const int &id); }; }// namespace AppWidget #endif // KAPPWIDGETCOMMON_H ukui-app-widget-4.0.0.2/libukui-appwidget-common/libukui-appwidget-common.pri000066400000000000000000000002461456160714700272500ustar00rootroot00000000000000INCLUDEPATH += $$PWD SOURCES += \ $$PWD/kappwidgetcommon.cpp HEADERS += \ $$PWD/libukui-appwidget-common_global.h \ $$PWD/kappwidgetcommon.h ukui-app-widget-4.0.0.2/libukui-appwidget-common/libukui-appwidget-common_global.h000066400000000000000000000020521456160714700302220ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef LIBUKUIAPPWIDGETCOMMON_GLOBAL_H #define LIBUKUIAPPWIDGETCOMMON_GLOBAL_H #include #if defined(LIBUKUIAPPWIDGETCOMMON_LIBRARY) # define LIBUKUIAPPWIDGETCOMMON_EXPORT Q_DECL_EXPORT #else # define LIBUKUIAPPWIDGETCOMMON_EXPORT Q_DECL_IMPORT #endif #endif // LIBUKUIAPPWIDGETCOMMON_GLOBAL_H ukui-app-widget-4.0.0.2/man/000077500000000000000000000000001456160714700154555ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/man/appwidgetprovider-clock-demo.1000066400000000000000000000037331456160714700233170ustar00rootroot00000000000000.\" ukui-app-widget manual page .\" .\" This is free software; you may 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, .\" or (at your option) any later version. .\" .\" This 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. .\" .TH UKUI-APP-WIDGET 1 "05 Apr 2023" "UKUI Desktop Environment" .\" Please adjust this date whenever revising the manpage. .\" .SH "NAME" ukui-app-widget \- The UKUI Desktop for qml .SH "SYNOPSIS" .B ukui-app-widget [OPTIONS] .SH "DESCRIPTION" ukui-app-widget is a qml appwidget framework. It can display a view for quick browsing, which is mainly to display the most important data and functions of the application. .SH "OPTIONS" .TP \fB\-\-display=DISPLAY\fR X display to use. .TP \fB\-\-no\-daemon\fR Don't start as a daemon .TP \fB\-\-debug\fR Enable debugging messages for \fBukui-screensaver\fP .TP \fB\-\-version\fR Output version information and exit. .TP \fB\-h, \-\-help\fR Print standard command line options. .TP \fB\-\-help\-all\fR Print all command line options. .P This program also accepts the standard GTK options. .SH "BUGS" .SS Should you encounter any bugs, they may be reported at: https://gitee.com/openkylin/ukui-app-widget/issues .SH "AUTHORS" .SS ukui-app-widget is maintained by: .nf Yan Wang .fi .SS This Man Page has been updated for the UKUI Desktop Environment by: Yan Wang (2023) .SH "SEE ALSO" .SS Further information may also be available at: http://wiki.ukui-desktop.org/docs .P .BR gtk-options (7) ukui-app-widget-4.0.0.2/man/appwidgetprovider-clock-service.1000066400000000000000000000037331456160714700240330ustar00rootroot00000000000000.\" ukui-app-widget manual page .\" .\" This is free software; you may 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, .\" or (at your option) any later version. .\" .\" This 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. .\" .TH UKUI-APP-WIDGET 1 "05 Apr 2023" "UKUI Desktop Environment" .\" Please adjust this date whenever revising the manpage. .\" .SH "NAME" ukui-app-widget \- The UKUI Desktop for qml .SH "SYNOPSIS" .B ukui-app-widget [OPTIONS] .SH "DESCRIPTION" ukui-app-widget is a qml appwidget framework. It can display a view for quick browsing, which is mainly to display the most important data and functions of the application. .SH "OPTIONS" .TP \fB\-\-display=DISPLAY\fR X display to use. .TP \fB\-\-no\-daemon\fR Don't start as a daemon .TP \fB\-\-debug\fR Enable debugging messages for \fBukui-screensaver\fP .TP \fB\-\-version\fR Output version information and exit. .TP \fB\-h, \-\-help\fR Print standard command line options. .TP \fB\-\-help\-all\fR Print all command line options. .P This program also accepts the standard GTK options. .SH "BUGS" .SS Should you encounter any bugs, they may be reported at: https://gitee.com/openkylin/ukui-app-widget/issues .SH "AUTHORS" .SS ukui-app-widget is maintained by: .nf Yan Wang .fi .SS This Man Page has been updated for the UKUI Desktop Environment by: Yan Wang (2023) .SH "SEE ALSO" .SS Further information may also be available at: http://wiki.ukui-desktop.org/docs .P .BR gtk-options (7) ukui-app-widget-4.0.0.2/man/appwidgetprovider-search-demo.1000066400000000000000000000037331456160714700234710ustar00rootroot00000000000000.\" ukui-app-widget manual page .\" .\" This is free software; you may 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, .\" or (at your option) any later version. .\" .\" This 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. .\" .TH UKUI-APP-WIDGET 1 "05 Apr 2023" "UKUI Desktop Environment" .\" Please adjust this date whenever revising the manpage. .\" .SH "NAME" ukui-app-widget \- The UKUI Desktop for qml .SH "SYNOPSIS" .B ukui-app-widget [OPTIONS] .SH "DESCRIPTION" ukui-app-widget is a qml appwidget framework. It can display a view for quick browsing, which is mainly to display the most important data and functions of the application. .SH "OPTIONS" .TP \fB\-\-display=DISPLAY\fR X display to use. .TP \fB\-\-no\-daemon\fR Don't start as a daemon .TP \fB\-\-debug\fR Enable debugging messages for \fBukui-screensaver\fP .TP \fB\-\-version\fR Output version information and exit. .TP \fB\-h, \-\-help\fR Print standard command line options. .TP \fB\-\-help\-all\fR Print all command line options. .P This program also accepts the standard GTK options. .SH "BUGS" .SS Should you encounter any bugs, they may be reported at: https://gitee.com/openkylin/ukui-app-widget/issues .SH "AUTHORS" .SS ukui-app-widget is maintained by: .nf Yan Wang .fi .SS This Man Page has been updated for the UKUI Desktop Environment by: Yan Wang (2023) .SH "SEE ALSO" .SS Further information may also be available at: http://wiki.ukui-desktop.org/docs .P .BR gtk-options (7) ukui-app-widget-4.0.0.2/man/appwidgetuser-demo.1000066400000000000000000000037331456160714700213520ustar00rootroot00000000000000.\" ukui-app-widget manual page .\" .\" This is free software; you may 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, .\" or (at your option) any later version. .\" .\" This 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. .\" .TH UKUI-APP-WIDGET 1 "05 Apr 2023" "UKUI Desktop Environment" .\" Please adjust this date whenever revising the manpage. .\" .SH "NAME" ukui-app-widget \- The UKUI Desktop for qml .SH "SYNOPSIS" .B ukui-app-widget [OPTIONS] .SH "DESCRIPTION" ukui-app-widget is a qml appwidget framework. It can display a view for quick browsing, which is mainly to display the most important data and functions of the application. .SH "OPTIONS" .TP \fB\-\-display=DISPLAY\fR X display to use. .TP \fB\-\-no\-daemon\fR Don't start as a daemon .TP \fB\-\-debug\fR Enable debugging messages for \fBukui-screensaver\fP .TP \fB\-\-version\fR Output version information and exit. .TP \fB\-h, \-\-help\fR Print standard command line options. .TP \fB\-\-help\-all\fR Print all command line options. .P This program also accepts the standard GTK options. .SH "BUGS" .SS Should you encounter any bugs, they may be reported at: https://gitee.com/openkylin/ukui-app-widget/issues .SH "AUTHORS" .SS ukui-app-widget is maintained by: .nf Yan Wang .fi .SS This Man Page has been updated for the UKUI Desktop Environment by: Yan Wang (2023) .SH "SEE ALSO" .SS Further information may also be available at: http://wiki.ukui-desktop.org/docs .P .BR gtk-options (7) ukui-app-widget-4.0.0.2/man/ukui-appwidget-manager.1000066400000000000000000000037331456160714700221140ustar00rootroot00000000000000.\" ukui-app-widget manual page .\" .\" This is free software; you may 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, .\" or (at your option) any later version. .\" .\" This 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. .\" .TH UKUI-APP-WIDGET 1 "05 Apr 2023" "UKUI Desktop Environment" .\" Please adjust this date whenever revising the manpage. .\" .SH "NAME" ukui-app-widget \- The UKUI Desktop for qml .SH "SYNOPSIS" .B ukui-app-widget [OPTIONS] .SH "DESCRIPTION" ukui-app-widget is a qml appwidget framework. It can display a view for quick browsing, which is mainly to display the most important data and functions of the application. .SH "OPTIONS" .TP \fB\-\-display=DISPLAY\fR X display to use. .TP \fB\-\-no\-daemon\fR Don't start as a daemon .TP \fB\-\-debug\fR Enable debugging messages for \fBukui-screensaver\fP .TP \fB\-\-version\fR Output version information and exit. .TP \fB\-h, \-\-help\fR Print standard command line options. .TP \fB\-\-help\-all\fR Print all command line options. .P This program also accepts the standard GTK options. .SH "BUGS" .SS Should you encounter any bugs, they may be reported at: https://gitee.com/openkylin/ukui-app-widget/issues .SH "AUTHORS" .SS ukui-app-widget is maintained by: .nf Yan Wang .fi .SS This Man Page has been updated for the UKUI Desktop Environment by: Yan Wang (2023) .SH "SEE ALSO" .SS Further information may also be available at: http://wiki.ukui-desktop.org/docs .P .BR gtk-options (7) ukui-app-widget-4.0.0.2/ukui-app-widget.pro000066400000000000000000000003271456160714700204420ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS += \ libukui-app-widget \ ukui-appwidget-test \ ukui-appwidget-manager ukui-appwidget-test.depends += libukui-app-widget ukui-appwidget-manager.depends += libukui-app-widget ukui-app-widget-4.0.0.2/ukui-appwidget-manager/000077500000000000000000000000001456160714700212515ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/000077500000000000000000000000001456160714700251635ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/QtLockedFile000066400000000000000000000000321456160714700274070ustar00rootroot00000000000000#include "qtlockedfile.h" ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/QtSingleApplication000066400000000000000000000000411456160714700310130ustar00rootroot00000000000000#include "qtsingleapplication.h" ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/qtlocalpeer.cpp000066400000000000000000000154361456160714700302130ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Solutions component. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qtlocalpeer.h" #include #include #include #if defined(Q_OS_WIN) #include #include typedef BOOL(WINAPI*PProcessIdToSessionId)(DWORD,DWORD*); static PProcessIdToSessionId pProcessIdToSessionId = 0; #endif #if defined(Q_OS_UNIX) #include #include #include #endif namespace QtLP_Private { #include "qtlockedfile.cpp" #if defined(Q_OS_WIN) #include "qtlockedfile_win.cpp" #else #include "qtlockedfile_unix.cpp" #endif } const char* QtLocalPeer::ack = "ack"; QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId) : QObject(parent), id(appId) { QString prefix = id; if (id.isEmpty()) { id = QCoreApplication::applicationFilePath(); #if defined(Q_OS_WIN) id = id.toLower(); #endif prefix = id.section(QLatin1Char('/'), -1); } prefix.remove(QRegExp("[^a-zA-Z]")); prefix.truncate(6); QByteArray idc = id.toUtf8(); quint16 idNum = qChecksum(idc.constData(), idc.size()); socketName = QLatin1String("qtsingleapp-") + prefix + QLatin1Char('-') + QString::number(idNum, 16); #if defined(Q_OS_WIN) if (!pProcessIdToSessionId) { QLibrary lib("kernel32"); pProcessIdToSessionId = (PProcessIdToSessionId)lib.resolve("ProcessIdToSessionId"); } if (pProcessIdToSessionId) { DWORD sessionId = 0; pProcessIdToSessionId(GetCurrentProcessId(), &sessionId); socketName += QLatin1Char('-') + QString::number(sessionId, 16); } #else socketName += QLatin1Char('-') + QString::number(::getuid(), 16); #endif server = new QLocalServer(this); QString lockName = QDir(QDir::tempPath()).absolutePath() + QLatin1Char('/') + socketName + QLatin1String("-lockfile"); lockFile.setFileName(lockName); lockFile.open(QIODevice::ReadWrite); } bool QtLocalPeer::isClient() { if (lockFile.isLocked()) return false; if (!lockFile.lock(QtLP_Private::QtLockedFile::WriteLock, false)) return true; bool res = server->listen(socketName); #if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(4,5,0)) // ### Workaround if (!res && server->serverError() == QAbstractSocket::AddressInUseError) { QFile::remove(QDir::cleanPath(QDir::tempPath())+QLatin1Char('/')+socketName); res = server->listen(socketName); } #endif if (!res) qWarning("QtSingleCoreApplication: listen on local socket failed, %s", qPrintable(server->errorString())); QObject::connect(server, SIGNAL(newConnection()), SLOT(receiveConnection())); return false; } bool QtLocalPeer::sendMessage(const QString &message, int timeout) { if (!isClient()) return false; QLocalSocket socket; bool connOk = false; for(int i = 0; i < 2; i++) { // Try twice, in case the other instance is just starting up socket.connectToServer(socketName); connOk = socket.waitForConnected(timeout/2); if (connOk || i) break; int ms = 250; #if defined(Q_OS_WIN) Sleep(DWORD(ms)); #else struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; nanosleep(&ts, NULL); #endif } if (!connOk) return false; QByteArray uMsg(message.toUtf8()); QDataStream ds(&socket); ds.writeBytes(uMsg.constData(), uMsg.size()); bool res = socket.waitForBytesWritten(timeout); if (res) { res &= socket.waitForReadyRead(timeout); // wait for ack if (res) res &= (socket.read(qstrlen(ack)) == ack); } return res; } void QtLocalPeer::receiveConnection() { QLocalSocket* socket = server->nextPendingConnection(); if (!socket) return; while (true) { if (socket->state() == QLocalSocket::UnconnectedState) { qWarning("QtLocalPeer: Peer disconnected"); delete socket; return; } if (socket->bytesAvailable() >= qint64(sizeof(quint32))) break; socket->waitForReadyRead(); } QDataStream ds(socket); QByteArray uMsg; quint32 remaining; ds >> remaining; uMsg.resize(remaining); int got = 0; char* uMsgBuf = uMsg.data(); do { got = ds.readRawData(uMsgBuf, remaining); remaining -= got; uMsgBuf += got; } while (remaining && got >= 0 && socket->waitForReadyRead(2000)); if (got < 0) { qWarning("QtLocalPeer: Message reception failed %s", socket->errorString().toLatin1().constData()); delete socket; return; } QString message(QString::fromUtf8(uMsg)); socket->write(ack, qstrlen(ack)); socket->waitForBytesWritten(1000); socket->waitForDisconnected(1000); // make sure client reads ack delete socket; Q_EMIT messageReceived(message); //### (might take a long time to return) } ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/qtlocalpeer.h000066400000000000000000000052051456160714700276510ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Solutions component. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QTLOCALPEER_H #define QTLOCALPEER_H #include #include #include #include "qtlockedfile.h" class QtLocalPeer : public QObject { Q_OBJECT public: QtLocalPeer(QObject *parent = 0, const QString &appId = QString()); bool isClient(); bool sendMessage(const QString &message, int timeout); QString applicationId() const { return id; } Q_SIGNALS: void messageReceived(const QString &message); protected Q_SLOTS: void receiveConnection(); protected: QString id; QString socketName; QLocalServer* server; QtLP_Private::QtLockedFile lockFile; private: static const char* ack; }; #endif // QTLOCALPEER_H ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/qtlockedfile.cpp000066400000000000000000000137421456160714700303440ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Solutions component. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qtlockedfile.h" /*! \class QtLockedFile \brief The QtLockedFile class extends QFile with advisory locking functions. A file may be locked in read or write mode. Multiple instances of \e QtLockedFile, created in multiple processes running on the same machine, may have a file locked in read mode. Exactly one instance may have it locked in write mode. A read and a write lock cannot exist simultaneously on the same file. The file locks are advisory. This means that nothing prevents another process from manipulating a locked file using QFile or file system functions offered by the OS. Serialization is only guaranteed if all processes that access the file use QLockedFile. Also, while holding a lock on a file, a process must not open the same file again (through any API), or locks can be unexpectedly lost. The lock provided by an instance of \e QtLockedFile is released whenever the program terminates. This is true even when the program crashes and no destructors are called. */ /*! \enum QtLockedFile::LockMode This enum describes the available lock modes. \value ReadLock A read lock. \value WriteLock A write lock. \value NoLock Neither a read lock nor a write lock. */ /*! Constructs an unlocked \e QtLockedFile object. This constructor behaves in the same way as \e QFile::QFile(). \sa QFile::QFile() */ QtLockedFile::QtLockedFile() : QFile() { #ifdef Q_OS_WIN wmutex = 0; rmutex = 0; #endif m_lock_mode = NoLock; } /*! Constructs an unlocked QtLockedFile object with file \a name. This constructor behaves in the same way as \e QFile::QFile(const QString&). \sa QFile::QFile() */ QtLockedFile::QtLockedFile(const QString &name) : QFile(name) { #ifdef Q_OS_WIN wmutex = 0; rmutex = 0; #endif m_lock_mode = NoLock; } /*! Opens the file in OpenMode \a mode. This is identical to QFile::open(), with the one exception that the Truncate mode flag is disallowed. Truncation would conflict with the advisory file locking, since the file would be modified before the write lock is obtained. If truncation is required, use resize(0) after obtaining the write lock. Returns true if successful; otherwise false. \sa QFile::open(), QFile::resize() */ bool QtLockedFile::open(OpenMode mode) { if (mode & QIODevice::Truncate) { qWarning("QtLockedFile::open(): Truncate mode not allowed."); return false; } return QFile::open(mode); } /*! Returns \e true if this object has a in read or write lock; otherwise returns \e false. \sa lockMode() */ bool QtLockedFile::isLocked() const { return m_lock_mode != NoLock; } /*! Returns the type of lock currently held by this object, or \e QtLockedFile::NoLock. \sa isLocked() */ QtLockedFile::LockMode QtLockedFile::lockMode() const { return m_lock_mode; } /*! \fn bool QtLockedFile::lock(LockMode mode, bool block = true) Obtains a lock of type \a mode. The file must be opened before it can be locked. If \a block is true, this function will block until the lock is aquired. If \a block is false, this function returns \e false immediately if the lock cannot be aquired. If this object already has a lock of type \a mode, this function returns \e true immediately. If this object has a lock of a different type than \a mode, the lock is first released and then a new lock is obtained. This function returns \e true if, after it executes, the file is locked by this object, and \e false otherwise. \sa unlock(), isLocked(), lockMode() */ /*! \fn bool QtLockedFile::unlock() Releases a lock. If the object has no lock, this function returns immediately. This function returns \e true if, after it executes, the file is not locked by this object, and \e false otherwise. \sa lock(), isLocked(), lockMode() */ /*! \fn QtLockedFile::~QtLockedFile() Destroys the \e QtLockedFile object. If any locks were held, they are released. */ ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/qtlockedfile.h000066400000000000000000000063071456160714700300100ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Solutions component. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QTLOCKEDFILE_H #define QTLOCKEDFILE_H #include #ifdef Q_OS_WIN #include #endif #if defined(Q_OS_WIN) # if !defined(QT_QTLOCKEDFILE_EXPORT) && !defined(QT_QTLOCKEDFILE_IMPORT) # define QT_QTLOCKEDFILE_EXPORT # elif defined(QT_QTLOCKEDFILE_IMPORT) # if defined(QT_QTLOCKEDFILE_EXPORT) # undef QT_QTLOCKEDFILE_EXPORT # endif # define QT_QTLOCKEDFILE_EXPORT __declspec(dllimport) # elif defined(QT_QTLOCKEDFILE_EXPORT) # undef QT_QTLOCKEDFILE_EXPORT # define QT_QTLOCKEDFILE_EXPORT __declspec(dllexport) # endif #else # define QT_QTLOCKEDFILE_EXPORT #endif namespace QtLP_Private { class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile { public: enum LockMode { NoLock = 0, ReadLock, WriteLock }; QtLockedFile(); QtLockedFile(const QString &name); ~QtLockedFile(); bool open(OpenMode mode); bool lock(LockMode mode, bool block = true); bool unlock(); bool isLocked() const; LockMode lockMode() const; private: #ifdef Q_OS_WIN Qt::HANDLE wmutex; Qt::HANDLE rmutex; QVector rmutexes; QString mutexname; Qt::HANDLE getMutexHandle(int idx, bool doCreate); bool waitMutex(Qt::HANDLE mutex, bool doBlock); #endif LockMode m_lock_mode; }; } #endif ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/qtlockedfile_unix.cpp000066400000000000000000000066141456160714700314070ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Solutions component. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include #include #include #include "qtlockedfile.h" bool QtLockedFile::lock(LockMode mode, bool block) { if (!isOpen()) { qWarning("QtLockedFile::lock(): file is not opened"); return false; } if (mode == NoLock) return unlock(); if (mode == m_lock_mode) return true; if (m_lock_mode != NoLock) unlock(); struct flock fl; fl.l_whence = SEEK_SET; fl.l_start = 0; fl.l_len = 0; fl.l_type = (mode == ReadLock) ? F_RDLCK : F_WRLCK; int cmd = block ? F_SETLKW : F_SETLK; int ret = fcntl(handle(), cmd, &fl); if (ret == -1) { if (errno != EINTR && errno != EAGAIN) qWarning("QtLockedFile::lock(): fcntl: %s", strerror(errno)); return false; } m_lock_mode = mode; return true; } bool QtLockedFile::unlock() { if (!isOpen()) { qWarning("QtLockedFile::unlock(): file is not opened"); return false; } if (!isLocked()) return true; struct flock fl; fl.l_whence = SEEK_SET; fl.l_start = 0; fl.l_len = 0; fl.l_type = F_UNLCK; int ret = fcntl(handle(), F_SETLKW, &fl); if (ret == -1) { qWarning("QtLockedFile::lock(): fcntl: %s", strerror(errno)); return false; } m_lock_mode = NoLock; return true; } QtLockedFile::~QtLockedFile() { if (isOpen()) unlock(); } ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/qtlockedfile_win.cpp000066400000000000000000000146631456160714700312240ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Solutions component. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qtlockedfile.h" #include #include #define MUTEX_PREFIX "QtLockedFile mutex " // Maximum number of concurrent read locks. Must not be greater than MAXIMUM_WAIT_OBJECTS #define MAX_READERS MAXIMUM_WAIT_OBJECTS #if QT_VERSION >= 0x050000 #define QT_WA(unicode, ansi) unicode #endif Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate) { if (mutexname.isEmpty()) { QFileInfo fi(*this); mutexname = QString::fromLatin1(MUTEX_PREFIX) + fi.absoluteFilePath().toLower(); } QString mname(mutexname); if (idx >= 0) mname += QString::number(idx); Qt::HANDLE mutex; if (doCreate) { QT_WA( { mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); }, { mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); } ); if (!mutex) { qErrnoWarning("QtLockedFile::lock(): CreateMutex failed"); return 0; } } else { QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); }, { mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } ); if (!mutex) { if (GetLastError() != ERROR_FILE_NOT_FOUND) qErrnoWarning("QtLockedFile::lock(): OpenMutex failed"); return 0; } } return mutex; } bool QtLockedFile::waitMutex(Qt::HANDLE mutex, bool doBlock) { Q_ASSERT(mutex); DWORD res = WaitForSingleObject(mutex, doBlock ? INFINITE : 0); switch (res) { case WAIT_OBJECT_0: case WAIT_ABANDONED: return true; break; case WAIT_TIMEOUT: break; default: qErrnoWarning("QtLockedFile::lock(): WaitForSingleObject failed"); } return false; } bool QtLockedFile::lock(LockMode mode, bool block) { if (!isOpen()) { qWarning("QtLockedFile::lock(): file is not opened"); return false; } if (mode == NoLock) return unlock(); if (mode == m_lock_mode) return true; if (m_lock_mode != NoLock) unlock(); if (!wmutex && !(wmutex = getMutexHandle(-1, true))) return false; if (!waitMutex(wmutex, block)) return false; if (mode == ReadLock) { int idx = 0; for (; idx < MAX_READERS; idx++) { rmutex = getMutexHandle(idx, false); if (!rmutex || waitMutex(rmutex, false)) break; CloseHandle(rmutex); } bool ok = true; if (idx >= MAX_READERS) { qWarning("QtLockedFile::lock(): too many readers"); rmutex = 0; ok = false; } else if (!rmutex) { rmutex = getMutexHandle(idx, true); if (!rmutex || !waitMutex(rmutex, false)) ok = false; } if (!ok && rmutex) { CloseHandle(rmutex); rmutex = 0; } ReleaseMutex(wmutex); if (!ok) return false; } else { Q_ASSERT(rmutexes.isEmpty()); for (int i = 0; i < MAX_READERS; i++) { Qt::HANDLE mutex = getMutexHandle(i, false); if (mutex) rmutexes.append(mutex); } if (rmutexes.size()) { DWORD res = WaitForMultipleObjects(rmutexes.size(), rmutexes.constData(), TRUE, block ? INFINITE : 0); if (res != WAIT_OBJECT_0 && res != WAIT_ABANDONED) { if (res != WAIT_TIMEOUT) qErrnoWarning("QtLockedFile::lock(): WaitForMultipleObjects failed"); m_lock_mode = WriteLock; // trick unlock() to clean up - semiyucky unlock(); return false; } } } m_lock_mode = mode; return true; } bool QtLockedFile::unlock() { if (!isOpen()) { qWarning("QtLockedFile::unlock(): file is not opened"); return false; } if (!isLocked()) return true; if (m_lock_mode == ReadLock) { ReleaseMutex(rmutex); CloseHandle(rmutex); rmutex = 0; } else { Q_FOREACH(Qt::HANDLE mutex, rmutexes) { ReleaseMutex(mutex); CloseHandle(mutex); } rmutexes.clear(); ReleaseMutex(wmutex); } m_lock_mode = QtLockedFile::NoLock; return true; } QtLockedFile::~QtLockedFile() { if (isOpen()) unlock(); if (wmutex) CloseHandle(wmutex); } ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/qtsingleapplication.cpp000066400000000000000000000267421456160714700317540ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Solutions component. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qtsingleapplication.h" #include "qtlocalpeer.h" //#include #include #include #include #include #include /*! \class QtSingleApplication qtsingleapplication.h \brief The QtSingleApplication class provides an API to detect and communicate with running instances of an application. This class allows you to create applications where only one instance should be running at a time. I.e., if the user tries to launch another instance, the already running instance will be activated instead. Another usecase is a client-server system, where the first started instance will assume the role of server, and the later instances will act as clients of that server. By default, the full path of the executable file is used to determine whether two processes are instances of the same application. You can also provide an explicit identifier string that will be compared instead. The application should create the QtSingleApplication object early in the startup phase, and call isRunning() to find out if another instance of this application is already running. If isRunning() returns false, it means that no other instance is running, and this instance has assumed the role as the running instance. In this case, the application should continue with the initialization of the application user interface before entering the event loop with exec(), as normal. The messageReceived() signal will be emitted when the running application receives messages from another instance of the same application. When a message is received it might be helpful to the user to raise the application so that it becomes visible. To facilitate this, QtSingleApplication provides the setActivationWindow() function and the activateWindow() slot. If isRunning() returns true, another instance is already running. It may be alerted to the fact that another instance has started by using the sendMessage() function. Also data such as startup parameters (e.g. the name of the file the user wanted this new instance to open) can be passed to the running instance with this function. Then, the application should terminate (or enter client mode). If isRunning() returns true, but sendMessage() fails, that is an indication that the running instance is frozen. Here's an example that shows how to convert an existing application to use QtSingleApplication. It is very simple and does not make use of all QtSingleApplication's functionality (see the examples for that). \code // Original int main(int argc, char **argv) { QApplication app(argc, argv); MyMainWidget mmw; mmw.show(); return app.exec(); } // Single instance int main(int argc, char **argv) { QtSingleApplication app(argc, argv); if (app.isRunning()) return !app.sendMessage(someDataString); MyMainWidget mmw; app.setActivationWindow(&mmw); mmw.show(); return app.exec(); } \endcode Once this QtSingleApplication instance is destroyed (normally when the process exits or crashes), when the user next attempts to run the application this instance will not, of course, be encountered. The next instance to call isRunning() or sendMessage() will assume the role as the new running instance. For console (non-GUI) applications, QtSingleCoreApplication may be used instead of this class, to avoid the dependency on the QtGui library. \sa QtSingleCoreApplication */ void QtSingleApplication::sysInit(const QString &appId) { actObj = 0; peer = new QtLocalPeer(this, appId); connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&))); } /*! Creates a QtSingleApplication object. The application identifier will be QCoreApplication::applicationFilePath(). \a argc, \a argv, and \a GUIenabled are passed on to the QAppliation constructor. If you are creating a console application (i.e. setting \a GUIenabled to false), you may consider using QtSingleCoreApplication instead. */ QtSingleApplication::QtSingleApplication(int &argc, char **argv, bool GUIenabled) : QApplication(argc, argv, GUIenabled) { sysInit(); } /*! Creates a QtSingleApplication object with the application identifier \a appId. \a argc and \a argv are passed on to the QAppliation constructor. */ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char **argv) : QApplication(argc, argv) { sysInit(appId); } #if QT_VERSION < 0x050000 /*! Creates a QtSingleApplication object. The application identifier will be QCoreApplication::applicationFilePath(). \a argc, \a argv, and \a type are passed on to the QAppliation constructor. */ QtSingleApplication::QtSingleApplication(int &argc, char **argv, Type type) : QApplication(argc, argv, type) { sysInit(); } # if defined(Q_WS_X11) /*! Special constructor for X11, ref. the documentation of QApplication's corresponding constructor. The application identifier will be QCoreApplication::applicationFilePath(). \a dpy, \a visual, and \a cmap are passed on to the QApplication constructor. */ QtSingleApplication::QtSingleApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE cmap) : QApplication(dpy, visual, cmap) { sysInit(); } /*! Special constructor for X11, ref. the documentation of QApplication's corresponding constructor. The application identifier will be QCoreApplication::applicationFilePath(). \a dpy, \a argc, \a argv, \a visual, and \a cmap are passed on to the QApplication constructor. */ QtSingleApplication::QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap) : QApplication(dpy, argc, argv, visual, cmap) { sysInit(); } /*! Special constructor for X11, ref. the documentation of QApplication's corresponding constructor. The application identifier will be \a appId. \a dpy, \a argc, \a argv, \a visual, and \a cmap are passed on to the QApplication constructor. */ QtSingleApplication::QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap) : QApplication(dpy, argc, argv, visual, cmap) { sysInit(appId); } # endif // Q_WS_X11 #endif // QT_VERSION < 0x050000 /*! Returns true if another instance of this application is running; otherwise false. This function does not find instances of this application that are being run by a different user (on Windows: that are running in another session). \sa sendMessage() */ bool QtSingleApplication::isRunning() { return peer->isClient(); } /*! Tries to send the text \a message to the currently running instance. The QtSingleApplication object in the running instance will emit the messageReceived() signal when it receives the message. This function returns true if the message has been sent to, and processed by, the current instance. If there is no instance currently running, or if the running instance fails to process the message within \a timeout milliseconds, this function return false. \sa isRunning(), messageReceived() */ bool QtSingleApplication::sendMessage(const QString &message, int timeout) { return peer->sendMessage(message, timeout); } /*! Returns the application identifier. Two processes with the same identifier will be regarded as instances of the same application. */ QString QtSingleApplication::id() const { return peer->applicationId(); } /*! Sets the activation window of this application to \a aw. The activation window is the widget that will be activated by activateWindow(). This is typically the application's main window. If \a activateOnMessage is true (the default), the window will be activated automatically every time a message is received, just prior to the messageReceived() signal being emitted. \sa activateWindow(), messageReceived() */ void QtSingleApplication::setActivationWindow(QObject* aw, bool activateOnMessage) { actObj = aw; if (activateOnMessage) connect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow())); else disconnect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow())); } /*! Returns the applications activation window if one has been set by calling setActivationWindow(), otherwise returns 0. \sa setActivationWindow() */ QObject* QtSingleApplication::activationWindow() const { return actObj; } /*! De-minimizes, raises, and activates this application's activation window. This function does nothing if no activation window has been set. This is a convenience function to show the user that this application instance has been activated when he has tried to start another instance. This function should typically be called in response to the messageReceived() signal. By default, that will happen automatically, if an activation window has been set. \sa setActivationWindow(), messageReceived(), initialize() */ void QtSingleApplication::activateWindow() { } /*! \fn void QtSingleApplication::messageReceived(const QString& message) This signal is emitted when the current instance receives a \a message from another instance of this application. \sa sendMessage(), setActivationWindow(), activateWindow() */ /*! \fn void QtSingleApplication::initialize(bool dummy = true) \obsolete */ ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/qtsingleapplication.h000066400000000000000000000076321456160714700314160ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Solutions component. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QTSINGLEAPPLICATION_H #define QTSINGLEAPPLICATION_H #include class QtLocalPeer; #if defined(Q_OS_WIN) # if !defined(QT_QTSINGLEAPPLICATION_EXPORT) && !defined(QT_QTSINGLEAPPLICATION_IMPORT) # define QT_QTSINGLEAPPLICATION_EXPORT # elif defined(QT_QTSINGLEAPPLICATION_IMPORT) # if defined(QT_QTSINGLEAPPLICATION_EXPORT) # undef QT_QTSINGLEAPPLICATION_EXPORT # endif # define QT_QTSINGLEAPPLICATION_EXPORT __declspec(dllimport) # elif defined(QT_QTSINGLEAPPLICATION_EXPORT) # undef QT_QTSINGLEAPPLICATION_EXPORT # define QT_QTSINGLEAPPLICATION_EXPORT __declspec(dllexport) # endif #else # define QT_QTSINGLEAPPLICATION_EXPORT #endif class QT_QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QApplication { Q_OBJECT public: QtSingleApplication(int &argc, char **argv, bool GUIenabled = true); QtSingleApplication(const QString &id, int &argc, char **argv); #if QT_VERSION < 0x050000 QtSingleApplication(int &argc, char **argv, Type type); # if defined(Q_WS_X11) QtSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0); QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); # endif // Q_WS_X11 #endif // QT_VERSION < 0x050000 bool isRunning(); QString id() const; void setActivationWindow(QObject* aw, bool activateOnMessage = true); QObject* activationWindow() const; // Obsolete: void initialize(bool dummy = true) { isRunning(); Q_UNUSED(dummy) } public Q_SLOTS: bool sendMessage(const QString &message, int timeout = 5000); void activateWindow(); Q_SIGNALS: void messageReceived(const QString &message); private: void sysInit(const QString &appId = QString()); QtLocalPeer *peer; QObject *actObj = nullptr; }; #endif // QTSINGLEAPPLICATION_H ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/qtsingleapplication.pri000066400000000000000000000010611456160714700317470ustar00rootroot00000000000000INCLUDEPATH += $$PWD DEPENDPATH += $$PWD QT *= network greaterThan(QT_MAJOR_VERSION, 4): QT *= widgets qtsingleapplication-uselib:!qtsingleapplication-buildlib { LIBS += -L$$QTSINGLEAPPLICATION_LIBDIR -l$$QTSINGLEAPPLICATION_LIBNAME } else { SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h } win32 { contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES += QT_QTSINGLEAPPLICATION_EXPORT else:qtsingleapplication-uselib:DEFINES += QT_QTSINGLEAPPLICATION_IMPORT } ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/qtsinglecoreapplication.cpp000066400000000000000000000123551456160714700326200ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Solutions component. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qtsinglecoreapplication.h" #include "qtlocalpeer.h" /*! \class QtSingleCoreApplication qtsinglecoreapplication.h \brief A variant of the QtSingleApplication class for non-GUI applications. This class is a variant of QtSingleApplication suited for use in console (non-GUI) applications. It is an extension of QCoreApplication (instead of QApplication). It does not require the QtGui library. The API and usage is identical to QtSingleApplication, except that functions relating to the "activation window" are not present, for obvious reasons. Please refer to the QtSingleApplication documentation for explanation of the usage. A QtSingleCoreApplication instance can communicate to a QtSingleApplication instance if they share the same application id. Hence, this class can be used to create a light-weight command-line tool that sends commands to a GUI application. \sa QtSingleApplication */ /*! Creates a QtSingleCoreApplication object. The application identifier will be QCoreApplication::applicationFilePath(). \a argc and \a argv are passed on to the QCoreAppliation constructor. */ QtSingleCoreApplication::QtSingleCoreApplication(int &argc, char **argv) : QCoreApplication(argc, argv) { peer = new QtLocalPeer(this); connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&))); } /*! Creates a QtSingleCoreApplication object with the application identifier \a appId. \a argc and \a argv are passed on to the QCoreAppliation constructor. */ QtSingleCoreApplication::QtSingleCoreApplication(const QString &appId, int &argc, char **argv) : QCoreApplication(argc, argv) { peer = new QtLocalPeer(this, appId); connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&))); } /*! Returns true if another instance of this application is running; otherwise false. This function does not find instances of this application that are being run by a different user (on Windows: that are running in another session). \sa sendMessage() */ bool QtSingleCoreApplication::isRunning() { return peer->isClient(); } /*! Tries to send the text \a message to the currently running instance. The QtSingleCoreApplication object in the running instance will emit the messageReceived() signal when it receives the message. This function returns true if the message has been sent to, and processed by, the current instance. If there is no instance currently running, or if the running instance fails to process the message within \a timeout milliseconds, this function return false. \sa isRunning(), messageReceived() */ bool QtSingleCoreApplication::sendMessage(const QString &message, int timeout) { return peer->sendMessage(message, timeout); } /*! Returns the application identifier. Two processes with the same identifier will be regarded as instances of the same application. */ QString QtSingleCoreApplication::id() const { return peer->applicationId(); } /*! \fn void QtSingleCoreApplication::messageReceived(const QString& message) This signal is emitted when the current instance receives a \a message from another instance of this application. \sa sendMessage() */ ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/qtsinglecoreapplication.h000066400000000000000000000050251456160714700322610ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Solutions component. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QTSINGLECOREAPPLICATION_H #define QTSINGLECOREAPPLICATION_H #include class QtLocalPeer; class QtSingleCoreApplication : public QCoreApplication { Q_OBJECT public: QtSingleCoreApplication(int &argc, char **argv); QtSingleCoreApplication(const QString &id, int &argc, char **argv); bool isRunning(); QString id() const; public Q_SLOTS: bool sendMessage(const QString &message, int timeout = 5000); Q_SIGNALS: void messageReceived(const QString &message); private: QtLocalPeer* peer; }; #endif // QTSINGLECOREAPPLICATION_H ukui-app-widget-4.0.0.2/ukui-appwidget-manager/QtSingleApplication/qtsinglecoreapplication.pri000066400000000000000000000005041456160714700326210ustar00rootroot00000000000000INCLUDEPATH += $$PWD DEPENDPATH += $$PWD HEADERS += $$PWD/qtsinglecoreapplication.h $$PWD/qtlocalpeer.h SOURCES += $$PWD/qtsinglecoreapplication.cpp $$PWD/qtlocalpeer.cpp QT *= network win32:contains(TEMPLATE, lib):contains(CONFIG, shared) { DEFINES += QT_QTSINGLECOREAPPLICATION_EXPORT=__declspec(dllexport) } ukui-app-widget-4.0.0.2/ukui-appwidget-manager/appwidgetcommon.h000066400000000000000000000027021456160714700246200ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef APPWIDGETCOMMON_H #define APPWIDGETCOMMON_H namespace AppWidget { class AppWidgetCommon { public: static int getProviderIndexFromdecodeAppWidgetId(const int id) { int sum = id; int index = (sum >> 16) & (int)0xffff; return index; } static int getWidgetIndexFromdecodeAppWidgetId(const int id) { int sum = id; int index = sum & (int)0xffff; return index; } static int createAppWidgetId(const int providerindex, const int appwidgetindex) { int index1 = providerindex; int index2 = appwidgetindex; int id; id = (index1 << 16) | index2; return id; } }; } // namespace AppWidget #endif // APPWIDGETCOMMON_H ukui-app-widget-4.0.0.2/ukui-appwidget-manager/appwidgetconfiguration.cpp000066400000000000000000000155011456160714700265330ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "appwidgetconfiguration.h" #include #include #include #include #include static const char* CONFIG_FILE_PATH = "/usr/share/appwidget/config/"; namespace AppWidget { AppWidgetConfiguration::AppWidgetConfiguration(QObject *parent) : QObject(parent) { m_configInfo = getCurrentConfigInfo(); initFileWatcher(); } QString AppWidgetConfiguration::getProviderNameByAppWidgetName(const QString &appwidgetname) { if(appwidgetname.isEmpty()) { qWarning() << __FILE__ << __FUNCTION__ << "parameter is empty"; return QString(); } QString path = QString(CONFIG_FILE_PATH) + QString("%1.conf").arg(appwidgetname); QSettings setting(path, QSettings::IniFormat); setting.beginGroup("AppWidget"); QString providerName = setting.value("providerName").toString(); qDebug() << __FILE__ << __FUNCTION__ << appwidgetname << " `s appwidgetname is :" < AppWidgetConfiguration::getAppWidgetConfigs(const QString &appwidgetname, QString begianName) { if(appwidgetname.isEmpty()) { qWarning() << __FILE__ << __FUNCTION__ << "parameter is empty"; return QMap(); } QMap configs; QString path = QString(CONFIG_FILE_PATH) + QString("%1.conf").arg(appwidgetname); QSettings setting(path, QSettings::IniFormat); setting.beginGroup(begianName); QStringList keylist = setting.allKeys(); for (int i = 0; i < keylist.count(); i++) { configs.insert(keylist.at(i),setting.value(keylist.at(i))); } setting.endGroup(); setting.sync(); return configs; } QString AppWidgetConfiguration::getConfigurationByKey(const QString &path, const QString &key) { if(path.isEmpty() || key.isEmpty()) { qWarning() << __FILE__ << __FUNCTION__ << "parameter is empty"; return QString(); } QSettings setting(path, QSettings::IniFormat); setting.setIniCodec(QTextCodec::codecForName("utf-8")); setting.beginGroup("AppWidget"); QString value = setting.value(key).toString(); setting.endGroup(); setting.sync(); return value; } void AppWidgetConfiguration::initFileWatcher() { QFileSystemWatcher* fileWatcher = new QFileSystemWatcher(this); fileWatcher->addPath(QString(CONFIG_FILE_PATH)); connect(fileWatcher, &QFileSystemWatcher::directoryChanged, this, &AppWidgetConfiguration::onDirectoryChanged); } QMap AppWidgetConfiguration::getCurrentConfigInfo() const { QMap files; QStringList configFiles = getCurrentConfigFiles(); for (const QString& file : configFiles) { QString appWidgetName = getAppWidgetNameByFile(file); files.insert(file, appWidgetName); } return files; } QStringList AppWidgetConfiguration::getCurrentConfigFiles() const { QDir dirinfo = QDir(QString(CONFIG_FILE_PATH)); if (!dirinfo.exists()) { return QStringList(); } QStringList filename = {"*.conf"}; QStringList configFiles = dirinfo.entryList(filename, QDir::Files, QDir::Name); return configFiles; } QString AppWidgetConfiguration::getAppWidgetNameByFile(const QString& configFile) const { QString path = QString(CONFIG_FILE_PATH) + QString("%1").arg(configFile); QSettings setting(path, QSettings::IniFormat); setting.beginGroup("AppWidget"); QString appWidgetName = setting.value("name").toString(); setting.endGroup(); setting.sync(); return appWidgetName; } /* 分别获得目录下的当å‰�文件与目录å�˜åŒ–之å‰�的文件,移除相å�Œéƒ¨åˆ†ï¼› * 若当å‰�文件é�žç©ºï¼Œåˆ™åˆ¤æ–­ä¸ºæ–‡ä»¶æ–°å¢žï¼› * 若目录å�˜åŒ–之å‰�的文件é�žç©ºï¼Œåˆ™åˆ¤æ–­ä¸ºæ–‡ä»¶åˆ é™¤ï¼› * 若文件é‡�命å��,则表现为旧å��文件的删除和新å��文件的新增; */ void AppWidgetConfiguration::onDirectoryChanged() { QStringList currentFiles = getCurrentConfigFiles(); QStringList oldCofigFiles = m_configInfo.keys(); for (const auto& file : currentFiles) { if (!oldCofigFiles.contains(file)) { continue; } oldCofigFiles.removeOne(file); currentFiles.removeOne(file); } if (currentFiles.count() != 0) { onAppwidgetAdded(currentFiles); } if (oldCofigFiles.count() != 0) { onAppwidgetRemoved(oldCofigFiles); } m_configInfo = getCurrentConfigInfo(); } void AppWidgetConfiguration::onAppwidgetAdded(const QStringList& changedFiles) { for (const QString& file : changedFiles) { QString appWidgetName = getAppWidgetNameByFile(file); qDebug() << __FILE__ << __FUNCTION__ << "Appwidgt added: " << appWidgetName; emit appwidgetAdded(appWidgetName); } } void AppWidgetConfiguration::onAppwidgetRemoved(const QStringList& changedFiles) { for (const QString& file : changedFiles) { QString appWidgetName = m_configInfo.value(file); qDebug() << __FILE__ << __FUNCTION__ << "Appwidgt removed: " << appWidgetName; emit appwidgetRemoved(appWidgetName); } } } // namespace AppWidget ukui-app-widget-4.0.0.2/ukui-appwidget-manager/appwidgetconfiguration.h000066400000000000000000000042271456160714700262030ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef APPWIDGETCONFIGURATION_H #define APPWIDGETCONFIGURATION_H #include #include class QFileSystemWatcher; namespace AppWidget{ class AppWidgetConfiguration : public QObject { Q_OBJECT public: explicit AppWidgetConfiguration(QObject *parent = nullptr); ~AppWidgetConfiguration() = default; QString getProviderNameByAppWidgetName(const QString &appwidgetname); //获å�–ui文件 QString getAppWidgetUiFile(const QString &appwidgetname); //获å�–属性 QString getAppWidgetConfig(const QString &appwidgetname, const QString &config); //获å�–所有属性 QMap getAppWidgetConfigs(const QString &appwidgetname, QString begianName); //å�„个属性的获å�–函数 QString getConfigurationByKey(const QString &path, const QString &key); signals: void appwidgetAdded(QString name); void appwidgetRemoved(QString name); private slots: void onDirectoryChanged(); private: void initFileWatcher(); QMap getCurrentConfigInfo() const; QStringList getCurrentConfigFiles() const; QString getAppWidgetNameByFile(const QString& configFile) const; void onAppwidgetAdded(const QStringList& changedFiles); void onAppwidgetRemoved(const QStringList& changedFiles); //! @keyword config filename, @value AppWidget name QMap m_configInfo; }; } // namespace AppWidget #endif // APPWIDGETCONFIGURATION_H ukui-app-widget-4.0.0.2/ukui-appwidget-manager/appwidgetmanager.cpp000066400000000000000000000207751456160714700253070ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "appwidgetmanager.h" #include "appwidgetproviderproxy.h" #include "appwidgetproxy.h" #include "mappingmanager.h" #include "appwidgetconfiguration.h" #include #include #include #include namespace AppWidget { AppWidgetManager::AppWidgetManager(QObject *parent) : QObject(parent), m_mappingmanager(new MappingManager(this)), m_configmanager(new AppWidgetConfiguration(this)) { qDBusRegisterMetaType>(); registerCommunicationService(); connect(m_configmanager, &AppWidgetConfiguration::appwidgetAdded, this, [this](QString appwidgetName) { Q_EMIT appWidgetAdded(appwidgetName); }); connect(m_configmanager, &AppWidgetConfiguration::appwidgetRemoved, this, [this](QString appwidgetName) { Q_EMIT appWidgetDeleted(appwidgetName); }); } AppWidgetManager::~AppWidgetManager() { } //public slots QStringList AppWidgetManager::getAppWidgetList() { QStringList appwidgetlist; QDir dirinfo = QDir(APP_WIDGET_LIST); if (!dirinfo.exists()) { return QStringList(); } QStringList filename ; filename << "*.qml"; QStringList results; results = dirinfo.entryList(filename, QDir::Files, QDir::Name); for(int i=0; igetAppWidgetUiFile(appwidgetname); } QString AppWidgetManager::getAppWidgetConfig(QString appwidgetname, QString config) { if (appwidgetname.isEmpty() || config.isEmpty()) { return QString(); } return m_configmanager->getAppWidgetConfig(appwidgetname, config); } QMap AppWidgetManager::getAppWidgetConfigs(QString appwidgetname) { if (appwidgetname.isEmpty()) { return QMap(); } return m_configmanager->getAppWidgetConfigs(appwidgetname, "AppWidget"); } QMap AppWidgetManager::getAppWidgetLanguageFiles(QString appwidgetname) { if (appwidgetname.isEmpty()) { return QMap(); } QMap languageFiles = m_configmanager->getAppWidgetConfigs(appwidgetname, "LanguageFiles"); QMap appWidgetLanguageFiles; for (auto it = languageFiles.begin(); it != languageFiles.end(); ++it) { appWidgetLanguageFiles.insert(it.key(), it.value().toString()); } return appWidgetLanguageFiles; } int AppWidgetManager::registerAppWidget(QString appwidgetname,QString username) { if (appwidgetname.isEmpty() | username.isEmpty()) { return -1; } QString providername = m_configmanager->getProviderNameByAppWidgetName(appwidgetname); if (providername==NULL) { return -1; } AppWidgetProviderProxy* providerproxy = m_mappingmanager->findProviderProxyByProviderName(providername); if (!providerproxy) { providerproxy = createProviderProxy(providername); } AppWidgetProxy* appwidget = createAppWidgetProxy(providerproxy, appwidgetname, username); if (!appwidget) { return -1; } return appwidget->getAppWidgetProxyId(); } bool AppWidgetManager::unregisterAppWidget(int appwidgetid) { AppWidgetProviderProxy* providerproxy = m_mappingmanager->findProviderProxyByAppWidgetId(appwidgetid); if (!providerproxy) { qWarning() << __FILE__ << __FUNCTION__ << "Providerproxy is null"; return true; } if (deleteAppWidgetProxy(providerproxy, appwidgetid)) { if (providerproxy->appWidgetProxyIsEmpty()) { deleteProviderProxy(providerproxy); } }else { return false; } return true; } QMap AppWidgetManager::getAppWidgetData(int appwidgetid) { AppWidgetProviderProxy* providerproxy = m_mappingmanager->findProviderProxyByAppWidgetId(appwidgetid); if (!providerproxy) { return QMap(); } return providerproxy->getAppWidgetProviderProxyData(); } void AppWidgetManager::updateAppWidget(QString providername, QMap data) { qDebug() << __FILE__ << __FUNCTION__ << ": Providername = " << providername; AppWidgetProviderProxy * providerproxy = m_mappingmanager->findProviderProxyByProviderName(providername); if (!providerproxy) { return ; } providerproxy->updateAppWidgetProviderProxyData(data); } void AppWidgetManager::updateUserStatus(QString username, QString status) { QVector appvec = m_mappingmanager->findAppWidgetProxyByUserName(username); for (int var = 0; var < appvec.size(); ++var) { appvec.at(var)->updateUserStatus(status); } } void AppWidgetManager::notifyProviderUpdate(int id) { AppWidgetProviderProxy* providerproxy = m_mappingmanager->findProviderProxyByAppWidgetId(id); providerproxy->appWidgetUpdate(); } void AppWidgetManager::registerCommunicationService() { QDBusConnection systembus = QDBusConnection::sessionBus(); QString object = KAppWidgetCommon::getManagerDbusObject(); QString objectPath = KAppWidgetCommon::getManagerDbusPath(); QString interface = KAppWidgetCommon::getManagerDbusInterface(); if (systembus.registerService(object)) { qDebug() << "Regist Dbus Service success"; systembus.registerObject(objectPath, interface, this, QDBusConnection :: ExportAllSlots | QDBusConnection :: ExportAllSignals); } else qCritical() << "Register DBus Service Error:" << systembus.lastError().message(); } bool AppWidgetManager::registerScheduledUpdate(AppWidgetProviderProxy* providerproxy , int timingperiod) { Q_UNUSED(providerproxy); Q_UNUSED(timingperiod); return false; } bool AppWidgetManager::unregisterScheduledUpdate(AppWidgetProviderProxy* providerproxy) { Q_UNUSED(providerproxy); return false; } AppWidgetProviderProxy* AppWidgetManager::createProviderProxy(QString providername) { AppWidgetProviderProxy* providerproxy = m_mappingmanager->asyncCreateProviderProxy(providername); if (!providerproxy) { qWarning() << __FILE__ << __FUNCTION__ << "providerproxy is null"; return nullptr; } providerproxy->appWidgetEnable(); return providerproxy; } void AppWidgetManager::deleteProviderProxy(AppWidgetProviderProxy* providerproxy) { if (!providerproxy) { qWarning() << __FILE__ << __FUNCTION__ << "providerproxy is null"; return; } providerproxy->appWidgetDisable(); // if(通过é…�置管ç�†æŸ¥çœ‹é…�置是å�¦æ³¨å†Œå®šæ—¶ä»»åŠ¡){ // unregisterScheduledUpdate(providerproxy); // } m_mappingmanager->destroyProviderProxy(providerproxy); } AppWidgetProxy* AppWidgetManager::createAppWidgetProxy(AppWidgetProviderProxy* providerproxy, QString appwidgetname, QString username) { if (!providerproxy) { qWarning() << __FILE__ << __FUNCTION__ << "providerproxy is null"; return nullptr ; } AppWidgetProxy* appwidgetproxy = providerproxy->createAppWidgetProxy(appwidgetname, username); if (!appwidgetproxy) { qWarning() << __FILE__ << __FUNCTION__ << "appwidgetproxy is null"; return nullptr; } appwidgetproxy->setProviderProxy(providerproxy); return appwidgetproxy; } bool AppWidgetManager::deleteAppWidgetProxy(AppWidgetProviderProxy* providerproxy, int id) { qDebug() << __FILE__ << __FUNCTION__ << "delete appwidget`s id:" << id; if (!providerproxy) { qWarning() << __FILE__ << __FUNCTION__ << "providerproxy is null"; return false; } if (providerproxy->destroyAppWidgetProxy(id)) { providerproxy->appWidgetDeleted(); } else { return false; } return true; } } // namespace AppWidget ukui-app-widget-4.0.0.2/ukui-appwidget-manager/appwidgetmanager.h000066400000000000000000000054731456160714700247520ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef APPWIDGETMANAGER_H #define APPWIDGETMANAGER_H #include #include namespace AppWidget { class AppWidgetProviderProxy; class AppWidgetProxy; class MappingManager; class AppWidgetConfiguration; class AppWidgetManager : public QObject { Q_OBJECT public: Q_CLASSINFO("D-Bus Interface", "org.ukui.appwidget.manager") explicit AppWidgetManager(QObject *parent = nullptr); ~AppWidgetManager(); public slots: QStringList getAppWidgetList(); QString getAppWidgetUiFile(QString appwidgetname); QString getAppWidgetConfig(QString appwidgetname, QString config); QMap getAppWidgetConfigs(QString appwidgetname); QMap getAppWidgetLanguageFiles(QString appwidgetname); int registerAppWidget(QString appwidgetname, QString username); bool unregisterAppWidget(int appwidgetid); QMap getAppWidgetData(int appwidgetid); void updateAppWidget(QString providername, QMap data); void updateUserStatus(QString username, QString status); void notifyProviderUpdate(int id); signals: void appWidgetAdded(QString appwidgetname); void appWidgetDeleted (QString appwidgetname); private: void registerCommunicationService();//注册dbusæœ�务 bool registerScheduledUpdate(AppWidgetProviderProxy* providerproxy, int timingperiod);//注册定时更新 bool unregisterScheduledUpdate(AppWidgetProviderProxy* providerproxy);//注销定时更新 AppWidgetProviderProxy* createProviderProxy(QString providername); void deleteProviderProxy(AppWidgetProviderProxy* providerproxy); AppWidgetProxy* createAppWidgetProxy(AppWidgetProviderProxy* providerproxy, QString appwidgetname, QString username); bool deleteAppWidgetProxy(AppWidgetProviderProxy* providerproxy, int id); //定时更新 //映射管ç�† MappingManager* m_mappingmanager = nullptr; //å°�æ�’件列表管ç�† //å°�æ�’ä»¶é…�置管ç�† AppWidgetConfiguration * m_configmanager = nullptr; }; } // namespace AppWidget Q_DECLARE_METATYPE(QString) #endif // APPWIDGETMANAGER_H ukui-app-widget-4.0.0.2/ukui-appwidget-manager/appwidgetproviderproxy.cpp000066400000000000000000000134471456160714700266270ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "appwidgetproviderproxy.h" #include "appwidgetcommon.h" #include "appwidgetproxy.h" #include #include #include #include namespace AppWidget { AppWidgetProviderProxy::AppWidgetProviderProxy(int id, QString providername) :QDBusInterface(KAppWidgetCommon::getProviderDbusObject(providername), KAppWidgetCommon::getProviderDbusPath(providername), KAppWidgetCommon::getProviderDbusInterface(providername)), m_index(id), m_providername(providername) { } AppWidgetProviderProxy::~AppWidgetProviderProxy() { for (int i = 0; i < m_appwidgetproxy.count(); i++) { if(m_appwidgetproxy.at(i) != nullptr) { delete m_appwidgetproxy.at(i); } } } int AppWidgetProviderProxy::getAppWidgetProviderProxyIndex() { return m_index; } QString AppWidgetProviderProxy::getAppWidgetProviderProxyProviderName() { return m_providername; } QVector AppWidgetProviderProxy::getAppwidgetProxyByUser(QString username) { QVector appwidgetvec; for (int i = 0; i < m_appwidgetproxy.size(); ++i) { if (m_appwidgetproxy.at(i) == nullptr || !m_appwidgetproxy.at(i)->isValid()) { continue; } if(m_appwidgetproxy.at(i)->getAppWidgetProxyUserName() == username) { appwidgetvec.append(m_appwidgetproxy.at(i)); } } return appwidgetvec; } QMap AppWidgetProviderProxy::getAppWidgetProviderProxyData() { return m_data; } AppWidgetProxy* AppWidgetProviderProxy::getAppWidgetProxy(int id) { int index = AppWidgetCommon::getWidgetIndexFromdecodeAppWidgetId(id); if(m_appwidgetproxy.at(index)) { return m_appwidgetproxy.at(index); }else { return nullptr; } } void AppWidgetProviderProxy::updateAppWidgetProviderProxyData(QMap data) { m_data = data; int size = m_appwidgetproxy.size(); for(int i = 0; i < size; i++) { if(m_appwidgetproxy.at(i)) { m_appwidgetproxy.at(i)->updateAppWidget(); } } } void AppWidgetProviderProxy::appWidgetRecevie(QString eventname, QString controlname, QDBusVariant value) { QVariant date; date.setValue(value); asyncCall("appWidgetRecevie", eventname, controlname, date); } void AppWidgetProviderProxy::appWidgetUpdate() { asyncCall("appWidgetUpdate"); } void AppWidgetProviderProxy::appWidgetDisable() { asyncCall("appWidgetDisable"); } void AppWidgetProviderProxy::appWidgetEnable() { asyncCall("appWidgetEnable"); } void AppWidgetProviderProxy::appWidgetDeleted() { asyncCall("appWidgetDeleted"); } void AppWidgetProviderProxy::appWidgetClicked(QString cotrolname, QDBusVariant value) { qDebug() << __FILE__ << __FUNCTION__ << ": Appwidgetname: " << cotrolname; QVariant date; date.setValue(value); asyncCall("appWidgetClicked", cotrolname, date); // system("ukui-control-center"); } bool AppWidgetProviderProxy::appWidgetProxyIsEmpty() { int size = m_appwidgetproxy.size(); for(int i = 0; i < size; i++) { if(m_appwidgetproxy.at(i) != nullptr) { return false; } } return true; } AppWidgetProxy* AppWidgetProviderProxy::createAppWidgetProxy(QString appwidgetname, QString username) { int index1 = m_index; int index2 = getUsableIndex(); int id = AppWidgetCommon::createAppWidgetId(index1, index2); AppWidgetProxy* appwidgetproxy = new AppWidgetProxy(id, appwidgetname, username); addAppWidgetProxy(index2, appwidgetproxy); return appwidgetproxy; } bool AppWidgetProviderProxy::destroyAppWidgetProxy(int id) { int index = AppWidgetCommon::getWidgetIndexFromdecodeAppWidgetId(id); return deleteAppWidgetProxy(index); } int* AppWidgetProviderProxy::getAllAppWidgetIds() { return nullptr; } bool AppWidgetProviderProxy::addAppWidgetProxy(int index, AppWidgetProxy* appwidgetproxy) { if(appwidgetproxy) { int size = m_appwidgetproxy.size(); if(index < size) { m_appwidgetproxy.replace(index, appwidgetproxy); }else { m_appwidgetproxy.append(appwidgetproxy); } return true; } qWarning() << __FILE__ << __FUNCTION__ << "Appwidgetproxy is nullptr"; return false; } bool AppWidgetProviderProxy::deleteAppWidgetProxy(int index) { int size = m_appwidgetproxy.size(); if(index < size) { if(m_appwidgetproxy.at(index)) { AppWidgetProxy* appwidgetproxy = m_appwidgetproxy.at(index); m_appwidgetproxy.replace(index, nullptr); if(appwidgetproxy != nullptr) { delete appwidgetproxy; appwidgetproxy = nullptr; } return true; } } qWarning() << __FILE__ << __FUNCTION__ << "Appwidgetproxy deleted failed"; return false; } int AppWidgetProviderProxy::getUsableIndex() { int size = m_appwidgetproxy.size(); for(int i = 0; i < size; i++) { if(m_appwidgetproxy.at(i) == nullptr) { return i; } } return size; } } // namespace AppWidget ukui-app-widget-4.0.0.2/ukui-appwidget-manager/appwidgetproviderproxy.h000066400000000000000000000042631456160714700262700ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef APPWIDGETPROVIDERPROXY_H #define APPWIDGETPROVIDERPROXY_H #include #include namespace AppWidget { class AppWidgetProxy; class AppWidgetProviderProxy : public QDBusInterface { Q_OBJECT public: AppWidgetProviderProxy(int id, QString providerName); ~AppWidgetProviderProxy(); void updateAppWidgetProviderProxyData(QMap data); QMap getAppWidgetProviderProxyData(); AppWidgetProxy* createAppWidgetProxy(QString appwidgetname, QString username); bool destroyAppWidgetProxy(int id); int* getAllAppWidgetIds(); void appWidgetRecevie(QString eventname, QString widgetname, QDBusVariant value); void appWidgetUpdate(); void appWidgetDisable(); void appWidgetDeleted(); void appWidgetEnable(); void appWidgetClicked(QString widgetname, QDBusVariant value); bool appWidgetProxyIsEmpty(); AppWidgetProxy* getAppWidgetProxy(int id); int getAppWidgetProviderProxyIndex(); QString getAppWidgetProviderProxyProviderName(); QVector getAppwidgetProxyByUser(QString username); private: bool addAppWidgetProxy(int index, AppWidgetProxy* appwidgetproxy); bool deleteAppWidgetProxy(int index); int getUsableIndex(); private: QMap m_data; QVector m_appwidgetproxy; int m_index; QString m_providername; }; } // namespace AppWidget #endif // APPWIDGETPROVIDERPROXY_H ukui-app-widget-4.0.0.2/ukui-appwidget-manager/appwidgetproxy.cpp000066400000000000000000000050251456160714700250450ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "appwidgetproxy.h" #include "appwidgetproviderproxy.h" #include "appwidgetcommon.h" #include #include #include namespace AppWidget { AppWidgetProxy::AppWidgetProxy(int id, QString appwidgetname, QString appwidgetuser) :QDBusInterface(KAppWidgetCommon::getAppWidgetDbusObject(appwidgetuser,id), KAppWidgetCommon::getAppWidgetDbusPath(appwidgetuser,id), KAppWidgetCommon::getAppWidgetDbusInterface(appwidgetuser,id)), m_id(id), m_appwidgetname(appwidgetname), m_username(appwidgetuser), m_provider(nullptr) { connect(this, &AppWidgetProxy::clickedSignal, this, &AppWidgetProxy::onClicked); connect(this, &AppWidgetProxy::defineEventSignal, this, &AppWidgetProxy::onDefineSignalType); } AppWidgetProxy::~AppWidgetProxy() { } void AppWidgetProxy::setProviderProxy(AppWidgetProviderProxy * providerproxy) { m_provider = providerproxy; } int AppWidgetProxy::getAppWidgetProxyId() { return m_id; } QString AppWidgetProxy::getAppWidgetProxyAppWidgetName() { return m_appwidgetname; } QString AppWidgetProxy::getAppWidgetProxyUserName() { return m_username; } void AppWidgetProxy::updateAppWidget() { qDebug() << "dbus 调用æ��供端å°�æ�’件代ç�†" << m_id; this->asyncCall("updateAppWidget"); } void AppWidgetProxy::updateUserStatus(QString status) { qDebug() << "dbus updateUserStatus" << status; this->asyncCall("updateUserStatus", status); } void AppWidgetProxy::onClicked(QString widgetname, QDBusVariant value) { m_provider->appWidgetClicked(widgetname, value); } void AppWidgetProxy::onDefineSignalType(QString eventname, QString widgetname, QDBusVariant value) { m_provider->appWidgetRecevie(eventname, widgetname, value); } } // namespace AppWidget ukui-app-widget-4.0.0.2/ukui-appwidget-manager/appwidgetproxy.h000066400000000000000000000035551456160714700245200ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef APPWIDGETPROXY_H #define APPWIDGETPROXY_H #include namespace AppWidget { class AppWidgetProviderProxy; class AppWidgetProxy : public QDBusInterface { Q_OBJECT public: AppWidgetProxy(int id, QString appwidgetname, QString appwidgetuser); ~AppWidgetProxy(); void updateAppWidget(); void updateUserStatus(QString status); void updateAppWidgetOptions(QVariant key, QVariant value); bool updateAppWidgetSize(QSize); int getAppWidgetProxyId(); QString getAppWidgetProxyAppWidgetName(); QString getAppWidgetProxyUserName(); void setProviderProxy(AppWidgetProviderProxy * providerproxy); public slots: void onClicked(QString widgetname, QDBusVariant value); void onDefineSignalType(QString eventname, QString widgetname, QDBusVariant value); private: int m_id ; QString m_appwidgetname; QString m_username; AppWidgetProviderProxy* m_provider; signals: void clickedSignal(QString widgetname, QDBusVariant value); void defineEventSignal(QString eventname, QString widgetname, QDBusVariant value); }; } // namespace AppWidget #endif // APPWIDGETPROXY_H ukui-app-widget-4.0.0.2/ukui-appwidget-manager/asyncproviderproxycreator.cpp000066400000000000000000000030601456160714700273260ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "asyncproviderproxycreator.h" #include "appwidgetproviderproxy.h" #include namespace AppWidget { AsyncProviderProxyCreator::AsyncProviderProxyCreator(QObject* parent) : QThread(parent) { } void AsyncProviderProxyCreator::startCreatorByIndexAndName(int index, QString providername) { m_providerName = providername; m_index = index; start(); } void AsyncProviderProxyCreator::run() { qDebug() << __FILE__ << __FUNCTION__ << "providername =" << m_providerName; AppWidgetProviderProxy* providerproxy = new AppWidgetProviderProxy(m_index, m_providerName); m_appWidgetProviderProxy = providerproxy; } AppWidgetProviderProxy* AsyncProviderProxyCreator::getProviderProxy() { if (isFinished()) { return m_appWidgetProviderProxy; } return nullptr; } } // namespace AppWidget ukui-app-widget-4.0.0.2/ukui-appwidget-manager/asyncproviderproxycreator.h000066400000000000000000000025671456160714700270060ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef ASYNCPROVIDERPROXYCREATOR_H #define ASYNCPROVIDERPROXYCREATOR_H #include namespace AppWidget { class AppWidgetProviderProxy; class AsyncProviderProxyCreator : public QThread { Q_OBJECT public: AsyncProviderProxyCreator(QObject *parent = nullptr); ~AsyncProviderProxyCreator() = default; void run() override; void startCreatorByIndexAndName(int index, QString providername); AppWidgetProviderProxy* getProviderProxy(); private: int m_index; QString m_providerName; AppWidgetProviderProxy* m_appWidgetProviderProxy = nullptr; }; } // namespace AppWidget #endif // ASYNCPROVIDERPROXYCREATOR_H ukui-app-widget-4.0.0.2/ukui-appwidget-manager/data/000077500000000000000000000000001456160714700221625ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-manager/data/org.ukui.appwidget.manager.service000066400000000000000000000001251456160714700307010ustar00rootroot00000000000000[D-BUS Service] Name=org.ukui.appwidget.manager Exec=/usr/bin/ukui-appwidget-manager ukui-app-widget-4.0.0.2/ukui-appwidget-manager/data/ukui-appwidget-manager.desktop000066400000000000000000000004501456160714700301230ustar00rootroot00000000000000[Desktop Entry] Name=ukui-appwidget-manager Name[zh_CN]=å°�æ�’框架件 Comment=ukui-appwidget-manager Comment[zh_CN]=å°�æ�’框架件 Exec=/usr/bin/ukui-appwidget-manager Terminal=false Type=Application NoDisplay=true OnlyShowIn=UKUI X-UKUI-Autostart-Phase=Initialization X-UKUI-AutoRestart=true ukui-app-widget-4.0.0.2/ukui-appwidget-manager/main.cpp000066400000000000000000000022771456160714700227110ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "appwidgetmanager.h" #include #include "ukui-log4qt.h" int main(int argc, char *argv[]) { QtSingleApplication a("ukui-appwidget-manager", argc, argv); if(a.isRunning()) { a.sendMessage("Process already exists"); return EXIT_SUCCESS; } #ifndef QT_DEBUG initUkuiLog4qt("ukui-appwidget-manager"); #endif AppWidget::AppWidgetManager w; a.setActivationWindow(&w);//å�•例 return a.exec(); } ukui-app-widget-4.0.0.2/ukui-appwidget-manager/mappingmanager.cpp000066400000000000000000000123121456160714700247420ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "mappingmanager.h" #include "appwidgetproviderproxy.h" #include "appwidgetcommon.h" #include "asyncproviderproxycreator.h" #include #include #include namespace AppWidget { MappingManager::MappingManager(QObject *parent) :QObject(parent) { } MappingManager::~MappingManager() { for (int i = 0; i < m_providerproxy.count(); i++) { if (m_providerproxy.at(i) != nullptr) { delete m_providerproxy.at(i); } } } AppWidgetProviderProxy* MappingManager::findProviderProxyByProviderName(const QString providername) { //通过å��字从æ��供端容器查找到æ��供端代ç�† for (int i = 0 ; i < m_providerproxy.size(); i++) { if (m_providerproxy.at(i)) { if (m_providerproxy.at(i)->getAppWidgetProviderProxyProviderName() == providername) { return m_providerproxy.at(i); } } } return nullptr; } AppWidgetProviderProxy* MappingManager::findProviderProxyByAppWidgetId(int id) { int index = AppWidgetCommon::getProviderIndexFromdecodeAppWidgetId(id); if (index < m_providerproxy.size()) { return m_providerproxy.at(index); } return nullptr; } AppWidgetProxy* MappingManager::findAppWidgetProxyByAppWidgetId(int id) { qDebug() << __FILE__ << __FUNCTION__ << "appwidget`s id :" << id; int index1 = AppWidgetCommon::getProviderIndexFromdecodeAppWidgetId(id); AppWidgetProviderProxy* providerproxy; if (index1 < m_providerproxy.size()) { providerproxy = m_providerproxy.at(index1); if (!providerproxy) { qWarning() << __FILE__ << __FUNCTION__ << "providerproxy is null"; return nullptr; } } AppWidgetProxy* appwidgetproxy = providerproxy->getAppWidgetProxy(id); if (appwidgetproxy) { return appwidgetproxy; }else { qWarning() << __FILE__ << __FUNCTION__ << "appwidgetproxy is null"; return nullptr; } } QVector MappingManager::findAppWidgetProxyByUserName(QString username) { qDebug() << __FILE__ << __FUNCTION__ << "UserName`s :" << username; QVector appwidgetlist; AppWidgetProviderProxy* providerproxy; for (int i = 0; i < m_providerproxy.size(); ++i) { providerproxy = m_providerproxy.at(i); if (!providerproxy) { qWarning() << __FILE__ << __FUNCTION__ << "providerproxy is null"; continue; } QVector appvec(providerproxy->getAppwidgetProxyByUser(username)); for (int var = 0; var < appvec.size(); ++var) { appwidgetlist.append(appvec.at(var)); } } return appwidgetlist; } AppWidgetProviderProxy* MappingManager::asyncCreateProviderProxy(QString providername) { qDebug() << __FILE__ << __FUNCTION__ << "providername :" << providername; int index = getUsableIndex(); AsyncProviderProxyCreator providerProxyCreator; providerProxyCreator.startCreatorByIndexAndName(index, providername); while (!providerProxyCreator.isFinished()) { QCoreApplication::processEvents(QEventLoop::AllEvents); QThread::msleep(1); } if (providerProxyCreator.getProviderProxy()) { addProviderProxy(index, providerProxyCreator.getProviderProxy()); } return providerProxyCreator.getProviderProxy(); } void MappingManager::destroyProviderProxy(AppWidgetProviderProxy* providerproxy) { if (!providerproxy) { qWarning() << __FILE__ << __FUNCTION__ << "providerproxy is null"; return ; } int index = providerproxy->getAppWidgetProviderProxyIndex(); deleteProviderProxy(index); } int MappingManager::getUsableIndex() { int size = m_providerproxy.size(); for (int i = 0; i < size; i++) { if (m_providerproxy.at(i) == nullptr) { return i; } } return size; } void MappingManager::addProviderProxy(int index, AppWidgetProviderProxy* providerproxy) { int size = m_providerproxy.size(); if (index < size){ m_providerproxy.replace(index, providerproxy); } else { m_providerproxy.append(providerproxy); } } void MappingManager::deleteProviderProxy(int index) { qDebug() << __FILE__ << __FUNCTION__; int size = m_providerproxy.size(); if (index < size) { AppWidgetProviderProxy * providerproxy = m_providerproxy.at(index); m_providerproxy.replace(index, nullptr); if (providerproxy) { delete providerproxy; } } } } // namespace AppWidget ukui-app-widget-4.0.0.2/ukui-appwidget-manager/mappingmanager.h000066400000000000000000000034221456160714700244110ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef MAPPINGMANAGER_H #define MAPPINGMANAGER_H #include #include #include class AsyncProviderProxyCreator; namespace AppWidget { class AppWidgetProviderProxy; class AppWidgetProxy; class MappingManager:public QObject { Q_OBJECT public: MappingManager(QObject *parent = nullptr); ~MappingManager(); AppWidgetProviderProxy* findProviderProxyByProviderName(const QString providername); AppWidgetProviderProxy* findProviderProxyByAppWidgetId(int id); AppWidgetProxy* findAppWidgetProxyByAppWidgetId(int id); QVector findAppWidgetProxyByUserName(QString username); AppWidgetProviderProxy* asyncCreateProviderProxy(QString providername); void destroyProviderProxy(AppWidgetProviderProxy* providerproxy); private: int getUsableIndex(); void addProviderProxy(int index, AppWidgetProviderProxy* providerproxy); void deleteProviderProxy(int index); private: QVector m_providerproxy; }; } // namespace AppWidget #endif // MAPPINGMANAGER_H ukui-app-widget-4.0.0.2/ukui-appwidget-manager/ukui-appwidget-manager.pro000066400000000000000000000033211456160714700263410ustar00rootroot00000000000000QT += core gui dbus greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 link_pkgconfig # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS DEFINES += APP_WIDGET_LIST=\\\"/usr/share/appwidget/qml\\\" # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 include(QtSingleApplication/qtsingleapplication.pri) include(../libukui-appwidget-common/libukui-appwidget-common.pri) SOURCES += \ appwidgetconfiguration.cpp \ appwidgetproviderproxy.cpp \ appwidgetproxy.cpp \ asyncproviderproxycreator.cpp \ main.cpp \ appwidgetmanager.cpp \ mappingmanager.cpp HEADERS += \ appwidgetcommon.h \ appwidgetconfiguration.h \ appwidgetmanager.h \ appwidgetproviderproxy.h \ appwidgetproxy.h \ asyncproviderproxycreator.h \ mappingmanager.h # Default rules for deployment. target.path = /usr/bin/ managerservice.files += data/org.ukui.appwidget.manager.service managerservice.path += /usr/share/dbus-1/services/ desktop.files += data/ukui-appwidget-manager.desktop desktop.path += /etc/xdg/autostart/ INSTALLS += target managerservice desktop DISTFILES += \ data/org.ukui.appwidget.manager.service \ data/ukui-appwidget-manager.desktop LIBS += -lukui-log4qt ukui-app-widget-4.0.0.2/ukui-appwidget-test/000077500000000000000000000000001456160714700206165ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/000077500000000000000000000000001456160714700263705ustar00rootroot00000000000000appwidgetprovider-clock-demo.pro000066400000000000000000000001501456160714700346010ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demoTEMPLATE = subdirs SUBDIRS += \ appwidgetprovider-clock-demo \ appwidgetprovider-clock-service appwidgetprovider-clock-demo/000077500000000000000000000000001456160714700340635ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demoappwidgetprovider-clock-demo.pro000066400000000000000000000032051456160714700423570ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demoQT += core gui widgets dbus qml quick greaterThan(QT_MAJOR_VERSION, 4): QT += widgets include(../../../ukui-appwidget-manager/QtSingleApplication/qtsingleapplication.pri) CONFIG += C++11 # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui TRANSLATIONS += \ translations/democlock_zh_CN.ts \ translations/democlock_bo_CN.ts # Default rules for deployment. qnx: target.path = /usr/bin/ else: unix:!android: target.path = /usr/bin/ qml.files += data/democlock.qml qml.path = /usr/share/appwidget/qml/ appwidgetcong.files += data/democlock.conf appwidgetcong.path = /usr/share/appwidget/config/ preview.files += data/democlock.png preview.path = /usr/share/appwidgetdemo/clock/ qm_files.files += translations/* qm_files.path = /usr/share/appwidget/translations/ INSTALLS += target qml appwidgetcong preview qm_files RESOURCES += \ src.qrc DISTFILES += \ \ QtSingleApplication/qtsingleapplication.pri \ QtSingleApplication/qtsinglecoreapplication.pri config.ini000066400000000000000000000000151456160714700360250ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demo[AlarmClock] data/000077500000000000000000000000001456160714700347745ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demodemoclock.conf000066400000000000000000000007461456160714700376120ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demo/data[AppWidget] name = democlock providerName = democlock previewPath = /usr/share/appwidgetdemo/clock/democlock.png qmlFile = /usr/share/appwidget/qml/democlock.qml zoom = false rightButton = false repeatPlacement = false minWidget = 400 minHeight = 400 targetCellWidth = 2 targetCellHeight = 2 updatePeriodMillis = 0 describe = this is a alarm clock [LanguageFiles] zh_CN = /usr/share/appwidget/translations/democlock_zh_CN.qm bo_CN = /usr/share/appwidget/translations/democlock_bo_CN.qm democlock.png000066400000000000000000000447361456160714700374600ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demo/data‰PNG  IHDRLŒ>ä ¼ pHYsÄÄ•+ IDATxœíÝy\õÿð÷ì. , 7â,ˆ§€¢)&hbx`摚™)}+ -KûjÙ·_™g©%¥åQ’Z‚Š·¨ˆ Ê�¨(÷%È}-{Ìüþ]WÀa�ewÞχàÌìì{wçµ³s|>‚¢(@±GÓ „º†!–Ã�#Ärr„XCŽËaÈb9 9B,‡!Gˆå0䱆!–Ã�#Ärr„XCŽËaÈb9 9B,‡!Gˆå0䱆!–Ã�#Ärr„XCŽËaÈb9 9B,‡!Gˆå0䱆!–Ã�#Ärr„XCŽËaÈb9ž¦ @ªQ__Ÿ���“““��]RRòXA]]]“ÐU`hhh¡ÀÚÚÚÞÞÞÞÞ^(húe! p|ò¶6---%%%999%%åþýûeee*KKËAƒ¹¹¹¹»»»¹¹¹¸¸©üYPWÃ�wEeggÇ<•‘‘¡‘2†êããããã3vìX¡PH„FÊ@í‚!×jåååçÎ�‹ŠŠºxñbQQ‘¦ËyNß¾}'L˜àïïonn®érÐ aȵуÂÂÂN�:G’¤¦Ëi‡Ãñööž2eÊܹs5]jC®E*++�=«éZ:hôèÑ .œ3gŽ©©©¦kAO`È5O"‘œ9s&444""B,kºàóù��� .|õÕWutt4]NO‡!׊¢BCC>ÜçÆµ�¥¥å¼yó.\èåå¥éZz. ¹PuöìÙuëÖ]¿~]Óµ¨‰��Ï_|1iÒ$ßÎÎN(2ÄÞÞÞÀÀÀÂÂÂÜÜÜÂÂÂØØXOO�Ïçóù|}}}‚ Äb±X,‰DÕÕÕ�?.//§ï�ËÉɹ{÷nNNNnnn� pvv^³fÍœ9sx<¼áR0ä]N,‡††nܸñáÇ*\­³³³››Û�!C\]]]]]èÝcNNÎÙ³g…Bá¤I“Z>Š ‚ Z½,•——`kk $Ifee¥¦¦¦¦¦fdd¤¦¦ªöëiÀ€«W¯~ë­·ø|¾ W‹ZÂ�w!Š¢Ž?¾bÅŠ¼¼<•¬ÐÆÆÆÏÏoüøñÖÖÖ999cÆŒqqqi¶LYYÙñãÇ-,,fΜÙr !///Ÿ9s¦……E³Y©©©±±±öööEEE—/_¾|ùr~~¾J^‘­­íÖ­[_ýu=<<¼¤¤dΜ9µµµYYY-377çñxÕÕÕ-Ÿ… ˆáÇ�3¦Õ1Š¢Zý­NQ”��ψ#Z΢OÎñx¼VobËÊʪ­­�;wnqqqxxx```ÇN§‰ÅâuëÖ9;;GDDtàሆ\e²²²¦M›öÚk¯åæævàáÞÞÞ!!!ÅÅÅÿüóÏÌ™3uuuííí ;;»åÂÇÒÒÒÌ̬¡¡¡å\ggg.—«ü³óx|øð®]»Š‹‹[}Ò.~Ym?]QQÑ®]»Ž9ÒêC.^¼¸dɒ޽'zzz;vìPókd+Ü“wVeeåÌ™3ƒƒƒéNW”ÇápæÏŸéÒ¥áÇ¿èh–Þ™·z*[ͧ£[}:úª]dK#FŒ¸|ùòüùóÛ{÷‹H$ ž5kV‡�óÑ3šþ–éÞþý÷_;;»ö¾ç:::AAA™™™EI¥Òýû÷ïÚµ«¨¨¨åúkjjJJJÔþ²Ú¡¸¸¸¦¦¦åô‚‚‚]»v…††Êd2Š¢233—,YÒ�Æ*B¡ðßÿUûËbÜ“wI’ßÿ½��O»ŽÀutt‚ƒƒ>|¸{÷nºé5—Ëuvv€”””–ËõîÝ[U5wkkëVû„¢_޳³3½wttܳgÏǃƒƒÛõœœŸ~øAûÛÕk- yG<~üxÚ´i+W®”J¥Ê?ÊÓÓ3!!á§Ÿ~²±±QœîääÄårssskjjT]©fTWWçççóx<'''Åé666?ýôSBB‚§§§òk“J¥Ÿ}öY``àãÇ�U]iÏ éŸÝÏÕ«Wûõë×®7ÙÊÊ* € ˆ�;w¶ºÎää䜜5¿�®C’dvvvJJJ«swìØAÄ”)SäÞ•Ô¯_¿«W¯ªùµ°†¼}8ЮëÀA,]º´²²òرc`iiYYY©é¡Iåååt‡p'Nœ¨¨¨Xºti»Î òx¼ƒjúEt3òvضm[»ö<^^^qqqò‡ûùùÀòåË5ø4îÃ?€‰'ʧÄÅŵ·K‰íÛ·kð%t;r¥�$ùßÿþWù­�ËånÞ¼Y*•*®$99™ÇãéèèÐçÕÕ\ÿ�7222èÿŠÅâS§NíÙ³çÑ£Gê,ãîÝ»ô;�––¦8]*•nÚ´©]wï¬^½¯¢+ CÞ6‰DòÎ;ï(¿ý¹»»ÇÄÄ´ºª¯¾újÿþýêß:¿üòK¡Pøí·ßÒÿ]°`Áúõëׯ_?pàÀÚÚZµ•A’äï¿ÿþõ×_·:7&&ÆÕÕUù÷yñâʼnDmÅw_ò6Ô××O›6Mù-/((h÷îÝׯ_×táÍíØ±Cò¦¦&ú�éÓ§GGGk®¨çÄÄÄìÙ³§]7É644hºpm‡—ИTVVúûûGFF*³0—ËÝ´iÓºuë(ŠJMMUUò® ï§¡¼¼¼e7�ÈÉÉ¡ï_¿~ãÆ�Jþt�ˆˆð÷÷¯¬¬ìêòº5 ù UVVúúú*Ù×b¿~ý®\¹²jÕªÞ½{Óm3¢££[m=¢=®_¿.´¡w}}ý•+WÀÛÛÛÊÊêóÏ?�ŽŽVò:eLLŒ¯¯/朆¼u Ó¦Mkõ.´–|}}“’’ÆŒCÿ×Ýݽÿþ���·nÝêÊ;åþýûË—/ß»w¯¦ ˆ��‰D666nnnôŸ¤¤$___ež’’ØØØØ•5vgš>^ÐF‰DùãðY³f5666[C}}}ll¬V�R<&ÏÊÊrvv~ÑÍ*ê'‘H®_¿Þò躱±±ÕN¬Z¨Uo¸öÀ�7G’äâÅ‹•Ùª‚øüóÏ›]'ÓBµµµãÆ�stt …¯¾ú*EQƒ ²³³3fÌÈ‘#¿üòKMÈD*•~þùçJæ|ñâÅx]­%ìȱ¹Õ«WoܸQ™%·nÝ*FŽÙj_ ZE~�=A\.—nFOáp8ÚÜ zBBB|||CCÊ+”Y~õêÕëׯïꪺíýt5bûöíÊ$œ ˆ_~ùeúôéAܼyóþýûj¨­3xOÑg­¹\®|Š6'üîÝ»ñññA¼öÚk?ÿü³27ÀnذáÇTCm݈ö~ÀêwèСO>ù¤ÍÅø|þ‘#G>øà‡Ñ£GÀ•+W:ÖEñŽ;„B¡|ÏóèÑ£éÓ§ ‚öö?¡m~ýõWggçíÛ·wf%¹¹¹×®]{{û¥K—†……)ÓLõã�?>|øpgžše°·Ö'®]»ööÛo·¹ŸÏ�ŒŒô÷÷§ÿëââÒÐÐ�˜˜XQQѬ©2æÌ™SYY)o)mjjúã�?úøøt÷c(ÿììl‘HÔ™•Ð——¼½êœ9sLLL¦M›Öf'™ .ìß¿ÿرc;SkàžàñãÇóæÍk³q8A”'œæííèîîÞ�çíÝ»·™™™ü¿|>_(²`ð {{{kkëN®dذa���ÇWœèïïàÀ�6·K¥Òyóæaûs†H’\´hQaaa›KþüóϳfÍj9½OŸ>]Pjý��={vHHH›�-,,¤Ç�肺º 9lÛ¶íÔ©SÌ˱uëÖVGCê7iÒ¤­[·¶¹Ø©S§ÚÛ:˜•zzÈoÞ¼©LÒU«V ‚ .¤¥¥©¡*Ä 55õâÅ‹�`ÕªUm.üùçŸÇÅÅ©¡*mÆýúë¯5]ƒÆTVV¾òÊ+mÞö*///))IS5£ÄÄÄüü|Å)¥¥¥Êü° ÑTÍ×CokÍÊÊrrrb¾ç„Ëå^¹rEÞ¶ i-ºµ©L&cXFOO/==ÝÁÁAmUi�žxâ�¢¨eË–µyWÙúõë1áÝ‚��Ïwß}ǼŒH$Z¾|¹zêÑ6=1ä‘‘‘m^3 Ræ8¥lßAA€czu¥·ß~»Í~£Nž<©d'?,Óã~®7448991Ÿosss ¦(ÊÛÛ»c·²=sú4L™`fÙÙЫW§Ö†Z (*999>>žÃálß¾�ù§P(LOOj+Oô¸=ù† ˜Îãñ~ùå'''’$ÿý÷ßS§Nuª'}ý'TT€«+´gX%Ô¦†††S§Nݼy“¢(''§�;w2w—““³aõ•§%zÖž<33ÓÅÅ…¹yÃæÍ›W®\ yyyÑÑÑ���nnn/½ôRÇŸuüx¸|ùÉ߯ÁíÛ Å­;»—ëׯ§¥¥éëëûùùÑ „6oÞÌÜÉŸÏOKKÓ†žíÔGƒgöÕŒ$ÉfmKZòòòRìé…î`°³� Éd”“ðäßäÉ�}%è)±X|åÊÅ~£¤Ri›£)Nš4©Gu ÓƒBÎüÙß%ÏÝÔDõíû,çÿùO—< ¢(Š¢âââÚ¼ï娱cš.S}zJÈ›ššlmm™?ø¥K—va••”±ñ³œ?íSu…>ø€ù³¶³³“�0Áz=%ä{öìaþÔ{÷îÝåã�feQzzÏrþÇ]ût=Xeee›ã"ïÝ»WÓeªI�8$•JÛ<§êééyéÒ¥®­ÃÞ®^ùéßÅ‹áüù®}ÆžêüùóÍz›hiÆ mvšþ–Q‡ƒ2¿ žžžôQœŸŸ_rrr×Vsò$EOvæ<ÕÕO×Ã$&&Ž7‚hsDäC‡iº^u`Èe2™¼“°VÑ#éîܹÓÒÒx<ÞW_}Õµ5íÚõìG»¾>UPеO×c¬Y³†¾Nneeõ믿¦¥¥1wüèììL÷NÍnìùñãÇ™¿Îé›Û(Šª¬¬\¾|¹ŽŽÎþýû»¼¬/¾x–sSSªººËŸ±Ø»w/ŸÏ_±bEUU=å£�>bþôÿþûoÍÖ¬,9I’ÌWMuttòòò’™™©¦‹¨ >˹­-…CütšL&{ðà�â”ÜÜ\æŽ1½¼¼XÍœå!�ŠŠbþ" Òd}ãÇ?Ëù°aTøé¨~m6\9s挦kìZl9I’ÌmE9Nfff{W›––vüøqù ¶mÛvúô鎔(“QÎÎx3’$¯]»vøðáòòòŽ­!33“y”˜±cǪ¶fmÃæKh Ì£‹Ï�;×Ñѱ]댎Ž^¶lÙÚµkéÿ666¾öÚk mw‰$$€¼/·Ó§á½÷Ú½VûÏþyçÎ�Ñ£G×ÖÖv` ŽŽŽo¼ñÃ×®]KHHèh�Ý�¦¿eºÐ²e˘_û¥K—:0&iYY™³³3ý÷áÇ?ûì3Š¢ŠŠŠFŒÑÁB›Ý ÷Í7\ÕÕÕÑÌž=ûìÙ³XƒT*½,o ôË—/WiÕÚ…µ{r‰DrèÐ!†‚‚‚îß¿ðàÁÛ·owxüúû÷ïÓ×çúôéSVVÖ±•€‰ $'ƒ¼;ѯ¾‚ßïàªXÇÀÀ€þ£¶¶¶wïÞízlccã­[·8pïÞ=æá¨:$‘H:^¥vcmÈÏœ9Ã^èÌý–7ë ·º=÷¢(“'%%PýÖ[o© ôß~{îf¸ç¯á÷@ÅÅÅîîîׯ_oïI’lö±2w­««[QQ¡ºÂµ;C¾k×.†�“Çã5ëM]yŸ~úé¨Q£,,,ÆŒCoy+W®œ:uê¸qã²³³USý—_âÍprÇ …“&Mš0aB'o7.++c¾1æ×_UUÙZ…�!=z4Ãg9}útÕ>�ê[&¿ýö³œÛØôä›áª««+Ÿ’Ÿiï°ÀÀ@† c̘1*©YÛ°ðÄÛƒbccxë­·TûŒªÒè�?`„'ççÃðáЙ³zÝY¯^½Lž’Ÿiï0æ�þúõë>ìäSh!†<,,Œa®‰‰I÷8¿r>ù;9ºEÍZoêÔ©&&& >|XmŨ CÎÊWT¼û®F êöÊËËSSSße|OŸ>­¶zÔ†m]2———[ZZ2¼¨ƒÒwGÛÛÛ;99©±Àvªª{ûg£¯|ó <½£)©¦¦&###;;»ººŒŒŒ®™s8œ²²23335Øåض'?wîC­­­}}}���AuuuRRR§NPHJ›á:£¾¾>))©ººÚÀÀÀÅÅÅÏÏÏÚÚúE “$yŽ}·!iøÄŸª1ŸY™?¾|Éââ⸸8 –Ú �÷äd;‡Cuèî‹$É›7o–””ȧ̛7�a#Y¸p¡«í ¬Ú“SuñâE†üüüä[[[�1¢ë‹R8qè¾Äé›á’’4]S·A„···â}AK.\ Øu ˪�çää1,ÀüéjµÉ“á·ßžü-•ÂèÑ�Ÿ¯Ñ‚º1æÍ ¨¨ˆy´¼n‡U!¿víÃ\›î=}P|õÕ“¿ÁÝjj4ZPw5`À€þýû3,À¼!u;¬ yLL Ã\??¿6GÏÑvÿ÷ o2YY ..8LjÁ¼3gÞ�º�žrµUÒ…öî…‰Ÿüݳo†ë æ�÷äZª¶¶6##ƒakkëôôô²²²N5üÖgÎ>>®ò_C­éXOAÚ‰={òääd†¹C† qqq¡ÿ‹ÅÚ~£›2LL % ‘૯ _?`ìɬ‡›8q¢@ �7:t(ÃÂÌ›S÷ÒSöäŠ_Û|>Ÿ¹)R·ac±± ï{†cdbb¢Ø(˜yOŽ!×F÷ïßg˜Ëü‰vcùäf8ŠÂ›á”ǼIdffª­’®Æ’Vhuuu �Éø|~cc#ó0ÝÛž=Ï¢êëý{`c£Ñ‚º™L&Äbñ‹¨««ë|7Ú€%Û}NNÃ\;;;6'‚‚àÿ{òwc#¸¹áÍpmâr¹¶¶¶ 0oTÝK6}æÏC(ª­�ùúëggݪªÀÙ™¾N$±xØ€NbÞ00äÚ%;;›aî�!CrrrÊÊÊêëëÙqxÒº½{ÁßÿÉß”—×{ÿù�¡¡¡±±ñ¶mÛ4Z™¡(ª¾¾¾¬¬,''gÈ�! K2oTÝK.¡•””0̵··—��Ááp†îáá¡–ºÔ.* << %ˆ”³”@ccãŠ+Æ�ǯƼQu#,Ù“3“&M¢ÿ&I’Í¿ØáéÍpO{†ÛP p ,,lÛ¶m†††š®O“œœœœ��åga�;ư0kBÞ#öäæææò¿9W>® [™˜@J ©§\€¿FÔÕÕ=zTÓ•i—ËU¼Î¢¸a´Äš�÷”=¹Ú*Ѭ‚‚‚°°°šš;;»1¡¡Vsçš‘¤àÀ€={ö0�àÛÓ0oríÂÜ0°c#–&&&FFFŽ;¶»4D¿páB`` âXëî|þE±ØÀà,Àè7îܹC¨Î÷ïß���0`Àرc;ðpæ»›YÓÚ”%?×›ššæêÉ»4VÚ�;w/^`6À#€eŠïBSSÓ�7nܸAÿ×ÜÜÜ[�Öž¹ÌÏÏ߸qc}}½òw.+ÿåÅš�³¤—ËU¾ç6%_²X,.--µ²²9rdbbb'ªS“ŒŒ ÿºO¨€íËžþwÍÓÌ+ÃÁÁ�ÞÃ{{{{xx4ûÒÔ¸‚‚‚‰'2÷ð'§|ȹ\®”�á²$ä� Ù9'E���í=÷F’d}}½‘‘ѯ¿þZZZº¶› 3(‹###cbbâââDt§1OqÌyúßwžþ†o�çææ&Ïü�!C4ÕÂïÞ½{B¡PWW÷þýûþþþhOÒØØ(^4W Ô××w®F­À’�›šš2œD©®®îÕ«W»VøàÁƒE‹þñÇݱ]±D"IMM½yóf\\ÜéÓ§KKK@ €¾$(˜À4γzõê5|øpyæ™{AU­'NlذÁÁÁ!>>þÛo¿�;wn{×P]]ÍpÊÖÔÔ”>/Óݱ$äÖÖÖ�=zÑܲ²²ŽUJ¥R� §- mmmé#c€+îÐàpSuOÔ¿ùÙ;///5 �——gaaÁ°CfPVVfeeõ¢¹ÖÖÖÝâœk›Xr;;»¼¼¼ÍÍÏÏg§'˜:uê©SOvÛ} ¢7E@5€Ÿž^âó?ìU‚Ãá899Ñ{ø‘#Gº»»kÛû‚‚›w¡cggÇŽ&å,¹†¹Ý nüè¼%K–Èÿ.Ïá�Æ RéÝ£G÷îÝûÞ{ï 6LU÷ö“$™––¶oß¾÷ßßÃÃÃÅÅ%66V%kVæëäìiÌ£Ákô*ôòË/3¼ÆèèhM¨yb±¸ÙOÓCsçROo’¡ôô¨¼>>ÎÎÎj«M{,Y²dË–-òÿ¦§§ßô÷UXødäóª*pu…‡áùûÀ¬¬¬¦N�:uêT (êÁƒqqqôIûÄÄD†ÞN[¥Ù¦]±±±zzzòî„ù󨫫“Ÿ–ãp8=¶cÃÁƒûøø(ŽýºwïÞQ»wC~>DEÀðá�”/¸ôMÄÀ�øæ›o@SSSJJŠ<ó÷îÝk³†áÇ«æÅtˆD"áp8"‘H$•——3_gMÈYrLþÓO?1¼ÆàààÜÜܲ²²††MWªaüñÜý/555”LF öìø|âÄŽ­¼¢¢âܹsëÖ­›6mZ«—¦ÆŽ« -aèŽ?úè#†ÍfÇŽš®T5XòÈÈH†OkbG·Zöi9 Åž={(Š¢$ÊÖöYÎ/îä‘$™››{ôèÑÏ>ûÌßßüøñ›6mª««SÁkP�W^y…a³9yò¤¦ T –„<55•áÓ8p ¦ Ô"ï½÷žâ›óÒK/=™Q]M™š>Ëùÿþ§Ñ2ÕÁÑÑ‘a³IKKÓt�ªÁ’›azú0Iíïíí­8%==ýIw1……0p È[ìÝËâaRq˜¤nÆÐÐÐÒÒòEsÅbqVV–:ëÑfÇwssSœ²wïÞ'õëÿþûl˜ÔU«Ô[šZeee1$ÜÊÊŠ Ö„ Ä0—ù÷|�B„âÝoúlswsƒÓ§Ÿœ]gìÌ´»kóOm•t5ö„¼ÙÞ©ÅOT$UVVv}EÚkÁ‚Š=a<~ü8""âÙ쉡 ¶n…Û·5P\—©¬¬Tì‚9äîîî]_‘š°ä:9´õ©ddd¤¦¦––––••UWW›››Ïš5Kmµi33³3f„……ɧìÙ³ç¹7¤Oøä T֕Ο?_YYillleeeiiù¢^thl yÚ“ÇÆÆ>x𠺺šÇãéêê²ãŒc‡)þ÷ܹs ÍøX€¢(===�W]]�™™›’’°<óæÔ½°äì:ÔÖÖ2÷ qöìY+++SSS<ÓN’¤£££âÀ�_ýõÿ䃜³I’¥¥¥ò‘³Z"¢¦¦†5­Ðس­ :”a�¢¢¢¡C‡š››c€Ãá4Meß¾}Š�7X‰ÃáXXX8992,6dÈÖ$Ørðñña˜ËÜ®°Z´h‘â÷]^^ÞÅ‹5X�:1o �Ekõ¬�³æØD%ú÷ïÿꫯ*NÙ³g�¦ŠQ'ª­–äÌR·Ãª�3çççã-1Í4»`þÏ?ÿ°f”?>|QÇÕ4Ü“k/¡PÈÜ[(þbofêÔ©ŠÍÅ$ÉŸþ©ÁzÔƒy3èÛ·¯���ÚŠQV…œ ˆ &0, ÿt)Š*..¾yS…ý”vK|>áÂ…ŠSöîÝ˲ƒŠ¢nÞ¼Y\\,]Ì!å•W´­ÃÉNbÏ%4ÚáÇçÏŸÿ¢¹ÖÖÖ·nÝÊÊÊÊÎΦc˜>}ºµµµ Ô:wïÞmvUâÆ�£F�ÒT=*WTTD·DB¡ÐÁÁaøðá%%%/ZþðáÃèÂ]›±jOþþþ WÈJJJ®\¹rçÎ�ÆÆFSSSOOOÖ4Bè°!C†Œ3Fq ËN¿yxx˜˜˜444ܹsçêÕ« çp8þþþê,O4Ôĵ 1ï…V®\yûö튊 M—©E~ÿýwÅ·èIw1¬SQQqëÖ­•+W2lÏZ׳Ûöä0eʆ¹»wïvvvîd¯£,3{ölÅÖøõõõG�Õ`=]ÄÔÔÔÙÙy÷îÝ ËLž…T*Ý¿ÿæÍ›™oœê. æÍ›§8åY síP^^ÝùõœýôÓ»wï0 €a4Õn¤Ùó7nܹsGSÅ´üá‡v~=Ìý˜1c ÐùgÑ6, 94»,ÔÌ©S§:yËGBBÂÿûß™3gº¸¸0œÅéFFŒáêêª8E{væÿý7C·?Ê+++;}ú4ÃÌ›M÷ÅÎ�Ï™3‡ÿüФRé‘#G§TWWSí¹”øÁ,Z´èúõëMMMööö/Tk´Ú]Œb šRUUµiÓ¦¯¿þº½�g(Šj6Þ‘#GÏÑÕÕ�={v«Ônì ¹©©i`` ÃòÁz £¢¢Ž9’››«üú ‚èÓ§Opp0;N[°`�â7cóîb4dåÊ•ß|óM†@ÎÎÎ>räÈ™3gŠŠŠè)Ì#4²õt,;CmýôŠ‹‹»téRxxøÉ“'óòò¸\nmm­’k‰D¿ýöÛ/¿ürûöíâââëׯ«¢^Í377Ÿ1c†â�ÿb¿ÿ~XXØO?ý4}úô‚‚‚v–×ÕÕq¹ÜÜÜÜÈÈÈcÇŽ]ºt)>>žay¶þVöÝñ&'‘HúöíËpì½dÉ’#Fggg'''===%ל——çï‘AÄG}äááÑì‡n÷uáÂ…‰'ÊÿKDvv¶oä¦(Š>d�Édžžž©©© Ga-‰D¢;w§744ÄÅÅíÛ·ïEKZZZêè訠h-¤ÙËô]jÙ²e̯ýòåË2™¬kÞ¼y³§§ç«¯¾:gΑH¤òÊ5E&“5«øë¯¿ÖtQEQ‰dðàÁ{¬T*m³aÒòåËU[°VasÈoݺÅüÑΟ?¿Ã+'IR,«°Z-ñÍ7ß(¾E¶¶¶R©TÓEQEÕ××wø±m^ý¾}û¶ KÕ6l9I’Ì­ÿ9Nff¦¦ËÔ.yyyÍÚ`�={VÓEuJff&s‡_cÇŽÕt�]‹µ'Þ€ ˆ/¾ø‚a’$7mÚ¤¶zº–u³qãF’$`ÞHØ@Óß2]‹$I///†—¯££“——§ø�»wï’$©©‚µAxxx³·¨¬¬LÓE)E&“Ý»wOqJnn.�Ç4¸€——ë?n6ïÉA‰�¹D"Ù²e ýwEEÅG}äââ²ÿ~µT§¥¦M›¦x‡Y7ê.fß¾}...Ë—/—��³eˆ`àË/¿dY­Ðô·L—“ÉdÎÎΠŽNjjêŽ;ÌÍÍéÿjÉ)e úôÓOß"''§n±»[»v-½ß¶°°øùçŸSSS™¯Š9;;wìòJ÷Âþ�SuðàAæo:OOOúë|âĉ¬•º3Z¶N¹qㆦ‹RJjj*ÝAÌGjpèÐ!M׫="䉤ÍÖES¦L9qΩ+Õ"ÍZò-Y²DÓµÃñãǧN�Êü‰;::jÉÕÁ®Æòcr�Ç[½z5ó2ñññ/¿ü²zêéš –¦ü�¿çëëǼÌêÕ«¹\®zêÑ0M˨ISS“­­-ó[±téRM—©Ejkk› ô÷ßkº(e}ðÁÌŸµ��]SS“¦ËT“±'>Ÿ¿uëVæevîÜÉ܆¡G144lv£Xwé#..n×®]ÌËlݺµ]·Áwošþ–Q’$ÛìˆÓËËKñ8­®®îòåˉDƒekPVV–¼�§­­mee¥¦+jN,_¾|YñŽW©TêééÉü)Oš4©[\,PÖ¶BkUff¦‹‹‹X,fXfóæÍt‡ž999W®\‰D®®®ÌýI±Øƒöïß/Þ}÷] M—ÓÜõë×ÓÒÒôôôüüüèñ͛7þùç áóùiiiTW�š×³Bk×®]·nÃ\.÷Ê•+�––666~~~úúújªµGccãåË—óóóÀÕÕ•$I___æ>d¾üòËo¿ýV]j…ò††'''æ~`\]]鶇ÞÞÞnnnj« uLrrr\\—ËݶmýÕü"B¡0==] ¨­6mÐSN¼É ‚Ÿ~ú‰y™ÔÔÔ7nb»ww÷ÀÀ@ú§;ó’?ýôSOK8ôÀ�À´iÓ˜`€½{÷þñÇê©uÞüÁÐñ mêÔ©Ó¦MSO=Z¥Çý\§eee9;;‹D"†e¸\ntt4ËÆ£g¥˜˜˜6ÅõôôÒÓÓÔV•öè¡!€���àà`æeúõë—””¤xV977·²²rذa*,CÞ´“Ãáœ;w޹id·H7áž\µ•H¥RŸ‹/²`(å¼¼¼?ü0<<œÇã©üæð¸¸¸ÄÄD9r¤««ëœ9sÚüš …‰‰‰&&&ª­¤á~ýõך®Acôôô^zé¥?þøƒ¹{ ŒŒŒ¦¦¦††‚ ÆŽëîî®òJNœ8ÁçóT¾fõ+--ݶm[bbâºuëU{ܯ_?}}ýüüü‚‚‚ððð6»¦âñxQQQ¬á¬4v¯�Öøþûï•y£¶nÝš••ÕE5¼õÖ[×®]뢕«}Óhff¦§§gW¬ÿáÇ?üðƒ2ŸÚ?üÐt/rJ&“µyE�öË/¿tQ ƒ®­­í¢•kŠD"qppèŠ5ÿüóÏÊ|^S§NíQ÷¨¿†œ¢(ª¬¬¬_¿~mn4A=z´åà :Y€¥¥e'× =BBB.]º$‰¶lÙòþûïwfU­¾±GŽQæZÿþý?~Ü™gg�žx3LK‡nóÚEQ ,8wîœâÄ›7ož}Txùº‹åäääç盚š:thÉ’%ÊŒRþã�?6뻪‡Ã�?gÔ¨QMMM111m.yúôi¡P¨££3jÔ('''5ÔÖyo¿ýv]]�££ã©S§Æ�¯érÚfnnÎãñ RSS?þøce²zõê5kÖtuaÝŒfO h!’$/^¬ä»·jÕªîÒãgjjê”)S4]E»I¥ÒU«V)ùq,Y²O§·„Çä­�J¥¯¿þzdd¤2 Ïœ9óÀ�͆7ohhHLLôööÖž!¯CCCóóóÍÌÌJKK—.]ª8FŠÆI$’¸¸8OOÏf�sˆD¢7ß|³Í{Úh���ÇŽcÁ�ÿ*‡g×[ÁãñÂÂÂÆŒ£ÌÂÇŽ xüø±| EQ—.]JKK»qãF—ÕØn¥¥¥t7Ó§O×t9Ï¡›‚7E¼¬¬, @É„ûøø„……aÂ[…!o�@ ˆŒŒT²ÓˆèèèaÆÉ�ä“““ õõõGŒÑ•5¶�••U@@€——׌3ŠŠŠ˜;ºS3ooo==½üüüäädzJLLŒ‡‡G›-OhnnnØE׋`È_ÈÔÔ4::ZÉýyaa¡¯¯ï¦M›JJJâããéSîZµÙ�7޾p@ßZ§U ???ˆ‹‹{ôèÑÆ�}}}Ûl=Jóññ‰ŽŽ655íâ»1<&oCccão¼¡äñ9,Y²ä¥—^rrrz饗º´°øá‡®\¹’——÷å—_Κ5KÓå4{÷îÝØØØ½{÷*ù�ÀÀÀ°°0­ú2ÕFš=ï×-H$åÏ·€‹‹KLLL««Z³fÍÞ½{58’¦H$Rì¥\Íd2ÙîÝ»×®]ÛêÜk×®¹¸¸(ÿ>/^¼¸Çv‰ß.r¥�$ÙæhjЏ\î¦M›š]]KLLär¹|>ÿÁƒšz!šuïÞ=�—ššª8]*•nÚ´©]�Ï׬YƒWË”„!o‡íÛ·+¿€——W\\œüáãÆ�€+Vhð%hܲeË`„ ò)ôųv½±?þø£_B·ƒ!oŸƒ¶ë: A|ðAeeåÑ£GÀÊʪªªJÓ/B“***è>óŽ?^QQñÁ´«W&ºå‰¦_D7ƒ!o·«W¯*Ó.U‘••ÕäÉ“ ‚øõ×_[]gRRRVVk~’$ùðáÃäääVçþüóÏAL�:ÕÊʪ]oc¿~ý®^½ªæ×Âx ­ÝÆŽ›””¤d?´ÒÒÒÓ§O{zz¶zA®±±1>>þüùóÝhpf555.\ˆ��oµÓë—_~ÙÓÓóäÉ“¥¥¥Ê¯sÊ”)IIIcÇŽU]™=†¼#,,,"""¾ÿþûvýt¿}û¶‡‡Gppp^^žâôôôt™L& µ¿e˜’Œ��mmm¥Ré�;w§çåå{zzÞ¾}[ùµñx¼~ø!22R G\ì0äÄáp>ýôÓ˜˜;;;å%‘HBBBƒ‚‚*ª·‡Â�w–©©ixxxHHH³†hm"IòðáÃ~~~qqq/ê<;;Zý± æÝ{«OG NÙ’©©i\\œŸŸßáÇ™;½nIOO�[¦'÷—®*r âÃ?LOOo×Ù8¹}ûöM˜0ÁÛÛ;$$D±5[yyyuuµ��AïÞ½[>*""⯿þªªªêxÝÊ¡¯ÿµzc¯µµµ@ ¨ªªª¬¬”O|üøqHHˆ··÷„ Ú„°US§NMOOÿðÃñ'ºJ`ÈUÆÁÁáäÉ“'Nœh×Qº\|||pppŸ>}¦OŸ.‰²²² ÕŽ¥H’,++«¬¬lu Þ„„„ÔÔTezJ’“J¥©©© -g ‚ÊÊʲ²²–{c‚ „B!dee‰D¢ððpz©àààŽb…ˆˆˆÈÈÈž92aÁ�«X``à�;w¾üòËŽ5ó’J¥³gÏîÓ§Ï_ýeddÔêæ^^^.“ÉLLLZ> EQ·nݺqãF«»A‚ ^4=66¶Õ“ÞºººÆÆÆR©´¢¢¢å\‡^½z9r¤OŸ>³gÏŽŒŒlï�7�Ïç¯]»6==½gŽ.Ü¥°‘½ê ‚o¿ýváÂ…ÁÁÁgÏžíØJªªª¶lÙÖÖÖ~O 0€Ž(}…¹ÕÞ](ŠN;¾Á¹\®žžžH$jlllÙ¨ËÊʪººº´´”¾ˆEQÔÇ/?URRÒ±×(7iÒ¤;v 8°“ëA­Â�w•�FEEýý÷ߟ|òI³ ãíRRRrøðáÇ@ÿþýýüüÆ�OŸŠoõޱ††èÀÀ‰tµ–!·´´ÌÌÌ,,,¼yó&ì‚‚‚޼˜ììì¶nÝ:cÆ <üî:Øž¼Ë‰Åâ?ÿüsãÆ�ô…qUqrrruu:t¨««««««ƒƒÝŠ+''çìÙ³B¡pÒ¤I-Eg©Õ=***//ïÕW_¥Ï)Èd²¬¬¬ÔÔÔÔÔÔ»w捻¤4»³¥“W¯^½`Á­ê¾‚•0äj"•Jÿúë¯ï¾û޾õEåø|¾­­­P(2dˆƒƒƒ���¹¹¹¹¹¹………‰‰‰®®.ŸÏçóùô‰º††z\ô¦¦¦ªªªÇ�——————×ÕÕeggß½{7'''//¯‹ºˆrqqY³fÍìÙ³±K6õÀ�«I’ëÖ­k×}�¬1|øð/¾ø"00°]ç P'aÈ5€¢¨sçέ[·N™QØaìØ±_|ñ…¿¿?{«†\“BCC:TVV¦éZº„¥¥åüùó.\ØÞn!� aÈ5O"‘œ={644ôĉZÕSr‡éêê.\¸pÒ¤IÚ3¼D�…!×"•••ýõWhhèõë×5]K�3fáÂ…³gÏÆ>’µ†\=xð ,,ìôéÓ7oÞloÓõãp8#GŽœ>>cÇŽµ³³ÃSå݆¼[ª««KKKKIIINNNNNÎÌÌlWiJ²²²8p »»»»»»›››‹‹‹¡¡¡ÊŸu5 9KÔ××çääääädgg—””˜:O œ:Ò††Ž/O}ÓÚcà˜[[[[÷¶0ÒçÕq¢CÖ¤ì{¬°ŸËáð úz/Þ�\£0[\µf¢}/‡gÐwô‡a™�ò9…ç¿{ÝÍJŸÇáptM¾úåé|ñÓy²ò›!o{÷7Ôár8|#Û±Á‡î50VQ“ôë"O+}.‡Ã72ccL™ìY�•ñ!oyYèp¸<}+÷¹Ûþ­ ™^OSåÃè�ï�Ô¿�pÒŽ»2…Y¢}âkg¨ÃápÖ#ïNªVú]BEQråÑ!7÷ÿ&üä©f"w¿3ˆ£ò?§[r 8<>Ÿ¯ódiÂþF<0³1™~1’{!L‡±Ó§�`H˜ìÎzÑë* 4“ÿlеåYÈÉ’¿Úñƒ~.îŽf|ÂÄwkZG¾{, ¹òž„|Æ¡–›½èÆÊÁŠ!§Hi]òúQz„ý;¥?̼¾þe°žw´¨1û·c0 Øz5áv¿{Þè£ò¦„¯Üù½ç†—µQKCjÈô—æÿžÑ@Q”´èØ[¶Ýáߥˆ)Š"s~ó7ÐuþøB9IÕ'¬m ï½>ULQ²GgWøM\s¡DJQTCòFCèýFx)EQTõÍ�Ó&|xü'öà¢!úÀí3nÆK€¦âÌüz(¹_ :ç�1#@à>kö0hL;u>›Ž•ÿ—Î}7¡7ô�§Mª P�óð± zy~âü޶:Àw˜4c¸ @}^f¡¨µ šÒO�Ï–�Ù˜ù¯ ÖÂÚï͉ý (¹WEÁ£_‰Q_;3Ƴ?Ö“¿Þ»ÿ¯ËF4›Qu7)»xö&9é¦ã–.¡¥WþŠ~ÔÆ;„äðÄ[»5•ÜKJ.y.…„´°¶ÕX¶3Ö;ÓFrëçåÛ³åSÍÆ}òÕG¾¬ bãÆ‹\ù÷,Ø#ÎÛO7�8Šy{*¢j•5è˜öµÔå¦?¨0uò°×àôqs±$®åæ¥=¬…AÆŠ=.®”˜ôîcÌ}R0ñôuH«J‹t-ûYð[{ÒŠ{wŠ¥ ÓßÝÅz öt4€¼òû�ÈÉ&^ª—þùÇ„?ΤNGÝ™Œœ5Ѷ½g͇ %Mú»�Ûw˜[oNlÞ�„ÑÜÞzí\[…!o¯òÓ+Æ�n}–N‹)TC^ü…³wÈ¢2é“ Ieè>kéÛý*OÄ®~q~?Ÿ·‚}Ú[QSòÁßck@ÇeÊ4g]€ÚšÊz€^/ã'§ìùFÆP •U"Å�—�ß}<‹óѯûöi¾ÒÚ¿H�à¥é¯:p[yRª±ªF  cdjHÏ&ô�{ñª«+j¥zÃ?ßÿ}bÀÇ‘.ö<¶Ê”h´Y²o϶¶&F&Î#‡,yxôûßçü4ÇæÑ‰Ï?ú#‡¢¾²J €!W †¼½ôíÇLp³h¾µ6åÄžM®j¹tõƒWÊtdu¥b0 (™DJQùÕ’«@Õ?PA=Mé¿|²%®�°zíó�F €"I € 8òŸõüÕ¿ò3kW) u]–üw¦M³=lýÍ-Ÿìº#áØÎ_½ØYêÒ"_/~²Ž©çŒ™¦$IÁyºï'úiHŠ€†‡1Ñwª�œ_–ÝN,Cõ©ÝG“&¯nØôðÂá‹›(ú1úCÞgóâìsþß¿OÞœx|éÈãK�0:yÜÐì³w¹:J^ßC€—ÐÚáɉ·×¶<ñÖxcå®Â‰7©¨®"á»Qz„0èdQmEÒæ— ÀznXnÅío›]ç9ý·C—ÐhdùùåÎzœ~³åIéi 1+qÏÞÕ]þО¢ïÂÈ ù›îý:ÕŠx}[Ól¥²¢ãoÛót¾{ªôÉ™²ªSïô—Oü-‡*Ø7Ù€ïñÉz‘Ü__1ÐõÞxGJÕ\þd(Ì'ÿö@L‰‹¯n|µ€7ä“+µ”èßÿ:Éòð=¾yúpŠ¢®}ìØìÄ==çÒo_}¸ä?+<�™s|¾5:îÿKSH9rå1œ]oòú«+?Ý� B~œKôŸ¿6h‡;dù¥GU•y½ÙìZ{ ºñcŒ }—eçËŸM.Ø` À÷ø¿$1EQ™½s‚€ÞÈMwž| ˆs�, @Xú‡¤7{r²ìüŠa0òþß�Zùä¦Ò»·n>ŸZXO5Ä~:˜ `5ûè#Š¢(ªöòG8}œ(§ê¯;p ×Ä_sž|GýhÀs^/’”?Hˆ“¯*!»úÙ ÷…\AíÕ�q�è¿èdÅ –@-àÏõv£(ª­E}Ç Þ-“J �¤DBòt¸Ü¾åù§I}ÏÁö–Ʀ©ÓìGrCrÈ›“Íç†Ý<ɪ�*_^3ùµMñ5:Žoï�Üìg,“É—Cô7ÅÓ0êòýÓ)Ÿ¹{ñž;‘T |wÿW¸Ðtÿ�…“þs4Gbâó͉#ïæ={ È #‚'ÍÛ™Þ ïºìÈß«‡ëËçñ-{Y>_�KÀxÛm÷rb�GΜӯöÖßóH°|iŠ·HÄ$4eÔƒ�!px:\RÜØDòÌx˜ `~q$I>kVA_?�ãøêK½yTmâo߸/ãØOžïcÚÖ‡€ä4ý-Ó�Ð{r¾ÅÀaž-¸Ú*ÞñFQ”$ë÷é½ ¾íì�~œaË×üî‰âòÓ‹m ΠObê)Š¢*šÝ Ssá=; —ÿî<æRŸÿÄ�¾ÚÄ34³05èéêêòu <¾ŠQU~:Èž À3sò›ài­ @XNÍ#)ªéÞo�}é#`=c+sC}=]]]>Ï"ðÏ"²ðØ"GúX‚'0531Ò×ÕÕÕÕÕ5·­õ«8c»o/Ðï7ò•—šðt]WÅÔREUœÿp0€câ>û³o¿[5ÇÝ”  çþßëµ­­ˆÌÜÐßÔÌÌÌDÀà˜š™Y8¾uôEÕÞüæ¥^ÀX òpw0ÕŽõëæµq·R„!W^;nk¥jn~3º@¯±[RD”8ó·)–Ñ{Ús„\®íâSâýü˯ß 3]Ïo’ž]–ü³È�Op-^Ù–ÚÆ/øœßüMy:üçéð <þO?².e× 8„nÿW×_§ÝÖ_[é¤×Ê-§ÿY$½³a„>¯ù,¾©ïöýz–�ù|¬}`Âíåt(óÙÍ{ÿZîÓG÷ÉoŽ~¿U‘y/8Œ&ìðíÅåé(âéôyãÈ#Š¢ªv-t7{ò£‡g6ì�}iõÊ~bˆ¢( y{TŸ ²!À|êω¹ùyŠò ³¢– åØÿè�×$ì˜é Çí;ã÷‡ôi%éÃÐeïoÙ»aÖó¡ž«¤Ê#ߦÏcé Yzæ±ÂsHªkš˜îñ~B&·F¢˜FRT‘—y?§¬Aª0Múâ’ÒVg‰¥ÌõHëeÝPXÕJÙ¤¨¢ óâÖf>÷rZyj‰ìÙc¤u¥¹™÷²Jj% +A/@Pma"š¬¦ðaQ-©ká`ßâþ�ÆÇy�êHŽ‘µ­9}ñ–ª¾_bë=Øð¹Å¨ê{éÕö.¶üò”³± ÏAºx1u% 9B,‡;„XCŽËaÈb9 9B,‡!Gˆå0䱆!–Ã�#Ärr„XCŽËaÈb9 9B,‡!Gˆå0䱆!–Ã�#Ärr„Xîÿ¯ rq5²IEND®B`‚democlock.qml000066400000000000000000000224021456160714700374470ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demo/data/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ import QtQuick 2.6 import QtQuick.Window 2.2 import org.ukui.appwidget 1.0 AppWidget { id: window //注1:appname必须赋值 appname: "democlock" //注2:å°�æ�’ä»¶çš„ä½�置应该设置为居中 anchors.centerIn: parent //注3:å°�æ�’件应考虑在ä¸�å�Œç¼©æ”¾ä»¥å�Šåˆ†è¾¨çŽ‡ä¸‹çš„é€‚é…� //å�¯ä»¥é‡‡ç”¨å¦‚下方å¼�计算缩放比scalefactor(仅供å�‚考,å�ªè¦�能实现å°�æ�’ä»¶æ ¹æ�®çˆ¶ç±»çª—å�£ç¼©æ”¾å�³å�¯ï¼‰ width: 740 * scalefactor height: 680 * scalefactor property double scalefactor: 1.00 visible: true //注4:clickable为当å‰�å°�æ�’件是å�¦å�¯ä»¥è¿›è¡Œæ“�作的标志,当clickable为 false时, //å°�æ�’ä»¶ä¸�å�¯ç‚¹å‡»ï¼Œä¸�能接收焦点等。该状æ€�的决定由使用端传递并更新 property bool clickable: true property var date : "" property var aclock : "" Canvas { id: canvas anchors.fill: parent width: 740 * scalefactor height: 680 * scalefactor onPaint: { var ctx = getContext("2d"); drawBack(ctx); drawDot(ctx); var date = new Date(); var hours = date.getHours() hours = hours % 12; var minutes = date.getMinutes() var seconds = date.getUTCSeconds(); var timestr = date.toLocaleString("yyyy-MM-dd hh:mm:ss"); drawSecond(seconds, ctx); drawHour(hours, minutes, ctx); drawMinute(minutes, seconds, ctx); drawSecond(seconds, ctx); } Text { id: datetext color: "black" text: qsTr("日期:" + date) anchors.horizontalCenter: parent.horizontalCenter anchors.leftMargin: 1 y : 350 * scalefactor font.pointSize: 12 * scalefactor font.bold: true } Text { id: clocktext color: "black" text: qsTr("日期:" + aclock) wrapMode: Text.WordWrap anchors.horizontalCenter: parent.horizontalCenter anchors.leftMargin: 1 y : 370 * scalefactor font.pointSize: 12 * scalefactor font.bold: true } } MouseArea { id: mousearea anchors.fill: parent //注5:如果使用MouseArea需è¦�注æ„�enabled需è¦�与window.clickable一致 enabled: window.clickable //注6:事件é€�传,在å°�æ�’件中部分事件需è¦�é€�传到使用端处ç�†ï¼Œå¦‚onPressAndHold,其他的暂时未å�‘现需è¦�设置 //如需è¦�实现onClicked,则注æ„�onPressed一定ä¸�è¦�é€�传,å�¦åˆ™å°�æ�’件自身将ä¸�能得到点击事件 propagateComposedEvents: true onClicked: { //点击需è¦�进行的跳转 window.qmlclickedsignal("democlock", "clicked"); mouse.accepted = false } //注7:onPressAndHold事件需è¦�é€�传,å�¦åˆ™å°†ä¸�能实现长按进入编辑状æ€�(ä¸�能长按进行拖动) onPressAndHold: { mouse.accepted = false } } function drawBack(ctx) { var r = 200 * scalefactor; ctx.save(); ctx.beginPath(); ctx.translate(width / 2,height / 2); ctx.clearRect(-r, -r, r * 2, r * 2); ctx.lineWidth = 10; ctx.arc(0, 0, r - 5, 0, Math.PI * 2, false); //外圆 ctx.stroke(); //画文本 var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; ctx.font = "18px Arial"; ctx.textAlign = "center"; ctx.textBaseline = "middle"; for(var i = 0; i < 12; ++i) { var rad = 2 * Math.PI / 12 * numbers[i] - 3.14 / 2; var x = Math.cos(rad) * (r-30); var y = Math.sin(rad) * (r-30); ctx.fillText(numbers[i], x, y); } //画刻度 ctx.lineWidth = 2; for(var i = 0; i < 60; ++i) { ctx.beginPath(); var rad = 2 * Math.PI / 60 * i; var x = Math.cos(rad) * (r - 15); var y = Math.sin(rad) * (r - 15); var x2 = Math.cos(rad) * (r - 10); var y2 = Math.sin(rad) * (r - 10); //通过画线也å�¯ä»¥ if(i%5 === 0) { ctx.strokeStyle = "#000000"; }else { ctx.strokeStyle = "#989898"; } ctx.moveTo(x, y); ctx.lineTo(x2, y2); ctx.stroke(); } ctx.restore(); } function drawHour(hour, minute, ctx) { var r = 200 * scalefactor; ctx.save(); ctx.beginPath(); //必须写 ctx.lineWidth = 7; ctx.lineCap = "round"; ctx.translate(width / 2,height / 2); var rad = Math.PI * 2 / 12 * hour + Math.PI * 2 * minute / 12 / 60 - Math.PI; ctx.rotate(rad); ctx.moveTo(0, -10); ctx.lineTo(0, r / 2 - 10); ctx.stroke(); //必须写(填充方å¼�) ctx.restore(); } function drawMinute(minute, second, ctx) { var r = 200 * scalefactor; ctx.save(); ctx.beginPath(); //必须写 ctx.lineWidth = 5; ctx.lineCap = "round"; ctx.translate(width / 2,height / 2); var rad = Math.PI * 2 * minute / 60 + Math.PI * 2 * second / 60 / 60 - Math.PI; ctx.rotate(rad); ctx.moveTo(0, -10); ctx.lineTo(-10, r * 3 / 5 - 10); ctx.stroke(); //必须写(填充方å¼�) ctx.restore(); } function drawSecond(second, ctx) { var r = 200 * scalefactor; ctx.save(); ctx.beginPath(); //必须写 ctx.lineWidth = 3; ctx.lineCap = "round"; ctx.translate(width / 2, height / 2); ctx.strokeStyle="#ff0000"; var rad = Math.PI * 2 * second / 60 - Math.PI; ctx.rotate(rad); ctx.moveTo(0, -20); ctx.lineTo(0, r * 4 / 5 - 10); ctx.stroke(); //必须写(填充方å¼�) ctx.restore(); } function drawDot(ctx) { ctx.save(); ctx.beginPath(); //必须写 ctx.translate(width / 2, height / 2); ctx.fillStyle = "#ffffff"; ctx.arc(0, 0, 3, 0, Math.PI * 2); ctx.fill(); //必须写(填充方å¼�) ctx.restore(); } Component.onCompleted: { console.log("qml 接收到数æ�®æ›´æ–°ä¿¡å�·"); window.update.connect(window.onupdate); //注8:åˆ�始化缩放比 initScalefactor() //注9:监å�¬ä½¿ç”¨ç«¯çжæ€�改å�˜ä¿¡å�·ï¼Œç”¨äºŽæ›´æ–°clickable userStatusChangedSignal.connect(onUserStatusChanged) } function onupdate() { for (var i in window.datavalue) { var info = window.datavalue[i]; if( i === "date") { console.log("date", info); datetext.text = qsTr("日期:" + info) } if( i === "AlarmClock") { console.log("alarmClock", info); clocktext.text = qsTr("闹钟" + info) } } } //定时器 Timer { interval: 1000; running: true; repeat: true onTriggered: canvas.requestPaint(); } function initScalefactor() { //注10:按宽计算缩放比例,计算在这个比例系数下的å°�æ�’件宽高,如果高超出父类的高,则更æ�¢æ¯”例系数的计算方å¼�,按高计算缩放比例 //console.log("父类窗å�£å¤§å°�", window.parent.width,window.parent.height); if(window.parent.width == 0 || window.parent.height == 0) { window.scalefactor = 1.0 console.log("父类窗å�£å¤§å°�为 0 默认缩放比为1.0") return } //注11:640为默认情况下demosearch的宽度 window.scalefactor = window.parent.width / 740 //console.log("当å‰�比例系数", window.scalefactor); //注12:100为默认情况下demosearch的高度 var tw = window.scalefactor * 740 var th = window.scalefactor * 680 //console.log("大å°�:", tw,th ,window.height); //注13:当按宽缩放时,父类窗å�£çš„高å°�于å°�æ�’件缩放å�Žå®žé™…的高时则é‡�新以高度计算缩放比 if(th > window.parent.height) { window.scalefactor = window.parent.height / 680 //console.log("以宽度计算比例系数", appwidget.scalefactor); } } function onUserStatusChanged(status) { console.log("qml Appwidget demosearch user status changed ", status); if(status === "Normal") { window.clickable = true; }else if(status === "Editable") { window.clickable = false; } } } main.cpp000066400000000000000000000021611456160714700355130ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demo/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "mainwindow.h" #include #include int main(int argc, char *argv[]) { QtSingleApplication a("appwidgetprovider-clock-demo", argc, argv); if(a.isRunning()) { a.sendMessage("raise_window_noop"); return EXIT_SUCCESS; } MainWindow w; a.setActivationWindow(&w);//å�•例 w.show(); return a.exec(); } mainwindow.cpp000066400000000000000000000145021456160714700367450ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demo/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "mainwindow.h" #include "ui_mainwindow.h" #include #include #include #include #include #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); //åˆ�始化界é�¢ for (int h = 0; h < 24; h++) { ui->comboBox->addItem(QString::number(h)); } for (int m = 0; m < 60; m++) { ui->comboBox_2->addItem(QString::number(m)); } for (int s = 0; s < 60; s++) { ui->comboBox_3->addItem(QString::number(s)); } ui->dateEdit->setDate(QDate::currentDate()); ui->comboBox->setCurrentText(QString::number(QTime::currentTime().hour())); ui->comboBox_2->setCurrentText(QString::number(QTime::currentTime().minute())); ui->comboBox_3->setCurrentText(QString::number(QTime::currentTime().second())); //加载å°�æ�’ä»¶demoçš„qml ui,但是加上å�Žå�¯åŠ¨å¤ªæ…¢ï¼Œå…ˆåŽ»æŽ‰ // QQuickView *p=new QQuickView(); // QString path=QString("qrc:/clock.qml"); // qDebug()<<"path"<setSource(url); // QWidget*w= QWidget::createWindowContainer(p,this); // w->setFixedSize(370,340); // ui->verticalLayout_3->addWidget(w); timer = new QTimer(this); connect(timer, &QTimer::timeout, this, [=](){ // qDebug()<<"timer update"; ui->dateEdit->setDate(QDate::currentDate()); ui->comboBox->setCurrentText(QString::number(QTime::currentTime().hour())); ui->comboBox_2->setCurrentText(QString::number(QTime::currentTime().minute())); ui->comboBox_3->setCurrentText(QString::number(QTime::currentTime().second())); }); timer->start(1000); //闹钟记录的数æ�®å­˜æ”¾ä½�ç½® QString path1 = QDir::homePath() + "/.config/appwidgetclock/config.ini"; setting = new QSettings(path1, QSettings::IniFormat); //clcokå°�æ�’ä»¶çš„å�Žå�°æœ�务dbus接å�£ appwidgetinterface = new QDBusInterface("org.ukui.appwidget.provider.democlock", "/org/ukui/appwidget/provider", "org.ukui.appwidget.provider.democlock", QDBusConnection::sessionBus()); //åˆ�始化闹钟列表 ui->listView->setViewMode(QListView::ListMode); itemmode = new QStandardItemModel(this); ui->listView->setModel(itemmode); setting->beginGroup("AlarmClock"); QStringList AlarmClocklist = setting->allKeys(); for (int i = 0; iappendRow(item); } setting->endGroup(); setting->sync(); //监控闹钟列表的点击事件,进行删除闹钟 connect(ui->listView, &QListView::pressed, this, [=]() { QString key = itemmode->item(ui->listView->currentIndex().row())->text(); setting->beginGroup("AlarmClock"); setting->remove(key); setting->endGroup(); setting->sync(); appwidgetinterface->asyncCall("appWidgetUpdate"); ui->listView->model()->removeRow(ui->listView->currentIndex().row()); }); } MainWindow::~MainWindow() { delete ui; delete appwidgetinterface; delete setting; delete itemmode; } void MainWindow::on_pushButton_clicked() { //设置修改日期和时间,qml的图形钟表会自动根æ�®ç³»ç»Ÿæ—¶é—´è¿›è¡Œæ›´æ”¹ï¼Œåœ¨qml中内部有逻辑处ç�†ï¼Œè¿™é‡Œæ›´æ”¹å�Žé€šçŸ¥å°�æ�’件更改的主è¦�是日期 QDate date = ui->dateEdit->date();// 日期 int year = date.year(); // å¹´ int month = date.month(); // 月 int day = date.day(); // æ—¥ int hour = ui->comboBox->currentText().toInt(); int min = ui->comboBox_2->currentText().toInt(); int sss = ui->comboBox_3->currentText().toInt(); qDebug() << "日期andæ—¶é—´" << year << month << day << hour << min << sss; QString m_qstrDateTime = QString("%1%2%3%4%5.%6"). arg(month, 2, 10, QChar('0')). /*月份,必须两ä½�*/ arg(QString("%1").arg(day, 2, 10, QChar('0')))./*日,必须两ä½�*/ arg(hour, 2, 10, QChar('0')). /*å°�时,必须两ä½�*/ arg(min, 2, 10, QChar('0')). /*分钟,必须两ä½�*/ arg(year). /*年份,必须4ä½�*/ arg(sss, 2, 10, QChar('0')); /*秒,必须两ä½�*/ //设置时间需è¦�æ��æ�ƒï¼Œå¯¹åº”电脑的密ç �需è¦�改一下。 qDebug() << m_qstrDateTime; QString qstrDateTime = QString("/bin/sh -c \"echo \"%1\" | sudo -S date %2\"").arg("123123.."/*电脑密ç �*/).arg(m_qstrDateTime); qDebug() << qstrDateTime; QProcess::execute(qstrDateTime); QString qstrSaveTime = QString("/bin/sh -c \"echo \"%1\" | sudo -S hwclock --systohc\"").arg("123123.."/*电脑密ç �*/); QProcess::execute(qstrSaveTime); //通过å�Žå�°æœ�务通知管ç�†æœ�务更新 appwidgetinterface->asyncCall("appWidgetUpdate"); } void MainWindow::on_pushButton_2_clicked() { setting->beginGroup("AlarmClock"); QString value = ui->timeEdit->text(); if(setting->contains(value)) { qDebug()<<" å·²ç»�存在该时间的闹钟"; QMessageBox::critical(this, "æ��示","å·²ç»�存在该时间的闹钟,请æ�¢ä¸€ä¸ªæ—¶é—´ç‚¹"); setting->endGroup(); setting->sync(); return ; } setting->setValue(value, true); setting->endGroup(); setting->sync(); QStandardItem *item = new QStandardItem(value); itemmode->appendRow(item); appwidgetinterface->asyncCall("appWidgetUpdate"); } mainwindow.h000066400000000000000000000026441456160714700364160ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demo/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include #include #include #include QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); private slots: void on_pushButton_clicked(); void on_pushButton_2_clicked(); private: Ui::MainWindow *ui; QWidget * wid = nullptr; QTimer *timer = nullptr; QSettings * setting = nullptr; QDBusInterface *appwidgetinterface = nullptr; QStandardItemModel * itemmode = nullptr; }; #endif // MAINWINDOW_H mainwindow.ui000066400000000000000000000102241456160714700365750ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demo MainWindow 0 0 800 600 0 0 MainWindow 20 16777215 : 20 16777215 : 设置 Qt::Horizontal 40 20 设置闹钟: 设置 0 0 Qt::Horizontal 40 20 闹钟记录: 0 0 800 28 src.qrc000066400000000000000000000003221456160714700353560ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demo config.ini data/democlock.qml data/democlock.png data/democlock.conf translations/000077500000000000000000000000001456160714700366045ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demodemoclock_bo_CN.ts000066400000000000000000000021641456160714700421570ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demo/translations MainWindow MainWindow : 设置 设置闹钟: 闹钟记录: democlock_zh_CN.ts000066400000000000000000000021641456160714700422000ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-demo/translations MainWindow MainWindow : 设置 设置闹钟: 闹钟记录: appwidgetprovider-clock-service/000077500000000000000000000000001456160714700345775ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demoappwidgetprovider-clock-service.pro000066400000000000000000000034141456160714700436110ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-serviceQT -= gui QT += dbus CONFIG += c++11 console CONFIG -= app_bundle # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ clockprovider.cpp \ main.cpp \ # Default rules for deployment. qnx: target.path = /usr/bin else: unix:!android: target.path = /usr/bin clockservice.files += provider/org.ukui.appwidget.provider.democlock.service clockservice.path += /usr/share/dbus-1/services/ !isEmpty(target.path): INSTALLS += target clockservice HEADERS += \ clockprovider.h \ RESOURCES += \ provider/src.qrc #QMAKE_LFLAGS += -Wl,-rpath=$$OUT_PWD/../../../libukui-app-widget/libukui-appwidget-manager/ #QMAKE_LFLAGS += -Wl,-rpath=$$OUT_PWD/../../../libukui-app-widget/libukui-appwidget-provider/ LIBS += -L$$OUT_PWD/../../../libukui-app-widget/libukui-appwidget-manager -lukui-appwidget-manager LIBS += -L$$OUT_PWD/../../../libukui-app-widget/libukui-appwidget-provider -lukui-appwidget-provider INCLUDEPATH += $$PWD/../../../libukui-app-widget/libukui-appwidget-manager DEPENDPATH += $$PWD/../../../libukui-app-widget/libukui-appwidget-manager INCLUDEPATH += $$PWD/../../../libukui-app-widget/libukui-appwidget-provider DEPENDPATH += $$PWD/../../../libukui-app-widget/libukui-appwidget-provider clockprovider.cpp000066400000000000000000000055661456160714700401650ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-service/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "clockprovider.h" #include #include #include #include #include #include ClockProvider::ClockProvider(QString providername ,QObject *parent) : KAppWidgetProvider(providername , parent) { if(manager) { manager = new AppWidget::KAppWidgetManager(this); } } void ClockProvider::appWidgetRecevie(const QString &eventname, const QString &widgetname, const QDBusVariant &value) { Q_UNUSED(eventname); Q_UNUSED(widgetname); Q_UNUSED(value); qDebug() << "TestProvider::appWidgetRecevie"; } void ClockProvider::appWidgetUpdate() { qDebug() << "TestProvider::appWidgetUpdate"; QStringList message; QString path = QDir::homePath() + "/.config/appwidgetclock/config.ini"; setting = new QSettings(path, QSettings::IniFormat); dateTime = QDateTime::currentDateTime(); setting->beginGroup("AlarmClock"); QStringList ll = setting->allKeys(); for (int var = 0; var < ll.count(); var++) { message << ll.at(var); } setting->endGroup(); setting->sync(); //需è¦�将传递的消æ�¯ç”¨QDBusVariantå°�装,并用QVariantå°�装传递出去 QVariantMap m; m.insert("date" , dateTime.toString("yyyy-MM-dd")); m.insert("AlarmClock" , message); qDebug() << "QVariantMap:" << m; if(manager) { manager->updateAppWidget("democlock", m); qDebug() << "æ›´æ–°"; } if(setting) { delete setting; } } void ClockProvider::appWidgetDisable() { qDebug() << "TestProvider::appWidgetDisable"; if(manager) { delete manager; } qApp->exit(); } void ClockProvider::appWidgetDeleted() { qDebug() << "TestProvider::appWidgetDeleted"; } void ClockProvider::appWidgetEnable() { qDebug() << "TestProvider::appWidgetEnable"; if(!manager) { manager = new AppWidget::KAppWidgetManager(this); } } void ClockProvider::appWidgetClicked(const QString &widgetname, const QDBusVariant &value) { qDebug() << "TestProvider::appWidgetClicked"; Q_UNUSED(widgetname); Q_UNUSED(value); QProcess::startDetached("appwidgetprovider-clock-demo"); } clockprovider.h000066400000000000000000000031771456160714700376260ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-service/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef CLOCKPROVIDER_H #define CLOCKPROVIDER_H #include #include #include namespace AppWidget { class KAppWidgetManager; } class QTimer; class QSettings; class QDBusInterface; class ClockProvider:public AppWidget::KAppWidgetProvider { public: ClockProvider(QString providername = "democlock",QObject *parent = nullptr); void appWidgetRecevie(const QString &eventname, const QString &widgetname, const QDBusVariant &value); void appWidgetUpdate(); void appWidgetDisable(); void appWidgetDeleted(); void appWidgetEnable(); void appWidgetClicked(const QString &widgetname, const QDBusVariant &value); private: AppWidget::KAppWidgetManager * manager = nullptr; QDBusInterface *searchinterface = nullptr; QVariant m_date; QDateTime dateTime; QTimer *timer; QSettings *setting = nullptr; }; #endif // CLOCKPROVIDER_H main.cpp000066400000000000000000000016271456160714700362350ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-service/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include #include "clockprovider.h" int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); ClockProvider p; return a.exec(); } provider/000077500000000000000000000000001456160714700364315ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-serviceorg.ukui.appwidget.provider.democlock.service000066400000000000000000000001511456160714700473260ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-service/provider[D-BUS Service] Name=org.ukui.appwidget.provider.democlock Exec=/usr/bin/appwidgetprovider-clock-service src.qrc000066400000000000000000000001741456160714700377310ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-clock-demo/appwidgetprovider-clock-service/provider org.ukui.appwidget.provider.democlock.service ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/000077500000000000000000000000001456160714700265425ustar00rootroot00000000000000appwidgetprovider-search-demo.pro000066400000000000000000000043171456160714700351360ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demoQT -= gui QT += dbus widgets CONFIG += c++11 console CONFIG -= app_bundle # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ searchprovider.cpp TRANSLATIONS += \ translations/demosearch_zh_CN.ts \ translations/demosearch_bo_CN.ts # Default rules for deployment. qnx: target.path = /usr/bin else: unix:!android: target.path = /usr/bin qm_files.files += translations/* qm_files.path = /usr/share/appwidget/translations/ qml.files += provider/data/demosearch.qml qml.path = /usr/share/appwidget/qml/ appwidgetcong.files += provider/data/demosearch.conf appwidgetcong.path = /usr/share/appwidget/config/ service.files += provider/org.ukui.appwidget.provider.demosearch.service service.path += /usr/share/dbus-1/services/ preview.files += provider/data/demosearch.png preview.path = /usr/share/appwidgetdemo/search/ svg.files += provider/data/ukui-search.svg svg.path = /usr/share/appwidgetdemo/search/ INSTALLS += target qml appwidgetcong service preview svg qm_files HEADERS += \ searchprovider.h RESOURCES += \ provider/src.qrc #QMAKE_LFLAGS += -Wl,-rpath=$$OUT_PWD/../../libukui-app-widget/libukui-appwidget-provider/ LIBS += -L$$OUT_PWD/../../libukui-app-widget/libukui-appwidget-manager -lukui-appwidget-manager LIBS += -L$$OUT_PWD/../../libukui-app-widget/libukui-appwidget-provider -lukui-appwidget-provider INCLUDEPATH += $$PWD/../../libukui-app-widget/libukui-appwidget-manager DEPENDPATH += $$PWD/../../libukui-app-widget/libukui-appwidget-manager INCLUDEPATH += $$PWD/../../libukui-app-widget/libukui-appwidget-provider DEPENDPATH += $$PWD/../../libukui-app-widget/libukui-appwidget-provider ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/main.cpp000066400000000000000000000016321456160714700301740ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include #include "searchprovider.h" int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); SearchProvider p ; return a.exec(); } ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/provider/000077500000000000000000000000001456160714700303745ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/provider/data/000077500000000000000000000000001456160714700313055ustar00rootroot00000000000000demosearch.conf000066400000000000000000000007611456160714700342130ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/provider/data[AppWidget] name = demosearch providerName = demosearch previewPath = /usr/share/appwidgetdemo/demosearch/demosearch.png qmlFile = /usr/share/appwidget/qml/demosearch.qml zoom = false rightButton = false repeatPlacement = false minWidget = 640 minHeight = 100 targetCellWidth = 3 targetCellHeight = 1 updatePeriodMillis = 0 describe = this is a search demo [LanguageFiles] zh_CN = /usr/share/appwidget/translations/demosearch_zh_CN.qm bo_CN = /usr/share/appwidget/translations/demosearch_bo_CN.qm demosearch.png000066400000000000000000000050001456160714700340410ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/provider/data‰PNG  IHDR©d³OXÒ pHYsÄÄ•+ ²IDATxœíÝkpUÕÆñç]ç’`È „ ‘«ÑT1€JÔpK"- T¨XDE2oµ8­­Uk§µ�‚à(Ö¤`+b±ãD¬¢+A2€0*(äv’(†�sÖÛЪö> %f=¿�™½VÖ§ÿì³oKTDDŽ1§{DD§ÛGD.bûˆÈEl¹ˆí#"±}Dä"¶�ˆ\Äö‘‹Ø>"rÛGD.bûˆÈEl¹ˆí#"±}Dä"¶�ˆ\Äö‘‹Ø>"rÛGD.bûˆÈEl¹ˆí#"±}Dä"¶�ˆ\Äö‘‹Ø>"rÛGD.bûˆÈEl¹ˆí#"±}Dä"¶�ˆ\l³™êku÷6-/Cù­©Äõ8ÔÐf“‘³D"þ IË@f¶É‡^m0«ª¶r ýà=--ÑÒILÁ€,韅ŒA’˜Šän­_µ^äšìÓ½„¶Œ‘¾™’7IFNhÍ4­k_¨Ê¾X¬ëVHN� Ï—a£Z³":E:TûþM2³Má\¤ˆrxÔíÓͯëÊÅèš$ã§É�Üè&!¢ÿƒÙ>ˆë"WM7WF14Êë}ºþy»|�L6×ÌF°í.y×xHÿ²ÄÖ0?žçwh4ÙÒõÏÛ§~m¦Ý)ã¦F1œˆ¨ÍX«%«-à7¾ŸqÑͯÛå >"j?tý»f™¯!>ÛªÒ•‹¥`2ÃGD툵úÂ3øäCï#üµÏ¾XŒ®IæšÙ>×EDtŠ5²Ëõ~¸�öéïéº2~onQ;¤»¶êkk=ì§}¥%’SÀÇYˆ¨ÝÒWV{<Òsûêkµ´D†çG¹""êȤà6sýÍÒ«Å�Â@.½ÅÜt‡ô�;Ùè¡rãOÍŒ’ØÚuèÞ]Ø_áåH¯¿^u÷6ILá›DôM ιR.> ¯= ±gÉ·›qiº½Yr“ñùûHïŸéÆÍ°IÔ_‚r|´fÈeSÄlÐMCD[œ�5WéðõúE¸Ù¾±Î\;ç¤z¾rW^†Y~–@D3̓ÏHºEy šû@÷|3a|´Änܬ’$ÓŠÌÀد�aîqÂÊ‹ìüg|¿z¶k«—£<Ÿ÷•ï�­zs˜ˆ:¦¬©æ‚îè&@œŒš-Ÿï‡*vEø+&<°ã7‘¿­0÷/•£Ó:<{��iyÞ—.³ïó¦]¼ ¶Åß›FñÊ­¶ñoÞšJÉäDÔÑ%•«FRd|”,Týn�g7Þ¸c4:ÇàS@ï±2)j�Ï`b¥ ý䪰-r'õX>O÷ñ·žÆC^Žòü›÷‹zIâ7©ˆèkvÙ»ÿˆÉ¿3C+õÑ_jMª ì{ÕnØ„„@ÃV»ú äÝ$G³¦]00[Âuh ›!.±a4t’ž}ŽOŸ‚à^Dñµ•p³—£<·ïP’Rý®�ˆ:¾º ­K”°ÐÐ^=è$Éýqf<ƒ³úJcgȉÛò«ÈÂW‘4Xn¼ßä$cÏ öñ"­í-G¡d™Vv•¹Ï™ÁQ­Ç[-=·¯KW„ªù9R"úßâåÚ'¤âe47¢÷HI�!"£¦À*ÁÇ´o­ÕP¹åisé½­Z¬Ÿ|…Á÷š«ÇJ|z4Ø¥Gùzýâ°FädÿôkÄÓÏíKHÔúaûˆèA )4®��)¦ÊÐ^ø²82?F FÆ/5SSõ‘ivw#DÑ€}kíâµH½Òüv0b"H&Ó‡ =Œ²?Ûue‘�ôµºúÁ(¿-ð”5¯í“Ô¨x¼ÝAD'Cz˹é°@x§ÎŸi÷ŸcyI’�!F~²:V˜ÃúV‘]þ "€Ð«ö�ƒRPh.φ„ô�Uºfµ<‚žcÌÙ¹2o™ͱ›*£YQü^Žò|Þ×?KËËdä•Ñ,…ˆ:°=Åöž§1q©¹ÚÜD´ú€ô<5ÛtäØ1=/�ä >*;¾‹î57~Oº'M�dH¡\2ªPÀ`úÉ�O˜…³ì;¾ó'ižv2ò|Þ×?KŸÊï"ˆ¨ã íÒP¢¨€MÛuÉôç %íL¼t·ÝÐ S3YA¼ó{ûÆ�cCöU R­;¶¢¶uÕZ[‹ïÎ0CŽè»ힰ$„µù3ÿ6¹(G¶¿ M>דééý^ßç•ÌÁZ_«›þásDä€/7Ù‡îÒ�“dfqà©5æûðîcvÑZü瑾Ϟµ÷ÎÕê4¹ü éÙ„7^ÂÑmMš™¹Ä<¼*0¥«><)²Èø‚1&wœ§½ÎØ5E†çki _é%¢ôÈ‘¡ƒ¤g,l3Lzõ–Œ,š'=:ÄÅÀ)2ëLlÛ‚�[´>Qògˤ±r†bÇsv{Î-Ý;C£æŸö±Ûäº̘9æü Zü3ûòN_ïóJßL�»÷úøŸ Ï·÷ÏÐKÇò3VDt\M-rgÉÙ�P±µqrË3,¶oêÊ•vk½Œ¸^F�”œä¼t;#"Š´sêâûì†J™µÊŒþ„¶hU#¾úPŸ¼!òöLsëdôJCÌNøy­Cò&y=Ò×SÓvùìÝiæ=ÎÏ—}‹œâ=*ã‘y¡DöëÞ „�³.’Øúé>4µxk  i’بûª@bÓ„# iä›Aý§ºïs„[ä(D$ ?$3ÛüÂëm Ÿûó†ªìCspáeæºÛ}­‰ˆN£»?oKq]>í}«rŸ{%w—ݪ%Ïéºbß+#":EL@&N÷>D±G¥ É5×ßiW,`þˆ¨��1Í } ‰æ²�Œ¹Úvù©«1SfóÚ�6& c&úݘѵGó—ÔMW.²åe2~ïüÑi×E&N÷{Æw”Ï{ÿ%Te_,Öu+$§@†çóÑ?¢ö©CÞë�ÌlS8××5¾†·ª}ŽîÛ[Z¢¥%’˜‚þY2 ƒ$©¿÷GÔNt¨öc¤o¦äM’‘­ÚE£ ÚwLCHw½«åe(/Cm¥6ÔáPCÛÌLD.A ñ]$-™Ù&w"rÛGD.bûˆÈEl¹ˆí#"±}Dä"¶�ˆ\Äö‘‹Ø>"rÛGD.bûˆÈEl¹ˆí#"±}Dä"¶�ˆ\Äö‘‹Ø>"rÛGD.bûˆÈEl¹ˆí#"±}Dä"¶�ˆ\Äö‘‹Ø>"rÛGD.bûˆÈEl¹ˆí#"±}D䢸ä_{½¡—IEND®B`‚demosearch.qml000066400000000000000000000132111456160714700340510ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/provider/data/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 2.5 import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 import org.ukui.appwidget 1.0 AppWidget { id: window //注1:appname需è¦�å°�æ�’件赋值 appname: "demosearch" //å°�æ�’ä»¶çš„ä½�置应该设置为居中 anchors.centerIn: parent //注2:å°�æ�’件应考虑在ä¸�å�Œç¼©æ”¾ä»¥å�Šåˆ†è¾¨çŽ‡ä¸‹çš„é€‚é…� //å�¯ä»¥é‡‡ç”¨å¦‚下方å¼�计算缩放比scalefactor(仅供å�‚考,å�ªè¦�能实现å°�æ�’ä»¶æ ¹æ�®çˆ¶ç±»çª—å�£ç¼©æ”¾å�³å�¯ï¼‰ width: 640 * scalefactor height: 100 * scalefactor property double scalefactor: 1.00 visible: true //注3:qmlenable为当å‰�å°�æ�’件是å�¦å�¯ä»¥è¿›è¡Œæ“�作的标志,当clickable为 false时, //å°�æ�’ä»¶ä¸�å�¯ç‚¹å‡»ï¼Œä¸�能接收焦点等。该状æ€�的决定由使用端传递并更新 property bool clickable: true Rectangle { id: searchBar anchors.centerIn: parent width: 400 * scalefactor height: 35 * scalefactor border.color: "#fc5531" border.width: 1 radius: searchBar.height / 2 Rectangle { id: btn width: 80 * scalefactor height: searchBar.height anchors.right: parent.right anchors.top: parent.top color: "#fc5531" layer.enabled: true layer.effect: OpacityMask { maskSource: Rectangle { width: 80 * scalefactor height: btn.height radius: btn.height / 2 //左侧 Rectangle { width: 20 * scalefactor height: btn.height } } } Image { id: image_search width: 20 * scalefactor height: 20 * scalefactor x: 10 anchors.verticalCenter: parent.verticalCenter source: "file:///usr/share/appwidgetdemo/search/ukui-search.svg" } Text { id: searchTxt color: "White" text: qsTr("search") anchors.verticalCenter: parent.verticalCenter anchors.left: image_search.right anchors.leftMargin: 1 font.pointSize: 12 * scalefactor font.bold: true } } } MouseArea { anchors.fill: parent //注4:如果使用MouseArea需è¦�注æ„�enabled需è¦�与window.clickable一致 enabled: window.clickable //注5:事件é€�传,在å°�æ�’件中部分事件需è¦�é€�传到使用端处ç�†ï¼Œå¦‚onPressAndHold,其他的暂时未å�‘现需è¦�设置 //如需è¦�实现onClicked,则注æ„�onPressed一定ä¸�è¦�é€�传,å�¦åˆ™å°�æ�’件自身将ä¸�能得到点击事件 propagateComposedEvents: true onClicked: { //点击需è¦�进行的跳转 qmlclickedsignal("demosearch", "clicked"); mouse.accepted = false } //注6:onPressAndHold事件需è¦�é€�传,å�¦åˆ™å°†ä¸�能实现长按进入编辑状æ€�(ä¸�能长按进行拖动) onPressAndHold: { mouse.accepted = false } } Component.onCompleted: { //注7:åˆ�始化缩放比 initScalefactor() //监å�¬ä½¿ç”¨ç«¯çжæ€�改å�˜ä¿¡å�·ï¼Œç”¨äºŽæ›´æ–°clickable userStatusChangedSignal.connect(onUserStatusChanged) } function initScalefactor() { //按宽计算缩放比例,计算在这个比例系数下的å°�æ�’件宽高,如果高超出父类的高,则更æ�¢æ¯”例系数的计算方å¼�,按高计算缩放比例 //console.log("父类窗å�£å¤§å°�", window.parent.width,window.parent.height); if(window.parent.width == 0 || window.parent.height == 0) { window.scalefactor = 1.0 console.log("父类窗å�£å¤§å°�为 0 默认缩放比为1.0") return } //640为默认情况下demosearch的宽度 window.scalefactor = window.parent.width / 640 //console.log("当å‰�比例系数", window.scalefactor); //100为默认情况下demosearch的高度 var tw = window.scalefactor * 640 var th = window.scalefactor * 100 //console.log("大å°�:", tw,th ,window.height); //当按宽缩放时,父类窗å�£çš„高å°�于å°�æ�’件缩放å�Žå®žé™…的高时则é‡�新以高度计算缩放比 if(th > window.parent.height) { window.scalefactor = window.parent.height / 100 //console.log("以宽度计算比例系数", appwidget.scalefactor); } } function onUserStatusChanged(status) { console.log("qml Appwidget demosearch user status changed ", status); if(status === "Normal") { window.clickable = true; }else if(status === "Editable") { window.clickable = false; } } } ukui-search.svg000066400000000000000000000032201456160714700341640ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/provider/data ukui-global search-search org.ukui.appwidget.provider.demosearch.service000066400000000000000000000001501456160714700413630ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/provider[D-BUS Service] Name=org.ukui.appwidget.provider.demosearch Exec=/usr/bin/appwidgetprovider-search-demo ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/provider/src.qrc000066400000000000000000000004431456160714700316730ustar00rootroot00000000000000 data/demosearch.conf data/demosearch.png data/ukui-search.svg data/demosearch.qml org.ukui.appwidget.provider.demosearch.service ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/searchprovider.cpp000066400000000000000000000040411456160714700322650ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "searchprovider.h" #include #include #include SearchProvider::SearchProvider(QString providername ,QObject *parent) : KAppWidgetProvider(providername , parent) { searchinterface = new QDBusInterface("com.ukui.search.service", "/", "org.ukui.search.service", QDBusConnection::sessionBus()); } void SearchProvider::appWidgetRecevie(const QString &eventname, const QString &widgetname, const QDBusVariant &value) { Q_UNUSED(eventname); Q_UNUSED(widgetname); Q_UNUSED(value); qDebug() << "TestProvider::appWidgetRecevie"; } void SearchProvider::appWidgetUpdate() { qDebug() << "TestProvider::appWidgetUpdate"; } void SearchProvider::appWidgetDisable() { qDebug() << "TestProvider::appWidgetDisable"; } void SearchProvider::appWidgetDeleted() { qDebug() << "TestProvider::appWidgetDeleted"; } void SearchProvider::appWidgetEnable() { qDebug() << "TestProvider::appWidgetEnable"; } void SearchProvider::appWidgetClicked(const QString &widgetname, const QDBusVariant &value) { qDebug() << "TestProvider::appWidgetClicked"; qDebug() << widgetname << value.variant(); searchinterface->asyncCall("showWindow"); } ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/searchprovider.h000066400000000000000000000025651456160714700317430ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef SEARCHPROVIDER_H #define SEARCHPROVIDER_H #include class QDBusInterface; class SearchProvider : public AppWidget::KAppWidgetProvider { public: SearchProvider(QString providername = "demosearch",QObject *parent = nullptr); void appWidgetRecevie(const QString &eventname, const QString &widgetname, const QDBusVariant &value); void appWidgetUpdate(); void appWidgetDisable(); void appWidgetDeleted(); void appWidgetEnable(); void appWidgetClicked(const QString &widgetname, const QDBusVariant &value); private: QDBusInterface *searchinterface = nullptr; }; #endif // SEARCHPROVIDER_H ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/translations/000077500000000000000000000000001456160714700312635ustar00rootroot00000000000000demosearch_bo_CN.qm000066400000000000000000000001311456160714700347100ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/translations<¸dÊÍ!¿`¡½ÝB›ˆ˜i7undefinedsearch demosearchdemosearch_bo_CN.ts000066400000000000000000000005741456160714700347340ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/translations demosearch search undefined undefined demosearch_zh_CN.qm000066400000000000000000000001131456160714700347310ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/translations<¸dÊÍ!¿`¡½ÝB›ˆ˜i)d}"search demosearchdemosearch_zh_CN.ts000066400000000000000000000005661456160714700347560ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetprovider-search-demo/translations demosearch search æ�œç´¢ æ�œç´¢ ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetuser-demo/000077500000000000000000000000001456160714700244235ustar00rootroot00000000000000ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetuser-demo/appwidgetmodel.cpp000066400000000000000000000046521456160714700301430ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "appwidgetmodel.h" #include AppWidgetModel::AppWidgetModel(QObject *parent) : QAbstractListModel(parent) { m_roleName.insert(appWidgetItemQmlRole, "appQml"); m_roleName.insert(appWidgetItemNameRole, "appName"); appwidgetinterface = new AppWidget::KAppWidgetManager(this); } QVariant AppWidgetModel::headerData(int section, Qt::Orientation orientation, int role) const { // FIXME: Implement me! Q_UNUSED(section); Q_UNUSED(orientation); Q_UNUSED(role); return QVariant(); } int AppWidgetModel::rowCount(const QModelIndex &parent) const { if (parent.isValid()) return 0; // FIXME: Implement me! return m_date.size(); } QVariant AppWidgetModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); // FIXME: Implement me! switch (role) { case appWidgetItemQmlRole: return m_date.value(index.row()).appItemQml; case appWidgetItemNameRole: return m_date.value(index.row()).appItemName; default: break; } return QVariant(); } QHash AppWidgetModel::roleNames() const { return m_roleName; } int AppWidgetModel::count() const { return rowCount(QModelIndex()); } void AppWidgetModel::insert(QString appItemQml, QString appItemName) { int index = count(); emit beginInsertRows(QModelIndex(), index, index); LIST_APPWIDGET_ITEM_INFO list; qDebug() << __FILE__ << __FUNCTION__ << ": appItemQml = " << appItemQml << ", itemname = " << appItemName; list.appItemQml = appwidgetinterface->getAppWidgetUiFile(appItemQml); list.appItemName = appItemName; m_date.insert(index, list); emit endInsertRows(); } ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetuser-demo/appwidgetmodel.h000066400000000000000000000035221456160714700276030ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef APPWIDGETMODEL_H #define APPWIDGETMODEL_H #include #include struct LIST_APPWIDGET_ITEM_INFO { QString appItemQml; QString appItemName; }; class AppWidgetModel : public QAbstractListModel { Q_OBJECT public: explicit AppWidgetModel(QObject *parent = nullptr); enum LIST_APPWIDGET_ITEM_ROLE { appWidgetItemQmlRole = Qt::UserRole + 1, appWidgetItemNameRole, }; // Header: QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; // Basic functionality: int rowCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; // Add data: Q_INVOKABLE void insert(QString appItemQml, QString appItemName) ; int count() const; QHash roleNames() const override; private: QList m_date; QHash m_roleName; AppWidget::KAppWidgetManager * appwidgetinterface = nullptr; }; #endif // APPWIDGETMODEL_H ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetuser-demo/appwidgetuser-demo.pro000066400000000000000000000030251456160714700307520ustar00rootroot00000000000000QT += quick quickcontrols2 widgets core gui qml dbus greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 link_pkgconfig # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Refer to the documentation for the # deprecated API to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ appwidgetmodel.cpp \ listmodel.cpp \ main.cpp \ RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /usr/bin/ else: unix:!android: target.path = /usr/bin/ INSTALLS += target HEADERS += \ appwidgetmodel.h \ listmodel.h #QMAKE_LFLAGS += -Wl,-rpath=$$OUT_PWD/../../libukui-app-widget/libukui-appwidget-manager LIBS += -L$$OUT_PWD/../../libukui-app-widget/libukui-appwidget-manager -lukui-appwidget-manager INCLUDEPATH += $$PWD/../../libukui-app-widget/libukui-appwidget-manager DEPENDPATH += $$PWD/../../libukui-app-widget/libukui-appwidget-manager ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetuser-demo/listmodel.cpp000066400000000000000000000066521456160714700271340ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include "listmodel.h" #include #include ListModel::ListModel(QObject *parent) : QAbstractListModel(parent) { m_roleName.insert(itemIconRole, "itemIcon"); m_roleName.insert(itemTextRole, "itemName"); appwidgetinterface = new AppWidget::KAppWidgetManager(this); getIconAndText(); } QVariant ListModel::headerData(int section, Qt::Orientation orientation, int role) const { Q_UNUSED(section); Q_UNUSED(orientation); Q_UNUSED(role); // FIXME: Implement me! return QVariant(); } int ListModel::rowCount(const QModelIndex &parent) const { if (parent.isValid()) return 0; return m_date.size(); } QVariant ListModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); switch (role) { case itemIconRole: return m_date.value(index.row()).qsItemIcon; case itemTextRole: return m_date.value(index.row()).qsItemName; default: break; } return QVariant(); } QHash ListModel::roleNames() const { return m_roleName; } void ListModel::insert(QString qsItemIcon, QString qsItemName) { int index = count(); emit beginInsertRows(QModelIndex(), index, index); LIST_ITEM_INFO list; list.qsItemIcon = qsItemIcon; list.qsItemName = qsItemName; m_date.insert(index, list); emit endInsertRows(); } void ListModel::remove(int index) { if(index < 0 || index >= m_date.count()) { return; } beginRemoveRows(QModelIndex(), index, index); m_date.removeAt(index); endRemoveRows(); } int ListModel::count() const { return rowCount(QModelIndex()); } QList ListModel::getIconAndText() { m_applist = getAppWidgetList(); LIST_ITEM_INFO list; for (int var = 0; var < m_applist.count(); var++) { QString appwidgetname = m_applist.at(var); list.qsItemIcon = appwidgetinterface->getAppWidgetConfig(appwidgetname, AppWidget::PREVIEW_PATH); list.qsItemName = appwidgetinterface->getAppWidgetConfig(appwidgetname, AppWidget::NAME); //用于打å�°æŸ¥çœ‹æ‰€æœ‰å°�æ�’件的属性 // QMap a = appwidgetinterface->getAppWidgetConfigs(appwidgetname); // qDebug() << "a" << a.count(); // QMap::const_iterator it = a.constBegin(); // while (it != a.constEnd()) // { // qDebug() << it.key() << ": " << it.value() ; // it++; // } m_date.append(list); } return m_date; } QStringList ListModel::getAppWidgetList() { QStringList list = appwidgetinterface->getAppWidgetList(); qDebug() << __FILE__ << __FUNCTION__ << ": " << list; return list; } ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetuser-demo/listmodel.h000066400000000000000000000037741456160714700266030ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #ifndef LISTMODEL_H #define LISTMODEL_H #include struct LIST_ITEM_INFO { QString qsItemIcon; QString qsItemName; }; namespace AppWidget { class KAppWidgetManager; } class ListModel : public QAbstractListModel { Q_OBJECT public: explicit ListModel(QObject *parent = nullptr); enum LIST_ITEM_ROLE { itemIconRole = Qt::UserRole + 1, itemTextRole, }; // Header: QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; // Basic functionality: int rowCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; // Add data: Q_INVOKABLE void insert(QString qsItemIcon, QString qsItemName) ; // Remove data: Q_INVOKABLE void remove(int index); int count() const; QHash roleNames() const override; QList getIconAndText(); QStringList getAppWidgetList(); private: QStringList m_applist; QStringList m_iconlist; QStringList m_textlist; QList m_date; QHash m_roleName; AppWidget::KAppWidgetManager * appwidgetinterface = nullptr; }; #endif // LISTMODEL_H ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetuser-demo/main.cpp000066400000000000000000000031141456160714700260520ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ #include #include #include #include "listmodel.h" #include "appwidgetmodel.h" #include int main(int argc, char *argv[]) { QApplication app(argc, argv); QQmlApplicationEngine engine; ListModel listModel; AppWidgetModel appwidgetModel; engine.rootContext()->setContextProperty("AppWidgetModel", &appwidgetModel); engine.rootContext()->setContextProperty("KListModel", &listModel); QQuickStyle::setStyle("org.ukui.style"); const QUrl url(QStringLiteral("qrc:/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); } ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetuser-demo/main.qml000066400000000000000000000103101456160714700260550ustar00rootroot00000000000000/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: wangyan * */ import QtQuick 2.12 import QtQuick.Controls 2.5 import QtQuick.Window 2.12 import QtQuick.Layouts 1.12 ApplicationWindow { id: root visible: true width: screen.width height: screen.height title: qsTr("qmlWindow") property int intervalx: 40 property int intervaly: 20 Rectangle { id: rec1 width: parent.width height: (2*(parent.height))/3 anchors.margins: 10 color: "teal" border.color: "black" ListView { id: listview1 orientation: ListView.Horizontal width: rec1.width-2*intervalx height: rec1.height-2*intervaly anchors.verticalCenter: rec1.verticalCenter model: AppWidgetModel spacing: 20 delegate: Rectangle { id: rectangle1 width: 500 height: 500 color:"transparent" Loader { id: loader anchors.fill: rectangle1 asynchronous: false source: "file://" + appQml onLoaded: { item.register(item.appname, "user"); } } } } } Rectangle { id: rec2 y: (2*(parent.height))/3 width: parent.width height: (parent.height)/3 anchors.margins: 10 border.color: "black" Button { id: but2 x: intervalx y: 2*intervaly text: "Iconlist" onClicked: pop.open() } Popup { id: pop width: rec2.width-2*intervalx height: rec2.height-2*intervaly x: intervalx y: intervaly ListView { orientation: ListView.Horizontal id: listview width: rec2.width-2*intervalx height: rec2.height-2*intervaly model: KListModel spacing: 20 delegate: Rectangle { id: wraper width: 200 height: 200 MouseArea { id: mouse anchors.fill: parent hoverEnabled: true onEntered: { parent.color = "blue" } onExited: { parent.color = "lightblue" } onClicked: { console.log("onclicked" + text1.text) console.log("onclicked" + itemName) AppWidgetModel.insert(text1.text,text1.text) } } Text { id: text1 anchors.bottom: wraper.bottom anchors.horizontalCenter: wraper.horizontalCenter text: itemName Layout.preferredWidth: 120 color: "black" font.pointSize: 15 } Image { id: image1 width: 100 height:100 anchors.centerIn: wraper source: "file://" + itemIcon } } } } } } ukui-app-widget-4.0.0.2/ukui-appwidget-test/appwidgetuser-demo/qml.qrc000066400000000000000000000001271456160714700257230ustar00rootroot00000000000000 main.qml ukui-app-widget-4.0.0.2/ukui-appwidget-test/ukui-appwidget-test.pro000066400000000000000000000001771456160714700252610ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS += \ appwidgetuser-demo \ appwidgetprovider-clock-demo \ appwidgetprovider-search-demo