diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..a8b57e7b --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +shine diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + 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 +. diff --git a/README.md b/README.md index 180f2d5c..a59ec5ed 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,15 @@ -# kylin-nm-dev +# NAME + kylin-nm - kylin network monitor used in ubuntu-kylin operation system + +# DESCRIPTION + kylin-nm is a Qt based applet and uses some interface provided by NetworkManager. + It provides a GUI for users to connect or disconnect wired or wireless network which managed by NetworkManager. + Users can also create new wired network and configure a old network. + By click button at left bottom in the main window, a network configure window of NetworkManager will show in the screen. + Users can get some information about network directly by clicking one item in the network list, these information shown in extension area. +# BUILD KYLIN-NM + down the source sode + install dependency packages(see cntrol files in the debian directory) + execute debuild command in the root directory of project + execute sudo dpkg -i packagename.deb to install diff --git a/debian/.debhelper/generated/kylin-nm-dev/installed-by-dh_install b/debian/.debhelper/generated/kylin-nm-dev/installed-by-dh_install new file mode 100644 index 00000000..e69de29b diff --git a/debian/.debhelper/generated/kylin-nm-dev/installed-by-dh_installdocs b/debian/.debhelper/generated/kylin-nm-dev/installed-by-dh_installdocs new file mode 100644 index 00000000..e69de29b diff --git a/debian/.debhelper/generated/kylin-nm-dev/triggers b/debian/.debhelper/generated/kylin-nm-dev/triggers new file mode 100644 index 00000000..3b1fd9ad --- /dev/null +++ b/debian/.debhelper/generated/kylin-nm-dev/triggers @@ -0,0 +1,2 @@ +# Triggers added by dh_makeshlibs/12.10kylin1 +activate-noawait ldconfig diff --git a/debian/.debhelper/kylin-nm-dev/dbgsym-build-ids b/debian/.debhelper/kylin-nm-dev/dbgsym-build-ids new file mode 100644 index 00000000..9374dd3d --- /dev/null +++ b/debian/.debhelper/kylin-nm-dev/dbgsym-build-ids @@ -0,0 +1 @@ +7b336410c2ea6a28fb5e82d1e1453edfca2466da dd9b67ac5094cc99140951a7e5bfe818fa05a2f4 \ No newline at end of file diff --git a/debian/.debhelper/kylin-nm-dev/dbgsym-root/DEBIAN/control b/debian/.debhelper/kylin-nm-dev/dbgsym-root/DEBIAN/control new file mode 100644 index 00000000..ecc0548c --- /dev/null +++ b/debian/.debhelper/kylin-nm-dev/dbgsym-root/DEBIAN/control @@ -0,0 +1,13 @@ +Package: kylin-nm-dev-dbgsym +Package-Type: ddeb +Source: kylin-nm-dev +Version: 3.20.0.0 +Auto-Built-Package: debug-symbols +Architecture: amd64 +Maintainer: Kylin Team +Installed-Size: 6051 +Depends: kylin-nm-dev (= 3.20.0.0) +Section: debug +Priority: optional +Description: debug symbols for kylin-nm-dev +Build-Ids: 7b336410c2ea6a28fb5e82d1e1453edfca2466da dd9b67ac5094cc99140951a7e5bfe818fa05a2f4 diff --git a/debian/.debhelper/kylin-nm-dev/dbgsym-root/DEBIAN/md5sums b/debian/.debhelper/kylin-nm-dev/dbgsym-root/DEBIAN/md5sums new file mode 100644 index 00000000..dbb3353a --- /dev/null +++ b/debian/.debhelper/kylin-nm-dev/dbgsym-root/DEBIAN/md5sums @@ -0,0 +1,2 @@ +10ec666fec3a91ace445b4cc5b4c71e1 usr/lib/debug/.build-id/7b/336410c2ea6a28fb5e82d1e1453edfca2466da.debug +0362918325390826b5afee3480cb61a1 usr/lib/debug/.build-id/dd/9b67ac5094cc99140951a7e5bfe818fa05a2f4.debug diff --git a/debian/.debhelper/kylin-nm-dev/dbgsym-root/usr/lib/debug/.build-id/7b/336410c2ea6a28fb5e82d1e1453edfca2466da.debug b/debian/.debhelper/kylin-nm-dev/dbgsym-root/usr/lib/debug/.build-id/7b/336410c2ea6a28fb5e82d1e1453edfca2466da.debug new file mode 100644 index 00000000..a8bbbb09 Binary files /dev/null and b/debian/.debhelper/kylin-nm-dev/dbgsym-root/usr/lib/debug/.build-id/7b/336410c2ea6a28fb5e82d1e1453edfca2466da.debug differ diff --git a/debian/.debhelper/kylin-nm-dev/dbgsym-root/usr/lib/debug/.build-id/dd/9b67ac5094cc99140951a7e5bfe818fa05a2f4.debug b/debian/.debhelper/kylin-nm-dev/dbgsym-root/usr/lib/debug/.build-id/dd/9b67ac5094cc99140951a7e5bfe818fa05a2f4.debug new file mode 100644 index 00000000..599b13ef Binary files /dev/null and b/debian/.debhelper/kylin-nm-dev/dbgsym-root/usr/lib/debug/.build-id/dd/9b67ac5094cc99140951a7e5bfe818fa05a2f4.debug differ diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..2b02e5a1 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +kylin-nm-dev (3.20.0.0) v101; urgency=medium + + * new + + -- zhaoshixu Wed, 08 Jun 2022 10:00:53 +0800 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..f50ad762 --- /dev/null +++ b/debian/control @@ -0,0 +1,37 @@ +Source: kylin-nm-dev +Section: utils +Priority: optional +Maintainer: Kylin Team +Uploaders: handsome_feng +Build-Depends: debhelper (>=9), + qtbase5-dev, + qt5-qmake, + qtchooser, + qtscript5-dev, + qttools5-dev-tools, + qtbase5-dev-tools, + libqt5x11extras5-dev, + libgsettings-qt-dev, + libkf5windowsystem-dev, + libx11-dev, + libqt5svg5-dev, + libkf5networkmanagerqt-dev (>= 5.36.0), + libnm-dev, + libcap-dev, + libnma-dev, + libsecret-1-dev, +Standards-Version: 4.5.0 +Rules-Requires-Root: no +Homepage: https://github.com/ukui/kylin-nm +Vcs-Git: https://github.com/ukui/kylin-nm.git +Vcs-Browser: https://github.com/ukui/kylin-nm + +Package: kylin-nm-dev +Architecture: any +Depends: network-manager (>=1.2.6), + ${shlibs:Depends}, + ${misc:Depends} +Description: Gui Applet tool for display and edit network simply + Kylin NM is a Applet tool for managing network settings simply. + It has beautiful UI and very comfortable to use. + It's better work together with UKUI. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..642194d5 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,25 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: kylin-nm-dev +Upstream-Contact: Kylin Team +Source: https://github.com/ukui/kylin-nm + +Files: * +Copyright: 2019, Tianjin KYLIN Information Technology Co., Ltd. +License: GPL-3+ + +License: GPL-3+ + This package 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 package 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 Genaral Public License for more details. + . + You should have received a copy og the GNU General Public License + along with this program. If not, see + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..2da18dca --- /dev/null +++ b/debian/rules @@ -0,0 +1,34 @@ +#!/usr/bin/make -f + +export QT_SELECT=5 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +QMAKE_OPTS = DEFINES+=NO_DEBUG_ON_CONSOLE +MAKE_OPTS = PREFIX=/usr QMAKE=qmake LRELEASE=lrelease QMAKE_OPTS="$(QMAKE_OPTS)" + +override_dh_auto_configure: + QT_SELECT=qt5 dh_auto_configure \ + -- "QMAKE_CXXFLAGS=$(CFLAGS)" \ + kylin-nm.pro + +%: + dh $@ + +override_dh_install: + dh_install + +override_dh_missing: + dh_missing --fail-missing + +override_dh_auto_clean: + [ ! -d .moc ] || $(RM) -r .moc + [ ! -d .obj ] || $(RM) -r .obj + [ ! -d .ui ] || $(RM) -r .ui + [ ! -f Makefile ] || dh_auto_clean + +override_dh_auto_build: + dh_auto_build -- $(MAKE_OPTS) + +override_dh_shlibdeps: + dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..89ae9db8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/debian/watch b/debian/watch new file mode 100644 index 00000000..8253cbbc --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +version=4 +https://github.com/ukui/kylin-nm/releases .*/kylin-nm_(\d\S+)\.orig\.tar\.gz diff --git a/kylin-keyring/authorize.svg b/kylin-keyring/authorize.svg new file mode 100755 index 00000000..edf7e74a --- /dev/null +++ b/kylin-keyring/authorize.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kylin-keyring/kylin-agent/agentutils.h b/kylin-keyring/kylin-agent/agentutils.h new file mode 100644 index 00000000..b77916e7 --- /dev/null +++ b/kylin-keyring/kylin-agent/agentutils.h @@ -0,0 +1,96 @@ +#ifndef AGENTUTILS_H +#define AGENTUTILS_H + +#define VPN_TYPE "vpn" +#define VPN_NAME "vpn" +#define VPN_SERVICE "service-type" +#define VPN_DATA "data" +#define VPN_SECRET "secrets" +#define VPN_FLAG "password-flags" + +#define CONNECTION_KEY "connection" +#define UUID_KEY "uuid" +#define SSID_KEY "ssid" +#define ID_KEY "id" +#define TYPE_KEY "type" + + +#define WIRELESS_SECURITY_NAME "802-11-wireless-security" +#define KEY_MGMT "key-mgmt" + +#define PSK_MGMT "wpa-psk" +#define SAE_MGMT "sae" +#define PSK_FLAG "psk-flags" +#define PSK_KEY "psk" + +#define WEP_MGMT "none" +#define WEP128_MGMT "passphrase" +#define WEP_FLAG_KEY "wep-key-flags" +#define WEP_ID_KEY "wep-tx-keyidx" +#define WEP_KEY0 "wep-key0" +#define WEP_KEY1 "wep-key1" +#define WEP_KEY2 "wep-key2" +#define WEP_KEY3 "wep-key3" + +#define LEAP_MGMT "ieee8021x" +#define LEAP_PASSWORD_FLAG "leap-password-flags" +#define LEAP_PASSWORD_KEY "leap-password" +#define LEAP_USER_KEY "leap-username" + +#define ENTERPRICE_NAME "802-1x" +#define EAP_KEY "eap" +#define PWD_EAP "pwd" +#define LEAP_EAP "leap" +#define FAST_EAP "fast" +#define PEAP_EAP "peap" +#define TTLS_EAP "ttls" +#define TLS_EAP "tls" + +#define IDENTITY_KEY "identity" + +#define PASSWORD_FLAG "password-flags" +#define PASSWORD_KEY "password" + +#define PIN_FLAG "pin-flags" +#define PIN_KEY "pin" + +#define PHASE2_PRIVATE_KEY_FLAG "phase2-private-key-password-flags" +#define PHASE2_PRIVATE_KEY "phase2-private-key-password" + +#define PRIVATE_KEY_FLAG "private-key-password-flags" +#define PRIVATE_KEY "private-key-password" +#define DOMAIN_KEY "domain-suffix-match" + +#define PHASE2_CLIENT_FLAG "phase2-client-cert-password-flags" +#define PHASE2_CLIENT "phase2-client-cert-password" + +#define PHASE2_CACERT_FLAG "phase2-ca-cert-password-flags" +#define PHASE2_CACERT "phase2-ca-cert-password" + +#define PHASE1_AUTH_FLAG "phase1-auth-flags" +#define PHASE1_AUTH "phase1-auth" + +#define CLIENT_CERT_FLAG "client-cert-password-flags" +#define CLIENT_CERT "client-cert-password" + +#define CACERT_FLAG "ca-cert-password-flags" +#define CACERT "ca-cert-password" + + + +enum SecretPolicyFlag{ + POLICY_NONE = 0, + POLICY_AGENT_OWNED = 0x01, + POLICY_NOT_SAVED = 0x02, + POLICY_NOT_REQUIRED = 0x04 +}; + +enum SecretWepKeyId{ + KEY_TYPE0 = 0, + KEY_TYPE1 = 1, + KEY_TYPE2 = 2, + KEY_TYPE3 = 3 +}; + + +#endif // AGENTUTILS_H diff --git a/kylin-keyring/kylin-agent/kylin-agent.pri b/kylin-keyring/kylin-agent/kylin-agent.pri new file mode 100644 index 00000000..3cfbae16 --- /dev/null +++ b/kylin-keyring/kylin-agent/kylin-agent.pri @@ -0,0 +1,14 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/agentutils.h \ + $$PWD/kylinagent.h \ + $$PWD/kylinagentobject.h \ + $$PWD/kylinpassworddialog.h \ + $$PWD/kylinsecretagent.h + +SOURCES += \ + $$PWD/kylinagent.cpp \ + $$PWD/kylinagentobject.cpp \ + $$PWD/kylinpassworddialog.cpp \ + $$PWD/kylinsecretagent.cpp diff --git a/kylin-keyring/kylin-agent/kylinagent.cpp b/kylin-keyring/kylin-agent/kylinagent.cpp new file mode 100644 index 00000000..5a743a33 --- /dev/null +++ b/kylin-keyring/kylin-agent/kylinagent.cpp @@ -0,0 +1,23 @@ +#include "kylinagent.h" + +KylinAgent::KylinAgent(QObject *parent) : QObject(parent) +{ + +} + +KylinAgent::~KylinAgent() +{ + +} + +void KylinAgent::startKylinAgent() +{ + m_secretAgnet = new KylinSecretAgent("kylinagent", pWidget, this); +} + +//void KylinAgent::stopKylinAgent() +//{ +// delete m_kylinAgnetObject; +// m_kylinAgnetObject = nullptr; +// return; +//} diff --git a/kylin-keyring/kylin-agent/kylinagent.h b/kylin-keyring/kylin-agent/kylinagent.h new file mode 100644 index 00000000..2013aee4 --- /dev/null +++ b/kylin-keyring/kylin-agent/kylinagent.h @@ -0,0 +1,28 @@ +#ifndef KYLINAGENT_H +#define KYLINAGENT_H + +#include "kylinsecretagent.h".h" + +#if defined(LIBKYLIN_KEYRING_LIBRARY) +# define LIBKYLIN_KEYRING_LIBRARY Q_DECL_EXPORT +#else +# define LIBKYLIN_KEYRING_LIBRARY Q_DECL_IMPORT +#endif + +class LIBKYLIN_KEYRING_LIBRARY KylinAgent : public QObject +{ +public: + explicit KylinAgent(QObject *parent = nullptr); + ~KylinAgent(); + void startKylinAgent(); + void setParentWidget(QWidget *widget){ + pWidget = widget; + } + +private: + KylinSecretAgent *m_secretAgnet; + QWidget* pWidget = nullptr; +}; + + +#endif // KYLINAGENT_H diff --git a/kylin-keyring/kylin-agent/kylinagentobject.cpp b/kylin-keyring/kylin-agent/kylinagentobject.cpp new file mode 100644 index 00000000..217fcf55 --- /dev/null +++ b/kylin-keyring/kylin-agent/kylinagentobject.cpp @@ -0,0 +1,21 @@ +#include "kylinagentobject.h" + +KylinAgentObject::KylinAgentObject(QObject *parent) : QObject(parent) +{ + +} + +KylinAgentObject::~KylinAgentObject() +{ + if (nullptr != m_secretAgnet) { + delete m_secretAgnet; + m_secretAgnet = nullptr; + } +} + +void KylinAgentObject::onInitAgent() +{ + m_secretAgnet = new KylinSecretAgent("kylinagent"); + + return; +} diff --git a/kylin-keyring/kylin-agent/kylinagentobject.h b/kylin-keyring/kylin-agent/kylinagentobject.h new file mode 100644 index 00000000..7d071255 --- /dev/null +++ b/kylin-keyring/kylin-agent/kylinagentobject.h @@ -0,0 +1,23 @@ +#ifndef KYLINAGENTOBJECT_H +#define KYLINAGENTOBJECT_H + +#include "kylinsecretagent.h" + +#include + +class KylinAgentObject : public QObject +{ + Q_OBJECT +public: + explicit KylinAgentObject(QObject *parent = nullptr); + ~KylinAgentObject(); + +public Q_SLOTS: + void onInitAgent(); + +private: + KylinSecretAgent *m_secretAgnet; + +}; + +#endif // KYLINAGENTOBJECT_H diff --git a/kylin-keyring/kylin-agent/kylinpassworddialog.cpp b/kylin-keyring/kylin-agent/kylinpassworddialog.cpp new file mode 100644 index 00000000..04d82b6e --- /dev/null +++ b/kylin-keyring/kylin-agent/kylinpassworddialog.cpp @@ -0,0 +1,502 @@ +#include "kylinpassworddialog.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#define CLOSE_TIME 30*1000 + + +static QPalette lightPalette(QWidget *widget) +{ + auto palette = widget->palette(); + //ukui-light palette UKUI3.1 + QColor windowText_at(38, 38, 38), + windowText_iat(38, 38, 38), + windowText_dis(166, 166, 166), + button_at(230, 230, 230), + button_iat(230, 230, 230), + button_dis(233, 233, 233), + light_at(255, 255, 255), + light_iat(255, 255, 255), + light_dis(242, 242, 242), + midlight_at(218, 218, 218), + midlight_iat(218, 218, 218), + midlight_dis(230, 230, 230), + dark_at(77, 77, 77), + dark_iat(77, 77, 77), + dark_dis(64, 64, 64), + mid_at(115, 115, 115), + mid_iat(115, 115, 115), + mid_dis(102, 102, 102), + text_at(38, 38, 38), + text_iat(38, 38, 38), + text_dis(140, 140, 140), + brightText_at(89, 89, 89), + brightText_iat(89, 89, 89), + brightText_dis(77, 77, 77), + buttonText_at(38, 38, 38), + buttonText_iat(38, 38, 38), + buttonText_dis(179, 179, 179), + base_at(255, 255, 255), + base_iat(245, 245, 245), + base_dis(237, 237, 237), + window_at(245, 245, 245), + window_iat(237, 237, 237), + window_dis(230, 230, 230), + shadow_at(0, 0, 0, 16), + shadow_iat(0, 0, 0, 16), + shadow_dis(0, 0, 0, 21), +// shadow_at(214, 214, 214), +// shadow_iat(214, 214, 214), +// shadow_dis(201, 201, 201), + highLight_at(55, 144, 250), + highLight_iat(55, 144, 250), + highLight_dis(233, 233, 233), + highLightText_at(255, 255, 255), + highLightText_iat(255, 255, 255), + highLightText_dis(179, 179, 179), + link_at(55, 144, 250), + link_iat(55, 144, 250), + link_dis(55, 144, 250), + linkVisited_at(114, 46, 209), + linkVisited_iat(114, 46, 209), + linkVisited_dis(114, 46, 209), + alternateBase_at(245, 245, 245), + alternateBase_iat(245, 245, 245), + alternateBase_dis(245, 245, 245), + noRale_at(240, 240, 240), + noRole_iat(240, 240, 240), + noRole_dis(217, 217, 217), + toolTipBase_at(255, 255, 255), + toolTipBase_iat(255, 255, 255), + toolTipBase_dis(255, 255, 255), + toolTipText_at(38, 38, 38), + toolTipText_iat(38, 38, 38), + toolTipText_dis(38, 38, 38), + placeholderText_at(38, 38, 38), + placeholderText_iat(38, 38, 38), + placeholderText_dis(38, 38, 38); + + + + palette.setColor(QPalette::Active, QPalette::WindowText, windowText_at); + palette.setColor(QPalette::Inactive, QPalette::WindowText, windowText_iat); + palette.setColor(QPalette::Disabled, QPalette::WindowText, windowText_dis); + + palette.setColor(QPalette::Active, QPalette::Button, button_at); + palette.setColor(QPalette::Inactive, QPalette::Button, button_iat); + palette.setColor(QPalette::Disabled, QPalette::Button, button_dis); + + palette.setColor(QPalette::Active, QPalette::Light, light_at); + palette.setColor(QPalette::Inactive, QPalette::Light, light_iat); + palette.setColor(QPalette::Disabled, QPalette::Light, light_dis); + + palette.setColor(QPalette::Active, QPalette::Midlight, midlight_at); + palette.setColor(QPalette::Inactive, QPalette::Midlight, midlight_iat); + palette.setColor(QPalette::Disabled, QPalette::Midlight, midlight_dis); + + palette.setColor(QPalette::Active, QPalette::Dark, dark_at); + palette.setColor(QPalette::Inactive, QPalette::Dark, dark_iat); + palette.setColor(QPalette::Disabled, QPalette::Dark, dark_dis); + + palette.setColor(QPalette::Active, QPalette::Mid, mid_at); + palette.setColor(QPalette::Inactive, QPalette::Mid, mid_iat); + palette.setColor(QPalette::Disabled, QPalette::Mid, mid_dis); + + palette.setColor(QPalette::Active, QPalette::Text, text_at); + palette.setColor(QPalette::Inactive, QPalette::Text, text_iat); + palette.setColor(QPalette::Disabled, QPalette::Text, text_dis); + + palette.setColor(QPalette::Active, QPalette::BrightText, brightText_at); + palette.setColor(QPalette::Inactive, QPalette::BrightText, brightText_iat); + palette.setColor(QPalette::Disabled, QPalette::BrightText, brightText_dis); + + palette.setColor(QPalette::Active, QPalette::ButtonText, buttonText_at); + palette.setColor(QPalette::Inactive, QPalette::ButtonText, buttonText_iat); + palette.setColor(QPalette::Disabled, QPalette::ButtonText, buttonText_dis); + + palette.setColor(QPalette::Active, QPalette::Base, base_at); + palette.setColor(QPalette::Inactive, QPalette::Base, base_iat); + palette.setColor(QPalette::Disabled, QPalette::Base, base_dis); + + palette.setColor(QPalette::Active, QPalette::Window, window_at); + palette.setColor(QPalette::Inactive, QPalette::Window, window_iat); + palette.setColor(QPalette::Disabled, QPalette::Window, window_dis); + + palette.setColor(QPalette::Active, QPalette::Shadow, shadow_at); + palette.setColor(QPalette::Inactive, QPalette::Shadow, shadow_iat); + palette.setColor(QPalette::Disabled, QPalette::Shadow, shadow_dis); + + palette.setColor(QPalette::Active, QPalette::Highlight, highLight_at); + palette.setColor(QPalette::Inactive, QPalette::Highlight, highLight_iat); + palette.setColor(QPalette::Disabled, QPalette::Highlight, highLight_dis); + + palette.setColor(QPalette::Active, QPalette::HighlightedText, highLightText_at); + palette.setColor(QPalette::Inactive, QPalette::HighlightedText, highLightText_iat); + palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highLightText_dis); + + palette.setColor(QPalette::Active, QPalette::Link, link_at); + palette.setColor(QPalette::Inactive, QPalette::Link, link_iat); + palette.setColor(QPalette::Disabled, QPalette::Link, link_dis); + + palette.setColor(QPalette::Active, QPalette::LinkVisited, linkVisited_at); + palette.setColor(QPalette::Inactive, QPalette::LinkVisited, linkVisited_iat); + palette.setColor(QPalette::Disabled, QPalette::LinkVisited, linkVisited_dis); + + palette.setColor(QPalette::Active, QPalette::AlternateBase, alternateBase_at); + palette.setColor(QPalette::Inactive, QPalette::AlternateBase, alternateBase_iat); + palette.setColor(QPalette::Disabled, QPalette::AlternateBase, alternateBase_dis); + + palette.setColor(QPalette::Active, QPalette::NoRole, noRale_at); + palette.setColor(QPalette::Inactive, QPalette::NoRole, noRole_iat); + palette.setColor(QPalette::Disabled, QPalette::NoRole, noRole_dis); + + palette.setColor(QPalette::Active, QPalette::ToolTipBase, toolTipBase_at); + palette.setColor(QPalette::Inactive, QPalette::ToolTipBase, toolTipBase_iat); + palette.setColor(QPalette::Disabled, QPalette::ToolTipBase, toolTipBase_dis); + + palette.setColor(QPalette::Active, QPalette::ToolTipText, toolTipText_at); + palette.setColor(QPalette::Inactive, QPalette::ToolTipText, toolTipText_iat); + palette.setColor(QPalette::Disabled, QPalette::ToolTipText, toolTipText_dis); + +#if (QT_VERSION >= QT_VERSION_CHECK(5,12,0)) + palette.setColor(QPalette::Active, QPalette::PlaceholderText, placeholderText_at); + palette.setColor(QPalette::Inactive, QPalette::PlaceholderText, placeholderText_iat); + palette.setColor(QPalette::Disabled, QPalette::PlaceholderText, placeholderText_dis); +#endif + + return palette; + +} + +RowWidget::RowWidget(QWidget *widget, QWidget *parent) : valueWidget(widget), QWidget(parent) +{ + mainLayout = new QHBoxLayout(this); + mainLayout->setContentsMargins(0,0,0,0); + this->setLayout(mainLayout); + keyLabel = new QLabel(this); + keyLabel->setMaximumWidth(87); + valueWidget->setMinimumWidth(280); + mainLayout->addWidget(keyLabel); + mainLayout->addStretch(); + mainLayout->addWidget(valueWidget); +} + +RowWidget::~RowWidget() +{ + +} + +void RowWidget::setKey(QString text) +{ + this->keyLabel->setText(text); +} + +KyPasswordDialog::KyPasswordDialog(QString dialogType, QString connectionID, QWidget *parent) + :connectionID(connectionID),dialogType(dialogType),QDialog(parent) +{ + + qDebug() << "KyPasswordDialog"; + this->setAttribute(Qt::WA_QuitOnClose, false); +// this->setWindowFlags(Qt::Dialog); +// this->setWindowIcon(QIcon::fromTheme("kylin-network")); +// this->setWindowTitle(connectionID); + + initUI(dialogType); + m_sdkPasswdEdit->installEventFilter(this); + + this->setWindowFlags(Qt::MSWindowsFixedSizeDialogHint); + + connect(qApp, &QApplication::paletteChanged, this, &KyPasswordDialog::onPaletteChanged); + onPaletteChanged(); +} + +void KyPasswordDialog::showDesktopNotify(const QString &message) +{ + QDBusInterface iface("org.freedesktop.Notifications", + "/org/freedesktop/Notifications", + "org.freedesktop.Notifications", + QDBusConnection::sessionBus()); + QList args; + args<<(tr("Kylin NM")) + <<((unsigned int) 0) + <setContentsMargins(MAIN_LAYOUT_MARGINS); + mainVBoxLayout->setSpacing(DEFAULT_LAYOUT_SPACE); + this->setLayout(mainVBoxLayout); + + //不包含按钮的横向布局 + QHBoxLayout *hBoxLayout = new QHBoxLayout(this); + hBoxLayout->setContentsMargins(DEFAULT_LAYOUT_MARGINS); + hBoxLayout->setSpacing(DEFAULT_LAYOUT_SPACE); + + //图标 + QLabel *picture = new QLabel(this); + picture->setContentsMargins(DEFAULT_LAYOUT_MARGINS); + picture->setFixedSize(DEFAULT_PICTURE_FIXSIZE); + picture->setPixmap(QPixmap(":/authorize.svg")); + + //标题 + QLabel *titleLabel = new QLabel(this); + titleLabel->setText(tr("Wi-Fi authentication required")); + titleLabel->setFont(fontTitle); + + //提示信息 + QLabel *tipLabel = new QLabel(this); + tipLabel->setFixedSize(328, DEFAULT_FIXHEIGHT); + tipLabel->setAlignment(Qt::AlignTop); + tipLabel->setWordWrap(true); + QString text = tr("Access wireless networks"); + text += " " + connectionID + " "; + text += tr("needs password or encryption key"); + tipLabel->setText(text); + tipLabel->setFont(fontNormal); + + //密码输入框 + QLabel *pwdLabel = new QLabel(this); + pwdLabel->setText(tr("password")); + pwdLabel->setFont(fontNormal); + m_sdkPasswdEdit = new KPasswordEdit(this); + if (dialogType != "") { + this->setFixedSize(WPA2_PAGE_SIZE); + m_sdkPasswdEdit->setFixedSize(WPA2_EDIT_SIZE); + } else { + this->setFixedSize(DEFAULT_PAGE_SIZE); + m_sdkPasswdEdit->setFixedSize(DEFAULT_EDIT_SIZE); + } + m_sdkPasswdEdit->setClearButtonEnabled(false); + m_sdkPasswdEdit->setEchoModeBtnVisible(true); + m_sdkPasswdEdit->setState(LoginFailed); + m_sdkPasswdEdit->setAttribute(Qt::WA_InputMethodEnabled, true); + QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$"); + QRegExpValidator *latitude = new QRegExpValidator(rx, this); + m_sdkPasswdEdit->setValidator(latitude); + + //密码输入框布局 + QHBoxLayout *pwdLayout = new QHBoxLayout(this); + pwdLayout->setContentsMargins(DEFAULT_LAYOUT_MARGINS); + if (dialogType != "") { + pwdLayout->setSpacing(DEFAULT_LAYOUT_SPACE); + } else { + pwdLayout->setSpacing(LESS_LAYOUT_SPACE); + } + pwdLayout->addWidget(pwdLabel); + pwdLayout->addWidget(m_sdkPasswdEdit); + + //不包含图标的纵向布局 + QVBoxLayout *contentLayout = new QVBoxLayout(this); + contentLayout->setContentsMargins(DEFAULT_LAYOUT_MARGINS); + contentLayout->setSpacing(LESS_LAYOUT_SPACE); + contentLayout->setAlignment(Qt::AlignTop); + contentLayout->addWidget(titleLabel); + contentLayout->addWidget(tipLabel); + if (dialogType != "") { + //WPA2企业加密方式用户名输入框 + QLabel *userNameLabel = new QLabel(this); + userNameLabel->setText(tr("user name")); + userNameLabel->setFont(fontNormal); + m_usrLineEdit = new QLineEdit(this); + m_usrLineEdit->setFixedSize(WPA2_EDIT_SIZE); + + //用户名输入框布局 + QHBoxLayout *userNameLayout = new QHBoxLayout(this); + userNameLayout->setContentsMargins(DEFAULT_LAYOUT_MARGINS); + userNameLayout->setSpacing(8); + userNameLayout->addWidget(userNameLabel); + userNameLayout->addWidget(m_usrLineEdit); + contentLayout->addLayout(userNameLayout); + } + contentLayout->addLayout(pwdLayout); + + //连接按钮 + m_connectBtn = new QPushButton(this); + m_connectBtn->setText(tr("Connect")); + m_connectBtn->setFont(fontNormal); + m_connectBtn->setFixedSize(DEFAULT_BTN_FIXSIZE); + + //取消按钮 + m_exitBtn = new QPushButton(this); + m_exitBtn->setText(tr("Cancel")); + m_exitBtn->setFont(fontNormal); + m_exitBtn->setFixedSize(DEFAULT_BTN_FIXSIZE); + + //按钮布局 + QHBoxLayout *btnLayout = new QHBoxLayout(this); + btnLayout->setContentsMargins(DEFAULT_LAYOUT_MARGINS); + btnLayout->setSpacing(LESS_LAYOUT_SPACE); + btnLayout->addStretch(); + btnLayout->addWidget(m_exitBtn); + btnLayout->addWidget(m_connectBtn); + + hBoxLayout->addWidget(picture); + hBoxLayout->setAlignment(picture, Qt::AlignTop); + hBoxLayout->addLayout(contentLayout); + + mainVBoxLayout->addLayout(hBoxLayout); + mainVBoxLayout->addLayout(btnLayout); + + if (m_usrLineEdit == nullptr) { + showDesktopNotify(tr("password error!")); + } else { + showDesktopNotify(tr("username or password error!")); + } +} + +QString KyPasswordDialog::getPassword() +{ + return m_sdkPasswdEdit->text(); +} + +void KyPasswordDialog::setPassword(QString password) +{ + m_sdkPasswdEdit->setText(password); + m_sdkPasswdEdit->setFocus(); +} + +QString KyPasswordDialog::getUserName() +{ + return m_usrLineEdit->text(); +} + +void KyPasswordDialog::setUserName(QString name) +{ + m_usrLineEdit->setText(name); +} + +void KyPasswordDialog::login() +{ + qDebug() << "KyPasswordDialog login"; + if ((!m_sdkPasswdEdit->text().isEmpty()) && (m_usrLineEdit == nullptr? true : (!m_usrLineEdit->text().isEmpty()))) { + accept(); + } else { + m_sdkPasswdEdit->clear(); + if (m_usrLineEdit != nullptr) { + m_usrLineEdit->clear(); + m_usrLineEdit->setFocus(); + } + } +} + +void KyPasswordDialog::onTextChanged(const QString & text) +{ + qDebug() << "KyPasswordDialog onTextChanged"; + m_sdkPasswdEdit->setState(Ordinary); + if (text == "") { + //任何输入框为空,则不许按下连接按钮 + m_connectBtn->setEnabled(false); + return ; + } + + if (m_usrLineEdit != nullptr) { + //企业网修改密码页面 + if (!m_usrLineEdit->text().isEmpty() && !m_sdkPasswdEdit->text().isEmpty()) { + //用户名和密码均不为空,允许按下连接按钮 + m_connectBtn->setEnabled(true); + } else { + m_connectBtn->setEnabled(false); + } + return ; + } + + if (m_sdkPasswdEdit->text().isEmpty() || m_sdkPasswdEdit->text().length() < 8) { + //普通热点密码修改页面,若密码为空,或长度小于8位,不许按下连接按钮 + m_connectBtn->setEnabled(false); + return ; + } + + m_connectBtn->setEnabled(true); +} + + +void KyPasswordDialog::onPaletteChanged() +{ + QPalette pal = lightPalette(this); + + this->setPalette(pal); + m_sdkPasswdEdit->setPalette(pal); + if (nullptr != m_usrLineEdit) + m_usrLineEdit->setPalette(pal); + +// setFramePalette(this, pal); +} + +void KyPasswordDialog::paintEvent(QPaintEvent *event) +{ + QPalette pal = this->palette(); + + QPainter painter(this); + painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿 + painter.setPen(Qt::NoPen); + painter.setBrush(pal.color(QPalette::Base)); + + QRect rect = this->rect(); + painter.drawRoundedRect(rect, 12, 12); + + + QDialog::paintEvent(event); +} +bool KyPasswordDialog::eventFilter(QObject *watched, QEvent *event) +{ + if (watched == m_sdkPasswdEdit) { + qDebug() << "!!!!!" << event->type() << watched; + } + return QWidget::eventFilter(watched, event); +} diff --git a/kylin-keyring/kylin-agent/kylinpassworddialog.h b/kylin-keyring/kylin-agent/kylinpassworddialog.h new file mode 100644 index 00000000..077ac48e --- /dev/null +++ b/kylin-keyring/kylin-agent/kylinpassworddialog.h @@ -0,0 +1,75 @@ +#ifndef KYLINPASSWORDDIALOG_H +#define KYLINPASSWORDDIALOG_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kpasswordedit.h" + +using namespace kdk; + +class RowWidget : public QWidget +{ + Q_OBJECT +public: + RowWidget(QWidget *widget, QWidget *parent = nullptr); + ~RowWidget(); + void setKey(QString text); + +private: + QHBoxLayout *mainLayout; + QLabel *keyLabel; + QWidget *valueWidget; +}; + +class KyPasswordDialog : public QDialog +{ + Q_OBJECT +public: + KyPasswordDialog(QString dialogType, QString connectionID = "", QWidget *parent = 0); + ~KyPasswordDialog(); + + void showDesktopNotify(const QString &message); + + void InitConnect(); +private: + QString dialogType; + QString connectionID; + + QLineEdit *m_usrLineEdit = nullptr; + QPushButton *m_connectBtn = nullptr; + QPushButton *m_exitBtn = nullptr; + + KPasswordEdit *m_sdkPasswdEdit = nullptr; + + void onPaletteChanged(); + +protected: + void paintEvent(QPaintEvent *event); + bool eventFilter(QObject *watched, QEvent *event); + +public: + void initUI(QString dialogType); + + QString getPassword(); + void setPassword(QString password); + + QString getUserName(); + void setUserName(QString name); + +private Q_SLOTS: + void login(); + void onTextChanged(const QString &); + +Q_SIGNALS: + void signal_username(QString); +}; + +#endif // KYLINPASSWORDDIALOG_H diff --git a/kylin-keyring/kylin-agent/kylinsecretagent.cpp b/kylin-keyring/kylin-agent/kylinsecretagent.cpp new file mode 100644 index 00000000..f128e7d9 --- /dev/null +++ b/kylin-keyring/kylin-agent/kylinsecretagent.cpp @@ -0,0 +1,1213 @@ + +#include + +#include "kylinsecretagent.h" +#include "kylinpassworddialog.h" + +#define LOG_FLAG "[KylinSecretAgent]" + +#define KEYRING_UUID_TAG "connection-uuid" +#define KEYRING_SN_TAG "setting-name" +#define KEYRING_SK_TAG "setting-key" + +static const SecretSchema network_manager_secret_schema = { + "org.freedesktop.NetworkManager.Connection", + SECRET_SCHEMA_DONT_MATCH_NAME, + { + { KEYRING_UUID_TAG, SECRET_SCHEMA_ATTRIBUTE_STRING }, + { KEYRING_SN_TAG, SECRET_SCHEMA_ATTRIBUTE_STRING }, + { KEYRING_SK_TAG, SECRET_SCHEMA_ATTRIBUTE_STRING }, + { NULL, 0 }, + } +}; + +/* +* 目前wpa3存在的问题: +* 1、所有用户可见的存储策略情况下,当密码错误的时候,networkmanager不会调用getSecret接口 +* 2、当选择仅用户可见时,存储错误密码,由于传递给getSecret的flag参数一直是13, +* 导致无法弹出修改密码的框, +* 正常情况下,flag第一次是5,从keyring获取密码 第二次是7,由于密码错误,弹框获取新密码 +* 3、每次询问密码正常。 +* +* wep的存在的问题: +* 1、所有用户可见时,当输入错误的密码的时候,networkmanager没有调用getSecret函数,弹出密码框 +* 2、仅用户可见的时候,正确的密码可以正常连接,当密码错误的时候,不调用getsecret,不会弹出密码框 +* 3、每次询问密码的时候,第一次可以弹出密码框,如果输入错误的密码,有时弹出密码框,有时不弹,取决于输入的密码位数 +* +* +* 企业wifi leap加密方式 +* 无法选择每次询问用户 +* +*/ + + +KylinSecretAgent::KylinSecretAgent(const QString &id, QWidget *pWidget, QObject *parent):SecretAgent(id, parent) +{ + parentWidget = pWidget; + enterpriceInfo[PASSWORD_FLAG] = PASSWORD_KEY; + enterpriceInfo[PIN_FLAG] = PIN_KEY; + enterpriceInfo[PHASE2_PRIVATE_KEY_FLAG] = PHASE2_PRIVATE_KEY; + enterpriceInfo[PRIVATE_KEY_FLAG] = PRIVATE_KEY; + enterpriceInfo[PHASE2_CLIENT_FLAG] = PHASE2_CLIENT; + enterpriceInfo[PHASE2_CACERT_FLAG] = PHASE2_CACERT; + enterpriceInfo[PHASE1_AUTH_FLAG] = PHASE1_AUTH; + enterpriceInfo[CLIENT_CERT_FLAG] = CLIENT_CERT; + enterpriceInfo[CACERT_FLAG] = CACERT; + + wirelessInfo[PSK_FLAG] = PSK_KEY; + wirelessInfo[LEAP_PASSWORD_FLAG] = LEAP_PASSWORD_KEY; +} + +KylinSecretAgent::~KylinSecretAgent() +{ + +} + +bool KylinSecretAgent::hintIsFind(GList *p_secretList, const QStringList &hints) +{ + GList *p_iter; + bool hintFind = false; + + if (hints.isEmpty()) { + return true; + } + + for (p_iter = p_secretList; p_iter != NULL; p_iter = g_list_next(p_iter)) { + SecretItem *p_item = (SecretItem *)p_iter->data; + SecretValue *p_secret; + const char *p_keyName; + GHashTable *p_attributes; + + p_secret = secret_item_get_secret(p_item); + if (p_secret) { + p_attributes = secret_item_get_attributes (p_item); + p_keyName = (char *)g_hash_table_lookup (p_attributes, KEYRING_SK_TAG); + if (!p_keyName) { + g_hash_table_unref (p_attributes); + secret_value_unref (p_secret); + continue; + } + + /* See if this property matches a given hint */ + for (int index = 0; index < hints.size(); ++index) { + QString hintValue = hints.at(index); + if (!g_strcmp0(hintValue.toUtf8().constData(), p_keyName)) { + hintFind = true; + } + } + + g_hash_table_unref (p_attributes); + secret_value_unref (p_secret); + break; + } + } + + return hintFind; +} + +void KylinSecretAgent::getSecretFromKeyring(GList *p_secretList, + const QString &settingName, + QString connectType, + NMVariantMapMap &secretMap) +{ + GList *p_iter = nullptr; + QVariantMap secretKeyMap; + + for (p_iter = p_secretList; p_iter != NULL; p_iter = g_list_next(p_iter)) { + SecretItem *p_item = (SecretItem *)p_iter->data; + SecretValue *p_secret; + const char *p_keyName; + GHashTable *p_attributes; + + p_secret = secret_item_get_secret(p_item); + if (p_secret) { + p_attributes = secret_item_get_attributes (p_item); + p_keyName = (char *)g_hash_table_lookup (p_attributes, KEYRING_SK_TAG); + if (!p_keyName) { + g_hash_table_unref (p_attributes); + secret_value_unref (p_secret); + continue; + } + + if (VPN_TYPE == connectType) { + /* + * 目前根据测试的情况vpn只会存储密码,涉及的字段 + * vpn.secrets: password = 123456 + * 注意的问题:不知道会不会出现多个密码的问题, + */ + QString vpnSecretValue = QString(p_keyName) + + "=" + QString(secret_value_get(p_secret, NULL)); + secretKeyMap[VPN_SECRET] = vpnSecretValue; + } else { + secretKeyMap[p_keyName] = QString(secret_value_get(p_secret, NULL)); + } + g_hash_table_unref (p_attributes); + secret_value_unref (p_secret); + break; + } + } + + secretMap[settingName] = secretKeyMap; + + return; +} + +/* +* 目前根据测试掌握的情况来看,该函数无用原因: +* 当每次都是询问的时候,keyring上面并不会存储密码,那么从keyring上面获取的密码为空 +* 程序根本无法走到此处 +* +* 注意事项: +* 后期根据测试遇到的情况在调整该函数。 +*/ +bool KylinSecretAgent::connectionIsAlwaysAsk(const NMVariantMapMap &connection) +{ + return false; +} + +/* +* +* 802-11-wireless-security.key-mgmt: sae/wpa-psk +* wpa-psk 是WPA/WPA2个人加密方式 +* sae 是WPA3个人加密方式 +* 涉及的字段: +* 802-11-wireless-security.key-mgmt: sae +* 802-11-wireless-security.psk: asdasd +* 802-11-wireless-security.psk-flags: 0(无) +* +* 该函数通过弹出密码框获取密码,并构建相应类型的密码 +*/ +void KylinSecretAgent::askSecretForPassword(QVariantMap &securityMap, + QString passwordKey, + const QString &settingName, + NMVariantMapMap &secretMap, QString connectionID) +{ + QString secretValue = ""; + + if (secretMap.contains(settingName)) { + QVariantMap secretKeyMap = secretMap.value(settingName); + if (!secretKeyMap.isEmpty()) { + secretValue = secretKeyMap.value(passwordKey).toString(); + } + } + + if (secretValue.isEmpty()) { + secretValue = securityMap.value(passwordKey).toString(); + } + + KyPasswordDialog pwdDialog(tr(""), connectionID, parentWidget); + pwdDialog.setPassword(secretValue); + pwdDialog.InitConnect(); + + if(pwdDialog.exec()==QDialog::Accepted){ + QString password = pwdDialog.getPassword(); + QVariantMap newSecretKeyMap = securityMap; + newSecretKeyMap[passwordKey] = password; + secretMap[settingName] = newSecretKeyMap; + + qDebug() << LOG_FLAG << "password:" << password; + } else { + secretMap.clear(); + } + + return; +} + +/* +* 802-11-wireless-security.wep-key-type: passphrase or key +* passphrase 是 WEP128位密码句 +* key 是WEP40/128位秘钥(十六进制 或 ASCII) +* 两者对应的相同的mgmt类型:802-11-wireless-security.key-mgmt: none +* 共用该函数,保存密码到秘钥环 +* 涉及的字段 +* 802-11-wireless-security.key-mgmt: none +* 802-11-wireless-security.wep-tx-keyidx: 2 +* 802-11-wireless-security.wep-key0: -- +* 802-11-wireless-security.wep-key1: -- +* 802-11-wireless-security.wep-key2: -- +* 802-11-wireless-security.wep-key3: -- +* 802-11-wireless-security.wep-key-flags: 1 +* 802-11-wireless-security.wep-key-type: passphrase +*/ + +QString KylinSecretAgent::getWepKeyFromId(uint wepId) +{ + QString wepKey = ""; + + switch(wepId) { + case KEY_TYPE0: + wepKey = WEP_KEY0; + break; + case KEY_TYPE1: + wepKey = WEP_KEY1; + break; + case KEY_TYPE2: + wepKey = WEP_KEY2; + break; + case KEY_TYPE3: + wepKey = WEP_KEY3; + break; + default: + qWarning() << LOG_FLAG + << "the wep key id" << wepId << "is undefined."; + } + + return wepKey; +} + +void KylinSecretAgent::askSecretForWep(QVariantMap &wirelessSecurityMap, + const QString &settingName, + NMVariantMapMap &secretMap, QString connectionID) +{ + QString wepKey = ""; + QString wepSecretValue = ""; + uint wepId = 0; + + if (wirelessSecurityMap.contains(WEP_ID_KEY)) { + wepId = wirelessSecurityMap.value(WEP_ID_KEY).toUInt(); + } + + wepKey = getWepKeyFromId(wepId); + if (wepKey.isEmpty()) { + QString errorMsg = "the wep key is invalide."; + qWarning() << LOG_FLAG << errorMsg; + //sendError(); + return; + } + + if (secretMap.contains(settingName)) { + QVariantMap secretKeyMap = secretMap.value(settingName); + if (!secretKeyMap.isEmpty()) { + wepSecretValue = secretKeyMap.value(wepKey).toString(); + } + } + + if (wepSecretValue.isEmpty()) { + wepSecretValue = wirelessSecurityMap.value(wepKey).toString(); + } + + KyPasswordDialog pwdDialog("", connectionID, parentWidget); + pwdDialog.setPassword(wepSecretValue); + pwdDialog.InitConnect(); + +// pwdDialog.exec(); + if(pwdDialog.exec()==QDialog::Accepted){ + QString password = pwdDialog.getPassword(); + QVariantMap newSecretKeyMap = wirelessSecurityMap; + newSecretKeyMap[wepKey] = password; + secretMap[settingName] = newSecretKeyMap; + qDebug() << LOG_FLAG << "password:" << password; + } else { + secretMap.clear(); + } + + return; +} + +/* +* leap加密类型对应的mgmt值: +* 802-11-wireless-security.key-mgmt: ieee8021x +* 涉及的字段 +* 802-11-wireless-security.leap-username: sadasd +* 802-11-wireless-security.leap-password: sadasd +* 802-11-wireless-security.leap-password-flags:0 +* +* 该函数通过弹窗获取正确的密码和用户名,需要构建相应的secretmap +*/ + +void KylinSecretAgent::askSecretForLeap(QVariantMap &wirelessSecurityMap, + const QString &settingName, + NMVariantMapMap &secretMap, QString connectionID) +{ + uint leapPasswordFlag = 0; + QString leapPassword = ""; + QString leapUserName = ""; + + if (wirelessSecurityMap.contains(LEAP_USER_KEY)) { + leapUserName = wirelessSecurityMap.value(LEAP_USER_KEY).toString(); + } + + if (wirelessSecurityMap.contains(LEAP_PASSWORD_FLAG)) { + leapPasswordFlag = wirelessSecurityMap.value(LEAP_PASSWORD_FLAG).toUInt(); + } + + if (secretMap.contains(settingName)) { + QVariantMap secretKeyMap = secretMap.value(settingName); + if (!secretKeyMap.isEmpty()) { + leapPassword = secretKeyMap.value(LEAP_PASSWORD_KEY).toString(); + } + } + + if (leapPassword.isEmpty()) { + leapPassword = wirelessSecurityMap.value(LEAP_PASSWORD_KEY).toString(); + } + + KyPasswordDialog pwdDialog("userAndPwd", connectionID, parentWidget); + pwdDialog.setUserName(leapUserName); + pwdDialog.setPassword(leapPassword); + pwdDialog.InitConnect(); + + pwdDialog.exec(); + if(pwdDialog.exec()==QDialog::Accepted){ + QString password = pwdDialog.getPassword(); + QString userName = pwdDialog.getUserName(); + QVariantMap securityMap; + securityMap[LEAP_PASSWORD_KEY] = password; + securityMap[LEAP_PASSWORD_FLAG] = leapPasswordFlag; + securityMap[LEAP_USER_KEY] = userName; + secretMap[settingName] = securityMap; + + qDebug() << LOG_FLAG << "password:" << password << userName; + } else { + secretMap.clear(); + } + + return; +} + +/* +* 功能:获取普通wifi的密码,分为三类 +* 1)wpa/wpa2/wpa3 +* 2) leap +* 3) wep +*/ +void KylinSecretAgent::askSecretForWireless(const NMVariantMapMap &connection, + const QString settingName, + NMVariantMapMap &secretMap) +{ + qDebug() << LOG_FLAG <<"askSecretForWireless connection" << connection; + QString secretType = ""; + + QVariantMap wirelessSecurityMap = connection.value(settingName); + if (wirelessSecurityMap.contains(KEY_MGMT)) { + secretType = wirelessSecurityMap.value(KEY_MGMT).toString(); + } else { + QString errorMsg = "can not get wireless secret type."; + sendError(InvalidConnection, errorMsg); + qWarning()<< LOG_FLAG << errorMsg; + return; + } + + QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString connectId = connectMap.value(ID_KEY).toString(); + + if (PSK_MGMT == secretType || SAE_MGMT == secretType) { + askSecretForPassword(wirelessSecurityMap, PSK_KEY, settingName, secretMap, connectId); + } else if (WEP_MGMT == secretType || WEP128_MGMT == secretType) { + askSecretForWep(wirelessSecurityMap, settingName, secretMap, connectId); + } else if (LEAP_MGMT == secretType) { + askSecretForLeap(wirelessSecurityMap, settingName, secretMap, connectId); + } else { + QString errorMsg = "the secret type" + secretType + "is undefined"; + sendError(InvalidConnection, errorMsg); + qWarning()<< LOG_FLAG << errorMsg; + return; + } + if (secretMap.isEmpty()) { + QString errorMsg = "user cancel get wireless secret"; + sendError(UserCanceled, errorMsg); + qWarning()<< LOG_FLAG << errorMsg; + return; + } + QVariantMap newSecurityMap = secretMap.value(WIRELESS_SECURITY_NAME); +// QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString connectUuid = connectMap.value(UUID_KEY).toString(); +// QString connectId = connectMap.value(ID_KEY).toString(); + saveWirelessSecret(newSecurityMap, connectId, connectUuid); + + return; +} + +/* +功能:获取企业wifi类型为非tls的密码,涉及的字段 +802-11-wireless-security.key-mgmt: wpa-eap/ieee8021x +wpa-eap 是wpa/wpa2企业 +ieee8021x 是动态wep(802.1x)需要和普通wifi的leep作区分 +802-1x.eap: ttls/pwd/leap/fast/peap +802-1x.identity: steve +802-1x.password: 23445 +802-1x.password-flags: 1 +*/ +void KylinSecretAgent::askSecretWithIdentityAndPassword(QVariantMap securityMap, + QString userKey, + QString passwordKey, + const QString &settingName, + NMVariantMapMap &secretMap, QString connectionID) +{ + QString password = ""; + QString userName = ""; + + if (securityMap.contains(userKey)) { + userName = securityMap.value(userKey).toString(); + } + + if (secretMap.contains(settingName)) { + QVariantMap secretKeyMap = secretMap.value(settingName); + if (!secretKeyMap.isEmpty()) { + password = secretKeyMap.value(passwordKey).toString(); + } + } + + if (password.isEmpty()) { + password = securityMap.value(passwordKey).toString(); + } + + KyPasswordDialog pwdDialog(tr("userAndPwd"), connectionID, parentWidget); + pwdDialog.setUserName(userName); + pwdDialog.setPassword(password); + pwdDialog.InitConnect(); + +// pwdDialog.exec(); + if(pwdDialog.exec()==QDialog::Accepted){ + QString newPassword = pwdDialog.getPassword(); + QString newUserName = pwdDialog.getUserName(); + QVariantMap newSecurityMap = securityMap; + newSecurityMap[userKey] = newUserName; + newSecurityMap[passwordKey] = newPassword; + secretMap[settingName] = newSecurityMap; + + qDebug() << LOG_FLAG << "password:" << newPassword << newUserName; + } else { + secretMap.clear(); + } + + return; +} + +/* +* 功能:获取tls类型的密码,涉及的字段 +802-1x.eap: tls +802-1x.domain-suffix-match: +802-1x.private-key-password: -- +802-1x.private-key-password-flags: 0(无) +802-1x.identity: steve +*/ +void KylinSecretAgent::askSecretForTls(QVariantMap securityMap, + const QString &settingName, + NMVariantMapMap &secretMap, QString connectionID) +{ + QString password = ""; + QString identity = ""; + QString domain = ""; + + qDebug() << LOG_FLAG << "tls security map" << securityMap; + if (securityMap.contains(IDENTITY_KEY)) { + identity = securityMap.value(IDENTITY_KEY).toString(); + } + + if (securityMap.contains(DOMAIN_KEY)) { + domain = securityMap.value(DOMAIN_KEY).toString(); + qDebug() << LOG_FLAG << "domain match" << domain; + } + + if (secretMap.contains(settingName)) { + QVariantMap secretKeyMap = secretMap.value(settingName); + if (!secretKeyMap.isEmpty()) { + password = secretKeyMap.value(PRIVATE_KEY).toString(); + } + } + + if (password.isEmpty()) { + password = securityMap.value(PRIVATE_KEY).toString(); + } + + KyPasswordDialog pwdDialog(tr("tls"), connectionID, parentWidget); + pwdDialog.setUserName(identity); + pwdDialog.setPassword(password); + pwdDialog.InitConnect(); + +// pwdDialog.exec(); + if(pwdDialog.exec()==QDialog::Accepted){ + QString newPassword = pwdDialog.getPassword(); + QString newIdentity = pwdDialog.getUserName(); + QVariantMap newSecurityMap = securityMap; + newSecurityMap[IDENTITY_KEY] = newIdentity; + newSecurityMap[PRIVATE_KEY] = newPassword; + newSecurityMap[DOMAIN_KEY] = domain; + secretMap[settingName] = newSecurityMap; + + qDebug() << LOG_FLAG << "tls password:" << newPassword << newIdentity << domain; + } else { + secretMap.clear(); + } + + return; +} + +void KylinSecretAgent::askSecretForEnterpriceWireless(const NMVariantMapMap &connection, + const QString settingName, + NMVariantMapMap &secretMap) +{ + qDebug() << LOG_FLAG <<"askSecretForEnterpriceWireless connection" << connection; + QString secretType = ""; + + QVariantMap enterpriceSecurityMap = connection.value(settingName); + if (enterpriceSecurityMap.contains(EAP_KEY)) { + secretType = enterpriceSecurityMap.value(EAP_KEY).toString(); + } else { + QString errorStr = "can not get enterprice secret type."; + sendError(InvalidConnection, errorStr); + qWarning()<< LOG_FLAG << errorStr; + return; + } + QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString connectId = connectMap.value(ID_KEY).toString(); + + if (TLS_EAP == secretType) { + askSecretForTls(enterpriceSecurityMap, settingName, secretMap, connectId); + } else { + askSecretWithIdentityAndPassword(enterpriceSecurityMap, + IDENTITY_KEY, PASSWORD_KEY, settingName, secretMap, connectId); + } + + if (secretMap.isEmpty()) { + QString errorStr = "user cancel get enterprice wireless secret"; + sendError(UserCanceled, errorStr); + qWarning()<< LOG_FLAG << errorStr; + } + + QVariantMap newSecurityMap = secretMap.value(settingName); +// QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString connectUuid = connectMap.value(UUID_KEY).toString(); +// QString connectId = connectMap.value(ID_KEY).toString(); + saveEnterpriceSecret(newSecurityMap, connectId, connectUuid); + + return; +} + +void KylinSecretAgent::askSecretForVpn(const NMVariantMapMap &connection, + const QString settingName, + NMVariantMapMap &secretMap) +{ + QVariantMap newVpnSetingMap; + + QVariantMap vpnSetingMap = connection.value(VPN_NAME); + if (vpnSetingMap.isEmpty()) { + QString errorStr = "the VPN map of connection is invalide"; + sendError(InvalidConnection, errorStr); + qWarning() << LOG_FLAG << errorStr; + return; + } + + QVariantMap vpnSecretMap = secretMap.value(VPN_NAME); + QStringList vpnSecret = getVpnPassword(vpnSecretMap); + if (vpnSecret.isEmpty() || vpnSecret.size() < 2) { + vpnSecret = getVpnPassword(vpnSetingMap); + } + QString secretKey = vpnSecret.at(0); + QString secretValue= vpnSecret.at(1); + + KyPasswordDialog pwdDialog("","", parentWidget); + pwdDialog.setPassword(secretValue); + pwdDialog.InitConnect(); + + pwdDialog.exec(); + if(pwdDialog.exec()==QDialog::Accepted){ + QString newPassword = pwdDialog.getPassword(); + newVpnSetingMap = vpnSetingMap; + newVpnSetingMap[VPN_SECRET] = secretKey + "=" + newPassword; + secretMap[VPN_NAME] = newVpnSetingMap; + + QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString connectUuid = connectMap.value(UUID_KEY).toString(); + QString connectId = connectMap.value(ID_KEY).toString(); + saveSecretForVpn(newVpnSetingMap, connectId, connectUuid); + + qDebug() << LOG_FLAG << "vpn password:" << newPassword ; + } else { + QString errorStr = "user canceled get vpn secret"; + sendError(UserCanceled, errorStr); + qWarning() << LOG_FLAG << errorStr; + } + + return; +} + +void KylinSecretAgent::askForSecret(const NMVariantMapMap &connection, + const QString &settingName, + QString connectType, + NMVariantMapMap &secretMap) +{ + if (VPN_TYPE == connectType) { + askSecretForVpn(connection, settingName, secretMap); + } else { + QVariantMap enterpriceSecurityMap = connection.value(ENTERPRICE_NAME); + if (!enterpriceSecurityMap.isEmpty()) { + askSecretForEnterpriceWireless(connection, settingName, secretMap); + } else { + QVariantMap wirelessSecurityMap = connection.value(WIRELESS_SECURITY_NAME); + if (!wirelessSecurityMap.isEmpty()) { + askSecretForWireless(connection, settingName, secretMap); + } else { + qWarning()<< LOG_FLAG << "can not ask secret for wireless"; + } + } + } + + return; +} + +NMVariantMapMap KylinSecretAgent::GetSecrets(const NMVariantMapMap &connection, + const QDBusObjectPath &connection_path, + const QString &settingName, + const QStringList &hints, + uint flags) +{ + //qDebug() << LOG_FLAG <<"GetSecrets connection" << connection; + + qDebug() << LOG_FLAG <<"GetSecrets setting name" << settingName; + qDebug() << LOG_FLAG <<"GetSecrets hints" << hints; + qDebug() << LOG_FLAG <<"GetSecrets flag" << flags; + + NMVariantMapMap secretMap; + + GHashTable *p_attributes = NULL; + GError *p_secretError = NULL; + GCancellable *p_cancellable = g_cancellable_new(); + + QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString connectUuid = connectMap.value(UUID_KEY).toString(); + QString connectType = connectMap.value(TYPE_KEY).toString(); + + p_attributes = secret_attributes_build (&network_manager_secret_schema, + KEYRING_UUID_TAG, connectUuid.toLocal8Bit().data(), + KEYRING_SN_TAG, settingName.toLocal8Bit().data(), + NULL); + if (NULL == p_attributes) { + qWarning() << LOG_FLAG << "create secret arributes for getting secret failed."; + //sendError(); + return secretMap; + } + + GList *p_secretList = secret_service_search_sync(NULL, &network_manager_secret_schema, p_attributes, + (SecretSearchFlags)(SECRET_SEARCH_ALL | SECRET_SEARCH_UNLOCK | SECRET_SEARCH_LOAD_SECRETS), + p_cancellable, &p_secretError); + if (p_secretError) { + if ((flags & AllowInteraction) + && g_error_matches (p_secretError, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN)) { + /* If the connection always asks for secrets, tolerate + * keyring service not being present. */ + qWarning() << LOG_FLAG << "secret dbus failed"; + g_clear_error (&p_secretError); + } else { + QString errorStr = "read secret from keyring error msg: (" + QString(p_secretError->message) + ")"; + qWarning() << LOG_FLAG << errorStr; + sendError(InternalError, errorStr); + g_hash_table_unref (p_attributes); + g_error_free (p_secretError); + g_object_unref(p_cancellable); + return secretMap; + } + } + + if ((flags & AllowInteraction) && g_list_length (p_secretList) == 0) { + qDebug() << LOG_FLAG << "get secret list is empty"; + askForSecret(connection, settingName, connectType, secretMap); + } else { + getSecretFromKeyring(p_secretList, settingName, connectType, secretMap); + bool hintFind = hintIsFind(p_secretList, hints); + if (flags) { + if (!hintFind) { + qDebug() << LOG_FLAG << "can not find hints int keyring"; + askForSecret(connection, settingName, connectType, secretMap); + } else if (flags & RequestNew) { + qDebug() << LOG_FLAG <<"request new secret"; + askForSecret(connection, settingName, connectType, secretMap); + } else if ((flags & AllowInteraction) + && connectionIsAlwaysAsk (connection)) { + qDebug() << LOG_FLAG << "secret is asked always"; + askForSecret(connection, settingName, connectType, secretMap); + } + } + } + + g_hash_table_unref (p_attributes); + g_object_unref(p_cancellable); + + return secretMap; +} + +void KylinSecretAgent::CancelGetSecrets(const QDBusObjectPath &connection_path, const QString &setting_name) +{ + //qDebug() << LOG_FLAG <<"CancelGetSecrets setting name" << setting_name; + //qDebug() << LOG_FLAG <<"CancelGetSecrets path" << connection_path; + + return; +} + +void KylinSecretAgent::saveOneSecret(QString &connectUuid, + QString settingName, + QString secretKey, + QString &secretValue, + QString &displayName) +{ + qDebug()<< LOG_FLAG << "save one secret" + << "display name" << displayName + << "uuid" << connectUuid + << "setting name" << settingName + << "psk key" << secretKey + << "psk secret" << secretValue; + + GHashTable *attrs = NULL; + GError *secretError = NULL; + GCancellable *cancellable = g_cancellable_new(); + + attrs = secret_attributes_build(&network_manager_secret_schema, + KEYRING_UUID_TAG, connectUuid.toLocal8Bit().data(), + KEYRING_SN_TAG, settingName.toLocal8Bit().data(), + KEYRING_SK_TAG, secretKey.toLocal8Bit().data(), + NULL); + if (!attrs) { + QString errorStr = "create secret attri failed"; + qWarning() << LOG_FLAG << errorStr; + g_object_unref (cancellable); + sendError(InternalError, errorStr); + return; + } + + gboolean ret = secret_password_storev_sync(&network_manager_secret_schema, attrs, NULL, + displayName.toLocal8Bit().data(), + secretValue.toLocal8Bit().data(), + cancellable, &secretError); + if (!ret) { + qWarning() << LOG_FLAG << "save secret failed"; + if (secretError) { + QString errorStr = "secret password storev error msg: (" + + QString(secretError->message) + ")"; + qWarning() << LOG_FLAG << errorStr; + sendError(InternalError, errorStr); + g_object_unref(secretError); + } + } + + g_object_unref (cancellable); + g_hash_table_unref (attrs); + + return; +} + +void KylinSecretAgent::saveConnectSecret(QVariantMap &securityMap, + QString secretSettingName, + QString &secretKey, + QString &connectId, + QString &connectUuid) +{ + //to do and test this case + QString secretValue = ""; + + if (!securityMap.contains(secretKey)) { + qWarning() << LOG_FLAG << "the secret key" << secretKey + << "is not contain in security map."; + return; + } + + secretValue = securityMap.value(secretKey).toString(); + if (secretValue.isEmpty()) { + qWarning() << LOG_FLAG << "the leap password is invalid."; + return; + } + + QString displayName = "Network secret for " + connectId + + "/" + secretSettingName + "/" + secretKey; + saveOneSecret(connectUuid, secretSettingName, + secretKey, secretValue, displayName); + + return; +} + +/* +* 802-11-wireless-security.wep-key-type: passphrase or key +* passphrase 是 WEP128位密码句 +* key 是WEP40/128位秘钥(十六进制 或 ASCII) +* 两者对应的相同的mgmt类型:802-11-wireless-security.key-mgmt: none +* 共用该函数,保存密码到秘钥环 +* 涉及的字段 +* 802-11-wireless-security.key-mgmt: none +* 802-11-wireless-security.wep-tx-keyidx: 2 +* 802-11-wireless-security.wep-key0: -- +* 802-11-wireless-security.wep-key1: -- +* 802-11-wireless-security.wep-key2: -- +* 802-11-wireless-security.wep-key3: -- +* 802-11-wireless-security.wep-key-flags: 1 +* 802-11-wireless-security.wep-key-type: passphrase +*/ +void KylinSecretAgent::saveWepSecret(QVariantMap &wirelessSecurityMap, + QString &connectId, + QString &connectUuid) +{ + QString wepSecret = ""; + QString wepKey = ""; + + uint wepKeyId = wirelessSecurityMap.value(WEP_ID_KEY).toUInt(); + + wepKey = getWepKeyFromId(wepKeyId); + if (wepKey.isEmpty()) { + QString errorMsg = "save wep secret, but wep key is invalide."; + qWarning() << LOG_FLAG << errorMsg; + //sendError(); + return; + } + + if (!wirelessSecurityMap.contains(wepKey)) { + qWarning()<::iterator iter; + + iter = wirelessInfo.begin(); + while (iter != wirelessInfo.end()) { + QString flagName = iter.key(); + QString secretName = iter.value(); + if (wirelessSecurityMap.contains(flagName)) { + uint secretFlag = wirelessSecurityMap.value(flagName).toUInt(); + if (POLICY_AGENT_OWNED == secretFlag) { + saveConnectSecret(wirelessSecurityMap, WIRELESS_SECURITY_NAME, + secretName, connectId, connectUuid); + } + + return; + } + + iter ++; + } + + if (wirelessSecurityMap.contains(WEP_FLAG_KEY)) { + uint wepFLags = wirelessSecurityMap.value(WEP_FLAG_KEY).toUInt(); + if (POLICY_AGENT_OWNED == wepFLags) { + saveWepSecret(wirelessSecurityMap, connectId, connectUuid); + } + } + + return; +} + +/* +* 功能:保存企业级的wifi密码到keyring,涉及的主要字段: +* 802-1x.optional: 否 +802-1x.eap: peap +802-1x.identity: steve + +802-1x.ca-cert-password: -- +802-1x.ca-cert-password-flags: 0(无) + +802-1x.client-cert-password: -- +802-1x.client-cert-password-flags: 0(无) + +802-1x.phase2-ca-cert-password: -- +802-1x.phase2-ca-cert-password-flags: 0(无) + +802-1x.phase2-client-cert-password: -- +802-1x.phase2-client-cert-password-flags:0(无) + +802-1x.password: testing +802-1x.password-flags: 0(无) + +802-1x.private-key-password: -- +802-1x.private-key-password-flags: 0(无) + +802-1x.phase2-private-key-password: -- +802-1x.phase2-private-key-password-flags:0(无) + +802-1x.pin: -- +802-1x.pin-flags: 0(无) + +目前根据测试情况,企业wifi密码类型主要分为两类: +1) +802-11-wireless-security.key-mgmt: wpa-eap/ieee8021x +wpa-eap 是wpa/wpa2企业 +ieee8021x 是动态wep(802.1x)需要和普通wifi的leep作区分 +802-1x.eap: ttls/pwd/leap/fast/peap +802-1x.identity: steve +802-1x.password: 23445 +802-1x.password-flags: 1 + +2) +802-1x.eap: tls +802-1x.domain-suffix-match: +802-1x.private-key-password: -- +802-1x.private-key-password-flags: 0(无) +802-1x.identity: steve + +对于这种密码类型nm-applet的agnet没有保存,不处理 +802-1x.password-raw: -- +802-1x.password-raw-flags: 0(无) + +通过如下命令可以查看信息: +nmcli connection show [connection uuid] --show-secrets + +通过打印日志,将SaveSecrets函数的入参connection打印出,也可以查看这些信息, +*/ + +void KylinSecretAgent::saveEnterpriceSecret(QVariantMap &enterpriceSecurityMap, + QString &connectId, + QString &connectUuid) +{ + QMap::iterator iter; + + iter = enterpriceInfo.begin(); + while (iter != enterpriceInfo.end()) { + QString flagName = iter.key(); + QString secretName = iter.value(); + if (enterpriceSecurityMap.contains(flagName)) { + uint secretFlags = enterpriceSecurityMap.value(flagName).toUInt(); + if (POLICY_AGENT_OWNED == secretFlags) { + saveConnectSecret(enterpriceSecurityMap, + ENTERPRICE_NAME, secretName, connectId, connectUuid); + } + } + + iter++; + } + + return; +} + +/* +* 功能:将wifi的密码保存到keyring上面 +* 先判断有没有企业级wifi的安全字段,有的话就从其获取要保存到keyring的密码 +* 如果没有那就从普通wifi的安全字段获取要保存到keyring的密码 +* +* 注意事项: +* 目前的测试情况:企业wifi和普通wifi的安全字段只有一个起作用,即互斥关系, +* 不能排除共存的情况,如果出现需要另做调整 +*/ + +void KylinSecretAgent::saveSecretForWireless(const NMVariantMapMap &connection, + QString &connectId, + QString &connectUuid) +{ + QVariantMap enterpriceSecurityMap = connection.value(ENTERPRICE_NAME); + if (!enterpriceSecurityMap.isEmpty()) { + saveEnterpriceSecret(enterpriceSecurityMap, connectId, connectUuid); + } else { + QVariantMap wirelessSecurityMap = connection.value(WIRELESS_SECURITY_NAME); + if (!wirelessSecurityMap.isEmpty()) { + saveWirelessSecret(wirelessSecurityMap, connectId, connectUuid); + } else { + QString errorStr = "wireless is invalid, save secret failed."; + sendError(InvalidConnection, errorStr); + qWarning() << LOG_FLAG << errorStr; + } + } + + return; +} + +QString KylinSecretAgent::getVpnDataItemByKey(QVariantMap &vpnMap, QString key) +{ + QString value = ""; + + QString vpnData = vpnMap.value(VPN_DATA).toString(); + if (vpnData.isEmpty()) { + qWarning() << LOG_FLAG << "vpn data is empty"; + return value; + } + + QStringList vpnDataList = vpnData.split(","); + int index = vpnDataList.indexOf(key); + if (index < 0) { + qWarning() << LOG_FLAG << "it can not find key" << key << "from vpn data"; + return value; + } + + QString vpnDataItem = vpnDataList.at(index); + QStringList keyList = vpnDataItem.split("="); + if (keyList.isEmpty() || keyList.size() < 2) { + return value; + } + + value = keyList.at(1); + + return value; +} + +QStringList KylinSecretAgent::getVpnPassword(QVariantMap &vpnMap) +{ + QStringList vpnPassword; + QString vpnSecret; + + vpnSecret.clear(); + vpnPassword.clear(); + + vpnSecret = vpnMap.value(VPN_SECRET).toString(); + if (vpnSecret.contains("=")) { + vpnPassword = vpnSecret.split("="); + } + + return vpnPassword; +} +/* +* 功能:将vpn的密码保存到keyring上面,vpn涉及的字段如下: + +vpn.service-type: org.freedesktop.NetworkManager.pptp +vpn.user-name: -- +vpn.data: gateway = 127.2.2.2, password-flags = 1, user = admin +vpn.secrets: password = 123456 +vpn.persistent: 否 +vpn.timeout: 0 + +其中主要的字段: +1)vpn.data中的password-flags,检查是否存于keyring +2)vpn.secrets中的password 是要存于keyring的密码,存密码时的key为password + +注意事项: +vpn.secrets可能会有多个密码,目前没有遇到,等遇到的时候在调试,目前先按一个处理 + +通过如下命令可以查看信息: +nmcli connection show [connection uuid] --show-secrets + +通过打印日志,将SaveSecrets函数的入参connection打印出,也可以查看这些信息, +***/ +void KylinSecretAgent::saveSecretForVpn(QVariantMap &vpnSetingMap, + QString &connectId, + QString &connectUuid) +{ + if (vpnSetingMap.isEmpty()) { + QString errorStr = "VPN map is empty"; + sendError(InvalidConnection, errorStr); + qWarning() << LOG_FLAG << errorStr; + return; + } + + QString vpnFlag = getVpnDataItemByKey(vpnSetingMap, VPN_FLAG); + if (vpnFlag.isEmpty() || POLICY_AGENT_OWNED != vpnFlag.toInt()){ + return; + } + + QStringList vpnSecret = getVpnPassword(vpnSetingMap); + if (vpnSecret.isEmpty() || vpnSecret.size() < 2) { + QString errorStr = "the vpn secret is invalid"; + sendError(NoSecrets, errorStr); + qWarning() << LOG_FLAG << errorStr; + return; + } + + QString secretKey = vpnSecret.at(0); + QString secretValue= vpnSecret.at(1); + + QString vpnService = vpnSetingMap.value(VPN_SERVICE).toString(); + QString displayName = "VPN" + vpnSecret.at(0) + "secret for" + + connectId + vpnService + "/vpn"; + + + saveOneSecret(connectUuid, VPN_NAME, secretKey, secretValue, displayName); + + return; + +} + +void KylinSecretAgent::SaveSecrets(const NMVariantMapMap &connection, + const QDBusObjectPath &connection_path) +{ + qDebug() << LOG_FLAG <<"SaveSecrets connection" << connection; + + //GError *secretError = NULL; + GCancellable *cancellable = g_cancellable_new(); + + QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString connectUuid = connectMap.value(UUID_KEY).toString(); + + secret_password_clear_sync(&network_manager_secret_schema, + cancellable, NULL, + KEYRING_UUID_TAG, + connectUuid.toLocal8Bit().data(), NULL); + if (g_cancellable_is_cancelled(cancellable)) { + qWarning() << LOG_FLAG << "save secret is canceled"; + g_object_unref(cancellable); + return; + } + + QString connectType = connectMap.value(TYPE_KEY).toString(); + QString connectId = connectMap.value(ID_KEY).toString(); + if (VPN_TYPE == connectType) { + QVariantMap vpnSetingMap = connection.value(VPN_NAME); + saveSecretForVpn(vpnSetingMap, connectId, connectUuid); + } else { + saveSecretForWireless(connection, connectId, connectUuid); + } + + return; +} + +void KylinSecretAgent::DeleteSecrets(const NMVariantMapMap &connection, + const QDBusObjectPath &connection_path) +{ + //qDebug() << LOG_FLAG <<"DeleteSecrets connection" << connection; + + GError *secretError = NULL; + GCancellable *cancellable = g_cancellable_new(); + + QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString uuid = connectMap.value(UUID_KEY).toString(); + + secret_password_clear_sync(&network_manager_secret_schema, + cancellable, + &secretError, + KEYRING_UUID_TAG, + uuid.toLocal8Bit().data(), + NULL); + + if (g_cancellable_is_cancelled(cancellable)) { + qWarning() << LOG_FLAG << "delete secret is canceled"; + g_object_unref(cancellable); + return; + } + + if (secretError != NULL) { + QString errorStr = "The request could not be completed (" + + QString(secretError->message) + ")"; + sendError(InternalError, errorStr); + g_error_free(secretError); + } + + g_object_unref(cancellable); + return; +} diff --git a/kylin-keyring/kylin-agent/kylinsecretagent.h b/kylin-keyring/kylin-agent/kylinsecretagent.h new file mode 100644 index 00000000..5b7424e5 --- /dev/null +++ b/kylin-keyring/kylin-agent/kylinsecretagent.h @@ -0,0 +1,112 @@ +#ifndef KYLINSECRETAGENT_H +#define KYLINSECRETAGENT_H + +#include + +#include +//#include +#include "networkmanagerqt/secretagent.h" + +#include "agentutils.h" + +class KylinSecretAgent: public NetworkManager::SecretAgent +{ + Q_OBJECT + +public: + explicit KylinSecretAgent(const QString &id, QWidget *pWidget = nullptr, QObject *parent = nullptr); + ~KylinSecretAgent(); + +private: + QWidget *parentWidget = nullptr; + void saveOneSecret(QString &connectUuid, QString settingName, + QString secretKey, QString &secretValue, QString &displayNmae); + void saveConnectSecret(QVariantMap &securityMap, QString secretSettingName, + QString &secretKey, QString &connectId, QString &connectUuid); + + void saveWepSecret(QVariantMap &wirelessSecurityMap, + QString &connectId, QString &connectUuid); + void saveWirelessSecret(QVariantMap &wirelessSecurityMap, + QString &connectId, QString &connectUuid); + + void saveEnterpriceSecret(QVariantMap &enterpriceSecurityMap, + QString &connectId, QString &connectUuidd); + + void saveSecretForWireless(const NMVariantMapMap &connection, + QString &connectId, QString &connectUuid); + + QStringList getVpnPassword(QVariantMap &vpnSettingMap); + QString getVpnDataItemByKey(QVariantMap &vpnSettingMap, QString key); + void saveSecretForVpn(QVariantMap &vpnSetingMap, + QString &connectId, QString &connectUuid); + + void getSecretFromKeyring(GList *p_secretList, const QString &settingName, + QString connectType, NMVariantMapMap &secretMap); + bool hintIsFind(GList *p_secretList, const QStringList &hints); + bool connectionIsAlwaysAsk(const NMVariantMapMap &connection); + QString getWepKeyFromId(uint wepId); + + + void askSecretForLeap(QVariantMap &wirelessSecurityMap, + const QString &settingName, NMVariantMapMap &secretMap, QString connectionID); + void askSecretForWep(QVariantMap &wirelessSecurityMap, + const QString &settingName, NMVariantMapMap &secretMap, QString connectionID); + void askSecretForPassword(QVariantMap &securityMap, QString passwordKey, + const QString &settingName, NMVariantMapMap &secretMap, QString connectionID); + void askSecretForWireless(const NMVariantMapMap &connection, + const QString settingName, NMVariantMapMap &secretMap); + + void askSecretForTls(QVariantMap securityMap, + const QString &settingName, NMVariantMapMap &secretMap, QString connectionID); + void askSecretWithIdentityAndPassword(QVariantMap securityMap, QString userKey, + QString passwordKey, const QString &settingName, NMVariantMapMap &secretMap, QString connectionID); + void askSecretForEnterpriceWireless(const NMVariantMapMap &connection, + const QString settingName, NMVariantMapMap &secretMap); + void askSecretForVpn(const NMVariantMapMap &connection, + const QString settingName, NMVariantMapMap &secretMap); + void askForSecret(const NMVariantMapMap &connection, const QString &settingName, + QString connectType, NMVariantMapMap &secretMap); + +public Q_SLOTS: + + /* + * kylin-nm的agent功能主要是实现如下四个函数,这四个函数继承自父类NetworkManager::SecretAgent + * 当发生错误的时候,调用父类的sendError函数,给networkmanager返回结果 + * 调试方式 + * 根据kylin-nm移植的nm-applet的agent功能代码添加日志,进行流程调试梳理,完成了该代码的开发, + * 后续出了问题可以通过这种方式理顺流程调试解决问题。 + * 注意事项: + * 1)所有的函数keyring、的操作都是同步的,需要其单独的agent线程,否则容易阻塞 + * 2)目前代码只是对能够测试到的情况做了代码实现,有可能会有遗漏的地方,后续出现新情况,在完善。 + */ + + /* + * 该函数从秘钥环上面获取密码,并将获取到的密码组成安全的mapmap返回,失败后通过sendError返回错误, + * 函数的返回值将变得无效 + */ + NMVariantMapMap GetSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path, + const QString &setting_name, const QStringList &hints, uint flags); + + /* + * 该函数用于取消agent的操作,从测试的情况来看,目前没有发现在什么时候会出现这种情况 + * 暂时未实现,后期注意观察,出现问题后根据具体情况实现, + * 返回值为空,如果出现错误,通过sendError返回错误 + */ + void CancelGetSecrets(const QDBusObjectPath &connection_path, const QString &setting_name); + + /* + * 该函数将密码保存到keyring上面,要保存的密码可以在connection参数中查找到, + * 返回值为空,如果出现错误,通过sendError返回错误 + */ + void SaveSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path); + /* + * 该函数将密码从keyring上面删除,返回值为空,如果出现错误,通过sendError返回错误 + */ + void DeleteSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path); + +private: + QMap enterpriceInfo; + QMap wirelessInfo; +}; + +#endif // KYLINSECRETAGENT_H diff --git a/kylin-keyring/kylin-keyring b/kylin-keyring/kylin-keyring new file mode 100755 index 00000000..4d1ea9cf Binary files /dev/null and b/kylin-keyring/kylin-keyring differ diff --git a/kylin-keyring/kylin-keyring.pro b/kylin-keyring/kylin-keyring.pro new file mode 100644 index 00000000..c02cf117 --- /dev/null +++ b/kylin-keyring/kylin-keyring.pro @@ -0,0 +1,73 @@ +QT += core gui x11extras dbus KWindowSystem svg concurrent network + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = kylin-keyring +TEMPLATE = lib +DEFINES += LIBKYLIN_KEYRING_LIBRARY + +CONFIG += c++14 qt warn_on link_pkgconfig console +CONFIG += no_keywords + +PKGCONFIG +=gio-2.0 glib-2.0 gio-unix-2.0 libnm libnma libsecret-1 gtk+-3.0 gsettings-qt libcap kysdk-qtwidgets + +INCLUDEPATH += /usr/include/KF5/NetworkManagerQt + +LIBS += -L/usr/lib/ -lKF5NetworkManagerQt + +# 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 + +# QMAKE_CXXFLAGS += -Wno-unused-parameter +QMAKE_CPPFLAGS *= $(shell dpkg-buildflags --get CPPFLAGS) +QMAKE_CFLAGS *= $(shell dpkg-buildflags --get CFLAGS) +QMAKE_CXXFLAGS *= $(shell dpkg-buildflags --get CXXFLAGS) +QMAKE_LFLAGS *= $(shell dpkg-buildflags --get LDFLAGS) + +#include(kylin-agent/kylin-agent.pri) +INCLUDEPATH += $$PWD +INCLUDEPATH += ./kylin-agent + +HEADERS += \ + ./kylin-agent/agentutils.h \ + ./kylin-agent/kylinagent.h \ +# ./kylin-agent/kylinagentobject.h \ + ./kylin-agent/kylinpassworddialog.h \ + ./kylin-agent/kylinsecretagent.h + +SOURCES += \ + ./kylin-agent/kylinagent.cpp \ +# ./kylin-agent/kylinagentobject.cpp \ + ./kylin-agent/kylinpassworddialog.cpp \ + ./kylin-agent/kylinsecretagent.cpp \ + +TRANSLATIONS += \ + ./translations/kylin-keyring_zh_CN.ts \ + ./translations/kylin-keyring_tr.ts \ + ./translations/kylin-keyring_bo.ts + +unix { + target.path = /usr/lib/ + + manager.path = /usr/include/kylin-nm/kylin-agent + manager.files = kylin-agent/agentutils.h \ + kylin-agent/kylinagent.h \ + kylin-agent/kylinagentobject.h \ + kylin-agent/kylinpassworddialog.h \ + kylin-agent/kylinsecretagent.h + + INSTALLS += manager +} +!isEmpty(target.path): INSTALLS += target + + +RESOURCES += \ + svg.qrc diff --git a/kylin-keyring/main.cpp b/kylin-keyring/main.cpp new file mode 100644 index 00000000..de1b8af7 --- /dev/null +++ b/kylin-keyring/main.cpp @@ -0,0 +1,29 @@ +#include +#include +#include +#include "kylinagent.h" +#include + +bool isAppRuning(); + +int main(int argc, char *argv[]) +{ + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); + QApplication a(argc, argv); + + KylinAgent* agent = new KylinAgent(); + agent->startKylinAgent(); + + QTranslator trans_global; + qDebug() << "QLocale " << QLocale(); + if (trans_global.load(QLocale(), "kylin-keyring", "_", "/usr/share/kylin-keyring/")) + { + a.installTranslator(&trans_global); + qDebug()<<"Translations load success"; + } else { + qWarning() << "Translations load fail"; + } + + return a.exec(); +} diff --git a/kylin-keyring/qrc_svg.cpp b/kylin-keyring/qrc_svg.cpp new file mode 100644 index 00000000..5bde982b --- /dev/null +++ b/kylin-keyring/qrc_svg.cpp @@ -0,0 +1,617 @@ +/**************************************************************************** +** Resource object code +** +** Created by: The Resource Compiler for Qt version 5.12.8 +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +static const unsigned char qt_resource_data[] = { + // /home/crush/project/3.2/kylin-nm-dev/kylin-keyring/authorize.svg + 0x0,0x0,0x21,0x86, + 0x3c, + 0x73,0x76,0x67,0x20,0x77,0x69,0x64,0x74,0x68,0x3d,0x22,0x34,0x38,0x22,0x20,0x68, + 0x65,0x69,0x67,0x68,0x74,0x3d,0x22,0x34,0x38,0x22,0x20,0x76,0x69,0x65,0x77,0x42, + 0x6f,0x78,0x3d,0x22,0x30,0x20,0x30,0x20,0x34,0x38,0x20,0x34,0x38,0x22,0x20,0x66, + 0x69,0x6c,0x6c,0x3d,0x22,0x6e,0x6f,0x6e,0x65,0x22,0x20,0x78,0x6d,0x6c,0x6e,0x73, + 0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x77,0x33,0x2e, + 0x6f,0x72,0x67,0x2f,0x32,0x30,0x30,0x30,0x2f,0x73,0x76,0x67,0x22,0x3e,0xa,0x3c, + 0x67,0x20,0x66,0x69,0x6c,0x74,0x65,0x72,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x66, + 0x69,0x6c,0x74,0x65,0x72,0x30,0x5f,0x69,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38, + 0x36,0x37,0x33,0x32,0x29,0x22,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d, + 0x22,0x4d,0x39,0x2e,0x35,0x39,0x39,0x39,0x34,0x20,0x31,0x34,0x2e,0x39,0x34,0x38, + 0x38,0x43,0x39,0x2e,0x35,0x39,0x39,0x39,0x34,0x20,0x31,0x30,0x2e,0x31,0x30,0x36, + 0x31,0x20,0x31,0x33,0x2e,0x33,0x31,0x39,0x34,0x20,0x36,0x2e,0x31,0x36,0x35,0x38, + 0x37,0x20,0x31,0x38,0x2e,0x31,0x33,0x33,0x33,0x20,0x36,0x2e,0x31,0x36,0x35,0x38, + 0x37,0x43,0x32,0x32,0x2e,0x39,0x34,0x37,0x31,0x20,0x36,0x2e,0x31,0x36,0x35,0x38, + 0x37,0x20,0x32,0x36,0x2e,0x38,0x36,0x33,0x39,0x20,0x31,0x30,0x2e,0x31,0x30,0x36, + 0x31,0x20,0x32,0x36,0x2e,0x38,0x36,0x33,0x39,0x20,0x31,0x34,0x2e,0x39,0x34,0x38, + 0x38,0x56,0x32,0x36,0x2e,0x33,0x31,0x34,0x31,0x48,0x33,0x31,0x2e,0x39,0x39,0x39, + 0x39,0x56,0x31,0x34,0x2e,0x39,0x34,0x38,0x38,0x43,0x33,0x31,0x2e,0x39,0x39,0x39, + 0x39,0x20,0x37,0x2e,0x32,0x35,0x37,0x30,0x37,0x20,0x32,0x35,0x2e,0x37,0x37,0x39, + 0x31,0x20,0x31,0x20,0x31,0x38,0x2e,0x31,0x33,0x33,0x33,0x20,0x31,0x43,0x31,0x30, + 0x2e,0x34,0x38,0x37,0x34,0x20,0x31,0x20,0x34,0x2e,0x32,0x36,0x36,0x36,0x20,0x37, + 0x2e,0x32,0x35,0x37,0x30,0x37,0x20,0x34,0x2e,0x32,0x36,0x36,0x36,0x20,0x31,0x34, + 0x2e,0x39,0x34,0x38,0x38,0x56,0x32,0x32,0x2e,0x31,0x38,0x31,0x39,0x48,0x39,0x2e, + 0x35,0x39,0x39,0x39,0x34,0x56,0x31,0x34,0x2e,0x39,0x34,0x38,0x38,0x5a,0x22,0x20, + 0x66,0x69,0x6c,0x6c,0x3d,0x22,0x23,0x45,0x41,0x45,0x41,0x45,0x41,0x22,0x2f,0x3e, + 0xa,0x3c,0x2f,0x67,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d, + 0x30,0x20,0x31,0x39,0x2e,0x31,0x33,0x33,0x33,0x48,0x33,0x36,0x2e,0x32,0x36,0x36, + 0x37,0x56,0x34,0x30,0x2e,0x37,0x33,0x33,0x33,0x43,0x33,0x36,0x2e,0x32,0x36,0x36, + 0x37,0x20,0x34,0x32,0x2e,0x39,0x34,0x32,0x34,0x20,0x33,0x34,0x2e,0x34,0x37,0x35, + 0x38,0x20,0x34,0x34,0x2e,0x37,0x33,0x33,0x33,0x20,0x33,0x32,0x2e,0x32,0x36,0x36, + 0x37,0x20,0x34,0x34,0x2e,0x37,0x33,0x33,0x33,0x48,0x34,0x43,0x31,0x2e,0x37,0x39, + 0x30,0x38,0x36,0x20,0x34,0x34,0x2e,0x37,0x33,0x33,0x33,0x20,0x30,0x20,0x34,0x32, + 0x2e,0x39,0x34,0x32,0x34,0x20,0x30,0x20,0x34,0x30,0x2e,0x37,0x33,0x33,0x33,0x56, + 0x31,0x39,0x2e,0x31,0x33,0x33,0x33,0x5a,0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22, + 0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,0x30,0x5f,0x6c,0x69,0x6e,0x65, + 0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x29,0x22, + 0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,0x33,0x36,0x2e, + 0x32,0x36,0x36,0x37,0x20,0x31,0x39,0x2e,0x31,0x33,0x33,0x33,0x48,0x30,0x56,0x31, + 0x39,0x2e,0x32,0x39,0x39,0x37,0x43,0x34,0x2e,0x36,0x33,0x35,0x37,0x33,0x20,0x32, + 0x30,0x2e,0x34,0x37,0x32,0x20,0x31,0x31,0x2e,0x30,0x34,0x37,0x35,0x20,0x32,0x31, + 0x2e,0x31,0x39,0x38,0x34,0x20,0x31,0x38,0x2e,0x31,0x33,0x33,0x33,0x20,0x32,0x31, + 0x2e,0x31,0x39,0x38,0x34,0x43,0x32,0x35,0x2e,0x32,0x31,0x39,0x32,0x20,0x32,0x31, + 0x2e,0x31,0x39,0x38,0x34,0x20,0x33,0x31,0x2e,0x36,0x33,0x30,0x39,0x20,0x32,0x30, + 0x2e,0x34,0x37,0x32,0x20,0x33,0x36,0x2e,0x32,0x36,0x36,0x37,0x20,0x31,0x39,0x2e, + 0x32,0x39,0x39,0x37,0x56,0x31,0x39,0x2e,0x31,0x33,0x33,0x33,0x5a,0x22,0x20,0x66, + 0x69,0x6c,0x6c,0x3d,0x22,0x23,0x46,0x43,0x45,0x46,0x44,0x32,0x22,0x2f,0x3e,0xa, + 0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,0x33,0x36,0x2e,0x32,0x36,0x36, + 0x37,0x20,0x31,0x39,0x2e,0x31,0x33,0x33,0x33,0x48,0x30,0x56,0x31,0x39,0x2e,0x32, + 0x35,0x30,0x36,0x43,0x34,0x2e,0x36,0x33,0x35,0x37,0x33,0x20,0x32,0x30,0x2e,0x30, + 0x37,0x35,0x32,0x20,0x31,0x31,0x2e,0x30,0x34,0x37,0x35,0x20,0x32,0x30,0x2e,0x35, + 0x38,0x36,0x31,0x20,0x31,0x38,0x2e,0x31,0x33,0x33,0x33,0x20,0x32,0x30,0x2e,0x35, + 0x38,0x36,0x31,0x43,0x32,0x35,0x2e,0x32,0x31,0x39,0x32,0x20,0x32,0x30,0x2e,0x35, + 0x38,0x36,0x31,0x20,0x33,0x31,0x2e,0x36,0x33,0x30,0x39,0x20,0x32,0x30,0x2e,0x30, + 0x37,0x35,0x32,0x20,0x33,0x36,0x2e,0x32,0x36,0x36,0x37,0x20,0x31,0x39,0x2e,0x32, + 0x35,0x30,0x36,0x56,0x31,0x39,0x2e,0x31,0x33,0x33,0x33,0x5a,0x22,0x20,0x66,0x69, + 0x6c,0x6c,0x3d,0x22,0x23,0x46,0x46,0x44,0x31,0x38,0x46,0x22,0x2f,0x3e,0xa,0x3c, + 0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,0x32,0x32,0x2e,0x34,0x31,0x37,0x33, + 0x20,0x34,0x34,0x2e,0x37,0x33,0x33,0x33,0x4c,0x32,0x32,0x2e,0x35,0x30,0x33,0x37, + 0x20,0x34,0x34,0x2e,0x36,0x34,0x36,0x39,0x4c,0x32,0x32,0x2e,0x36,0x37,0x35,0x35, + 0x20,0x34,0x34,0x2e,0x37,0x33,0x33,0x33,0x48,0x32,0x33,0x2e,0x36,0x36,0x4c,0x32, + 0x35,0x2e,0x31,0x39,0x34,0x39,0x20,0x34,0x33,0x2e,0x31,0x39,0x38,0x34,0x4c,0x32, + 0x34,0x2e,0x33,0x36,0x36,0x31,0x20,0x34,0x31,0x2e,0x35,0x34,0x31,0x38,0x4c,0x32, + 0x35,0x2e,0x36,0x30,0x38,0x38,0x20,0x34,0x30,0x2e,0x32,0x39,0x39,0x32,0x4c,0x32, + 0x37,0x2e,0x32,0x36,0x35,0x33,0x20,0x34,0x31,0x2e,0x31,0x32,0x38,0x4c,0x33,0x32, + 0x2e,0x38,0x39,0x33,0x31,0x20,0x33,0x35,0x2e,0x35,0x30,0x30,0x32,0x43,0x33,0x33, + 0x2e,0x39,0x34,0x33,0x37,0x20,0x33,0x36,0x2e,0x30,0x37,0x37,0x33,0x20,0x33,0x35, + 0x2e,0x30,0x36,0x39,0x20,0x33,0x36,0x2e,0x34,0x36,0x37,0x37,0x20,0x33,0x36,0x2e, + 0x32,0x32,0x31,0x31,0x20,0x33,0x36,0x2e,0x36,0x37,0x35,0x37,0x56,0x31,0x39,0x2e, + 0x31,0x33,0x33,0x33,0x4c,0x32,0x38,0x2e,0x35,0x36,0x36,0x37,0x20,0x32,0x30,0x2e, + 0x35,0x33,0x34,0x39,0x43,0x32,0x38,0x2e,0x31,0x37,0x34,0x31,0x20,0x32,0x30,0x2e, + 0x38,0x33,0x33,0x36,0x20,0x32,0x38,0x2e,0x37,0x30,0x34,0x33,0x20,0x32,0x31,0x2e, + 0x31,0x31,0x33,0x20,0x32,0x37,0x2e,0x37,0x33,0x33,0x36,0x20,0x32,0x31,0x2e,0x32, + 0x36,0x36,0x36,0x43,0x32,0x36,0x2e,0x38,0x36,0x35,0x33,0x20,0x32,0x33,0x2e,0x34, + 0x36,0x32,0x39,0x20,0x32,0x38,0x2e,0x31,0x33,0x36,0x38,0x20,0x32,0x34,0x2e,0x34, + 0x34,0x39,0x36,0x20,0x32,0x38,0x2e,0x38,0x30,0x30,0x33,0x20,0x32,0x37,0x2e,0x36, + 0x36,0x36,0x36,0x4c,0x31,0x31,0x2e,0x38,0x37,0x30,0x31,0x20,0x34,0x34,0x2e,0x36, + 0x38,0x37,0x34,0x4c,0x32,0x32,0x2e,0x34,0x31,0x37,0x33,0x20,0x34,0x34,0x2e,0x37, + 0x33,0x33,0x33,0x5a,0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,0x23,0x44,0x45,0x39, + 0x36,0x35,0x33,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x66,0x69,0x6c, + 0x6c,0x2d,0x72,0x75,0x6c,0x65,0x3d,0x22,0x65,0x76,0x65,0x6e,0x6f,0x64,0x64,0x22, + 0x20,0x63,0x6c,0x69,0x70,0x2d,0x72,0x75,0x6c,0x65,0x3d,0x22,0x65,0x76,0x65,0x6e, + 0x6f,0x64,0x64,0x22,0x20,0x64,0x3d,0x22,0x4d,0x32,0x39,0x2e,0x32,0x35,0x32,0x36, + 0x20,0x31,0x35,0x2e,0x38,0x30,0x33,0x32,0x43,0x33,0x33,0x2e,0x35,0x34,0x31,0x37, + 0x20,0x31,0x31,0x2e,0x35,0x31,0x34,0x32,0x20,0x34,0x30,0x2e,0x34,0x39,0x34,0x32, + 0x20,0x31,0x31,0x2e,0x35,0x31,0x34,0x32,0x20,0x34,0x34,0x2e,0x37,0x38,0x33,0x33, + 0x20,0x31,0x35,0x2e,0x38,0x30,0x33,0x32,0x43,0x34,0x39,0x2e,0x30,0x37,0x32,0x33, + 0x20,0x32,0x30,0x2e,0x30,0x39,0x31,0x32,0x20,0x34,0x39,0x2e,0x30,0x37,0x32,0x33, + 0x20,0x32,0x37,0x2e,0x30,0x34,0x34,0x38,0x20,0x34,0x34,0x2e,0x37,0x38,0x35,0x34, + 0x20,0x33,0x31,0x2e,0x33,0x33,0x33,0x39,0x43,0x34,0x31,0x2e,0x32,0x35,0x31,0x35, + 0x20,0x33,0x34,0x2e,0x38,0x36,0x37,0x38,0x20,0x33,0x35,0x2e,0x39,0x31,0x33,0x39, + 0x20,0x33,0x35,0x2e,0x34,0x38,0x32,0x32,0x20,0x33,0x31,0x2e,0x37,0x34,0x33,0x33, + 0x20,0x33,0x33,0x2e,0x31,0x39,0x34,0x32,0x4c,0x32,0x38,0x2e,0x31,0x31,0x35,0x35, + 0x20,0x33,0x36,0x2e,0x38,0x32,0x31,0x39,0x4c,0x32,0x36,0x2e,0x34,0x35,0x39,0x20, + 0x33,0x35,0x2e,0x39,0x39,0x33,0x31,0x4c,0x32,0x35,0x2e,0x32,0x31,0x36,0x33,0x20, + 0x33,0x37,0x2e,0x32,0x33,0x35,0x38,0x4c,0x32,0x36,0x2e,0x30,0x34,0x35,0x31,0x20, + 0x33,0x38,0x2e,0x38,0x39,0x32,0x33,0x4c,0x32,0x34,0x2e,0x31,0x38,0x31,0x37,0x20, + 0x34,0x30,0x2e,0x37,0x35,0x35,0x38,0x4c,0x32,0x33,0x2e,0x33,0x35,0x32,0x39,0x20, + 0x34,0x30,0x2e,0x33,0x34,0x31,0x39,0x4c,0x32,0x32,0x2e,0x31,0x31,0x30,0x32,0x20, + 0x34,0x31,0x2e,0x35,0x38,0x34,0x36,0x4c,0x32,0x32,0x2e,0x35,0x32,0x34,0x31,0x20, + 0x34,0x32,0x2e,0x34,0x31,0x33,0x34,0x4c,0x32,0x31,0x2e,0x32,0x38,0x31,0x34,0x20, + 0x34,0x33,0x2e,0x36,0x35,0x36,0x4c,0x31,0x39,0x2e,0x36,0x32,0x34,0x39,0x20,0x34, + 0x32,0x2e,0x38,0x32,0x37,0x32,0x4c,0x31,0x38,0x2e,0x33,0x38,0x32,0x32,0x20,0x34, + 0x34,0x2e,0x30,0x36,0x39,0x39,0x4c,0x31,0x39,0x2e,0x32,0x31,0x31,0x20,0x34,0x35, + 0x2e,0x37,0x32,0x36,0x34,0x4c,0x31,0x37,0x2e,0x32,0x30,0x36,0x37,0x20,0x34,0x37, + 0x2e,0x37,0x33,0x30,0x37,0x4c,0x31,0x32,0x2e,0x31,0x36,0x39,0x39,0x20,0x34,0x36, + 0x2e,0x35,0x35,0x34,0x32,0x4c,0x31,0x32,0x2e,0x32,0x33,0x36,0x31,0x20,0x34,0x32, + 0x2e,0x37,0x36,0x4c,0x32,0x36,0x2e,0x39,0x38,0x33,0x38,0x20,0x32,0x38,0x2e,0x30, + 0x31,0x31,0x32,0x43,0x32,0x35,0x2e,0x32,0x30,0x31,0x34,0x20,0x32,0x33,0x2e,0x39, + 0x38,0x32,0x34,0x20,0x32,0x35,0x2e,0x39,0x35,0x31,0x33,0x20,0x31,0x39,0x2e,0x31, + 0x30,0x34,0x36,0x20,0x32,0x39,0x2e,0x32,0x35,0x32,0x36,0x20,0x31,0x35,0x2e,0x38, + 0x30,0x33,0x32,0x5a,0x4d,0x33,0x37,0x2e,0x33,0x32,0x39,0x34,0x20,0x31,0x38,0x2e, + 0x39,0x30,0x38,0x33,0x43,0x33,0x36,0x2e,0x31,0x32,0x38,0x33,0x20,0x32,0x30,0x2e, + 0x31,0x30,0x39,0x34,0x20,0x33,0x36,0x2e,0x31,0x32,0x38,0x33,0x20,0x32,0x32,0x2e, + 0x30,0x35,0x36,0x20,0x33,0x37,0x2e,0x33,0x32,0x39,0x34,0x20,0x32,0x33,0x2e,0x32, + 0x35,0x37,0x31,0x43,0x33,0x38,0x2e,0x35,0x32,0x39,0x34,0x20,0x32,0x34,0x2e,0x34, + 0x35,0x38,0x32,0x20,0x34,0x30,0x2e,0x34,0x37,0x37,0x31,0x20,0x32,0x34,0x2e,0x34, + 0x35,0x38,0x32,0x20,0x34,0x31,0x2e,0x36,0x37,0x38,0x32,0x20,0x32,0x33,0x2e,0x32, + 0x35,0x37,0x31,0x43,0x34,0x32,0x2e,0x38,0x37,0x39,0x33,0x20,0x32,0x32,0x2e,0x30, + 0x35,0x36,0x20,0x34,0x32,0x2e,0x38,0x37,0x39,0x33,0x20,0x32,0x30,0x2e,0x31,0x30, + 0x39,0x34,0x20,0x34,0x31,0x2e,0x36,0x37,0x38,0x32,0x20,0x31,0x38,0x2e,0x39,0x30, + 0x38,0x33,0x43,0x34,0x30,0x2e,0x34,0x37,0x37,0x31,0x20,0x31,0x37,0x2e,0x37,0x30, + 0x37,0x32,0x20,0x33,0x38,0x2e,0x35,0x33,0x30,0x35,0x20,0x31,0x37,0x2e,0x37,0x30, + 0x37,0x32,0x20,0x33,0x37,0x2e,0x33,0x32,0x39,0x34,0x20,0x31,0x38,0x2e,0x39,0x30, + 0x38,0x33,0x5a,0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23, + 0x70,0x61,0x69,0x6e,0x74,0x31,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32, + 0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70, + 0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,0x31,0x37,0x2e,0x32,0x30,0x35,0x35,0x20, + 0x34,0x37,0x2e,0x37,0x32,0x39,0x37,0x4c,0x31,0x39,0x2e,0x32,0x30,0x39,0x37,0x20, + 0x34,0x35,0x2e,0x37,0x32,0x35,0x34,0x4c,0x31,0x38,0x2e,0x33,0x38,0x30,0x39,0x20, + 0x34,0x34,0x2e,0x30,0x36,0x38,0x39,0x4c,0x31,0x39,0x2e,0x36,0x32,0x33,0x36,0x20, + 0x34,0x32,0x2e,0x38,0x32,0x36,0x32,0x4c,0x32,0x31,0x2e,0x32,0x38,0x30,0x31,0x20, + 0x34,0x33,0x2e,0x36,0x35,0x35,0x4c,0x32,0x32,0x2e,0x35,0x32,0x32,0x38,0x20,0x34, + 0x32,0x2e,0x34,0x31,0x32,0x33,0x4c,0x32,0x32,0x2e,0x31,0x30,0x38,0x39,0x20,0x34, + 0x31,0x2e,0x35,0x38,0x33,0x35,0x4c,0x32,0x33,0x2e,0x33,0x35,0x30,0x35,0x20,0x34, + 0x30,0x2e,0x33,0x34,0x31,0x39,0x4c,0x32,0x34,0x2e,0x31,0x37,0x39,0x33,0x20,0x34, + 0x30,0x2e,0x37,0x35,0x35,0x38,0x4c,0x32,0x36,0x2e,0x30,0x34,0x32,0x38,0x20,0x33, + 0x38,0x2e,0x38,0x39,0x32,0x33,0x4c,0x32,0x35,0x2e,0x32,0x31,0x35,0x31,0x20,0x33, + 0x37,0x2e,0x32,0x33,0x35,0x38,0x4c,0x32,0x36,0x2e,0x34,0x35,0x37,0x37,0x20,0x33, + 0x35,0x2e,0x39,0x39,0x33,0x31,0x4c,0x32,0x38,0x2e,0x31,0x31,0x34,0x33,0x20,0x33, + 0x36,0x2e,0x38,0x32,0x30,0x39,0x4c,0x33,0x30,0x2e,0x31,0x38,0x34,0x37,0x20,0x33, + 0x34,0x2e,0x37,0x35,0x30,0x35,0x4c,0x32,0x37,0x2e,0x36,0x39,0x39,0x33,0x20,0x33, + 0x33,0x2e,0x35,0x30,0x37,0x38,0x4c,0x31,0x34,0x2e,0x31,0x38,0x33,0x36,0x20,0x34, + 0x37,0x2e,0x30,0x32,0x34,0x36,0x4c,0x31,0x37,0x2e,0x32,0x30,0x35,0x35,0x20,0x34, + 0x37,0x2e,0x37,0x32,0x39,0x37,0x5a,0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,0x75, + 0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,0x32,0x5f,0x6c,0x69,0x6e,0x65,0x61, + 0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x29,0x22,0x2f, + 0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,0x31,0x32,0x2e,0x31, + 0x36,0x38,0x39,0x20,0x34,0x36,0x2e,0x35,0x35,0x33,0x39,0x4c,0x32,0x36,0x2e,0x34, + 0x35,0x38,0x20,0x33,0x32,0x2e,0x32,0x36,0x34,0x38,0x4c,0x32,0x35,0x2e,0x38,0x33, + 0x36,0x31,0x20,0x33,0x31,0x2e,0x36,0x34,0x34,0x4c,0x31,0x32,0x2e,0x31,0x39,0x31, + 0x33,0x20,0x34,0x35,0x2e,0x32,0x38,0x38,0x38,0x4c,0x31,0x32,0x2e,0x31,0x36,0x38, + 0x39,0x20,0x34,0x36,0x2e,0x35,0x35,0x33,0x39,0x5a,0x22,0x20,0x66,0x69,0x6c,0x6c, + 0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,0x33,0x5f,0x6c,0x69, + 0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32, + 0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,0x32, + 0x36,0x2e,0x34,0x35,0x37,0x39,0x20,0x33,0x32,0x2e,0x32,0x36,0x35,0x31,0x4c,0x31, + 0x32,0x2e,0x34,0x33,0x35,0x35,0x20,0x34,0x36,0x2e,0x32,0x38,0x36,0x35,0x4c,0x31, + 0x32,0x2e,0x35,0x39,0x31,0x33,0x20,0x34,0x36,0x2e,0x36,0x35,0x32,0x33,0x4c,0x32, + 0x36,0x2e,0x37,0x31,0x35,0x20,0x33,0x32,0x2e,0x35,0x32,0x33,0x33,0x4c,0x32,0x36, + 0x2e,0x34,0x35,0x37,0x39,0x20,0x33,0x32,0x2e,0x32,0x36,0x35,0x31,0x5a,0x22,0x20, + 0x66,0x69,0x6c,0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74, + 0x34,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38, + 0x36,0x37,0x33,0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64, + 0x3d,0x22,0x4d,0x32,0x37,0x2e,0x34,0x30,0x30,0x39,0x20,0x32,0x38,0x2e,0x34,0x32, + 0x37,0x32,0x4c,0x32,0x37,0x2e,0x33,0x39,0x38,0x38,0x20,0x32,0x38,0x2e,0x34,0x32, + 0x31,0x39,0x4c,0x32,0x36,0x2e,0x39,0x38,0x32,0x38,0x20,0x32,0x38,0x2e,0x30,0x30, + 0x35,0x39,0x4c,0x32,0x36,0x2e,0x39,0x38,0x34,0x39,0x20,0x32,0x38,0x2e,0x30,0x31, + 0x31,0x32,0x4c,0x31,0x32,0x2e,0x32,0x33,0x36,0x31,0x20,0x34,0x32,0x2e,0x37,0x36, + 0x4c,0x31,0x32,0x2e,0x31,0x36,0x38,0x39,0x20,0x34,0x36,0x2e,0x35,0x35,0x34,0x31, + 0x4c,0x31,0x32,0x2e,0x35,0x39,0x31,0x33,0x20,0x34,0x36,0x2e,0x36,0x35,0x32,0x33, + 0x4c,0x31,0x32,0x2e,0x36,0x35,0x32,0x31,0x20,0x34,0x33,0x2e,0x31,0x37,0x36,0x4c, + 0x32,0x37,0x2e,0x34,0x30,0x30,0x39,0x20,0x32,0x38,0x2e,0x34,0x32,0x37,0x32,0x5a, + 0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69, + 0x6e,0x74,0x35,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f, + 0x31,0x38,0x36,0x37,0x33,0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68, + 0x20,0x64,0x3d,0x22,0x4d,0x34,0x34,0x2e,0x37,0x38,0x33,0x31,0x20,0x31,0x35,0x2e, + 0x38,0x30,0x33,0x32,0x43,0x34,0x30,0x2e,0x34,0x39,0x34,0x20,0x31,0x31,0x2e,0x35, + 0x31,0x34,0x32,0x20,0x33,0x33,0x2e,0x35,0x34,0x31,0x35,0x20,0x31,0x31,0x2e,0x35, + 0x31,0x34,0x32,0x20,0x32,0x39,0x2e,0x32,0x35,0x32,0x34,0x20,0x31,0x35,0x2e,0x38, + 0x30,0x33,0x32,0x43,0x32,0x35,0x2e,0x37,0x37,0x38,0x33,0x20,0x31,0x39,0x2e,0x32, + 0x37,0x37,0x34,0x20,0x32,0x35,0x2e,0x31,0x32,0x30,0x32,0x20,0x32,0x34,0x2e,0x34, + 0x39,0x39,0x38,0x20,0x32,0x37,0x2e,0x32,0x37,0x34,0x38,0x20,0x32,0x38,0x2e,0x36, + 0x33,0x38,0x34,0x4c,0x32,0x37,0x2e,0x36,0x31,0x31,0x39,0x20,0x32,0x38,0x2e,0x33, + 0x30,0x31,0x34,0x43,0x32,0x35,0x2e,0x36,0x32,0x34,0x37,0x20,0x32,0x34,0x2e,0x33, + 0x35,0x32,0x36,0x20,0x32,0x36,0x2e,0x32,0x37,0x32,0x32,0x20,0x31,0x39,0x2e,0x34, + 0x31,0x37,0x31,0x20,0x32,0x39,0x2e,0x35,0x36,0x39,0x32,0x20,0x31,0x36,0x2e,0x31, + 0x32,0x43,0x33,0x33,0x2e,0x36,0x38,0x32,0x33,0x20,0x31,0x32,0x2e,0x30,0x30,0x37, + 0x20,0x34,0x30,0x2e,0x33,0x35,0x32,0x32,0x20,0x31,0x32,0x2e,0x30,0x30,0x37,0x20, + 0x34,0x34,0x2e,0x34,0x36,0x35,0x32,0x20,0x31,0x36,0x2e,0x31,0x32,0x43,0x34,0x38, + 0x2e,0x35,0x37,0x38,0x33,0x20,0x32,0x30,0x2e,0x32,0x33,0x33,0x31,0x20,0x34,0x38, + 0x2e,0x35,0x37,0x38,0x33,0x20,0x32,0x36,0x2e,0x39,0x30,0x33,0x20,0x34,0x34,0x2e, + 0x34,0x36,0x35,0x32,0x20,0x33,0x31,0x2e,0x30,0x31,0x36,0x43,0x34,0x31,0x2e,0x30, + 0x39,0x30,0x33,0x20,0x33,0x34,0x2e,0x33,0x39,0x31,0x20,0x33,0x35,0x2e,0x39,0x39, + 0x38,0x20,0x33,0x34,0x2e,0x39,0x39,0x31,0x35,0x20,0x33,0x32,0x2e,0x30,0x30,0x35, + 0x35,0x20,0x33,0x32,0x2e,0x38,0x32,0x39,0x34,0x4c,0x33,0x31,0x2e,0x36,0x37,0x38, + 0x20,0x33,0x33,0x2e,0x31,0x35,0x36,0x38,0x43,0x33,0x35,0x2e,0x38,0x35,0x37,0x32, + 0x20,0x33,0x35,0x2e,0x34,0x38,0x36,0x34,0x20,0x34,0x31,0x2e,0x32,0x33,0x31,0x31, + 0x20,0x33,0x34,0x2e,0x38,0x38,0x34,0x38,0x20,0x34,0x34,0x2e,0x37,0x38,0x32,0x20, + 0x33,0x31,0x2e,0x33,0x33,0x33,0x39,0x43,0x34,0x39,0x2e,0x30,0x37,0x32,0x32,0x20, + 0x32,0x37,0x2e,0x30,0x34,0x34,0x38,0x20,0x34,0x39,0x2e,0x30,0x37,0x32,0x32,0x20, + 0x32,0x30,0x2e,0x30,0x39,0x31,0x32,0x20,0x34,0x34,0x2e,0x37,0x38,0x33,0x31,0x20, + 0x31,0x35,0x2e,0x38,0x30,0x33,0x32,0x5a,0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22, + 0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,0x36,0x5f,0x6c,0x69,0x6e,0x65, + 0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x29,0x22, + 0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x66,0x69,0x6c,0x6c,0x2d,0x72,0x75, + 0x6c,0x65,0x3d,0x22,0x65,0x76,0x65,0x6e,0x6f,0x64,0x64,0x22,0x20,0x63,0x6c,0x69, + 0x70,0x2d,0x72,0x75,0x6c,0x65,0x3d,0x22,0x65,0x76,0x65,0x6e,0x6f,0x64,0x64,0x22, + 0x20,0x64,0x3d,0x22,0x4d,0x34,0x37,0x2e,0x39,0x33,0x31,0x39,0x20,0x32,0x32,0x2e, + 0x33,0x39,0x32,0x31,0x43,0x34,0x38,0x2e,0x30,0x38,0x30,0x31,0x20,0x32,0x35,0x2e, + 0x33,0x38,0x32,0x20,0x34,0x37,0x2e,0x30,0x32,0x34,0x31,0x20,0x32,0x38,0x2e,0x34, + 0x31,0x39,0x38,0x20,0x34,0x34,0x2e,0x37,0x34,0x31,0x35,0x20,0x33,0x30,0x2e,0x37, + 0x30,0x32,0x35,0x43,0x34,0x31,0x2e,0x32,0x30,0x38,0x37,0x20,0x33,0x34,0x2e,0x32, + 0x33,0x35,0x33,0x20,0x33,0x35,0x2e,0x38,0x37,0x20,0x33,0x34,0x2e,0x38,0x35,0x30, + 0x38,0x20,0x33,0x31,0x2e,0x36,0x39,0x39,0x33,0x20,0x33,0x32,0x2e,0x35,0x36,0x32, + 0x38,0x4c,0x32,0x38,0x2e,0x30,0x37,0x31,0x36,0x20,0x33,0x36,0x2e,0x31,0x39,0x30, + 0x35,0x4c,0x32,0x36,0x2e,0x34,0x31,0x35,0x31,0x20,0x33,0x35,0x2e,0x33,0x36,0x31, + 0x37,0x4c,0x32,0x35,0x2e,0x31,0x37,0x32,0x34,0x20,0x33,0x36,0x2e,0x36,0x30,0x34, + 0x34,0x4c,0x32,0x35,0x2e,0x33,0x39,0x36,0x34,0x20,0x33,0x37,0x2e,0x30,0x35,0x33, + 0x34,0x4c,0x32,0x36,0x2e,0x34,0x35,0x36,0x37,0x20,0x33,0x35,0x2e,0x39,0x39,0x33, + 0x32,0x4c,0x32,0x38,0x2e,0x31,0x31,0x33,0x32,0x20,0x33,0x36,0x2e,0x38,0x32,0x32, + 0x4c,0x33,0x31,0x2e,0x37,0x34,0x30,0x39,0x20,0x33,0x33,0x2e,0x31,0x39,0x34,0x32, + 0x43,0x33,0x35,0x2e,0x39,0x31,0x31,0x36,0x20,0x33,0x35,0x2e,0x34,0x38,0x32,0x32, + 0x20,0x34,0x31,0x2e,0x32,0x34,0x39,0x32,0x20,0x33,0x34,0x2e,0x38,0x36,0x37,0x38, + 0x20,0x34,0x34,0x2e,0x37,0x38,0x33,0x31,0x20,0x33,0x31,0x2e,0x33,0x33,0x34,0x43, + 0x34,0x37,0x2e,0x32,0x32,0x37,0x39,0x20,0x32,0x38,0x2e,0x38,0x38,0x39,0x32,0x20, + 0x34,0x38,0x2e,0x32,0x37,0x33,0x32,0x20,0x32,0x35,0x2e,0x35,0x38,0x30,0x34,0x20, + 0x34,0x37,0x2e,0x39,0x33,0x31,0x39,0x20,0x32,0x32,0x2e,0x33,0x39,0x32,0x31,0x5a, + 0x4d,0x31,0x39,0x2e,0x35,0x38,0x32,0x20,0x34,0x32,0x2e,0x31,0x39,0x34,0x38,0x4c, + 0x32,0x31,0x2e,0x32,0x33,0x38,0x35,0x20,0x34,0x33,0x2e,0x30,0x32,0x33,0x36,0x4c, + 0x32,0x32,0x2e,0x32,0x39,0x38,0x38,0x20,0x34,0x31,0x2e,0x39,0x36,0x33,0x33,0x4c, + 0x32,0x32,0x2e,0x35,0x32,0x32,0x38,0x20,0x34,0x32,0x2e,0x34,0x31,0x32,0x34,0x4c, + 0x32,0x31,0x2e,0x32,0x38,0x30,0x31,0x20,0x34,0x33,0x2e,0x36,0x35,0x35,0x4c,0x31, + 0x39,0x2e,0x36,0x32,0x33,0x36,0x20,0x34,0x32,0x2e,0x38,0x32,0x36,0x32,0x4c,0x31, + 0x38,0x2e,0x35,0x36,0x33,0x33,0x20,0x34,0x33,0x2e,0x38,0x38,0x36,0x35,0x4c,0x31, + 0x38,0x2e,0x33,0x33,0x39,0x33,0x20,0x34,0x33,0x2e,0x34,0x33,0x37,0x34,0x4c,0x31, + 0x39,0x2e,0x35,0x38,0x32,0x20,0x34,0x32,0x2e,0x31,0x39,0x34,0x38,0x5a,0x4d,0x31, + 0x39,0x2e,0x32,0x30,0x39,0x37,0x20,0x34,0x35,0x2e,0x37,0x32,0x36,0x35,0x4c,0x31, + 0x38,0x2e,0x39,0x38,0x35,0x37,0x20,0x34,0x35,0x2e,0x32,0x37,0x37,0x34,0x4c,0x31, + 0x37,0x2e,0x31,0x36,0x32,0x38,0x20,0x34,0x37,0x2e,0x31,0x30,0x30,0x34,0x4c,0x31, + 0x34,0x2e,0x36,0x39,0x39,0x39,0x20,0x34,0x36,0x2e,0x35,0x30,0x35,0x32,0x4c,0x31, + 0x34,0x2e,0x31,0x38,0x33,0x36,0x20,0x34,0x37,0x2e,0x30,0x32,0x34,0x36,0x4c,0x31, + 0x37,0x2e,0x32,0x30,0x35,0x35,0x20,0x34,0x37,0x2e,0x37,0x33,0x30,0x38,0x4c,0x31, + 0x39,0x2e,0x32,0x30,0x39,0x37,0x20,0x34,0x35,0x2e,0x37,0x32,0x36,0x35,0x5a,0x4d, + 0x32,0x33,0x2e,0x33,0x30,0x38,0x39,0x20,0x33,0x39,0x2e,0x37,0x31,0x31,0x36,0x4c, + 0x32,0x34,0x2e,0x31,0x33,0x37,0x37,0x20,0x34,0x30,0x2e,0x31,0x32,0x35,0x34,0x4c, + 0x32,0x35,0x2e,0x38,0x31,0x38,0x38,0x20,0x33,0x38,0x2e,0x34,0x34,0x34,0x34,0x4c, + 0x32,0x36,0x2e,0x30,0x34,0x32,0x38,0x20,0x33,0x38,0x2e,0x38,0x39,0x33,0x34,0x4c, + 0x32,0x34,0x2e,0x31,0x37,0x39,0x33,0x20,0x34,0x30,0x2e,0x37,0x35,0x36,0x39,0x4c, + 0x32,0x33,0x2e,0x33,0x35,0x30,0x35,0x20,0x34,0x30,0x2e,0x33,0x34,0x33,0x4c,0x32, + 0x32,0x2e,0x32,0x39,0x30,0x33,0x20,0x34,0x31,0x2e,0x34,0x30,0x33,0x33,0x4c,0x32, + 0x32,0x2e,0x30,0x36,0x36,0x33,0x20,0x34,0x30,0x2e,0x39,0x35,0x34,0x32,0x4c,0x32, + 0x33,0x2e,0x33,0x30,0x38,0x39,0x20,0x33,0x39,0x2e,0x37,0x31,0x31,0x36,0x5a,0x22, + 0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e, + 0x74,0x37,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31, + 0x38,0x36,0x37,0x33,0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20, + 0x66,0x69,0x6c,0x6c,0x2d,0x72,0x75,0x6c,0x65,0x3d,0x22,0x65,0x76,0x65,0x6e,0x6f, + 0x64,0x64,0x22,0x20,0x63,0x6c,0x69,0x70,0x2d,0x72,0x75,0x6c,0x65,0x3d,0x22,0x65, + 0x76,0x65,0x6e,0x6f,0x64,0x64,0x22,0x20,0x64,0x3d,0x22,0x4d,0x33,0x35,0x2e,0x39, + 0x36,0x31,0x39,0x20,0x32,0x31,0x2e,0x31,0x30,0x31,0x33,0x43,0x33,0x35,0x2e,0x39, + 0x36,0x31,0x39,0x20,0x31,0x39,0x2e,0x31,0x35,0x35,0x37,0x20,0x33,0x37,0x2e,0x35, + 0x33,0x39,0x35,0x20,0x31,0x37,0x2e,0x35,0x37,0x38,0x31,0x20,0x33,0x39,0x2e,0x34, + 0x38,0x35,0x31,0x20,0x31,0x37,0x2e,0x35,0x37,0x38,0x31,0x43,0x34,0x31,0x2e,0x34, + 0x33,0x30,0x37,0x20,0x31,0x37,0x2e,0x35,0x37,0x38,0x31,0x20,0x34,0x33,0x2e,0x30, + 0x30,0x38,0x33,0x20,0x31,0x39,0x2e,0x31,0x35,0x35,0x37,0x20,0x34,0x33,0x2e,0x30, + 0x30,0x38,0x33,0x20,0x32,0x31,0x2e,0x31,0x30,0x31,0x33,0x43,0x34,0x33,0x2e,0x30, + 0x30,0x38,0x33,0x20,0x32,0x33,0x2e,0x30,0x34,0x36,0x39,0x20,0x34,0x31,0x2e,0x34, + 0x33,0x30,0x37,0x20,0x32,0x34,0x2e,0x36,0x32,0x34,0x35,0x20,0x33,0x39,0x2e,0x34, + 0x38,0x35,0x31,0x20,0x32,0x34,0x2e,0x36,0x32,0x34,0x35,0x43,0x33,0x37,0x2e,0x35, + 0x33,0x39,0x35,0x20,0x32,0x34,0x2e,0x36,0x32,0x34,0x35,0x20,0x33,0x35,0x2e,0x39, + 0x36,0x31,0x39,0x20,0x32,0x33,0x2e,0x30,0x34,0x36,0x39,0x20,0x33,0x35,0x2e,0x39, + 0x36,0x31,0x39,0x20,0x32,0x31,0x2e,0x31,0x30,0x31,0x33,0x5a,0x4d,0x33,0x36,0x2e, + 0x34,0x30,0x39,0x39,0x20,0x32,0x31,0x2e,0x31,0x30,0x31,0x33,0x43,0x33,0x36,0x2e, + 0x34,0x30,0x39,0x39,0x20,0x32,0x32,0x2e,0x37,0x39,0x39,0x35,0x20,0x33,0x37,0x2e, + 0x37,0x38,0x37,0x20,0x32,0x34,0x2e,0x31,0x37,0x36,0x35,0x20,0x33,0x39,0x2e,0x34, + 0x38,0x35,0x31,0x20,0x32,0x34,0x2e,0x31,0x37,0x36,0x35,0x43,0x34,0x31,0x2e,0x31, + 0x38,0x33,0x32,0x20,0x32,0x34,0x2e,0x31,0x37,0x36,0x35,0x20,0x34,0x32,0x2e,0x35, + 0x36,0x30,0x33,0x20,0x32,0x32,0x2e,0x37,0x39,0x39,0x35,0x20,0x34,0x32,0x2e,0x35, + 0x36,0x30,0x33,0x20,0x32,0x31,0x2e,0x31,0x30,0x31,0x33,0x43,0x34,0x32,0x2e,0x35, + 0x36,0x30,0x33,0x20,0x31,0x39,0x2e,0x34,0x30,0x33,0x32,0x20,0x34,0x31,0x2e,0x31, + 0x38,0x33,0x32,0x20,0x31,0x38,0x2e,0x30,0x32,0x36,0x31,0x20,0x33,0x39,0x2e,0x34, + 0x38,0x35,0x31,0x20,0x31,0x38,0x2e,0x30,0x32,0x36,0x31,0x43,0x33,0x37,0x2e,0x37, + 0x38,0x37,0x20,0x31,0x38,0x2e,0x30,0x32,0x36,0x31,0x20,0x33,0x36,0x2e,0x34,0x30, + 0x39,0x39,0x20,0x31,0x39,0x2e,0x34,0x30,0x33,0x32,0x20,0x33,0x36,0x2e,0x34,0x30, + 0x39,0x39,0x20,0x32,0x31,0x2e,0x31,0x30,0x31,0x33,0x5a,0x22,0x20,0x66,0x69,0x6c, + 0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,0x38,0x5f,0x6c, + 0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33, + 0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d, + 0x33,0x37,0x2e,0x33,0x32,0x38,0x38,0x20,0x31,0x38,0x2e,0x39,0x30,0x39,0x34,0x43, + 0x33,0x38,0x2e,0x35,0x32,0x39,0x39,0x20,0x31,0x37,0x2e,0x37,0x30,0x38,0x33,0x20, + 0x34,0x30,0x2e,0x34,0x37,0x36,0x35,0x20,0x31,0x37,0x2e,0x37,0x30,0x38,0x33,0x20, + 0x34,0x31,0x2e,0x36,0x37,0x37,0x36,0x20,0x31,0x38,0x2e,0x39,0x30,0x39,0x34,0x43, + 0x34,0x32,0x2e,0x30,0x34,0x34,0x35,0x20,0x31,0x39,0x2e,0x32,0x37,0x36,0x33,0x20, + 0x34,0x32,0x2e,0x32,0x38,0x34,0x35,0x20,0x31,0x39,0x2e,0x37,0x31,0x35,0x38,0x20, + 0x34,0x32,0x2e,0x34,0x32,0x37,0x35,0x20,0x32,0x30,0x2e,0x31,0x37,0x38,0x37,0x4c, + 0x34,0x36,0x2e,0x38,0x34,0x36,0x36,0x20,0x31,0x38,0x2e,0x36,0x38,0x32,0x32,0x43, + 0x34,0x36,0x2e,0x33,0x33,0x30,0x34,0x20,0x31,0x37,0x2e,0x36,0x34,0x34,0x33,0x20, + 0x34,0x35,0x2e,0x36,0x34,0x38,0x38,0x20,0x31,0x36,0x2e,0x36,0x36,0x38,0x33,0x20, + 0x34,0x34,0x2e,0x37,0x38,0x33,0x37,0x20,0x31,0x35,0x2e,0x38,0x30,0x33,0x32,0x43, + 0x34,0x30,0x2e,0x34,0x39,0x34,0x36,0x20,0x31,0x31,0x2e,0x35,0x31,0x34,0x32,0x20, + 0x33,0x33,0x2e,0x35,0x34,0x31,0x20,0x31,0x31,0x2e,0x35,0x31,0x34,0x32,0x20,0x32, + 0x39,0x2e,0x32,0x35,0x33,0x20,0x31,0x35,0x2e,0x38,0x30,0x33,0x32,0x43,0x32,0x36, + 0x2e,0x35,0x37,0x33,0x36,0x20,0x31,0x38,0x2e,0x34,0x38,0x31,0x36,0x20,0x32,0x35, + 0x2e,0x35,0x37,0x36,0x32,0x20,0x32,0x32,0x2e,0x31,0x39,0x37,0x39,0x20,0x32,0x36, + 0x2e,0x32,0x34,0x37,0x32,0x20,0x32,0x35,0x2e,0x36,0x35,0x37,0x31,0x4c,0x33,0x36, + 0x2e,0x36,0x32,0x34,0x38,0x20,0x32,0x32,0x2e,0x31,0x34,0x33,0x35,0x43,0x33,0x36, + 0x2e,0x32,0x32,0x33,0x37,0x20,0x32,0x31,0x2e,0x30,0x35,0x32,0x33,0x20,0x33,0x36, + 0x2e,0x34,0x35,0x33,0x20,0x31,0x39,0x2e,0x37,0x38,0x34,0x20,0x33,0x37,0x2e,0x33, + 0x32,0x38,0x38,0x20,0x31,0x38,0x2e,0x39,0x30,0x39,0x34,0x5a,0x22,0x20,0x66,0x69, + 0x6c,0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,0x39,0x5f, + 0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37, + 0x33,0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22, + 0x4d,0x34,0x30,0x2e,0x36,0x34,0x35,0x34,0x20,0x32,0x34,0x2e,0x37,0x33,0x34,0x36, + 0x43,0x34,0x30,0x2e,0x33,0x37,0x37,0x37,0x20,0x32,0x34,0x2e,0x34,0x38,0x35,0x20, + 0x34,0x30,0x2e,0x36,0x37,0x34,0x32,0x20,0x32,0x33,0x2e,0x37,0x33,0x30,0x39,0x20, + 0x34,0x31,0x2e,0x33,0x30,0x38,0x39,0x20,0x32,0x33,0x2e,0x30,0x35,0x30,0x33,0x43, + 0x34,0x31,0x2e,0x39,0x34,0x32,0x35,0x20,0x32,0x32,0x2e,0x33,0x36,0x39,0x38,0x20, + 0x34,0x32,0x2e,0x36,0x37,0x34,0x32,0x20,0x32,0x32,0x2e,0x30,0x31,0x39,0x39,0x20, + 0x34,0x32,0x2e,0x39,0x34,0x31,0x39,0x20,0x32,0x32,0x2e,0x32,0x36,0x39,0x35,0x43, + 0x34,0x33,0x2e,0x32,0x30,0x39,0x37,0x20,0x32,0x32,0x2e,0x35,0x31,0x39,0x31,0x20, + 0x34,0x32,0x2e,0x39,0x31,0x33,0x31,0x20,0x32,0x33,0x2e,0x32,0x37,0x33,0x33,0x20, + 0x34,0x32,0x2e,0x32,0x37,0x38,0x35,0x20,0x32,0x33,0x2e,0x39,0x35,0x33,0x38,0x43, + 0x34,0x31,0x2e,0x36,0x34,0x33,0x38,0x20,0x32,0x34,0x2e,0x36,0x33,0x34,0x33,0x20, + 0x34,0x30,0x2e,0x39,0x31,0x33,0x31,0x20,0x32,0x34,0x2e,0x39,0x38,0x33,0x31,0x20, + 0x34,0x30,0x2e,0x36,0x34,0x35,0x34,0x20,0x32,0x34,0x2e,0x37,0x33,0x34,0x36,0x5a, + 0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69, + 0x6e,0x74,0x31,0x30,0x5f,0x72,0x61,0x64,0x69,0x61,0x6c,0x5f,0x36,0x32,0x38,0x35, + 0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x64,0x65,0x66, + 0x73,0x3e,0xa,0x3c,0x66,0x69,0x6c,0x74,0x65,0x72,0x20,0x69,0x64,0x3d,0x22,0x66, + 0x69,0x6c,0x74,0x65,0x72,0x30,0x5f,0x69,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38, + 0x36,0x37,0x33,0x32,0x22,0x20,0x78,0x3d,0x22,0x34,0x2e,0x32,0x36,0x36,0x36,0x22, + 0x20,0x79,0x3d,0x22,0x30,0x22,0x20,0x77,0x69,0x64,0x74,0x68,0x3d,0x22,0x32,0x37, + 0x2e,0x37,0x33,0x33,0x34,0x22,0x20,0x68,0x65,0x69,0x67,0x68,0x74,0x3d,0x22,0x32, + 0x36,0x2e,0x33,0x31,0x34,0x22,0x20,0x66,0x69,0x6c,0x74,0x65,0x72,0x55,0x6e,0x69, + 0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,0x55, + 0x73,0x65,0x22,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x2d,0x69,0x6e,0x74,0x65,0x72,0x70, + 0x6f,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x2d,0x66,0x69,0x6c,0x74,0x65,0x72,0x73,0x3d, + 0x22,0x73,0x52,0x47,0x42,0x22,0x3e,0xa,0x3c,0x66,0x65,0x46,0x6c,0x6f,0x6f,0x64, + 0x20,0x66,0x6c,0x6f,0x6f,0x64,0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3d,0x22, + 0x30,0x22,0x20,0x72,0x65,0x73,0x75,0x6c,0x74,0x3d,0x22,0x42,0x61,0x63,0x6b,0x67, + 0x72,0x6f,0x75,0x6e,0x64,0x49,0x6d,0x61,0x67,0x65,0x46,0x69,0x78,0x22,0x2f,0x3e, + 0xa,0x3c,0x66,0x65,0x42,0x6c,0x65,0x6e,0x64,0x20,0x6d,0x6f,0x64,0x65,0x3d,0x22, + 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x22,0x20,0x69,0x6e,0x3d,0x22,0x53,0x6f,0x75,0x72, + 0x63,0x65,0x47,0x72,0x61,0x70,0x68,0x69,0x63,0x22,0x20,0x69,0x6e,0x32,0x3d,0x22, + 0x42,0x61,0x63,0x6b,0x67,0x72,0x6f,0x75,0x6e,0x64,0x49,0x6d,0x61,0x67,0x65,0x46, + 0x69,0x78,0x22,0x20,0x72,0x65,0x73,0x75,0x6c,0x74,0x3d,0x22,0x73,0x68,0x61,0x70, + 0x65,0x22,0x2f,0x3e,0xa,0x3c,0x66,0x65,0x43,0x6f,0x6c,0x6f,0x72,0x4d,0x61,0x74, + 0x72,0x69,0x78,0x20,0x69,0x6e,0x3d,0x22,0x53,0x6f,0x75,0x72,0x63,0x65,0x41,0x6c, + 0x70,0x68,0x61,0x22,0x20,0x74,0x79,0x70,0x65,0x3d,0x22,0x6d,0x61,0x74,0x72,0x69, + 0x78,0x22,0x20,0x76,0x61,0x6c,0x75,0x65,0x73,0x3d,0x22,0x30,0x20,0x30,0x20,0x30, + 0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30, + 0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x31, + 0x32,0x37,0x20,0x30,0x22,0x20,0x72,0x65,0x73,0x75,0x6c,0x74,0x3d,0x22,0x68,0x61, + 0x72,0x64,0x41,0x6c,0x70,0x68,0x61,0x22,0x2f,0x3e,0xa,0x3c,0x66,0x65,0x4f,0x66, + 0x66,0x73,0x65,0x74,0x20,0x64,0x79,0x3d,0x22,0x2d,0x31,0x22,0x2f,0x3e,0xa,0x3c, + 0x66,0x65,0x47,0x61,0x75,0x73,0x73,0x69,0x61,0x6e,0x42,0x6c,0x75,0x72,0x20,0x73, + 0x74,0x64,0x44,0x65,0x76,0x69,0x61,0x74,0x69,0x6f,0x6e,0x3d,0x22,0x31,0x2e,0x35, + 0x22,0x2f,0x3e,0xa,0x3c,0x66,0x65,0x43,0x6f,0x6d,0x70,0x6f,0x73,0x69,0x74,0x65, + 0x20,0x69,0x6e,0x32,0x3d,0x22,0x68,0x61,0x72,0x64,0x41,0x6c,0x70,0x68,0x61,0x22, + 0x20,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x3d,0x22,0x61,0x72,0x69,0x74,0x68, + 0x6d,0x65,0x74,0x69,0x63,0x22,0x20,0x6b,0x32,0x3d,0x22,0x2d,0x31,0x22,0x20,0x6b, + 0x33,0x3d,0x22,0x31,0x22,0x2f,0x3e,0xa,0x3c,0x66,0x65,0x43,0x6f,0x6c,0x6f,0x72, + 0x4d,0x61,0x74,0x72,0x69,0x78,0x20,0x74,0x79,0x70,0x65,0x3d,0x22,0x6d,0x61,0x74, + 0x72,0x69,0x78,0x22,0x20,0x76,0x61,0x6c,0x75,0x65,0x73,0x3d,0x22,0x30,0x20,0x30, + 0x20,0x30,0x20,0x30,0x20,0x30,0x2e,0x36,0x36,0x35,0x31,0x35,0x31,0x20,0x30,0x20, + 0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x2e,0x36,0x31,0x39,0x32,0x36,0x38,0x20,0x30, + 0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x2e,0x35,0x39,0x31,0x38,0x38,0x34,0x20, + 0x30,0x20,0x30,0x20,0x30,0x20,0x31,0x20,0x30,0x22,0x2f,0x3e,0xa,0x3c,0x66,0x65, + 0x42,0x6c,0x65,0x6e,0x64,0x20,0x6d,0x6f,0x64,0x65,0x3d,0x22,0x6e,0x6f,0x72,0x6d, + 0x61,0x6c,0x22,0x20,0x69,0x6e,0x32,0x3d,0x22,0x73,0x68,0x61,0x70,0x65,0x22,0x20, + 0x72,0x65,0x73,0x75,0x6c,0x74,0x3d,0x22,0x65,0x66,0x66,0x65,0x63,0x74,0x31,0x5f, + 0x69,0x6e,0x6e,0x65,0x72,0x53,0x68,0x61,0x64,0x6f,0x77,0x5f,0x36,0x32,0x38,0x35, + 0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x66,0x69,0x6c, + 0x74,0x65,0x72,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64, + 0x69,0x65,0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x30,0x5f, + 0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37, + 0x33,0x32,0x22,0x20,0x78,0x31,0x3d,0x22,0x30,0x22,0x20,0x79,0x31,0x3d,0x22,0x34, + 0x34,0x2e,0x30,0x34,0x38,0x35,0x22,0x20,0x78,0x32,0x3d,0x22,0x33,0x34,0x2e,0x33, + 0x32,0x36,0x34,0x22,0x20,0x79,0x32,0x3d,0x22,0x34,0x34,0x2e,0x30,0x34,0x38,0x35, + 0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x55,0x6e,0x69,0x74,0x73,0x3d, + 0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,0x73,0x65,0x22, + 0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c, + 0x6f,0x72,0x3d,0x22,0x23,0x45,0x45,0x41,0x45,0x35,0x33,0x22,0x2f,0x3e,0xa,0x3c, + 0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x30,0x2e,0x31, + 0x34,0x33,0x39,0x31,0x39,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f, + 0x72,0x3d,0x22,0x23,0x46,0x45,0x43,0x36,0x37,0x35,0x22,0x2f,0x3e,0xa,0x3c,0x73, + 0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x30,0x2e,0x38,0x36, + 0x32,0x38,0x32,0x34,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72, + 0x3d,0x22,0x23,0x45,0x42,0x42,0x35,0x36,0x37,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74, + 0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74, + 0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x44,0x41,0x38,0x41,0x32, + 0x43,0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61, + 0x64,0x69,0x65,0x6e,0x74,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72, + 0x61,0x64,0x69,0x65,0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74, + 0x31,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38, + 0x36,0x37,0x33,0x32,0x22,0x20,0x78,0x31,0x3d,0x22,0x34,0x39,0x2e,0x34,0x30,0x37, + 0x32,0x22,0x20,0x79,0x31,0x3d,0x22,0x34,0x38,0x2e,0x35,0x39,0x39,0x35,0x22,0x20, + 0x78,0x32,0x3d,0x22,0x34,0x39,0x2e,0x36,0x31,0x33,0x38,0x22,0x20,0x79,0x32,0x3d, + 0x22,0x31,0x30,0x2e,0x35,0x34,0x35,0x36,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65, + 0x6e,0x74,0x55,0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61, + 0x63,0x65,0x4f,0x6e,0x55,0x73,0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20, + 0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x43,0x33,0x43, + 0x46,0x43,0x46,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66, + 0x73,0x65,0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c, + 0x6f,0x72,0x3d,0x22,0x23,0x43,0x38,0x43,0x38,0x43,0x38,0x22,0x2f,0x3e,0xa,0x3c, + 0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x3e, + 0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74, + 0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x32,0x5f,0x6c,0x69,0x6e,0x65, + 0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x22,0x20, + 0x78,0x31,0x3d,0x22,0x33,0x30,0x2e,0x38,0x31,0x32,0x39,0x22,0x20,0x79,0x31,0x3d, + 0x22,0x34,0x38,0x2e,0x30,0x38,0x31,0x33,0x22,0x20,0x78,0x32,0x3d,0x22,0x33,0x30, + 0x2e,0x38,0x38,0x38,0x37,0x22,0x20,0x79,0x32,0x3d,0x22,0x33,0x32,0x2e,0x36,0x38, + 0x31,0x39,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x55,0x6e,0x69,0x74, + 0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,0x73, + 0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63, + 0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x42,0x38,0x42,0x34,0x42,0x34,0x22,0x2f,0x3e, + 0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x31, + 0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x42, + 0x30,0x42,0x44,0x42,0x44,0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61, + 0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65, + 0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70, + 0x61,0x69,0x6e,0x74,0x33,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38, + 0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x22,0x20,0x78,0x31,0x3d,0x22,0x32,0x37, + 0x2e,0x30,0x31,0x39,0x31,0x22,0x20,0x79,0x31,0x3d,0x22,0x34,0x36,0x2e,0x39,0x32, + 0x32,0x35,0x22,0x20,0x78,0x32,0x3d,0x22,0x32,0x37,0x2e,0x31,0x31,0x32,0x33,0x22, + 0x20,0x79,0x32,0x3d,0x22,0x33,0x30,0x2e,0x37,0x37,0x38,0x33,0x22,0x20,0x67,0x72, + 0x61,0x64,0x69,0x65,0x6e,0x74,0x55,0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65, + 0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,0x73,0x65,0x22,0x3e,0xa,0x3c,0x73, + 0x74,0x6f,0x70,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22, + 0x23,0x42,0x38,0x42,0x34,0x42,0x34,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70, + 0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74,0x6f,0x70, + 0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x42,0x30,0x42,0x44,0x42,0x44,0x22, + 0x2f,0x3e,0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69, + 0x65,0x6e,0x74,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64, + 0x69,0x65,0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x34,0x5f, + 0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37, + 0x33,0x32,0x22,0x20,0x78,0x31,0x3d,0x22,0x33,0x32,0x2e,0x37,0x31,0x30,0x35,0x22, + 0x20,0x79,0x31,0x3d,0x22,0x35,0x35,0x2e,0x31,0x35,0x39,0x36,0x22,0x20,0x78,0x32, + 0x3d,0x22,0x33,0x33,0x2e,0x31,0x36,0x39,0x36,0x22,0x20,0x79,0x32,0x3d,0x22,0x32, + 0x38,0x2e,0x31,0x36,0x37,0x38,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74, + 0x55,0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65, + 0x4f,0x6e,0x55,0x73,0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x73,0x74, + 0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x36,0x41,0x36,0x41,0x36, + 0x41,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65, + 0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72, + 0x3d,0x22,0x23,0x44,0x34,0x44,0x34,0x44,0x34,0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x6c, + 0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x3e,0xa,0x3c, + 0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x20,0x69, + 0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x35,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72, + 0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x22,0x20,0x78,0x31, + 0x3d,0x22,0x32,0x33,0x2e,0x34,0x39,0x38,0x39,0x22,0x20,0x79,0x31,0x3d,0x22,0x33, + 0x37,0x2e,0x31,0x39,0x37,0x37,0x22,0x20,0x78,0x32,0x3d,0x22,0x31,0x39,0x2e,0x30, + 0x35,0x22,0x20,0x79,0x32,0x3d,0x22,0x33,0x34,0x2e,0x33,0x36,0x33,0x33,0x22,0x20, + 0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x55,0x6e,0x69,0x74,0x73,0x3d,0x22,0x75, + 0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,0x73,0x65,0x22,0x3e,0xa, + 0x3c,0x73,0x74,0x6f,0x70,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72, + 0x3d,0x22,0x23,0x36,0x41,0x36,0x41,0x36,0x41,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74, + 0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74, + 0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x45,0x30,0x45,0x30,0x45, + 0x30,0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61, + 0x64,0x69,0x65,0x6e,0x74,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72, + 0x61,0x64,0x69,0x65,0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74, + 0x36,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38, + 0x36,0x37,0x33,0x32,0x22,0x20,0x78,0x31,0x3d,0x22,0x35,0x30,0x2e,0x35,0x32,0x32, + 0x34,0x22,0x20,0x79,0x31,0x3d,0x22,0x32,0x31,0x2e,0x36,0x36,0x38,0x33,0x22,0x20, + 0x78,0x32,0x3d,0x22,0x33,0x35,0x2e,0x35,0x36,0x32,0x37,0x22,0x20,0x79,0x32,0x3d, + 0x22,0x35,0x2e,0x35,0x38,0x36,0x31,0x34,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65, + 0x6e,0x74,0x55,0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61, + 0x63,0x65,0x4f,0x6e,0x55,0x73,0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20, + 0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x37,0x46,0x37, + 0x46,0x37,0x46,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66, + 0x73,0x65,0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c, + 0x6f,0x72,0x3d,0x22,0x23,0x45,0x45,0x45,0x45,0x45,0x45,0x22,0x2f,0x3e,0xa,0x3c, + 0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x3e, + 0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74, + 0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x37,0x5f,0x6c,0x69,0x6e,0x65, + 0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x22,0x20, + 0x78,0x31,0x3d,0x22,0x2d,0x31,0x2e,0x35,0x33,0x36,0x30,0x37,0x22,0x20,0x79,0x31, + 0x3d,0x22,0x36,0x30,0x2e,0x38,0x38,0x33,0x39,0x22,0x20,0x78,0x32,0x3d,0x22,0x31, + 0x35,0x2e,0x32,0x34,0x32,0x39,0x22,0x20,0x79,0x32,0x3d,0x22,0x34,0x37,0x2e,0x33, + 0x35,0x33,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x55,0x6e,0x69,0x74, + 0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,0x73, + 0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63, + 0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x35,0x31,0x35,0x31,0x35,0x31,0x22,0x2f,0x3e, + 0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x31, + 0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x38, + 0x33,0x38,0x33,0x38,0x33,0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61, + 0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65, + 0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70, + 0x61,0x69,0x6e,0x74,0x38,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38, + 0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x22,0x20,0x78,0x31,0x3d,0x22,0x34,0x34, + 0x2e,0x38,0x39,0x33,0x31,0x22,0x20,0x79,0x31,0x3d,0x22,0x32,0x30,0x2e,0x39,0x36, + 0x22,0x20,0x78,0x32,0x3d,0x22,0x33,0x39,0x2e,0x33,0x34,0x35,0x34,0x22,0x20,0x79, + 0x32,0x3d,0x22,0x31,0x35,0x2e,0x33,0x34,0x39,0x33,0x22,0x20,0x67,0x72,0x61,0x64, + 0x69,0x65,0x6e,0x74,0x55,0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53, + 0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,0x73,0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f, + 0x70,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x45, + 0x45,0x45,0x45,0x45,0x45,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f, + 0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63, + 0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x36,0x41,0x36,0x41,0x36,0x41,0x22,0x2f,0x3e, + 0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e, + 0x74,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65, + 0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x39,0x5f,0x6c,0x69, + 0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32, + 0x22,0x20,0x78,0x31,0x3d,0x22,0x34,0x39,0x2e,0x33,0x30,0x37,0x38,0x22,0x20,0x79, + 0x31,0x3d,0x22,0x32,0x37,0x2e,0x30,0x31,0x39,0x37,0x22,0x20,0x78,0x32,0x3d,0x22, + 0x34,0x37,0x2e,0x34,0x36,0x31,0x37,0x22,0x20,0x79,0x32,0x3d,0x22,0x31,0x33,0x2e, + 0x33,0x30,0x39,0x33,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x55,0x6e, + 0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e, + 0x55,0x73,0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73, + 0x65,0x74,0x3d,0x22,0x30,0x2e,0x30,0x34,0x38,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d, + 0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x77,0x68,0x69,0x74,0x65,0x22,0x20,0x73,0x74, + 0x6f,0x70,0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3d,0x22,0x30,0x2e,0x30,0x31, + 0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74, + 0x3d,0x22,0x30,0x2e,0x39,0x39,0x34,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f, + 0x6c,0x6f,0x72,0x3d,0x22,0x77,0x68,0x69,0x74,0x65,0x22,0x20,0x73,0x74,0x6f,0x70, + 0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3d,0x22,0x30,0x2e,0x35,0x22,0x2f,0x3e, + 0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e, + 0x74,0x3e,0xa,0x3c,0x72,0x61,0x64,0x69,0x61,0x6c,0x47,0x72,0x61,0x64,0x69,0x65, + 0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x31,0x30,0x5f,0x72, + 0x61,0x64,0x69,0x61,0x6c,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33, + 0x32,0x22,0x20,0x63,0x78,0x3d,0x22,0x30,0x22,0x20,0x63,0x79,0x3d,0x22,0x30,0x22, + 0x20,0x72,0x3d,0x22,0x31,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x55, + 0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f, + 0x6e,0x55,0x73,0x65,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x54,0x72, + 0x61,0x6e,0x73,0x66,0x6f,0x72,0x6d,0x3d,0x22,0x74,0x72,0x61,0x6e,0x73,0x6c,0x61, + 0x74,0x65,0x28,0x34,0x31,0x2e,0x38,0x30,0x35,0x38,0x20,0x32,0x33,0x2e,0x34,0x35, + 0x33,0x29,0x20,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x31,0x33,0x32,0x2e,0x39,0x36, + 0x37,0x29,0x20,0x73,0x63,0x61,0x6c,0x65,0x28,0x31,0x2e,0x35,0x31,0x35,0x37,0x33, + 0x20,0x31,0x2e,0x35,0x31,0x32,0x32,0x29,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70, + 0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x77,0x68,0x69, + 0x74,0x65,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73, + 0x65,0x74,0x3d,0x22,0x30,0x2e,0x39,0x39,0x39,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d, + 0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x77,0x68,0x69,0x74,0x65,0x22,0x20,0x73,0x74, + 0x6f,0x70,0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3d,0x22,0x30,0x2e,0x30,0x31, + 0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x72,0x61,0x64,0x69,0x61,0x6c,0x47,0x72,0x61,0x64, + 0x69,0x65,0x6e,0x74,0x3e,0xa,0x3c,0x2f,0x64,0x65,0x66,0x73,0x3e,0xa,0x3c,0x2f, + 0x73,0x76,0x67,0x3e,0xa, + +}; + +static const unsigned char qt_resource_name[] = { + // authorize.svg + 0x0,0xd, + 0x0,0x95,0xb6,0x47, + 0x0,0x61, + 0x0,0x75,0x0,0x74,0x0,0x68,0x0,0x6f,0x0,0x72,0x0,0x69,0x0,0x7a,0x0,0x65,0x0,0x2e,0x0,0x73,0x0,0x76,0x0,0x67, + +}; + +static const unsigned char qt_resource_struct[] = { + // : + 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + // :/authorize.svg + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, +0x0,0x0,0x1,0x80,0xdf,0x58,0x2d,0xf4, + +}; + +#ifdef QT_NAMESPACE +# define QT_RCC_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name +# define QT_RCC_MANGLE_NAMESPACE0(x) x +# define QT_RCC_MANGLE_NAMESPACE1(a, b) a##_##b +# define QT_RCC_MANGLE_NAMESPACE2(a, b) QT_RCC_MANGLE_NAMESPACE1(a,b) +# define QT_RCC_MANGLE_NAMESPACE(name) QT_RCC_MANGLE_NAMESPACE2( \ + QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE)) +#else +# define QT_RCC_PREPEND_NAMESPACE(name) name +# define QT_RCC_MANGLE_NAMESPACE(name) name +#endif + +#ifdef QT_NAMESPACE +namespace QT_NAMESPACE { +#endif + +bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); + +bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); + +#ifdef QT_NAMESPACE +} +#endif + +int QT_RCC_MANGLE_NAMESPACE(qInitResources_svg)(); +int QT_RCC_MANGLE_NAMESPACE(qInitResources_svg)() +{ + QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData) + (0x2, qt_resource_struct, qt_resource_name, qt_resource_data); + return 1; +} + +int QT_RCC_MANGLE_NAMESPACE(qCleanupResources_svg)(); +int QT_RCC_MANGLE_NAMESPACE(qCleanupResources_svg)() +{ + QT_RCC_PREPEND_NAMESPACE(qUnregisterResourceData) + (0x2, qt_resource_struct, qt_resource_name, qt_resource_data); + return 1; +} + +namespace { + struct initializer { + initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources_svg)(); } + ~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources_svg)(); } + } dummy; +} diff --git a/kylin-keyring/svg.qrc b/kylin-keyring/svg.qrc new file mode 100644 index 00000000..8f57de43 --- /dev/null +++ b/kylin-keyring/svg.qrc @@ -0,0 +1,5 @@ + + + authorize.svg + + diff --git a/kylin-keyring/translations/kylin-keyring_bo.ts b/kylin-keyring/translations/kylin-keyring_bo.ts new file mode 100644 index 00000000..0cbe6545 --- /dev/null +++ b/kylin-keyring/translations/kylin-keyring_bo.ts @@ -0,0 +1,75 @@ + + + + + KyPasswordDialog + + + Kylin NM + + + + + kylin network desktop message + + + + + Wi-Fi authentication required + + + + + Access wireless networks + + + + + needs password or encryption key + + + + + user name + + + + + Connect + + + + + Cancel + + + + + password error! + + + + + username or password error! + + + + + password + + + + + KylinSecretAgent + + + userAndPwd + + + + + tls + + + + diff --git a/kylin-keyring/translations/kylin-keyring_tr.ts b/kylin-keyring/translations/kylin-keyring_tr.ts new file mode 100644 index 00000000..8eca6866 --- /dev/null +++ b/kylin-keyring/translations/kylin-keyring_tr.ts @@ -0,0 +1,75 @@ + + + + + KyPasswordDialog + + + Kylin NM + + + + + kylin network desktop message + + + + + Wi-Fi authentication required + + + + + Access wireless networks + + + + + needs password or encryption key + + + + + user name + + + + + Connect + + + + + Cancel + + + + + password error! + + + + + username or password error! + + + + + password + + + + + KylinSecretAgent + + + userAndPwd + + + + + tls + + + + diff --git a/kylin-keyring/translations/kylin-keyring_zh_CN.qm b/kylin-keyring/translations/kylin-keyring_zh_CN.qm new file mode 100644 index 00000000..0132f295 Binary files /dev/null and b/kylin-keyring/translations/kylin-keyring_zh_CN.qm differ diff --git a/kylin-keyring/translations/kylin-keyring_zh_CN.ts b/kylin-keyring/translations/kylin-keyring_zh_CN.ts new file mode 100644 index 00000000..3dbe6c92 --- /dev/null +++ b/kylin-keyring/translations/kylin-keyring_zh_CN.ts @@ -0,0 +1,83 @@ + + + + + KyPasswordDialog + + + Kylin NM + + + + + kylin network desktop message + 网络提示信息 + + + + Wi-Fi authentication required + 此无线网络需要密码认证 + + + + Access wireless networks + 访问无线网络 + + + + needs password or encryption key + 需要密码或加密秘钥 + + + + user name + 用户名 + + + + Connect + 连接 + + + + Cancel + 取消 + + + + password error! + 密码错误! + + + + username or password error! + 用户名或密码错误! + + + WiFi + 访问无线网络 + + + needs password + 需要密码或加密秘钥 + + + + password + 密码 + + + + KylinSecretAgent + + + userAndPwd + 用户名和密码 + + + + tls + + + + diff --git a/kylin-nm-gui/kylin-nm-gui.pro b/kylin-nm-gui/kylin-nm-gui.pro new file mode 100644 index 00000000..98ad10c2 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-gui.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs + +SUBDIRS += \ + kylin-nm-main \ +# kylin-nm-simple diff --git a/kylin-nm-gui/kylin-nm-main/frontend/customstyle.cpp b/kylin-nm-gui/kylin-nm-main/frontend/customstyle.cpp new file mode 100644 index 00000000..7c5c3397 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/customstyle.cpp @@ -0,0 +1,152 @@ +#include "customstyle.h" + +CustomStyle::CustomStyle(const QString &proxyStyleName) : QProxyStyle (proxyStyleName) +{ + +} + +QSize CustomStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const +{ + switch (type) { + case CT_TabBarTab: { + QSize size(0,40); + if (const QStyleOptionTab *tab= qstyleoption_cast(option)) { + switch (tab->shape) { + case QTabBar::RoundedNorth: + case QTabBar::RoundedSouth: { + return size + QSize(50,0); + break; + } + case QTabBar::RoundedWest: + case QTabBar::RoundedEast: { + return size + QSize(0,50); + break; + } + default: { + break; + } + } + } + return size; + break; + } + default: { + break; + } + } + return QProxyStyle::sizeFromContents(type, option, contentsSize, widget); +} +void CustomStyle::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const +{ +// switch (element) { +// case CE_TabBarTab: { +// if (QStyle::State_Selected != option->state) { +// painter->save(); +// painter->setBrush(QColor(0,0,0,0)); +// painter->drawRect(widget->rect()); +//// painter->setOpacity(0.1); +// painter->restore(); +// } +// break; +// } +// default: { +// break; +// } +// } + return QProxyStyle::drawControl(element, option, painter, widget); +} + +//void CustomStyle::drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const +//{ +// return QProxyStyle::drawComplexControl(control, option, painter, widget); +//} + +//void CustomStyle::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const +//{ +// return QProxyStyle::drawItemPixmap(painter, rectangle, alignment, pixmap); +//} + +//void CustomStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const +//{ +// return QProxyStyle::drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole); +//} + +//void CustomStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const +//{ +// return QProxyStyle::drawPrimitive(element, option, painter, widget); +//} + +//QPixmap CustomStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const +//{ +// return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option); +//} + +//QStyle::SubControl CustomStyle::hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const +//{ +// return QProxyStyle::hitTestComplexControl(control, option, position, widget); +//} + +//QRect CustomStyle::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const +//{ +// return QProxyStyle::itemPixmapRect(rectangle, alignment, pixmap); +//} + +//QRect CustomStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const +//{ +// return QProxyStyle::itemTextRect(metrics, rectangle, alignment, enabled, text); +//} + +//int CustomStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const +//{ +// return QProxyStyle::pixelMetric(metric, option, widget); +//} + +//void CustomStyle::polish(QWidget *widget) +//{ +// return QProxyStyle::polish(widget); +//} + +//void CustomStyle::polish(QApplication *application) +//{ +// return QProxyStyle::polish(application); +//} + +//void CustomStyle::polish(QPalette &palette) +//{ +// return QProxyStyle::polish(palette); +//} + +//void CustomStyle::unpolish(QWidget *widget) +//{ +// return QProxyStyle::unpolish(widget); +//} + +//void CustomStyle::unpolish(QApplication *application) +//{ +// return QProxyStyle::unpolish(application); +//} + +//QIcon CustomStyle::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const +//{ +// return QProxyStyle::standardIcon(standardIcon, option, widget); +//} + +//QPalette CustomStyle::standardPalette() const +//{ +// return QProxyStyle::standardPalette(); +//} + +//int CustomStyle::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const +//{ +// return QProxyStyle::styleHint(hint, option, widget, returnData); +//} + +//QRect CustomStyle::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const +//{ +// return QProxyStyle::subControlRect(control, option, subControl, widget); +//} + +//QRect CustomStyle::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const +//{ +// return QProxyStyle::subElementRect(element, option, widget); +//} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/customstyle.h b/kylin-nm-gui/kylin-nm-main/frontend/customstyle.h new file mode 100644 index 00000000..85245ccb --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/customstyle.h @@ -0,0 +1,47 @@ +#ifndef CUSTOMSTYLE_H +#define CUSTOMSTYLE_H + +#include +#include +#include +#include +#include +#include +#include + +class CustomStyle : public QProxyStyle +{ + Q_OBJECT +public: + explicit CustomStyle(const QString &proxyStyleName = "windows"); + ~CustomStyle() = default; + virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const; + virtual void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const; +// virtual void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const; + +// virtual void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const; +// virtual void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; + +// virtual void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const; +// virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const; +// virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = nullptr) const; +// virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const; +// virtual QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const; +// //virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget); +// virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const; + +// virtual void polish(QWidget *widget); +// virtual void polish(QApplication *application); +// virtual void polish(QPalette &palette); +// virtual void unpolish(QWidget *widget); +// virtual void unpolish(QApplication *application); + +// virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const; +// virtual QPalette standardPalette() const; + +// virtual int styleHint(QStyle::StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const; +// virtual QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget = nullptr) const; +// virtual QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const; +}; + +#endif // CUSTOMSTYLE_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/enterprise-wlan/enterprise-wlan.pri b/kylin-nm-gui/kylin-nm-main/frontend/enterprise-wlan/enterprise-wlan.pri new file mode 100644 index 00000000..c4571359 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/enterprise-wlan/enterprise-wlan.pri @@ -0,0 +1,9 @@ +INCLUDEPATH += $$PWD + +FORMS += \ + +HEADERS += \ + $$PWD/enterprisewlandialog.h \ + +SOURCES += \ + $$PWD/enterprisewlandialog.cpp \ diff --git a/kylin-nm-gui/kylin-nm-main/frontend/enterprise-wlan/enterprisewlandialog.cpp b/kylin-nm-gui/kylin-nm-main/frontend/enterprise-wlan/enterprisewlandialog.cpp new file mode 100644 index 00000000..50e9a150 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/enterprise-wlan/enterprisewlandialog.cpp @@ -0,0 +1,217 @@ +#include "enterprisewlandialog.h" +#include +#include +#include + +#include "xatom-helper.h" +#define MAIN_SIZE_EXPAND 400,500 +#define MAIN_SIZE_NARROW 400,400 + +#define THEME_SCHAME "org.ukui.style" +#define COLOR_THEME "styleName" + +EnterpriseWlanDialog::EnterpriseWlanDialog(KyWirelessNetItem &wirelessNetItem, QString device, QWidget *parent) : QWidget(parent) +{ + //设置窗口无边框,阴影 +#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) + MotifWmHints window_hints; + window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; + window_hints.functions = MWM_FUNC_ALL; + window_hints.decorations = MWM_DECOR_BORDER; + XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), window_hints); +#else + this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint); +#endif + this->setAttribute(Qt::WA_DeleteOnClose); + this->setWindowFlag(Qt::Window); + this->setWindowTitle(tr("Connect Enterprise WLAN")); + + m_wirelessNetItem = wirelessNetItem; + m_deviceName = device; + m_connectOperation = new KyWirelessConnectOperation(); + m_resource = new KyWirelessNetResource(); + + initUI(); + initData(); + centerToScreen(); +} + +EnterpriseWlanDialog::~EnterpriseWlanDialog() { + if (m_securityPage) { + delete m_securityPage; + m_securityPage = nullptr; + } + if (m_connectOperation) { + delete m_connectOperation; + m_connectOperation = nullptr; + } +} + +void EnterpriseWlanDialog::closeEvent(QCloseEvent *event) +{ + Q_EMIT this->enterpriseWlanDialogClose(false); + return QWidget::closeEvent(event); + +} + +void EnterpriseWlanDialog::initUI() +{ +#define MAIN_LAYOUT_MARGINS 8,8,8,8 +#define SSID_LAYOUT_MARGINS 8,8,8,0 +#define MAIN_LAYOUT_SPACING 0 +#define BUTTON_SPACING 8 + + m_mainLayout = new QVBoxLayout(this); + this->setLayout(m_mainLayout); + m_mainLayout->setContentsMargins(MAIN_LAYOUT_MARGINS); + m_mainLayout->setSpacing(MAIN_LAYOUT_SPACING); + + m_ssidLayout = new QHBoxLayout(); + m_ssidLayout->setContentsMargins(SSID_LAYOUT_MARGINS); + m_ssidTitleLabel = new QLabel(this); + m_ssidTitleLabel->setText("SSID"); + m_ssidLabel = new QLabel(this); + m_ssidLabel->setText(m_wirelessNetItem.m_NetSsid); + + m_ssidLayout->addWidget(m_ssidTitleLabel); + m_ssidLayout->addStretch(); + m_ssidLayout->addWidget(m_ssidLabel); + + m_securityPage = new SecurityPage(this); + m_securityPage->setSecurity(KySecuType::WPA_AND_WPA2_ENTERPRISE); + m_securityPage->setSecurityVisible(false); + + m_btnLayout = new QHBoxLayout(); + m_btnLayout->setSpacing(BUTTON_SPACING); + m_cancelBtn = new QPushButton(this); + m_connectBtn = new QPushButton(this); + m_cancelBtn->setText(tr("Cancel")); + m_connectBtn->setText(tr("Connect")); + m_connectBtn->setEnabled(false); + m_btnLayout->addStretch(); + m_btnLayout->addWidget(m_cancelBtn); + m_btnLayout->addWidget(m_connectBtn); + m_mainLayout->addLayout(m_ssidLayout); + m_mainLayout->addWidget(m_securityPage); + m_mainLayout->addLayout(m_btnLayout); + m_mainLayout->addStretch(); + + this->setFixedSize(MAIN_SIZE_EXPAND); + initConnections(); + onPaletteChanged(); +} + +void EnterpriseWlanDialog::centerToScreen() +{ + QDesktopWidget* m = QApplication::desktop(); + QRect desk_rect = m->screenGeometry(m->screenNumber(QCursor::pos())); + int desk_x = desk_rect.width(); + int desk_y = desk_rect.height(); + int x = this->width(); + int y = this->height(); + this->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top()); +} + +void EnterpriseWlanDialog::initConnections() +{ + connect(m_closeBtn, &QPushButton::clicked, this, &EnterpriseWlanDialog::close); + connect(m_cancelBtn, &QPushButton::clicked, this, &EnterpriseWlanDialog::close); + connect(m_connectBtn, &QPushButton::clicked, this, &EnterpriseWlanDialog::onBtnConnectClicked); + connect(m_securityPage, &SecurityPage::eapTypeChanged, this, &EnterpriseWlanDialog::onEapTypeChanged); + connect(m_securityPage, &SecurityPage::setSecuPageState, this, [ = ](bool status) { + m_connectBtn->setEnabled(status); + }); + + connect(qApp, &QApplication::paletteChanged, this, &EnterpriseWlanDialog::onPaletteChanged); +} + +void EnterpriseWlanDialog::onPaletteChanged() +{ + QPalette pal = qApp->palette(); + + QGSettings * styleGsettings = nullptr; + const QByteArray style_id(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(style_id)) { + styleGsettings = new QGSettings(style_id); + QString currentTheme = styleGsettings->get(COLOR_THEME).toString(); + if(currentTheme == "ukui-default"){ + pal = lightPalette(this); + } + } + + this->setPalette(pal); + + setFramePalette(m_securityPage, pal); +} + +void EnterpriseWlanDialog::initData() +{ + if (m_wirelessNetItem.m_isConfigured) { + KyEapMethodType type; + m_connectOperation->getEnterpiseEapMethod(m_wirelessNetItem.m_connectUuid, type); + if (type) { + onEapTypeChanged(type); + } else { + qWarning() << "Get eap type failed!" << Q_FUNC_INFO << __LINE__; + } + } +} + +void EnterpriseWlanDialog::onBtnConnectClicked() +{ + qDebug() << "Clicked connectBtn, will connect enterprise WLAN, ssid = " + << m_wirelessNetItem.m_NetSsid << "." << Q_FUNC_INFO << __LINE__; + KySecuType secuType; + KyEapMethodType eapType; + m_securityPage->getSecuType(secuType, eapType); + + KyWirelessConnectSetting connetSetting; + connetSetting.setConnectName(m_wirelessNetItem.m_NetSsid); + connetSetting.setIfaceName(m_deviceName); + connetSetting.isAutoConnect = true; //ZJP_TODO 自动连接选项 + connetSetting.m_type = KyKeyMgmt::WpaEap; + connetSetting.m_ssid = m_wirelessNetItem.m_NetSsid; + connetSetting.m_secretFlag = 0; + connetSetting.dumpInfo(); + + if (eapType == KyEapMethodType::TLS) { + m_info.tlsInfo.devIfaceName = m_deviceName; + m_securityPage->updateTlsChange(m_info.tlsInfo); + m_connectOperation->addAndActiveWirelessEnterPriseTlsConnect(m_info.tlsInfo, connetSetting, m_deviceName, false); + } else if (eapType == KyEapMethodType::PEAP) { + m_securityPage->updatePeapChange(m_info.peapInfo); + m_connectOperation->addAndActiveWirelessEnterPrisePeapConnect(m_info.peapInfo, connetSetting, m_deviceName, false); + } else if (eapType == KyEapMethodType::TTLS) { + m_securityPage->updateTtlsChange(m_info.ttlsInfo); + m_connectOperation->addAndActiveWirelessEnterPriseTtlsConnect(m_info.ttlsInfo, connetSetting, m_deviceName, false); + } else { + qWarning() << "Connect enterprise wlan failed!(Unknown eap type)" << Q_FUNC_INFO << __LINE__; + } + close(); +} + +void EnterpriseWlanDialog::onEapTypeChanged(const KyEapMethodType &type) +{ + switch (type) { + case KyEapMethodType::TLS: + if (!m_wirelessNetItem.m_connectUuid.isEmpty()) { + m_resource->getEnterPriseInfoTls(m_wirelessNetItem.m_connectUuid, m_info.tlsInfo); + } + this->setFixedSize(MAIN_SIZE_EXPAND); + break; + case KyEapMethodType::PEAP: + if (m_wirelessNetItem.m_connectUuid.isEmpty()) { + m_resource->getEnterPriseInfoPeap(m_wirelessNetItem.m_connectUuid, m_info.peapInfo); + } + this->setFixedSize(MAIN_SIZE_NARROW); + break; + case KyEapMethodType::TTLS: + if (!m_wirelessNetItem.m_connectUuid.isEmpty()) { + m_resource->getEnterPriseInfoTtls(m_wirelessNetItem.m_connectUuid, m_info.ttlsInfo); + } + this->setFixedSize(MAIN_SIZE_NARROW); + break; + default: + break; + } +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/enterprise-wlan/enterprisewlandialog.h b/kylin-nm-gui/kylin-nm-main/frontend/enterprise-wlan/enterprisewlandialog.h new file mode 100644 index 00000000..4b78dff4 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/enterprise-wlan/enterprisewlandialog.h @@ -0,0 +1,65 @@ +#ifndef ENTERPRISEWLANDIALOG_H +#define ENTERPRISEWLANDIALOG_H +#include +#include +#include "securitypage.h" +#include "kywirelessnetitem.h" +#include "coninfo.h" + +class EnterpriseWlanDialog : public QWidget +{ + Q_OBJECT +public: + EnterpriseWlanDialog(KyWirelessNetItem &wirelessNetItem, QString device, QWidget *parent = nullptr); + ~EnterpriseWlanDialog(); + +protected: + void closeEvent(QCloseEvent *event); + +private: + void initUI(); //初始化UI界面 + void centerToScreen(); + void initConnections(); + void initData(); + +private: + KyWirelessNetItem m_wirelessNetItem; + ConInfo m_info; + QString m_deviceName; + KyWirelessConnectOperation *m_connectOperation = nullptr; + KyWirelessNetResource *m_resource = nullptr; + + /* 弹窗布局 + * Connect Enterprise WLAN············X + * SSID··························[SSID] + * -----------SecurityPage------------- + * | | + * ------------------------------------ + * ····················CANCEL···CONNECT + */ + QVBoxLayout *m_mainLayout = nullptr; + + QHBoxLayout *m_titleLayout = nullptr; + QLabel *m_titleLabel = nullptr; + QPushButton *m_closeBtn = nullptr; + + QHBoxLayout *m_ssidLayout = nullptr; + QLabel *m_ssidTitleLabel = nullptr; + QLabel *m_ssidLabel = nullptr; + + SecurityPage *m_securityPage = nullptr; + + QHBoxLayout *m_btnLayout = nullptr; + QPushButton *m_cancelBtn = nullptr; + QPushButton *m_connectBtn = nullptr; + +private Q_SLOTS: + void onBtnConnectClicked(); + void onEapTypeChanged(const KyEapMethodType &type); + void onPaletteChanged(); + +Q_SIGNALS: + void enterpriseWlanDialogClose(bool); +}; + +#endif // ENTERPRISEWLANDIALOG_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/frontend.pri b/kylin-nm-gui/kylin-nm-main/frontend/frontend.pri new file mode 100644 index 00000000..2ef4e4fe --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/frontend.pri @@ -0,0 +1,18 @@ +INCLUDEPATH += $$PWD +include(tools/tools.pri) +include(xatom/xatom.pri) +include(tab-pages/tab-pages.pri) +include(list-items/list-items.pri) +include(netdetails/netdetails.pri) +include(enterprise-wlan/enterprise-wlan.pri) + +FORMS += \ + $$PWD/wificonfigdialog.ui + +HEADERS += \ + $$PWD/customstyle.h \ + $$PWD/mainwindow.h + +SOURCES += \ + $$PWD/customstyle.cpp \ + $$PWD/mainwindow.cpp diff --git a/kylin-nm-gui/kylin-nm-main/frontend/list-items/lanlistitem.cpp b/kylin-nm-gui/kylin-nm-main/frontend/list-items/lanlistitem.cpp new file mode 100644 index 00000000..d920de75 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/list-items/lanlistitem.cpp @@ -0,0 +1,218 @@ +#include "lanlistitem.h" +#include "kylinconnectitem.h" + +#include + +#define LOG_FLAG "[LanListItem]" + +LanListItem::LanListItem(const KyConnectItem *lanConnectItem, + const QString &deviceName, QWidget *parent):ListItem(parent) +{ + m_connectOperation = new KyWiredConnectOperation(this); + m_deviceResource = new KyNetworkDeviceResourse(this); + + connectItemCopy(lanConnectItem); + m_deviceName = deviceName; + + m_nameLabel->setText(m_lanConnectItem.m_connectName); + m_netButton->setButtonIcon(QIcon::fromTheme("network-wired-connected-symbolic")); + + qDebug() << "LanListItem init:" << m_lanConnectItem.m_connectName << m_lanConnectItem.m_connectState << m_lanConnectItem.m_ifaceName; + + if (CONNECT_STATE_DEACTIVATED == m_lanConnectItem.m_connectState + || CONNECT_STATE_ACTIVATED == m_lanConnectItem.m_connectState) { + m_netButton->stopLoading(); + if (m_lanConnectItem.m_connectState == CONNECT_STATE_ACTIVATED) { + setIcon(true); + } else { + setIcon(false); + } + } else { + m_netButton->startLoading(); + } + + m_itemFrame->installEventFilter(this); + connect(this->m_infoButton, &InfoButton::clicked, this, &LanListItem::onInfoButtonClicked); + connect(m_menu, &QMenu::triggered, this, &LanListItem::onMenuTriggered); +} + + +LanListItem::LanListItem(QWidget *parent) : ListItem(parent) +{ + m_isActive = false; + m_netButton->setButtonIcon(QIcon::fromTheme("network-wired-disconnected-symbolic")); + setIcon(false); + const QString str=tr("Not connected"); + m_nameLabel->setText(str); + this->m_infoButton->hide(); +} + +LanListItem::~LanListItem() +{ + qDebug()<<"[LanPage] lan list item is deleted." << m_lanConnectItem.m_connectName; +} + +void LanListItem::setIcon(bool isOn) +{ + if (isOn) { + m_netButton->setActive(true); //设置图标显示不同颜色 + } else { + m_netButton->setActive(false); + } +} + +void LanListItem::connectItemCopy(const KyConnectItem *lanConnectItem) +{ + if (lanConnectItem) { + m_lanConnectItem.m_connectName = lanConnectItem->m_connectName; + m_lanConnectItem.m_connectPath = lanConnectItem->m_connectPath; + m_lanConnectItem.m_connectState = lanConnectItem->m_connectState; + m_lanConnectItem.m_connectUuid = lanConnectItem->m_connectUuid; + m_lanConnectItem.m_ifaceName = lanConnectItem->m_ifaceName; + m_lanConnectItem.m_itemType = lanConnectItem->m_itemType; + } else { + qDebug() << LOG_FLAG <<"the connect item is nullptr"; + m_lanConnectItem.m_connectName = ""; + m_lanConnectItem.m_connectPath = ""; + m_lanConnectItem.m_connectState = CONNECT_STATE_UNKONW; + m_lanConnectItem.m_connectUuid = ""; + m_lanConnectItem.m_ifaceName = ""; + m_lanConnectItem.m_itemType = CONNECT_TYPE_UNKNOWN; + } + + return; +} + +void LanListItem::onNetButtonClicked() +{ + if (m_lanConnectItem.m_connectUuid.isEmpty()) { + qDebug() << LOG_FLAG << "connect is empty, so can not connect or disconnect."; + return; + } + + if (CONNECT_STATE_DEACTIVATED == m_lanConnectItem.m_connectState) { + //断开的连接,点击激活连接 + if (m_deviceResource->wiredDeviceIsCarriered(m_deviceName)) { + m_connectOperation->activateWiredConnection(m_lanConnectItem.m_connectUuid, m_deviceName); + qDebug() << LOG_FLAG << "it will activate connection" << m_lanConnectItem.m_connectName + << ". it's device is" << m_deviceName; + m_netButton->startLoading(); + } else { + qDebug() << LOG_FLAG << m_deviceName << "is not carried, so can not activate connection"; + this->showDesktopNotify(tr("Wired Device not carried")); + } + } else { + qDebug() << LOG_FLAG <<"the connection" << m_lanConnectItem.m_connectName + << "is not deactived, so it can not be operation."; + } + + return; + +} + +void LanListItem::onRightButtonClicked() +{ + //右键点击事件 + qDebug()<< LOG_FLAG <<"onRightButtonClicked"; + if (!m_menu) { + return; + } + + m_menu->clear(); + if (CONNECT_STATE_ACTIVATED == m_lanConnectItem.m_connectState + || CONNECT_STATE_ACTIVATING == m_lanConnectItem.m_connectState) { + m_menu->addAction(new QAction(tr("Disconnect"), this)); + } else if (CONNECT_STATE_DEACTIVATED == m_lanConnectItem.m_connectState) { + m_menu->addAction(new QAction(tr("Connect"), this)); + } else { + return; + } + + m_menu->move(cursor().pos()); + m_menu->show(); + return; +} + +void LanListItem::onMenuTriggered(QAction *action) +{ + if (action->text() == tr("Connect")) { + this->onNetButtonClicked(); + } else if (action->text() == tr("Disconnect")) { + m_connectOperation->deactivateWiredConnection(m_lanConnectItem.m_connectName, m_lanConnectItem.m_connectUuid); + qDebug() << LOG_FLAG << "it will disconnect connection" << m_lanConnectItem.m_connectName + << ". it's device is" << m_deviceName; + m_netButton->startLoading(); + } + return; +} + + +void LanListItem::onInfoButtonClicked() +{ + if (m_lanConnectItem.m_connectUuid.isEmpty()) { + qDebug() << LOG_FLAG << "connect is empty, so can not show detail info."; + return; + } + + if(isDetailShow){ + qDebug()<< LOG_FLAG << "the detail page has be shown , so do not show again" << Q_FUNC_INFO << __LINE__; + return; + } + + qDebug()<< LOG_FLAG << "the info button of lan is clicked! uuid = " + << m_lanConnectItem.m_connectUuid << "; name = " << m_lanConnectItem.m_connectName + << "." <show(); + Q_EMIT this->detailShow(true); + + return; +} + +void LanListItem::updateConnectionState(KyConnectState state) +{ + m_lanConnectItem.m_connectState = state; + + if (CONNECT_STATE_DEACTIVATED == state || CONNECT_STATE_ACTIVATED == state) { + m_netButton->stopLoading(); + if (state == CONNECT_STATE_ACTIVATED) { + setIcon(true); + } else { + setIcon(false); + } + } else { + m_netButton->startLoading(); + } + + return; +} + +QString LanListItem::getConnectionName() +{ + return m_lanConnectItem.m_connectName; +} + +void LanListItem::updateConnectionName(QString connectionName) +{ + m_lanConnectItem.m_connectName = connectionName; + m_nameLabel->setText(m_lanConnectItem.m_connectName); + return; +} + +QString LanListItem::getConnectionPath() +{ + return m_lanConnectItem.m_connectPath; +} + +void LanListItem::updateConnectionPath(QString connectionPath) +{ + m_lanConnectItem.m_connectPath = connectionPath; +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/list-items/lanlistitem.h b/kylin-nm-gui/kylin-nm-main/frontend/list-items/lanlistitem.h new file mode 100644 index 00000000..c602602a --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/list-items/lanlistitem.h @@ -0,0 +1,50 @@ +#ifndef LANLISTITEM_H +#define LANLISTITEM_H +#include "listitem.h" +#include "kylinactiveconnectresource.h" + +#include +#include +#include + +class LanListItem : public ListItem +{ + Q_OBJECT + +public: + LanListItem(const KyConnectItem *lanConnectItem, const QString &deviceName, QWidget *parent = nullptr); + LanListItem(QWidget *parent = nullptr); + + ~LanListItem(); + +public: + void updateConnectionState(KyConnectState state); + + QString getConnectionName(); + void updateConnectionName(QString connectionName); + + QString getConnectionPath(); + void updateConnectionPath(QString connectionPath); + +protected: + void setIcon(bool isOn); + void onRightButtonClicked(); + +private: + void connectItemCopy(const KyConnectItem *lanConnectItem); + +private Q_SLOTS: + void onInfoButtonClicked(); + void onNetButtonClicked(); + void onMenuTriggered(QAction *action); + +private: + KyConnectItem m_lanConnectItem; + + KyWiredConnectOperation *m_connectOperation = nullptr; + KyNetworkDeviceResourse *m_deviceResource = nullptr; + + QString m_deviceName = ""; +}; + +#endif // LANLISTITEM_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/list-items/list-items.pri b/kylin-nm-gui/kylin-nm-main/frontend/list-items/list-items.pri new file mode 100644 index 00000000..8fdc468e --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/list-items/list-items.pri @@ -0,0 +1,18 @@ +INCLUDEPATH += $$PWD + +FORMS += \ + $$PWD/oneconnform.ui \ + $$PWD/onelancform.ui + +HEADERS += \ + $$PWD/lanlistitem.h \ + $$PWD/listitem.h \ + $$PWD/wlanlistitem.h \ + $$PWD/wlanmoreitem.h + +SOURCES += \ + $$PWD/lanlistitem.cpp \ + $$PWD/listitem.cpp \ + $$PWD/wlanlistitem.cpp \ + $$PWD/wlanmoreitem.cpp + diff --git a/kylin-nm-gui/kylin-nm-main/frontend/list-items/listitem.cpp b/kylin-nm-gui/kylin-nm-main/frontend/list-items/listitem.cpp new file mode 100644 index 00000000..08a2f2bd --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/list-items/listitem.cpp @@ -0,0 +1,172 @@ +#include "listitem.h" +#include + +#define MAIN_LAYOUT_MARGINS 0,0,0,0 +#define MAIN_LAYOUT_SPACING 0 +#define ITEM_FRAME_MARGINS 16,6,16,6 +#define ITEM_FRAME_SPACING 10 +#define FRAME_WIDTH 395 +#define INFO_ICON_WIDTH 16 +#define INFO_ICON_HEIGHT 16 +#define LIGHT_HOVER_COLOR QColor(240,240,240,255) +#define DARK_HOVER_COLOR QColor(15,15,15,255) + +ListItem::ListItem(QWidget *parent) : QFrame(parent) +{ + m_connectState = CONNECT_STATE_UNKONW; + isDetailShow = false; + + initUI(); + initConnection(); + connect(qApp, &QApplication::paletteChanged, this, &ListItem::onPaletteChanged); + connect(this, &ListItem::detailShow, this, &ListItem::onDetailShow); +// m_itemFrame->installEventFilter(this); +} + +ListItem::~ListItem() +{ + if (nullptr != m_netButton) { + delete m_netButton; + m_netButton = nullptr; + } + + if (nullptr != m_infoButton) { + delete m_infoButton; + m_infoButton = nullptr; + } + +} + +void ListItem::setName(const QString &name) +{ + m_nameLabel->setText(name); +} + +//仅无线调用,有线自己获取 +void ListItem::setActive(const bool &isActive) +{ + m_netButton->setActive(isActive); + m_isActive = isActive; +} + +void ListItem::setConnectState(KyConnectState state) +{ + m_connectState = state; +} + +void ListItem::showDesktopNotify(const QString &message) +{ + QDBusInterface iface("org.freedesktop.Notifications", + "/org/freedesktop/Notifications", + "org.freedesktop.Notifications", + QDBusConnection::sessionBus()); + QList args; + args<<(tr("Kylin NM")) + <<((unsigned int) 0) + <button() == Qt::LeftButton) { + onNetButtonClicked(); + } else if (event->button() == Qt::RightButton) { + onRightButtonClicked(); + } + return QFrame::mousePressEvent(event); +} + +void ListItem::enterEvent(QEvent *event) +{ +// QPalette pal = qApp->palette(); +// QColor baseColor = qApp->palette().base().color(); +// if (baseColor.red() > MIDDLE_COLOR) { +// pal.setColor(QPalette::Window, LIGHT_HOVER_COLOR); +// } else { +// pal.setColor(QPalette::Window, DARK_HOVER_COLOR); +// } +// this->setPalette(pal); +// return QFrame::enterEvent(event); +} + +void ListItem::leaveEvent(QEvent *event) +{ +// QPalette pal = qApp->palette(); +// pal.setColor(QPalette::Window, qApp->palette().base().color()); +// this->setPalette(pal); +// return QFrame::leaveEvent(event); +} + +void ListItem::paintEvent(QPaintEvent *event) +{ +// QPainter painter(this); +// painter.setRenderHint(QPainter::Antialiasing); //反锯齿 +// painter.setBrush(this->palette().brush(QPalette::Window)); +// painter.setPen(Qt::transparent); +// painter.drawRoundedRect(this->rect(), 6, 6); +// return QFrame::paintEvent(event); +} + +void ListItem::initUI() +{ + m_menu = new QMenu(this);//右键菜单 +// m_menu->setStyleSheet("QMenu::item{border:3px; border-radius:3px}"); +// m_menu->setStyleSheet("QMenu{border-radius:6px; margin:6px 6px 6px 6px}"); + connect(m_menu, &QMenu::triggered, this, &ListItem::onMenuTriggered); + + m_mainLayout = new QVBoxLayout(this); + m_mainLayout->setContentsMargins(MAIN_LAYOUT_MARGINS); + m_mainLayout->setSpacing(MAIN_LAYOUT_SPACING); + this->setLayout(m_mainLayout); + + m_itemFrame = new QFrame(this); + m_itemFrame->setFixedWidth(FRAME_WIDTH); + + m_hItemLayout = new QHBoxLayout(m_itemFrame); + m_hItemLayout->setContentsMargins(ITEM_FRAME_MARGINS); +// m_hItemLayout->setSpacing(ITEM_FRAME_SPACING); + + m_netButton = new RadioItemButton(m_itemFrame); + m_nameLabel = new FixLabel(m_itemFrame); + m_infoButton = new InfoButton(m_itemFrame); + m_infoButton->setIconSize(QSize(INFO_ICON_WIDTH,INFO_ICON_HEIGHT)); + + m_hItemLayout->addWidget(m_netButton); + m_hItemLayout->addWidget(m_nameLabel); + m_hItemLayout->addStretch(); + m_hItemLayout->addWidget(m_infoButton); + + m_mainLayout->addWidget(m_itemFrame); + +// this->setAutoFillBackground(true); +// this->setBackgroundRole(QPalette::Base); +// QPalette pal = qApp->palette(); +// pal.setColor(QPalette::Window, qApp->palette().base().color()); +// this->setPalette(pal); +} + + +void ListItem::initConnection() +{ + connect(this->m_netButton, &RadioItemButton::clicked, this, &ListItem::onNetButtonClicked); + // connect(this->m_infoButton, &InfoButton::clicked, this, &ListItem::onInfoButtonClicked); +} + +void ListItem::onPaletteChanged() +{ +// QPalette pal = qApp->palette(); +// pal.setColor(QPalette::Window, qApp->palette().base().color()); +// this->setPalette(pal); +} + +void ListItem::onDetailShow(bool isShow) +{ + isDetailShow = isShow; +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/list-items/listitem.h b/kylin-nm-gui/kylin-nm-main/frontend/list-items/listitem.h new file mode 100644 index 00000000..e5444fd2 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/list-items/listitem.h @@ -0,0 +1,60 @@ +#ifndef LISTITEM_H +#define LISTITEM_H +#include +#include +#include +#include +#include +#include +#include "radioitembutton.h" +#include "infobutton.h" +#include "netdetails/netdetail.h" + +class ListItem : public QFrame +{ + Q_OBJECT +public: + ListItem(QWidget *parent = nullptr); + ~ListItem(); + void setName(const QString &name); + void setActive(const bool &isActive); + void setConnectState(KyConnectState state); + static void showDesktopNotify(const QString &message); + +protected: + void mousePressEvent(QMouseEvent *event); + void enterEvent(QEvent *event); + void leaveEvent(QEvent *event); + void paintEvent(QPaintEvent *event); + virtual void onRightButtonClicked() = 0; + +protected: + QFrame * m_itemFrame = nullptr; + + FixLabel * m_nameLabel = nullptr; + RadioItemButton * m_netButton = nullptr; + InfoButton * m_infoButton = nullptr; + + bool m_isActive = false; + KyConnectState m_connectState; + + QMenu *m_menu = nullptr; +public: + QVBoxLayout * m_mainLayout = nullptr; + QHBoxLayout * m_hItemLayout = nullptr; + bool isDetailShow; +private: + void initUI(); + void initConnection(); + +public Q_SLOTS: + virtual void onNetButtonClicked() = 0; + void onPaletteChanged(); + void onDetailShow(bool isShow); + virtual void onMenuTriggered(QAction *action)=0; + +Q_SIGNALS: + void detailShow(bool isShow); +}; + +#endif // LISTITEM_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/list-items/oneconnform.ui b/kylin-nm-gui/kylin-nm-main/frontend/list-items/oneconnform.ui new file mode 100644 index 00000000..9e47beaa --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/list-items/oneconnform.ui @@ -0,0 +1,302 @@ + + + OneConnForm + + + + 0 + 0 + 424 + 142 + + + + Form + + + + + 63 + 8 + 241 + 20 + + + + + + + + + + 316 + 14 + 100 + 34 + + + + + + + + + + 316 + 14 + 100 + 34 + + + + + + + + + + 14 + 14 + 32 + 32 + + + + + + + + + + 63 + 31 + 140 + 20 + + + + + + + + + + 0 + 0 + 424 + 106 + + + + + + 64 + 64 + 352 + 30 + + + + + + + 390 + 75 + 18 + 9 + + + + + + + + + + + 316 + 14 + 100 + 34 + + + + + + + + + + 316 + 14 + 100 + 34 + + + + + + + + + + 316 + 14 + 100 + 34 + + + + + + + + + + 0 + 0 + 424 + 138 + + + + + + 63 + 64 + 230 + 61 + + + + + + + + + + 63 + 62 + 230 + 20 + + + + + + + + + + 63 + 86 + 230 + 20 + + + + + + + + + + 63 + 110 + 230 + 20 + + + + + + + leInfo_1 + leInfo_2 + leInfo_3 + btnInfo + + + + + 2 + 59 + 421 + 2 + + + + background-color: rgba(156, 156, 156,0.1); + + + Qt::Horizontal + + + + + + 0 + 0 + 424 + 60 + + + + + + + 316 + 14 + 100 + 34 + + + + + + + + + + 380 + 20 + 20 + 20 + + + + + + + + + + 316 + 14 + 70 + 34 + + + + + + + wbg_3 + wbg_2 + lbName + lbSignal + lbConned + line + wbg + btnConnSub + btnConn + btnConnPWD + btnDisConn + btnHideConn + lbWaiting + lbWaitingIcon + btnCancel + + + + diff --git a/kylin-nm-gui/kylin-nm-main/frontend/list-items/onelancform.ui b/kylin-nm-gui/kylin-nm-main/frontend/list-items/onelancform.ui new file mode 100644 index 00000000..ee3f4a06 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/list-items/onelancform.ui @@ -0,0 +1,254 @@ + + + OneLancForm + + + + 0 + 0 + 424 + 167 + + + + Form + + + + + 63 + 8 + 190 + 20 + + + + + + + + + + 316 + 14 + 100 + 34 + + + + + + + + + + 316 + 14 + 100 + 34 + + + + + + + + + + 316 + 14 + 100 + 34 + + + + + + + + + + 63 + 31 + 200 + 20 + + + + + + + + + + 0 + 0 + 424 + 162 + + + + + + 63 + 64 + 238 + 85 + + + + + + + + + + 63 + 62 + 238 + 20 + + + + + + + + + + 63 + 86 + 260 + 20 + + + + + + + + + + 63 + 110 + 238 + 20 + + + + + + + + + + 63 + 134 + 238 + 20 + + + + + + + leInfo_1 + leInfo_2 + leInfo_3 + leInfo_4 + btnInfo + + + + + 14 + 14 + 32 + 32 + + + + + + + + + + 2 + 59 + 421 + 2 + + + + background-color: rgba(156, 156, 156,0.1); + + + Qt::Horizontal + + + + + + 0 + 0 + 424 + 60 + + + + + + + 316 + 14 + 100 + 34 + + + + + + + + + + 380 + 20 + 20 + 20 + + + + + + + + + + 316 + 14 + 70 + 34 + + + + + + + wbg + wbg_2 + lbName + lbConned + lbIcon + line + btnConnSub + btnDisConn + btnConn + lbWaiting + lbWaitingIcon + btnCancel + + + + diff --git a/kylin-nm-gui/kylin-nm-main/frontend/list-items/wlanlistitem.cpp b/kylin-nm-gui/kylin-nm-main/frontend/list-items/wlanlistitem.cpp new file mode 100644 index 00000000..45237445 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/list-items/wlanlistitem.cpp @@ -0,0 +1,588 @@ +#include "wlanlistitem.h" +#include +#include +#include + +#define EMPTY_SSID "EMPTY_SSID" +#define LOG_FLAG "[WlanListItem]" +#define WAIT_US 10*1000 + +WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, QWidget *parent) + : WlanListItem(wirelessNetItem, device, parent) +{ + m_isApMode = isApMode; + refreshIcon(false); // 额外刷新一次图标,因为WlanListItem执行时,m_isApMode尚未赋值 +} + +WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, QWidget *parent) : ListItem(parent) +{ + m_wlanDevice = device; + m_wirelessNetItem = wirelessNetItem; + + qDebug()<<"[WlanPage] wlan list item is created." << m_wirelessNetItem.m_NetSsid; + + initWlanUI(); + setExpanded(false); + + connect(this->m_infoButton, &InfoButton::clicked, this, &WlanListItem::onInfoButtonClicked); + connect(m_menu, &QMenu::triggered, this, &WlanListItem::onMenuTriggered); + + m_wirelessConnectOperation = new KyWirelessConnectOperation(this); +} + +WlanListItem::WlanListItem(QWidget *parent) : ListItem(parent) +{ + m_wirelessNetItem.m_NetSsid = EMPTY_SSID; + + qDebug()<<"[WlanPage] wlan list item is created." << m_wirelessNetItem.m_NetSsid; + + m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-offline-symbolic")); + m_netButton->setActive(false); +// m_netButton->setDefaultPixmap(); + const QString name = tr("Not connected"); + setExpanded(false); + this->setName(name); +// this->m_netButton->setEnabled(false); + this->m_infoButton->hide(); +} + +WlanListItem::~WlanListItem() +{ + qDebug()<<"[WlanPage] wlan list item is deleted." << m_wirelessNetItem.m_NetSsid; +} + +QString WlanListItem::getSsid() +{ + return m_wirelessNetItem.m_NetSsid; +} + +void WlanListItem::setSignalStrength(const int &signal) +{ + m_wirelessNetItem.m_signalStrength = signal; + if (CONNECT_STATE_ACTIVATED == m_connectState) { + refreshIcon(true); + } else if (CONNECT_STATE_DEACTIVATED == m_connectState) { + refreshIcon(false); + } + + return; +} + +int WlanListItem::getSignalStrength() +{ + return m_wirelessNetItem.m_signalStrength; +} + +bool WlanListItem::isConfigured() +{ + return m_wirelessNetItem.m_isConfigured; +} + +void WlanListItem::setWlanState(const int &state) +{ +// m_wirelessNetItem.m_state = state; //ZJP_TODO 后端接口待补全 + refreshIcon(false); +} + +void WlanListItem::setExpanded(const bool &expanded) +{ + if (!m_pwdFrame || !m_autoConnectFrame) { + this->setFixedHeight(NORMAL_HEIGHT); + return; + } + + m_pwdFrame->setVisible(expanded); + m_autoConnectFrame->setVisible(expanded); + + if (expanded) { + m_pwdLineEdit->setFocus(); + setFixedHeight(EXPANDED_HEIGHT); + } else { + setFixedHeight(NORMAL_HEIGHT); + QPalette pal = qApp->palette(); + pal.setColor(QPalette::Window, qApp->palette().base().color()); + this->setPalette(pal); + } + + Q_EMIT this->itemHeightChanged(expanded, m_wirelessNetItem.m_NetSsid); + + return; +} + +void WlanListItem::resizeEvent(QResizeEvent *event) +{ + this->blockSignals(true); + + if (this->height() == EXPANDED_HEIGHT) { + this->setExpanded(true); + } else { + this->setExpanded(false); + } + + this->blockSignals(false); + + return ListItem::resizeEvent(event); +} + +void WlanListItem::onRightButtonClicked() +{ + qDebug()<< LOG_FLAG <<"onRightButtonClicked"; + + if (!m_menu) { + return; + } + + m_menu->clear(); + + if (CONNECT_STATE_ACTIVATED == m_connectState || CONNECT_STATE_ACTIVATING == m_connectState) { + m_menu->addAction(new QAction(tr("Disconnect"), this)); + } else if (CONNECT_STATE_DEACTIVATED == m_connectState) { + m_menu->addAction(new QAction(tr("Connect"), this)); + qDebug() << "add connect action"; + } else { + return; + } + + if (m_wirelessNetItem.m_isConfigured) { + m_menu->addAction(new QAction(tr("Forget"), this)); + } + + m_menu->move(cursor().pos()); + m_menu->show(); + + return; +} + +void WlanListItem::enterEvent(QEvent *event) +{ + //qDebug()<< LOG_FLAG <<"enterEvent" << m_wirelessNetItem.m_NetSsid; + m_mouseIsOut = false; + return ListItem::enterEvent(event); +} + +void WlanListItem::leaveEvent(QEvent *event) +{ + //qDebug()<< LOG_FLAG <<"leaveEvent"<< m_wirelessNetItem.m_NetSsid; + m_mouseIsOut = true; + if (m_pwdFrame && m_pwdFrame->isVisible()) { + if (m_focusIsOut) { + setExpanded(false); + } + return QFrame::leaveEvent(event); + } + + return ListItem::leaveEvent(event); +} + +bool WlanListItem::eventFilter(QObject *watched, QEvent *event) +{ + if (watched == m_showPwdButton || watched == m_autoConnectCheckBox) { + if (event->type() == QEvent::FocusIn) { + m_pwdLineEdit->setFocus(); + } + } + + if (watched == m_pwdLineEdit) { + if (event->type() == QEvent::FocusOut) { + m_focusIsOut = true; + //qDebug()<< LOG_FLAG <<"focusOutEvent" << m_wirelessNetItem.m_NetSsid; + if (m_mouseIsOut) { + setExpanded(false); + } + } else if (event->type() == QEvent::FocusIn) { + //qDebug()<< LOG_FLAG <<"focusInEvent" << m_wirelessNetItem.m_NetSsid; + m_focusIsOut = false; + } + } + + return QFrame::eventFilter(watched, event); +} + +void WlanListItem::keyPressEvent(QKeyEvent *event) +{ + if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { + if (m_pwdFrame && m_pwdFrame->isVisible() && m_pwdLineEdit->text().length() >= PWD_LENGTH_LIMIT) { + onConnectButtonClicked(); + } + } + return QFrame::keyPressEvent(event); +} + +void WlanListItem::initWlanUI() +{ + m_hasPwd = (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") ? false : true; + //设置显示的Wlan名称 +// this->setName((m_wirelessNetItem.m_connName != "") ? m_wirelessNetItem.m_connName : m_wirelessNetItem.m_NetSsid); + this->setName(m_wirelessNetItem.m_NetSsid); + //刷新左侧按钮图标 + refreshIcon(false); + +#define PWD_AREA_HEIGHT 36 +#define CONNECT_BUTTON_WIDTH 96 +#define FRAME_CONTENT_MARGINS 56,0,16,4 +#define FRAME_SPACING 8 +#define LINEEDIT_WIDTH 220 +#define PWD_CONTENT_MARGINS 8,0,34,0 +#define SHOW_PWD_BUTTON_SIZE 24,24 +#define PWD_LAYOUT_MARGINS 8,0,8,0 + //密码输入区域的UI + m_pwdFrame = new QFrame(this); + m_pwdFrameLyt = new QHBoxLayout(m_pwdFrame); + m_pwdFrameLyt->setContentsMargins(FRAME_CONTENT_MARGINS); + m_pwdFrameLyt->setSpacing(FRAME_SPACING); + m_pwdFrame->setLayout(m_pwdFrameLyt); + + m_pwdLineEdit = new QLineEdit(m_pwdFrame); + m_pwdLineEdit->setFixedWidth(LINEEDIT_WIDTH); + m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, false); + m_pwdLineEdit->setContextMenuPolicy(Qt::NoContextMenu); + + QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$"); + QRegExpValidator *latitude = new QRegExpValidator(rx, this); + m_pwdLineEdit->setValidator(latitude); + + m_pwdLineEdit->installEventFilter(this); + connect(m_pwdLineEdit, &QLineEdit::textChanged, this, &WlanListItem::onPwdEditorTextChanged); + m_pwdLineEdit->setFixedHeight(PWD_AREA_HEIGHT); + m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Password); + m_pwdLineEdit->setTextMargins(PWD_CONTENT_MARGINS); + m_pwdFrameLyt->addWidget(m_pwdLineEdit); + + m_pwdLineEditLyt = new QHBoxLayout(m_pwdLineEdit); + m_pwdLineEditLyt->setContentsMargins(PWD_LAYOUT_MARGINS); + m_pwdLineEdit->setLayout(m_pwdLineEditLyt); + + m_showPwdButton = new QPushButton(m_pwdLineEdit); + m_showPwdButton->setFlat(true); //去除边框 + m_showPwdButton->installEventFilter(this); + m_showPwdButton->setFixedSize(SHOW_PWD_BUTTON_SIZE); + m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic")); + m_showPwdButton->setCursor(Qt::PointingHandCursor); + connect(m_showPwdButton, &QPushButton::clicked, this, &WlanListItem::onShowPwdButtonClicked); + m_pwdLineEditLyt->addStretch(); + m_pwdLineEditLyt->addWidget(m_showPwdButton); + + m_connectButton = new QPushButton(m_pwdFrame); + m_connectButton->setFixedSize(CONNECT_BUTTON_WIDTH, PWD_AREA_HEIGHT); + m_connectButton->setText(tr("Connect")); + m_connectButton->setEnabled(false); + connect(m_connectButton, &QPushButton::clicked, this, &WlanListItem::onConnectButtonClicked); + m_pwdFrameLyt->addWidget(m_connectButton); + m_pwdFrameLyt->addStretch(); + + //自动连接选择区域UI + m_autoConnectFrame = new QFrame(this); + + m_autoConnectFrameLyt = new QHBoxLayout(m_autoConnectFrame); + m_autoConnectFrameLyt->setContentsMargins(FRAME_CONTENT_MARGINS); + m_autoConnectFrameLyt->setSpacing(FRAME_SPACING); + m_autoConnectFrame->setLayout(m_autoConnectFrameLyt); + + m_autoConnectCheckBox = new QCheckBox(m_autoConnectFrame); + m_autoConnectCheckBox->installEventFilter(this); + m_autoConnectCheckBox->setChecked(true); + m_autoConnectCheckBox->setFixedSize(SHOW_PWD_BUTTON_SIZE); + m_autoConnectFrameLyt->addWidget(m_autoConnectCheckBox); + + m_autoConnectLabel = new QLabel(m_autoConnectFrame); + m_autoConnectLabel->setText(tr("Auto Connect")); + m_autoConnectFrameLyt->addWidget(m_autoConnectLabel); + m_autoConnectFrameLyt->addStretch(); + + m_mainLayout->addWidget(m_pwdFrame); + m_mainLayout->addWidget(m_autoConnectFrame); + + m_pwdFrame->hide(); + m_autoConnectFrame->hide(); +} + +void WlanListItem::refreshIcon(bool isActivated) +{ +#define FULL_SIGNAL 5 +#define EXCELLENT_SIGNAL 4 +#define GOOD_SIGNAL 3 +#define OK_SIGNAL 2 +#define LOW_SIGNAL 1 +#define STEP 25 + if (m_isApMode) { + m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-hotspot-symbolic", QIcon(":/res/w/wifi-full.png"))); + m_netButton->setActive(isActivated); + return; + } + + if (!m_hasPwd) { + //ZJP_TODO 无加密 注意信号格数计算方式,可能需要修改 + switch (m_wirelessNetItem.m_signalStrength / STEP + 1) { + case FULL_SIGNAL: + case EXCELLENT_SIGNAL: + m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-excellent-symbolic", + QIcon(":/res/w/wifi-full.png"))); + break; + case GOOD_SIGNAL: + m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-good-symbolic", + QIcon(":/res/w/wifi-high.png"))); + break; + case OK_SIGNAL: + m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-ok", + QIcon(":/res/w/wifi-medium.png"))); + break; + case LOW_SIGNAL: + m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-low", + QIcon(":/res/w/wifi-low.png"))); + break; + default: + qDebug() << "Set wlan(without passwd) icon failed, signal = " + << m_wirelessNetItem.m_signalStrength << Q_FUNC_INFO << __LINE__; + break; + } + } else { + //ZJP_TODO 有加密 + switch (m_wirelessNetItem.m_signalStrength / STEP + 1) { + case FULL_SIGNAL: + case EXCELLENT_SIGNAL: + m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-excellent-secure-symbolic", + QIcon(":/res/w/wifi-full-pwd.png"))); + break; + case GOOD_SIGNAL: + m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-good-secure-symbolic", + QIcon(":/res/w/wifi-high-pwd.png"))); + break; + case OK_SIGNAL: + m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-ok-secure-symbolic", + QIcon(":/res/w/wifi-medium-pwd.png"))); + break; + case LOW_SIGNAL: + m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-low-secure-symbolic", + QIcon(":/res/w/wifi-low-pwd.png"))); + break; + default: + qDebug() << "Set wlan(with passwd) icon failed, signal = " + << m_wirelessNetItem.m_signalStrength << Q_FUNC_INFO << __LINE__; + break; + } + } + m_netButton->setActive(isActivated); +} + +void WlanListItem::onInfoButtonClicked() +{ + //ZJP_TODO 呼出无线详情页 + if(isDetailShow){ + qDebug() << "has show the detail page,and do not show again" << Q_FUNC_INFO << __LINE__; + return; + } + + qDebug() << LOG_FLAG << "Net active or not:"<< m_connectState; + qDebug() << LOG_FLAG << "On wlan info button clicked! ssid = " + << m_wirelessNetItem.m_NetSsid << "; name = " + << m_wirelessNetItem.m_connName << "." <show(); + Q_EMIT this->detailShow(true); +} + +void WlanListItem::onNetButtonClicked() +{ + qDebug() << LOG_FLAG << "onNetButtonClicked"; + if (m_wirelessNetItem.m_NetSsid == EMPTY_SSID) { + return; + } + + if (CONNECT_STATE_DEACTIVATED != m_connectState) { + qDebug() << LOG_FLAG <<"the connection" << m_wirelessNetItem.m_connName + << "is not deactived, so it can not be operation." << Q_FUNC_INFO << __LINE__; + return; + } + + //有配置或者无密码的wifi直接连接 + if (m_wirelessNetItem.m_isConfigured) { + m_wirelessConnectOperation->activeWirelessConnect(m_wlanDevice, m_wirelessNetItem.m_connectUuid); + qDebug()<<"[WlanListItem] Has configuration, will be activated. ssid = " + << m_wirelessNetItem.m_NetSsid << Q_FUNC_INFO << __LINE__; + m_netButton->startLoading(); + return; + } + + if (!this->m_connectButton->isVisible() && m_wirelessNetItem.m_secuType != "") { + if (m_wirelessNetItem.m_secuType.contains("802.1x", Qt::CaseInsensitive)) { + if (isEnterpriseWlanDialogShow && enterpriseWlanDialog != nullptr) { + qDebug() << LOG_FLAG <<"EnterpriseWlanDialog is show do not show again!"; + KWindowSystem::raiseWindow(enterpriseWlanDialog->winId()); + return; + } else { + enterpriseWlanDialog = new EnterpriseWlanDialog(m_wirelessNetItem, m_wlanDevice, this); + connect(enterpriseWlanDialog, &EnterpriseWlanDialog::enterpriseWlanDialogClose, this, &WlanListItem::onEnterpriseWlanDialogClose); + enterpriseWlanDialog->show(); + isEnterpriseWlanDialogShow = true; + } + } else { + this->setExpanded(true); + } + } else { + onConnectButtonClicked(); + } + + return; +} + +void WlanListItem::updateWirelessNetSecurity(QString ssid, QString securityType) +{ + if (ssid != m_wirelessNetItem.m_NetSsid) { + return; + } + + qDebug() << LOG_FLAG << "Security changed! ssid = " << m_wirelessNetItem.m_NetSsid + << "; security = " << m_wirelessNetItem.m_secuType << "." <text().length() < PWD_LENGTH_LIMIT) { + m_connectButton->setEnabled(false); + } else { + m_connectButton->setEnabled(true); + } + + return; +} + +void WlanListItem::onShowPwdButtonClicked() +{ + qDebug()<< LOG_FLAG << "onShowPwdButtonClicked"; + if (!m_pwdLineEdit) { + return; + } + + if (m_pwdLineEdit->echoMode() == QLineEdit::EchoMode::Password) { + m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-display-symbolic")); + m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Normal); + } else { + m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic")); + m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Password); + } + + return; +} + +void WlanListItem::onConnectButtonClicked() +{ + qDebug()<< LOG_FLAG << "onConnectButtonClicked"; + if ((CONNECT_STATE_ACTIVATING == m_connectState || CONNECT_STATE_DEACTIVATING == m_connectState)) { + qDebug() << LOG_FLAG << "On wlan clicked! But there is nothing to do because it is already activating/deactivating!" + << Q_FUNC_INFO << __LINE__; + return; + } + + if (m_connectButton->isVisible() && !m_connectButton->isEnabled()) { + qWarning() << "Connect wlan failed because of null pointer or button state!" << Q_FUNC_INFO << __LINE__; + return; + } + + KyWirelessConnectSetting settings; + settings.m_connectName = m_wirelessNetItem.m_NetSsid; + settings.m_ssid = m_wirelessNetItem.m_NetSsid; + settings.isAutoConnect = m_autoConnectCheckBox->isChecked(); + settings.m_psk = m_pwdLineEdit->text(); + if (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") { + settings.m_type = WpaNone; + } else if (m_wirelessNetItem.m_secuType.contains("WPA1") || m_wirelessNetItem.m_secuType.contains("WPA2")) { + settings.m_type = WpaPsk; + } else if (m_wirelessNetItem.m_secuType.contains("WPA3")) { + settings.m_type = SAE; + } + + qDebug() << "[WlanListItem] On button connect clicked, will connect wlan. ssid = " + << m_wirelessNetItem.m_NetSsid << Q_FUNC_INFO <<__LINE__; + + m_wirelessConnectOperation->addAndActiveWirelessConnect(m_wlanDevice, settings, false); + setExpanded(false); + m_netButton->startLoading(); + return; +} + +KyConnectState WlanListItem::getConnectionState() +{ + return m_connectState; +} + +void WlanListItem::updateConnectState(KyConnectState state) +{ + m_connectState = state; + + if (CONNECT_STATE_ACTIVATED == state) { + m_netButton->stopLoading(); + m_netButton->setActive(true); + } else if(CONNECT_STATE_DEACTIVATED == state) { + qDebug() << "[WlanListItem] stop loading connect state:" << state; + m_netButton->stopLoading(); + m_netButton->setActive(false); + } else { + qDebug() << "[WlanListItem] start loading connect state:" << state; + m_netButton->startLoading(); + } + + return; +} + +void WlanListItem::onMenuTriggered(QAction *action) +{ + if (action->text() == tr("Connect")) { + this->onNetButtonClicked(); + } else if (action->text() == tr("Disconnect")) { + m_wirelessConnectOperation->deActivateWirelessConnection(m_wlanDevice, m_wirelessNetItem.m_connectUuid); + qDebug()<<"[WlanListItem] Clicked on connected wifi, it will be inactivated. ssid = " + << m_wirelessNetItem.m_NetSsid << Q_FUNC_INFO << __LINE__; + m_netButton->startLoading(); + } else if (action->text() == tr("Forget")) { + m_wirelessConnectOperation->deleteWirelessConnect(m_wirelessNetItem.m_connectUuid); + } + + return; +} + +void WlanListItem::onEnterpriseWlanDialogClose(bool isShow) +{ + isEnterpriseWlanDialogShow = isShow; + + return; +} + +void WlanListItem::forgetPwd() +{ + if (!this->isConfigured()) { + m_pwdLineEdit->setText(""); + return; + } +} + + diff --git a/kylin-nm-gui/kylin-nm-main/frontend/list-items/wlanlistitem.h b/kylin-nm-gui/kylin-nm-main/frontend/list-items/wlanlistitem.h new file mode 100644 index 00000000..4e650d7e --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/list-items/wlanlistitem.h @@ -0,0 +1,107 @@ +#ifndef WLANLISTITEM_H +#define WLANLISTITEM_H +#include "listitem.h" +#include "kywirelessnetitem.h" +#include "kywirelessnetresource.h" +#include "wlanpage.h" +#include "kywirelessconnectoperation.h" +#include +#include "kylinactiveconnectresource.h" +#include +#include "enterprisewlandialog.h" + +#include + +#define PSK_SETTING_NAME "802-11-wireless-security" + +#define NORMAL_HEIGHT 48 +#define EXPANDED_HEIGHT 120 +#define PWD_LENGTH_LIMIT 8 + +class WlanListItem : public ListItem +{ + Q_OBJECT +public: + WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, QWidget *parent = nullptr); + WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, QWidget *parent = nullptr); + WlanListItem(QWidget *parent = nullptr); + ~WlanListItem(); + +public: + QString getSsid(); + + void setSignalStrength(const int &signal); + int getSignalStrength(); + + bool isConfigured(); + + void setWlanState(const int &state); + void setExpanded(const bool &expanded); + + KyConnectState getConnectionState(); + void updateConnectState(KyConnectState state); + + void updateWirelessNetSecurity(QString ssid, QString securityType); + void updateWirelessNetItem(KyWirelessNetItem &wirelessNetItem); + + void forgetPwd(); + +protected: + void resizeEvent(QResizeEvent *event); + void onRightButtonClicked(); + void enterEvent(QEvent *event); + void leaveEvent(QEvent *event); + bool eventFilter(QObject *watched, QEvent *event); + void keyPressEvent(QKeyEvent *event); + +Q_SIGNALS: + void itemHeightChanged(const bool isExpanded, const QString &ssid); + +private: + void initWlanUI(); + void refreshIcon(bool isActivated); + +private: + KyWirelessNetItem m_wirelessNetItem; + KyWirelessConnectOperation *m_wirelessConnectOperation = nullptr; + EnterpriseWlanDialog *enterpriseWlanDialog = nullptr; + + bool m_hasPwd = true; + QString m_wlanDevice; + + bool isEnterpriseWlanDialogShow = false; + + //密码输入区域的UI + QFrame *m_pwdFrame = nullptr; + QHBoxLayout *m_pwdFrameLyt = nullptr; + + QLineEdit * m_pwdLineEdit = nullptr; + QHBoxLayout *m_pwdLineEditLyt = nullptr; + QPushButton *m_showPwdButton = nullptr; + QPushButton *m_connectButton = nullptr; + + //自动连接选择区域UI + QFrame *m_autoConnectFrame = nullptr; + QHBoxLayout *m_autoConnectFrameLyt = nullptr; + QCheckBox *m_autoConnectCheckBox = nullptr; + QLabel *m_autoConnectLabel = nullptr; + + bool m_focusIsOut = true; + bool m_mouseIsOut = true; + + bool m_forgetConnection = false; + bool m_isApMode = false; + +protected Q_SLOTS: + void onInfoButtonClicked(); + +private Q_SLOTS: + void onNetButtonClicked(); + void onPwdEditorTextChanged(); + void onShowPwdButtonClicked(); + void onConnectButtonClicked(); + void onMenuTriggered(QAction *action); + void onEnterpriseWlanDialogClose(bool isShow); +}; + +#endif // WLANLISTITEM_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/list-items/wlanmoreitem.cpp b/kylin-nm-gui/kylin-nm-main/frontend/list-items/wlanmoreitem.cpp new file mode 100644 index 00000000..ee4f9943 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/list-items/wlanmoreitem.cpp @@ -0,0 +1,25 @@ +#include "wlanmoreitem.h" + +WlanMoreItem::WlanMoreItem(QWidget *parent) : ListItem(parent) +{ + setObjectName(WMI_OB_NAME); + m_netButton->setVisible(false); + m_infoButton->setVisible(false); + m_nameLabel->setText(tr("Add Others...")); +} + +WlanMoreItem::~WlanMoreItem() { + +} + +void WlanMoreItem::onNetButtonClicked() { + Q_EMIT hiddenWlanClicked(); +} + +void WlanMoreItem::onRightButtonClicked() { + // Todo +} + +void WlanMoreItem::onMenuTriggered(QAction *action) { + +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/list-items/wlanmoreitem.h b/kylin-nm-gui/kylin-nm-main/frontend/list-items/wlanmoreitem.h new file mode 100644 index 00000000..8783013e --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/list-items/wlanmoreitem.h @@ -0,0 +1,26 @@ +#ifndef WLANMOREITEM_H +#define WLANMOREITEM_H + +#include +#include "listitem.h" + +const QString WMI_OB_NAME = "WlanMoreItemObjName"; + +class WlanMoreItem : public ListItem +{ + Q_OBJECT + +protected: + void onRightButtonClicked(); + +public: + WlanMoreItem(QWidget *parent = nullptr); + ~WlanMoreItem(); + + void onNetButtonClicked(); + void onMenuTriggered(QAction *action); +Q_SIGNALS: + void hiddenWlanClicked(); +}; + +#endif // WLANMOREITEM_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/mainwindow.cpp b/kylin-nm-gui/kylin-nm-main/frontend/mainwindow.cpp new file mode 100644 index 00000000..369000de --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/mainwindow.cpp @@ -0,0 +1,726 @@ +#include "mainwindow.h" +#include "customstyle.h" +#include +#include +#include +#include +#include +#include + +#include "kylinnetworkdeviceresource.h" + +#define MAINWINDOW_WIDTH 420 +#define MAINWINDOW_HEIGHT 476 +#define LAYOUT_MARGINS 0,0,0,0 +#define LOADING_TRAYICON_TIMER_MS 60 +#define THEME_SCHAME "org.ukui.style" +#define COLOR_THEME "styleName" + +#define LAN_PAGE_INDEX 0 +#define WLAN_PAGE_INDEX 1 + +#include +#include + +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) +{ + firstlyStart(); +} + +/** + * @brief MainWindow::showMainwindow show主窗口,同时也作为dbus接口提供给外部组件调用 + */ +void MainWindow::showMainwindow() +{ + if (!m_loadFinished) { + m_secondaryStartTimer->stop(); + secondaryStart(); + } + + /** + * 设置主界面跳过任务栏和分页器的属性,隐藏再次展示有可能辉冲刷掉该属性,需要展示时重新设置 + */ + const KWindowInfo info(this->winId(), NET::WMState); + if (!info.hasState(NET::SkipTaskbar) || !info.hasState(NET::SkipPager)) { + KWindowSystem::setState(this->winId(), NET::SkipTaskbar | NET::SkipPager); + } + + this->resetWindowPosition(); + this->showNormal(); + this->raise(); + this->activateWindow(); + Q_EMIT this->mainWindowVisibleChanged(true); +} + +/** + * @brief MainWindow::hideMainwindow 隐藏主页面时要进行的操作,后续可以添加到此函数 + */ +void MainWindow::hideMainwindow() +{ + this->hide(); + Q_EMIT this->mainWindowVisibleChanged(false); +} + +///** +// * @brief MainWindow::setWiredDefaultDevice 设置有线设备默认网卡 +// */ +//void MainWindow::setWiredDefaultDevice(QString deviceName) +//{ +//// m_lanWidget->updateDefaultDevice(deviceName); +//} + +///** +// * @brief MainWindow::hideMainwindow 设置无线设备默认网卡 +// */ +//void MainWindow::setWirelessDefaultDevice(QString deviceName) +//{ +//// m_wlanWidget->updateDefaultDevice(deviceName); +//} + +/** + * @brief MainWindow::firstlyStart 一级启动,执行重要且不耗时的启动操作 + */ +void MainWindow::firstlyStart() +{ + initWindowProperties(); + initTransparency(); + initUI(); + initDbusConnnect(); + initWindowTheme(); + initTrayIcon(); + installEventFilter(this); + m_secondaryStartTimer = new QTimer(this); + connect(m_secondaryStartTimer, &QTimer::timeout, this, [ = ]() { + m_secondaryStartTimer->stop(); + secondaryStart();//满足条件后执行比较耗时的二级启动 + }); + m_secondaryStartTimer->start(5 * 1000); + + m_createPagePtrMap.clear(); + + //加载key ring + //agent_init(); + //m_secretAgent = new KylinSecretAgent("kylinagent", this); +} + +/** + * @brief MainWindow::secondaryStart 二级启动,可以将较耗时的初始化操作放到此处执行 + */ +void MainWindow::secondaryStart() +{ + if (m_loadFinished) + return; + m_loadFinished = true; +} + +/** + * @brief MainWindow::initWindowProperties 初始化一些窗口属性 + */ +void MainWindow::initWindowProperties() +{ + this->setWindowTitle(tr("kylin-nm")); + this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png"))); + this->setFixedSize(MAINWINDOW_WIDTH, MAINWINDOW_HEIGHT); +// //绘制毛玻璃特效 + this->setAttribute(Qt::WA_TranslucentBackground, true); //透明 + this->setFocusPolicy(Qt::NoFocus); + + QPainterPath path; + auto rect = this->rect(); + path.addRoundedRect(rect, 12, 12); + KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); //背景模糊 +} + +void MainWindow::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); // 反锯齿; + painter.setPen(Qt::transparent); + auto rect = this->rect(); + painter.drawRoundedRect(rect, 12, 12); //窗口圆角 +} + +void MainWindow::initTransparency() +{ + if(QGSettings::isSchemaInstalled(TRANSPARENCY_GSETTINGS)) { + m_transGsettings = new QGSettings(TRANSPARENCY_GSETTINGS); + if(m_transGsettings->keys().contains(QString("transparency"))) { + m_transparency=m_transGsettings->get("transparency").toDouble() + 0.15; + m_transparency = (m_transparency > 1) ? 1 : m_transparency; + connect(m_transGsettings, &QGSettings::changed, this, &MainWindow::onTransChanged); + } + } +} + +void MainWindow::onTransChanged() +{ + m_transparency = m_transGsettings->get("transparency").toDouble() + 0.15; + m_transparency = (m_transparency > 1) ? 1 : m_transparency; + paintWithTrans(); +} + +void MainWindow::paintWithTrans() +{ + QPalette pal = m_centralWidget->palette(); + QColor color = qApp->palette().base().color(); + color.setAlphaF(m_transparency); + pal.setColor(QPalette::Base, color); + m_centralWidget->setPalette(pal); + + QPalette tabPal = m_centralWidget->tabBar()->palette(); + tabPal.setColor(QPalette::Base, color); + + QColor inactiveColor = qApp->palette().window().color(); + inactiveColor.setAlphaF(0.86 *m_transparency); + tabPal.setColor(QPalette::Window, inactiveColor); + + m_centralWidget->tabBar()->setPalette(tabPal); +} + +/** + * @brief MainWindow::initUI 初始化窗口内控件 + */ +void MainWindow::initUI() +{ + m_centralWidget = new QTabWidget(this); + this->setCentralWidget(m_centralWidget); + m_centralWidget->tabBar()->setFixedWidth(this->width()+1); +// m_centralWidget->tabBar()->setStyleSheet("QTabBar::tab{min-height:40px}"); + m_lanWidget = new LanPage(m_centralWidget); + m_wlanWidget = new WlanPage(m_centralWidget); + connect(this, &MainWindow::mainWindowVisibleChanged, m_wlanWidget, &WlanPage::onMainWindowVisibleChanged); +// m_centralWidget->addTab(m_lanWidget, QIcon::fromTheme("network-wired-connected-symbolic", QIcon::fromTheme("network-wired-symbolic", QIcon(":/res/l/network-online.svg"))), tr("LAN")); +// m_centralWidget->addTab(m_wlanWidget, QIcon::fromTheme("network-wireless-signal-excellent-symbolic", QIcon(":/res/x/wifi-list-bg.svg")), tr("WLAN")); + + m_centralWidget->addTab(m_lanWidget, tr("")); + m_centralWidget->addTab(m_wlanWidget,tr("")); + m_tabBarLayout = new QHBoxLayout(this); + m_tabBarLayout->setContentsMargins(LAYOUT_MARGINS); + m_lanLabel = new QLabel(tr("LAN")); + m_lanLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter); + m_wlanLabel = new QLabel(tr("WLAN")); + m_wlanLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter); + m_tabBarLayout->addWidget(m_lanLabel); + m_tabBarLayout->addWidget(m_wlanLabel); + m_centralWidget->tabBar()->setLayout(m_tabBarLayout); + m_centralWidget->tabBar()->setProperty("useTabbarSeparateLine", false); // 去掉中间的分割线 + m_centralWidget->setAttribute(Qt::WA_TranslucentBackground, true); // 背景透明 解决切换黑屏问题 + connect(m_centralWidget, &QTabWidget::currentChanged, m_wlanWidget, &WlanPage::onWlanPageVisibleChanged); + paintWithTrans(); +} + +/** + * @brief MainWindow::initTrayIcon 初始化托盘图标和托盘右键菜单 + */ +void MainWindow::initTrayIcon() +{ + loadIcons.append(QIcon::fromTheme("kylin-network-1")); + loadIcons.append(QIcon::fromTheme("kylin-network-2")); + loadIcons.append(QIcon::fromTheme("kylin-network-3")); + loadIcons.append(QIcon::fromTheme("kylin-network-4")); + loadIcons.append(QIcon::fromTheme("kylin-network-5")); + loadIcons.append(QIcon::fromTheme("kylin-network-6")); + loadIcons.append(QIcon::fromTheme("kylin-network-7")); + loadIcons.append(QIcon::fromTheme("kylin-network-8")); + loadIcons.append(QIcon::fromTheme("kylin-network-9")); + loadIcons.append(QIcon::fromTheme("kylin-network-10")); + loadIcons.append(QIcon::fromTheme("kylin-network-11")); + loadIcons.append(QIcon::fromTheme("kylin-network-12")); + iconTimer = new QTimer(this); + connect(iconTimer, &QTimer::timeout, this, &MainWindow::onSetTrayIconLoading); + + m_trayIcon = new QSystemTrayIcon(); + m_trayIconMenu = new QMenu(); + m_showMainwindowAction = new QAction(tr("Show MainWindow"),this); + m_showSettingsAction = new QAction(tr("Settings"),this); + + m_trayIcon->setToolTip(QString(tr("kylin-nm"))); + m_showSettingsAction->setIcon(QIcon::fromTheme("document-page-setup-symbolic", QIcon(":/res/x/setup.png")) ); +// m_trayIconMenu->addAction(m_showMainwindowAction); + m_trayIconMenu->addAction(m_showSettingsAction); + m_trayIcon->setContextMenu(m_trayIconMenu); + m_trayIcon->setIcon(QIcon::fromTheme("network-wired-signal-excellent-symbolic")); + iconStatus = IconActiveType::LAN_CONNECTED; + onRefreshTrayIcon(); + + connect(m_trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::onTrayIconActivated); +// connect(m_showMainwindowAction, &QAction::triggered, this, &MainWindow::onShowMainwindowActionTriggled); + connect(m_showSettingsAction, &QAction::triggered, this, &MainWindow::onShowSettingsActionTriggled); + m_trayIcon->show(); +} + +void MainWindow::initDbusConnnect() +{ +// connect(m_lanWidget, &LanPage::deviceStatusChanged, this, &MainWindow::deviceStatusChanged); +// connect(m_lanWidget, &LanPage::deviceNameChanged, this, &MainWindow::deviceNameChanged); +// connect(m_wlanWidget, &WlanPage::deviceStatusChanged, this, &MainWindow::deviceStatusChanged); +// connect(m_wlanWidget, &WlanPage::deviceNameChanged, this, &MainWindow::deviceNameChanged); + +// connect(m_wlanWidget, &WlanPage::activateFailed, this, &MainWindow::activateFailed); +// connect(m_wlanWidget, &WlanPage::deactivateFailed, this, &MainWindow::deactivateFailed); +// connect(m_lanWidget, &LanPage::activateFailed, this, &MainWindow::activateFailed); +// connect(m_lanWidget, &LanPage::deactivateFailed, this, &MainWindow::deactivateFailed); + +// connect(m_lanWidget, &LanPage::lanAdd, this, &MainWindow::lanAdd); +// connect(m_lanWidget, &LanPage::lanRemove, this, &MainWindow::lanRemove); +// connect(m_lanWidget, &LanPage::lanUpdate, this, &MainWindow::lanUpdate); +// connect(m_lanWidget, &LanPage::lanActiveConnectionStateChanged, this, &MainWindow::lanActiveConnectionStateChanged); + connect(m_lanWidget, &LanPage::lanConnectChanged, this, &MainWindow::onLanConnectStatusToChangeTrayIcon); + + +// connect(m_wlanWidget, &WlanPage::wlanAdd, this, &MainWindow::wlanAdd); +// connect(m_wlanWidget, &WlanPage::wlanRemove, this, &MainWindow::wlanRemove); +// connect(m_wlanWidget, &WlanPage::wlanActiveConnectionStateChanged, this, &MainWindow::wlanactiveConnectionStateChanged); +// connect(m_wlanWidget, &WlanPage::wlanConnectChanged, this, &MainWindow::onWlanConnectStatusToChangeTrayIcon); +// connect(m_wlanWidget, &WlanPage::hotspotDeactivated, this, &MainWindow::hotspotDeactivated); +// connect(m_wlanWidget, &WlanPage::hotspotActivated, this, &MainWindow::hotspotActivated); +// connect(m_wlanWidget, &WlanPage::secuTypeChange, this, &MainWindow::secuTypeChange); +// connect(m_wlanWidget, &WlanPage::signalStrengthChange, this, &MainWindow::signalStrengthChange); +// connect(m_wlanWidget, &WlanPage::timeToUpdate , this, &MainWindow::timeToUpdate); + connect(m_wlanWidget, &WlanPage::showMainWindow, this, &MainWindow::onShowByWlanPage); + connect(m_wlanWidget, &WlanPage::connectivityChanged, this, &MainWindow::onConnectivityChanged); +} + +/** + * @brief MainWindow::resetWindowPosition 重新计算窗口位置 + */ +void MainWindow::resetWindowPosition() +{ +#define MARGIN 4 +#define PANEL_TOP 1 +#define PANEL_LEFT 2 +#define PANEL_RIGHT 3 +//#define PANEL_BOTTOM 4 + if (!m_positionInterface) { + m_positionInterface = new QDBusInterface("org.ukui.panel", + "/panel/position", + "org.ukui.panel", + QDBusConnection::sessionBus()); + } + QDBusReply reply = m_positionInterface->call("GetPrimaryScreenGeometry"); + //reply获取的参数共5个,分别是 主屏可用区域的起点x坐标,主屏可用区域的起点y坐标,主屏可用区域的宽度,主屏可用区域高度,任务栏位置 + if (!m_positionInterface->isValid() || !reply.isValid() || reply.value().size() < 5) { + qCritical() << QDBusConnection::sessionBus().lastError().message(); + this->setGeometry(0, 0, this->width(), this->height()); + return; + } + QVariantList position_list = reply.value(); + int position = position_list.at(4).toInt(); + switch(position){ + case PANEL_TOP: + //任务栏位于上方 + this->setGeometry(position_list.at(0).toInt() + position_list.at(2).toInt() - this->width() - MARGIN, + position_list.at(1).toInt() + MARGIN, + this->width(), this->height()); + break; + //任务栏位于左边 + case PANEL_LEFT: + this->setGeometry(position_list.at(0).toInt() + MARGIN, + position_list.at(1).toInt() + reply.value().at(3).toInt() - this->height() - MARGIN, + this->width(), this->height()); + break; + //任务栏位于右边 + case PANEL_RIGHT: + this->setGeometry(position_list.at(0).toInt() + position_list.at(2).toInt() - this->width() - MARGIN, + position_list.at(1).toInt() + reply.value().at(3).toInt() - this->height() - MARGIN, + this->width(), this->height()); + break; + //任务栏位于下方 + default: + this->setGeometry(position_list.at(0).toInt() + position_list.at(2).toInt() - this->width() - MARGIN, + position_list.at(1).toInt() + reply.value().at(3).toInt() - this->height() - MARGIN, + this->width(), this->height()); + break; + } + qDebug() << " Position of ukui-panel is " << position << "; Position of mainwindow is " << this->geometry() << "." << Q_FUNC_INFO << __LINE__; +} + +/** + * @brief MainWindow::resetTrayIconTool 重新获取网络连接状态并重新设置图标和tooltip + */ +void MainWindow::resetTrayIconTool() +{ + //ZJP_TODO 检测当前连接的是有线还是无线,是否可用,设置图标和tooltip,图标最好提前define +// int connectivity = objKyDBus->getNetworkConectivity(); +// qDebug() << "Value of current network Connectivity property : "<< connectivity; +// switch (connectivity) { +// case UnknownConnectivity: +// case Portal: +// case Limited: +// setTrayIcon(iconLanOnlineNoInternet); +// trayIcon->setToolTip(QString(tr("Network Connected But Can Not Access Internet"))); +// break; +// case NoConnectivity: +// case Full: +// setTrayIcon(iconLanOnline); +// trayIcon->setToolTip(QString(tr("kylin-nm"))); +// break; +// } + qDebug() << "Has set tray icon to be XXX." << Q_FUNC_INFO << __LINE__; +} + + +/** + * @brief MainWindow::initWindowTheme 初始化窗口主题并创建信号槽 + */ +void MainWindow::initWindowTheme() +{ + const QByteArray style_id(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(style_id)) { + m_styleGsettings = new QGSettings(style_id); +// resetWindowTheme(); + connect(m_styleGsettings, &QGSettings::changed, this, &MainWindow::onThemeChanged); + } else { + qWarning() << "Gsettings interface \"org.ukui.style\" is not exist!" << Q_FUNC_INFO << __LINE__; + } +} + +/** + * @brief MainWindow::resetWindowTheme 读取和设置窗口主题 + */ +void MainWindow::resetWindowTheme() +{ + if (!m_styleGsettings) { return; } + QString currentTheme = m_styleGsettings->get(COLOR_THEME).toString(); + auto app = static_cast(QCoreApplication::instance()); + if(currentTheme == "ukui-dark" || currentTheme == "ukui-black"){ + app->setStyle(new CustomStyle("ukui-dark")); + qDebug() << "Has set color theme to ukui-dark." << Q_FUNC_INFO << __LINE__; + Q_EMIT qApp->paletteChanged(qApp->palette()); + return; + } + app->setStyle(new CustomStyle("ukui-light")); + qDebug() << "Has set color theme to " << currentTheme << Q_FUNC_INFO << __LINE__; + Q_EMIT qApp->paletteChanged(qApp->palette()); + return; +} + +/** + * @brief MainWindow::showControlCenter 打开控制面板网络界面 + */ +void MainWindow::showControlCenter() +{ + QProcess process; + if (!m_lanWidget->lanIsConnected() && m_wlanWidget->wlanIsConnected()){ + process.startDetached("ukui-control-center -m wlanconnect"); + } else { + process.startDetached("ukui-control-center -m netconnect"); + } +} + +/** + * @brief MainWindow::onTrayIconActivated 点击托盘图标的槽函数 + */ +void MainWindow::onTrayIconActivated() +{ + if (this->isVisible()) { + qDebug() << "Received signal of tray icon activated, will hide mainwindow." << Q_FUNC_INFO << __LINE__; + hideMainwindow(); + return; + } + qDebug() << "Received signal of tray icon activated, will show mainwindow." << Q_FUNC_INFO << __LINE__; + this->showMainwindow(); +} + +void MainWindow::onShowMainwindowActionTriggled() +{ + showMainwindow(); +} + +void MainWindow::onShowSettingsActionTriggled() +{ + showControlCenter(); +} + +void MainWindow::onThemeChanged(const QString &key) +{ + if (key == COLOR_THEME) { + qDebug() << "Received signal of theme changed, will reset theme." << Q_FUNC_INFO << __LINE__; +// resetWindowTheme(); + paintWithTrans(); + Q_EMIT qApp->paletteChanged(qApp->palette()); + } else { + qDebug() << "Received signal of theme changed, key=" << key << " will do nothing." << Q_FUNC_INFO << __LINE__; + } +} + +void MainWindow::onRefreshTrayIcon() +{ + //更新托盘图标显示 + iconTimer->stop(); + if (m_lanWidget->lanIsConnected()) { + m_trayIcon->setIcon(QIcon::fromTheme("network-wired-connected-symbolic")); + iconStatus = IconActiveType::LAN_CONNECTED; + } else if (m_wlanWidget->wlanIsConnected()){ + m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-connected-symbolic")); + iconStatus = IconActiveType::WLAN_CONNECTED; + } else { + m_trayIcon->setIcon(QIcon::fromTheme("network-wired-disconnected-symbolic")); + iconStatus = IconActiveType::NOT_CONNECTED; + } + + KyConnectivity connecttivity; + m_wlanWidget->getConnectivity(connecttivity); + if (connecttivity == NetworkManager::Connectivity::Portal || connecttivity == NetworkManager::Connectivity::Limited) { + if (iconStatus == IconActiveType::LAN_CONNECTED) { + m_trayIcon->setIcon(QIcon::fromTheme("network-error-symbolic")); + iconStatus = IconActiveType::LAN_CONNECTED_LIMITED; + } else if (iconStatus == IconActiveType::WLAN_CONNECTED) { + //todo 信号强度 + m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-error-symbolic")); + iconStatus = IconActiveType::WLAN_CONNECTED_LIMITED; + } + } +} + +void MainWindow::onSetTrayIconLoading() +{ + if (currentIconIndex > 11) { + currentIconIndex = 0; + } + m_trayIcon->setIcon(loadIcons.at(currentIconIndex)); + iconStatus = IconActiveType::ACTIVATING; + currentIconIndex ++; +} + +void MainWindow::onLanConnectStatusToChangeTrayIcon(int state) +{ + qDebug() << "lan state:" << state << Q_FUNC_INFO << __LINE__; + if (state==1 || state==3){ + m_lanIsLoading = true; + iconTimer->start(LOADING_TRAYICON_TIMER_MS); + } else { + m_lanIsLoading = false; + if (m_wlanIsLoading == false) { + onRefreshTrayIcon(); + } + } +} + +void MainWindow::onWlanConnectStatusToChangeTrayIcon(int state) +{ + qDebug() << "wlan state:" << state << Q_FUNC_INFO << __LINE__; + if (state==1 || state==3){ + m_wlanIsLoading = true; + iconTimer->start(LOADING_TRAYICON_TIMER_MS); + } else { + m_wlanIsLoading = false; + if (m_lanIsLoading == false) { + onRefreshTrayIcon(); + } + } +} + +void MainWindow::onShowByWlanPage() +{ + m_centralWidget->setCurrentIndex(WLAN_PAGE_INDEX); + + if(QApplication::activeWindow() != this) { + this->resetWindowPosition(); + this->showNormal(); + this->raise(); + this->activateWindow(); + Q_EMIT this->mainWindowVisibleChanged(true); + } +} + +void MainWindow::onConnectivityChanged(KyConnectivity connectivity) +{ + if (!m_trayIcon) { + return; + } + + if (iconStatus == ACTIVATING) { + return; + } + + onRefreshTrayIcon(); +} + +/** + * @brief MainWindow::keyPressEvent 按esc键关闭主界面 + * @param event + */ +void MainWindow::keyPressEvent(QKeyEvent *event) +{ + if (event->key() == Qt::Key_Escape) { + hideMainwindow(); + } + return QWidget::keyPressEvent(event); +} + +/** + * @brief MainWindow::eventFilter 事件过滤器 + * @param watched + * @param event + * @return + */ +bool MainWindow::eventFilter(QObject *watched, QEvent *event) +{ + if (event->type() == QEvent::ActivationChange) { + if(QApplication::activeWindow() != this) { + hideMainwindow(); + } + } + return QMainWindow::eventFilter(watched,event); +} + +///** +// * @brief MainWindow::getWirelessList 获取wifi列表,供dbus调用 +// * @param map +// */ +//void MainWindow::getWirelessList(QMap > &map) +//{ +// map.clear(); +// if (nullptr != m_wlanWidget) { +// m_wlanWidget->getWirelessList(map); +// } +//} + +///** +// * @brief MainWindow::getWiredList 获取lan列表,供dbus调用 +// * @param map +// */ +//void MainWindow::getWiredList(QMap> &map) +//{ +// map.clear(); +// if (nullptr != m_lanWidget) { +// m_lanWidget->getWiredList(map); +// } +//} + +///** +// * @brief MainWindow::activeWirelessAp 开启热点,供dbus调用 +// * @param apName +// * @param apPassword +// * @param apDevice +// */ +//void MainWindow::activeWirelessAp(const QString apName, const QString apPassword, const QString band, const QString apDevice) +//{ +// m_wlanWidget->activeWirelessAp(apName, apPassword, band, apDevice); +//} + +///** +// * @brief MainWindow::activeWirelessAp 断开热点,供dbus调用 +// * @param apName +// */ +//void MainWindow::deactiveWirelessAp(const QString apName, const QString uuid) +//{ +// m_wlanWidget->deactiveWirelessAp(apName, uuid); +//} + +///** +// * @brief MainWindow::activeWirelessAp 获取热点,供dbus调用 +// * @param list +// */ +//void MainWindow::getApInfoBySsid(QString devName, QString ssid, QStringList &list) +//{ +// m_wlanWidget->getApInfoBySsid(devName, ssid, list); +//} + +//void MainWindow::getStoredApInfo(QStringList &list) +//{ +// m_wlanWidget->getStoredApInfo(list); +//} + +////无线开关 +//void MainWindow::setWirelessSwitchEnable(bool enable) +//{ +// m_wlanWidget->setWirelessSwitchEnable(enable); +//} + +//void MainWindow::setWiredDeviceEnable(const QString& devName, bool enable) +//{ +// m_lanWidget->setWiredDeviceEnable(devName, enable); +//} +//void MainWindow::showPropertyWidget(QString devName, QString ssid) +//{ +// KyNetworkDeviceResourse *devResourse = new KyNetworkDeviceResourse(); +// QStringList wiredDeviceList; +// wiredDeviceList.clear(); +// devResourse->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, wiredDeviceList); +// if (wiredDeviceList.contains(devName)) { +// qDebug() << "showPropertyWidget device type wired device name " << devName << " uuid " << ssid; +// m_lanWidget->showDetailPage(devName, ssid); +// delete devResourse; +// devResourse = nullptr; +// return; +// } + +// QStringList wirelessDeviceList; +// wirelessDeviceList.clear(); +// devResourse->getNetworkDeviceList(NetworkManager::Device::Type::Wifi, wirelessDeviceList); +// if (wirelessDeviceList.contains(devName)) { +// qDebug() << "showPropertyWidget device type wireless device name " << devName << " ssid " << ssid; +// m_wlanWidget->showDetailPage(devName, ssid); +// delete devResourse; +// devResourse = nullptr; +// return; +// } + +// qWarning() << "showPropertyWidget no such device " << devName; +// delete devResourse; +// devResourse = nullptr; +//} + +//void MainWindow::showCreateWiredConnectWidget(const QString devName) +//{ +// qDebug() << "showCreateWiredConnectWidget! devName = " << devName; +// if (m_createPagePtrMap.contains(devName)) { +// if (m_createPagePtrMap[devName] != nullptr) { +// qDebug() << "showCreateWiredConnectWidget" << devName << "already create,just raise"; + +// KWindowSystem::raiseWindow(m_createPagePtrMap[devName]->winId()); +// return; +// } +// } +// NetDetail *netDetail = new NetDetail(devName, "", "", false, false, true, this); +// connect(netDetail, &NetDetail::createPageClose, [&](QString interfaceName){ +// if (m_createPagePtrMap.contains(interfaceName)) { +// m_createPagePtrMap[interfaceName] = nullptr; +// } +// }); +// m_createPagePtrMap.insert(devName, netDetail); +// netDetail->show(); +//} + +//void MainWindow::getWirelessDeviceCap(QMap &map) +//{ +// m_wlanWidget->getWirelessDeviceCap(map); +//} + +////有线连接断开 +//void MainWindow::activateWired(const QString& devName, const QString& connUuid) +//{ +// m_lanWidget->activateWired(devName, connUuid); +//} +//void MainWindow::deactivateWired(const QString& devName, const QString& connUuid) +//{ +// m_lanWidget->deactivateWired(devName, connUuid); +//} + +////无线连接断开 +//void MainWindow::activateWireless(const QString& devName, const QString& ssid) +//{ +// m_wlanWidget->activateWirelessConnection(devName, ssid); +//} + +//void MainWindow::deactivateWireless(const QString& devName, const QString& ssid) +//{ +// m_wlanWidget->deactivateWirelessConnection(devName, ssid); +//} + +//void MainWindow::rescan() +//{ +// m_wlanWidget->requestScan(); +//} + +//void MainWindow::keyRingInit() +//{ +// //agent_init(); +//} + +//void MainWindow::keyRingClear() +//{ +// // agent_clear(); +//} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/mainwindow.h b/kylin-nm-gui/kylin-nm-main/frontend/mainwindow.h new file mode 100644 index 00000000..89db24a7 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/mainwindow.h @@ -0,0 +1,170 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "lanpage.h" +#include "wlanpage.h" +#include "netdetails/netdetail.h" + +enum IconActiveType { + NOT_CONNECTED = 0, + LAN_CONNECTED, + WLAN_CONNECTED, + LAN_CONNECTED_LIMITED, + WLAN_CONNECTED_LIMITED, + ACTIVATING, +}; + +const QByteArray TRANSPARENCY_GSETTINGS = "org.ukui.control-center.personalise"; + +class LanPage; + +class MainWindow : public QMainWindow +{ + Q_OBJECT +public: + explicit MainWindow(QWidget *parent = nullptr); + void showMainwindow(); + void hideMainwindow(); + +// void setWiredDefaultDevice(QString deviceName); +// void setWirelessDefaultDevice(QString deviceName); + +// //for dbus +// void getWirelessList(QMap > &map); +// void getWiredList(QMap> &map); +// //开启热点 +// void activeWirelessAp(const QString apName, const QString apPassword, const QString wirelessBand, const QString apDevice); +// //断开热点 +// void deactiveWirelessAp(const QString apName, const QString uuid); +// //获取热点 +// void getStoredApInfo(QStringList &list); +// void getApInfoBySsid(QString devName, QString ssid, QStringList &list); +// //有线连接断开 +// void activateWired(const QString& devName, const QString& connUuid); +// void deactivateWired(const QString& devName, const QString& connUuid); +// //无线连接断开 +// void activateWireless(const QString& devName, const QString& ssid); +// void deactivateWireless(const QString& devName, const QString& ssid); +// //无线总开关 +// void setWirelessSwitchEnable(bool enable); + +// void setWiredDeviceEnable(const QString& devName, bool enable); + +// //唤起属性页 根据网卡类型 参数2 为ssid/uuid +// void showPropertyWidget(QString devName, QString ssid); +// //唤起新建有线连接界面 +// void showCreateWiredConnectWidget(const QString devName); + +// void getWirelessDeviceCap(QMap &map); + +// void rescan(); +// KylinSecretAgent *m_secretAgent; + +// void keyRingInit(); +// void keyRingClear(); + +Q_SIGNALS: +// //设备插拔 +// void deviceStatusChanged(); +// //设备名称变化 +// void deviceNameChanged(QString oldName, QString newName, int type); +// //有线无线列表更新(有线增删、无线增加减少) +// void lanAdd(QString devName, QStringList info); +// void lanRemove(QString dbusPath); +// void lanUpdate(QString devName, QStringList info); +// void wlanAdd(QString devName, QStringList info); +// void wlanRemove(QString devName,QString ssid); +// void wlanactiveConnectionStateChanged(QString devName, QString ssid, QString uuid, int status); +// void lanActiveConnectionStateChanged(QString devName, QString uuid, int status); +// void activateFailed(QString errorMessage); +// void deactivateFailed(QString errorMessage); +// //热点断开 +// void hotspotDeactivated(QString devName, QString ssid); +// void hotspotActivated(QString devName, QString ssid, QString uuid); +// //信号强度变化 +// void signalStrengthChange(QString devName, QString ssid, int strength); +// //安全性变化 +// void secuTypeChange(QString devName, QString ssid, QString secuType); + void mainWindowVisibleChanged(const bool &visible); +// //列表排序 +// void timeToUpdate(); + +protected: + void keyPressEvent(QKeyEvent *event); + bool eventFilter(QObject *watched, QEvent *event) override; + void paintEvent(QPaintEvent *event); + +private: + void firstlyStart(); //一级启动 + void secondaryStart(); //二级启动 + bool m_loadFinished = false; //是否二级启动已执行完 + QTimer * m_secondaryStartTimer = nullptr; //执行二级启动的倒计时 + void initWindowProperties(); + void initTransparency(); + void paintWithTrans(); + void initUI(); + void initDbusConnnect(); + void initTrayIcon(); + void resetTrayIconTool(); + void initWindowTheme(); + void resetWindowTheme(); + void showControlCenter(); + double m_transparency=1.0; //透明度 + QGSettings * m_transGsettings; //透明度配置文件 + int currentIconIndex=0; + QList loadIcons; + QTimer *iconTimer = nullptr; + + //主窗口的主要构成控件 + QTabWidget * m_centralWidget = nullptr; + QHBoxLayout * m_tabBarLayout = nullptr; + QLabel * m_lanLabel = nullptr; + QLabel * m_wlanLabel = nullptr; + + LanPage * m_lanWidget = nullptr; + WlanPage * m_wlanWidget = nullptr; + + //监听主题的Gsettings + QGSettings * m_styleGsettings = nullptr; + + //获取和重置窗口位置 + void resetWindowPosition(); + QDBusInterface * m_positionInterface = nullptr; + + //托盘图标,托盘图标右键菜单 + QSystemTrayIcon * m_trayIcon = nullptr; + QMenu * m_trayIconMenu = nullptr; + QAction * m_showMainwindowAction = nullptr; + QAction * m_showSettingsAction = nullptr; + + bool m_lanIsLoading = false; + bool m_wlanIsLoading = false; + + IconActiveType iconStatus = IconActiveType::NOT_CONNECTED; + + QMap m_createPagePtrMap; + +private Q_SLOTS: + void onTransChanged(); + void onTrayIconActivated(); + void onShowMainwindowActionTriggled(); + void onShowSettingsActionTriggled(); + void onThemeChanged(const QString &key); + void onRefreshTrayIcon(); + void onSetTrayIconLoading(); + void onLanConnectStatusToChangeTrayIcon(int state); + void onWlanConnectStatusToChangeTrayIcon(int state); + void onShowByWlanPage(); + void onConnectivityChanged(KyConnectivity connectivity); +}; + +#endif // MAINWINDOW_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/coninfo.h b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/coninfo.h new file mode 100644 index 00000000..56829514 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/coninfo.h @@ -0,0 +1,271 @@ +#ifndef CONINFO_H +#define CONINFO_H + +#include +#include +#include +#include +#include +#include +#include + +#include "kywirelessnetitem.h" +#include "kylinwirednetresource.h" +#include "kylinactiveconnectresource.h" +#include "kywirelessconnectoperation.h" +#include "kywirelessnetresource.h" +#include "kyenterpricesettinginfo.h" + +#define AUTO_CONFIG 0 +#define MANUAL_CONFIG 1 + +enum PeapInnerType +{ + MSCHAPV2_PEAP = 0, + MD5_PEAP, + GTC_PEAP, +}; + +enum TtlsInnerType +{ + PAP = 0, + MSCHAP, + MSCHAPV2_EAP, + MSCHAPV2, + CHAP, + MD5_EAP, + GTC_EAP +}; + +class LineEdit : public QLineEdit +{ + Q_OBJECT + +public: + explicit LineEdit(QWidget *parent = nullptr) : QLineEdit(parent) {} + ~LineEdit() {} + +protected: + void contextMenuEvent(QContextMenuEvent *event) { + QMenu *menu = createStandardContextMenu();//默认的标准右键菜单,如果不需要刻意完全自己实现 + menu->setPalette(this->palette()); + menu->exec(event->globalPos()); + delete menu; + } +}; + +class ConInfo { +public: + QString strConName; + QString strConType; + QString strSecType; + KySecuType secType = WPA_AND_WPA2_PERSONAL; + QString strPassword; + QString strChan; + QString strMac; + QString strHz; + QString strBandWidth; + QString strDynamicIpv4; + QString strDynamicIpv6; + QString strDynamicIpv4Dns; + bool isAutoConnect = false; + + KyIpConfigType ipv4ConfigType = CONFIG_IP_DHCP; + QString strIPV4Address; + QString strIPV4NetMask; + QString strIPV4FirDns; + QString strIPV4SecDns; + QString strIPV4GateWay; + + KyIpConfigType ipv6ConfigType = CONFIG_IP_DHCP; + QString strIPV6Address; + int iIPV6Prefix; + QString strIPV6FirDns; + QString strIPV6SecDns; + QString strIPV6GateWay; + + KyEapMethodType enterpriseType; + KyEapMethodTlsInfo tlsInfo; + KyEapMethodPeapInfo peapInfo; + KyEapMethodTtlsInfo ttlsInfo; +}; + +static void setFramePalette(QFrame *widget, QPalette &pal) { + QList lineEditList = widget->findChildren(); + for (int i = 0; i < lineEditList.count(); ++i) { + lineEditList.at(i)->setPalette(pal); + lineEditList.at(i)->setContextMenuPolicy(Qt::DefaultContextMenu); + } + QList comboBoxList = widget->findChildren(); + for (int i = 0; i < comboBoxList.count(); ++i) { + comboBoxList.at(i)->setPalette(pal); + if (comboBoxList.at(i)->view()) { + comboBoxList.at(i)->view()->setPalette(pal); + } + } +} + +static QPalette lightPalette(QWidget *widget) +{ + auto palette = widget->palette(); + //ukui-light palette UKUI3.1 + QColor windowText_at(38, 38, 38), + windowText_iat(38, 38, 38), + windowText_dis(166, 166, 166), + button_at(230, 230, 230), + button_iat(230, 230, 230), + button_dis(233, 233, 233), + light_at(255, 255, 255), + light_iat(255, 255, 255), + light_dis(242, 242, 242), + midlight_at(218, 218, 218), + midlight_iat(218, 218, 218), + midlight_dis(230, 230, 230), + dark_at(77, 77, 77), + dark_iat(77, 77, 77), + dark_dis(64, 64, 64), + mid_at(115, 115, 115), + mid_iat(115, 115, 115), + mid_dis(102, 102, 102), + text_at(38, 38, 38), + text_iat(38, 38, 38), + text_dis(140, 140, 140), + brightText_at(89, 89, 89), + brightText_iat(89, 89, 89), + brightText_dis(77, 77, 77), + buttonText_at(38, 38, 38), + buttonText_iat(38, 38, 38), + buttonText_dis(179, 179, 179), + base_at(255, 255, 255), + base_iat(245, 245, 245), + base_dis(237, 237, 237), + window_at(245, 245, 245), + window_iat(237, 237, 237), + window_dis(230, 230, 230), + shadow_at(0, 0, 0, 16), + shadow_iat(0, 0, 0, 16), + shadow_dis(0, 0, 0, 21), +// shadow_at(214, 214, 214), +// shadow_iat(214, 214, 214), +// shadow_dis(201, 201, 201), + highLight_at(55, 144, 250), + highLight_iat(55, 144, 250), + highLight_dis(233, 233, 233), + highLightText_at(255, 255, 255), + highLightText_iat(255, 255, 255), + highLightText_dis(179, 179, 179), + link_at(55, 144, 250), + link_iat(55, 144, 250), + link_dis(55, 144, 250), + linkVisited_at(114, 46, 209), + linkVisited_iat(114, 46, 209), + linkVisited_dis(114, 46, 209), + alternateBase_at(245, 245, 245), + alternateBase_iat(245, 245, 245), + alternateBase_dis(245, 245, 245), + noRale_at(240, 240, 240), + noRole_iat(240, 240, 240), + noRole_dis(217, 217, 217), + toolTipBase_at(255, 255, 255), + toolTipBase_iat(255, 255, 255), + toolTipBase_dis(255, 255, 255), + toolTipText_at(38, 38, 38), + toolTipText_iat(38, 38, 38), + toolTipText_dis(38, 38, 38), + placeholderText_at(38, 38, 38), + placeholderText_iat(38, 38, 38), + placeholderText_dis(38, 38, 38); + + + + palette.setColor(QPalette::Active, QPalette::WindowText, windowText_at); + palette.setColor(QPalette::Inactive, QPalette::WindowText, windowText_iat); + palette.setColor(QPalette::Disabled, QPalette::WindowText, windowText_dis); + + palette.setColor(QPalette::Active, QPalette::Button, button_at); + palette.setColor(QPalette::Inactive, QPalette::Button, button_iat); + palette.setColor(QPalette::Disabled, QPalette::Button, button_dis); + + palette.setColor(QPalette::Active, QPalette::Light, light_at); + palette.setColor(QPalette::Inactive, QPalette::Light, light_iat); + palette.setColor(QPalette::Disabled, QPalette::Light, light_dis); + + palette.setColor(QPalette::Active, QPalette::Midlight, midlight_at); + palette.setColor(QPalette::Inactive, QPalette::Midlight, midlight_iat); + palette.setColor(QPalette::Disabled, QPalette::Midlight, midlight_dis); + + palette.setColor(QPalette::Active, QPalette::Dark, dark_at); + palette.setColor(QPalette::Inactive, QPalette::Dark, dark_iat); + palette.setColor(QPalette::Disabled, QPalette::Dark, dark_dis); + + palette.setColor(QPalette::Active, QPalette::Mid, mid_at); + palette.setColor(QPalette::Inactive, QPalette::Mid, mid_iat); + palette.setColor(QPalette::Disabled, QPalette::Mid, mid_dis); + + palette.setColor(QPalette::Active, QPalette::Text, text_at); + palette.setColor(QPalette::Inactive, QPalette::Text, text_iat); + palette.setColor(QPalette::Disabled, QPalette::Text, text_dis); + + palette.setColor(QPalette::Active, QPalette::BrightText, brightText_at); + palette.setColor(QPalette::Inactive, QPalette::BrightText, brightText_iat); + palette.setColor(QPalette::Disabled, QPalette::BrightText, brightText_dis); + + palette.setColor(QPalette::Active, QPalette::ButtonText, buttonText_at); + palette.setColor(QPalette::Inactive, QPalette::ButtonText, buttonText_iat); + palette.setColor(QPalette::Disabled, QPalette::ButtonText, buttonText_dis); + + palette.setColor(QPalette::Active, QPalette::Base, base_at); + palette.setColor(QPalette::Inactive, QPalette::Base, base_iat); + palette.setColor(QPalette::Disabled, QPalette::Base, base_dis); + + palette.setColor(QPalette::Active, QPalette::Window, window_at); + palette.setColor(QPalette::Inactive, QPalette::Window, window_iat); + palette.setColor(QPalette::Disabled, QPalette::Window, window_dis); + + palette.setColor(QPalette::Active, QPalette::Shadow, shadow_at); + palette.setColor(QPalette::Inactive, QPalette::Shadow, shadow_iat); + palette.setColor(QPalette::Disabled, QPalette::Shadow, shadow_dis); + + palette.setColor(QPalette::Active, QPalette::Highlight, highLight_at); + palette.setColor(QPalette::Inactive, QPalette::Highlight, highLight_iat); + palette.setColor(QPalette::Disabled, QPalette::Highlight, highLight_dis); + + palette.setColor(QPalette::Active, QPalette::HighlightedText, highLightText_at); + palette.setColor(QPalette::Inactive, QPalette::HighlightedText, highLightText_iat); + palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highLightText_dis); + + palette.setColor(QPalette::Active, QPalette::Link, link_at); + palette.setColor(QPalette::Inactive, QPalette::Link, link_iat); + palette.setColor(QPalette::Disabled, QPalette::Link, link_dis); + + palette.setColor(QPalette::Active, QPalette::LinkVisited, linkVisited_at); + palette.setColor(QPalette::Inactive, QPalette::LinkVisited, linkVisited_iat); + palette.setColor(QPalette::Disabled, QPalette::LinkVisited, linkVisited_dis); + + palette.setColor(QPalette::Active, QPalette::AlternateBase, alternateBase_at); + palette.setColor(QPalette::Inactive, QPalette::AlternateBase, alternateBase_iat); + palette.setColor(QPalette::Disabled, QPalette::AlternateBase, alternateBase_dis); + + palette.setColor(QPalette::Active, QPalette::NoRole, noRale_at); + palette.setColor(QPalette::Inactive, QPalette::NoRole, noRole_iat); + palette.setColor(QPalette::Disabled, QPalette::NoRole, noRole_dis); + + palette.setColor(QPalette::Active, QPalette::ToolTipBase, toolTipBase_at); + palette.setColor(QPalette::Inactive, QPalette::ToolTipBase, toolTipBase_iat); + palette.setColor(QPalette::Disabled, QPalette::ToolTipBase, toolTipBase_dis); + + palette.setColor(QPalette::Active, QPalette::ToolTipText, toolTipText_at); + palette.setColor(QPalette::Inactive, QPalette::ToolTipText, toolTipText_iat); + palette.setColor(QPalette::Disabled, QPalette::ToolTipText, toolTipText_dis); + +#if (QT_VERSION >= QT_VERSION_CHECK(5,12,0)) + palette.setColor(QPalette::Active, QPalette::PlaceholderText, placeholderText_at); + palette.setColor(QPalette::Inactive, QPalette::PlaceholderText, placeholderText_iat); + palette.setColor(QPalette::Disabled, QPalette::PlaceholderText, placeholderText_dis); +#endif + + return palette; + +} + +#endif // CONINFO_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/creatnetpage.cpp b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/creatnetpage.cpp new file mode 100644 index 00000000..ef53bc15 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/creatnetpage.cpp @@ -0,0 +1,227 @@ +#include "creatnetpage.h" +#include "math.h" + +#define MAX_NAME_LENGTH 32 + +CreatNetPage::CreatNetPage(QWidget *parent):QFrame(parent) +{ + initUI(); + initComponent(); +} + +void CreatNetPage::initUI() +{ + connNameEdit = new LineEdit(this); + connNameEdit->setMaxLength(MAX_NAME_LENGTH); + ipv4ConfigCombox = new QComboBox(this); + ipv4addressEdit = new LineEdit(this); + netMaskEdit = new LineEdit(this); + gateWayEdit = new LineEdit(this); + firstDnsEdit = new LineEdit(this); + secondDnsEdit = new LineEdit(this); + + m_connNameLabel = new QLabel(this); + m_configLabel = new QLabel(this); + m_addressLabel = new QLabel(this); + m_maskLabel = new QLabel(this); + m_gateWayLabel = new QLabel(this); + m_dnsLabel = new QLabel(this); + m_secDnsLabel = new QLabel(this); + + m_connNameLabel->setText(tr("Connection Name")); + m_configLabel->setText(tr("Ipv4Config")); + m_addressLabel->setText(tr("Address")); + m_maskLabel->setText(tr("Netmask")); + m_gateWayLabel->setText(tr("Default Gateway")); + m_dnsLabel->setText(tr("Prefs DNS")); + m_secDnsLabel->setText(tr("Alternative DNS")); + + m_detailLayout = new QFormLayout(this); + m_detailLayout->addRow(m_connNameLabel,connNameEdit); + m_detailLayout->addRow(m_configLabel,ipv4ConfigCombox); + m_detailLayout->addRow(m_addressLabel,ipv4addressEdit); + m_detailLayout->addRow(m_maskLabel,netMaskEdit); + m_detailLayout->addRow(m_gateWayLabel,gateWayEdit); + m_detailLayout->addRow(m_dnsLabel,firstDnsEdit); + m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit); + + ipv4ConfigCombox->addItem(tr("Auto(DHCP)"), AUTO_CONFIG); //"自动(DHCP)" + ipv4ConfigCombox->addItem(tr("Manual"), MANUAL_CONFIG); //"手动" + + + // IP的正则格式限制 + QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); + + ipv4addressEdit->setValidator(new QRegExpValidator(rx, this)); + gateWayEdit->setValidator(new QRegExpValidator(rx, this)); + netMaskEdit->setValidator(new QRegExpValidator(rx, this)); + firstDnsEdit->setValidator(new QRegExpValidator(rx, this)); + secondDnsEdit->setValidator(new QRegExpValidator(rx, this)); +} + +void CreatNetPage::initComponent() { + if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) { + setLineEnabled(false); + } else if (ipv4ConfigCombox->currentIndex() == MANUAL_CONFIG) { + setLineEnabled(true); + } + connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int))); + + connect(connNameEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn())); + connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); +} + +bool CreatNetPage::checkConnectBtnIsEnabled() +{ + if (connNameEdit->text().isEmpty()) { + qDebug() << "create connName empty or invalid"; + return false; + } + qDebug() << "checkConnectBtnIsEnabled currentIndex" << ipv4ConfigCombox->currentIndex(); + if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) { + return true; + } else { + if (ipv4addressEdit->text().isEmpty() || !getTextEditState(ipv4addressEdit->text())) { + qDebug() << "create ipv4address empty or invalid"; + return false; + } + + if (netMaskEdit->text().isEmpty() || !netMaskIsValide(netMaskEdit->text())) { + qDebug() << "create ipv4 netMask empty or invalid"; + return false; + } + + if (gateWayEdit->text().isEmpty() || !getTextEditState(gateWayEdit->text())) { + qDebug() << "create ipv4 gateway empty or invalid"; + return false; + } + + if (firstDnsEdit->text().isEmpty() && !secondDnsEdit->text().isEmpty()) { + qDebug() << "create ipv4 dns sort invalid"; + return false; + } + + if (!getTextEditState(firstDnsEdit->text())) { + qDebug() << "create ipv4 first dns invalid"; + return false; + } + + if (!getTextEditState(secondDnsEdit->text())) { + qDebug() << "create ipv4 second dns invalid"; + return false; + } + } + return true; +} + +void CreatNetPage::configChanged(int index) { + if (index == AUTO_CONFIG) { + setLineEnabled(false); + } + if (index == MANUAL_CONFIG) { + setLineEnabled(true); + } +} + +void CreatNetPage::setLineEnabled(bool check) { + + ipv4addressEdit->setEnabled(check); + netMaskEdit->setEnabled(check); + gateWayEdit->setEnabled(check); + firstDnsEdit->setEnabled(check); + secondDnsEdit->setEnabled(check); + + if (!check) { + ipv4addressEdit->clear(); + netMaskEdit->clear(); + gateWayEdit->clear(); + firstDnsEdit->clear(); + secondDnsEdit->clear(); + } +} + +void CreatNetPage::setEnableOfSaveBtn() { + Q_EMIT setCreatePageState(checkConnectBtnIsEnabled()); +} + +bool CreatNetPage::getTextEditState(QString text) +{ + if (text.isEmpty()) { + return true; + } + QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); + + bool match = false; + match = rx.exactMatch(text); + + return match; +} + +void CreatNetPage::constructIpv4Info(KyConnectSetting &setting) +{ + setting.m_connectName = connNameEdit->text(); + QString ipv4address =ipv4addressEdit->text(); + QString netMask = getNetMaskText(netMaskEdit->text()); + QString gateWay = gateWayEdit->text(); + qDebug() << "constructIpv4Info: " << "ipv4address " << ipv4address + << " netMask " << netMask + << " gateWay " << gateWay; + + QStringList dnsList; + dnsList.empty(); + if (!firstDnsEdit->text().isEmpty()) { + dnsList << firstDnsEdit->text(); + if (!secondDnsEdit->text().isEmpty()) { + dnsList << secondDnsEdit->text(); + } + } + if (ipv4ConfigCombox->currentData() == AUTO_CONFIG) { + setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP); + } else { + setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_MANUAL); + setting.ipv4AddressConstruct(ipv4address, netMask, gateWay, dnsList); + } + +} + +bool CreatNetPage::netMaskIsValide(QString text) +{ + if (getTextEditState(text)) { + return true; + } else { + if (text.length() > 0 && text.length() < 3) { + int num = text.toInt(); + if (num > 0 && num < 33) { + return true; + } + } + } + return false; +} + +QString CreatNetPage::getNetMaskText(QString text) +{ + if (text.length() > 2) { + return text; + } + + int num = text.toInt(); + QStringList list; + list << "0" << "0" << "0" << "0"; + int count = 0; + while (num - 8 >= 0) { + list[count] = "255"; + num = num - 8; + count ++; + } + if (num > 0) { + int size = pow(2, 8) - pow(2,(8-num)); + list[count] = QString::number(size); + } + return QString("%1.%2.%3.%4").arg(list[0],list[1],list[2],list[3]); +} + diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/creatnetpage.h b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/creatnetpage.h new file mode 100644 index 00000000..312c0a1d --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/creatnetpage.h @@ -0,0 +1,61 @@ +#ifndef CREATNETPAGE_H +#define CREATNETPAGE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "coninfo.h" + +class CreatNetPage : public QFrame +{ + Q_OBJECT +public: + CreatNetPage(QWidget *parent = nullptr); + + void constructIpv4Info(KyConnectSetting &setting); +private: + LineEdit *connNameEdit; + QComboBox *ipv4ConfigCombox; + LineEdit *ipv4addressEdit; + LineEdit *netMaskEdit; + LineEdit *gateWayEdit; + LineEdit *firstDnsEdit; + LineEdit *secondDnsEdit; + +private: + QFormLayout *m_detailLayout; + QVBoxLayout *mvBoxLayout; + QLabel *m_connNameLabel; + QLabel *m_configLabel; + QLabel *m_addressLabel; + QLabel *m_maskLabel; + QLabel *m_gateWayLabel; + QLabel *m_dnsLabel; + QLabel *m_secDnsLabel; +private: + void initUI(); + void initComponent(); + void setLineEnabled(bool check); + bool getTextEditState(QString text); + bool checkConnectBtnIsEnabled(); + + bool netMaskIsValide(QString text); + QString getNetMaskText(QString text); + +private Q_SLOTS: + void setEnableOfSaveBtn(); + void configChanged(int index); +Q_SIGNALS: + void setCreatePageState(bool); + +}; + +#endif // CREATNETPAGE_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/customtabstyle.cpp b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/customtabstyle.cpp new file mode 100644 index 00000000..c8683cc8 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/customtabstyle.cpp @@ -0,0 +1,73 @@ +#include "customtabstyle.h" + + +CustomTabStyle::CustomTabStyle() +{ + +} + +QSize CustomTabStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const +{ + QSize s = QProxyStyle::sizeFromContents(type, option, size, widget); + if (type == QStyle::CT_TabBarTab) { + s.transpose(); + s.rwidth() = 60; // 设置每个tabBar中item的大小 + s.rheight() = 36; + } + return s; +} + +void CustomTabStyle::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const +{ + if (element == CE_TabBarTab) { + if (const QStyleOptionTab *tab = qstyleoption_cast(option)) { + QRect allRect = tab->rect; + if (tab->state & QStyle::State_Selected) { //选中状态:tab的Qlabel为矩形,底色为白色,边框淡灰色,文字为淡蓝色且加粗居中(具体颜色值由拾色器提取) + painter->save(); + painter->setPen(0x3790FA); //设置画笔颜色为淡灰色 + painter->setBrush(QBrush(0x3790FA)); //设置画刷为白色 + painter->drawRoundedRect(allRect.adjusted(0,0,0,0),6,6); //重绘tab的矩形边框 + painter->restore(); //还原为默认 + + painter->save(); + painter->setPen(0xffffff); //重新设置画笔颜色为淡蓝色 + QTextOption option; + option.setAlignment(Qt::AlignCenter); //设置文字居中 + painter->drawText(allRect, tab->text, option); //重绘文字 + painter->restore(); + } + else if(tab->state & QStyle::State_MouseOver) { //hover状态:tab的Qlabel为矩形,底色为灰色,边框仍未淡灰色,文字加粗居中 + painter->save(); + painter->setPen(tab->palette.color(QPalette::Window)); //设置画笔颜色为淡灰色 + painter->setBrush(tab->palette.color(QPalette::Window)); //设置画刷为灰色 + painter->drawRoundedRect(allRect.adjusted(0,0,0,0),6,6); //重绘tab的矩形边框 + painter->restore(); //还原 + + painter->save(); + QTextOption option; + option.setAlignment(Qt::AlignCenter); //设置文字居中 + painter->drawText(allRect, tab->text, option); //重绘文字 + painter->restore(); + } + else //其它的:tab的Qlabel为矩形,底色为灰色,边框为淡灰色不变,文字不加粗但居中 + { + painter->save(); + painter->setPen(tab->palette.color(QPalette::Button)); + painter->setBrush(tab->palette.color(QPalette::Button)); + painter->drawRoundedRect(allRect.adjusted(0,0,0,0),6,6); //重绘tab的矩形边框 + painter->restore(); + painter->save(); + QTextOption option; + option.setAlignment(Qt::AlignCenter); + painter->drawText(allRect, tab->text, option); + painter->restore(); + } + return; + } + } + + if (element == CE_TabBarTab) { + QProxyStyle::drawControl(element, option, painter, widget); + } +} + diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/customtabstyle.h b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/customtabstyle.h new file mode 100644 index 00000000..75a09825 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/customtabstyle.h @@ -0,0 +1,19 @@ +#ifndef CUSTOMTABSTYLE_H +#define CUSTOMTABSTYLE_H + +#include +#include +#include +#include +#include +class CustomTabStyle : public QProxyStyle +{ +public: + CustomTabStyle(); + QSize sizeFromContents(ContentsType type, const QStyleOption *option, + const QSize &size, const QWidget *widget) const; + + void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const; +}; + +#endif // CUSTOMTABSTYLE_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/detailpage.cpp b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/detailpage.cpp new file mode 100644 index 00000000..a5f44074 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/detailpage.cpp @@ -0,0 +1,220 @@ +#include "detailpage.h" +#include +#include + +#define MAX_NAME_LENGTH 32 +#define MAX_LABEL_WIDTH 250 +extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); + +DetailPage::DetailPage(bool isWlan, bool isCreate, QWidget *parent) + : mIsWlan(isWlan), isCreate(isCreate), QFrame(parent) +{ + this->setFrameShape(QFrame::Shape::StyledPanel); + this->setMaximumWidth(960); + initUI(); + if (isCreate) { + connect(mSSIDEdit, &LineEdit::textEdited, this, &DetailPage::setEnableOfSaveBtn); + } +} + +void DetailPage::setSSID(const QString &ssid) { + if (isCreate) { + return; + } + this->mSSIDLabel->setText(ssid); +} + +void DetailPage::setProtocol(const QString &protocol) { + this->mProtocol->setText(protocol); +} + +void DetailPage::setSecType(const QString &secType) { + this->mSecType->setText(secType); +} + +void DetailPage::setHz(const QString &hz) { + this->mHz->setText(hz); +} + +void DetailPage::setChan(const QString &chan) { + this->mChan->setText(chan); +} + +void DetailPage::setBandWidth(const QString &brandWidth) { + this->mBandWidth->setText(brandWidth); +} + +void DetailPage::setIpv4(const QString &ipv4) { + this->mIPV4->setText(ipv4); +} + +void DetailPage::setIpv4Dns(const QString &ipv4Dns) { + this->mIPV4Dns->setText(ipv4Dns); +} + +void DetailPage::setIpv6(const QString &ipv6) { + this->mIPV6->setText(ipv6); +} + +void DetailPage::setMac(const QString &mac) { + this->mMac->setText(mac); +} + +void DetailPage::setAutoConnect(bool flag) +{ + if (!mIsWlan) { + return; + } + this->forgetNetBox->setChecked(flag); +} + +void DetailPage::getSsid(QString &ssid) +{ + if (isCreate) { + ssid = mSSIDEdit->text(); + } else { + ssid = mSSIDLabel->text(); + } +} + +bool DetailPage::checkIsChanged(const ConInfo info) +{ + if (!mIsWlan) { + return false; + } + if (info.isAutoConnect != forgetNetBox->isChecked()) { + return true; + } else { + return false; + } +} + +void DetailPage::addDetailItem(QListWidget *listWidget, DetailWidget *detailWidget) +{ + QListWidgetItem *listWidgetItem = new QListWidgetItem(listWidget); + listWidgetItem->setSizeHint(QSize(listWidget->width(),36)); + listWidgetItem->setFlags(Qt::NoItemFlags); + listWidget->addItem(listWidgetItem); + listWidget->setItemWidget(listWidgetItem, detailWidget); +} + +void DetailPage::initUI() { + layout = new QVBoxLayout(this); + layout->setContentsMargins(0,0,0,0); + + QWidget *mDetailFrame = new QFrame(this); + mDetailLayout = new QVBoxLayout(mDetailFrame); + mDetailLayout->setContentsMargins(0,0,0,0); + + m_listWidget = new QListWidget(mDetailFrame); + m_listWidget->setFrameShape(QFrame::Shape::NoFrame); + m_listWidget->setBackgroundRole(QPalette::Base); + m_listWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus); + mDetailLayout->addWidget(m_listWidget); + + if (!isCreate) { + mSSIDLabel = new FixLabel(this); + mSSIDLabel->setFixedWidth(MAX_LABEL_WIDTH); + mSSIDLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + m_ssidWidget = new DetailWidget(qobject_cast(mSSIDLabel), m_listWidget); + +// mSSID->setStyleSheet("background:transparent;border-width:0px;border-style:none"); +// mSSID->setFocusPolicy(Qt::NoFocus); + } else { +// mSSID->setStyleSheet("border-width:1px;;border-style:solid;border-color:black;border-radius:2px"); + mSSIDEdit = new LineEdit(this); + mSSIDEdit->setMaximumWidth(MAX_LABEL_WIDTH); + mSSIDEdit->setAlignment(Qt::AlignRight); + mSSIDEdit->setStyleSheet("border-top:0px solid;border-bottom:1px solid;border-left:0px solid;border-right: 0px solid;background:transparent"); + mSSIDEdit->setPlaceholderText(tr("Please input SSID:")); + mSSIDEdit->setMaxLength(MAX_NAME_LENGTH); + m_ssidWidget = new DetailWidget(qobject_cast(mSSIDEdit), m_listWidget); + } + m_ssidWidget->setKey(tr("SSID:")); + + mProtocol = new QLabel(this); + m_protocolWidget = new DetailWidget(qobject_cast(mProtocol), m_listWidget); + m_protocolWidget->setKey(tr("Protocol:")); + + mSecType = new QLabel(this); + m_secTypeWidget = new DetailWidget(qobject_cast(mSecType)); + m_secTypeWidget->setKey(tr("Security Type:")); + + mHz = new QLabel(this); + m_hzWidget = new DetailWidget(qobject_cast(mHz)); + m_hzWidget->setKey(tr("Hz:")); + + mChan = new QLabel(this); + m_chanelWidget = new DetailWidget(qobject_cast(mChan)); + m_chanelWidget->setKey(tr("Chan:")); + + mBandWidth = new QLabel(this); + m_bandwidthWidget = new DetailWidget(qobject_cast(mBandWidth), m_listWidget); + m_bandwidthWidget->setKey(tr("BandWidth:")); + + mIPV4 = new QLabel(this); + m_ipv4Widget = new DetailWidget(qobject_cast(mIPV4), m_listWidget); + m_ipv4Widget->setKey(tr("IPV4:")); + + mIPV4Dns = new QLabel(this); + m_ipv4DnsWidget = new DetailWidget(qobject_cast(mIPV4Dns), m_listWidget); + m_ipv4DnsWidget->setKey(tr("IPV4 Dns:")); + + mIPV6 = new FixLabel(this); + mIPV6->setFixedWidth(MAX_LABEL_WIDTH); + mIPV6->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + m_ipv6Widget = new DetailWidget(qobject_cast(mIPV6), m_listWidget); + m_ipv6Widget->setKey(tr("IPV6:")); + + mMac = new QLabel(this); + m_macWidget = new DetailWidget(qobject_cast(mMac), m_listWidget); + m_macWidget->setKey(tr("Mac:")); + + if (mIsWlan) { + autoConnect = new QLabel(this); + forgetNetBox = new QCheckBox(this); + + autoConnect->setText(tr("Auto Connection")); + mAutoLayout = new QHBoxLayout(this); + QSpacerItem *horizontalSpacer; + horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + mAutoLayout->addSpacing(20); + mAutoLayout->addWidget(forgetNetBox); + mAutoLayout->addWidget(autoConnect); + mAutoLayout->addSpacerItem(horizontalSpacer); + } + + this->addDetailItem(m_listWidget, m_ssidWidget); + this->addDetailItem(m_listWidget, m_protocolWidget); + if (mIsWlan) { + this->addDetailItem(m_listWidget, m_secTypeWidget); + this->addDetailItem(m_listWidget, m_hzWidget); + this->addDetailItem(m_listWidget, m_chanelWidget); + } + this->addDetailItem(m_listWidget, m_bandwidthWidget); + this->addDetailItem(m_listWidget, m_ipv6Widget); + this->addDetailItem(m_listWidget, m_ipv4Widget); + this->addDetailItem(m_listWidget, m_ipv4DnsWidget); + this->addDetailItem(m_listWidget, m_macWidget); + + QPalette mpal(m_listWidget->palette()); + mpal.setColor(QPalette::Base, qApp->palette().base().color()); + mpal.setColor(QPalette::AlternateBase, qApp->palette().alternateBase().color()); + m_listWidget->setAlternatingRowColors(true); +// m_listWidget->setAutoFillBackground(true); + m_listWidget->setPalette(mpal); + + layout->addWidget(mDetailFrame); + if (mIsWlan) { + layout->addLayout(mAutoLayout); + } +} + +void DetailPage::setEnableOfSaveBtn() { + bool saveEnable = true; + if (isCreate) { + saveEnable = !mSSIDEdit->text().isEmpty(); + } + Q_EMIT setDetailPageState(saveEnable); +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/detailpage.h b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/detailpage.h new file mode 100644 index 00000000..0e27737a --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/detailpage.h @@ -0,0 +1,85 @@ +#ifndef DETAILPAGE_H +#define DETAILPAGE_H +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "detailwidget.h" +#include "coninfo.h" + +class DetailPage : public QFrame +{ + Q_OBJECT +public: + DetailPage(bool isWlan, bool isCreate = false, QWidget *parent = nullptr); + + void setSSID(const QString &ssid); + void setProtocol(const QString &protocol); + void setSecType(const QString &secType); + void setHz(const QString &hz); + void setChan(const QString &chan); + void setBandWidth(const QString &brandWidth); + void setIpv4(const QString &ipv4); + void setIpv4Dns(const QString &ipv4Dns); + void setIpv6(const QString &ipv6); + void setMac(const QString &mac); + void setAutoConnect(bool flag); + + bool checkIsChanged(const ConInfo info); + + void getSsid(QString &ssid); + +private: + void initUI(); + void addDetailItem(QListWidget *listWidget, DetailWidget *detailWidget); + +public: + QListWidget * m_listWidget = nullptr; + DetailWidget * m_ssidWidget = nullptr; + DetailWidget * m_protocolWidget = nullptr; + DetailWidget * m_secTypeWidget = nullptr; + DetailWidget * m_hzWidget = nullptr; + DetailWidget * m_chanelWidget = nullptr; + DetailWidget * m_bandwidthWidget = nullptr; + DetailWidget * m_ipv4Widget = nullptr; + DetailWidget * m_ipv4DnsWidget = nullptr; + DetailWidget * m_ipv6Widget = nullptr; + DetailWidget * m_macWidget = nullptr; + + LineEdit *mSSIDEdit; + FixLabel *mSSIDLabel; + QLabel *mProtocol; + QLabel *mSecType; + QLabel *mHz; + QLabel *mChan; + QLabel *mBandWidth; + QLabel *mIPV4; + QLabel *mIPV4Dns; + FixLabel *mIPV6; + QLabel *mMac; + QLabel *autoConnect; + +// QWidget *autoFrame; +private: + QVBoxLayout *layout; + QVBoxLayout *mDetailLayout; + QHBoxLayout *mAutoLayout; + QCheckBox *forgetNetBox; + bool mIsWlan; + bool isCreate; + +private Q_SLOTS: + void setEnableOfSaveBtn(); + +Q_SIGNALS: + void setDetailPageState(bool); + +}; + +#endif // DETAILPAGE_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/detailwidget.cpp b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/detailwidget.cpp new file mode 100644 index 00000000..54359865 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/detailwidget.cpp @@ -0,0 +1,73 @@ +#include "detailwidget.h" +#include +#include + +#define ITEM_HEIGHT 36 +#define ITEM_MARGINS 18,0,16,0 + +#define MAX_LABEL_WIDTH 138 + +FixLabel::FixLabel(QWidget *parent): + QLabel(parent) +{ + +} + +FixLabel::~FixLabel() +{ + +} + +void FixLabel::paintEvent(QPaintEvent *event) +{ + QFontMetrics fontMetrics(this->font()); + int fontSize = fontMetrics.width(mStr); + if (fontSize > this->width()) { + this->setText(fontMetrics.elidedText(mStr, Qt::ElideRight, this->width()), false); + this->setToolTip(mStr); + } else { + this->setText(mStr, false); + this->setToolTip(""); + } + QLabel::paintEvent(event); +} + +void FixLabel::setText(const QString & text, bool saveTextFlag) +{ + if (saveTextFlag) { + mStr = text; + } + QLabel::setText(text); +} + +DetailWidget::DetailWidget(QWidget *valueWidget, QWidget *parent) + : m_valueWidget(valueWidget) , QWidget(parent) +{ +// m_valueWidget = valueWidget; + initUI(); +} + +DetailWidget::~DetailWidget() +{ + +} + +void DetailWidget::initUI() +{ + this->setFixedHeight(ITEM_HEIGHT); + m_mainLayout = new QHBoxLayout(this); + m_mainLayout->setContentsMargins(ITEM_MARGINS); + + m_keyLabel = new FixLabel(this); + m_keyLabel->setMaximumWidth(MAX_LABEL_WIDTH); + m_keyLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); + m_mainLayout->addWidget(m_keyLabel); + m_mainLayout->addStretch(); + m_mainLayout->addWidget(m_valueWidget); +// m_valueWidget->setMaximumWidth(100000000000); +} + +void DetailWidget::setKey(const QString &keyLabel) +{ + m_keyLabel->setText(keyLabel); +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/detailwidget.h b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/detailwidget.h new file mode 100644 index 00000000..d0f88edf --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/detailwidget.h @@ -0,0 +1,42 @@ +#ifndef DetailWidget_H +#define DetailWidget_H + +#include +#include +#include + +//文本长自动省略并添加悬浮 +class FixLabel : public QLabel +{ + + Q_OBJECT +public: + FixLabel(QWidget *parent = nullptr); + ~FixLabel(); + void setText(const QString &text, bool saveTextFlag = true); +private: + void paintEvent(QPaintEvent *event); + +private: + QString mStr; +}; + +class DetailWidget : public QWidget +{ + Q_OBJECT +public: + explicit DetailWidget(QWidget *valueWidget = nullptr, QWidget *parent = nullptr); + ~DetailWidget(); + + void setKey(const QString &keyLabel); + +private: + QHBoxLayout * m_mainLayout = nullptr; + FixLabel * m_keyLabel = nullptr; + QWidget * m_valueWidget = nullptr; + + void initUI(); + +}; + +#endif // DetailWidget_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/ipv4page.cpp b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/ipv4page.cpp new file mode 100644 index 00000000..ba28a75e --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/ipv4page.cpp @@ -0,0 +1,280 @@ +#include "ipv4page.h" +#include "netdetail.h" +#include "math.h" + +Ipv4Page::Ipv4Page(QWidget *parent):QFrame(parent) +{ + initUI(); + initComponent(); +} + +void Ipv4Page::initUI() { + ipv4ConfigCombox = new QComboBox(this); + ipv4addressEdit = new LineEdit(this); + netMaskEdit = new LineEdit(this); + gateWayEdit = new LineEdit(this); + firstDnsEdit = new LineEdit(this); + secondDnsEdit = new LineEdit(this); + + m_configLabel = new QLabel(this); + m_addressLabel = new QLabel(this); + m_maskLabel = new QLabel(this); + m_gateWayLabel = new QLabel(this); + m_dnsLabel = new QLabel(this); + m_secDnsLabel = new QLabel(this); + + m_configLabel->setText(tr("Ipv4Config")); + m_addressLabel->setText(tr("Address")); + m_maskLabel->setText(tr("Netmask")); + m_gateWayLabel->setText(tr("Default Gateway")); + m_dnsLabel->setText(tr("Prefs DNS")); + m_secDnsLabel->setText(tr("Alternative DNS")); + + m_detailLayout = new QFormLayout(this); + m_detailLayout->addRow(m_configLabel,ipv4ConfigCombox); + m_detailLayout->addRow(m_addressLabel,ipv4addressEdit); + m_detailLayout->addRow(m_maskLabel,netMaskEdit); + m_detailLayout->addRow(m_gateWayLabel,gateWayEdit); + m_detailLayout->addRow(m_dnsLabel,firstDnsEdit); + m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit); + + ipv4ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)" + ipv4ConfigCombox->addItem(tr("Manual")); //"手动" + +// netMaskCombox->addItem(""); +// netMaskCombox->addItem("255.255.255.0"); //24 +// netMaskCombox->addItem("255.255.254.0"); //23 +// netMaskCombox->addItem("255.255.252.0"); //22 +// netMaskCombox->addItem("255.255.0.0"); //16 +// netMaskCombox->addItem("255.0.0.0"); //8 + + + // IP的正则格式限制 + QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); + + ipv4addressEdit->setValidator(new QRegExpValidator(rx, this)); + gateWayEdit->setValidator(new QRegExpValidator(rx, this)); + netMaskEdit->setValidator(new QRegExpValidator(rx, this)); + firstDnsEdit->setValidator(new QRegExpValidator(rx, this)); + secondDnsEdit->setValidator(new QRegExpValidator(rx, this)); +} + +void Ipv4Page::initComponent() { + if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) { + setLineEnabled(false); + } else if (ipv4ConfigCombox->currentIndex() == MANUAL_CONFIG) { + setLineEnabled(true); + } + connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int))); + + connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn())); + connect(ipv4addressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); +} + +void Ipv4Page::setIpv4Config(KyIpConfigType ipv4Config) +{ + if (ipv4Config == CONFIG_IP_MANUAL) { + ipv4ConfigCombox->setCurrentIndex(MANUAL_CONFIG); + } else { + ipv4ConfigCombox->setCurrentIndex(AUTO_CONFIG); + } +} + +void Ipv4Page::setIpv4(const QString &ipv4) +{ + ipv4addressEdit->setText(ipv4); +} + +void Ipv4Page::setNetMask(const QString &netMask) +{ + netMaskEdit->setText(netMask); +} + +void Ipv4Page::setIpv4FirDns(const QString &ipv4FirDns) +{ + firstDnsEdit->setText(ipv4FirDns); +} + +void Ipv4Page::setIpv4SecDns(const QString &ipv4SecDns) +{ + secondDnsEdit->setText(ipv4SecDns); +} + +void Ipv4Page::setGateWay(const QString &gateWay) +{ + gateWayEdit->setText(gateWay); +} + +bool Ipv4Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting) +{ + bool isChanged = false; + if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) { + if (info.ipv4ConfigType != CONFIG_IP_DHCP) { + qDebug() << "ipv4ConfigType change to Auto"; + setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP); + QString ipv4address(""); + QString netMask(""); + QString gateWay(""); + QStringList dnsList; + dnsList.empty(); + qDebug() << ipv4address << netMask << gateWay; + setting.ipv4AddressConstruct(ipv4address, netMask, gateWay, dnsList); + isChanged = true; + } + } else { + if (info.ipv4ConfigType != CONFIG_IP_MANUAL) { + qDebug() << "ipv4ConfigType change to Manual"; + setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_MANUAL); + isChanged = true; + } + qDebug() << "ipv4 netmask " << getNetMaskText(netMaskEdit->text()); + if(info.strIPV4Address != ipv4addressEdit->text() + || info.strIPV4NetMask != /*netMaskEdit->text()*/getNetMaskText(netMaskEdit->text()) + || info.strIPV4GateWay != gateWayEdit->text() + || info.strIPV4FirDns != firstDnsEdit->text() + || info.strIPV4SecDns != secondDnsEdit->text()) { + + qDebug() << "ipv4 info changed"; + QStringList dnsList; + dnsList.empty(); + if (!firstDnsEdit->text().isEmpty()) { + dnsList << firstDnsEdit->text(); + if (!secondDnsEdit->text().isEmpty()) { + dnsList << secondDnsEdit->text(); + } + } + + QString ipv4address =ipv4addressEdit->text(); + QString netMask = getNetMaskText(netMaskEdit->text()); + QString gateWay = gateWayEdit->text(); + qDebug() << ipv4address << netMask << gateWay; + setting.ipv4AddressConstruct(ipv4address, netMask, gateWay, dnsList); + setting.dumpInfo(); + isChanged = true; + } + } + return isChanged; +} + +bool Ipv4Page::checkConnectBtnIsEnabled() +{ + qDebug() << "checkConnectBtnIsEnabled currentIndex" << ipv4ConfigCombox->currentIndex(); + if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) { + return true; + } else { + if (ipv4addressEdit->text().isEmpty() || !getTextEditState(ipv4addressEdit->text())) { + qDebug() << "ipv4address empty or invalid"; + return false; + } + + if (netMaskEdit->text().isEmpty() || !netMaskIsValide(netMaskEdit->text())) { + qDebug() << "ipv4 netMask empty or invalid"; + return false; + } + +// if (gateWayEdit->text().isEmpty() || !getTextEditState(gateWayEdit->text())) { +// qDebug() << "ipv4 gateway empty or invalid"; +// return false; +// } + + if (firstDnsEdit->text().isEmpty() && !secondDnsEdit->text().isEmpty()) { + qDebug() << "ipv4 dns sort invalid"; + return false; + } + + if (!getTextEditState(firstDnsEdit->text())) { + qDebug() << "ipv4 first dns invalid"; + return false; + } + + if (!getTextEditState(secondDnsEdit->text())) { + qDebug() << "ipv4 second dns invalid"; + return false; + } + } + return true; +} + +void Ipv4Page::configChanged(int index) { + if (index == AUTO_CONFIG) { + setLineEnabled(false); + } + if (index == MANUAL_CONFIG) { + setLineEnabled(true); + } +} + +void Ipv4Page::setLineEnabled(bool check) { + + ipv4addressEdit->setEnabled(check); + netMaskEdit->setEnabled(check); + gateWayEdit->setEnabled(check); + firstDnsEdit->setEnabled(check); + secondDnsEdit->setEnabled(check); + + if (!check) { + ipv4addressEdit->clear(); + netMaskEdit->clear(); + gateWayEdit->clear(); + firstDnsEdit->clear(); + secondDnsEdit->clear(); + } +} + +void Ipv4Page::setEnableOfSaveBtn() { + Q_EMIT setIpv4PageState(checkConnectBtnIsEnabled()); +} + +bool Ipv4Page::getTextEditState(QString text) +{ + if (text.isEmpty()) { + return true; + } + QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); + + bool match = false; + match = rx.exactMatch(text); + + return match; +} + +bool Ipv4Page::netMaskIsValide(QString text) +{ + if (getTextEditState(text)) { + return true; + } else { + if (text.length() > 0 && text.length() < 3) { + int num = text.toInt(); + if (num > 0 && num < 33) { + return true; + } + } + } + return false; +} + +QString Ipv4Page::getNetMaskText(QString text) +{ + if (text.length() > 2) { + return text; + } + + int num = text.toInt(); + QStringList list; + list << "0" << "0" << "0" << "0"; + int count = 0; + while (num - 8 >= 0) { + list[count] = "255"; + num = num - 8; + count ++; + } + if (num > 0) { + int size = pow(2, 8) - pow(2,(8-num)); + list[count] = QString::number(size); + } + return QString("%1.%2.%3.%4").arg(list[0],list[1],list[2],list[3]); +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/ipv4page.h b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/ipv4page.h new file mode 100644 index 00000000..bf1bd051 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/ipv4page.h @@ -0,0 +1,67 @@ +#ifndef IPV4PAGE_H +#define IPV4PAGE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//#include "kylinconnectsetting.h" +#include "coninfo.h" + +class Ipv4Page : public QFrame +{ + Q_OBJECT +public: + Ipv4Page(QWidget *parent = nullptr); + void setIpv4Config(KyIpConfigType ipv4Config); + void setIpv4(const QString &ipv4); + void setNetMask(const QString &netMask); + void setIpv4FirDns(const QString &ipv4FirDns); + void setIpv4SecDns(const QString &ipv4SecDns); + void setGateWay(const QString &gateWay); + + bool checkIsChanged(const ConInfo info, KyConnectSetting &setting); +private: + QComboBox *ipv4ConfigCombox; + LineEdit *ipv4addressEdit; + LineEdit *netMaskEdit; + LineEdit *gateWayEdit; + LineEdit *firstDnsEdit; + LineEdit *secondDnsEdit; + +private: + QFormLayout *m_detailLayout; + QVBoxLayout *mvBoxLayout; + QLabel *m_configLabel; + QLabel *m_addressLabel; + QLabel *m_maskLabel; + QLabel *m_gateWayLabel; + QLabel *m_dnsLabel; + QLabel *m_secDnsLabel; +private: + void initUI(); + void initComponent(); + void setLineEnabled(bool check); + void configSave(); + bool getTextEditState(QString text); + bool netMaskIsValide(QString text); + QString getNetMaskText(QString text); + bool checkConnectBtnIsEnabled(); + + +private Q_SLOTS: + void setEnableOfSaveBtn(); + void configChanged(int index); +Q_SIGNALS: + void setIpv4PageState(bool); + +}; + +#endif // IPV4PAGE_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/ipv6page.cpp b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/ipv6page.cpp new file mode 100644 index 00000000..ada3157b --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/ipv6page.cpp @@ -0,0 +1,257 @@ +#include "ipv6page.h" +#include "netdetail.h" + +Ipv6Page::Ipv6Page(QWidget *parent):QFrame(parent) +{ + initUI(); + initComponent(); +} + +void Ipv6Page::setIpv6Config(KyIpConfigType ipv6Config) +{ + if (ipv6Config == CONFIG_IP_MANUAL) { + ipv6ConfigCombox->setCurrentIndex(MANUAL_CONFIG); + } else { + ipv6ConfigCombox->setCurrentIndex(AUTO_CONFIG); + } +} + +void Ipv6Page::setIpv6(const QString &ipv6) +{ + ipv6AddressEdit->setText(ipv6); +} + +void Ipv6Page::setIpv6Perfix(const int &ipv6Perfix) +{ + lengthEdit->setText(QString::number(ipv6Perfix)); +} + +void Ipv6Page::setIpv6FirDns(const QString &ipv6FirDns) +{ + firstDnsEdit->setText(ipv6FirDns); +} + +void Ipv6Page::setIpv6SecDns(const QString &ipv6SecDns) +{ + secondDnsEdit->setText(ipv6SecDns); +} + +void Ipv6Page::setGateWay(const QString &gateWay) +{ + gateWayEdit->setText(gateWay); +} + +bool Ipv6Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting) +{ + bool isChanged = false; + if (ipv6ConfigCombox->currentIndex() == AUTO_CONFIG) { + if (info.ipv6ConfigType != CONFIG_IP_DHCP) { + qDebug() << "ipv6ConfigType change to Auto"; + setting.setIpConfigType(IPADDRESS_V6, CONFIG_IP_DHCP); + QString ipv6address(""); + QString prefix(""); + QString gateWay(""); + QStringList dnsList; + dnsList.empty(); + setting.ipv6AddressConstruct(ipv6address, prefix, gateWay, dnsList); + isChanged = true; + } + } else { + if (info.ipv6ConfigType != CONFIG_IP_MANUAL) { + qDebug() << "ipv6ConfigType change to Manual"; + setting.setIpConfigType(IPADDRESS_V6, CONFIG_IP_MANUAL); + isChanged = true; + } + if(info.strIPV6Address != ipv6AddressEdit->text() + || info.iIPV6Prefix != lengthEdit->text().toInt() + || info.strIPV6GateWay != gateWayEdit->text() + || info.strIPV6FirDns != firstDnsEdit->text() + || info.strIPV6SecDns != secondDnsEdit->text()) { + + qDebug() << "ipv6 info changed"; + QStringList dnsList; + dnsList.empty(); + if (!firstDnsEdit->text().isEmpty()) { + dnsList << firstDnsEdit->text(); + if (!secondDnsEdit->text().isEmpty()) { + dnsList << secondDnsEdit->text(); + } + } + + QString ipv6address =ipv6AddressEdit->text(); + QString prefix = lengthEdit->text(); + QString gateWay = gateWayEdit->text(); + setting.ipv6AddressConstruct(ipv6address, prefix, gateWay, dnsList); + setting.dumpInfo(); + isChanged = true; + } + } + return isChanged; +} + +void Ipv6Page::initUI() { + ipv6ConfigCombox = new QComboBox(this); + ipv6AddressEdit = new LineEdit(this); + lengthEdit = new LineEdit(this); + gateWayEdit = new LineEdit(this); + firstDnsEdit = new LineEdit(this); + secondDnsEdit = new LineEdit(this); + + m_configLabel = new QLabel(this); + m_addressLabel = new QLabel(this); + m_subnetLabel = new QLabel(this); + m_gateWayLabel = new QLabel(this); + m_dnsLabel = new QLabel(this); + m_secDnsLabel = new QLabel(this); + + + m_configLabel->setText(tr("Ipv6Config")); + m_addressLabel->setText(tr("Address")); + m_subnetLabel->setText(tr("Subnet prefix Length")); + m_gateWayLabel->setText(tr("Default Gateway")); + m_dnsLabel->setText(tr("Prefs DNS")); + m_secDnsLabel->setText(tr("Alternative DNS")); + + + m_detailLayout = new QFormLayout(this); + m_detailLayout->addRow(m_configLabel,ipv6ConfigCombox); + m_detailLayout->addRow(m_addressLabel,ipv6AddressEdit); + m_detailLayout->addRow(m_subnetLabel,lengthEdit); + m_detailLayout->addRow(m_gateWayLabel,gateWayEdit); + m_detailLayout->addRow(m_dnsLabel,firstDnsEdit); + m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit); + + ipv6ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)" + ipv6ConfigCombox->addItem(tr("Manual")); //"手动" + + QRegExp ipv6_rx("^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$"); + ipv6AddressEdit->setValidator(new QRegExpValidator(ipv6_rx, this)); + gateWayEdit->setValidator(new QRegExpValidator(ipv6_rx, this)); + firstDnsEdit->setValidator(new QRegExpValidator(ipv6_rx, this)); + secondDnsEdit->setValidator(new QRegExpValidator(ipv6_rx, this)); + + QRegExp prefix_rx("\\b(?:(?:12[0-8]|1[0-1][0-9]|^[1-9][0-9]?$)\\.){3}(?:12[0-8]|1[0-1][0-9]|^[1-9][0-9]?$)\\b"); + lengthEdit->setValidator(new QRegExpValidator(prefix_rx,this)); +} + +void Ipv6Page::initComponent() { + if (ipv6ConfigCombox->currentIndex() == AUTO_CONFIG) { + setControlEnabled(false); + } else if (ipv6ConfigCombox->currentIndex() == MANUAL_CONFIG) { + setControlEnabled(true); + } + connect(ipv6ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int))); + + connect(ipv6ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn())); + connect(ipv6AddressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(lengthEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); +} + +void Ipv6Page::configChanged(int index) { + if (index == AUTO_CONFIG) { + setControlEnabled(false); + } + if (index == MANUAL_CONFIG) { + setControlEnabled(true); + } +} + +void Ipv6Page::setControlEnabled(bool check) +{ + ipv6AddressEdit->setEnabled(check); + lengthEdit->setEnabled(check); + gateWayEdit->setEnabled(check); + firstDnsEdit->setEnabled(check); + secondDnsEdit->setEnabled(check); + + if (!check) { + ipv6AddressEdit->clear(); + lengthEdit->clear(); + gateWayEdit->clear(); + firstDnsEdit->clear(); + secondDnsEdit->clear(); + } +} + +void Ipv6Page::setEnableOfSaveBtn() +{ + Q_EMIT setIpv6PageState(checkConnectBtnIsEnabled()); +} + +bool Ipv6Page::checkConnectBtnIsEnabled() +{ + if (ipv6ConfigCombox->currentIndex() == AUTO_CONFIG) { + return true; + } else { + if (ipv6AddressEdit->text().isEmpty() || !getIpv6EditState(ipv6AddressEdit->text())) { + qDebug() << "ipv6address empty or invalid"; + return false; + } + + if (lengthEdit->text().isEmpty()) { + qDebug() << "ipv6 prefix length empty"; + return false; + } + + if (gateWayEdit->text().isEmpty() || !getIpv6EditState(gateWayEdit->text())) { + qDebug() << "ipv6 gateway empty or invalid"; + return false; + } + + if (firstDnsEdit->text().isEmpty() && !secondDnsEdit->text().isEmpty()) { + qDebug() << "ipv6 dns sort invalid"; + return false; + } + + if (!getIpv6EditState(firstDnsEdit->text())) { + qDebug() << "ipv6 first dns invalid"; + return false; + } + + if (!getIpv6EditState(secondDnsEdit->text())) { + qDebug() << "ipv6 second dns invalid"; + return false; + } + } + return true; +} + +bool Ipv6Page::getIpv6EditState(QString text) +{ + if (text.isEmpty()) { + return true; + } + QRegExp rx("^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$"); + + bool match = false; + match = rx.exactMatch(text); + + return match; +} + +int Ipv6Page::getPerfixLength(QString text) +{ + qDebug() << "getPerfixLength" << text; + int length = 0; + QStringList list= text.split(":"); + for (int i = 0; i < list.size(); ++i) { + QString temp = list.at(i); + if (temp.isEmpty()) { + continue; + } + bool ok; + unsigned int val = temp.toUInt(&ok, 16); + temp = temp.setNum(val,2); + for(int j = 0; j < temp.length(); ++j) { + if (temp.at(j) == "1") { + length++; + } + } + } + qDebug() << "getPerfixLength" << length; + return length; +} + diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/ipv6page.h b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/ipv6page.h new file mode 100644 index 00000000..c3f55b9b --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/ipv6page.h @@ -0,0 +1,66 @@ +#ifndef IPV6PAGE_H +#define IPV6PAGE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//#include "kylinconnectsetting.h" +#include "coninfo.h" + +class Ipv6Page : public QFrame +{ + Q_OBJECT +public: + Ipv6Page(QWidget *parent = nullptr); + void setIpv6Config(KyIpConfigType ipv6Config); + void setIpv6(const QString &ipv6); + void setIpv6Perfix(const int &ipv6Perfix); + void setIpv6FirDns(const QString &ipv6FirDns); + void setIpv6SecDns(const QString &ipv6SecDns); + void setGateWay(const QString &gateWay); + + bool checkIsChanged(const ConInfo info, KyConnectSetting &setting); + + int getPerfixLength(QString text); + +public: + QComboBox *ipv6ConfigCombox; + LineEdit *ipv6AddressEdit; + LineEdit *lengthEdit; + LineEdit *gateWayEdit; + LineEdit *firstDnsEdit; + LineEdit *secondDnsEdit; +private: + QFormLayout *m_detailLayout; + QLabel *m_configLabel; + QLabel *m_addressLabel; + QLabel *m_subnetLabel; + QLabel *m_gateWayLabel; + QLabel *m_dnsLabel; + QLabel *m_secDnsLabel; +private: + void initUI(); + void initComponent(); + void setControlEnabled(bool check); + + bool getIpv6EditState(QString text); + + bool checkConnectBtnIsEnabled(); + +private Q_SLOTS: + void configChanged(int index); + void setEnableOfSaveBtn(); + +Q_SIGNALS: + void setIpv6PageState(bool); +}; + +#endif // IPV6PAGE_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/netdetail.cpp b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/netdetail.cpp new file mode 100644 index 00000000..a1c1cce2 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/netdetail.cpp @@ -0,0 +1,950 @@ +#include + +#include "netdetail.h" +#include "kylin-tool/kylinipv4arping.h" +#include "kylin-tool/kylinipv6arping.h" +//#include "xatom/xatom-helper.h" + + +#define THEME_SCHAME "org.ukui.style" +#define COLOR_THEME "styleName" + +#include +#include + +#define WINDOW_WIDTH 520 +#define WINDOW_HEIGHT 590 +#define BUTTON_SIZE 30 +#define ICON_SIZE 22,22 +#define TITLE_LAYOUT_MARGINS 9,9,0,0 +#define LAYOUT_MARGINS 24,0,24,0 +#define BOTTOM_LAYOUT_SPACING 16 +#define PAGE_LAYOUT_SPACING 1 +#define DETAIL_PAGE_NUM 0 +#define IPV4_PAGE_NUM 1 +#define IPV6_PAGE_NUM 2 +#define SECURITY_PAGE_NUM 3 +#define CREATE_NET_PAGE_NUM 4 +#define PAGE_MIN_HEIGHT 40 + +//extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); + +void NetDetail::showDesktopNotify(const QString &message) +{ + QDBusInterface iface("org.freedesktop.Notifications", + "/org/freedesktop/Notifications", + "org.freedesktop.Notifications", + QDBusConnection::sessionBus()); + QList args; + args<<(tr("Kylin NM")) + <<((unsigned int) 0) + <setEnabled(on); + ipv4Page->setEnabled(on); + ipv6Page->setEnabled(on); + securityPage->setEnabled(on); + createNetPage->setEnabled(on); + cancelBtn->setEnabled(on); + forgetBtn->setEnabled(on); + confimBtn->setEnabled(on); +} + +NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActive, bool isWlan, bool isCreateNet, QWidget *parent) + :m_deviceName(interface), + m_name(name), + m_uuid(uuid), + isActive(isActive), + isWlan(isWlan), + m_isCreateNet(isCreateNet), + QWidget(parent) +{ + //设置窗口无边框,阴影 +//#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) +// MotifWmHints window_hints; +// window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; +// window_hints.functions = MWM_FUNC_ALL; +// window_hints.decorations = MWM_DECOR_BORDER; +// XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), window_hints); +//#else +// this->setWindowFlags(Qt::Dialog /*| Qt::FramelessWindowHint*/); + this->setWindowFlag(Qt::Window); +//#endif +// this->setProperty("useStyleWindowManager", false); //禁用拖动 +// setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint ); +// setAttribute(Qt::WA_TranslucentBackground); + setAttribute(Qt::WA_DeleteOnClose); + setFixedSize(WINDOW_WIDTH,WINDOW_HEIGHT); + centerToScreen(); + + qDebug() << m_isCreateNet << name; + if (!m_isCreateNet && name.isEmpty()) { + m_isCreateNet = true; + } + qDebug() << m_isCreateNet; + m_netDeviceResource = new KyNetworkDeviceResourse(this); + m_wirelessConnOpration = new KyWirelessConnectOperation(this); + m_resource = new KyWirelessNetResource(this); + m_connectOperation = new KyConnectOperation(this); + m_wiredConnOperation = new KyWiredConnectOperation(this); + initUI(); + loadPage(); + initComponent(); + getConInfo(m_info); + pagePadding(name,isWlan); + + connect(qApp, &QApplication::paletteChanged, this, &NetDetail::onPaletteChanged); + + isCreateOk = !(m_isCreateNet && !isWlan); + isDetailOk = !(m_name.isEmpty()); + isIpv4Ok = true; + isIpv6Ok = true; + isSecuOk = true; + + qDebug() << interface << name << uuid << "isWlan" << isWlan << "isCreateNet" <palette(); + + QGSettings * styleGsettings = nullptr; + const QByteArray style_id(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(style_id)) { + styleGsettings = new QGSettings(style_id); + QString currentTheme = styleGsettings->get(COLOR_THEME).toString(); + if(currentTheme == "ukui-default"){ + pal = lightPalette(this); + } + } + + this->setPalette(pal); + + setFramePalette(detailPage, pal); + setFramePalette(ipv4Page, pal); + setFramePalette(ipv6Page, pal); + setFramePalette(securityPage, pal); + setFramePalette(createNetPage, pal); + + QPalette listwidget_pal(detailPage->m_listWidget->palette()); + listwidget_pal.setColor(QPalette::Base, this->palette().base().color()); + listwidget_pal.setColor(QPalette::AlternateBase, this->palette().alternateBase().color()); + detailPage->m_listWidget->setAlternatingRowColors(true); + detailPage->m_listWidget->setPalette(listwidget_pal); + +} + +void NetDetail::paintEvent(QPaintEvent *event) +{ + return QWidget::paintEvent(event); +} + +void NetDetail::closeEvent(QCloseEvent *event) +{ + Q_EMIT this->detailPageClose(false); + Q_EMIT this->createPageClose(m_deviceName); + return QWidget::closeEvent(event); + +} + +void NetDetail::centerToScreen() +{ + QDesktopWidget* m = QApplication::desktop(); + QRect desk_rect = m->screenGeometry(m->screenNumber(QCursor::pos())); + int desk_x = desk_rect.width(); + int desk_y = desk_rect.height(); + int x = this->width(); + int y = this->height(); + this->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top()); +} + +void NetDetail::initUI() +{ + QVBoxLayout *mainLayout = new QVBoxLayout(this); + mainLayout->setContentsMargins(9,9,14,24); + + detailPage = new DetailPage(isWlan, m_name.isEmpty(), this); + ipv4Page = new Ipv4Page(this); + ipv6Page = new Ipv6Page(this); + securityPage = new SecurityPage(this); + createNetPage = new CreatNetPage(this); + + this->installEventFilter(this); + + centerWidget = new QWidget(this); + bottomWidget = new QWidget(this); + + stackWidget = new QStackedWidget(centerWidget); + stackWidget->addWidget(detailPage); + stackWidget->addWidget(ipv4Page); + stackWidget->addWidget(ipv6Page); + stackWidget->addWidget(securityPage); + stackWidget->addWidget(createNetPage); + + mainLayout->addWidget(centerWidget); + mainLayout->addWidget(bottomWidget); + + bottomWidget->setMinimumHeight(PAGE_MIN_HEIGHT); + + pageFrame = new QFrame(this); + + QHBoxLayout *pageLayout = new QHBoxLayout(pageFrame); + pageLayout->setSpacing(PAGE_LAYOUT_SPACING); + + detailBtn = new QPushButton(this); + detailBtn->setText(tr("Detail")); + detailBtn->setCheckable(true); + detailBtn->setChecked(true); + + ipv4Btn = new QPushButton(this); + ipv4Btn->setText(tr("Ipv4")); + ipv4Btn->setCheckable(true); + + ipv6Btn = new QPushButton(this); + ipv6Btn->setText(tr("Ipv6")); + ipv6Btn->setCheckable(true); + + securityBtn = new QPushButton(this); + securityBtn->setText(tr("Security")); + securityBtn->setCheckable(true); + + m_group = new QButtonGroup(this); + m_group->addButton(detailBtn); + m_group->addButton(ipv4Btn); + m_group->addButton(ipv6Btn); + if (isWlan) { + m_group->addButton(securityBtn); + } + + pageLayout->addStretch(); + pageLayout->addWidget(detailBtn); + pageLayout->addWidget(ipv4Btn); + pageLayout->addWidget(ipv6Btn); + pageLayout->addWidget(securityBtn); + pageLayout->addStretch(); + + confimBtn = new QPushButton(this); + confimBtn->setText(tr("Confirm")); + + cancelBtn = new QPushButton(this); + cancelBtn->setText(tr("Cancel")); + + forgetBtn = new QPushButton(this); + forgetBtn->setText(tr("Forget this network")); + + this->setWindowIcon(QIcon::fromTheme("kylin-network")); + + QVBoxLayout *centerlayout = new QVBoxLayout(centerWidget); + centerlayout->setContentsMargins(LAYOUT_MARGINS); + centerlayout->addWidget(pageFrame); + centerlayout->addWidget(stackWidget); + + QHBoxLayout *bottomLayout = new QHBoxLayout(bottomWidget); + bottomLayout->setContentsMargins(LAYOUT_MARGINS); + bottomLayout->setSpacing(BOTTOM_LAYOUT_SPACING); + bottomLayout->addWidget(forgetBtn); + bottomLayout->addStretch(); + bottomLayout->addWidget(cancelBtn); + bottomLayout->addWidget(confimBtn); + +// QPalette pal(this->palette()); +// pal.setColor(QPalette::Background, qApp->palette().base().color()); + this->setAutoFillBackground(true); +// this->setPalette(pal); + onPaletteChanged(); +} + +void NetDetail::loadPage() +{ + //判断是否创建网络页面 + if (m_isCreateNet && !isWlan) { + pageFrame->hide(); + stackWidget->setCurrentIndex(CREATE_NET_PAGE_NUM); + this->setWindowTitle(tr("Add Lan Connect")); + } else { + stackWidget->setCurrentIndex(DETAIL_PAGE_NUM); + this->setWindowTitle(m_name); + if (!isWlan) { + securityBtn->hide(); + } else { + securityBtn->show(); + if (m_name.isEmpty()) { + this->setWindowTitle(tr("connect hiddin wlan")); + } + } + } +} + +void NetDetail::initComponent() +{ + connect(cancelBtn, &QPushButton::clicked, this, [=] { + close(); + }); + connect(detailBtn, &QPushButton::clicked, this, [=] { + stackWidget->setCurrentIndex(DETAIL_PAGE_NUM); + }); + connect(ipv4Btn, &QPushButton::clicked, this, [=] { + stackWidget->setCurrentIndex(IPV4_PAGE_NUM); + }); + connect(ipv6Btn, &QPushButton::clicked, this, [=] { + stackWidget->setCurrentIndex(IPV6_PAGE_NUM); + }); + connect(securityBtn, &QPushButton::clicked, this, [=] { + stackWidget->setCurrentIndex(SECURITY_PAGE_NUM); + }); + connect(confimBtn, SIGNAL(clicked()), this, SLOT(on_btnConfirm_clicked())); + if (isWlan && !m_uuid.isEmpty()) { + forgetBtn->show(); + connect(forgetBtn, SIGNAL(clicked()), this, SLOT(on_btnForget_clicked())); + } else { + forgetBtn->hide(); + } + + connect(createNetPage, &CreatNetPage::setCreatePageState, this, [=](bool status) { + isCreateOk = status; + setConfirmEnable(); + }); + + connect(detailPage, &DetailPage::setDetailPageState, this, [=](bool status) { + isDetailOk = status; + setConfirmEnable(); + }); + + connect(ipv4Page, &Ipv4Page::setIpv4PageState, this, [=](bool status) { + isIpv4Ok = status; + setConfirmEnable(); + }); + + connect(ipv6Page, &Ipv6Page::setIpv6PageState, this, [=](bool status) { + isIpv6Ok = status; + setConfirmEnable(); + }); + + connect(securityPage, &SecurityPage::setSecuPageState, this, [=](bool status) { + isSecuOk = status; + setConfirmEnable(); + }); +} + +void NetDetail::pagePadding(QString netName, bool isWlan) +{ + //网络详情页填充 + if(m_isCreateNet && !isWlan) { + return; + } + + detailPage->setSSID(netName); + detailPage->setProtocol(m_info.strConType); + detailPage->setSecType(m_info.strSecType); + detailPage->setHz(m_info.strHz); + detailPage->setChan(m_info.strChan); + detailPage->setIpv4(m_info.strDynamicIpv4); + detailPage->setIpv4Dns(m_info.strDynamicIpv4Dns); + detailPage->setIpv6(m_info.strDynamicIpv6); + detailPage->setMac(m_info.strMac); + detailPage->setBandWidth(m_info.strBandWidth); + detailPage->setAutoConnect(m_info.isAutoConnect); + + //ipv4页面填充 + if (m_info.ipv4ConfigType == CONFIG_IP_MANUAL) { + ipv4Page->setIpv4Config(m_info.ipv4ConfigType); + ipv4Page->setIpv4(m_info.strIPV4Address); + ipv4Page->setNetMask(m_info.strIPV4NetMask); + ipv4Page->setIpv4FirDns(m_info.strIPV4FirDns); + ipv4Page->setIpv4SecDns(m_info.strIPV4SecDns); + ipv4Page->setGateWay(m_info.strIPV4GateWay); + } else { + ipv4Page->setIpv4Config(m_info.ipv4ConfigType); + } + //ipv6页面填充 + if (m_info.ipv6ConfigType == CONFIG_IP_MANUAL) { + ipv6Page->setIpv6Config(m_info.ipv6ConfigType); + ipv6Page->setIpv6(m_info.strIPV6Address); + ipv6Page->setIpv6Perfix(m_info.iIPV6Prefix); + ipv6Page->setIpv6FirDns(m_info.strIPV6FirDns); + ipv6Page->setIpv6SecDns(m_info.strIPV6SecDns); + ipv6Page->setGateWay(m_info.strIPV6GateWay); + } else { + ipv6Page->setIpv6Config(m_info.ipv6ConfigType); + } + + //安全页面 + if (isWlan) { + securityPage->setSecurity(m_info.secType); + qDebug() << "setSecurity" << m_info.secType; + if (m_info.secType == WPA_AND_WPA2_ENTERPRISE) { + if (m_info.enterpriseType == TLS) { + securityPage->setTlsInfo(m_info.tlsInfo); + } else if (m_info.enterpriseType == PEAP) { + securityPage->setPeapInfo(m_info.peapInfo); + } else if (m_info.enterpriseType == TTLS) { + securityPage->setTtlsInfo(m_info.ttlsInfo); + } + } + } + +} + +//获取网路详情信息 +void NetDetail::getConInfo(ConInfo &conInfo) +{ + if (m_isCreateNet && !isWlan) { + return; + } + getBaseInfo(conInfo); + getDynamicIpInfo(conInfo, isActive); + getStaticIpInfo(conInfo,isActive); +} + + +//详情ssid 带宽 物理地址 无线额外(安全性 频带 通道) +void NetDetail::getBaseInfo(ConInfo &conInfo) +{ + //有线无线公有 + conInfo.strConName = m_name; + + QString hardAddress; + int bandWith; + m_netDeviceResource->getHardwareInfo(m_deviceName, hardAddress, bandWith); + + if (!hardAddress.isEmpty()) { + conInfo.strBandWidth = QString("%1").arg(bandWith/1000) + "Mbps"; + conInfo.strMac = hardAddress; + } + + if (!isWlan) { + conInfo.strConType = "802-3-ethernet"; + } else { + conInfo.strConType = "802-11-wireless"; + if (!isActive) { + KyWirelessNetItem item; + if (!m_resource->getWifiNetwork(m_deviceName, m_name, item)) { + qDebug() << "getWifiNetWork failed device:" << m_deviceName << " name:" << m_name; + return; + } else { + conInfo.strHz = QString::number(item.m_frequency); + conInfo.strChan = QString::number(item.m_channel); + //无线特有 + conInfo.strSecType = item.m_secuType; + if (conInfo.strSecType.isEmpty()) { + conInfo.strSecType = tr("None"); + } + } + } else { + uint iHz,iChan; + QString strMac; + m_netDeviceResource->getDeviceActiveAPInfo(m_deviceName, strMac, iHz, iChan, conInfo.strSecType); + if (conInfo.strSecType.isEmpty()) { + conInfo.strSecType = tr("None"); + } + conInfo.strHz = QString::number(iHz); + conInfo.strChan = QString::number(iChan); + + } + + + + KyKeyMgmt type = m_wirelessConnOpration->getConnectKeyMgmt(m_uuid); + if (type == WpaNone || type == Unknown) { + conInfo.secType = NONE; + } else if (type == WpaPsk) { + conInfo.secType = WPA_AND_WPA2_PERSONAL; + } else if (type == SAE) { + conInfo.secType = WPA3_PERSONAL; + } else if (type == WpaEap) { + conInfo.secType = WPA_AND_WPA2_ENTERPRISE; + } else { + qDebug() << "KeyMgmt not support now " << type; + } + + initSecuData(); + } +} + +//详情ipv4 ipv6 ipv4Dns +void NetDetail::getDynamicIpInfo(ConInfo &conInfo, bool bActived) +{ + if (!bActived) { + return; + } + //已激活的网络 详情页显示动态ipv4 ipv6 dns + QString ipv4,ipv6; + QList ipv4Dns,ipv6Dns; + KyActiveConnectResourse *activeResourse = new KyActiveConnectResourse(this); + activeResourse->getActiveConnectIpInfo(m_uuid,ipv4,ipv6); + activeResourse->getActiveConnectDnsInfo(m_uuid,ipv4Dns,ipv6Dns); + + //Ipv6 + if (!ipv6.isEmpty()) { + conInfo.strDynamicIpv6 = ipv6; + } + + //IPv4 + if (!ipv4.isEmpty()) { + conInfo.strDynamicIpv4 = ipv4; + } + + if (!ipv4Dns.isEmpty()) { + conInfo.strDynamicIpv4Dns = ipv4Dns.at(0).toString(); + } +} + +//ipv4+ipv6页面 +void NetDetail::getStaticIpInfo(ConInfo &conInfo, bool bActived) +{ + KyConnectResourse *kyConnectResourse = new KyConnectResourse(this); + KyConnectSetting connetSetting; + kyConnectResourse->getConnectionSetting(m_uuid,connetSetting); + connetSetting.dumpInfo(); + + conInfo.ipv4ConfigType = connetSetting.m_ipv4ConfigIpType; + conInfo.ipv6ConfigType = connetSetting.m_ipv6ConfigIpType; + conInfo.isAutoConnect = connetSetting.m_isAutoConnect; + + if (connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) { + if (connetSetting.m_ipv4Address.size() > 0) { + conInfo.strIPV4Address = connetSetting.m_ipv4Address.at(0).ip().toString(); + conInfo.strIPV4NetMask = connetSetting.m_ipv4Address.at(0).netmask().toString(); + conInfo.strIPV4GateWay = connetSetting.m_ipv4Address.at(0).gateway().toString(); + } + if (connetSetting.m_ipv4Dns.size() == 1) { + conInfo.strIPV4FirDns = connetSetting.m_ipv4Dns.at(0).toString(); + } else if (connetSetting.m_ipv4Dns.size() > 1) { + conInfo.strIPV4FirDns = connetSetting.m_ipv4Dns.at(0).toString(); + conInfo.strIPV4SecDns = connetSetting.m_ipv4Dns.at(1).toString(); + } + } + + if (connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) { + if (connetSetting.m_ipv6Address.size() > 0) { + conInfo.strIPV6Address = connetSetting.m_ipv6Address.at(0).ip().toString(); + conInfo.iIPV6Prefix = ipv6Page->getPerfixLength(connetSetting.m_ipv6Address.at(0).netmask().toString()); + conInfo.strIPV6GateWay = connetSetting.m_ipv6Address.at(0).gateway().toString(); + } + + if (connetSetting.m_ipv6Dns.size() == 1) { + conInfo.strIPV6FirDns = connetSetting.m_ipv6Dns.at(0).toString(); + } else if (connetSetting.m_ipv4Dns.size() > 1) { + conInfo.strIPV6FirDns = connetSetting.m_ipv6Dns.at(0).toString(); + conInfo.strIPV6SecDns = connetSetting.m_ipv6Dns.at(1).toString(); + } + } + + if (!bActived) { + conInfo.strDynamicIpv4 = conInfo.strIPV4Address.isEmpty() ? tr("Auto") : conInfo.strIPV4Address; + conInfo.strDynamicIpv6 = conInfo.strIPV6Address.isEmpty() ? tr("Auto") : conInfo.strIPV6Address; + conInfo.strDynamicIpv4Dns = conInfo.strIPV4FirDns.isEmpty() ? tr("Auto") : conInfo.strIPV4FirDns; + } +} + +void NetDetail::initSecuData() +{ + QString password(""); + int type = m_info.secType; + switch (type) { + case NONE: + break; + case WPA_AND_WPA2_PERSONAL: + case WPA3_PERSONAL: + if (!m_uuid.isEmpty()) { + NetworkManager::Setting::SecretFlags flag; + if (m_wirelessConnOpration->getConnSecretFlags(m_uuid, flag)) { + if (!flag) { + password = m_wirelessConnOpration->getPsk(m_uuid); + } + } + } + m_info.strPassword = password; + securityPage->setPsk(password); + break; + case WPA_AND_WPA2_ENTERPRISE: + if (!m_wirelessConnOpration->getEnterpiseEapMethod(m_uuid, m_info.enterpriseType)) { + qDebug() << m_name << "not enterprise wifi"; + } else if (m_info.enterpriseType == TLS){ + initTlsInfo(m_info); + } else if (m_info.enterpriseType == PEAP){ + initPeapInfo(m_info); + } else { + initTtlsInfo(m_info); + } + break; + default: + break; + } +} + +void NetDetail::initTlsInfo(ConInfo &conInfo) +{ + m_resource->getEnterPriseInfoTls(m_uuid, conInfo.tlsInfo); +} + +void NetDetail::initPeapInfo(ConInfo &conInfo) +{ + m_resource->getEnterPriseInfoPeap(m_uuid, conInfo.peapInfo); +} + +void NetDetail::initTtlsInfo(ConInfo &conInfo) +{ + m_resource->getEnterPriseInfoTtls(m_uuid, conInfo.ttlsInfo); +} + +//点击了保存更改网络设置的按钮 +void NetDetail::on_btnConfirm_clicked() +{ + qDebug() << "on_btnConfirm_clicked"; + setNetdetailSomeEnable(false); + if (m_isCreateNet) { + if (!isWlan) { + //新建有线连接 + qDebug() << "Confirm create wired connect"; + if (!createWiredConnect()) { + setNetdetailSomeEnable(true); + return; + } + } else { + //新建无线连接 + qDebug() << "Confirm create wireless connect"; + if (!createWirelessConnect()) { + setNetdetailSomeEnable(true); + return; + } + } + } else { + //更新连接 + qDebug() << "Confirm update connect"; + if (!updateConnect()) { + setNetdetailSomeEnable(true); + return; + } + } + close(); +} + +//点击忘记网络 +void NetDetail::on_btnForget_clicked() +{ + qDebug() << "user choose forget connection uuid = " << m_uuid; + m_connectOperation->deleteConnect(m_uuid); + close(); +} + +void NetDetail::setConfirmEnable() +{ + if (m_isCreateNet && !isWlan) { + isConfirmBtnEnable = isCreateOk; + } else { + if (isDetailOk && isIpv4Ok && isIpv6Ok) { + if (isWlan && !isSecuOk) { + isConfirmBtnEnable = false; + } else { + isConfirmBtnEnable = true; + } + } else { + isConfirmBtnEnable = false; + } + } + qDebug() << "setConfirmEnable "<< isConfirmBtnEnable; + confimBtn->setEnabled(isConfirmBtnEnable); +} + +bool NetDetail::checkIpv4Conflict(QString ipv4Address) +{ + showDesktopNotify(tr("start check ipv4 address conflict")); + bool isConflict = false; + KyIpv4Arping* ipv4Arping = new KyIpv4Arping(m_deviceName, ipv4Address); + + if (ipv4Arping->ipv4ConflictCheck() >= 0) { + isConflict = ipv4Arping->ipv4IsConflict(); + } else { + qWarning() << "checkIpv4Conflict internal error"; + } + + delete ipv4Arping; + ipv4Arping = nullptr; + return isConflict; +} + +bool NetDetail::checkIpv6Conflict(QString ipv6address) +{ + showDesktopNotify(tr("start check ipv6 address conflict")); + bool isConflict = false; + KyIpv6Arping* ipv46rping = new KyIpv6Arping(m_deviceName, ipv6address); + + if (ipv46rping->ipv6ConflictCheck() >= 0) { + isConflict = ipv46rping->ipv6IsConflict(); + } else { + qWarning() << "checkIpv6Conflict internal error"; + } + + delete ipv46rping; + ipv46rping = nullptr; + return isConflict; +} + +void NetDetail::updateWirelessPersonalConnect() +{ + KyWirelessConnectSetting setting; + securityPage->updateSecurityChange(setting); + bool isPwdChanged = !(m_info.strPassword == setting.m_psk); + m_wirelessConnOpration->updateWirelessPersonalConnect(m_uuid, setting, isPwdChanged); +} + +void NetDetail::updateWirelessEnterPriseConnect(KyEapMethodType enterpriseType) +{ + if (enterpriseType == TLS) { + m_info.tlsInfo.devIfaceName = m_deviceName; + securityPage->updateTlsChange(m_info.tlsInfo); + m_wirelessConnOpration->updateWirelessEnterPriseTlsConnect(m_uuid, m_info.tlsInfo); + } else if (enterpriseType == PEAP) { + securityPage->updatePeapChange(m_info.peapInfo); + m_wirelessConnOpration->updateWirelessEnterPrisePeapConnect(m_uuid, m_info.peapInfo); + } else if (enterpriseType == TTLS) { + securityPage->updateTtlsChange(m_info.ttlsInfo); + m_wirelessConnOpration->updateWirelessEnterPriseTtlsConnect(m_uuid, m_info.ttlsInfo); + } +} + +bool NetDetail::createWiredConnect() +{ + KyWirelessConnectSetting connetSetting; + connetSetting.setIfaceName(m_deviceName); + createNetPage->constructIpv4Info(connetSetting); + if (connetSetting.m_ipv4ConfigIpType != CONFIG_IP_DHCP) { + if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) { + qDebug() << "ipv4 conflict"; + showDesktopNotify(tr("ipv4 address conflict!")); + return false; + } + } + m_wiredConnOperation->createWiredConnect(connetSetting); + return true; +} + +bool NetDetail::createWirelessConnect() +{ + KyWirelessConnectSetting connetSetting; + KySecuType secuType; + KyEapMethodType enterpriseType; + securityPage->getSecuType(secuType, enterpriseType); + //类型判断 + if (!m_name.isEmpty()) { + if (!checkWirelessSecurity(secuType)) { + return false; + } + } + + //基本信息 + QString ssid; + if (m_name.isEmpty()) { + detailPage->getSsid(ssid); + } else { + ssid = m_name; + } + connetSetting.setConnectName(ssid); + connetSetting.setIfaceName(m_deviceName); + if (detailPage->checkIsChanged(m_info)) { + connetSetting.isAutoConnect = !m_info.isAutoConnect; + } else { + connetSetting.isAutoConnect = m_info.isAutoConnect; + } + qDebug() << "isAutoConnect" << connetSetting.isAutoConnect; + connetSetting.m_ssid = ssid; +// connetSetting.m_secretFlag = NetworkManager::Setting::None; + //由于X.h的None与此处的None有歧义,此处直接使用值 + connetSetting.m_secretFlag = 0; + + //ipv4 & ipv6 + bool ipv4Change = ipv4Page->checkIsChanged(m_info, connetSetting); + bool ipv6Change = ipv6Page->checkIsChanged(m_info, connetSetting); + + connetSetting.dumpInfo(); + + qDebug() << "ipv4Changed" << ipv4Change << "ipv6Change" << ipv6Change; + if (ipv4Change && connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) { + if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) { + qDebug() << "ipv4 conflict"; + showDesktopNotify(tr("ipv4 address conflict!")); + return false; + } + } + + if (ipv6Change && connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) { + if (checkIpv6Conflict(connetSetting.m_ipv6Address.at(0).ip().toString())) { + qDebug() << "ipv6 conflict"; + showDesktopNotify(tr("ipv6 address conflict!")); + return false; + } + } + //wifi安全性 + if (secuType == WPA_AND_WPA2_ENTERPRISE) { + connetSetting.m_type = WpaEap; + if (enterpriseType == TLS) { + m_info.tlsInfo.devIfaceName = m_deviceName; + securityPage->updateTlsChange(m_info.tlsInfo); + if (!m_name.isEmpty()) { + qDebug() << "add new TLS connect"; + m_wirelessConnOpration->addTlsConnect(connetSetting, m_info.tlsInfo); + } else { + qDebug() << "addAndConnect TLS connect"; + m_wirelessConnOpration->addAndActiveWirelessEnterPriseTlsConnect(m_info.tlsInfo, connetSetting, m_deviceName, true); + } + } else if (enterpriseType == PEAP) { + securityPage->updatePeapChange(m_info.peapInfo); + if (!m_name.isEmpty()) { + qDebug() << "add new PEAP connect"; + m_wirelessConnOpration->addPeapConnect(connetSetting, m_info.peapInfo); + } else { + qDebug() << "addAndConnect PEAP connect"; + m_wirelessConnOpration->addAndActiveWirelessEnterPrisePeapConnect(m_info.peapInfo, connetSetting, m_deviceName, true); + } + } else if (enterpriseType == TTLS) { + securityPage->updateTtlsChange(m_info.ttlsInfo); + if (!m_name.isEmpty()) { + qDebug() << "add new TTLS connect"; + m_wirelessConnOpration->addTtlsConnect(connetSetting, m_info.ttlsInfo); + } else { + qDebug() << "addAndConnect TTLS connect"; + m_wirelessConnOpration->addAndActiveWirelessEnterPriseTtlsConnect(m_info.ttlsInfo, connetSetting, m_deviceName, true); + } + } + } else { + securityPage->updateSecurityChange(connetSetting); + if (!m_name.isEmpty()) { + qDebug() << "add new personal connect"; + m_wirelessConnOpration->addConnect(connetSetting); + } else { + qDebug() << "addAndConnect personal connect" << m_deviceName; + m_wirelessConnOpration->addAndActiveWirelessConnect(m_deviceName, connetSetting, true); + } + } + return true; +} + +bool NetDetail::updateConnect() +{ + KyConnectResourse *kyConnectResourse = new KyConnectResourse(this); + KyConnectSetting connetSetting; + KySecuType secuType; + KyEapMethodType enterpriseType; + kyConnectResourse->getConnectionSetting(m_uuid,connetSetting); + + bool securityChange = false; + if (isWlan) { + securityChange = securityPage->checkIsChanged(m_info); + if(securityChange) { + securityPage->getSecuType(secuType, enterpriseType); + if (!checkWirelessSecurity(secuType)) { + return false; + } + } + } + + if(!m_uuid.isEmpty() && detailPage->checkIsChanged(m_info)) { + m_wirelessConnOpration->setWirelessAutoConnect(m_uuid, !m_info.isAutoConnect); + } + + bool ipv4Change = ipv4Page->checkIsChanged(m_info, connetSetting); + bool ipv6Change = ipv6Page->checkIsChanged(m_info, connetSetting); + + qDebug() << "ipv4Changed" << ipv4Change << "ipv6Change" << ipv6Change; + + if (ipv4Change && connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) { + if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) { + qDebug() << "ipv4 conflict"; + showDesktopNotify(tr("ipv4 address conflict!")); + return false; + } + } + + if (ipv6Change && connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) { + if (checkIpv6Conflict(connetSetting.m_ipv6Address.at(0).ip().toString())) { + qDebug() << "ipv6 conflict"; + showDesktopNotify(tr("ipv6 address conflict!")); + return false; + } + } + + if (ipv4Change || ipv6Change) { + connetSetting.dumpInfo(); + m_wiredConnOperation->updateWiredConnect(m_uuid, connetSetting); + } + + qDebug() << "securityChange" << securityChange; + if (securityChange) { + if (secuType == WPA_AND_WPA2_ENTERPRISE) { + updateWirelessEnterPriseConnect(enterpriseType); + } else { + updateWirelessPersonalConnect(); + } + } + + if (ipv4Change || ipv6Change || securityChange) { + if (isActive) { + //信息变化 断开-重连 更新需要時間 不可以立即重連 +// sleep(1); + QEventLoop eventloop; + QTimer::singleShot(1000, &eventloop, SLOT(quit())); + eventloop.exec(); + m_wirelessConnOpration->activateConnection(m_uuid, m_deviceName); + } + } + return true; +} + +bool NetDetail::checkWirelessSecurity(KySecuType secuType) +{ + if (secuType == WPA_AND_WPA2_ENTERPRISE) { + if(m_info.strSecType.indexOf("802.1X") < 0) { + showDesktopNotify(tr("this wifi no support enterprise type")); + return false; + } + } else { + if (secuType == NONE && m_info.strSecType != "None") { + showDesktopNotify(tr("this wifi no support None type")); + return false; + } else if (secuType == WPA_AND_WPA2_PERSONAL + && (m_info.strSecType.indexOf("WPA1") < 0 && + m_info.strSecType.indexOf("WPA2") < 0)) { + showDesktopNotify(tr("this wifi no support WPA2 type")); + return false; + } else if (secuType == WPA3_PERSONAL && m_info.strSecType.indexOf("WPA3") < 0) { + showDesktopNotify(tr("this wifi no support WPA3 type")); + return false; + } + } + return true; +} + +bool NetDetail::eventFilter(QObject *w, QEvent *event) +{ + // 回车键触发确定按钮点击事件 + if (event->type() == QEvent::KeyPress) { + QKeyEvent *mEvent = static_cast(event); + if (mEvent->key() == Qt::Key_Enter || mEvent->key() == Qt::Key_Return) { + if (confimBtn->isEnabled()) { + Q_EMIT confimBtn->clicked(); + } + return true; + } else if (mEvent->key() == Qt::Key_Escape) { + close(); + return true; + } + } + return QWidget::eventFilter(w, event); +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/netdetail.h b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/netdetail.h new file mode 100644 index 00000000..e911c3b3 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/netdetail.h @@ -0,0 +1,141 @@ +#ifndef NETDETAIL_H +#define NETDETAIL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "detailpage.h" +#include "ipv4page.h" +#include "ipv6page.h" +#include "securitypage.h" +#include "creatnetpage.h" +#include "coninfo.h" +#include "tab-pages/tabpage.h" + +class NetDetail : public QWidget +{ + Q_OBJECT + +public: + NetDetail(QString interface, QString name, QString uuid, bool isActive, bool isWlan, bool isCreateNet, QWidget *parent = nullptr); + ~NetDetail(); +protected: + void paintEvent(QPaintEvent *event); + void closeEvent(QCloseEvent *event); + bool eventFilter(QObject *w, QEvent *event); + +private: + void initUI(); + void centerToScreen(); + void initComponent(); + void getConInfo(ConInfo &conInfo); + void loadPage(); + void pagePadding(QString netName, bool isWlan); + void initSecuData(); + + void initTlsInfo(ConInfo &conInfo); + void initPeapInfo(ConInfo &conInfo); + void initTtlsInfo(ConInfo &conInfo); + + void updateWirelessPersonalConnect(); + void updateWirelessEnterPriseConnect(KyEapMethodType enterpriseType); + + //详情ssid 带宽 物理地址 无线额外(安全性 频带 通道) + void getBaseInfo(ConInfo &conInfo); + //详情ipv4 ipv6 ipv4Dns + void getDynamicIpInfo(ConInfo &conInfo, bool bActived); + //ipv4+ipv6页面 + void getStaticIpInfo(ConInfo &conInfo, bool bActived); + + void setConfirmEnable(); + + bool checkIpv4Conflict(QString ipv4Address); + bool checkIpv6Conflict(QString ipv6Address); + + bool createWiredConnect(); + bool createWirelessConnect(); + bool updateConnect(); + + bool checkWirelessSecurity(KySecuType secuType); + + void showDesktopNotify(const QString &message); + + void setNetdetailSomeEnable(bool on); +private: + KyNetworkDeviceResourse *m_netDeviceResource = nullptr; + KyConnectOperation* m_connectOperation = nullptr; + KyWirelessConnectOperation *m_wirelessConnOpration = nullptr; + KyWiredConnectOperation *m_wiredConnOperation = nullptr; + KyWirelessNetResource *m_resource = nullptr; + + QStackedWidget * stackWidget; + + DetailPage * detailPage; + Ipv4Page * ipv4Page; + Ipv6Page * ipv6Page; + SecurityPage * securityPage; + CreatNetPage * createNetPage; + + QWidget * centerWidget; + QWidget * bottomWidget; + + QPushButton * cancelBtn; + QPushButton * forgetBtn; + QPushButton * confimBtn; + + QPushButton * detailBtn; + QPushButton * ipv4Btn; + QPushButton * ipv6Btn; + QPushButton * securityBtn; + QFrame * pageFrame; + + QString m_name; + QString m_uuid; + QString m_deviceName; + + bool isWlan; + bool m_isCreateNet; + bool isActive; + bool isHideWlan; + + bool isCreateOk; + bool isDetailOk; + bool isIpv4Ok; + bool isIpv6Ok; + bool isSecuOk; + bool isConfirmBtnEnable; + + ConInfo m_info; + + QButtonGroup *m_group; + +private Q_SLOTS: + void on_btnConfirm_clicked(); + void on_btnForget_clicked(); + void onPaletteChanged(); + +Q_SIGNALS: + void detailPageClose(bool on); + void createPageClose(QString); +}; + + + +#endif // NETDETAIL_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/netdetails.pri b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/netdetails.pri new file mode 100644 index 00000000..720a66b8 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/netdetails.pri @@ -0,0 +1,22 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/coninfo.h \ + $$PWD/creatnetpage.h \ + $$PWD/customtabstyle.h \ + $$PWD/detailpage.h \ + $$PWD/detailwidget.h \ + $$PWD/ipv4page.h \ + $$PWD/ipv6page.h \ + $$PWD/netdetail.h \ + $$PWD/securitypage.h + +SOURCES += \ + $$PWD/creatnetpage.cpp \ + $$PWD/customtabstyle.cpp \ + $$PWD/detailpage.cpp \ + $$PWD/detailwidget.cpp \ + $$PWD/ipv4page.cpp \ + $$PWD/ipv6page.cpp \ + $$PWD/netdetail.cpp \ + $$PWD/securitypage.cpp diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/securitypage.cpp b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/securitypage.cpp new file mode 100644 index 00000000..895f3b64 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/securitypage.cpp @@ -0,0 +1,831 @@ +#include "securitypage.h" +#include "netdetail.h" + +#include + +SecurityPage::SecurityPage(QWidget *parent) : QFrame(parent) +{ + initUI(); + initConnect(); +} + +void SecurityPage::initUI() +{ + secuTypeLabel = new QLabel(this); + pwdLabel = new QLabel(this); + secuTypeLabel = new QLabel(this); + pwdLabel = new QLabel(this); + //企业wifi共有 + eapTypeLabel = new QLabel(this); + //TLS + identityLable = new QLabel(this); + domainLable = new QLabel(this); + caCertPathLabel = new QLabel(this); + caNeedFlagLabel = new QLabel(this); + clientCertPathLabel = new QLabel(this); + clientPrivateKeyLabel = new QLabel(this); + clientPrivateKeyPwdLabel = new QLabel(this); + + //PEAP TTLS共有 + eapMethodLabel = new QLabel(this); + userNameLabel = new QLabel(this); + userPwdLabel = new QLabel(this); + userPwdFlagLabel = new QLabel(this); + + secuTypeCombox = new QComboBox(this); + pwdEdit = new LineEdit(this); + eapTypeCombox = new QComboBox(this); + //TLS + identityEdit = new LineEdit(this); + domainEdit = new LineEdit(this); + caCertPathCombox = new QComboBox(this); + caNeedBox = new QCheckBox(this); + clientCertPathCombox = new QComboBox(this); + clientPrivateKeyCombox = new QComboBox(this); + clientPrivateKeyPwdEdit = new LineEdit(this); + + //PEAP && TTLS + eapMethodCombox = new QComboBox(this); + userNameEdit = new LineEdit(this); + userPwdEdit = new LineEdit(this); + userPwdFlagBox = new QCheckBox(this); + + + mSecuLayout = new QFormLayout(this); + mSecuLayout->addRow(secuTypeLabel, secuTypeCombox); + mSecuLayout->addRow(pwdLabel, pwdEdit); + mSecuLayout->addRow(eapTypeLabel, eapTypeCombox); + mSecuLayout->addRow(identityLable, identityEdit); + mSecuLayout->addRow(domainLable, domainEdit); + mSecuLayout->addRow(caCertPathLabel, caCertPathCombox); + mSecuLayout->addRow(caNeedBox, caNeedFlagLabel); + mSecuLayout->addRow(clientCertPathLabel, clientCertPathCombox); + mSecuLayout->addRow(clientPrivateKeyLabel, clientPrivateKeyCombox); + mSecuLayout->addRow(clientPrivateKeyPwdLabel,clientPrivateKeyPwdEdit); + mSecuLayout->addRow(eapMethodLabel, eapMethodCombox); + mSecuLayout->addRow(userNameLabel, userNameEdit); + mSecuLayout->addRow(userPwdLabel, userPwdEdit); + mSecuLayout->addRow(userPwdFlagBox, userPwdFlagLabel); + + + secuTypeLabel->setText(tr("Security")); + pwdLabel->setText(tr("Password")); + //企业wifi共有 + eapTypeLabel->setText(tr("EAP type")); + //TLS + identityLable->setText(tr("Identity")); + domainLable->setText(tr("Domain")); + caCertPathLabel->setText(tr("CA certficate")); + caNeedFlagLabel->setText(tr("no need for CA certificate")); + clientCertPathLabel->setText(tr("User certificate")); + clientPrivateKeyLabel->setText(tr("User private key")); + clientPrivateKeyPwdLabel->setText(tr("User key password")); + + //PEAP TTLS共有 + eapMethodLabel->setText(tr("Ineer authentication")); + userNameLabel->setText(tr("Usename")); + userPwdLabel->setText(tr("Password")); + userPwdFlagLabel->setText(tr("Ask pwd each query")); + + secuTypeCombox->addItem(tr("None"),NONE); + secuTypeCombox->addItem(tr("WPA&WPA2 Personal"),WPA_AND_WPA2_PERSONAL); + secuTypeCombox->addItem(tr("WPA&WPA2 Enterprise"), WPA_AND_WPA2_ENTERPRISE); + secuTypeCombox->addItem(tr("WPA3 Personal"), WPA3_PERSONAL); + + eapTypeCombox->addItem("TLS", TLS); + eapTypeCombox->addItem("PEAP", PEAP); + eapTypeCombox->addItem("TTLS", TTLS); + eapTypeCombox->setCurrentIndex(TLS); + //TLS + caCertPathCombox->addItem(tr("None"), QString(tr("None"))); //无 + caCertPathCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... + + clientCertPathCombox->addItem(tr("None"), QString(tr("None"))); //无 + clientCertPathCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... + + clientPrivateKeyCombox->addItem(tr("None"), QString(tr("None"))); //无 + clientPrivateKeyCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... + + pwdBox = new QCheckBox(this); + pwdBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}" + "QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}" + "QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}"); + pwdBox->setCursor(Qt::PointingHandCursor); + pwdBox->setFixedSize(30, pwdEdit->height()); + //防止文本框输入内容位于按钮之下 + QMargins margins = pwdEdit->textMargins(); + pwdEdit->setTextMargins(margins.left(), margins.top(), pwdBox->width(), margins.bottom()); + QHBoxLayout *pPwdLayout = new QHBoxLayout(); + pPwdLayout->addStretch(); + pPwdLayout->addWidget(pwdBox); + pPwdLayout->setSpacing(0); + pPwdLayout->setContentsMargins(0, 0, 0, 0); + pwdEdit->setLayout(pPwdLayout); + pwdEdit->setEchoMode(QLineEdit::Password); + + userPwdBox = new QCheckBox(this); + userPwdBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}" + "QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}" + "QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}"); + userPwdBox->setCursor(Qt::PointingHandCursor); + userPwdBox->setFixedSize(30, userPwdEdit->height()); + userPwdBox->setFocusPolicy(Qt::NoFocus); + //防止文本框输入内容位于按钮之下 + userPwdEdit->setTextMargins(margins.left(), margins.top(), userPwdBox->width(), margins.bottom()); + QHBoxLayout *puserPwdLayout = new QHBoxLayout(); + puserPwdLayout->addStretch(); + puserPwdLayout->addWidget(userPwdBox); + puserPwdLayout->setSpacing(0); + puserPwdLayout->setContentsMargins(0, 0, 0, 0); + userPwdEdit->setLayout(puserPwdLayout); + userPwdEdit->setEchoMode(QLineEdit::Password); + + privateKeyBox = new QCheckBox(this); + privateKeyBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}" + "QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}" + "QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}"); + privateKeyBox->setCursor(Qt::PointingHandCursor); + privateKeyBox->setFixedSize(30, clientPrivateKeyPwdEdit->height()); + //防止文本框输入内容位于按钮之下 + clientPrivateKeyPwdEdit->setTextMargins(margins.left(), margins.top(), privateKeyBox->width(), margins.bottom()); + QHBoxLayout *pPrivateKeyPwdLayout = new QHBoxLayout(); + pPrivateKeyPwdLayout->addStretch(); + pPrivateKeyPwdLayout->addWidget(privateKeyBox); + pPrivateKeyPwdLayout->setSpacing(0); + pPrivateKeyPwdLayout->setContentsMargins(0, 0, 0, 0); + clientPrivateKeyPwdEdit->setLayout(pPrivateKeyPwdLayout); + clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password); + + pwdEdit->setContextMenuPolicy(Qt::NoContextMenu); + clientPrivateKeyPwdEdit->setContextMenuPolicy(Qt::NoContextMenu); + userPwdEdit->setContextMenuPolicy(Qt::NoContextMenu); + + QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$"); + QRegExpValidator *latitude = new QRegExpValidator(rx, this); + pwdEdit->setValidator(latitude); + clientPrivateKeyPwdEdit->setValidator(latitude); + userPwdEdit->setValidator(latitude); + + showNone(); +} + +void SecurityPage::initConnect() +{ + //安全类型变化 +// connect(secuTypeCombox, &QComboBox::currentTextChanged, this, &SecurityPage::onSecuTypeComboxIndexChanged); + connect(secuTypeCombox, QOverload::of(&QComboBox::currentIndexChanged), this, &SecurityPage::onSecuTypeComboxIndexChanged); + //EAP方式变化 +// connect(eapTypeCombox, &QComboBox::currentTextChanged, this, &SecurityPage::onEapTypeComboxIndexChanged); + connect(eapTypeCombox, QOverload::of(&QComboBox::currentIndexChanged), this, &SecurityPage::onEapTypeComboxIndexChanged); + + connect(caNeedBox, &QCheckBox::clicked, this, &SecurityPage::onCaNeedBoxClicked); + + connect(pwdBox, &QCheckBox::clicked, this, &SecurityPage::onPwdBoxClicked); + connect(userPwdBox, &QCheckBox::clicked, this, &SecurityPage::onUserPwdBox); + connect(privateKeyBox, &QCheckBox::clicked, this, &SecurityPage::onPrivateKeyBoxClicked); + + connect(caCertPathCombox, static_cast(&QComboBox::currentIndexChanged), + this, &SecurityPage::onCaCertPathComboxIndexChanged); + + connect(clientCertPathCombox, static_cast(&QComboBox::currentIndexChanged), + this, &SecurityPage::onClientCertPathComboxIndexChanged); + + connect(clientPrivateKeyCombox, static_cast(&QComboBox::currentIndexChanged), + this, &SecurityPage::onClientPrivateKeyComboxIndexChanged); + + connect(secuTypeCombox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(pwdEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn); + connect(eapTypeCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn())); + connect(identityEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn); + connect(caCertPathCombox, SIGNAL(currentTextChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(caNeedBox, &QCheckBox::stateChanged, this, &SecurityPage::setEnableOfSaveBtn); + connect(clientCertPathCombox, SIGNAL(currentTextChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(clientPrivateKeyCombox, SIGNAL(currentTextChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(clientPrivateKeyPwdEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn); + connect(eapMethodCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn())); + connect(userNameEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn); + connect(userPwdEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn); + +} + +void SecurityPage::setSecurity(KySecuType index) +{ + secuTypeCombox->setCurrentIndex(index); + onSecuTypeComboxIndexChanged(); +} + +void SecurityPage::setPsk(const QString &psk) +{ + pwdEdit->setText(psk); +} + +void SecurityPage::setTlsInfo(KyEapMethodTlsInfo &info) +{ + showTls(); + identityEdit->setText(info.identity); + domainEdit->setText(info.domain); + if (info.caCertPath.isEmpty()) { + caCertPathCombox->setItemText(0, ""); + caNeedBox->setChecked(true); + } else { + caCertPathCombox->setItemText(0, info.caCertPath); + caNeedBox->setChecked(false); + } + + if (info.clientCertPath.isEmpty()) { + clientCertPathCombox->setItemText(0, ""); + } else { + clientCertPathCombox->setItemText(0, info.clientCertPath); + } + + if (info.clientPrivateKey.isEmpty()) { + clientPrivateKeyCombox->setItemText(0, ""); + } else { + clientPrivateKeyCombox->setItemText(0, info.clientPrivateKey); + } + + clientPrivateKeyPwdEdit->setText(info.clientPrivateKeyPWD); + +} + +void SecurityPage::setPeapInfo(KyEapMethodPeapInfo &info) +{ + showPeapOrTtls(); + eapTypeCombox->setCurrentIndex(PEAP); + onEapTypeComboxIndexChanged(); + if (info.phase2AuthMethod == KyAuthMethodMschapv2) { + eapMethodCombox->setCurrentIndex(MSCHAPV2_PEAP); + } else if (info.phase2AuthMethod == KyAuthMethodMd5){ + eapMethodCombox->setCurrentIndex(MD5_PEAP); + } else if (info.phase2AuthMethod == KyAuthMethodGtc) { + eapMethodCombox->setCurrentIndex(GTC_PEAP); + } + userNameEdit->setText(info.userName); + userPwdEdit->setText(info.userPWD); + if (info.m_passwdFlag) { + userPwdFlagBox->setChecked(true); + } else { + userPwdFlagBox->setChecked(false); + } +} + +void SecurityPage::setTtlsInfo(KyEapMethodTtlsInfo &info) +{ + showPeapOrTtls(); + eapTypeCombox->setCurrentIndex(TTLS); + onEapTypeComboxIndexChanged(); + + if (info.authType == AUTH_EAP) { + if (info.authEapMethod = KyAuthEapMethodMschapv2) { + eapMethodCombox->setCurrentIndex(MSCHAPV2_EAP); + } else if (info.authEapMethod = KyAuthEapMethodMd5) { + eapMethodCombox->setCurrentIndex(MD5_EAP); + } else if (info.authEapMethod = KyAuthEapMethodMd5) { + eapMethodCombox->setCurrentIndex(MD5_EAP); + } else { + qDebug() << "not support yet. AUTH_EAP method" << info.authEapMethod; + } + } else { + if (info.authNoEapMethod == KyAuthMethodPap) { + eapMethodCombox->setCurrentIndex(PAP); + } else if (info.authNoEapMethod == KyAuthMethodMschap) { + eapMethodCombox->setCurrentIndex(MSCHAP); + } else if (info.authNoEapMethod == KyAuthMethodMschapv2) { + eapMethodCombox->setCurrentIndex(MSCHAPV2); + } else if (info.authNoEapMethod == KyAuthMethodChap) { + eapMethodCombox->setCurrentIndex(CHAP); + } else { + qDebug() << "not support yet. AUTH_NO_EAP method" << info.authNoEapMethod; + } + } + userNameEdit->setText(info.userName); + userPwdEdit->setText(info.userPWD); + if (info.m_passwdFlag) { + userPwdFlagBox->setChecked(true); + } else { + userPwdFlagBox->setChecked(false); + } +} + +void SecurityPage::setSecurityVisible(const bool &visible) +{ + if (secuTypeLabel) { + secuTypeLabel->setVisible(visible); + } else { + qWarning() << "Set visible of secuTypeLabel failed because of null pointer" << Q_FUNC_INFO << __LINE__; + } + if (secuTypeCombox) { + secuTypeCombox->setVisible(visible); + } else { + qWarning() << "Set visible of secuTypeCombox failed because of null pointer" << Q_FUNC_INFO << __LINE__; + } +} + +void SecurityPage::updateTlsChange(KyEapMethodTlsInfo &info) +{ + KyEapMethodTlsInfo tlsInfo = assembleTlsInfo(); + if (tlsInfo.clientPrivateKeyPWD != info.clientPrivateKeyPWD) { + tlsInfo.bChanged = true; + } + tlsInfo.devIfaceName = info.devIfaceName; + info = tlsInfo; +} + +void SecurityPage::updatePeapChange(KyEapMethodPeapInfo &info) +{ + KyEapMethodPeapInfo peapInfo = assemblePeapInfo(); + if (peapInfo.userPWD != info.userPWD) { + peapInfo.bChanged = true; + } + info = peapInfo; +} + +void SecurityPage::updateTtlsChange(KyEapMethodTtlsInfo &info) +{ + KyEapMethodTtlsInfo ttlsInfo = assembleTtlsInfo(); + if (ttlsInfo.userPWD != info.userPWD) { + ttlsInfo.bChanged = true; + } + info = ttlsInfo; +} + +void SecurityPage::getSecuType(KySecuType &secuType, KyEapMethodType &enterpriseType) +{ + secuType = (KySecuType)secuTypeCombox->currentData().toInt(); + enterpriseType = (KyEapMethodType)eapTypeCombox->currentData().toInt(); +} + +bool SecurityPage::checkIsChanged(const ConInfo info) +{ + if (info.secType != secuTypeCombox->currentData().toInt()) { + return true; + } else { + if (info.secType == NONE) { + return false; + } else if (info.secType == WPA_AND_WPA2_PERSONAL || info.secType == WPA3_PERSONAL) { + return !(info.strPassword == pwdEdit->text()); + } else { + if (info.enterpriseType != eapTypeCombox->currentData().toInt()) { + return true; + } else { + if (info.enterpriseType == TLS) { + return !(info.tlsInfo == assembleTlsInfo()); + } else if (info.enterpriseType == PEAP) { + return !(info.peapInfo == assemblePeapInfo()); + } else if (info.enterpriseType == TTLS) { + return !(info.ttlsInfo == assembleTtlsInfo()); + } + } + } + } +} + +void SecurityPage::showNone() +{ + pwdEdit->hide(); + eapTypeCombox->hide(); + + identityEdit->hide(); + domainEdit->hide(); + caCertPathCombox->hide(); + caNeedBox->hide(); + clientCertPathCombox->hide(); + clientPrivateKeyCombox->hide(); + clientPrivateKeyPwdEdit->hide(); + + eapMethodCombox->hide(); + userNameEdit->hide(); + userPwdEdit->hide(); + userPwdFlagBox->hide(); + + pwdLabel->hide(); + //企业wifi共有 + eapTypeLabel->hide(); + //TLS + identityLable->hide(); + domainLable->hide(); + caCertPathLabel->hide(); + caNeedFlagLabel->hide(); + clientCertPathLabel->hide(); + clientPrivateKeyLabel->hide(); + clientPrivateKeyPwdLabel->hide(); + + //PEAP TTLS共有 + eapMethodLabel->hide(); + userNameLabel->hide(); + userPwdLabel->hide(); + userPwdFlagLabel->hide(); +} + +void SecurityPage::showPsk() +{ + pwdEdit->show(); + eapTypeCombox->hide(); + + identityEdit->hide(); + domainEdit->hide(); + caCertPathCombox->hide(); + caNeedBox->hide(); + clientCertPathCombox->hide(); + clientPrivateKeyCombox->hide(); + clientPrivateKeyPwdEdit->hide(); + + eapMethodCombox->hide(); + userNameEdit->hide(); + userPwdEdit->hide(); + userPwdFlagBox->hide(); + + pwdLabel->show(); + //企业wifi共有 + eapTypeLabel->hide(); + //TLS + identityLable->hide(); + domainLable->hide(); + caCertPathLabel->hide(); + caNeedFlagLabel->hide(); + clientCertPathLabel->hide(); + clientPrivateKeyLabel->hide(); + clientPrivateKeyPwdLabel->hide(); + + //PEAP TTLS共有 + eapMethodLabel->hide(); + userNameLabel->hide(); + userPwdLabel->hide(); + userPwdFlagLabel->hide(); +} + +void SecurityPage::showTls() +{ + pwdEdit->hide(); + eapTypeCombox->show(); + + identityEdit->show(); + domainEdit->show(); + caCertPathCombox->show(); + caNeedBox->show(); + clientCertPathCombox->show(); + clientPrivateKeyCombox->show(); + clientPrivateKeyPwdEdit->show(); + + eapMethodCombox->hide(); + userNameEdit->hide(); + userPwdEdit->hide(); + userPwdFlagBox->hide(); + + pwdLabel->hide(); + //企业wifi共有 + eapTypeLabel->show(); + //TLS + identityLable->show(); + domainLable->show(); + caCertPathLabel->show(); + caNeedFlagLabel->show(); + clientCertPathLabel->show(); + clientPrivateKeyLabel->show(); + clientPrivateKeyPwdLabel->show(); + + //PEAP TTLS共有 + eapMethodLabel->hide(); + userNameLabel->hide(); + userPwdLabel->hide(); + userPwdFlagLabel->hide(); +} + +void SecurityPage::showPeapOrTtls() +{ + pwdEdit->hide(); + eapTypeCombox->show(); + + identityEdit->hide(); + domainEdit->hide(); + caCertPathCombox->hide(); + caNeedBox->hide(); + clientCertPathCombox->hide(); + clientPrivateKeyCombox->hide(); + clientPrivateKeyPwdEdit->hide(); + + eapMethodCombox->show(); + userNameEdit->show(); + userPwdEdit->show(); + userPwdFlagBox->show(); + + pwdLabel->hide(); + //企业wifi共有 + eapTypeLabel->show(); + //TLS + identityLable->hide(); + domainLable->hide(); + caCertPathLabel->hide(); + caNeedFlagLabel->hide(); + clientCertPathLabel->hide(); + clientPrivateKeyLabel->hide(); + clientPrivateKeyPwdLabel->hide(); + + //PEAP TTLS共有 + eapMethodLabel->show(); + userNameLabel->show(); + userPwdLabel->show(); + userPwdFlagLabel->show(); +} + +KyEapMethodTlsInfo SecurityPage::assembleTlsInfo() +{ + KyEapMethodTlsInfo info; + info.identity = identityEdit->text(); + info.domain = domainEdit->text(); + info.caCertPath = caCertPathCombox->currentText(); + info.bNeedCa = !caNeedBox->isChecked(); + info.clientCertPath = clientCertPathCombox->currentText(); + info.clientPrivateKey = clientPrivateKeyCombox->currentText(); + info.clientPrivateKeyPWD = clientPrivateKeyPwdEdit->text(); + info.m_privateKeyPWDFlag = NetworkManager::Setting::None; + + return info; +} + +KyEapMethodPeapInfo SecurityPage::assemblePeapInfo() +{ + KyEapMethodPeapInfo info; +// info.phase2AuthMethod = (KyNoEapMethodAuth)eapMethodCombox->currentData().toInt(); + switch (eapMethodCombox->currentIndex()) { + case 0: + info.phase2AuthMethod = KyAuthMethodMschapv2; + break; + case 1: + info.phase2AuthMethod = KyAuthMethodMd5; + break; + case 2: + info.phase2AuthMethod = KyAuthMethodGtc; + break; + default: + break; + } + info.userName = userNameEdit->text(); + info.userPWD = userPwdEdit->text(); + info.m_passwdFlag = (userPwdFlagBox->isChecked() ? NetworkManager::Setting::NotSaved : NetworkManager::Setting::None); + + return info; +} +KyEapMethodTtlsInfo SecurityPage::assembleTtlsInfo() +{ + KyEapMethodTtlsInfo info; + switch (eapMethodCombox->currentIndex()) { + case PAP: + info.authType = AUTH_NO_EAP; + info.authNoEapMethod = KyAuthMethodPap; + break; + case MSCHAP: + info.authType = AUTH_NO_EAP; + info.authNoEapMethod = KyAuthMethodChap; + break; + case MSCHAPV2_EAP: + info.authType = AUTH_EAP; + info.authEapMethod = KyAuthEapMethodMschapv2; + break; + case MSCHAPV2: + info.authType = AUTH_NO_EAP; + info.authNoEapMethod = KyAuthMethodMschapv2; + break; + case CHAP: + info.authType = AUTH_NO_EAP; + info.authNoEapMethod = KyAuthMethodChap; + break; + case MD5_EAP: + info.authType = AUTH_EAP; + info.authEapMethod = KyAuthEapMethodMd5; + break; + case GTC_EAP: + info.authType = AUTH_EAP; + info.authEapMethod = KyAuthEapMethodGtc; + break; + default: + break; + } + info.userName = userNameEdit->text(); + info.userPWD = userPwdEdit->text(); + info.m_passwdFlag = (userPwdFlagBox->isChecked() ? NetworkManager::Setting::NotSaved : NetworkManager::Setting::None); + return info; +} + +void SecurityPage::updateSecurityChange(KyWirelessConnectSetting &setting) +{ + qDebug() << "secuTypeCombox->currentData()" << secuTypeCombox->currentData().toInt() << pwdEdit->text(); + if (secuTypeCombox->currentData().toInt() == NONE) { + setting.m_psk = ""; + } else { + setting.m_psk = pwdEdit->text(); + } + + if (secuTypeCombox->currentData().toInt() == NONE) { + setting.m_type = WpaNone; + } else if (secuTypeCombox->currentData().toInt() == WPA_AND_WPA2_PERSONAL) { + setting.m_type = WpaPsk; + } else if (secuTypeCombox->currentData().toInt() == WPA3_PERSONAL) { + setting.m_type = SAE; + } +} + +bool SecurityPage::checkConnectBtnIsEnabled() +{ + int index = secuTypeCombox->currentData().toInt(); + if (index == NONE) { + + } else if (index == WPA_AND_WPA2_PERSONAL || index == WPA3_PERSONAL) { + if (pwdEdit->text().isEmpty() || pwdEdit->text().length() < 8 ) { + qDebug() << "password is empty or length < 8"; + return false; + } + } else if (index == WPA_AND_WPA2_ENTERPRISE) { + int type = eapTypeCombox->currentData().toInt(); + if (type == TLS) { + if (identityEdit->text().isEmpty()) { + qDebug() << "tls identity is empty"; + return false; + } + QFile cafile(caCertPathCombox->currentText()); + if(!caNeedBox->isChecked() && !cafile.exists()) { + qDebug() << "ca cert filepath " << caCertPathCombox->currentText() << " is invalid"; + return false; + } + + QFile cliCafile(clientCertPathCombox->currentText()); + if(!cliCafile.exists()) { + qDebug() << "client cert filepath " << clientCertPathCombox->currentText() << " is invalid"; + return false; + } + + QFile cliKeyfile(clientPrivateKeyCombox->currentText()); + if(!cliKeyfile.exists()) { + qDebug() << "client private key filepath " << clientPrivateKeyCombox->currentText() << " is invalid"; + return false; + } + + if(clientPrivateKeyPwdEdit->text().isEmpty()) { + qDebug() << "client Private Key password is empty"; + return false; + } + } else if (type == PEAP || type == TTLS) { + if(userNameEdit->text().isEmpty() || userPwdEdit->text().isEmpty()) { + qDebug() << "user name or user password is empty"; + return false; + } + } + } + return true; +} + +void SecurityPage::setEnableOfSaveBtn() +{ + Q_EMIT setSecuPageState(checkConnectBtnIsEnabled()); +} + +void SecurityPage::onSecuTypeComboxIndexChanged() +{ + int index = secuTypeCombox->currentData().toInt(); + if (index == WPA_AND_WPA2_PERSONAL || index == WPA3_PERSONAL) { + showPsk(); + } else if (index == WPA_AND_WPA2_ENTERPRISE) { + onEapTypeComboxIndexChanged(); + } else if (index == NONE) { + showNone(); + } +} + +void SecurityPage::onEapTypeComboxIndexChanged() +{ + qDebug() << "onEapTypeComboxIndexChanged"; + int index = eapTypeCombox->currentData().toInt(); + if (index == TLS) { + showTls(); + Q_EMIT this->eapTypeChanged(TLS); + } else if (index == PEAP) { + showPeapOrTtls(); + eapMethodCombox->clear(); + eapMethodCombox->addItem("MSCHAPv2", MSCHAPV2_PEAP); + eapMethodCombox->addItem("MD5", MD5_PEAP); + eapMethodCombox->addItem("GTC", GTC_PEAP); + Q_EMIT this->eapTypeChanged(PEAP); + } else if (index == TTLS) { + showPeapOrTtls(); + eapMethodCombox->clear(); + eapMethodCombox->addItem("pap", PAP); + eapMethodCombox->addItem("mschap", MSCHAP); + eapMethodCombox->addItem("mschapv2(eap)", MSCHAPV2_EAP); + eapMethodCombox->addItem("mschapv2", MSCHAPV2); + eapMethodCombox->addItem("chap", CHAP); + eapMethodCombox->addItem("md5(eap)", MD5_EAP); + eapMethodCombox->addItem("gtc(eap)", GTC_EAP); + Q_EMIT this->eapTypeChanged(TTLS); + } +} + +void SecurityPage::onCaNeedBoxClicked() +{ + if (caNeedBox->isChecked()) { + caCertPathCombox->setEnabled(false); + } else { + caCertPathCombox->setEnabled(true); + } +} + +void SecurityPage::onPwdBoxClicked() +{ + if (pwdEdit->echoMode() == QLineEdit::Password) { + pwdBox->setChecked(true); + pwdEdit->setEchoMode(QLineEdit::Normal); + } else { + pwdBox->setChecked(false); + pwdEdit->setEchoMode(QLineEdit::Password); + } +} + +void SecurityPage::onUserPwdBox() +{ + if (userPwdEdit->echoMode() == QLineEdit::Password) { + userPwdBox->setChecked(true); + userPwdEdit->setEchoMode(QLineEdit::Normal); + } else { + userPwdBox->setChecked(false); + userPwdEdit->setEchoMode(QLineEdit::Password); + } + +} + +void SecurityPage::onPrivateKeyBoxClicked() +{ + if (clientPrivateKeyPwdEdit->echoMode() == QLineEdit::Password) { + privateKeyBox->setChecked(true); + clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Normal); + } else { + privateKeyBox->setChecked(false); + clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password); + } +} + +void SecurityPage::onCaCertPathComboxIndexChanged(QString str) +{ + if (str.contains("Choose from file...") || str.contains("从文件选择...")) + { + QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///", + tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)")); + if (!fileName.isNull()) { + QStringList nameList = fileName.split("/"); + caCertPathCombox->blockSignals(true); + caCertPathCombox->setItemText(0, fileName); + caCertPathCombox->setCurrentIndex(0); + caCertPathCombox->blockSignals(false); + } else { + caCertPathCombox->blockSignals(true); + caCertPathCombox->setItemText(0, tr("None")); + caCertPathCombox->setCurrentIndex(0); + caCertPathCombox->blockSignals(false); + } + } else { + qWarning() << "Choose file is null or unvalible"; + } +} + +void SecurityPage::onClientCertPathComboxIndexChanged(QString str) +{ + if (str.contains("Choose from file...") || str.contains("从文件选择...")) + { + QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///", + tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)")); + if (!fileName.isNull()) { + clientCertPathCombox->blockSignals(true); + clientCertPathCombox->setItemText(0, fileName); + clientCertPathCombox->setCurrentIndex(0); + clientCertPathCombox->blockSignals(false); + } else { + clientCertPathCombox->blockSignals(true); + clientCertPathCombox->setItemText(0, tr("None")); + clientCertPathCombox->setCurrentIndex(0); + clientCertPathCombox->blockSignals(false); + } + } else { + qWarning() << "Choose file is null or unvalible"; + } +} + +void SecurityPage::onClientPrivateKeyComboxIndexChanged(QString str) +{ + if (str.contains("Choose from file...") || str.contains("从文件选择...")) + { + QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///", + tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)")); + if (!fileName.isNull()) { + QStringList nameList = fileName.split("/"); + clientPrivateKeyCombox->blockSignals(true); + clientPrivateKeyCombox->setItemText(0, fileName); + clientPrivateKeyCombox->setCurrentIndex(0); + clientPrivateKeyCombox->blockSignals(false); + } else { + clientPrivateKeyCombox->blockSignals(true); + clientPrivateKeyCombox->setItemText(0, tr("None")); + clientPrivateKeyCombox->setCurrentIndex(0); + clientPrivateKeyCombox->blockSignals(false); + } + } else { + qWarning() << "Choose file is null or unvalible"; + } +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/netdetails/securitypage.h b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/securitypage.h new file mode 100644 index 00000000..dd9011e8 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/netdetails/securitypage.h @@ -0,0 +1,113 @@ +#ifndef SECURITYWIDGET_H +#define SECURITYWIDGET_H + +#include +#include +#include +#include +#include +#include + +#include "coninfo.h" + +class SecurityPage : public QFrame +{ + Q_OBJECT +public: + SecurityPage(QWidget *parent = nullptr); + + void setSecurity(KySecuType index); + void setPsk(const QString &psk); + void setTlsInfo(KyEapMethodTlsInfo &info); + void setPeapInfo(KyEapMethodPeapInfo &info); + void setTtlsInfo(KyEapMethodTtlsInfo &info); + void setSecurityVisible(const bool &visible); + + bool checkIsChanged(const ConInfo info); + void updateSecurityChange(KyWirelessConnectSetting &setting); + void updateTlsChange(KyEapMethodTlsInfo &info); + void updatePeapChange(KyEapMethodPeapInfo &info); + void updateTtlsChange(KyEapMethodTtlsInfo &info); + + void getSecuType(KySecuType &secuType, KyEapMethodType &enterpriseType); + +private: + QFormLayout *mSecuLayout; + +private: + + QLabel *secuTypeLabel; + QLabel *pwdLabel; + //企业wifi共有 + QLabel *eapTypeLabel; + //TLS + QLabel *identityLable; + QLabel *domainLable; + QLabel *caCertPathLabel; + QLabel *caNeedFlagLabel; + QLabel *clientCertPathLabel; + QLabel *clientPrivateKeyLabel; + QLabel *clientPrivateKeyPwdLabel; + + //PEAP TTLS共有 + QLabel *eapMethodLabel; + QLabel *userNameLabel; + QLabel *userPwdLabel; + QLabel *userPwdFlagLabel; + + QComboBox *secuTypeCombox; + LineEdit *pwdEdit; + QComboBox *eapTypeCombox; + //TLS + LineEdit *identityEdit; + LineEdit *domainEdit; + QComboBox *caCertPathCombox; + QCheckBox *caNeedBox; + QComboBox *clientCertPathCombox; + QComboBox *clientPrivateKeyCombox; + LineEdit *clientPrivateKeyPwdEdit; + + //PEAP && TTLS + QComboBox *eapMethodCombox; + LineEdit *userNameEdit; + LineEdit *userPwdEdit; + QCheckBox *userPwdFlagBox; + + QCheckBox *pwdBox; + QCheckBox *userPwdBox; + QCheckBox *privateKeyBox; + + void showNone(); + void showPsk(); + void showTls(); + void showPeapOrTtls(); + void initUI(); + void initConnect(); + + KyEapMethodTlsInfo assembleTlsInfo(); + KyEapMethodPeapInfo assemblePeapInfo(); + KyEapMethodTtlsInfo assembleTtlsInfo(); + + bool checkConnectBtnIsEnabled(); + + +private Q_SLOTS: + void onSecuTypeComboxIndexChanged(); + void onEapTypeComboxIndexChanged(); + void setEnableOfSaveBtn(); + + void onCaNeedBoxClicked(); + void onPwdBoxClicked(); + void onUserPwdBox(); + void onPrivateKeyBoxClicked(); + + void onCaCertPathComboxIndexChanged(QString str); + void onClientCertPathComboxIndexChanged(QString str); + void onClientPrivateKeyComboxIndexChanged(QString str); + +Q_SIGNALS: + void setSecuPageState(bool); + void eapTypeChanged(const KyEapMethodType &type); +}; + +#endif // SECURITYWIDGET_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/lanpage.cpp b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/lanpage.cpp new file mode 100644 index 00000000..94549a0b --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/lanpage.cpp @@ -0,0 +1,1225 @@ +#include "lanpage.h" +#include +#include + +#define MAIN_LAYOUT_MARGINS 0,0,0,0 +#define MAIN_LAYOUT_SPACING 0 +#define TITLE_FRAME_HEIGHT 52 +#define TITLE_LAYOUT_MARGINS 24,0,24,0 +#define LAN_LIST_SPACING 0 +#define TEXT_MARGINS 16,0,0,0 +#define SETTINGS_LAYOUT_MARGINS 24,16,24,16 +#define TRANSPARENT_COLOR QColor(0,0,0,0) +#define ITEM_HEIGHT 48 + +#define LOG_FLAG "[LanPage]" + +const QString EMPTY_CONNECT_UUID = "emptyconnect"; + +const QString WIRED_SWITCH = "wiredswitch"; + +LanPage::LanPage(QWidget *parent) : TabPage(parent) +{ + m_activeResourse = new KyActiveConnectResourse(this); + m_connectResourse = new KyConnectResourse(this); + m_deviceResource = new KyNetworkDeviceResourse(this); + m_wiredConnectOperation = new KyWiredConnectOperation(this); + + initUI(); + initLanDevice(); + initNetSwitch(); + initLanDeviceState(); + + initDeviceCombox(); + initLanArea(); + + connect(m_activeResourse, &KyActiveConnectResourse::wiredStateChange, this, &LanPage::onConnectionStateChange); + connect(m_activeResourse, &KyActiveConnectResourse::activeConnectRemove, this, [=] (QString activeConnectUuid) { + sendLanStateChangeSignal(activeConnectUuid, CONNECT_STATE_DEACTIVATED); + } ); + + connect(m_connectResourse, &KyConnectResourse::wiredConnectionAdd, this, &LanPage::onAddConnection); + connect(m_connectResourse, &KyConnectResourse::wiredConnectionRemove, this, &LanPage::onRemoveConnection); + connect(m_connectResourse, &KyConnectResourse::wiredConnectionUpdate, this, &LanPage::onUpdateConnection); + + connect(m_deviceResource, &KyNetworkDeviceResourse::wiredDeviceAdd, this, &LanPage::onDeviceAdd); + connect(m_deviceResource, &KyNetworkDeviceResourse::wiredDeviceRemove, this, &LanPage::onDeviceRemove); + connect(m_deviceResource, &KyNetworkDeviceResourse::wiredDeviceNameUpdate, this, &LanPage::onDeviceNameUpdate); + + connect(m_deviceResource, &KyNetworkDeviceResourse::carrierChanage, this, &LanPage::onDeviceCarriered); + connect(m_deviceResource, &KyNetworkDeviceResourse::deviceActiveChanage, this, &LanPage::onDeviceActiveChanage); + + connect(m_wiredConnectOperation, &KyWiredConnectOperation::activateConnectionError, this, &LanPage::activateFailed); + connect(m_wiredConnectOperation, &KyWiredConnectOperation::deactivateConnectionError, this, &LanPage::deactivateFailed); + +} + +LanPage::~LanPage() +{ + +} + +void LanPage::initLanDevice() +{ + m_devList.clear(); + m_deviceResource->getNetworkDeviceList(DEVICE_TYPE_ETHERNET, m_devList); + + m_currentDeviceName = getDefaultDeviceName(DEVICE_TYPE_ETHERNET); + bool getDefault = !m_currentDeviceName.isEmpty(); + if (getDefault) { + if (m_deviceResource->wiredDeviceIsCarriered(m_currentDeviceName)) { + return; + } + } + + QList activedList; + for (int index = 0; index < m_devList.size(); ++index) { + m_activeResourse->getActiveConnectionList(m_devList.at(index), CONNECT_TYPE_WIRED, activedList); + if (!activedList.isEmpty()) { + m_currentDeviceName = m_devList.at(index); + if (!getDefault) { + setDefaultDevice(DEVICE_TYPE_ETHERNET, m_currentDeviceName); + } + return; + } + } + + for (int index = 0; index < m_devList.size(); ++index) { + if (m_deviceResource->wiredDeviceIsCarriered(m_devList.at(index))) { + m_currentDeviceName = m_devList.at(index); + if (!getDefault) { + setDefaultDevice(DEVICE_TYPE_ETHERNET, m_currentDeviceName); + } + return; + } + } + return; +} + +void LanPage::initLanDeviceState() +{ + QMap deviceStateMap; + getDeviceEnableState(DEVICE_TYPE_ETHERNET, deviceStateMap); + + QStringList disableDeviceList; + disableDeviceList.clear(); + m_enableDeviceList.clear(); + for (int index = 0; index < m_devList.count(); ++index) { + QString deviceName = m_devList.at(index); + if (deviceStateMap.contains(deviceName)) { + if (deviceStateMap[deviceName]) { + m_enableDeviceList<keys().contains(WIRED_SWITCH)) { + m_wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool(); + connect(m_switchGsettings, &QGSettings::changed, this, &LanPage::onSwithGsettingsChanged); + } + } else { + qDebug()<<"[LanPage] org.ukui.kylin-nm.switch is not installed!"; + } + + if (m_devList.count() == 0) { + qDebug() << "[wiredSwitch]:init not enable when no device"; + m_wiredSwitch = false; + m_netSwitch->setSwitchStatus(m_wiredSwitch); + m_netSwitch->setEnabled(false); + } + + qDebug() << "[wiredSwitch]:init state:" << m_wiredSwitch; + + m_netSwitch->setSwitchStatus(m_wiredSwitch); + + connect(m_netSwitch, &SwitchButton::clicked, this, &LanPage::onLanSwitchClicked); + + return; +} + +void LanPage::onSwithGsettingsChanged(const QString &key) +{ + if (key == WIRED_SWITCH) { + m_netSwitch->blockSignals(true); + + m_wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool(); + qDebug()<<"[LanPage] SwitchButton statue changed to:" << m_wiredSwitch; + + KyWiredConnectOperation wiredOperation; + if (m_wiredSwitch) { + for (int index = 0; index < m_enableDeviceList.size(); ++index) { + qDebug()<<"[LanPage] open wired device "<< m_enableDeviceList.at(index); + wiredOperation.openWiredNetworkWithDevice(m_enableDeviceList.at(index)); + } + } else { + for (int index = 0; index < m_enableDeviceList.size(); ++index) { + qDebug()<<"[LanPage] close wired device "<< m_enableDeviceList.at(index); + wiredOperation.closeWiredNetworkWithDevice(m_enableDeviceList.at(index)); + } + } + + initDeviceCombox(); + initLanArea(); + + m_netSwitch->setSwitchStatus(m_wiredSwitch); + + m_netSwitch->blockSignals(false); + } +} + +void LanPage::onLanSwitchClicked() +{ + qDebug()<<"[LanPage] On lan switch button clicked! Status:" <getSwitchStatus() + <<"devices count:"<showDesktopNotify(tr("No ethernet device avaliable")); + } else { + if (m_netSwitch->getSwitchStatus()) { + //qDebug() << "[wiredSwitch]set true after clicked"; + m_switchGsettings->set(WIRED_SWITCH, true); + } else { + //qDebug() << "[wiredSwitch]set false after clicked"; + m_switchGsettings->set(WIRED_SWITCH, false); + } + } +} + +void LanPage::getEnabledDevice(QStringList &enableDeviceList) +{ + int index = 0; + QMap deviceMap; + + if (m_devList.isEmpty()) { + qDebug()<<"[LanPage] there is not wired device."; + return; + } + + getDeviceEnableState(DEVICE_TYPE_ETHERNET, deviceMap); + for (index = 0; index < m_devList.size(); ++index) { + if (deviceMap.contains(m_devList.at(index))) { + if (deviceMap[m_devList.at(index)]) { + enableDeviceList << m_devList.at(index); + } + } else { + saveDeviceEnableState(m_devList.at(index), true); + enableDeviceList << m_devList.at(index); + } + } + + return; +} + +void LanPage::getDisabledDevices(QStringList &disableDeviceList) +{ + int index = 0; + QMap deviceMap; + + if (m_devList.isEmpty()) { + qDebug()<<"[LanPage] there is not wired device."; + return; + } + + getDeviceEnableState(DEVICE_TYPE_ETHERNET, deviceMap); + for (index = 0; index < m_devList.size(); ++index) { + if (deviceMap.contains(m_devList.at(index))) { + if (!deviceMap[m_devList.at(index)]) { + disableDeviceList << m_devList.at(index); + } + } + } + + return; +} + +void LanPage::initDeviceCombox() +{ + //TODO 获取设备列表,单设备时隐藏下拉框,多设备时添加到下拉框;m_devList记录插入的所有设备,deviceMap记录设备状态 + disconnect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), + this, &LanPage::onDeviceComboxIndexChanged); + + m_deviceComboBox->clear(); + + if (m_wiredSwitch) { + int enableDeviceCount = m_enableDeviceList.count(); + if (enableDeviceCount > 1) { + for (int index = 0; index < enableDeviceCount; ++index) { + m_deviceComboBox->addItem(m_enableDeviceList.at(index)); + } + + m_deviceFrame->show(); + m_tipsLabel->hide(); + m_deviceComboBox->show(); + + if (m_currentDeviceName != m_deviceComboBox->currentText()) { + if (m_enableDeviceList.contains(m_currentDeviceName)) { + m_deviceComboBox->setCurrentText(m_currentDeviceName); + } else { + m_currentDeviceName = m_deviceComboBox->currentText(); + } + } + + } else if (enableDeviceCount == 1) { + m_deviceFrame->hide(); + + if (m_currentDeviceName != m_enableDeviceList.at(0)) { + m_currentDeviceName = m_enableDeviceList.at(0); + } + } else { + m_deviceFrame->show(); + m_deviceComboBox->hide(); + m_tipsLabel->show(); + m_currentDeviceName = ""; + } + } else { + m_deviceFrame->hide(); + m_currentDeviceName = ""; + + } + + setDefaultDevice(DEVICE_TYPE_ETHERNET, m_currentDeviceName); + connect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), + this, &LanPage::onDeviceComboxIndexChanged); + return; +} + +void LanPage::addEmptyConnectItem(QMap &connectMap, + QListWidget *lanListWidget) +{ + QListWidgetItem *p_listWidgetItem = addNewItem(nullptr, lanListWidget); + connectMap.insert(EMPTY_CONNECT_UUID, p_listWidgetItem); + + return; +} + + +void LanPage::deleteConnectionMapItem(QMap &connectMap, + QListWidget *lanListWidget, QString uuid) +{ + QListWidgetItem *p_listWidgetItem = connectMap.value(uuid); + if (p_listWidgetItem) { + connectMap.remove(uuid); + LanListItem *p_lanItem = (LanListItem *)lanListWidget->itemWidget(p_listWidgetItem); + lanListWidget->removeItemWidget(p_listWidgetItem); + + delete p_lanItem; + p_lanItem = nullptr; + + delete p_listWidgetItem; + p_listWidgetItem = nullptr; + } + + return; +} + +void LanPage::clearConnectionMap(QMap &connectMap, + QListWidget *lanListWidget) +{ + QMap::iterator iter; + + iter = connectMap.begin(); + while (iter != connectMap.end()) { + qDebug()<<"[LanPage] clear connection map item"<< iter.key(); + + QListWidgetItem *p_widgetItem = iter.value(); + LanListItem *p_lanItem = (LanListItem *)lanListWidget->itemWidget(p_widgetItem); + lanListWidget->removeItemWidget(p_widgetItem); + + delete p_lanItem; + p_lanItem = nullptr; + + delete p_widgetItem; + p_widgetItem = nullptr; + + iter = connectMap.erase(iter); + } + + return; +} + +void LanPage::constructActiveConnectionArea() +{ + QList activedList; + + activedList.clear(); + clearConnectionMap(m_activeConnectionMap, m_activatedLanListWidget); + + m_activeResourse->getActiveConnectionList(m_currentDeviceName, CONNECT_TYPE_WIRED, activedList); //激活列表的显示 + qDebug() << "[LanPage] construct active connection area get Active list size:" << activedList.size(); + if (!activedList.isEmpty()) { + for (int index = 0; index < activedList.size(); index++) { + KyConnectItem *p_activeConnectionItem = activedList.at(index); + qDebug() << "[LanPage] construct active connection area. add active item" + << p_activeConnectionItem->m_connectName; + QListWidgetItem *p_listWidgetItem = addNewItem(p_activeConnectionItem, m_activatedLanListWidget); + m_activeConnectionMap.insert(p_activeConnectionItem->m_connectUuid, p_listWidgetItem); + + delete p_activeConnectionItem; + p_activeConnectionItem = nullptr; + } + } else { + qDebug()<<"[LanPage] there is not active"; + addEmptyConnectItem(m_activeConnectionMap, m_activatedLanListWidget); + } + + return; +} + +void LanPage::constructConnectionArea() +{ + QList deactivedList; + + deactivedList.clear(); + clearConnectionMap(m_inactiveConnectionMap, m_inactivatedLanListWidget); + + m_connectResourse->getConnectionList(m_currentDeviceName, CONNECT_TYPE_WIRED, deactivedList); //未激活列表的显示 + qDebug() << "[LanPage]construct connection area get connection list size:" << deactivedList.size(); + if (!deactivedList.isEmpty()) { + for (int index = 0; index < deactivedList.size(); index++) { + KyConnectItem *p_deactiveConnectionItem = deactivedList.at(index); + qDebug()<<"[LanPage] construct connection area add deactive item"<m_connectName; + QListWidgetItem *p_listWidgetItem = addNewItem(p_deactiveConnectionItem, m_inactivatedLanListWidget); + if (m_inactiveConnectionMap.contains(p_deactiveConnectionItem->m_connectUuid)) { + qDebug()<m_connectUuid; + } + m_inactiveConnectionMap.insert(p_deactiveConnectionItem->m_connectUuid, p_listWidgetItem); + + delete p_deactiveConnectionItem; + p_deactiveConnectionItem = nullptr; + + } + } + if (m_inactivatedLanListWidget->count() < MAX_ITEMS) { + m_inactivatedLanListWidget->setFixedWidth(MIN_WIDTH); + } else { + m_inactivatedLanListWidget->setFixedWidth(MAX_WIDTH); + } + return; +} + +void LanPage::initLanArea() +{ + if (!m_wiredSwitch || m_currentDeviceName.isEmpty()) { + m_activatedNetDivider->hide(); + m_activatedNetFrame->hide(); + + m_inactivatedNetFrame->hide(); + } else { + m_activatedNetDivider->show(); + m_activatedNetFrame->show(); + constructActiveConnectionArea(); + + m_inactivatedNetFrame->show(); + constructConnectionArea(); + } + + return; +} + +bool LanPage::removeConnectionItem(QMap &connectMap, + QListWidget *lanListWidget, QString path) +{ + QMap::iterator iter; + for (iter = connectMap.begin(); iter != connectMap.end(); ++iter) { + QListWidgetItem *p_listWidgetItem = iter.value(); + LanListItem *p_lanItem = (LanListItem*)lanListWidget->itemWidget(p_listWidgetItem); + if (p_lanItem->getConnectionPath() == path) { + qDebug()<<"[LanPage] Remove a connection from list"; + + lanListWidget->removeItemWidget(p_listWidgetItem); + + delete p_lanItem; + p_lanItem = nullptr; + + delete p_listWidgetItem; + p_listWidgetItem = nullptr; + + iter = connectMap.erase(iter); + if (m_inactivatedLanListWidget->count() < MAX_ITEMS) { + m_inactivatedLanListWidget->setFixedWidth(MIN_WIDTH); + } + return true; + } + } + + return false; +} + +void LanPage::onRemoveConnection(QString path) //删除时后端会自动断开激活,将其从未激活列表中删除 +{ + //for dbus + qDebug() << "[LanPage] emit lanRemove because onRemoveConnection " << path; + + if (removeConnectionItem(m_inactiveConnectionMap, m_inactivatedLanListWidget, path)) { + return; + } else { + removeConnectionItem(m_activeConnectionMap, m_activatedLanListWidget, path); + if (m_activeConnectionMap.count() <= 0) { + addEmptyConnectItem(m_activeConnectionMap, m_activatedLanListWidget); + } + + return; + } +} + +void LanPage::onAddConnection(QString connectUuid, QString connectName, QString connectPath) //新增一个有线连接,将其加入到激活列表 +{ + if (!m_connectResourse->isWiredConnection(connectUuid)) { + return; + } + + KyConnectItem *p_newItem = nullptr; + p_newItem = m_connectResourse->getConnectionItemByUuid(connectUuid); + if (nullptr == p_newItem) { + return; + } + + if (p_newItem->m_ifaceName == m_currentDeviceName || p_newItem->m_ifaceName == "") { + qDebug()<<"[LanPage] Add a new connection, name:"<m_connectName; + QListWidgetItem *p_listWidgetItem = insertNewItem(p_newItem, m_inactivatedLanListWidget); + if (m_inactiveConnectionMap.contains(p_newItem->m_connectUuid)) { + qDebug()<m_connectUuid; + } + m_inactiveConnectionMap.insert(p_newItem->m_connectUuid, p_listWidgetItem); + } + + delete p_newItem; + p_newItem = nullptr; + if (m_inactivatedLanListWidget->count() >= MAX_ITEMS) { + m_inactivatedLanListWidget->setFixedWidth(MAX_WIDTH); + } + return; +} + +void LanPage::addDeviceForCombox(QString deviceName) +{ + disconnect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), + this, &LanPage::onDeviceComboxIndexChanged); + + if (m_wiredSwitch) { + if (1 == m_enableDeviceList.count()) { + //1、从无到有添加第一块有线网卡 + //2、有多快网卡,但是没有使能 + m_deviceFrame->hide(); + m_currentDeviceName = deviceName; + setDefaultDevice(DEVICE_TYPE_ETHERNET, m_currentDeviceName); + } else if (2 == m_enableDeviceList.count()) { + //3、现在有且只有一块网卡,并已使能 + //4、有多快网卡,且使能了其中一块 + m_deviceComboBox->addItem(m_currentDeviceName); + m_deviceComboBox->addItem(deviceName); + + m_deviceFrame->show(); + m_tipsLabel->hide(); + m_deviceComboBox->show(); + } else if (m_enableDeviceList.count() > 2) { + //5、有多快网卡且使能了多块网卡 + m_deviceComboBox->addItem(deviceName); + } + } + + connect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), + this, &LanPage::onDeviceComboxIndexChanged); + return; +} + +void LanPage::onDeviceAdd(QString deviceName) +{ + if (m_devList.contains(deviceName)) { + return; + } + + if (m_devList.count() == 0) {// 有线网卡从无到有,打开开关 + m_netSwitch->setEnabled(true); + m_wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool(); + m_netSwitch->setSwitchStatus(m_wiredSwitch); + } + + qDebug() << "[LanPage] Begin add device:" << deviceName; + + m_devList << deviceName; + saveDeviceEnableState(deviceName, true); + m_enableDeviceList<::of(&QComboBox::currentIndexChanged), + this, &LanPage::onDeviceComboxIndexChanged); + + if (m_wiredSwitch) { + if (0 == m_enableDeviceList.count()) { + //1、没有使能任何网卡 + goto l_out; + } else if (1 == m_enableDeviceList.count()) { + //2、使能了一个网卡,且当前网卡是要删除的网卡 + if (m_currentDeviceName == deviceName) { + m_deviceFrame->show(); + m_deviceComboBox->hide(); + m_tipsLabel->show(); + m_currentDeviceName = ""; + setDefaultDevice(DEVICE_TYPE_ETHERNET, m_currentDeviceName); + } + } else if (2 == m_enableDeviceList.count()) { + //3、使能了两个网卡,且包括要删除的网卡,有可能是要删除的网卡 + if (m_deviceComboBox->findText(deviceName) != -1) { + for (int index = m_deviceComboBox->count() - 1; index >= 0; index--) { + if (m_currentDeviceName == deviceName + && m_deviceComboBox->itemText(index) != deviceName) { + m_currentDeviceName = m_deviceComboBox->itemText(index); + setDefaultDevice(DEVICE_TYPE_ETHERNET, m_currentDeviceName); + } + m_deviceComboBox->removeItem(index); + } + + m_tipsLabel->hide(); + m_deviceFrame->hide(); + m_deviceComboBox->hide(); + } + } else { + //4、使能了多个网卡,且包括要删除的网卡,有可能是正要删除的网卡 + int index = m_deviceComboBox->findText(deviceName); + if (index != -1) { + m_deviceComboBox->removeItem(index); + if (m_currentDeviceName == deviceName) { + m_currentDeviceName = m_deviceComboBox->currentText(); + setDefaultDevice(DEVICE_TYPE_ETHERNET, m_currentDeviceName); + } + } + } + } + +l_out: + connect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), + this, &LanPage::onDeviceComboxIndexChanged); + + return; +} + +void LanPage::onDeviceRemove(QString deviceName) +{ + if (!m_devList.contains(deviceName)) { + return; + } + + qDebug() << "[LanPage] deviceRemove:" << deviceName; + + m_devList.removeOne(deviceName); + if (m_devList.count() == 0) { + m_wiredSwitch = false; + m_netSwitch->setSwitchStatus(m_wiredSwitch); + m_netSwitch->setEnabled(false); + qDebug() << "[wiredSwitch]set not enable after device remove"; + } + + QString nowDevice = m_currentDeviceName; + deleteDeviceFromCombox(deviceName); + if (nowDevice == deviceName) { + setDefaultDevice(DEVICE_TYPE_ETHERNET, m_currentDeviceName); + initLanArea(); + } + + if (m_enableDeviceList.contains(deviceName)) { + m_enableDeviceList.removeOne(deviceName); + } + deleteDeviceEnableState(deviceName); + + return; +} + +void LanPage::updateDeviceCombox(QString oldDeviceName, QString newDeviceName) +{ + if (m_currentDeviceName == oldDeviceName) { + m_currentDeviceName = newDeviceName; + setDefaultDevice(DEVICE_TYPE_ETHERNET, m_currentDeviceName); + } + + int index = m_deviceComboBox->findText(oldDeviceName); + if (index != -1) { + m_deviceComboBox->setItemText(index, newDeviceName); + } + + return; +} + +void LanPage::onDeviceNameUpdate(QString oldName, QString newName) +{ + if (m_devList.contains(oldName)) { + m_devList.removeOne(oldName); + m_devList.append(newName); + + if (m_enableDeviceList.contains(oldName)) { + m_enableDeviceList.removeOne(oldName); + m_enableDeviceList.append(newName); + } + qDebug() << "[LanPage] emit deviceNameUpdate " << oldName << newName; + + updateDeviceCombox(oldName, newName); + if (m_currentDeviceName == newName) { + initLanArea(); + } + } +} + +void LanPage::onDeviceCarriered(QString deviceName, bool pluged) +{ + if (!pluged) { + return; + } + if (m_enableDeviceList.contains(deviceName)) { + m_wiredConnectOperation->openWiredNetworkWithDevice(deviceName); + updateCurrentDevice(deviceName); + } + return; +} + +void LanPage::onDeviceActiveChanage(QString deviceName, bool deviceActive) +{ + if (!m_devList.contains(deviceName)) { + return; + } + + if (deviceActive) { + if (!m_wiredSwitch || !m_enableDeviceList.contains(deviceName)) { + qDebug()<< LOG_FLAG << "close disabled device"; + m_wiredConnectOperation->closeWiredNetworkWithDevice(deviceName); + } + } + + return; +} + + +void LanPage::onDeviceComboxIndexChanged(int currentIndex) +{ + //TODO 设备变更时更新设备和列表 + m_currentDeviceName = m_deviceComboBox->currentText(); + qDebug() << "[LanPage]Current Device Changed to:" << m_currentDeviceName; + initLanArea(); +} + +void LanPage::onShowControlCenter() +{ + QProcess process; + process.startDetached("ukui-control-center -m netconnect"); +} + +void LanPage::initUI() +{ + m_titleLabel->setText(tr("LAN")); + + m_activatedNetLabel->setText(tr("Activated LAN")); + m_activatedLanListWidget = new QListWidget(m_activatedNetFrame); + m_activatedLanListWidget->setFrameShape(QFrame::Shape::NoFrame); + m_activatedLanListWidget->setSpacing(LAN_LIST_SPACING); + m_activatedLanListWidget->setFixedHeight(ITEM_HEIGHT); //active区域固定高度,只显示一个条目 + m_activatedLanListWidget->setFixedWidth(MIN_WIDTH); + m_activatedLanListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_activatedNetLayout->addWidget(m_activatedLanListWidget); + + m_inactivatedNetLabel->setText(tr("Inactivated LAN")); + m_inactivatedLanListWidget = new QListWidget(m_inactivatedNetListArea); + m_inactivatedLanListWidget->setFrameShape(QFrame::Shape::NoFrame); + m_inactivatedLanListWidget->setSpacing(LAN_LIST_SPACING); + m_inactivatedLanListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_inactivatedLanListWidget->setVerticalScrollMode(QAbstractItemView::ScrollMode::ScrollPerPixel); + m_inactivatedLanListWidget->verticalScrollBar()->setProperty("drawScrollBarGroove",false); //去除滚动条的外侧黑框 + m_inactivatedLanListWidget->verticalScrollBar()->setSingleStep(SCROLL_STEP); + m_inactivatedLanListWidget->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu); + m_inactivatedAreaLayout->addWidget(m_inactivatedLanListWidget); + + QPalette pal = m_activatedLanListWidget->palette(); + pal.setBrush(QPalette::Base, QColor(0,0,0,0)); //背景透明 + m_activatedLanListWidget->setPalette(pal); + m_inactivatedLanListWidget->setPalette(pal); + + m_settingsLabel->installEventFilter(this); +} + +QListWidgetItem *LanPage::insertNewItem(KyConnectItem *itemData, QListWidget *listWidget) +{ + int index = 0; + + for(index = 0; index < m_inactivatedLanListWidget->count(); index++) { + QListWidgetItem *p_listWidgetItem = m_inactivatedLanListWidget->item(index); + LanListItem *p_lanItem = (LanListItem *)m_inactivatedLanListWidget->itemWidget(p_listWidgetItem); + QString name1 = p_lanItem->getConnectionName(); + QString name2 = itemData->m_connectName; + if (QString::compare(name1, name2, Qt::CaseInsensitive) > 0) { + break; + } + } + + QListWidgetItem *p_sortListWidgetItem = new QListWidgetItem(); + p_sortListWidgetItem->setFlags(p_sortListWidgetItem->flags() & (~Qt::ItemIsSelectable)); //设置不可被选中 + p_sortListWidgetItem->setSizeHint(QSize(listWidget->width(),ITEM_HEIGHT)); + + listWidget->insertItem(index, p_sortListWidgetItem); + + LanListItem *p_sortLanItem = nullptr; + p_sortLanItem = new LanListItem(itemData, m_currentDeviceName); + listWidget->setItemWidget(p_sortListWidgetItem, p_sortLanItem); + + return p_sortListWidgetItem; +} + +QListWidgetItem *LanPage::addNewItem(KyConnectItem *itemData, QListWidget *listWidget) +{ + QListWidgetItem *p_listWidgetItem = new QListWidgetItem(); + p_listWidgetItem->setFlags(p_listWidgetItem->flags() & (~Qt::ItemIsSelectable)); + p_listWidgetItem->setSizeHint(QSize(listWidget->width(), ITEM_HEIGHT)); + listWidget->addItem(p_listWidgetItem); + LanListItem *p_lanItem = nullptr; + if (itemData != nullptr) { + p_lanItem = new LanListItem(itemData, m_currentDeviceName); + qDebug() << "[LanPage] addNewItem, connection: " + << itemData->m_connectName << "deviceName: " << m_currentDeviceName; + } else { + p_lanItem = new LanListItem(); + qDebug() << "[LanPage] Add nullItem!"; + } + + listWidget->setItemWidget(p_listWidgetItem, p_lanItem); + return p_listWidgetItem; +} + +void LanPage::updateActivatedConnectionArea(KyConnectItem *p_newItem) +{ + if (m_activeConnectionMap.contains(p_newItem->m_connectUuid)) { + return; + } + + deleteConnectionMapItem(m_inactiveConnectionMap, m_inactivatedLanListWidget, p_newItem->m_connectUuid); + if (p_newItem->m_ifaceName == m_currentDeviceName) { + qDebug()<<"[LanPage]update active connection item"<m_connectName; + deleteConnectionMapItem(m_activeConnectionMap, m_activatedLanListWidget, EMPTY_CONNECT_UUID); + QListWidgetItem *p_listWidgetItem = addNewItem(p_newItem, m_activatedLanListWidget); + m_activeConnectionMap.insert(p_newItem->m_connectUuid, p_listWidgetItem); + this->showDesktopNotify(tr("LAN Connected Successfully")); + } + if (m_inactivatedLanListWidget->count() < MAX_ITEMS) { + m_inactivatedLanListWidget->setFixedWidth(MIN_WIDTH); + } + + return; +} + +void LanPage::updateConnectionArea(KyConnectItem *p_newItem) +{ + if (m_inactiveConnectionMap.contains(p_newItem->m_connectUuid)) { + return; + } + + deleteConnectionMapItem(m_activeConnectionMap, m_activatedLanListWidget, p_newItem->m_connectUuid); + if (m_activeConnectionMap.count() <= 0) { + addEmptyConnectItem(m_activeConnectionMap, m_activatedLanListWidget); + } + + if (p_newItem->m_ifaceName == m_currentDeviceName || p_newItem->m_ifaceName == "") { + qDebug()<<"[LanPage] update connection item"<m_connectName; + QListWidgetItem *p_listWidgetItem = insertNewItem(p_newItem, m_inactivatedLanListWidget); + m_inactiveConnectionMap.insert(p_newItem->m_connectUuid, p_listWidgetItem); + this->showDesktopNotify(tr("LAN Disconnected Successfully")); + } + if (m_inactivatedLanListWidget->count() < MAX_ITEMS) { + m_inactivatedLanListWidget->setFixedWidth(MIN_WIDTH); + } else { + m_inactivatedLanListWidget->setFixedWidth(MAX_WIDTH); + } + + return; +} + +void LanPage::updateConnectionState(QMap &connectMap, + QListWidget *lanListWidget, QString uuid, KyConnectState state) +{ + qDebug() << LOG_FLAG << "update connection state"; + + QListWidgetItem *p_listWidgetItem = connectMap.value(uuid); + if (p_listWidgetItem) { + LanListItem *p_lanItem = (LanListItem *)lanListWidget->itemWidget(p_listWidgetItem); + p_lanItem->updateConnectionState(state); + } + + return; +} + +QString LanPage::getConnectionDevice(QString uuid) +{ + QString deviceName = ""; + + deviceName = m_activeResourse->getDeviceOfActivateConnect(uuid); + if (deviceName.isEmpty()) { + m_connectResourse->getInterfaceByUuid(deviceName, uuid); + } + + return deviceName; +} + +void LanPage::updateCurrentDevice(QString deviceName) +{ + if (m_currentDeviceName != deviceName) { + int index = m_deviceComboBox->findText(deviceName); + if (index < 0) { + index = 0; + } + m_deviceComboBox->setCurrentIndex(index); + return; + } + return; +} + +void LanPage::onConnectionStateChange(QString deviceName, QString uuid, KyConnectState state) +{ + //lanpage函数内持续监听连接状态的变化并记录供其他函数调用获取状态 + sendLanStateChangeSignal(uuid, state); + + qDebug()<<"[LanPage] connection uuid"<< uuid + << "state change slot:"<< state; + + KyConnectItem *p_newItem = nullptr; + + if (state == CONNECT_STATE_ACTIVATED) { + p_newItem = m_activeResourse->getActiveConnectionByUuid(uuid); + if (nullptr == p_newItem) { + qWarning()<<"[LanPage] get active connection failed, connection uuid" << uuid; + return; + } + + updateActivatedConnectionArea(p_newItem); + updateConnectionState(m_activeConnectionMap, m_activatedLanListWidget, uuid, state); + } else if (state == CONNECT_STATE_DEACTIVATED) { + p_newItem = m_connectResourse->getConnectionItemByUuid(uuid); + if (nullptr == p_newItem) { + qWarning()<<"[LanPage] get active connection failed, connection uuid" << uuid; + return; + } + + updateConnectionArea(p_newItem); + updateConnectionState(m_inactiveConnectionMap, m_inactivatedLanListWidget, uuid, state); + } else if (state == CONNECT_STATE_ACTIVATING) { + if (deviceName == m_currentDeviceName) { + updateConnectionState(m_inactiveConnectionMap, m_inactivatedLanListWidget, uuid, state); + } + } else if (state == CONNECT_STATE_DEACTIVATING) { + if (deviceName == m_currentDeviceName) { + updateConnectionState(m_activeConnectionMap, m_activatedLanListWidget, uuid, state); + } + } + + if (p_newItem) { + delete p_newItem; + p_newItem = nullptr; + } + + return; +} + + +//void LanPage::getWiredList(QMap > &map) +//{ +// QStringList devlist; +// m_deviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, devlist); +// if (devlist.isEmpty()) { +// return; +// } + +// Q_FOREACH (auto deviceName, devlist) { +// QList activedList; +// QList deactivedList; +// QVector vector; +// m_activeResourse->getActiveConnectionList(deviceName,NetworkManager::ConnectionSettings::Wired,activedList); +// if (!activedList.isEmpty()) { +// vector.append(QStringList() << activedList.at(0)->m_connectName << activedList.at(0)->m_connectUuid << activedList.at(0)->m_connectPath); +// } else { +// vector.append(QStringList()<<("--")); +// } + +// m_connectResourse->getConnectionList(deviceName, NetworkManager::ConnectionSettings::Wired, deactivedList); //未激活列表的显示 +// if (!deactivedList.isEmpty()) { +// for (int i = 0; i < deactivedList.size(); i++) { +// vector.append(QStringList()<m_connectName<m_connectUuid << deactivedList.at(i)->m_connectPath); +// } +// } +// map.insert(deviceName, vector); +// } +// return; +//} + +//void LanPage::sendLanUpdateSignal(KyConnectItem *p_connectItem) +//{ +// QStringList info; +// info << p_connectItem->m_connectName << p_connectItem->m_connectUuid << p_connectItem->m_connectPath; +// Q_EMIT lanUpdate(p_connectItem->m_ifaceName, info); + +// return; +//} + +//void LanPage::sendLanAddSignal(KyConnectItem *p_connectItem) +//{ +// QStringList info; +// info << p_connectItem->m_connectName << p_connectItem->m_connectUuid << p_connectItem->m_connectPath; +// qDebug() << "[LanPage] emit lanAdd because addConnection "; +// Q_EMIT lanAdd(p_connectItem->m_ifaceName, info); + +// return; +//} + +void LanPage::sendLanStateChangeSignal(QString uuid, KyConnectState state) +{ + if (state == CONNECT_STATE_ACTIVATING || state == CONNECT_STATE_DEACTIVATING) { + if (m_activeResourse->connectionIsVirtual(uuid)) { + return; + } + } + + Q_EMIT lanConnectChanged(state); + + return; +} + +void LanPage::updateConnectionProperty(KyConnectItem *p_connectItem) +{ + QString newUuid = p_connectItem->m_connectUuid; + + if (m_inactiveConnectionMap.contains(newUuid)) { + QListWidgetItem *p_listWidgetItem = m_inactiveConnectionMap.value(newUuid); + LanListItem *p_lanItem = (LanListItem*)m_inactivatedLanListWidget->itemWidget(p_listWidgetItem); + if (p_connectItem->m_ifaceName != "" + && m_currentDeviceName != p_connectItem->m_ifaceName) { + m_inactivatedLanListWidget->removeItemWidget(p_listWidgetItem); + + delete p_listWidgetItem; + p_listWidgetItem = nullptr; + + delete p_lanItem; + p_lanItem = nullptr; + + m_inactiveConnectionMap.remove(newUuid); + } else { + if (p_connectItem->m_connectName != p_lanItem->getConnectionName()){ + //只要名字改变就要删除,重新插入,主要是为了排序 + deleteConnectionMapItem(m_inactiveConnectionMap, m_inactivatedLanListWidget, newUuid); + QListWidgetItem *p_sortListWidgetItem = insertNewItem(p_connectItem, m_inactivatedLanListWidget); + if (m_inactiveConnectionMap.contains(newUuid)) { + qDebug()<m_connectPath != p_lanItem->getConnectionPath()) { + p_lanItem->updateConnectionPath(p_connectItem->m_connectPath); + } + } + + } else if (!m_activeConnectionMap.contains(newUuid)){ + if (p_connectItem->m_ifaceName == m_currentDeviceName + || p_connectItem->m_ifaceName.isEmpty()) { + QListWidgetItem *p_listWidgetItem = insertNewItem(p_connectItem, m_inactivatedLanListWidget); + if (m_inactiveConnectionMap.contains(newUuid)) { + qDebug()<m_connectUuid; + + if (m_activeConnectionMap.contains(newUuid)) { + QListWidgetItem *p_listWidgetItem = m_activeConnectionMap.value(newUuid); + LanListItem *p_lanItem = (LanListItem *)m_activatedLanListWidget->itemWidget(p_listWidgetItem); + if (m_currentDeviceName != p_connectItem->m_ifaceName) { + m_activeConnectionMap.remove(newUuid); + int takeRow = m_activatedLanListWidget->row(p_listWidgetItem); + m_activatedLanListWidget->takeItem(takeRow); + + delete p_lanItem; + p_lanItem = nullptr; + + p_lanItem = new LanListItem(); + m_activatedLanListWidget->addItem(p_listWidgetItem); + m_activatedLanListWidget->setItemWidget(p_listWidgetItem, p_lanItem); + m_activeConnectionMap.insert(EMPTY_CONNECT_UUID, p_listWidgetItem); + } else { + if (p_lanItem->getConnectionName() != p_connectItem->m_connectName) { + p_lanItem->updateConnectionName(p_connectItem->m_connectName); + } + + if (p_lanItem->getConnectionName() != p_connectItem->m_connectPath) { + p_lanItem->updateConnectionPath(p_connectItem->m_connectPath); + } + + } + } + + return; +} + +void LanPage::onUpdateConnection(QString connectUuid, QString connectName, QString connectPath) +{ + if (!m_connectResourse->isWiredConnection(connectUuid)) { + return; + } + + qDebug() << "[LanPage]:Connection property Changed." << Q_FUNC_INFO << __LINE__; + + KyConnectItem *p_newItem = nullptr; + if (m_connectResourse->isActivatedConnection(connectUuid)) { + p_newItem = m_activeResourse->getActiveConnectionByUuid(connectUuid); + if (nullptr == p_newItem) { + qWarning()<<"[LanPage] get item failed, when update activate connection." + <<"connection uuid" << connectUuid; + return; + } + + updateActiveConnectionProperty(p_newItem); + } else { + p_newItem = m_connectResourse->getConnectionItemByUuid(connectUuid); + if (nullptr == p_newItem) { + qWarning()<<"[LanPage] get item failed, when update connection." + <<"connection uuid"<type() == QEvent::MouseButtonRelease) { + onShowControlCenter(); + } + } + + return QWidget::eventFilter(watched, event); +} + +//void LanPage::activateWired(const QString& devName, const QString& connUuid) +//{ +// qDebug() << "[LanPage] activateWired" << devName << connUuid; +// if (!m_deviceResource->wiredDeviceIsCarriered(devName)) { +// qDebug() << LOG_FLAG << devName << "is not carried, so can not activate connection"; +// this->showDesktopNotify(tr("Wired Device not carried")); +// } else { +// m_wiredConnectOperation->activateConnection(connUuid, devName); +// } +//} + +//void LanPage::deactivateWired(const QString& devName, const QString& connUuid) +//{ +// qDebug() << "[LanPage] deactivateWired" << devName << connUuid; +// QString name(""); +// m_wiredConnectOperation->deactivateWiredConnection(name, connUuid); +//} + +void LanPage::showDetailPage(QString devName, QString uuid) +{ + KyConnectItem *p_item = nullptr; + bool isActive = true; + + if (m_connectResourse->isActivatedConnection(uuid)) { + p_item = m_activeResourse->getActiveConnectionByUuid(uuid); + isActive = true; + } else { + p_item = m_connectResourse->getConnectionItemByUuid(uuid); + isActive = false; + } + + if (nullptr == p_item) { + qWarning()<<"[LanPage] GetConnectionItemByUuid is empty when showDetailPage." + <<"device name"<m_connectName, uuid, isActive, false, false, this); + netDetail->show(); + + delete p_item; + p_item = nullptr; +} + +bool LanPage::lanIsConnected() +{ + if (m_activeResourse->wiredConnectIsActived()) { + return true; + } else { + return false; + } +} + diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/lanpage.h b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/lanpage.h new file mode 100644 index 00000000..87268383 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/lanpage.h @@ -0,0 +1,135 @@ +#ifndef LANPAGE_H +#define LANPAGE_H + +#include "divider.h" +#include "switchbutton.h" +#include +#include +#include +#include +#include +#include +#include + +#include "list-items/listitem.h" +#include "list-items/lanlistitem.h" +#include "tab-pages/tabpage.h" + +class LanListItem; + +class LanPage : public TabPage +{ + Q_OBJECT +public: + explicit LanPage(QWidget *parent = nullptr); + ~LanPage(); + + //for dbus +// void getWiredList(QMap > &map); +// void activateWired(const QString& devName, const QString& connUuid); +// void deactivateWired(const QString& devName, const QString& connUuid); + + void showDetailPage(QString devName, QString uuid); + void setWiredDeviceEnable(const QString& devName, bool enable); + + bool lanIsConnected(); + +protected: + bool eventFilter(QObject *watched, QEvent *event); + +private: + void initLanDevice(); + void initUI(); + void initLanArea(); + void initNetSwitch(); + void initLanDeviceState(); + + void initDeviceCombox(); + void updateDeviceCombox(QString oldDeviceName, QString newDeviceName); + void deleteDeviceFromCombox(QString deviceName); + void addDeviceForCombox(QString deviceName); + + QListWidgetItem *insertNewItem(KyConnectItem *itemData, QListWidget *listWidget); + QListWidgetItem *addNewItem(KyConnectItem *itemData, QListWidget *listWidget); + bool removeConnectionItem(QMap &connectMap, + QListWidget *lanListWidget, QString path); + + void getEnabledDevice(QStringList &enableDeviceList); + void getDisabledDevices(QStringList &disableDeviceList); + + void constructConnectionArea(); + void constructActiveConnectionArea(); + + void updateConnectionArea(KyConnectItem *p_newItem); + void updateActivatedConnectionArea(KyConnectItem *p_newItem); + void updateConnectionState(QMap &connectMap, + QListWidget *lanListWidget, QString uuid, KyConnectState state); + QString getConnectionDevice(QString uuid); + + void updateActiveConnectionProperty(KyConnectItem *p_connectItem); + void updateConnectionProperty(KyConnectItem *p_connectItem); + +// void sendLanUpdateSignal(KyConnectItem *p_connectItem); +// void sendLanAddSignal(KyConnectItem *p_connectItem); + void sendLanStateChangeSignal(QString uuid, KyConnectState state); + + void addEmptyConnectItem(QMap &connectMap, + QListWidget *lanListWidget); + void clearConnectionMap(QMap &connectMap, + QListWidget *lanListWidget); + void deleteConnectionMapItem(QMap &connectMap, + QListWidget *lanListWidget, QString uuid); + + void updateCurrentDevice(QString deviceName); + +Q_SIGNALS: +// void lanAdd(QString devName, QStringList info); +// void lanRemove(QString dbusPath); +// void lanUpdate(QString devName, QStringList info); + +// void lanActiveConnectionStateChanged(QString interface, QString uuid, int status); + void lanConnectChanged(int state); + +private Q_SLOTS: + void onConnectionStateChange(QString deviceName, QString uuid, KyConnectState state); + + void onAddConnection(QString connectUuid, QString connectName, QString connectPath); + void onRemoveConnection(QString path); + void onUpdateConnection(QString connectUuid, QString connectName, QString connectPath); + + void onSwithGsettingsChanged(const QString &key); + void onLanSwitchClicked(); + + void onDeviceAdd(QString deviceName); + void onDeviceRemove(QString deviceName); + void onDeviceNameUpdate(QString oldName, QString newName); + + void onDeviceCarriered(QString deviceName, bool pluged); + void onDeviceActiveChanage(QString deviceName, bool deviceActive); + + void onDeviceComboxIndexChanged(int currentIndex); + + void onShowControlCenter(); + +private: + QListWidget * m_activatedLanListWidget = nullptr; + QListWidget * m_inactivatedLanListWidget = nullptr; + + KyNetworkDeviceResourse *m_deviceResource = nullptr; + KyWiredConnectOperation *m_wiredConnectOperation = nullptr; + KyActiveConnectResourse *m_activeResourse = nullptr; //激活的连接 + KyConnectResourse *m_connectResourse = nullptr; //未激活的连接 + + QMap m_inactiveConnectionMap; + QMap m_activeConnectionMap; + + QString m_currentDeviceName; + QStringList m_devList; + QStringList m_enableDeviceList; + + QGSettings *m_switchGsettings = nullptr; + + bool m_wiredSwitch = true; +}; + +#endif // LANPAGE_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/tab-pages.pri b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/tab-pages.pri new file mode 100644 index 00000000..6d049be2 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/tab-pages.pri @@ -0,0 +1,12 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/lanpage.h \ + $$PWD/wlanpage.h \ + $$PWD/tabpage.h + +SOURCES += \ + $$PWD/lanpage.cpp \ + $$PWD/wlanpage.cpp \ + $$PWD/tabpage.cpp + diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/tabpage.cpp b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/tabpage.cpp new file mode 100644 index 00000000..7045c1e7 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/tabpage.cpp @@ -0,0 +1,294 @@ +#include "tabpage.h" +#include +#include +#include +#include + +TabPage::TabPage(QWidget *parent) : QWidget(parent) +{ + initUI(); + connect(qApp, &QApplication::paletteChanged, this, &TabPage::onPaletteChanged); +} + +TabPage::~TabPage() +{ + delete m_titleDivider; + delete m_activatedNetDivider; + delete m_inactivatedNetDivider; +} + +void TabPage::initUI() +{ + m_mainLayout = new QVBoxLayout(this); + m_mainLayout->setContentsMargins(MAIN_LAYOUT_MARGINS); + m_mainLayout->setSpacing(MAIN_LAYOUT_SPACING); + this->setLayout(m_mainLayout); + + m_titleFrame = new QFrame(this); + m_titleFrame->setFixedHeight(TITLE_FRAME_HEIGHT); + m_titleLayout = new QHBoxLayout(m_titleFrame); + m_titleLayout->setContentsMargins(TITLE_LAYOUT_MARGINS); + m_titleLabel = new QLabel(m_titleFrame); + m_netSwitch = new SwitchButton(m_titleFrame); + m_titleLayout->addWidget(m_titleLabel); + m_titleLayout->addStretch(); + m_titleLayout->addWidget(m_netSwitch); + m_titleDivider = new Divider(this); + + //临时增加的下拉框选择网卡区域 + m_deviceFrame = new QFrame(this); + m_deviceFrame->setFixedHeight(TITLE_FRAME_HEIGHT); + m_deviceLayout = new QHBoxLayout(m_deviceFrame); + m_deviceLayout->setContentsMargins(DEVICE_LAYOUT_MARGINS); + m_deviceFrame->setLayout(m_deviceLayout); + m_deviceLabel = new QLabel(m_deviceFrame); + m_deviceLabel->setText(tr("Current Device")); + m_deviceComboBox = new QComboBox(m_deviceFrame); + m_deviceComboBox->setFixedWidth(DEVICE_COMBOBOX_WIDTH); + + m_tipsLabel = new QLabel(m_deviceFrame); + m_tipsLabel->setText(tr("Devices Closed!")); + m_deviceLayout->addWidget(m_deviceLabel); + m_deviceLayout->addStretch(); + m_deviceLayout->addWidget(m_deviceComboBox); + m_deviceLayout->addWidget(m_tipsLabel); + connect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &TabPage::onDeviceComboxIndexChanged); + + m_activatedNetFrame = new QFrame(this); + m_activatedNetFrame->setMaximumHeight(ACTIVE_AREA_MAX_HEIGHT); + m_activatedNetLayout = new QVBoxLayout(m_activatedNetFrame); + m_activatedNetLayout->setContentsMargins(ACTIVE_NET_LAYOUT_MARGINS); +// m_activatedNetLayout->setSpacing(NET_LAYOUT_SPACING); + m_activatedNetLabel = new QLabel(m_activatedNetFrame); + m_activatedNetLabel->setContentsMargins(TEXT_MARGINS); + m_activatedNetLayout->addWidget(m_activatedNetLabel); + m_activatedNetDivider = new Divider(this); + + m_inactivatedNetFrame = new QFrame(this); + m_inactivatedNetFrame->setMinimumHeight(INACTIVE_AREA_MIN_HEIGHT); + m_inactivatedNetLayout = new QVBoxLayout(m_inactivatedNetFrame); + m_inactivatedNetLayout->setContentsMargins(NET_LAYOUT_MARGINS); +// m_inactivatedNetLayout->setSpacing(NET_LAYOUT_SPACING); + m_inactivatedNetFrame->setLayout(m_inactivatedNetLayout); + + m_inactivatedNetLabel = new QLabel(m_inactivatedNetFrame); + m_inactivatedNetLabel->setContentsMargins(TEXT_MARGINS); + + m_inactivatedNetListArea = new QScrollArea(m_inactivatedNetFrame); + m_inactivatedNetListArea->setFrameShape(QFrame::Shape::NoFrame); + m_inactivatedNetListArea->setWidgetResizable(true); + m_inactivatedNetListArea->setBackgroundRole(QPalette::Base); + m_inactivatedNetListArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + m_inactivatedNetListArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_inactivatedAreaLayout = new QVBoxLayout(m_inactivatedNetListArea); + m_inactivatedAreaLayout->setSpacing(MAIN_LAYOUT_SPACING); + m_inactivatedAreaLayout->setContentsMargins(MAIN_LAYOUT_MARGINS); + m_inactivatedNetListArea->setLayout(m_inactivatedAreaLayout); + + m_inactivatedNetLayout->addWidget(m_inactivatedNetLabel); + m_inactivatedNetLayout->addWidget(m_inactivatedNetListArea); + + m_inactivatedNetDivider = new Divider(this); + m_settingsFrame = new QFrame(this); + m_settingsFrame->setFixedHeight(TITLE_FRAME_HEIGHT); + + m_settingsLayout = new QHBoxLayout(m_settingsFrame); + m_settingsLayout->setContentsMargins(SETTINGS_LAYOUT_MARGINS); + m_settingsLabel = new KyLable(m_settingsFrame); + m_settingsLabel->setCursor(Qt::PointingHandCursor); + m_settingsLabel->setText(tr("Settings")); + m_settingsLabel->setScaledContents(true); + + m_settingsLayout->addWidget(m_settingsLabel); + m_settingsLayout->addStretch(); + m_settingsFrame->setLayout(m_settingsLayout); + + m_mainLayout->addWidget(m_titleFrame); + //临时增加的设备选择区域 + m_mainLayout->addWidget(m_deviceFrame); + m_mainLayout->addWidget(m_titleDivider); + m_mainLayout->addWidget(m_activatedNetFrame); + m_mainLayout->addWidget(m_activatedNetDivider); + m_mainLayout->addWidget(m_inactivatedNetFrame); + m_mainLayout->addStretch(); + m_mainLayout->addWidget(m_inactivatedNetDivider); + m_mainLayout->addWidget(m_settingsFrame); + + QPalette pal = m_inactivatedNetListArea->palette(); + pal.setBrush(QPalette::Base, QColor(0,0,0,0)); //背景透明 + m_inactivatedNetListArea->setPalette(pal); + + onPaletteChanged(); +} + +void TabPage::onPaletteChanged() +{ + QPalette labPal = m_activatedNetLabel->palette(); + QColor color = qApp->palette().color(QPalette::PlaceholderText); + labPal.setColor(QPalette::WindowText, color); + m_activatedNetLabel->setPalette(labPal); + m_inactivatedNetLabel->setPalette(labPal); + + if (m_deviceComboBox->view()) { + QPalette view_pal = m_deviceComboBox->view()->palette(); + QColor view_color = qApp->palette().color(QPalette::Active, QPalette::Button); + view_pal.setColor(QPalette::Base, view_color); + m_deviceComboBox->setPalette(view_pal); + m_deviceComboBox->view()->setPalette(view_pal); + } +} + +void TabPage::showDesktopNotify(const QString &message) +{ + QDBusInterface iface("org.freedesktop.Notifications", + "/org/freedesktop/Notifications", + "org.freedesktop.Notifications", + QDBusConnection::sessionBus()); + QList args; + args<<(tr("Kylin NM")) + <<((unsigned int) 0) + <beginGroup("DEFAULTCARD"); + defaultDevice = m_settings->value(key).toString(); + m_settings->endGroup(); + + delete m_settings; + m_settings = nullptr; + + return defaultDevice; +} + +void setDefaultDevice(KyDeviceType deviceType, QString deviceName) +{ + QString key; + switch (deviceType) { + case DEVICE_TYPE_ETHERNET: + key = "wired"; + break; + case DEVICE_TYPE_WIFI: + key = "wireless"; + break; + default: + return; + } + + QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat); + m_settings->beginGroup("DEFAULTCARD"); + m_settings->setValue(key, deviceName); + m_settings->endGroup(); + m_settings->sync(); + + delete m_settings; + m_settings = nullptr; + + return; +} + +bool checkDeviceExist(KyDeviceType deviceType, QString deviceName) +{ + KyNetworkDeviceResourse *kdr = new KyNetworkDeviceResourse(); + QStringList devList; + devList.clear(); + + kdr->getNetworkDeviceList(deviceType, devList); + delete kdr; + return devList.contains(deviceName); +} + +void saveDeviceEnableState(QString deviceName, bool enable) +{ + QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat); + m_settings->beginGroup("CARDEABLE"); + m_settings->setValue(deviceName, enable); + m_settings->endGroup(); + m_settings->sync(); + delete m_settings; + m_settings = nullptr; + return; +} + +void deleteDeviceEnableState(QString deviceName) +{ + QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat); + m_settings->beginGroup("CARDEABLE"); + m_settings->remove(deviceName); + m_settings->endGroup(); + m_settings->sync(); + delete m_settings; + m_settings = nullptr; + return; +} + +void getDeviceEnableState(KyDeviceType type, QMap &map) +{ + map.clear(); + if (!QFile::exists(CONFIG_FILE_PATH)) { + qDebug() << "CONFIG_FILE_PATH not exist"; + return; + } + if (type != DEVICE_TYPE_ETHERNET && type != DEVICE_TYPE_WIFI) { + qDebug() << "getDeviceEnableState but wrong type"; + return; + } + + KyNetworkDeviceResourse * kdr = new KyNetworkDeviceResourse(); + QStringList wiredDevList,wirelessDevList; + wiredDevList.clear(); + wirelessDevList.clear(); + + QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat); + m_settings->beginGroup("CARDEABLE"); + + if (type == DEVICE_TYPE_ETHERNET) { + kdr->getNetworkDeviceList(type, wiredDevList); + if (!wiredDevList.isEmpty()) { + for (int i = 0; i < wiredDevList.size(); ++i) { + if (!m_settings->contains(wiredDevList.at(i))) { + saveDeviceEnableState(wiredDevList.at(i),true); + } + bool enable = m_settings->value(wiredDevList.at(i), true).toBool(); + map.insert(wiredDevList.at(i), enable); + } + } + } else if (type == DEVICE_TYPE_WIFI) { + kdr->getNetworkDeviceList(type, wirelessDevList); + if (!wirelessDevList.isEmpty()) { + for (int i = 0; i < wirelessDevList.size(); ++i) { + bool enable = m_settings->value(wirelessDevList.at(i), true).toBool(); + map.insert(wirelessDevList.at(i), enable); + } + } + } + + m_settings->endGroup(); + delete m_settings; + m_settings = nullptr; + delete kdr; + kdr = nullptr; + return; +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/tabpage.h b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/tabpage.h new file mode 100644 index 00000000..f8954111 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/tabpage.h @@ -0,0 +1,109 @@ +#ifndef TABPAGE_H +#define TABPAGE_H + +#include "divider.h" +#include "switchbutton.h" +#include "kylable.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "kylinnetworkdeviceresource.h" +#include + +#define MAIN_LAYOUT_MARGINS 0,0,0,0 +#define MAIN_LAYOUT_SPACING 0 +#define TITLE_FRAME_HEIGHT 50 //TabWidget的tab和widget有间隙,和设计稿看起来一致就不能设为设计稿里的高度 +#define TITLE_LAYOUT_MARGINS 24,0,24,0 +#define DEVICE_LAYOUT_MARGINS 24,0,24,8 +#define DEVICE_COMBOBOX_WIDTH 180 +#define ACTIVE_NET_LAYOUT_MARGINS 8,8,8,8 +#define NET_LAYOUT_MARGINS 8,8,0,3 +#define NET_LAYOUT_SPACING 8 +#define NET_LIST_SPACING 0 +#define TEXT_MARGINS 16,0,0,0 +//#define SCROLL_AREA_HEIGHT 200 +#define SETTINGS_LAYOUT_MARGINS 24,0,24,0 +#define TRANSPARENT_COLOR QColor(0,0,0,0) +#define INACTIVE_AREA_MIN_HEIGHT 170 +#define ACTIVE_AREA_MAX_HEIGHT 92 + +#define MAX_ITEMS 4 +#define MAX_WIDTH 400 +#define MIN_WIDTH 383 + +#define SCROLL_STEP 4 + +const QString CONFIG_FILE_PATH = QDir::homePath() + "/.config/ukui/kylin-nm.conf"; +bool checkDeviceExist(KyDeviceType deviceType, QString deviceName); +QString getDefaultDeviceName(KyDeviceType deviceType); +void setDefaultDevice(KyDeviceType deviceType, QString deviceName); +void saveDeviceEnableState(QString deviceName, bool enable); +void deleteDeviceEnableState(QString deviceName); +void getDeviceEnableState(KyDeviceType type, QMap &map); + +class TabPage : public QWidget +{ + Q_OBJECT +public: + explicit TabPage(QWidget *parent = nullptr); + ~TabPage(); + +// void updateDefaultDevice(QString &deviceName); +// QString getDefaultDevice(); + static void showDesktopNotify(const QString &message); + +Q_SIGNALS: + void deviceStatusChanged(); + void deviceNameChanged(QString oldName, QString newName, int type); + void activateFailed(QString errorMessage); + void deactivateFailed(QString errorMessage); + +protected: + void initUI(); +// virtual void initDevice() = 0;//初始化默认设备 + virtual void initDeviceCombox() = 0;//初始化设备选择下拉框 + QVBoxLayout * m_mainLayout = nullptr; + QFrame * m_titleFrame = nullptr; + QHBoxLayout * m_titleLayout = nullptr; + QLabel * m_titleLabel = nullptr; + SwitchButton * m_netSwitch = nullptr; + Divider * m_titleDivider = nullptr; + + QFrame * m_activatedNetFrame = nullptr; + QVBoxLayout * m_activatedNetLayout = nullptr; + QLabel * m_activatedNetLabel = nullptr; + Divider * m_activatedNetDivider = nullptr; + + QFrame * m_inactivatedNetFrame = nullptr; + QVBoxLayout * m_inactivatedNetLayout = nullptr; + QLabel * m_inactivatedNetLabel = nullptr; + QScrollArea * m_inactivatedNetListArea = nullptr; + QVBoxLayout * m_inactivatedAreaLayout = nullptr; + + Divider * m_inactivatedNetDivider = nullptr; + + QFrame * m_settingsFrame = nullptr; + QHBoxLayout * m_settingsLayout = nullptr; + KyLable * m_settingsLabel = nullptr; + + //临时增加的下拉框选择网卡区域 + QFrame * m_deviceFrame = nullptr; + QHBoxLayout * m_deviceLayout = nullptr; + QLabel * m_deviceLabel = nullptr; + QComboBox * m_deviceComboBox = nullptr; + QLabel * m_tipsLabel = nullptr; + +public Q_SLOTS: + virtual void onDeviceComboxIndexChanged(int currentIndex) = 0; + void onPaletteChanged(); + +}; + +#endif // TABPAGE_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/wlanpage.cpp b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/wlanpage.cpp new file mode 100644 index 00000000..fe121cf8 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/wlanpage.cpp @@ -0,0 +1,1430 @@ +#include "wlanpage.h" +#include "kywirelessnetitem.h" +#include +#include +#include +#include +#include + +#define AP_SCAN_INTERVAL (20*1000) +#define ICON_REFRESH_INTERVAL (5*1000) +#define EMPTY_SSID "emptyssid" +#define LOG_FLAG "[WlanPage]" +#define LAN_PAGE_INDEX 0 + +const QString NotApConnection = "0"; +const QString IsApConnection = "1"; + +WlanPage::WlanPage(QWidget *parent) : TabPage(parent) +{ + m_wirelessNetResource = new KyWirelessNetResource(this); + m_activatedConnectResource = new KyActiveConnectResourse(this); + m_netDeviceResource=new KyNetworkDeviceResourse(this); + m_connectResource = new KyConnectResourse(this); + m_wirelessConnectOpreation = new KyWirelessConnectOperation(this); + + initDevice(); + initWlanUI(); + initWlanSwitchState(); + initDeviceCombox(); + initWlanArea(); + + initTimer(); + + connect(m_wirelessNetResource, &KyWirelessNetResource::wifiNetworkAdd, this, &WlanPage::onWlanAdded); + connect(m_wirelessNetResource, &KyWirelessNetResource::wifiNetworkRemove, this, &WlanPage::onWlanRemoved); + +// connect(m_wirelessNetResource, &KyWirelessNetResource::signalStrengthChange, this, &WlanPage::signalStrengthChange); + connect(m_wirelessNetResource, &KyWirelessNetResource::secuTypeChange, this, &WlanPage::onSecurityTypeChange); + + connect(m_wirelessNetResource, &KyWirelessNetResource::wirelessConnectionAdd, this, &WlanPage::onConnectionAdd); + connect(m_wirelessNetResource, &KyWirelessNetResource::wirelessConnectionRemove, this, &WlanPage::onConnectionRemove); + + connect(m_wirelessNetResource, &KyWirelessNetResource::wirelessDeviceAdd, this, &WlanPage::onDeviceAdd); + connect(m_wirelessNetResource, &KyWirelessNetResource::wirelessDeviceRemove, this, &WlanPage::onDeviceRemove); + connect(m_wirelessNetResource, &KyWirelessNetResource::wirelessDeviceNameUpdate, this, &WlanPage::onDeviceNameUpdate); + + connect(m_activatedConnectResource, &KyActiveConnectResourse::wirelessStateChange, + this, &WlanPage::onConnectionStateChanged); + + connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::activateConnectionError, this, &WlanPage::activateFailed); + connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::addAndActivateConnectionError, this, &WlanPage::activateFailed); + connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::deactivateConnectionError, this, &WlanPage::deactivateFailed); + + connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::wifiEnabledChanged, this, &WlanPage::onWifiEnabledChanged); + + connect(m_connectResource, &KyConnectResourse::connectivityChanged, this, &WlanPage::connectivityChanged); +} + +bool WlanPage::eventFilter(QObject *w, QEvent *e) +{ + if (e->type() == QEvent::MouseButtonRelease) { + if (w == m_settingsLabel) { + //ZJP_TODO 打开控制面板 + qDebug() << LOG_FLAG <<"recive event show control center"; + showControlCenter(); + } + } + + return QWidget::eventFilter(w,e); +} + +void WlanPage::initWlanUI() +{ + m_titleLabel->setText(tr("WLAN")); + + m_activatedNetLabel->setText(tr("Activated WLAN")); + m_activatedNetListWidget = new QListWidget(m_activatedNetFrame); + m_activatedNetListWidget->setFrameShape(QFrame::Shape::NoFrame); + m_activatedNetListWidget->setContentsMargins(MAIN_LAYOUT_MARGINS); + m_activatedNetListWidget->setSpacing(NET_LIST_SPACING); + m_activatedNetListWidget->setFixedHeight(NORMAL_HEIGHT); + m_activatedNetListWidget->setFixedWidth(MIN_WIDTH); + m_activatedNetListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_activatedNetLayout->addWidget(m_activatedNetListWidget); + + m_inactivatedNetLabel->setText(tr("Other WLAN")); + m_inactivatedNetListWidget = new QListWidget(m_inactivatedNetListArea); + m_inactivatedNetListWidget->setContentsMargins(MAIN_LAYOUT_MARGINS); + m_inactivatedNetListWidget->setSpacing(NET_LIST_SPACING); + m_inactivatedNetListWidget->setFrameShape(QFrame::Shape::NoFrame); + m_inactivatedNetListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_inactivatedNetListWidget->setVerticalScrollMode(QAbstractItemView::ScrollMode::ScrollPerPixel); + m_inactivatedNetListWidget->verticalScrollBar()->setProperty("drawScrollBarGroove",false); //去除滚动条的外侧黑框 + m_inactivatedNetListWidget->verticalScrollBar()->setSingleStep(SCROLL_STEP); + m_inactivatedNetListWidget->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu); + addWlanMoreItem(); + m_inactivatedAreaLayout->addWidget(m_inactivatedNetListWidget); + + QPalette pal = m_activatedNetListWidget->palette(); + pal.setBrush(QPalette::Base, QColor(0,0,0,0)); //背景透明 + m_activatedNetListWidget->setPalette(pal); + m_inactivatedNetListWidget->setPalette(pal); + + m_settingsLabel->installEventFilter(this); +} + + +void WlanPage::onWlanSwithGsettingsChanged(const QString &key) +{ + if (key == WIRELESS_SWITCH) { + m_wlanSwitchEnable = m_switchGsettings->get(WIRELESS_SWITCH).toBool(); + qDebug() << LOG_FLAG << "wlan switch state" << m_wlanSwitchEnable; + m_netSwitch->setSwitchStatus(m_wlanSwitchEnable); + initDeviceCombox(); + initWlanArea(); + } + + return; +} + +/** + * @brief WlanPage::onWlanSwitchClicked 点击无线网开关 + */ +void WlanPage::onWlanSwitchClicked() +{ + if (m_devList.isEmpty()) { + showDesktopNotify(tr("No wireless network card detected")); + //检测不到无线网卡不再触发click信号 + m_netSwitch->setSwitchStatus(false); + m_netSwitch->setEnabled(false); + } else { + bool switchEnable = m_netSwitch->getSwitchStatus(); + if (m_wlanSwitchEnable != switchEnable) { + qDebug()<< LOG_FLAG << "wlan switch state " << switchEnable; + m_wirelessConnectOpreation->setWirelessEnabled(switchEnable); + if (!switchEnable) { + m_netSwitch->setEnabled(false); + m_activatedNetFrame->hide(); + m_activatedNetDivider->hide(); + m_inactivatedNetFrame->hide(); + m_deviceFrame->hide(); + } + } + } + + return; +} + +void WlanPage::initWlanSwitchState() +{ + m_wlanSwitchEnable = m_wirelessConnectOpreation->getWirelessEnabled(); + + if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) { + m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA); + if (m_switchGsettings->keys().contains(WIRELESS_SWITCH)) { + if (m_devList.isEmpty()) { + m_wlanSwitchEnable = false; + m_netSwitch->setSwitchStatus(m_wlanSwitchEnable); + m_netSwitch->setEnabled(false); + } else { + m_wlanSwitchEnable = m_switchGsettings->get(WIRELESS_SWITCH).toBool(); + } + connect(m_switchGsettings, &QGSettings::changed, this, &WlanPage::onWlanSwithGsettingsChanged); + } + } + m_netSwitch->setSwitchStatus(m_wlanSwitchEnable); + + + connect(m_netSwitch, &SwitchButton::clicked, this, &WlanPage::onWlanSwitchClicked); + + return; +} + +void WlanPage::initTimer() +{ + m_scanTimer = new QTimer(this); + connect(m_scanTimer, &QTimer::timeout, this, &WlanPage::requestScan); + + m_refreshIconTimer = new QTimer(this); + connect(m_refreshIconTimer, &QTimer::timeout, this, &WlanPage::onRefreshIconTimer); + m_refreshIconTimer->start(ICON_REFRESH_INTERVAL); +} + +/** + * @brief WlanPage::initDevice 初始化默认网卡 + */ +void WlanPage::initDevice() +{ + m_devList.clear(); + m_netDeviceResource->getNetworkDeviceList(DEVICE_TYPE_WIFI, m_devList); + + m_currentDevice = getDefaultDeviceName(DEVICE_TYPE_WIFI); + return; +} + +void WlanPage::initDeviceCombox() +{ + //TODO 获取设备列表,单设备时隐藏下拉框,多设备时添加到下拉框 + disconnect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), + this, &WlanPage::onDeviceComboxIndexChanged); + m_deviceComboBox->clear(); + + if (m_wlanSwitchEnable) { + if (0 == m_devList.count()) { + m_deviceFrame->show(); + m_tipsLabel->show(); + m_deviceComboBox->hide(); + m_currentDevice = ""; + setDefaultDevice(DEVICE_TYPE_WIFI, m_currentDevice); + } else if (1 == m_devList.count()) { + m_deviceFrame->hide(); + if (m_currentDevice != m_devList.at(0)) { + m_currentDevice = m_devList.at(0); + setDefaultDevice(DEVICE_TYPE_WIFI, m_currentDevice); + } + } else { + m_deviceFrame->show(); + m_deviceComboBox->show(); + m_tipsLabel->hide(); + for (int index = 0; index < m_devList.count(); ++index) { + m_deviceComboBox->addItem(m_devList.at(index)); + } + + if (m_devList.contains(m_currentDevice)) { + m_deviceComboBox->setCurrentText(m_currentDevice); + } else { + m_currentDevice = m_deviceComboBox->currentText(); + setDefaultDevice(DEVICE_TYPE_WIFI, m_currentDevice); + } + } + } else { + m_deviceFrame->hide(); + m_currentDevice = ""; + setDefaultDevice(DEVICE_TYPE_WIFI, m_currentDevice); + } + + connect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), + this, &WlanPage::onDeviceComboxIndexChanged, Qt::DirectConnection); + return; +} + +QListWidgetItem *WlanPage::addEmptyItem(QListWidget *wirelessListWidget) +{ + WlanListItem *p_wlanItem = new WlanListItem(); + QListWidgetItem *p_listWidgetItem = new QListWidgetItem(); + p_listWidgetItem->setFlags(p_listWidgetItem->flags() & (~Qt::ItemIsSelectable)); //设置不可被选中 + p_listWidgetItem->setSizeHint(QSize(wirelessListWidget->width(), p_wlanItem->height())); + wirelessListWidget->addItem(p_listWidgetItem); + wirelessListWidget->setItemWidget(p_listWidgetItem, p_wlanItem); + + return p_listWidgetItem; +} + +QListWidgetItem *WlanPage::addNewItem(KyWirelessNetItem &wirelessNetItem, + QListWidget *wirelessListWidget) +{ + WlanListItem *p_wlanItem = new WlanListItem( + wirelessNetItem, + m_currentDevice, + m_connectResource->isApConnection(wirelessNetItem.m_connectUuid)); + connect(p_wlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged); + + QListWidgetItem *p_listWidgetItem = new QListWidgetItem(); + p_listWidgetItem->setFlags(p_listWidgetItem->flags() & (~Qt::ItemIsSelectable)); + p_listWidgetItem->setSizeHint(QSize(wirelessListWidget->width(), p_wlanItem->height())); + wirelessListWidget->addItem(p_listWidgetItem); + wirelessListWidget->setItemWidget(p_listWidgetItem, p_wlanItem); + + return p_listWidgetItem; +} + +QListWidgetItem *WlanPage::insertNewItem(KyWirelessNetItem &wirelessNetItem, + QListWidget *wirelessListWidget, + int row) +{ + WlanListItem *p_wlanItem = new WlanListItem(wirelessNetItem, m_currentDevice); + connect(p_wlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged); + + QListWidgetItem *p_listWidgetItem = new QListWidgetItem(); + p_listWidgetItem->setFlags(p_listWidgetItem->flags() & (~Qt::ItemIsSelectable)); + p_listWidgetItem->setSizeHint(QSize(wirelessListWidget->width(), p_wlanItem->height())); + wirelessListWidget->insertItem(row, p_listWidgetItem); + wirelessListWidget->setItemWidget(p_listWidgetItem, p_wlanItem); + + return p_listWidgetItem; +} + +QListWidgetItem *WlanPage::insertNewItemWithSort(KyWirelessNetItem &wirelessNetItem, + QListWidget *p_ListWidget) +{ + int row = 0; + + // qDebug()<< "insertNewItemWithSort" << wirelessNetItem.m_NetSsid + // <<"sort item config" << wirelessNetItem.m_isConfigured + // << "signal strength" << wirelessNetItem.m_signalStrength; + WlanListItem *p_sortWlanItem = new WlanListItem(wirelessNetItem, m_currentDevice); + connect(p_sortWlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged); + + QListWidgetItem *p_sortListWidgetItem = new QListWidgetItem(); + p_sortListWidgetItem->setFlags(p_sortListWidgetItem->flags() & (~Qt::ItemIsSelectable)); + p_sortListWidgetItem->setSizeHint(QSize(p_ListWidget->width(), p_sortWlanItem->height())); + + // qDebug() << "insertNewItemWithSort, count" << p_ListWidget->count(); + for (row = 0; row < p_ListWidget->count() - 1; ++row) { + QListWidgetItem *p_listWidgetItem = p_ListWidget->item(row); + WlanListItem *p_wlanItem = (WlanListItem *)p_ListWidget->itemWidget(p_listWidgetItem); + + if (WMI_OB_NAME == p_wlanItem->objectName()) { + qDebug() << "insertNewItemWithSort" << "p_wlanItem is WlanMoreItem"; + continue; + } + + // qDebug()<< "insertNewItemWithSort" << p_wlanItem->getSsid() + // <<"item config" << p_wlanItem->isConfigured() + // << "signal strength" << p_wlanItem->getSignalStrength(); + + if (wirelessNetItem.m_isConfigured == p_wlanItem->isConfigured()) { + if (wirelessNetItem.m_signalStrength > p_wlanItem->getSignalStrength()) { + break; + } + } else { + if (wirelessNetItem.m_isConfigured) { + break; + } + } + } + + p_ListWidget->insertItem(row, p_sortListWidgetItem); + p_ListWidget->setItemWidget(p_sortListWidgetItem, p_sortWlanItem); + + //qDebug()<< "insertNewItemWithSort" << "insert sort item finished. row" << row; + return p_sortListWidgetItem; +} + +void WlanPage::clearWirelessNetItemMap(QMap &wirelessNetItem, + QListWidget *wirelessListWidget) +{ + QMap::iterator iter; + + iter = wirelessNetItem.begin(); + while (iter != wirelessNetItem.end()) { + QListWidgetItem *p_listWidgetItem = iter.value(); + if (p_listWidgetItem == m_hiddenItem) { + continue; + } + + WlanListItem *p_wlanItem = (WlanListItem *)wirelessListWidget->itemWidget(p_listWidgetItem); + wirelessListWidget->removeItemWidget(p_listWidgetItem); + + delete p_wlanItem; + p_wlanItem = nullptr; + + delete p_listWidgetItem; + p_listWidgetItem = nullptr; + + iter = wirelessNetItem.erase(iter); + } + + return; +} + +void WlanPage::deleteWirelessItemFormMap(QMap &wirelessNetItemMap, + QListWidget *wirelessListWidget, QString ssid) +{ + QListWidgetItem *p_listWidgetItem = wirelessNetItemMap.value(ssid); + if (nullptr == p_listWidgetItem) { + qWarning()<< LOG_FLAG <<"wireless item is not exsit, it's ssid is " << ssid; + return; + } + + WlanListItem *p_wlanItem = (WlanListItem *)wirelessListWidget->itemWidget(p_listWidgetItem); + if (nullptr == p_wlanItem) { + qWarning() << LOG_FLAG << "p_wlanItem is null"; + return; + } + + wirelessNetItemMap.remove(ssid); + + wirelessListWidget->takeItem(wirelessListWidget->row(p_listWidgetItem)); + + delete p_wlanItem; + p_wlanItem = nullptr; + + delete p_listWidgetItem; + p_listWidgetItem = nullptr; + + if (m_inactivatedNetListWidget->count() < MAX_ITEMS) { + m_inactivatedNetListWidget->setFixedWidth(MIN_WIDTH); + } + return; +} + +void WlanPage::updateWlanItemState(QListWidget *p_wirelessListWidget, + QListWidgetItem *p_listWidgetItem, + KyConnectState state) +{ + WlanListItem *p_wlanItem = nullptr; + p_wlanItem = (WlanListItem *)p_wirelessListWidget->itemWidget(p_listWidgetItem); + if (nullptr != p_wlanItem) { + p_wlanItem->updateConnectState(state); + } + + return; +} + +void WlanPage::constructActivateConnectionArea() +{ + int height = 0; + clearWirelessNetItemMap(m_activateConnectionItemMap, m_activatedNetListWidget); + + if (!m_currentDevice.isEmpty()) { + KyWirelessNetItem wirelessNetItem; + bool ret = m_wirelessNetResource->getActiveWirelessNetItem(m_currentDevice, wirelessNetItem); + if (ret == true) { + QListWidgetItem *p_listWidgetItem = addNewItem(wirelessNetItem, m_activatedNetListWidget); + m_activateConnectionItemMap.insert(wirelessNetItem.m_NetSsid, p_listWidgetItem); + updateWlanItemState(m_activatedNetListWidget, p_listWidgetItem, CONNECT_STATE_ACTIVATED); + + height += p_listWidgetItem->sizeHint().height(); + } + } + + if (height == 0) { + QListWidgetItem *p_listWidgetItem = addEmptyItem(m_activatedNetListWidget); + m_activateConnectionItemMap.insert(EMPTY_SSID, p_listWidgetItem); + + height += p_listWidgetItem->sizeHint().height(); + } + + m_activatedNetListWidget->setFixedHeight(height); + + return; +} + +void WlanPage::constructWirelessNetArea() +{ + qDebug() << "[WlanPage] Started loading wireless net list!" + << QDateTime::currentDateTime().toString("hh:mm:ss.zzzz"); + + clearWirelessNetItemMap(m_wirelessNetItemMap, m_inactivatedNetListWidget); + m_expandedItem = nullptr; + + QList wirelessNetItemList; + if (!m_wirelessNetResource->getWifiNetworkOfDevice(m_currentDevice, wirelessNetItemList)) { + qWarning()<<"[WlanPage] get wireless net item list failed."; + return; + } + + QString activateSsid = m_activateConnectionItemMap.firstKey(); + + Q_FOREACH (auto wirelessNetItem, wirelessNetItemList) { + if (wirelessNetItem.m_NetSsid == activateSsid) { + continue; + } + + QListWidgetItem *p_listWidgetItem = addNewItem(wirelessNetItem, m_inactivatedNetListWidget); + m_wirelessNetItemMap.insert(wirelessNetItem.m_NetSsid, p_listWidgetItem); + updateWlanItemState(m_inactivatedNetListWidget, p_listWidgetItem, CONNECT_STATE_DEACTIVATED); + } + + addWlanMoreItem(); + + qDebug() << "[WlanPage] Stopped loading wireless net list! time=" + << QDateTime::currentDateTime().toString("hh:mm:ss.zzzz"); + if (m_inactivatedNetListWidget->count() < MAX_ITEMS) { + m_inactivatedNetListWidget->setFixedWidth(MIN_WIDTH); + } else { + m_inactivatedNetListWidget->setFixedWidth(MAX_WIDTH); + } + return; +} + +void WlanPage::initWlanArea() +{ + if (m_wlanSwitchEnable) { + m_activatedNetFrame->show(); + m_activatedNetDivider->show(); + constructActivateConnectionArea(); + + m_inactivatedNetFrame->show(); + constructWirelessNetArea(); + } else { + m_activatedNetFrame->hide(); + m_activatedNetDivider->hide(); + + m_inactivatedNetFrame->hide(); + } + + return; +} + +void WlanPage::onWlanAdded(QString interface, KyWirelessNetItem &item) +{ +// //for dbus +// QStringList info; + +// info << item.m_NetSsid +// << QString::number(item.m_signalStrength) +// << item.m_secuType +// << (m_connectResource->isApConnection(item.m_connectUuid) ? IsApConnection : NotApConnection); +// Q_EMIT wlanAdd(interface, info); + + if (interface != m_currentDevice) { + qDebug() << "[WlanPage] wlan add interface not equal defaultdevice"; + return; + } + + if (m_wirelessNetItemMap.contains(item.m_NetSsid)) { + return; + } + + qDebug() << "[WlanPage] A Wlan Added! interface = " + << interface << "; ssid = " << item.m_NetSsid << Q_FUNC_INFO <<__LINE__; + + QListWidgetItem *p_listWidgetItem = insertNewItemWithSort(item, m_inactivatedNetListWidget); + m_wirelessNetItemMap.insert(item.m_NetSsid, p_listWidgetItem); + updateWlanItemState(m_inactivatedNetListWidget, p_listWidgetItem, CONNECT_STATE_DEACTIVATED); + + addWlanMoreItem(); + if (m_inactivatedNetListWidget->count() >= MAX_ITEMS) { + m_inactivatedNetListWidget->setFixedWidth(MAX_WIDTH); + } + return; +} + +void WlanPage::onWlanRemoved(QString interface, QString ssid) +{ +// Q_EMIT wlanRemove(interface, ssid); + + if (interface != m_currentDevice) { + qDebug()<<"[WlanPage] the device is not current device," + <<"current device" << m_currentDevice + << "remove wlan device" << interface; + return; + } + + if (!m_wirelessNetItemMap.contains(ssid) && !m_activateConnectionItemMap.contains(ssid)) { + return; + } + + if (m_expandedItem == m_wirelessNetItemMap.value(ssid)) { + m_expandedItem = nullptr; + } + + qDebug() << "[WlanPage] A Wlan Removed! interface = " << interface + << "; ssid = " << ssid << Q_FUNC_INFO <<__LINE__; + + + if (m_wirelessNetItemMap.contains(ssid)) { + deleteWirelessItemFormMap(m_wirelessNetItemMap, + m_inactivatedNetListWidget, ssid); + } else { + deleteWirelessItemFormMap(m_activateConnectionItemMap, + m_activatedNetListWidget, ssid); + showDesktopNotify(tr("WLAN Disconnected Successfully")); + + QListWidgetItem *p_listWidgetItem = addEmptyItem(m_activatedNetListWidget); + m_activateConnectionItemMap.insert(EMPTY_SSID, p_listWidgetItem); + } + + return; +} + +void WlanPage::updateWlanListItem(QString ssid) +{ + KyWirelessNetItem wirelessNetItem; + + qDebug() << LOG_FLAG << "update wlan list item " << ssid; + + bool ret = m_wirelessNetResource->getWifiNetwork(m_currentDevice, ssid, wirelessNetItem); + if (ret) { + QListWidgetItem *p_listWidgetItem = m_wirelessNetItemMap.value(ssid); + if (p_listWidgetItem) { + WlanListItem *p_wlanItem = (WlanListItem *)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem); + p_wlanItem->updateWirelessNetItem(wirelessNetItem); + p_wlanItem->updateConnectState(CONNECT_STATE_DEACTIVATED); + } + } + + return; +} + +void WlanPage::onConnectionAdd(QString deviceName, QString ssid) +{ + qDebug() << LOG_FLAG << "one connection is added, it's ssid " << ssid << "device name"<< deviceName; + + if (deviceName == m_currentDevice) { + updateWlanListItem(ssid); + } + + return; +} + +void WlanPage::onConnectionRemove(QString deviceName, QString ssid) +{ + qDebug() << LOG_FLAG << "one connection is removed, it's ssid " << ssid << "device name"<< deviceName; + if (deviceName == m_currentDevice) { + if (m_activateConnectionItemMap.contains(ssid)) { + updateWirelessNetArea(nullptr, ssid, deviceName); + } + updateWlanListItem(ssid); + } + + return; +} + +void WlanPage::onSecurityTypeChange(QString devName, QString ssid, QString secuType) +{ + QListWidgetItem *p_listWidgetItem = nullptr; + WlanListItem *p_wlanItem = nullptr; + + qDebug()<< LOG_FLAG << "security type is chenged"; + + if (m_wirelessNetItemMap.contains(ssid)) { + p_listWidgetItem = m_wirelessNetItemMap.value(ssid); + p_wlanItem = (WlanListItem*)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem); + } else if (m_activateConnectionItemMap.contains(ssid)) { + p_listWidgetItem = m_activateConnectionItemMap.value(ssid); + p_wlanItem = (WlanListItem*)m_activatedNetListWidget->itemWidget(p_listWidgetItem); + } + + if (nullptr != p_wlanItem) { + p_wlanItem->updateWirelessNetSecurity(ssid, secuType); + } + + return; +} + + +void WlanPage::addDeviceToCombox(QString deviceName) +{ + disconnect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), + this, &WlanPage::onDeviceComboxIndexChanged); + if (m_wlanSwitchEnable) { + if (m_currentDevice.isEmpty()){ + m_deviceFrame->hide(); + m_currentDevice = deviceName; + setDefaultDevice(DEVICE_TYPE_WIFI, m_currentDevice); + } else if (m_deviceComboBox->count() == 0) { + m_deviceComboBox->addItem(m_currentDevice); + m_deviceComboBox->addItem(deviceName); + m_deviceFrame->show(); + m_deviceComboBox->show(); + m_tipsLabel->hide(); + } else { + m_deviceComboBox->addItem(deviceName); + } + } + + connect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), + this, &WlanPage::onDeviceComboxIndexChanged); + return; +} + +void WlanPage::onDeviceAdd(QString deviceName) +{ + qDebug() << LOG_FLAG << "currentDevice" << m_currentDevice << "deviceAdd" << deviceName; + if (m_devList.contains(deviceName)) { + return; + } + + if (m_devList.isEmpty()) { + m_wlanSwitchEnable = m_switchGsettings->get(WIRELESS_SWITCH).toBool(); + m_netSwitch->setEnabled(true); + m_netSwitch->setSwitchStatus(m_wlanSwitchEnable); + } + + m_devList << deviceName; + addDeviceToCombox(deviceName); + if (m_currentDevice == deviceName) { + initWlanArea(); + } + + return; +} + +void WlanPage::deleteDeviceFromCombox(QString deviceName) +{ + disconnect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), + this, &WlanPage::onDeviceComboxIndexChanged); + + if (m_wlanSwitchEnable) { + if (0 == m_devList.count()) { + m_deviceFrame->hide(); + //m_tipsLabel->show(); + //m_deviceComboBox->hide(); + m_currentDevice = ""; + setDefaultDevice(DEVICE_TYPE_WIFI, m_currentDevice); + } else if (1 == m_devList.count()) { + m_deviceFrame->hide(); + m_deviceComboBox->clear(); + m_currentDevice = m_devList.at(0); + setDefaultDevice(DEVICE_TYPE_WIFI, m_currentDevice); + } else { + int index = m_deviceComboBox->findData(deviceName); + if (-1 != index) { + m_deviceComboBox->removeItem(index); + m_currentDevice = m_deviceComboBox->currentText(); + setDefaultDevice(DEVICE_TYPE_WIFI, m_currentDevice); + } + } + } + + connect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), + this, &WlanPage::onDeviceComboxIndexChanged); + return; +} + +void WlanPage::onDeviceRemove(QString deviceName) +{ + if (!m_devList.contains(deviceName)) { + return; + } + + qDebug() << "deviceRemove" << deviceName; + + QString originalDeviceName = m_currentDevice; + + m_devList.removeOne(deviceName); + deleteDeviceFromCombox(deviceName); + + if (m_devList.isEmpty()) { + m_wlanSwitchEnable = false; + m_netSwitch->setSwitchStatus(m_wlanSwitchEnable); + m_netSwitch->setEnabled(false); + } + + if (originalDeviceName == deviceName) { + initWlanArea(); + } +} + +void WlanPage::updateDeviceForCombox(QString oldDeviceName, QString newDeviceName) +{ + if (m_currentDevice == oldDeviceName) { + m_currentDevice = newDeviceName; + setDefaultDevice(DEVICE_TYPE_WIFI, m_currentDevice); + } + + int index = m_deviceComboBox->findText(oldDeviceName); + if (index != -1) { + m_deviceComboBox->setItemText(index, newDeviceName); + } + + return; +} + +void WlanPage::onDeviceNameUpdate(QString oldName, QString newName) +{ + if (!m_devList.contains(oldName)) { + return; + } + + qDebug()<<"[WlanPage] update device name, old name" + << oldName << "new Name" << newName; + + m_devList.removeOne(oldName); + m_devList.append(newName); + + QString originalDeviceName = m_currentDevice; + + updateDeviceForCombox(oldName, newName); + if (originalDeviceName != m_currentDevice) { + initWlanArea(); + } + return; +} + +//void WlanPage::sendApStateChangeSignal(QString uuid, +// QString ssid, +// QString deviceName, +// NetworkManager::ActiveConnection::State state) +//{ +// bool ret = false; +// ret = m_connectResource->isApConnection(uuid); +// if (!ret) { +// return; +// } + +// if (state == CONNECT_STATE_DEACTIVATED) { +// qDebug() << "[WlanPage] hotspot Deactivated"; +// Q_EMIT hotspotDeactivated(deviceName, ssid); +// } else if (state == CONNECT_STATE_ACTIVATED) { +// qDebug() << "[WlanPage] hotspot activated"; +// Q_EMIT hotspotActivated(deviceName, ssid, uuid); +// } + +// return; +//} + +void WlanPage::wlanShowNotify(QString ssid, KyConnectState state) +{ + if (state == CONNECT_STATE_DEACTIVATED) { + showDesktopNotify(tr("WLAN Disconnected Successfully")); + } else if (state == CONNECT_STATE_ACTIVATED) { + this->showDesktopNotify(tr("WLAN Connected Successfully")); + } + + return; +} + +void WlanPage::updateActivatedArea(QString uuid, QString ssid, QString devName) +{ + if (m_activateConnectionItemMap.contains(ssid)) { + return; + } + + if (m_expandedItem == m_wirelessNetItemMap.value(ssid)) { + m_expandedItem = nullptr; + } + deleteWirelessItemFormMap(m_wirelessNetItemMap, + m_inactivatedNetListWidget, ssid); + + KyWirelessNetItem wirelessNetItem; + bool ret = m_wirelessNetResource->getWifiNetwork(devName, ssid, wirelessNetItem); + if (!ret) { + qWarning()<<"[WlanPage] get wireless item failed, when update activated connection area."; + return; + } + + deleteWirelessItemFormMap(m_activateConnectionItemMap, m_activatedNetListWidget, EMPTY_SSID); + QListWidgetItem *p_listWidgetItem = addNewItem(wirelessNetItem, m_activatedNetListWidget); + m_activateConnectionItemMap.insert(wirelessNetItem.m_NetSsid, p_listWidgetItem); + + m_activatedNetListWidget->setFixedHeight(p_listWidgetItem->sizeHint().height()); + if (m_inactivatedNetListWidget->count() < MAX_ITEMS) { + m_inactivatedNetListWidget->setFixedWidth(MIN_WIDTH); + } + return; +} + +void WlanPage::updateWirelessNetArea(QString uuid, QString ssid, QString devName) +{ + if(m_wirelessNetItemMap.contains(ssid)) { + return; + } + + if (m_activateConnectionItemMap.contains(ssid)) { + deleteWirelessItemFormMap(m_activateConnectionItemMap, m_activatedNetListWidget, ssid); + QListWidgetItem *p_activeListWidgetItem = addEmptyItem(m_activatedNetListWidget); + m_activateConnectionItemMap.insert(EMPTY_SSID, p_activeListWidgetItem); + m_activatedNetListWidget->setFixedHeight(p_activeListWidgetItem->sizeHint().height()); + } else { + qDebug() << LOG_FLAG << ssid << "is not in activeconnection map"; + } + + KyWirelessNetItem wirelessNetItem; + bool ret = m_wirelessNetResource->getWifiNetwork(devName, ssid, wirelessNetItem); + if (!ret) { + qWarning()<<"[WlanPage] get wireless item failed, when update wireless area."; + return; + } + + QListWidgetItem *p_listWidgetItem = insertNewItemWithSort(wirelessNetItem, m_inactivatedNetListWidget); + m_wirelessNetItemMap.insert(wirelessNetItem.m_NetSsid, p_listWidgetItem); + + // 更新‘更多’条目,以保证其处于listwidget的最底部 + addWlanMoreItem(); + if (m_inactivatedNetListWidget->count() < MAX_ITEMS) { + m_inactivatedNetListWidget->setFixedWidth(MIN_WIDTH); + } else { + m_inactivatedNetListWidget->setFixedWidth(MAX_WIDTH); + } + return; +} + +void WlanPage::onConnectionStateChanged(QString deviceName, QString ssid, QString uuid, KyConnectState state) +{ + qDebug()<< LOG_FLAG << "emit wlanActiveConnectionStateChanged" << deviceName << ssid << state; + + if (ssid.isEmpty() || deviceName.isEmpty()) { + qDebug()<< LOG_FLAG << "ssid or devicename is empty" + << "devicename"<< deviceName <<"ssid"<isWirelessConnection(uuid)) { + qDebug()<< LOG_FLAG << "it is not wireless connection" << uuid; + return; + } + + if (m_connectResource->isApConnection(uuid)) { + // sendApStateChangeSignal(uuid, ssid, deviceName, state); + } else { + if (state == CONNECT_STATE_DEACTIVATED && + !m_activateConnectionItemMap.contains(ssid)) { + qDebug() << "wlan remove before deactivated"; + } else { + wlanShowNotify(ssid, state); + } + } + + if (deviceName != m_currentDevice) { + return; + } + + qDebug()<< "[WlanPage] wlan state changed, ssid = " << ssid + << "; state = " << state << "; reason = " << Q_FUNC_INFO <<__LINE__; + if (state == CONNECT_STATE_ACTIVATED) { + m_updateStrength = true; + updateActivatedArea(uuid, ssid, deviceName); + if (m_activateConnectionItemMap.contains(ssid)) { + QListWidgetItem *p_listWidgetItem = m_activateConnectionItemMap.value(ssid); + updateWlanItemState(m_activatedNetListWidget, p_listWidgetItem, CONNECT_STATE_ACTIVATED); + } + } else if (state == CONNECT_STATE_DEACTIVATED) { + m_updateStrength = true; + updateWirelessNetArea(uuid, ssid, deviceName); + if (m_wirelessNetItemMap.contains(ssid)) { + QListWidgetItem *p_listWidgetItem = m_wirelessNetItemMap.value(ssid); + updateWlanItemState(m_inactivatedNetListWidget, p_listWidgetItem, CONNECT_STATE_DEACTIVATED); + } + } else if (state == CONNECT_STATE_DEACTIVATING){ + m_updateStrength = false; + if (m_activateConnectionItemMap.contains(ssid)) { + QListWidgetItem *p_listWidgetItem = m_activateConnectionItemMap.value(ssid); + updateWlanItemState(m_activatedNetListWidget, p_listWidgetItem, CONNECT_STATE_DEACTIVATING); + } + } else if (state == CONNECT_STATE_ACTIVATING) { + m_updateStrength = false; + if (m_wirelessNetItemMap.contains(ssid)) { + QListWidgetItem *p_listWidgetItem = m_wirelessNetItemMap.value(ssid); + updateWlanItemState(m_inactivatedNetListWidget, p_listWidgetItem, CONNECT_STATE_ACTIVATING); + } + } + return; +} + +void WlanPage::onItemHeightChanged(const bool isExpanded, const QString &ssid) +{ + if (!m_wirelessNetItemMap.contains(ssid)) { + return; + } + + QListWidgetItem *p_listWidgetItem = m_wirelessNetItemMap.value(ssid); + + qDebug()<sizeHint().height(); + int width = p_listWidgetItem->sizeHint().width(); + + if (isExpanded) { + if (m_expandedItem != p_listWidgetItem) { + qDebug()<setSizeHint(expandedSize); + } + m_inactivatedNetListWidget->scrollToItem(p_listWidgetItem, QAbstractItemView::QAbstractItemView::EnsureVisible); + } else { + m_expandedItem = nullptr; + + if (height > NORMAL_HEIGHT) { + qDebug()<setSizeHint(normalSize); + } + } + + return; +} + +void WlanPage::onDeviceComboxIndexChanged(int currentIndex) +{ + qDebug() << "onDeviceComboxIndexChanged"; + if (!m_deviceComboBox || currentIndex < 0) { + return; + } + + m_currentDevice = m_deviceComboBox->itemText(currentIndex); + setDefaultDevice(DEVICE_TYPE_WIFI, m_currentDevice); + + initWlanArea(); + + return; +} + +//申请触发扫描,初始化执行&定时执行 +void WlanPage::requestScan() +{ + if (!m_wirelessConnectOpreation) { + qWarning() << "[WlanPage]Scan failed! m_wirelessConnectOpreation is nullptr!" << Q_FUNC_INFO << __LINE__; + return; + } + + m_wirelessConnectOpreation->requestWirelessScan(); + + return; +} + +void WlanPage::onHiddenWlanClicked() +{ + qDebug() << "[wlanPage] AddHideWifi Clicked! " << Q_FUNC_INFO << __LINE__ ; + NetDetail *netDetail = new NetDetail(m_currentDevice, "", "", false, true, true, this); + netDetail->show(); +} + +void WlanPage::showControlCenter() +{ + qDebug() << LOG_FLAG <<"show control center"; + + QProcess process; + process.startDetached("ukui-control-center -m wlanconnect"); + + return; +} + +void WlanPage::onWifiEnabledChanged(bool isWifiOn) +{ + //监听外部命令导致wifi状态变化,更新界面 + qDebug() << "[WlanPage] onWifiEnabledChanged wifi state" << isWifiOn; + + //应该先检测是否有无线网卡可用,才改变开关状态 + if (m_devList.isEmpty()) { + qDebug() << "[WLanPage] have no device to use " << Q_FUNC_INFO << __LINE__; + return; + } + + if (m_wlanSwitchEnable == isWifiOn) { + return; + } else { + if (!m_netSwitch->getEnabled()) { + m_netSwitch->setEnabled(true); + } + m_switchGsettings->set(WIRELESS_SWITCH, isWifiOn); + } + + return; +} + +void WlanPage::refreshActiveConnectionIcon(QString ssid, const int &signal) +{ + QListWidgetItem *p_listWidgetItem = m_activateConnectionItemMap.value(ssid); + if (p_listWidgetItem) { + WlanListItem *p_wlanItem = (WlanListItem *)m_activatedNetListWidget->itemWidget(p_listWidgetItem); + if (nullptr != p_wlanItem) { + p_wlanItem->setSignalStrength(signal); + return; + } + } +} + +void WlanPage::onRefreshIconTimer() +{ + if (!m_updateStrength) { + return; + } + + Q_EMIT timeToUpdate(); + + if(!this->isVisible()) { + return; + } + //qDebug() << "onRefreshIconTimer"; + + if (m_expandedItem) { + qDebug()<< LOG_FLAG << "Has expanded item and forbid refresh wifi strength" << Q_FUNC_INFO << __LINE__; + return; + } + + QList wlanList; + if (!m_wirelessNetResource->getWifiNetworkOfDevice(m_currentDevice, wlanList)) { + return; + } + + + QString activateSsid = m_activateConnectionItemMap.firstKey(); + int sortRow = 0; + for (int index = 0; index < wlanList.length(); index++) { + KyWirelessNetItem sortItem = wlanList.at(index); + QString sortSsid = sortItem.m_NetSsid; //应该在第currentRow行的新的WiFi名称 + //qDebug()<< LOG_FLAG << "sort ssid"<< sortSsid << "active ssid" << activateSsid << "sort row"<< sortRow; + if (sortSsid == activateSsid) { //排除已连接WiFi + refreshActiveConnectionIcon(activateSsid, sortItem.m_signalStrength); + continue; + } + + QListWidgetItem *p_listWidgetItem = m_inactivatedNetListWidget->item(sortRow); + if (p_listWidgetItem) { + WlanListItem *p_wlanItem = (WlanListItem *)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem); + + if (nullptr == p_wlanItem) { + qDebug() << LOG_FLAG << "p_wlanItem is null continue"; + continue;//暂时先保持continue,后续讨论是否使用break直接跳出循环 + } + + // 该item是‘更多’条目,不需要更新 + if (WMI_OB_NAME == p_wlanItem->objectName()) { + qDebug() << LOG_FLAG << "p_wlanItem is WlanMoreItem"; + continue; + } + + //qDebug()<< LOG_FLAG << "row" << sortRow << "item ssid" << p_wlanItem->getSsid(); + if (sortSsid == p_wlanItem->getSsid()) { + // qDebug()<< LOG_FLAG << "sort wlan set signal strength." << Q_FUNC_INFO << __LINE__; + p_wlanItem->setSignalStrength(sortItem.m_signalStrength); + sortRow++; + continue; + } + + QListWidgetItem *p_sortListWidgetItem = m_wirelessNetItemMap.value(sortSsid); + if (p_sortListWidgetItem) { + WlanListItem *p_wlanItem = (WlanListItem *)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem); + if (p_wlanItem == nullptr) { + continue; + } + + if (CONNECT_STATE_DEACTIVATED != p_wlanItem->getConnectionState()) { + continue; + } + // qDebug()<< LOG_FLAG << "sort wlan update position." << sortSsid << Q_FUNC_INFO << __LINE__; + int takeRow = m_inactivatedNetListWidget->row(p_sortListWidgetItem); + m_inactivatedNetListWidget->takeItem(takeRow); + + WlanListItem *p_sortWlanItem = new WlanListItem(sortItem, m_currentDevice); + connect(p_sortWlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged); + m_inactivatedNetListWidget->insertItem(sortRow, p_sortListWidgetItem); + m_inactivatedNetListWidget->setItemWidget(p_sortListWidgetItem, p_sortWlanItem); + updateWlanItemState(m_inactivatedNetListWidget, p_sortListWidgetItem, CONNECT_STATE_DEACTIVATED); + sortRow++; + continue; + } + } + + //qDebug()<< LOG_FLAG << "sort wlan add new item." << Q_FUNC_INFO << __LINE__; + QListWidgetItem *p_newListWidgetItem = insertNewItem(sortItem, m_inactivatedNetListWidget, sortRow); + m_wirelessNetItemMap.insert(sortItem.m_NetSsid, p_newListWidgetItem); + updateWlanItemState(m_inactivatedNetListWidget, p_listWidgetItem, CONNECT_STATE_DEACTIVATED); + + sortRow++; + } + + // qDebug()<< LOG_FLAG << "sort wlan finished." << Q_FUNC_INFO << __LINE__; + + return; +} + +////for dbus +//void WlanPage::getWirelessList(QMap > &map) +//{ +// QMap actMap; +// m_wirelessNetResource->getWirelessActiveConnection(NetworkManager::ActiveConnection::State::Activated, actMap); + +// QMap > wlanMap; +// if (!m_wirelessNetResource->getAllDeviceWifiNetwork(wlanMap)) { +// return; +// } + +// QMap >::iterator iter = wlanMap.begin(); +// while (iter != wlanMap.end()) { +// QVector vector; +// QString activeSsid ; +// //先是已连接 +// if (actMap.contains(iter.key())) { +// qDebug() << "find " <getSsidByUuid(actMap[iter.key()].at(0), ssid); +// if (m_wirelessNetResource->getWifiNetwork(iter.key(), ssid, data)) { +// vector.append(QStringList() << data.m_NetSsid +// << QString::number(data.m_signalStrength) +// << data.m_secuType +// << data.m_connectUuid +// << (m_connectResource->isApConnection(data.m_connectUuid) ? IsApConnection : NotApConnection)); +// activeSsid = data.m_NetSsid; +// } else { +// vector.append(QStringList("--")); +// } +// } else { +// vector.append(QStringList("--")); +// } +// //未连接 +// Q_FOREACH (auto itemData, iter.value()) { +// if (itemData.m_NetSsid == activeSsid) { +// continue; +// } +// vector.append(QStringList()<isApConnection(itemData.m_connectUuid) ? IsApConnection : NotApConnection)); +// } + +// map.insert(iter.key(), vector); +// iter++; +// } + +// return; +//} + +////开启热点 +//void WlanPage::activeWirelessAp(const QString apName, const QString apPassword, const QString wirelessBand, const QString apDevice) +//{ +// QString uuid(""); +// QList apConnectItemList; +// m_connectResource->getApConnections(apConnectItemList); +// if (!apConnectItemList.isEmpty()) { +// uuid = apConnectItemList.at(0)->m_connectUuid; +// } + +// m_wirelessConnectOpreation->activeWirelessAp(uuid, apName, apPassword, apDevice, wirelessBand); +//} + +////断开热点 +//void WlanPage::deactiveWirelessAp(const QString apName, const QString uuid) +//{ +// if (!uuid.isEmpty()) { +// m_wirelessConnectOpreation->deactiveWirelessAp(apName, uuid); +// } +//} + +//void WlanPage::getStoredApInfo(QStringList &list) +//{ +// list.clear(); +// QList apConnectItemList; +// m_connectResource->getApConnections(apConnectItemList); +// if (!apConnectItemList.isEmpty()) { +// list << apConnectItemList.at(0)->m_connectSsid; +// list << apConnectItemList.at(0)->m_password; +// list << apConnectItemList.at(0)->m_ifaceName; +// list << (apConnectItemList.at(0)->m_isActivated? "true":"false"); +// list << apConnectItemList.at(0)->m_connectUuid; +// list << apConnectItemList.at(0)->m_band; +// } +//} + +//void WlanPage::getApInfoBySsid(QString devName, QString ssid, QStringList &list) +//{ +// list.clear(); +// QList apConnectItemList; +// m_connectResource->getApConnections(apConnectItemList); +// for (int i = 0; i < apConnectItemList.size(); i++) { +// if (apConnectItemList.at(i)->m_connectSsid == ssid +// && apConnectItemList.at(i)->m_ifaceName == devName) { +// list << apConnectItemList.at(i)->m_password; +// list << apConnectItemList.at(i)->m_band; +// } +// } + +// return; +//} + +//void WlanPage::activateWirelessConnection(const QString& devName, const QString& ssid) +//{ +// KyWirelessNetItem wirelessNetItem; +// if (!m_wirelessNetResource->getWifiNetwork(devName, ssid, wirelessNetItem)) { +// qDebug() << "[WlanPage] no such wifi " << ssid << " in " << devName; +// return; +// } + +// if (devName != m_currentDevice) { +// int index = m_deviceComboBox->findText(devName); +// if (index >= 0) { +// m_deviceComboBox->setCurrentIndex(index); +// } else { +// qDebug() << "[WlanPage]activateWirelessConnection no such " << devName; +// return; +// } +// } + +// QListWidgetItem *p_listWidgetItem = nullptr; +// WlanListItem *p_wlanItem = nullptr; + +// if (m_wirelessNetItemMap.contains(ssid)) { +// p_listWidgetItem = m_wirelessNetItemMap.value(ssid); +// p_wlanItem = (WlanListItem*)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem); + +// m_inactivatedNetListWidget->scrollToItem(p_listWidgetItem, QAbstractItemView::EnsureVisible); + + +// QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, QPoint(0,0), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// QApplication::postEvent(p_wlanItem, event); +// Q_EMIT showMainWindow(); +// } else { +// qDebug() << "[WlanPage]activateWirelessConnection no such " << ssid << "in" << devName; +// } +// return; +//} + +//void WlanPage::deactivateWirelessConnection(const QString& devName, const QString& ssid) +//{ +// KyWirelessNetItem wirelessNetItem; +// if (!m_wirelessNetResource->getWifiNetwork(devName, ssid, wirelessNetItem)) { +// qDebug() << "[WlanPage] no such wifi " << ssid << " in " << devName; +// return; +// } + +// if (!m_connectResource->isActivatedConnection(wirelessNetItem.m_connectUuid)) { +// qDebug()<<"[WlanPage]"<deActivateWirelessConnection(wirelessNetItem.m_connName, wirelessNetItem.m_connectUuid); + +// return; +//} + +void WlanPage::onMainWindowVisibleChanged(const bool &visible) +{ + qDebug() << "[WlanPage] Received signal of mainwindow visible changed. cur_state = " << visible << Q_FUNC_INFO << __LINE__; + if (visible) { + //打开页面时先触发一次扫描,然后定时扫描wifi热点和刷新icon + requestScan(); + m_scanTimer->start(AP_SCAN_INTERVAL); + onRefreshIconTimer(); +// m_refreshIconTimer->start(ICON_REFRESH_INTERVAL); + } else { + //界面关闭的时候,停止wifi扫描和刷新 + m_scanTimer->stop(); +// m_refreshIconTimer->stop(); + qDebug() << "wlanpage not visible"; + showNonePwd(); + } + + return; +} + +void WlanPage::onWlanPageVisibleChanged(int index) +{ + if (index == LAN_PAGE_INDEX) { + qDebug() << "wlanpage not visible"; + showNonePwd(); + } +} + +void WlanPage::showNonePwd() +{ + QMap::iterator iter; + for(iter=m_wirelessNetItemMap.begin();iter!= m_wirelessNetItemMap.end();iter++) + { + if(iter.value() != nullptr) { + QListWidgetItem *p_listWidgetItem = iter.value(); + WlanListItem *p_wlanItem = (WlanListItem*)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem); + p_wlanItem->forgetPwd(); + p_wlanItem->setExpanded(false); + } + } + return; +} + +void WlanPage::showDetailPage(QString devName, QString ssid) +{ + KyWirelessNetItem wirelessNetItem; + if (!m_wirelessNetResource->getWifiNetwork(devName, ssid, wirelessNetItem)) { + qDebug()<<"[WlanPage] " << ssid << " is missing when showDetailPage"; + return; + } + + bool isActive = m_connectResource->isActivatedConnection(wirelessNetItem.m_connectUuid); + + NetDetail *netDetail = new NetDetail(devName, ssid, wirelessNetItem.m_connectUuid, isActive, true, !wirelessNetItem.m_isConfigured, this); + netDetail->show(); + + return; +} + +bool WlanPage::wlanIsConnected() +{ + if (m_activatedConnectResource->wirelessConnectIsActived()) { + return true; + } else { + return false; + } +} + +//void WlanPage::setWirelessSwitchEnable(bool enable) +//{ +// qDebug() << "dbus setWirelessSwitchEnable = " << enable << __LINE__; +// //应该先检测是否有无线网卡可用,才改变开关状态 +// if (m_devList.isEmpty()) { +// qDebug() << "have no device to use " << Q_FUNC_INFO << __LINE__; +// //检测不到无线网卡不再触发click信号 +// m_netSwitch->setSwitchStatus(false); +// //m_netSwitch->setEnabled(false); +// }else{ +// m_wirelessConnectOpreation->setWirelessEnabled(enable); +// if (!enable) { +// m_netSwitch->setEnabled(false); +// m_activatedNetFrame->hide(); +// m_activatedNetDivider->hide(); +// m_inactivatedNetFrame->hide(); +// m_deviceFrame->hide(); +// } +// } +//} + +//void WlanPage::getWirelessDeviceCap(QMap &map) +//{ +// for (int i = 0; i < m_devList.size(); ++i) { +// QString devName = m_devList.at(i); +// map.insert(devName, m_netDeviceResource->getWirelessDeviceCapability(devName)); +// } +//} + +void WlanPage::getConnectivity(KyConnectivity &connectivity) +{ + m_connectResource->getConnectivity(connectivity); +} + +/** + * @brief WlanPage::addWlanMoreItem + * 添加‘更多网络’的条目 + */ +void WlanPage::addWlanMoreItem() +{ + if (m_hiddenItem) { + m_inactivatedNetListWidget->takeItem(m_inactivatedNetListWidget->row(m_hiddenItem)); + delete m_hiddenItem; + m_hiddenItem = nullptr; + } + + if (m_hiddenWlanWidget) { +// disconnect(m_hiddenWlanWidget, &WlanMoreItem::hiddenWlanClicked, this, &WlanPage::onHiddenWlanClicked); + m_hiddenWlanWidget->setParent(nullptr); + delete m_hiddenWlanWidget; + m_hiddenWlanWidget = nullptr; + } + + m_hiddenWlanWidget = new WlanMoreItem(this); + connect(m_hiddenWlanWidget, &WlanMoreItem::hiddenWlanClicked, this, &WlanPage::onHiddenWlanClicked); + m_hiddenWlanWidget->setFixedHeight(NORMAL_HEIGHT); + + m_hiddenItem = new QListWidgetItem(m_inactivatedNetListWidget); + m_hiddenItem->setFlags(m_hiddenItem->flags() & (~Qt::ItemIsSelectable)); + m_hiddenItem->setSizeHint(QSize(m_inactivatedNetListWidget->width(), m_hiddenWlanWidget->height())); + m_inactivatedNetListWidget->addItem(m_hiddenItem); + m_inactivatedNetListWidget->setItemWidget(m_hiddenItem, m_hiddenWlanWidget); + return; +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/wlanpage.h b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/wlanpage.h new file mode 100644 index 00000000..2456259e --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tab-pages/wlanpage.h @@ -0,0 +1,177 @@ +#ifndef WLANPAGE_H +#define WLANPAGE_H + +#include "tabpage.h" +#include "kywirelessnetresource.h" +#include "kylinactiveconnectresource.h" +#include "kylinnetworkdeviceresource.h" +#include "kywirelessconnectoperation.h" +#include "wlanlistitem.h" +#include "wlanmoreitem.h" +#include "kylinconnectoperation.h" +#include +#include "netdetails/netdetail.h" +#include +#include "kylinactiveconnectresource.h" +#include "kywirelessnetresource.h" + +//#define SCROLLAREA_HEIGHT 150 +#define MORE_TEXT_MARGINS 16,0,0,0 +#define SCROLLAREA_HEIGHT 200 + +class WlanListItem; + +class WlanPage : public TabPage +{ + Q_OBJECT +public: + explicit WlanPage(QWidget *parent = nullptr); + ~WlanPage() = default; + +// //for dbus +// void getWirelessList(QMap > &map); +// //开启热点 +// void activeWirelessAp(const QString apName, const QString apPassword, const QString wirelessBand, const QString apDevice); +// //断开热点 +// void deactiveWirelessAp(const QString apName, const QString uuid); +// //获取热点 +// void getStoredApInfo(QStringList &list); + +// void activateWirelessConnection(const QString& devName, const QString& ssid); +// void deactivateWirelessConnection(const QString& devName, const QString& ssid); + +// void getApInfoBySsid(QString devName, QString ssid, QStringList &list); +// //无线总开关 +// void setWirelessSwitchEnable(bool enable); +// void getWirelessDeviceCap(QMap &map); + + void getConnectivity(KyConnectivity &connectivity); + bool wlanIsConnected(); + void showDetailPage(QString devName, QString uuid); + +Q_SIGNALS: + void oneItemExpanded(const QString &ssid); +// void wlanAdd(QString devName, QStringList info); +// void wlanRemove(QString devName,QString ssid); +// void wlanActiveConnectionStateChanged(QString interface, QString ssid, QString uuid, int status); +// void hotspotDeactivated(QString devName, QString ssid); +// void hotspotActivated(QString devName, QString ssid, QString uuid); +// void signalStrengthChange(QString devName, QString ssid, int strength); +// void secuTypeChange(QString devName, QString ssid, QString secuType); + void hiddenWlanClicked(); +// void wlanConnectChanged(int state); + void timeToUpdate(); + + void showMainWindow(); + + void connectivityChanged(KyConnectivity connectivity); + +public Q_SLOTS: + void onMainWindowVisibleChanged(const bool &visible); + void onSecurityTypeChange(QString devName, QString ssid, QString secuType); + void requestScan(); + void onWlanPageVisibleChanged(int index); + +private Q_SLOTS: + void onWlanAdded(QString interface, KyWirelessNetItem &item); + void onWlanRemoved(QString interface, QString ssid); + + void onConnectionAdd(QString deviceName, QString ssid); + void onConnectionRemove(QString deviceName, QString ssid); + + void onDeviceAdd(QString deviceName); + void onDeviceRemove(QString deviceName); + void onDeviceNameUpdate(QString oldName, QString newName); + + void onConnectionStateChanged(QString deviceName, QString ssid, QString uuid, KyConnectState state); + void onItemHeightChanged(const bool isExpanded, const QString &ssid); + + void onWlanSwitchClicked(); + void onWlanSwithGsettingsChanged(const QString &key); + + void onDeviceComboxIndexChanged(int currentIndex); + void onHiddenWlanClicked(); + void showControlCenter(); + void onWifiEnabledChanged(bool isWifiOn); + void onRefreshIconTimer(); + +protected: + bool eventFilter(QObject *watched, QEvent *event); + +private: + //定时触发扫描的定时器 + void initTimer(); + void initWlanUI(); + void initDevice();//初始化默认设备 + void initDeviceCombox(); + void initWlanSwitchState(); + void initWlanArea(); + void addWlanMoreItem(); + + void showNonePwd(); + + QListWidgetItem *addEmptyItem(QListWidget *wirelessListWidget); + QListWidgetItem *addNewItem(KyWirelessNetItem &wirelessNetItem, + QListWidget *wirelessListWidget); + QListWidgetItem *insertNewItem(KyWirelessNetItem &wirelessNetItem, + QListWidget *wirelessListWidget, + int row); + QListWidgetItem *insertNewItemWithSort(KyWirelessNetItem &wirelessNetItem, + QListWidget *p_ListWidget); + + void clearWirelessNetItemMap(QMap &wirelessNetItem, + QListWidget *wirelessListWidget); + void deleteWirelessItemFormMap(QMap &wirelessNetItemMap, + QListWidget *wirelessListWidget, QString ssid); + + void updateWlanItemState(QListWidget *p_wirelessListWidget, + QListWidgetItem *p_listWidgetItem, + KyConnectState state); + void updateWlanListItem(QString ssid); + void refreshActiveConnectionIcon(QString ssid, const int &signal); + + void constructWirelessNetArea(); + void constructActivateConnectionArea(); + + void updateActivatedArea(QString uuid, QString ssid, QString devName); + void updateWirelessNetArea(QString uuid, QString ssid, QString devName); + + void addDeviceToCombox(QString deviceName); + void deleteDeviceFromCombox(QString deviceName); + void updateDeviceForCombox(QString oldDeviceName, QString newDeviceName); + +// void sendApStateChangeSignal(QString uuid, QString ssid, QString deviceName, +// NetworkManager::ActiveConnection::State state); + void wlanShowNotify(QString ssid, KyConnectState state); + +private: + QMap m_wirelessNetItemMap; + QMap m_activateConnectionItemMap; + + QListWidgetItem *m_expandedItem = nullptr; + + WlanMoreItem *m_hiddenWlanWidget = nullptr; + QListWidgetItem *m_hiddenItem = nullptr; + + QListWidget *m_activatedNetListWidget = nullptr; + QListWidget *m_inactivatedNetListWidget = nullptr; + + QStringList m_devList; + QString m_currentDevice; + + KyWirelessNetResource *m_wirelessNetResource = nullptr; + KyActiveConnectResourse *m_activatedConnectResource = nullptr; + KyNetworkDeviceResourse *m_netDeviceResource = nullptr; + KyWirelessConnectOperation * m_wirelessConnectOpreation = nullptr; + KyConnectResourse *m_connectResource = nullptr; + + QGSettings *m_switchGsettings = nullptr; + bool m_wlanSwitchEnable = true; + + bool m_updateStrength = true; + + QTimer *m_scanTimer = nullptr; + QTimer *m_refreshIconTimer = nullptr; +}; + +#endif // WLANPAGE_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/divider.cpp b/kylin-nm-gui/kylin-nm-main/frontend/tools/divider.cpp new file mode 100644 index 00000000..f82fba9a --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/divider.cpp @@ -0,0 +1,23 @@ +#include "divider.h" +#include +#include + +Divider::Divider(QWidget * parent) : QFrame(parent) +{ + this->setFixedHeight(1); +} + + + +void Divider::paintEvent(QPaintEvent * e) +{ + QPainter p(this); + QColor color = qApp->palette().color(QPalette::BrightText); + color.setAlphaF(0.08); + p.save(); + p.setBrush(color); + p.setPen(Qt::transparent); + p.drawRoundedRect(this->rect(), 6, 6); + p.restore(); + return QFrame::paintEvent(e); +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/divider.h b/kylin-nm-gui/kylin-nm-main/frontend/tools/divider.h new file mode 100644 index 00000000..e22a6392 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/divider.h @@ -0,0 +1,15 @@ +#ifndef DIVIDER_H +#define DIVIDER_H +#include + +class Divider : public QFrame +{ +public: + Divider(QWidget * parent = nullptr); + ~Divider() = default; + +protected: + void paintEvent(QPaintEvent *event); +}; + +#endif // DIVIDER_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/infobutton.cpp b/kylin-nm-gui/kylin-nm-main/frontend/tools/infobutton.cpp new file mode 100644 index 00000000..0dd16cd8 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/infobutton.cpp @@ -0,0 +1,93 @@ +#include "infobutton.h" +#include +#include +#include + +#define BUTTON_SIZE 36,36 +#define ICON_SIZE 16,16 +#define BACKGROUND_COLOR QColor(0,0,0,0) +#define FOREGROUND_COLOR_NORMAL qApp->palette().text().color() +#define FOREGROUND_COLOR_HOVER QColor(55,144,250,255) +#define FOREGROUND_COLOR_PRESS QColor(36,109,212,255) +#define OUTER_PATH 8,8,16,16 +#define INNER_PATH 9,9,14,14 +#define TEXT_POS 14,5,16,16,0 + +#define BUTTON_SIZE 36,36 + +InfoButton::InfoButton(QWidget *parent) : QPushButton(parent) +{ + this->setFixedSize(BUTTON_SIZE); + initUI(); + connect(qApp, &QApplication::paletteChanged, this, &InfoButton::onPaletteChanged); +} + +void InfoButton::initUI() +{ + this->setFixedSize(BUTTON_SIZE); + m_backgroundColor = BACKGROUND_COLOR; + m_foregroundColor = FOREGROUND_COLOR_NORMAL; +} + +void InfoButton::onPaletteChanged() +{ + m_foregroundColor = FOREGROUND_COLOR_NORMAL; + this->repaint(); +} + +void InfoButton::paintEvent(QPaintEvent *event) +{ + QPalette pal = this->palette(); + pal.setColor(QPalette::Base, m_backgroundColor); + pal.setColor(QPalette::Text, m_foregroundColor); + + QPainterPath cPath; + cPath.addRect(0, 0, ICON_SIZE); + cPath.addEllipse(0, 0, ICON_SIZE); + + QPainterPath outerPath; + outerPath.addEllipse(OUTER_PATH); + + QPainterPath innerPath; + innerPath.addEllipse(INNER_PATH); + outerPath -= innerPath; + + QPainter painter(this); + painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿 + painter.setPen(Qt::NoPen); + + painter.setBrush(pal.color(QPalette::Base)); + painter.drawPath(cPath); + + painter.fillPath(outerPath, pal.color(QPalette::Text)); + painter.setPen(m_foregroundColor); + QFont font("Noto Sans CJK SC", 11, QFont::Normal, false); + painter.setFont(font); + painter.drawText(TEXT_POS, "i"); +} + +void InfoButton::enterEvent(QEvent *event) +{ + m_foregroundColor = FOREGROUND_COLOR_HOVER; + this->update(); +} + +void InfoButton::leaveEvent(QEvent *event) +{ + m_foregroundColor = FOREGROUND_COLOR_NORMAL; + this->update(); +} + +void InfoButton::mousePressEvent(QMouseEvent *event) +{ + m_foregroundColor = FOREGROUND_COLOR_PRESS; + this->update(); + return QPushButton::mousePressEvent(event); +} + +void InfoButton::mouseReleaseEvent(QMouseEvent *event) +{ + m_foregroundColor = FOREGROUND_COLOR_HOVER; + this->update(); + return QPushButton::mouseReleaseEvent(event); +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/infobutton.h b/kylin-nm-gui/kylin-nm-main/frontend/tools/infobutton.h new file mode 100644 index 00000000..443c0c2b --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/infobutton.h @@ -0,0 +1,31 @@ +#ifndef INFOBUTTON_H +#define INFOBUTTON_H +#include +#include + +class InfoButton : public QPushButton +{ + Q_OBJECT +public: + explicit InfoButton(QWidget * parent = nullptr); + ~InfoButton() = default; + +protected: + void paintEvent(QPaintEvent *event); + void enterEvent(QEvent *event); + void leaveEvent(QEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + +private: + void initUI(); + +private: + QColor m_backgroundColor; + QColor m_foregroundColor; + +private Q_SLOTS: + void onPaletteChanged(); +}; + +#endif // INFOBUTTON_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/kylable.cpp b/kylin-nm-gui/kylin-nm-main/frontend/tools/kylable.cpp new file mode 100644 index 00000000..0c428a5d --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/kylable.cpp @@ -0,0 +1,97 @@ +#include "kylable.h" +#include +#include +#include + +#define FOREGROUND_COLOR_NORMAL qApp->palette().text().color() + +static inline qreal mixQreal(qreal a, qreal b, qreal bias) +{ + return a + (b - a) * bias; +} + + +QColor mixColor(const QColor &c1, const QColor &c2, qreal bias) +{ + if (bias <= 0.0) { + return c1; + } + if (bias >= 1.0) { + return c2; + } + if (qIsNaN(bias)) { + return c1; + } + + qreal r = mixQreal(c1.redF(), c2.redF(), bias); + qreal g = mixQreal(c1.greenF(), c2.greenF(), bias); + qreal b = mixQreal(c1.blueF(), c2.blueF(), bias); + qreal a = mixQreal(c1.alphaF(), c2.alphaF(), bias); + + return QColor::fromRgbF(r, g, b, a); +} + +KyLable::KyLable(QWidget *parent) : QLabel(parent) +{ + connect(qApp, &QApplication::paletteChanged, this, &KyLable::onPaletteChanged); + onPaletteChanged(); +} + +void KyLable::onPaletteChanged() +{ + m_foregroundColor = FOREGROUND_COLOR_NORMAL; + this->repaint(); +} + +void KyLable::setPressColor() +{ + QColor hightlight = this->palette().color(QPalette::Active,QPalette::Highlight); + QColor mix = this->palette().color(QPalette::Active,QPalette::BrightText); + m_foregroundColor = mixColor(hightlight, mix, 0.05); +} + +void KyLable::setHoverColor() +{ + QColor hightlight = this->palette().color(QPalette::Active,QPalette::Highlight); + QColor mix = this->palette().color(QPalette::Active,QPalette::BrightText); + m_foregroundColor = mixColor(hightlight, mix, 0.2); +} + +void KyLable::setNormalColor() +{ + m_foregroundColor = FOREGROUND_COLOR_NORMAL; +} + +void KyLable::paintEvent(QPaintEvent *event) +{ + QPalette pal = this->palette(); + pal.setColor(QPalette::WindowText, m_foregroundColor); + this->setPalette(pal); + return QLabel::paintEvent(event); +} + +void KyLable::enterEvent(QEvent *event) +{ + setHoverColor(); + this->update(); +} + +void KyLable::leaveEvent(QEvent *event) +{ + setNormalColor(); + this->update(); +} + +void KyLable::mousePressEvent(QMouseEvent *event) +{ + setPressColor(); + this->update(); + return QLabel::mousePressEvent(event); +} + +void KyLable::mouseReleaseEvent(QMouseEvent *event) +{ + setHoverColor(); + this->update(); + return QLabel::mouseReleaseEvent(event); +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/kylable.h b/kylin-nm-gui/kylin-nm-main/frontend/tools/kylable.h new file mode 100644 index 00000000..cdc627d9 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/kylable.h @@ -0,0 +1,33 @@ +#ifndef KYLABLE_H +#define KYLABLE_H + +#include +#include + +class KyLable : public QLabel +{ + Q_OBJECT +public: + explicit KyLable(QWidget *parent = nullptr); + ~KyLable() = default; + +protected: + void paintEvent(QPaintEvent *event); + void enterEvent(QEvent *event); + void leaveEvent(QEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + +private: + QColor m_foregroundColor; + + void setPressColor(); + void setHoverColor(); + void setNormalColor(); + +private Q_SLOTS: + void onPaletteChanged(); + +}; + +#endif // KYLABLE_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/loadingdiv.cpp b/kylin-nm-gui/kylin-nm-main/frontend/tools/loadingdiv.cpp new file mode 100644 index 00000000..9e3b1f87 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/loadingdiv.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 + +#define FRAMESPEED 60 //帧与帧之间的间隔时间(ms) +#define ALLTIME 40*1000 //等待动画持续总时间 + +//加载动画控件'loadingGif' +LoadingDiv::LoadingDiv(QWidget *parent) : QWidget(parent) +{ + this->resize(480, 538); + + this->loadingGif = new QLabel(this); + this->loadingGif->resize(96, 96); + this->loadingGif->move(this->width()/2 - 96/2 + 41/2 - 40, this->height()/2 + 20); + this->loadingGif->show(); + + this->switchTimer = new QTimer(this); //QTimer对象,控制等待动画播放 + connect(switchTimer, SIGNAL(timeout()), this, SLOT(switchAnimStep())); + + this->raise(); + this->hide(); +} + +//加载动画控件'loadingGif' +void LoadingDiv::switchAnimStep() +{ + //另外一种加载方法 + QString qpmQss = ":/res/s/conning-b/"; + qpmQss.append(QString::number(this->currentPage)); + qpmQss.append(".png"); + loadingGif->setPixmap(QPixmap(qpmQss)); + loadingGif->setProperty("useIconHighlightEffect", true); + loadingGif->setProperty("iconHighlightEffectMode", true); + + this->currentPage --; + + if (this->currentPage < 1) { + this->currentPage = 12; //循环播放 + } + this->countCurrentTime += FRAMESPEED; + if (this->countCurrentTime >= ALLTIME) { + Q_EMIT this->toStopLoading(); //发出信号停止主界面和托盘区的等待动画 + } +} + +//开始播放动画 +void LoadingDiv::startLoading() +{ + this->currentPage = 12; + this->countCurrentTime = 0; + this->switchTimer->start(FRAMESPEED); + this->show(); +} + +//结束播放动画 +void LoadingDiv::stopLoading() +{ + this->switchTimer->stop(); + this->hide(); +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/loadingdiv.h b/kylin-nm-gui/kylin-nm-main/frontend/tools/loadingdiv.h new file mode 100644 index 00000000..f8ee9e30 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/loadingdiv.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 +#include +#include +#include +#include +#include + +class LoadingDiv : public QWidget +{ + Q_OBJECT +public: + explicit LoadingDiv(QWidget *parent = nullptr); + +Q_SIGNALS: + void toStopLoading(); + +public Q_SLOTS: + void switchAnimStep(); + void startLoading(); + void stopLoading(); + +private: + QLabel *loadingGif = nullptr; + QTimer *switchTimer = nullptr; + + int currentPage; + int countCurrentTime; +}; + +#endif // LOADINGDIV_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/radioitembutton.cpp b/kylin-nm-gui/kylin-nm-main/frontend/tools/radioitembutton.cpp new file mode 100644 index 00000000..3f1c1f58 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/radioitembutton.cpp @@ -0,0 +1,246 @@ +#include "radioitembutton.h" +#include +#include +#include +#include +#include +#define FLASH_SPEED 100 +#define TIMEOUT_TIMER 90*1000 +#define BUTTON_SIZE 36,36 +#define ICON_SIZE 16,16 +#define BACKGROUND_COLOR QColor(0,0,0,0) +#define FOREGROUND_COLOR_NORMAL_INACTIVE_LIGHT QColor(230,230,230,255) +#define FOREGROUND_COLOR_NORMAL_INACTIVE_DARK QColor(55,55,55,255) +#define FOREGROUND_COLOR_PRESS_INACTIVE_LIGHT QColor(217,217,217,255) +#define FOREGROUND_COLOR_PRESS_INACTIVE_DARK QColor(70,70,70,255) +#define FOREGROUND_COLOR_NORMAL_ACTIVE QColor(55,144,250,255) +#define FOREGROUND_COLOR_PRESS_ACTIVE QColor(36,109,212,255) + +RadioItemButton::RadioItemButton(QWidget *parent) : QPushButton(parent) +{ + this->setAutoFillBackground(false); + m_iconLabel = new QLabel(this); + + this->setFixedSize(BUTTON_SIZE); + m_iconLabel->setFixedSize(BUTTON_SIZE); + m_iconLabel->setAlignment(Qt::AlignCenter); + + setActive(false); + //JXJ_TODO loading动画 + connect(this, &RadioItemButton::requestStartLoading, this, &RadioItemButton::onLoadingStarted); + connect(this , &RadioItemButton::requestStopLoading, this, &RadioItemButton::onLoadingStopped); + connect(qApp, &QApplication::paletteChanged, this, &RadioItemButton::onPaletteChanged); +} + +RadioItemButton::~RadioItemButton() +{ + +} + +void RadioItemButton::startLoading() +{ + Q_EMIT this->requestStartLoading(); +} + +void RadioItemButton::stopLoading() +{ + Q_EMIT this->requestStopLoading(); +} +//设置图标 +void RadioItemButton::setButtonIcon(const QIcon &icon) +{ + if (icon.isNull()) { + return; + } + m_pixmap = icon.pixmap(ICON_SIZE); +// m_iconLabel->setPixmap(m_pixmap); +} +//显示默认图标 +void RadioItemButton::setDefaultPixmap() +{ + m_iconLabel->setPixmap(m_pixmap); +} +//根据连接状态更改图标颜色 +void RadioItemButton::setActive(const bool &isActive) +{ + m_isActivated = isActive; + refreshButtonIcon(); +} +void RadioItemButton::onLoadingStarted() +{ +#define ANIMATION_SPEED 0.5*1000 +#define START_ROTATION 0 +#define END_ROTATION 360 +#define ANIMATION_LOOP -1 //无限旋转 + if (!m_iconLabel) { + qWarning() << "Start loading failed, iconLabel is null pointer!" << Q_FUNC_INFO << __LINE__; + } + if (!m_animation) { + m_animation = new QVariantAnimation(m_iconLabel); + } + m_animation->setDuration(ANIMATION_SPEED); + m_animation->setStartValue(START_ROTATION); + m_animation->setEndValue(END_ROTATION); + m_animation->setLoopCount(ANIMATION_LOOP); + connect(m_animation, &QVariantAnimation::valueChanged, this, &RadioItemButton::onAnimationValueChanged); + m_animation->start(); +} + +void RadioItemButton::onLoadingStopped() +{ + if (!m_animation) { + qWarning() << "Stop loading failed, m_animation is null pointer!" << Q_FUNC_INFO << __LINE__; + return; + } else { + m_iconLabel->setPixmap(m_pixmap); + m_animation->stop(); + Q_EMIT this->animationStoped(); + } + +} + +void RadioItemButton::onPaletteChanged() +{ + refreshButtonIcon(); +} + +void RadioItemButton::onAnimationValueChanged(const QVariant& value) +{ + if (!m_iconLabel) { + return; + } + QTransform t; + t.rotate(value.toReal()); + m_iconLabel->setPixmap(QIcon(":/res/s/conning-a/1.png").pixmap(ICON_SIZE).transformed(t)); +} + +void RadioItemButton::paintEvent(QPaintEvent *event) +{ + QPalette pal = this->palette(); + pal.setColor(QPalette::Base, BACKGROUND_COLOR); + pal.setColor(QPalette::Text, m_backgroundColor); + + QPainterPath cPath; + cPath.addRect(0, 0, this->width(), this->height()); + cPath.addEllipse(0, 0, this->width(), this->width()); + + QPainterPath innerPath; + innerPath.addEllipse(0, 0, this->width(), this->width()); + + QPainter painter(this); + painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿 + painter.setPen(Qt::NoPen); + + painter.setBrush(pal.color(QPalette::Base)); + painter.drawPath(cPath); + + painter.fillPath(innerPath, pal.color(QPalette::Text)); +} + +void RadioItemButton::mousePressEvent(QMouseEvent *event) +{ + if (m_isActivated) { + m_backgroundColor = qApp->palette().highlight().color(); + } else { + m_backgroundColor = qApp->palette().brightText().color(); + m_backgroundColor.setAlphaF(0.21); + } + this->update(); + return QPushButton::mousePressEvent(event); +} + +void RadioItemButton::mouseReleaseEvent(QMouseEvent *event) +{ + if (m_isActivated) { + m_backgroundColor = qApp->palette().highlight().color(); + } else { + m_backgroundColor = qApp->palette().brightText().color(); + m_backgroundColor.setAlphaF(0.18); + } + this->update(); + return QPushButton::mouseReleaseEvent(event); +} + +void RadioItemButton::enterEvent(QEvent *event) +{ + if (m_isActivated) { + m_backgroundColor = qApp->palette().highlight().color(); + } else { + m_backgroundColor = qApp->palette().brightText().color(); + m_backgroundColor.setAlphaF(0.32); + } + this->update(); + return QPushButton::enterEvent(event); +} + +void RadioItemButton::leaveEvent(QEvent *event) +{ + if (m_isActivated) { + m_backgroundColor = qApp->palette().highlight().color(); + } else { + m_backgroundColor = qApp->palette().brightText().color(); + m_backgroundColor.setAlphaF(0.18); + } + this->update(); + return QPushButton::leaveEvent(event); +} + +void RadioItemButton::refreshButtonIcon() +{ + if (m_isActivated) { + m_backgroundColor = qApp->palette().highlight().color(); + m_iconLabel->setPixmap(loadSvg(m_pixmap, PixmapColor::WHITE)); + } else { + m_backgroundColor = qApp->palette().brightText().color(); + m_backgroundColor.setAlphaF(0.18); + if (qApp->palette().base().color().red() > MIDDLE_COLOR) { + m_iconLabel->setPixmap(m_pixmap); + } else { + m_iconLabel->setPixmap(loadSvg(m_pixmap, PixmapColor::WHITE)); + } + } + + return; +} + +const QPixmap RadioItemButton::loadSvg(const QPixmap &source, const PixmapColor &cgColor) +{ + QImage img = source.toImage(); + for (int x = 0; x < img.width(); x++) { + for (int y = 0; y < img.height(); y++) { + auto color = img.pixelColor(x, y); + if (color.alpha() > 0) { + switch (cgColor) { + case PixmapColor::WHITE: + color.setRed(255); + color.setGreen(255); + color.setBlue(255); + img.setPixelColor(x, y, color); + break; + case PixmapColor::BLACK: + color.setRed(0); + color.setGreen(0); + color.setBlue(0); + img.setPixelColor(x, y, color); + break; + case PixmapColor::GRAY: + color.setRed(152); + color.setGreen(163); + color.setBlue(164); + img.setPixelColor(x, y, color); + break; + case PixmapColor::BLUE: + color.setRed(61); + color.setGreen(107); + color.setBlue(229); + img.setPixelColor(x, y, color); + break; + default: + return source; + break; + } + } + } + } + return QPixmap::fromImage(img); +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/radioitembutton.h b/kylin-nm-gui/kylin-nm-main/frontend/tools/radioitembutton.h new file mode 100644 index 00000000..ab757d72 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/radioitembutton.h @@ -0,0 +1,61 @@ +#ifndef NETBUTTON_H +#define NETBUTTON_H +#include +#include +#include +#include +#include + +#define MIDDLE_COLOR 178 + +class RadioItemButton : public QPushButton +{ + Q_OBJECT + +public: + RadioItemButton(QWidget * parent = nullptr); + ~RadioItemButton(); + void startLoading(); + void stopLoading(); + void setButtonIcon(const QIcon &icon); + void setDefaultPixmap(); + void setActive(const bool &isActive); + enum PixmapColor { + WHITE = 0, + BLACK, + GRAY, + BLUE, + }; + const QPixmap loadSvg(const QPixmap &source, const PixmapColor &color); + +Q_SIGNALS: + void requestStartLoading(); + void requestStopLoading(); + void animationStoped(); + +protected: + void paintEvent(QPaintEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void enterEvent(QEvent *event); + void leaveEvent(QEvent *event); + +private: + bool m_isActivated = false; + QLabel * m_iconLabel = nullptr; + QColor m_backgroundColor; + QVariantAnimation * m_animation = nullptr; + + QPixmap m_pixmap; + + void refreshButtonIcon(); + +private Q_SLOTS: + void onLoadingStarted(); + void onLoadingStopped(); + void onPaletteChanged(); + void onAnimationValueChanged(const QVariant& value); +}; + +#endif // NETBUTTON_H + diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/switchbutton.cpp b/kylin-nm-gui/kylin-nm-main/frontend/tools/switchbutton.cpp new file mode 100644 index 00000000..c3cc8f6f --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/switchbutton.cpp @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 setInterval(5); + + if(m_bIsOn == 1) { + m_fCurrentValue = m_fWidth - 16 - 4; + } + else { + m_fCurrentValue = 4; + } + connect(m_cTimer, SIGNAL(timeout()), this, SLOT(startAnimation())); + + +} + +void SwitchButton::setSwitchStatus(bool check) { + if (!m_enabled) + return; + + if(check == true) { + m_bIsOn = 1; + } else { + m_bIsOn = 0; + } + + Q_EMIT this->switchStatusChanged(); + + m_cTimer->start(); //开始播放动画 +} + +bool SwitchButton::getSwitchStatus() +{ + if (m_bIsOn == 1) + return true; + return false; +} + +void SwitchButton::setEnabled(bool enabled) +{ + m_enabled = enabled; + update(); + + return; +} + +bool SwitchButton::getEnabled() +{ + return m_enabled; +} +/* 播放按钮开启关闭动画 */ +void SwitchButton::startAnimation() { //滑动按钮动作播放 + int pos = 4; + int size = m_fWidth - 16; + if(m_bIsOn) { + m_fCurrentValue ++; //往右滑动 + if(m_fCurrentValue >= size - pos) { //到达边界停下来 + m_fCurrentValue = size - pos; + m_cTimer->stop(); + } + } else { + m_fCurrentValue --; + if(m_fCurrentValue <= pos) { //到达最小值,停止继续前进 + m_fCurrentValue = pos; + m_cTimer->stop(); + } + } + update(); +} + +/* 按钮按下处理 */ +void SwitchButton::mousePressEvent(QMouseEvent *event) { + Q_UNUSED(event); + + if (m_enabled) { + m_bIsOn = !m_bIsOn; + } + Q_EMIT clicked(); + return QWidget::mousePressEvent(event); +} + +void SwitchButton::enterEvent(QEvent *event) +{ + if (m_enabled && m_bIsOn) { + m_colorActive = COLOR_ACTIVE_HOVER; + } else if (m_enabled && !m_bIsOn) { + m_colorInactive = COLOR_INACTIVE_HOVER; + } + + this->update(); + + return QWidget::enterEvent(event); +} + +void SwitchButton::leaveEvent(QEvent *event) +{ + if (m_enabled && m_bIsOn) { + m_colorActive = COLOR_ACTIVE; + } else if (m_enabled && !m_bIsOn) { + m_colorInactive = COLOR_INACTIVE; + } + + this->update(); + + return QWidget::leaveEvent(event); +} + +/* 绘制滑动按钮主体 */ +void SwitchButton::paintEvent(QPaintEvent *event) { + Q_UNUSED(event); + QPainter painter(this); + painter.setRenderHint(QPainter::SmoothPixmapTransform); + painter.setRenderHint(QPainter::Antialiasing); //抗锯齿效果 + painter.setPen(Qt::NoPen); + if(m_bIsOn && m_enabled) { + painter.save(); + painter.setBrush(m_colorActive); + QRectF active_rect = QRectF(0,0,m_fWidth,m_fHeight); + painter.drawRoundedRect(active_rect, 0.5 * m_fHeight, 0.5 * m_fHeight); //画开启状态 + } else { + painter.save(); + painter.setBrush(m_colorInactive); + QRectF inactive_rect = QRectF(0 ,0,m_fWidth,m_fHeight); + painter.drawRoundedRect(inactive_rect, 0.5 * m_fHeight, 0.5 * m_fHeight); //画关闭状态 + } + painter.restore(); + painter.save(); + if (!m_enabled) { + painter.setBrush(COLOR_UNABLE); +// QRectF enableRect = QRectF(30, 10, 8, 4); +// painter.drawRoundedRect(enableRect, 2, 2); + } else { + painter.setBrush(Qt::white); + } + painter.drawEllipse(m_fCurrentValue,4, 16, 16); + + painter.restore(); +} + diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/switchbutton.h b/kylin-nm-gui/kylin-nm-main/frontend/tools/switchbutton.h new file mode 100644 index 00000000..fea1e480 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/switchbutton.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 +#include +#include +#include + +class SwitchButton : public QWidget +{ + Q_OBJECT +public: + explicit SwitchButton(QWidget *parent = nullptr); + void setSwitchStatus(bool check); + bool getSwitchStatus(); + void setEnabled(bool enabled); + bool getEnabled(); + +private: + QColor m_colorActive; + QColor m_colorInactive; + int m_bIsOn = 1; + QTimer *m_cTimer; + float m_fWidth; + float m_fHeight; + float m_fCurrentValue; + void paintEvent(QPaintEvent *event); + void mousePressEvent(QMouseEvent *event); + void enterEvent(QEvent *event); + void leaveEvent(QEvent *event); + bool m_enabled = true; + +Q_SIGNALS: + void clicked(); + void switchStatusChanged(); + +private Q_SLOTS: + void startAnimation(); + +}; + +#endif // SWITCHBUTTON_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/tools/tools.pri b/kylin-nm-gui/kylin-nm-main/frontend/tools/tools.pri new file mode 100644 index 00000000..7863428b --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/tools/tools.pri @@ -0,0 +1,18 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/divider.h \ + $$PWD/infobutton.h \ + $$PWD/loadingdiv.h \ + $$PWD/radioitembutton.h \ + $$PWD/switchbutton.h \ + $$PWD/kylable.h + + +SOURCES += \ + $$PWD/divider.cpp \ + $$PWD/infobutton.cpp \ + $$PWD/loadingdiv.cpp \ + $$PWD/radioitembutton.cpp \ + $$PWD/switchbutton.cpp \ + $$PWD/kylable.cpp diff --git a/kylin-nm-gui/kylin-nm-main/frontend/wificonfigdialog.ui b/kylin-nm-gui/kylin-nm-main/frontend/wificonfigdialog.ui new file mode 100644 index 00000000..e608614c --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/wificonfigdialog.ui @@ -0,0 +1,140 @@ + + + WiFiConfigDialog + + + + 0 + 0 + 474 + 320 + + + + Dialog + + + + + 60 + 30 + 290 + 30 + + + + + + + + + + 60 + 140 + 90 + 30 + + + + + + + + + + 60 + 200 + 90 + 30 + + + + + + + + + + 190 + 140 + 240 + 30 + + + + + + + 190 + 200 + 241 + 30 + + + + + + + 220 + 260 + 96 + 36 + + + + + + + + + + 330 + 260 + 96 + 36 + + + + + + + + + + 60 + 80 + 121 + 30 + + + + + + + + + + 190 + 80 + 240 + 30 + + + + + + + 400 + 211 + 18 + 9 + + + + + + + + + + diff --git a/kylin-nm-gui/kylin-nm-main/frontend/xatom/xatom-helper.cpp b/kylin-nm-gui/kylin-nm-main/frontend/xatom/xatom-helper.cpp new file mode 100644 index 00000000..cf7b2936 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/xatom/xatom-helper.cpp @@ -0,0 +1,210 @@ +/* + * KWin Style UKUI + * + * Copyright (C) 2020, 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: Yue Lan + * + */ + +#include "xatom-helper.h" +#include +#include +#include +#include + +static XAtomHelper *global_instance = nullptr; + +XAtomHelper *XAtomHelper::getInstance() +{ + if(!global_instance) + global_instance = new XAtomHelper; + return global_instance; +} + +bool XAtomHelper::isFrameLessWindow(int winId) +{ + auto hints = getInstance()->getWindowMotifHint(winId); + if(hints.flags == MWM_HINTS_DECORATIONS && hints.functions == 1) { + return true; + } + return false; +} + +bool XAtomHelper::isWindowDecorateBorderOnly(int winId) +{ + return isWindowMotifHintDecorateBorderOnly(getInstance()->getWindowMotifHint(winId)); +} + +bool XAtomHelper::isWindowMotifHintDecorateBorderOnly(const MotifWmHints &hint) { + bool isDeco = false; + if(hint.flags & MWM_HINTS_DECORATIONS && hint.flags != MWM_HINTS_DECORATIONS) { + if(hint.decorations == MWM_DECOR_BORDER) + isDeco = true; + } + return isDeco; +} + +bool XAtomHelper::isUKUICsdSupported() +{ + // fixme: + return false; +} + +bool XAtomHelper::isUKUIDecorationWindow(int winId) +{ + if(m_ukuiDecorationAtion == None) + return false; + + Atom type; + int format; + ulong nitems; + ulong bytes_after; + uchar *data; + + bool isUKUIDecoration = false; + + XGetWindowProperty(QX11Info::display(), winId, m_ukuiDecorationAtion, + 0, LONG_MAX, false, + m_ukuiDecorationAtion, &type, + &format, &nitems, + &bytes_after, &data); + + if(type == m_ukuiDecorationAtion) { + if(nitems == 1) { + isUKUIDecoration = data[0]; + } + } + + return isUKUIDecoration; +} + +UnityCorners XAtomHelper::getWindowBorderRadius(int winId) +{ + UnityCorners corners; + + Atom type; + int format; + ulong nitems; + ulong bytes_after; + uchar *data; + + if(m_unityBorderRadiusAtom != None) { + XGetWindowProperty(QX11Info::display(), winId, m_unityBorderRadiusAtom, + 0, LONG_MAX, false, + XA_CARDINAL, &type, + &format, &nitems, + &bytes_after, &data); + + if(type == XA_CARDINAL) { + if(nitems == 4) { + corners.topLeft = static_cast(data[0]); + corners.topRight = static_cast(data[1 * sizeof(ulong)]); + corners.bottomLeft = static_cast(data[2 * sizeof(ulong)]); + corners.bottomRight = static_cast(data[3 * sizeof(ulong)]); + } + XFree(data); + } + } + + return corners; +} + +void XAtomHelper::setWindowBorderRadius(int winId, const UnityCorners &data) +{ + if(m_unityBorderRadiusAtom == None) + return; + + ulong corners[4] = {data.topLeft, data.topRight, data.bottomLeft, data.bottomRight}; + + XChangeProperty(QX11Info::display(), winId, m_unityBorderRadiusAtom, XA_CARDINAL, + 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof(corners) / sizeof(corners[0])); +} + +void XAtomHelper::setWindowBorderRadius(int winId, int topLeft, int topRight, int bottomLeft, int bottomRight) +{ + if(m_unityBorderRadiusAtom == None) + return; + + ulong corners[4] = {(ulong)topLeft, (ulong)topRight, (ulong)bottomLeft, (ulong)bottomRight}; + + XChangeProperty(QX11Info::display(), winId, m_unityBorderRadiusAtom, XA_CARDINAL, + 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof(corners) / sizeof(corners[0])); +} + +void XAtomHelper::setUKUIDecoraiontHint(int winId, bool set) +{ + if(m_ukuiDecorationAtion == None) + return; + + XChangeProperty(QX11Info::display(), winId, m_ukuiDecorationAtion, m_ukuiDecorationAtion, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &set, 1); +} + +void XAtomHelper::setWindowMotifHint(int winId, const MotifWmHints &hints) +{ + if(m_unityBorderRadiusAtom == None) + return; + + XChangeProperty(QX11Info::display(), winId, m_motifWMHintsAtom, m_motifWMHintsAtom, + 32, XCB_PROP_MODE_REPLACE, (const unsigned char *)&hints, sizeof(MotifWmHints) / sizeof(ulong)); +} + +MotifWmHints XAtomHelper::getWindowMotifHint(int winId) +{ + MotifWmHints hints; + + if(m_unityBorderRadiusAtom == None) + return hints; + + uchar *data; + Atom type; + int format; + ulong nitems; + ulong bytes_after; + + XGetWindowProperty(QX11Info::display(), winId, m_motifWMHintsAtom, + 0, sizeof(MotifWmHints) / sizeof(long), false, AnyPropertyType, &type, + &format, &nitems, &bytes_after, &data); + + if(type == None) { + return hints; + } else { + hints = *(MotifWmHints *)data; + XFree(data); + } + return hints; +} + +XAtomHelper::XAtomHelper(QObject *parent) : QObject(parent) +{ + if(!QX11Info::isPlatformX11()) + return; + + m_motifWMHintsAtom = XInternAtom(QX11Info::display(), "_MOTIF_WM_HINTS", true); + m_unityBorderRadiusAtom = XInternAtom(QX11Info::display(), "_UNITY_GTK_BORDER_RADIUS", false); + m_ukuiDecorationAtion = XInternAtom(QX11Info::display(), "_KWIN_UKUI_DECORAION", false); +} + +Atom XAtomHelper::registerUKUICsdNetWmSupportAtom() +{ + // fixme: + return None; +} + +void XAtomHelper::unregisterUKUICsdNetWmSupportAtom() +{ + // fixme: +} diff --git a/kylin-nm-gui/kylin-nm-main/frontend/xatom/xatom-helper.h b/kylin-nm-gui/kylin-nm-main/frontend/xatom/xatom-helper.h new file mode 100644 index 00000000..87272454 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/xatom/xatom-helper.h @@ -0,0 +1,110 @@ +/* + * KWin Style UKUI + * + * Copyright (C) 2020, 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: Yue Lan + * + */ + +#ifndef XATOMHELPER_H +#define XATOMHELPER_H + +#include +#include +#include + +struct UnityCorners { + ulong topLeft = 0; + ulong topRight = 0; + ulong bottomLeft = 0; + ulong bottomRight = 0; +}; + +typedef struct { + ulong flags = 0; + ulong functions = 0; + ulong decorations = 0; + long input_mode = 0; + ulong status = 0; +} MotifWmHints, MwmHints; + +#define MWM_HINTS_FUNCTIONS (1L << 0) +#define MWM_HINTS_DECORATIONS (1L << 1) +#define MWM_HINTS_INPUT_MODE (1L << 2) +#define MWM_HINTS_STATUS (1L << 3) + +#define MWM_FUNC_ALL (1L << 0) +#define MWM_FUNC_RESIZE (1L << 1) +#define MWM_FUNC_MOVE (1L << 2) +#define MWM_FUNC_MINIMIZE (1L << 3) +#define MWM_FUNC_MAXIMIZE (1L << 4) +#define MWM_FUNC_CLOSE (1L << 5) + +#define MWM_DECOR_ALL (1L << 0) +#define MWM_DECOR_BORDER (1L << 1) +#define MWM_DECOR_RESIZEH (1L << 2) +#define MWM_DECOR_TITLE (1L << 3) +#define MWM_DECOR_MENU (1L << 4) +#define MWM_DECOR_MINIMIZE (1L << 5) +#define MWM_DECOR_MAXIMIZE (1L << 6) + +#define MWM_INPUT_MODELESS 0 +#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 +#define MWM_INPUT_SYSTEM_MODAL 2 +#define MWM_INPUT_FULL_APPLICATION_MODAL 3 +#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL + +#define MWM_TEAROFF_WINDOW (1L<<0) + +namespace UKUI { +class Decoration; +} + +class XAtomHelper : public QObject +{ + // friend class UKUI::Decoration; + Q_OBJECT +public: + static XAtomHelper *getInstance(); + + static bool isFrameLessWindow(int winId); + + static bool isWindowDecorateBorderOnly(int winId); + static bool isWindowMotifHintDecorateBorderOnly(const MotifWmHints &hint); + bool isUKUICsdSupported(); + bool isUKUIDecorationWindow(int winId); + + UnityCorners getWindowBorderRadius(int winId); + void setWindowBorderRadius(int winId, const UnityCorners &data); + void setWindowBorderRadius(int winId, int topLeft, int topRight, int bottomLeft, int bottomRight); + void setUKUIDecoraiontHint(int winId, bool set = true); + + void setWindowMotifHint(int winId, const MotifWmHints &hints); + MotifWmHints getWindowMotifHint(int winId); + +private: + explicit XAtomHelper(QObject *parent = nullptr); + + Atom registerUKUICsdNetWmSupportAtom(); + void unregisterUKUICsdNetWmSupportAtom(); + + Atom m_motifWMHintsAtom = None; + Atom m_unityBorderRadiusAtom = None; + Atom m_ukuiDecorationAtion = None; +}; + +#endif // XATOMHELPER_H diff --git a/kylin-nm-gui/kylin-nm-main/frontend/xatom/xatom.pri b/kylin-nm-gui/kylin-nm-main/frontend/xatom/xatom.pri new file mode 100644 index 00000000..2d5b1409 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/frontend/xatom/xatom.pri @@ -0,0 +1,7 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/xatom-helper.h \ + +SOURCES += \ + $$PWD/xatom-helper.cpp \ diff --git a/kylin-nm-gui/kylin-nm-main/kylin-nm-main.pro b/kylin-nm-gui/kylin-nm-main/kylin-nm-main.pro new file mode 100644 index 00000000..e35fb0ca --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/kylin-nm-main.pro @@ -0,0 +1,72 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2018-10-19T15:29:47 +# +#------------------------------------------------- + +QT += core gui x11extras dbus KWindowSystem svg concurrent network + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = kylin-nm +TEMPLATE = app + +CONFIG += c++14 qt warn_on link_pkgconfig +CONFIG += no_keywords +#CONFIG += release + +#PKGCONFIG +=gio-2.0 glib-2.0 gio-unix-2.0 libnm libnma libsecret-1 gtk+-3.0 gsettings-qt libcap +#PKGCONFIG +=libnm libnma libsecret-1 gsettings-qt libcap +PKGCONFIG +=gsettings-qt + +#INCLUDEPATH += /usr/include/KF5/NetworkManagerQt +INCLUDEPATH += /usr/include/kylin-nm +INCLUDEPATH += /usr/include/kylin-nm-depend + +LIBS += -L/usr/lib/ -lgsettings-qt -lX11 -lKF5NetworkManagerQt -lkylin-nm-base -lkylin-nm-external + +target.path = /usr/bin +target.source += $$TARGET +desktop.path = /etc/xdg/autostart/ +desktop.files = kylin-nm.desktop +gschema.files = org.ukui.kylin-nm.switch.gschema.xml +gschema.path = /usr/share/glib-2.0/schemas/ + +INSTALLS += target \ + desktop \ + gschema \ + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as 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 you use 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 + +# QMAKE_CXXFLAGS += -Wno-unused-parameter +QMAKE_CPPFLAGS *= $(shell dpkg-buildflags --get CPPFLAGS) +QMAKE_CFLAGS *= $(shell dpkg-buildflags --get CFLAGS) +QMAKE_CXXFLAGS *= $(shell dpkg-buildflags --get CXXFLAGS) +QMAKE_LFLAGS *= $(shell dpkg-buildflags --get LDFLAGS) + +include(singleapplication/qt-single-application.pri) +include(frontend/frontend.pri) + +RESOURCES += \ + ../nmqrc.qrc + +SOURCES += \ + main.cpp + +unix { + UI_DIR = .ui + MOC_DIR = .moc + OBJECTS_DIR = .obj +} + +DISTFILES += \ + org.ukui.kylin-nm.switch.gschema.xml diff --git a/kylin-nm-gui/kylin-nm-main/kylin-nm.desktop b/kylin-nm-gui/kylin-nm-main/kylin-nm.desktop new file mode 100644 index 00000000..849c402e --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/kylin-nm.desktop @@ -0,0 +1,18 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Kylin NM +Name[zh_CN]=麒麟网络设置工具 +Name[zh_HK]=麒麟網路設置工具 +Name[zh_TW]=麒麟網路設置工具 +Icon=gnome-dev-ethernet +Comment=Beautiful Network Config Applet +Comment[zh_CN]=麒麟网络设置工具,提供查看和简单设置功能,拥有美观的界面和舒适的操作. +Keywords=applet;nm;network;network-manager; +Exec=/usr/bin/kylin-nm +StartupNotify=false +Terminal=false +Type=Application +OnlyShowIn=UKUI +X-UKUI-AutoRestart=true +NoDisplay=true +X-UKUI-Autostart-Phase=Application diff --git a/kylin-nm-gui/kylin-nm-main/main.cpp b/kylin-nm-gui/kylin-nm-main/main.cpp new file mode 100644 index 00000000..36b5c8b1 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/main.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 +#include +#include "qt-single-application.h" +#include +#include +#include +#include +#include + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) +#include "xatom-helper.h" +#endif + +#define LOG_IDENT "ukui_kylin_nm" + +const QString QT_TRANSLATE_FILE = "/usr/share/qt5/translations/qt_zh_CN.qm"; + +void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) +{ + QByteArray localMsg = msg.toLocal8Bit(); + QByteArray currentTime = QTime::currentTime().toString().toLocal8Bit(); + + bool showDebug = true; + QString logFilePath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.config/ukui/kylin-nm.log"; + //若不需要自动创建日志文件,请放开此注释 +// if (!QFile::exists(logFilePath)) { +// showDebug = false; +// } + FILE *log_file = nullptr; + + if (showDebug) { + log_file = fopen(logFilePath.toLocal8Bit().constData(), "a+"); + } + + const char *file = context.file ? context.file : ""; + const char *function = context.function ? context.function : ""; + switch (type) { + case QtDebugMsg: + if (!log_file) { + break; + } + fprintf(log_file, "Debug: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); + break; + case QtInfoMsg: + fprintf(log_file? log_file: stdout, "Info: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); + break; + case QtWarningMsg: + fprintf(log_file? log_file: stderr, "Warning: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); + break; + case QtCriticalMsg: + fprintf(log_file? log_file: stderr, "Critical: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); + break; + case QtFatalMsg: + fprintf(log_file? log_file: stderr, "Fatal: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); + break; + } + + if (log_file) + fclose(log_file); +} + +int main(int argc, char *argv[]) +{ + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); + +// QApplication a(argc, argv); + QString id = QString("kylin-nm"+ QLatin1String(getenv("DISPLAY"))); + QtSingleApplication a(id, argc, argv); + qInstallMessageHandler(messageOutput); + if (a.isRunning()) { + a.sendMessage("raise_window_noop"); + return EXIT_SUCCESS; + } + + QApplication::setQuitOnLastWindowClosed(false); + + KyNetworkManager kylinNetworkManager; + kylinNetworkManager.kylinNetworkManagerInit(); +// qWarning()<<"main thread id........................" <moveToThread(&thread); +// QObject::connect(&thread, SIGNAL(started()), p_networkResource, SLOT(onInitNetwork())); +// thread.start(); + + // Internationalization + QString locale = QLocale::system().name(); + QTranslator trans_global; + qDebug() << "QLocale " << QLocale(); + if (trans_global.load(QLocale(), "kylin-nm", "_", ":/translations/")) + { + a.installTranslator(&trans_global); + qDebug()<<"Translations load success"; + } else { + qWarning() << "Translations load fail"; + } + + QTranslator qtBaseTranslator; + if (qtBaseTranslator.load(QLocale(), "qt", "_", "/usr/share/qt5/translations/")){ + a.installTranslator(&qtBaseTranslator); + qDebug()<<"QtBase Translations load success"; + } else { + qWarning() << "QtBase Translations load fail"; + } + +// while (!p_networkResource->NetworkManagerIsInited()) { +// ::usleep(1000); +// } + + MainWindow w; + a.setActivationWindow(&w); + w.setProperty("useStyleWindowManager", false); //禁用拖动 + //设置窗口无边框,阴影 + + MotifWmHints window_hints; + window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; + window_hints.functions = MWM_FUNC_ALL; + window_hints.decorations = MWM_DECOR_BORDER; + XAtomHelper::getInstance()->setWindowMotifHint(w.winId(), window_hints); + +// w.setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint); + + +// DbusAdaptor adaptor(&w); +// Q_UNUSED(adaptor); + +// auto connection = QDBusConnection::sessionBus(); +// if (!connection.registerService("com.kylin.network") || !connection.registerObject("/com/kylin/network", &w)) { +// qCritical() << "QDbus register service failed reason:" << connection.lastError(); +// } + + return a.exec(); +} diff --git a/kylin-nm-gui/kylin-nm-main/singleapplication/qt-local-peer.cpp b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-local-peer.cpp new file mode 100644 index 00000000..4a62537c --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-local-peer.cpp @@ -0,0 +1,205 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies) +** 2020 KylinSoft Co., Ltd. +** 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 "qt-local-peer.h" +#include +#include +#include + +#if defined(Q_OS_UNIX) +#include +#include +#include +#endif + +namespace QtLP_Private { +#include "qt-locked-file.cpp" +#include "qt-locked-file-unix.cpp" +} + +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"); //tmp目录下的锁文件 + 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; + + //由于文件锁的存在,仅当本进程第一次启动时能执行到此并使server进行监听和关联槽函数 + 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, &QLocalServer::newConnection, this, &QtLocalPeer::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; +} + +/** + * @brief QtLocalPeer::receiveConnection 当新进程启动时,会尝试连接此进程server,server接收到newConnection信号并触发此槽函数 + */ +void QtLocalPeer::receiveConnection() { + QLocalSocket* socket = server->nextPendingConnection(); //获取新进程的socket + 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); //获取新进程的启动信息并作为信号发送给前端 +} diff --git a/kylin-nm-gui/kylin-nm-main/singleapplication/qt-local-peer.h b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-local-peer.h new file mode 100644 index 00000000..883aec2a --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-local-peer.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies) +** 2020 KylinSoft Co., Ltd. +** 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 "qt-locked-file.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 diff --git a/kylin-nm-gui/kylin-nm-main/singleapplication/qt-locked-file-unix.cpp b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-locked-file-unix.cpp new file mode 100644 index 00000000..51472520 --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-locked-file-unix.cpp @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies) +** 2020 KylinSoft Co., Ltd. +** 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 "qt-locked-file.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(); +} + diff --git a/kylin-nm-gui/kylin-nm-main/singleapplication/qt-locked-file.cpp b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-locked-file.cpp new file mode 100644 index 00000000..707b4cfa --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-locked-file.cpp @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies) +** 2020 KylinSoft Co., Ltd. +** 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 "qt-locked-file.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. +*/ diff --git a/kylin-nm-gui/kylin-nm-main/singleapplication/qt-locked-file.h b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-locked-file.h new file mode 100644 index 00000000..332d648e --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-locked-file.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies) +** 2020 KylinSoft Co., Ltd. +** 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 diff --git a/kylin-nm-gui/kylin-nm-main/singleapplication/qt-single-application.cpp b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-single-application.cpp new file mode 100644 index 00000000..b924430c --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-single-application.cpp @@ -0,0 +1,353 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies) +** 2020 KylinSoft Co., Ltd. +** 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 "qt-single-application.h" +#include "qt-local-peer.h" +#include +#include +#include +#include +#include +#include +#include "../mainwindow.h" + + +/*! + \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) { + m_activateWindow = 0; + m_peer = new QtLocalPeer(this, appId); + connect(m_peer, &QtLocalPeer::messageReceived, this, &QtSingleApplication::messageReceived); +} + + +/*! + 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 m_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 m_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 m_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(QWidget* aw, bool activateOnMessage) { + m_activateWindow = aw; + if (activateOnMessage) + connect(m_peer, &QtLocalPeer::messageReceived, this, &QtSingleApplication::activateWindow); + else + disconnect(m_peer, &QtLocalPeer::messageReceived, this, &QtSingleApplication::activateWindow); +} + + +/*! + Returns the applications activation window if one has been set by + calling setActivationWindow(), otherwise returns 0. + + \sa setActivationWindow() +*/ +QWidget* QtSingleApplication::activationWindow() const { + return m_activateWindow; +} + + +/*! + 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() { + if (m_activateWindow) { + if(this->applicationState() & Qt::ApplicationInactive) + { + MainWindow* w=qobject_cast(m_activateWindow); + w->showMainwindow(); + m_activateWindow->setWindowState(m_activateWindow->windowState() & ~Qt::WindowMinimized); + m_activateWindow->raise(); + m_activateWindow->showNormal(); + m_activateWindow->activateWindow(); + } + else { + m_activateWindow->setWindowState(m_activateWindow->windowState() & Qt::WindowMinimized); + m_activateWindow->hide(); + } + } +} + + +/*! + \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 +*/ diff --git a/kylin-nm-gui/kylin-nm-main/singleapplication/qt-single-application.h b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-single-application.h new file mode 100644 index 00000000..084b9b7c --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-single-application.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies) +** 2020 KylinSoft Co., Ltd. +** 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(QWidget* aw, bool activateOnMessage = true); + QWidget* 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 *m_peer; + QWidget *m_activateWindow; +}; + +#endif // QTSINGLEAPPLICATION_H diff --git a/kylin-nm-gui/kylin-nm-main/singleapplication/qt-single-application.pri b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-single-application.pri new file mode 100644 index 00000000..0a4ca9ae --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/singleapplication/qt-single-application.pri @@ -0,0 +1,27 @@ +INCLUDEPATH += $$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 += + HEADERS += +} + +win32 { + contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES += QT_QTSINGLEAPPLICATION_EXPORT + else:qtsingleapplication-uselib:DEFINES += QT_QTSINGLEAPPLICATION_IMPORT +} + +HEADERS += \ + $$PWD/qt-local-peer.h \ + $$PWD/qt-locked-file.h \ + $$PWD/qt-single-application.h + +SOURCES += \ + $$PWD/qt-local-peer.cpp \ + $$PWD/qt-locked-file-unix.cpp \ + $$PWD/qt-single-application.cpp \ + $$PWD/qt-locked-file.cpp diff --git a/kylin-nm-gui/kylin-nm-main/translations/kylin-nm_bo.qm b/kylin-nm-gui/kylin-nm-main/translations/kylin-nm_bo.qm new file mode 100644 index 00000000..be651eed --- /dev/null +++ b/kylin-nm-gui/kylin-nm-main/translations/kylin-nm_bo.qm @@ -0,0 +1 @@ + + + res/g/down_arrow.png + res/s/rescan/1.png + res/s/rescan/2.png + res/s/rescan/3.png + res/s/rescan/4.png + res/s/rescan/5.png + res/s/rescan/6.png + res/s/rescan/7.png + res/s/rescan/8.png + res/s/rescan/9.png + res/s/rescan/10.png + res/s/rescan/11.png + res/s/rescan/12.png + res/h/hide-pwd.png + res/h/right-pwd.png + res/h/show-pwd.png + res/h/no-pwd-wifi.png + translations/kylin-nm_bo.qm + translations/kylin-nm_tr.qm + translations/kylin-nm_zh_CN.qm + res/x/fly-mode-off.svg + res/x/fly-mode-on.svg + res/x/hot-spot-off.svg + res/x/hot-spot-on.svg + res/x/net-list-bg.svg + res/x/wifi-list-bg.svg + res/x/load-down.png + res/x/load-up.png + res/l/network-offline.png + res/l/network-offline.svg + res/l/network-online.png + res/l/network-online.svg + res/w/wifi-full.png + res/w/wifi-full-pwd.png + res/w/wifi-high.png + res/w/wifi-high-pwd.png + res/w/wifi-low.png + res/w/wifi-low-pwd.png + res/w/wifi-medium.png + res/w/wifi-medium-pwd.png + res/w/wifi-none.png + res/w/wifi-none-pwd.png + res/s/conning-a/1.png + res/s/conning-a/2.png + res/s/conning-a/3.png + res/s/conning-a/4.png + res/s/conning-a/5.png + res/s/conning-a/6.png + res/s/conning-a/7.png + res/s/conning-a/8.png + res/g/close_black.png + res/g/close_white.png + res/s/conning-s/1.png + res/s/conning-s/2.png + res/s/conning-s/3.png + res/s/conning-s/4.png + res/s/conning-s/5.png + res/s/conning-s/6.png + res/s/conning-s/7.png + res/s/conning-s/8.png + res/s/conning-s/9.png + res/s/conning-s/10.png + res/s/conning-s/11.png + res/s/conning-s/12.png + res/x/setup.png + res/x/control.svg + res/w/wifi6-full-pwd.png + res/w/wifi6-full.png + res/w/wifi6-high-pwd.png + res/w/wifi6-high.png + res/w/wifi6-low-pwd.png + res/w/wifi6-low.png + res/w/wifi6-medium-pwd.png + res/w/wifi6-medium.png + res/w/wifi6-none.png + res/w/wifi6+-none.png + res/w/wifi6+-meidum-pwd.png + res/w/wifi6+-medium.png + res/w/wifi6+-medium-pwd.png + res/w/wifi6+-low.png + res/w/wifi6+-low-pwd.png + res/w/wifi6+-high.png + res/w/wifi6+-high-pwd.png + res/w/wifi6+-full.png + res/w/wifi6+-full-pwd.png + res/w/wifi6-none-pwd.png + res/hw/wifi-full-pwd.png + res/hw/wifi-full.png + res/hw/wifi-high-pwd.png + res/hw/wifi-high.png + res/hw/wifi-low-pwd.png + res/hw/wifi-low.png + res/hw/wifi-medium-pwd.png + res/hw/wifi-medium.png + res/hw/wifi-none-pwd.png + res/hw/wifi-none.png + res/hw/wifi6-full-pwd.png + res/hw/wifi6-full.png + res/hw/wifi6-high-pwd.png + res/hw/wifi6-high.png + res/hw/wifi6-low-pwd.png + res/hw/wifi6-low.png + res/hw/wifi6-medium-pwd.png + res/hw/wifi6-medium.png + res/hw/wifi6-none-pwd.png + res/hw/wifi6-none.png + res/hw/wifi6+-full-pwd.png + res/hw/wifi6+-full.png + res/hw/wifi6+-high-pwd.png + res/hw/wifi6+-high.png + res/hw/wifi6+-low-pwd.png + res/hw/wifi6+-low.png + res/hw/wifi6+-medium-pwd.png + res/hw/wifi6+-medium.png + res/hw/wifi6+-none-pwd.png + res/hw/wifi6+-none.png + res/s/conning-b/1.png + res/s/conning-b/2.png + res/s/conning-b/3.png + res/s/conning-b/4.png + res/s/conning-b/5.png + res/s/conning-b/6.png + res/s/conning-b/7.png + res/s/conning-b/8.png + res/s/conning-b/9.png + res/s/conning-b/10.png + res/s/conning-b/11.png + res/s/conning-b/12.png + + diff --git a/kylin-nm-gui/res.qrc b/kylin-nm-gui/res.qrc new file mode 100644 index 00000000..7646d2b3 --- /dev/null +++ b/kylin-nm-gui/res.qrc @@ -0,0 +1 @@ + diff --git a/kylin-nm-gui/res/g/close_black.png b/kylin-nm-gui/res/g/close_black.png new file mode 100644 index 00000000..237e5552 Binary files /dev/null and b/kylin-nm-gui/res/g/close_black.png differ diff --git a/kylin-nm-gui/res/g/close_white.png b/kylin-nm-gui/res/g/close_white.png new file mode 100644 index 00000000..0943a4bb Binary files /dev/null and b/kylin-nm-gui/res/g/close_white.png differ diff --git a/kylin-nm-gui/res/g/down_arrow.png b/kylin-nm-gui/res/g/down_arrow.png new file mode 100644 index 00000000..c7a343b3 Binary files /dev/null and b/kylin-nm-gui/res/g/down_arrow.png differ diff --git a/kylin-nm-gui/res/h/hide-pwd.png b/kylin-nm-gui/res/h/hide-pwd.png new file mode 100644 index 00000000..c1d30447 Binary files /dev/null and b/kylin-nm-gui/res/h/hide-pwd.png differ diff --git a/kylin-nm-gui/res/h/no-pwd-wifi.png b/kylin-nm-gui/res/h/no-pwd-wifi.png new file mode 100644 index 00000000..dbec54a3 Binary files /dev/null and b/kylin-nm-gui/res/h/no-pwd-wifi.png differ diff --git a/kylin-nm-gui/res/h/right-pwd.png b/kylin-nm-gui/res/h/right-pwd.png new file mode 100644 index 00000000..1bbc00d1 Binary files /dev/null and b/kylin-nm-gui/res/h/right-pwd.png differ diff --git a/kylin-nm-gui/res/h/show-pwd.png b/kylin-nm-gui/res/h/show-pwd.png new file mode 100644 index 00000000..08c4de51 Binary files /dev/null and b/kylin-nm-gui/res/h/show-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi-full-pwd.png b/kylin-nm-gui/res/hw/wifi-full-pwd.png new file mode 100644 index 00000000..065f7f8e Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi-full-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi-full.png b/kylin-nm-gui/res/hw/wifi-full.png new file mode 100644 index 00000000..48024d04 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi-full.png differ diff --git a/kylin-nm-gui/res/hw/wifi-high-pwd.png b/kylin-nm-gui/res/hw/wifi-high-pwd.png new file mode 100644 index 00000000..81a4d11e Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi-high-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi-high.png b/kylin-nm-gui/res/hw/wifi-high.png new file mode 100644 index 00000000..3ec53052 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi-high.png differ diff --git a/kylin-nm-gui/res/hw/wifi-low-pwd.png b/kylin-nm-gui/res/hw/wifi-low-pwd.png new file mode 100644 index 00000000..784ad1b2 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi-low-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi-low.png b/kylin-nm-gui/res/hw/wifi-low.png new file mode 100644 index 00000000..3fe8bded Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi-low.png differ diff --git a/kylin-nm-gui/res/hw/wifi-medium-pwd.png b/kylin-nm-gui/res/hw/wifi-medium-pwd.png new file mode 100644 index 00000000..221fdbc1 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi-medium-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi-medium.png b/kylin-nm-gui/res/hw/wifi-medium.png new file mode 100644 index 00000000..3b1683f3 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi-medium.png differ diff --git a/kylin-nm-gui/res/hw/wifi-none-pwd.png b/kylin-nm-gui/res/hw/wifi-none-pwd.png new file mode 100644 index 00000000..109f19ee Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi-none-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi-none.png b/kylin-nm-gui/res/hw/wifi-none.png new file mode 100644 index 00000000..0a3bdd14 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi-none.png differ diff --git a/kylin-nm-gui/res/hw/wifi6+-full-pwd.png b/kylin-nm-gui/res/hw/wifi6+-full-pwd.png new file mode 100644 index 00000000..b2936c6f Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6+-full-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi6+-full.png b/kylin-nm-gui/res/hw/wifi6+-full.png new file mode 100644 index 00000000..faf2297d Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6+-full.png differ diff --git a/kylin-nm-gui/res/hw/wifi6+-high-pwd.png b/kylin-nm-gui/res/hw/wifi6+-high-pwd.png new file mode 100644 index 00000000..684d51f6 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6+-high-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi6+-high.png b/kylin-nm-gui/res/hw/wifi6+-high.png new file mode 100644 index 00000000..0ffb9ff9 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6+-high.png differ diff --git a/kylin-nm-gui/res/hw/wifi6+-low-pwd.png b/kylin-nm-gui/res/hw/wifi6+-low-pwd.png new file mode 100644 index 00000000..c2b8ece5 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6+-low-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi6+-low.png b/kylin-nm-gui/res/hw/wifi6+-low.png new file mode 100644 index 00000000..134cf766 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6+-low.png differ diff --git a/kylin-nm-gui/res/hw/wifi6+-medium-pwd.png b/kylin-nm-gui/res/hw/wifi6+-medium-pwd.png new file mode 100644 index 00000000..4e1c908f Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6+-medium-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi6+-medium.png b/kylin-nm-gui/res/hw/wifi6+-medium.png new file mode 100644 index 00000000..bb9d50dd Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6+-medium.png differ diff --git a/kylin-nm-gui/res/hw/wifi6+-none-pwd.png b/kylin-nm-gui/res/hw/wifi6+-none-pwd.png new file mode 100644 index 00000000..640ec001 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6+-none-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi6+-none.png b/kylin-nm-gui/res/hw/wifi6+-none.png new file mode 100644 index 00000000..fa20a4c2 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6+-none.png differ diff --git a/kylin-nm-gui/res/hw/wifi6-full-pwd.png b/kylin-nm-gui/res/hw/wifi6-full-pwd.png new file mode 100644 index 00000000..427b721e Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6-full-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi6-full.png b/kylin-nm-gui/res/hw/wifi6-full.png new file mode 100644 index 00000000..a4bcdcea Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6-full.png differ diff --git a/kylin-nm-gui/res/hw/wifi6-high-pwd.png b/kylin-nm-gui/res/hw/wifi6-high-pwd.png new file mode 100644 index 00000000..9458bb97 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6-high-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi6-high.png b/kylin-nm-gui/res/hw/wifi6-high.png new file mode 100644 index 00000000..8280cd0c Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6-high.png differ diff --git a/kylin-nm-gui/res/hw/wifi6-low-pwd.png b/kylin-nm-gui/res/hw/wifi6-low-pwd.png new file mode 100644 index 00000000..9b647b41 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6-low-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi6-low.png b/kylin-nm-gui/res/hw/wifi6-low.png new file mode 100644 index 00000000..5217b8dc Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6-low.png differ diff --git a/kylin-nm-gui/res/hw/wifi6-medium-pwd.png b/kylin-nm-gui/res/hw/wifi6-medium-pwd.png new file mode 100644 index 00000000..c157f572 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6-medium-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi6-medium.png b/kylin-nm-gui/res/hw/wifi6-medium.png new file mode 100644 index 00000000..a44f85a7 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6-medium.png differ diff --git a/kylin-nm-gui/res/hw/wifi6-none-pwd.png b/kylin-nm-gui/res/hw/wifi6-none-pwd.png new file mode 100644 index 00000000..6c2973e5 Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6-none-pwd.png differ diff --git a/kylin-nm-gui/res/hw/wifi6-none.png b/kylin-nm-gui/res/hw/wifi6-none.png new file mode 100644 index 00000000..7d41e1ce Binary files /dev/null and b/kylin-nm-gui/res/hw/wifi6-none.png differ diff --git a/kylin-nm-gui/res/l/network-offline.png b/kylin-nm-gui/res/l/network-offline.png new file mode 100644 index 00000000..a288fc32 Binary files /dev/null and b/kylin-nm-gui/res/l/network-offline.png differ diff --git a/kylin-nm-gui/res/l/network-offline.svg b/kylin-nm-gui/res/l/network-offline.svg new file mode 100644 index 00000000..ca9dcea3 --- /dev/null +++ b/kylin-nm-gui/res/l/network-offline.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + diff --git a/kylin-nm-gui/res/l/network-online.png b/kylin-nm-gui/res/l/network-online.png new file mode 100644 index 00000000..b8c5fe4a Binary files /dev/null and b/kylin-nm-gui/res/l/network-online.png differ diff --git a/kylin-nm-gui/res/l/network-online.svg b/kylin-nm-gui/res/l/network-online.svg new file mode 100644 index 00000000..7f10bfdf --- /dev/null +++ b/kylin-nm-gui/res/l/network-online.svg @@ -0,0 +1 @@ +gnome-dev-ethernet32 \ No newline at end of file diff --git a/kylin-nm-gui/res/s/conning-a/1.png b/kylin-nm-gui/res/s/conning-a/1.png new file mode 100644 index 00000000..cd0fafa9 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-a/1.png differ diff --git a/kylin-nm-gui/res/s/conning-a/2.png b/kylin-nm-gui/res/s/conning-a/2.png new file mode 100644 index 00000000..38b549a3 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-a/2.png differ diff --git a/kylin-nm-gui/res/s/conning-a/3.png b/kylin-nm-gui/res/s/conning-a/3.png new file mode 100644 index 00000000..c002abd0 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-a/3.png differ diff --git a/kylin-nm-gui/res/s/conning-a/4.png b/kylin-nm-gui/res/s/conning-a/4.png new file mode 100644 index 00000000..ec398d05 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-a/4.png differ diff --git a/kylin-nm-gui/res/s/conning-a/5.png b/kylin-nm-gui/res/s/conning-a/5.png new file mode 100644 index 00000000..df58230e Binary files /dev/null and b/kylin-nm-gui/res/s/conning-a/5.png differ diff --git a/kylin-nm-gui/res/s/conning-a/6.png b/kylin-nm-gui/res/s/conning-a/6.png new file mode 100644 index 00000000..44fbf5d7 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-a/6.png differ diff --git a/kylin-nm-gui/res/s/conning-a/7.png b/kylin-nm-gui/res/s/conning-a/7.png new file mode 100644 index 00000000..1dcfb6d0 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-a/7.png differ diff --git a/kylin-nm-gui/res/s/conning-a/8.png b/kylin-nm-gui/res/s/conning-a/8.png new file mode 100644 index 00000000..01785950 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-a/8.png differ diff --git a/kylin-nm-gui/res/s/conning-b/1.png b/kylin-nm-gui/res/s/conning-b/1.png new file mode 100644 index 00000000..31773e94 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-b/1.png differ diff --git a/kylin-nm-gui/res/s/conning-b/10.png b/kylin-nm-gui/res/s/conning-b/10.png new file mode 100644 index 00000000..41e3c140 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-b/10.png differ diff --git a/kylin-nm-gui/res/s/conning-b/11.png b/kylin-nm-gui/res/s/conning-b/11.png new file mode 100644 index 00000000..18920478 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-b/11.png differ diff --git a/kylin-nm-gui/res/s/conning-b/12.png b/kylin-nm-gui/res/s/conning-b/12.png new file mode 100644 index 00000000..f5515e95 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-b/12.png differ diff --git a/kylin-nm-gui/res/s/conning-b/2.png b/kylin-nm-gui/res/s/conning-b/2.png new file mode 100644 index 00000000..e227bb8c Binary files /dev/null and b/kylin-nm-gui/res/s/conning-b/2.png differ diff --git a/kylin-nm-gui/res/s/conning-b/3.png b/kylin-nm-gui/res/s/conning-b/3.png new file mode 100644 index 00000000..a1ad1bb1 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-b/3.png differ diff --git a/kylin-nm-gui/res/s/conning-b/4.png b/kylin-nm-gui/res/s/conning-b/4.png new file mode 100644 index 00000000..db16b0d2 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-b/4.png differ diff --git a/kylin-nm-gui/res/s/conning-b/5.png b/kylin-nm-gui/res/s/conning-b/5.png new file mode 100644 index 00000000..02dceb2e Binary files /dev/null and b/kylin-nm-gui/res/s/conning-b/5.png differ diff --git a/kylin-nm-gui/res/s/conning-b/6.png b/kylin-nm-gui/res/s/conning-b/6.png new file mode 100644 index 00000000..05de12c3 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-b/6.png differ diff --git a/kylin-nm-gui/res/s/conning-b/7.png b/kylin-nm-gui/res/s/conning-b/7.png new file mode 100644 index 00000000..9f5e23fe Binary files /dev/null and b/kylin-nm-gui/res/s/conning-b/7.png differ diff --git a/kylin-nm-gui/res/s/conning-b/8.png b/kylin-nm-gui/res/s/conning-b/8.png new file mode 100644 index 00000000..429fa4a5 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-b/8.png differ diff --git a/kylin-nm-gui/res/s/conning-b/9.png b/kylin-nm-gui/res/s/conning-b/9.png new file mode 100644 index 00000000..95bf53e8 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-b/9.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1.png b/kylin-nm-gui/res/s/conning-s/1.png new file mode 100644 index 00000000..69747259 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1.png differ diff --git a/kylin-nm-gui/res/s/conning-s/10.png b/kylin-nm-gui/res/s/conning-s/10.png new file mode 100644 index 00000000..964a3009 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/10.png differ diff --git a/kylin-nm-gui/res/s/conning-s/11.png b/kylin-nm-gui/res/s/conning-s/11.png new file mode 100644 index 00000000..d4659b52 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/11.png differ diff --git a/kylin-nm-gui/res/s/conning-s/12.png b/kylin-nm-gui/res/s/conning-s/12.png new file mode 100644 index 00000000..cb0272e3 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/12.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1x/1.png b/kylin-nm-gui/res/s/conning-s/1x/1.png new file mode 100644 index 00000000..258bd704 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1x/1.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1x/10.png b/kylin-nm-gui/res/s/conning-s/1x/10.png new file mode 100644 index 00000000..88398b80 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1x/10.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1x/11.png b/kylin-nm-gui/res/s/conning-s/1x/11.png new file mode 100644 index 00000000..7157960f Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1x/11.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1x/12.png b/kylin-nm-gui/res/s/conning-s/1x/12.png new file mode 100644 index 00000000..60b88e98 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1x/12.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1x/2.png b/kylin-nm-gui/res/s/conning-s/1x/2.png new file mode 100644 index 00000000..45eedb2b Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1x/2.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1x/3.png b/kylin-nm-gui/res/s/conning-s/1x/3.png new file mode 100644 index 00000000..96cfdad7 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1x/3.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1x/4.png b/kylin-nm-gui/res/s/conning-s/1x/4.png new file mode 100644 index 00000000..c8a9a982 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1x/4.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1x/5.png b/kylin-nm-gui/res/s/conning-s/1x/5.png new file mode 100644 index 00000000..0595e6b9 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1x/5.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1x/6.png b/kylin-nm-gui/res/s/conning-s/1x/6.png new file mode 100644 index 00000000..274f5a8f Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1x/6.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1x/7.png b/kylin-nm-gui/res/s/conning-s/1x/7.png new file mode 100644 index 00000000..c49a271f Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1x/7.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1x/8.png b/kylin-nm-gui/res/s/conning-s/1x/8.png new file mode 100644 index 00000000..94946d6a Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1x/8.png differ diff --git a/kylin-nm-gui/res/s/conning-s/1x/9.png b/kylin-nm-gui/res/s/conning-s/1x/9.png new file mode 100644 index 00000000..87f74199 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/1x/9.png differ diff --git a/kylin-nm-gui/res/s/conning-s/2.png b/kylin-nm-gui/res/s/conning-s/2.png new file mode 100644 index 00000000..eb6a4a41 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/2.png differ diff --git a/kylin-nm-gui/res/s/conning-s/3.png b/kylin-nm-gui/res/s/conning-s/3.png new file mode 100644 index 00000000..f985e8cf Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/3.png differ diff --git a/kylin-nm-gui/res/s/conning-s/4.png b/kylin-nm-gui/res/s/conning-s/4.png new file mode 100644 index 00000000..e8645dc4 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/4.png differ diff --git a/kylin-nm-gui/res/s/conning-s/5.png b/kylin-nm-gui/res/s/conning-s/5.png new file mode 100644 index 00000000..089e6710 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/5.png differ diff --git a/kylin-nm-gui/res/s/conning-s/6.png b/kylin-nm-gui/res/s/conning-s/6.png new file mode 100644 index 00000000..aee7edf2 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/6.png differ diff --git a/kylin-nm-gui/res/s/conning-s/7.png b/kylin-nm-gui/res/s/conning-s/7.png new file mode 100644 index 00000000..914deea1 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/7.png differ diff --git a/kylin-nm-gui/res/s/conning-s/8.png b/kylin-nm-gui/res/s/conning-s/8.png new file mode 100644 index 00000000..b3de2879 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/8.png differ diff --git a/kylin-nm-gui/res/s/conning-s/9.png b/kylin-nm-gui/res/s/conning-s/9.png new file mode 100644 index 00000000..ffbdb739 Binary files /dev/null and b/kylin-nm-gui/res/s/conning-s/9.png differ diff --git a/kylin-nm-gui/res/s/rescan/1.png b/kylin-nm-gui/res/s/rescan/1.png new file mode 100644 index 00000000..19c4f777 Binary files /dev/null and b/kylin-nm-gui/res/s/rescan/1.png differ diff --git a/kylin-nm-gui/res/s/rescan/10.png b/kylin-nm-gui/res/s/rescan/10.png new file mode 100644 index 00000000..2b4c501f Binary files /dev/null and b/kylin-nm-gui/res/s/rescan/10.png differ diff --git a/kylin-nm-gui/res/s/rescan/11.png b/kylin-nm-gui/res/s/rescan/11.png new file mode 100644 index 00000000..c43ee8ce Binary files /dev/null and b/kylin-nm-gui/res/s/rescan/11.png differ diff --git a/kylin-nm-gui/res/s/rescan/12.png b/kylin-nm-gui/res/s/rescan/12.png new file mode 100644 index 00000000..b3c08bed Binary files /dev/null and b/kylin-nm-gui/res/s/rescan/12.png differ diff --git a/kylin-nm-gui/res/s/rescan/2.png b/kylin-nm-gui/res/s/rescan/2.png new file mode 100644 index 00000000..40628922 Binary files /dev/null and b/kylin-nm-gui/res/s/rescan/2.png differ diff --git a/kylin-nm-gui/res/s/rescan/3.png b/kylin-nm-gui/res/s/rescan/3.png new file mode 100644 index 00000000..d6a64bc5 Binary files /dev/null and b/kylin-nm-gui/res/s/rescan/3.png differ diff --git a/kylin-nm-gui/res/s/rescan/4.png b/kylin-nm-gui/res/s/rescan/4.png new file mode 100644 index 00000000..f92092f0 Binary files /dev/null and b/kylin-nm-gui/res/s/rescan/4.png differ diff --git a/kylin-nm-gui/res/s/rescan/5.png b/kylin-nm-gui/res/s/rescan/5.png new file mode 100644 index 00000000..279fd345 Binary files /dev/null and b/kylin-nm-gui/res/s/rescan/5.png differ diff --git a/kylin-nm-gui/res/s/rescan/6.png b/kylin-nm-gui/res/s/rescan/6.png new file mode 100644 index 00000000..cea2f895 Binary files /dev/null and b/kylin-nm-gui/res/s/rescan/6.png differ diff --git a/kylin-nm-gui/res/s/rescan/7.png b/kylin-nm-gui/res/s/rescan/7.png new file mode 100644 index 00000000..f9b384aa Binary files /dev/null and b/kylin-nm-gui/res/s/rescan/7.png differ diff --git a/kylin-nm-gui/res/s/rescan/8.png b/kylin-nm-gui/res/s/rescan/8.png new file mode 100644 index 00000000..3930bef0 Binary files /dev/null and b/kylin-nm-gui/res/s/rescan/8.png differ diff --git a/kylin-nm-gui/res/s/rescan/9.png b/kylin-nm-gui/res/s/rescan/9.png new file mode 100644 index 00000000..bd22fa1b Binary files /dev/null and b/kylin-nm-gui/res/s/rescan/9.png differ diff --git a/kylin-nm-gui/res/w/wifi-full-pwd.png b/kylin-nm-gui/res/w/wifi-full-pwd.png new file mode 100644 index 00000000..065f7f8e Binary files /dev/null and b/kylin-nm-gui/res/w/wifi-full-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi-full.png b/kylin-nm-gui/res/w/wifi-full.png new file mode 100644 index 00000000..48024d04 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi-full.png differ diff --git a/kylin-nm-gui/res/w/wifi-high-pwd.png b/kylin-nm-gui/res/w/wifi-high-pwd.png new file mode 100644 index 00000000..81a4d11e Binary files /dev/null and b/kylin-nm-gui/res/w/wifi-high-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi-high.png b/kylin-nm-gui/res/w/wifi-high.png new file mode 100644 index 00000000..3ec53052 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi-high.png differ diff --git a/kylin-nm-gui/res/w/wifi-low-pwd.png b/kylin-nm-gui/res/w/wifi-low-pwd.png new file mode 100644 index 00000000..784ad1b2 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi-low-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi-low.png b/kylin-nm-gui/res/w/wifi-low.png new file mode 100644 index 00000000..3fe8bded Binary files /dev/null and b/kylin-nm-gui/res/w/wifi-low.png differ diff --git a/kylin-nm-gui/res/w/wifi-medium-pwd.png b/kylin-nm-gui/res/w/wifi-medium-pwd.png new file mode 100644 index 00000000..221fdbc1 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi-medium-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi-medium.png b/kylin-nm-gui/res/w/wifi-medium.png new file mode 100644 index 00000000..3b1683f3 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi-medium.png differ diff --git a/kylin-nm-gui/res/w/wifi-none-pwd.png b/kylin-nm-gui/res/w/wifi-none-pwd.png new file mode 100644 index 00000000..109f19ee Binary files /dev/null and b/kylin-nm-gui/res/w/wifi-none-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi-none.png b/kylin-nm-gui/res/w/wifi-none.png new file mode 100644 index 00000000..0a3bdd14 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi-none.png differ diff --git a/kylin-nm-gui/res/w/wifi6+-full-pwd.png b/kylin-nm-gui/res/w/wifi6+-full-pwd.png new file mode 100644 index 00000000..b4498c0c Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6+-full-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi6+-full.png b/kylin-nm-gui/res/w/wifi6+-full.png new file mode 100644 index 00000000..4c3867e4 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6+-full.png differ diff --git a/kylin-nm-gui/res/w/wifi6+-high-pwd.png b/kylin-nm-gui/res/w/wifi6+-high-pwd.png new file mode 100644 index 00000000..a6d9456b Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6+-high-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi6+-high.png b/kylin-nm-gui/res/w/wifi6+-high.png new file mode 100644 index 00000000..5144960f Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6+-high.png differ diff --git a/kylin-nm-gui/res/w/wifi6+-low-pwd.png b/kylin-nm-gui/res/w/wifi6+-low-pwd.png new file mode 100644 index 00000000..802a3668 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6+-low-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi6+-low.png b/kylin-nm-gui/res/w/wifi6+-low.png new file mode 100644 index 00000000..f7e4a96d Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6+-low.png differ diff --git a/kylin-nm-gui/res/w/wifi6+-medium-pwd.png b/kylin-nm-gui/res/w/wifi6+-medium-pwd.png new file mode 100644 index 00000000..68f47cf3 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6+-medium-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi6+-medium.png b/kylin-nm-gui/res/w/wifi6+-medium.png new file mode 100644 index 00000000..ae79551c Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6+-medium.png differ diff --git a/kylin-nm-gui/res/w/wifi6+-meidum-pwd.png b/kylin-nm-gui/res/w/wifi6+-meidum-pwd.png new file mode 100644 index 00000000..5d64fddc Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6+-meidum-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi6+-none.png b/kylin-nm-gui/res/w/wifi6+-none.png new file mode 100644 index 00000000..20a30ee0 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6+-none.png differ diff --git a/kylin-nm-gui/res/w/wifi6-full-pwd.png b/kylin-nm-gui/res/w/wifi6-full-pwd.png new file mode 100644 index 00000000..cd21cd7e Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6-full-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi6-full.png b/kylin-nm-gui/res/w/wifi6-full.png new file mode 100644 index 00000000..becdaa07 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6-full.png differ diff --git a/kylin-nm-gui/res/w/wifi6-high-pwd.png b/kylin-nm-gui/res/w/wifi6-high-pwd.png new file mode 100644 index 00000000..cf650101 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6-high-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi6-high.png b/kylin-nm-gui/res/w/wifi6-high.png new file mode 100644 index 00000000..a8d64899 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6-high.png differ diff --git a/kylin-nm-gui/res/w/wifi6-low-pwd.png b/kylin-nm-gui/res/w/wifi6-low-pwd.png new file mode 100644 index 00000000..b58198bf Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6-low-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi6-low.png b/kylin-nm-gui/res/w/wifi6-low.png new file mode 100644 index 00000000..5217b8dc Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6-low.png differ diff --git a/kylin-nm-gui/res/w/wifi6-medium-pwd.png b/kylin-nm-gui/res/w/wifi6-medium-pwd.png new file mode 100644 index 00000000..b713c4ec Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6-medium-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi6-medium.png b/kylin-nm-gui/res/w/wifi6-medium.png new file mode 100644 index 00000000..135b1817 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6-medium.png differ diff --git a/kylin-nm-gui/res/w/wifi6-none-pwd.png b/kylin-nm-gui/res/w/wifi6-none-pwd.png new file mode 100644 index 00000000..aee1b42a Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6-none-pwd.png differ diff --git a/kylin-nm-gui/res/w/wifi6-none.png b/kylin-nm-gui/res/w/wifi6-none.png new file mode 100644 index 00000000..c4563c20 Binary files /dev/null and b/kylin-nm-gui/res/w/wifi6-none.png differ diff --git a/kylin-nm-gui/res/x/control.svg b/kylin-nm-gui/res/x/control.svg new file mode 100644 index 00000000..a64182b7 --- /dev/null +++ b/kylin-nm-gui/res/x/control.svg @@ -0,0 +1,15 @@ + + + + +画板 1 + + + diff --git a/kylin-nm-gui/res/x/fly-mode-off.svg b/kylin-nm-gui/res/x/fly-mode-off.svg new file mode 100644 index 00000000..408b7b07 --- /dev/null +++ b/kylin-nm-gui/res/x/fly-mode-off.svg @@ -0,0 +1,19 @@ + + + + +画板 1 + + + + + diff --git a/kylin-nm-gui/res/x/fly-mode-on.svg b/kylin-nm-gui/res/x/fly-mode-on.svg new file mode 100644 index 00000000..9f5e543b --- /dev/null +++ b/kylin-nm-gui/res/x/fly-mode-on.svg @@ -0,0 +1,14 @@ + + + + +画板 1 + + diff --git a/kylin-nm-gui/res/x/hot-spot-off.svg b/kylin-nm-gui/res/x/hot-spot-off.svg new file mode 100644 index 00000000..cf39cadb --- /dev/null +++ b/kylin-nm-gui/res/x/hot-spot-off.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + diff --git a/kylin-nm-gui/res/x/hot-spot-on.svg b/kylin-nm-gui/res/x/hot-spot-on.svg new file mode 100644 index 00000000..2041db9d --- /dev/null +++ b/kylin-nm-gui/res/x/hot-spot-on.svg @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/kylin-nm-gui/res/x/load-down.png b/kylin-nm-gui/res/x/load-down.png new file mode 100644 index 00000000..a96298ac Binary files /dev/null and b/kylin-nm-gui/res/x/load-down.png differ diff --git a/kylin-nm-gui/res/x/load-up.png b/kylin-nm-gui/res/x/load-up.png new file mode 100644 index 00000000..e5ec581b Binary files /dev/null and b/kylin-nm-gui/res/x/load-up.png differ diff --git a/kylin-nm-gui/res/x/net-list-bg.svg b/kylin-nm-gui/res/x/net-list-bg.svg new file mode 100644 index 00000000..c17c1fd8 --- /dev/null +++ b/kylin-nm-gui/res/x/net-list-bg.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/kylin-nm-gui/res/x/setup.png b/kylin-nm-gui/res/x/setup.png new file mode 100644 index 00000000..fe242f89 Binary files /dev/null and b/kylin-nm-gui/res/x/setup.png differ diff --git a/kylin-nm-gui/res/x/wifi-list-bg.svg b/kylin-nm-gui/res/x/wifi-list-bg.svg new file mode 100644 index 00000000..43f18664 --- /dev/null +++ b/kylin-nm-gui/res/x/wifi-list-bg.svg @@ -0,0 +1,15 @@ + + + + +画板 1 + + + + + + + diff --git a/kylin-nm-gui/translations/kylin-nm_bo.qm b/kylin-nm-gui/translations/kylin-nm_bo.qm new file mode 100644 index 00000000..be651eed --- /dev/null +++ b/kylin-nm-gui/translations/kylin-nm_bo.qm @@ -0,0 +1 @@ + + + + + CreatNetPage + + + Connection Name + + + + + Ipv4Config + + + + + Address + + + + + Netmask + + + + + Default Gateway + + + + + Prefs DNS + + + + + Alternative DNS + + + + + Auto(DHCP) + + + + + Manual + + + + + DetailPage + + + Auto Connection + + + + + SSID: + + + + + Please input SSID: + + + + + Protocol: + + + + + Security Type: + + + + + Hz: + + + + + Chan: + + + + + BandWidth: + + + + + IPV6: + + + + + IPV4: + + + + + IPV4 Dns: + + + + + Mac: + + + + + EnterpriseWlanDialog + + + Connect Enterprise WLAN + + + + + Close + + + + + Cancel + + + + + Connect + + + + + Ipv4Page + + + Ipv4Config + + + + + Address + + + + + Netmask + + + + + Default Gateway + + + + + Prefs DNS + + + + + Alternative DNS + + + + + Auto(DHCP) + + + + + Manual + + + + + Ipv6Page + + + Ipv6Config + + + + + Address + + + + + Subnet prefix Length + + + + + Default Gateway + + + + + Prefs DNS + + + + + Alternative DNS + + + + + Auto(DHCP) + + + + + Manual + + + + + LanListItem + + + Not connected + + + + + Wired Device not carried + + + + + + Disconnect + + + + + + Connect + + + + + LanPage + + + No ethernet device avaliable + + + + + LAN + + + + + Activated LAN + + + + + Inactivated LAN + + + + + LAN Connected Successfully + + + + + LAN Disconnected Successfully + + + + + Wired Device not carried + + + + + ListItem + + + Kylin NM + + + + + kylin network applet desktop message + + + + + MainWindow + + + + kylin-nm + + + + + LAN + + + + + WLAN + + + + + Settings + + + + + Show MainWindow + + + + + NetDetail + + + Kylin NM + + + + + kylin network desktop message + + + + + Detail + + + + + Ipv4 + + + + + Ipv6 + + + + + Security + + + + + Confirm + + + + + Cancel + + + + + Forget this network + + + + + Add Lan Connect + + + + + connect hiddin wlan + + + + + + None + + + + + + + Auto + + + + + start check ipv4 address conflict + + + + + start check ipv6 address conflict + + + + + + + ipv4 address conflict! + + + + + + ipv6 address conflict! + + + + + this wifi no support enterprise type + + + + + this wifi no support None type + + + + + this wifi no support WPA2 type + + + + + this wifi no support WPA3 type + + + + + OneConnForm + + + Form + + + + + OneLancForm + + + Form + + + + + SecurityPage + + + Security + + + + + + Password + + + + + EAP type + + + + + Identity + + + + + Domain + + + + + CA certficate + + + + + no need for CA certificate + + + + + User certificate + + + + + User private key + + + + + User key password + + + + + Ineer authentication + + + + + Usename + + + + + Ask pwd each query + + + + + + + + + + + None + + + + + WPA&WPA2 Personal + + + + + WPA&WPA2 Enterprise + + + + + WPA3 Personal + + + + + + + Choose from file... + + + + + + + Choose a CA certificate + + + + + + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) + + + + + TabPage + + + Current Device + + + + + Devices Closed! + + + + + Settings + + + + + Kylin NM + + + + + kylin network applet desktop message + + + + + WiFiConfigDialog + + + Dialog + + + + + WLAN Authentication + + + + + Input WLAN Information Please + + + + + WLAN ID: + + + + + WLAN Name: + + + + + Password: + + + + + Cancl + + + + + Ok + + + + + WlanListItem + + + Not connected + + + + + + Disconnect + + + + + + + Connect + + + + + + Forget + + + + + Auto Connect + + + + + WlanMoreItem + + + Add Others... + + + + + WlanPage + + + WLAN + + + + + Activated WLAN + + + + + Other WLAN + + + + + No wireless network card detected + + + + + WLAN Connected Successfully + + + + + + WLAN Disconnected Successfully + + + + diff --git a/kylin-nm-gui/translations/kylin-nm_tr.qm b/kylin-nm-gui/translations/kylin-nm_tr.qm new file mode 100644 index 00000000..07e2ca58 Binary files /dev/null and b/kylin-nm-gui/translations/kylin-nm_tr.qm differ diff --git a/kylin-nm-gui/translations/kylin-nm_tr.ts b/kylin-nm-gui/translations/kylin-nm_tr.ts new file mode 100644 index 00000000..535f7e41 --- /dev/null +++ b/kylin-nm-gui/translations/kylin-nm_tr.ts @@ -0,0 +1,2082 @@ + + + + + BackThread + + Confirm your WLAN password + WLAN parolasını doğrula + + + + ConfForm + + edit network + Ağı düzenle + + + LAN name: + LAN adı: + + + Method: + Yöntem: + + + Address: + Adres: + + + Netmask: + Netmask: + + + DNS 1: + DNS 1: + + + DNS 2: + DNS 2: + + + Edit Conn + Bağ. Düzenle + + + Auto(DHCP) + Oto(DHCP) + + + Manual + Elle + + + Cancel + İptal + + + Save + Kaydet + + + Ok + Tamam + + + Can not create new wired network for without wired card + Kablolu kart olmadan yeni kablolu ağ oluşturulamıyor + + + New network already created + Yeni ağ zaten oluşturuldu + + + New network settings already finished + Yeni ağ ayarları zaten tamamlandı + + + kylin network applet desktop message + Kylin ağ uygulaması masaüstü mesajı + + + Edit Network + Ağı Düzenle + + + Add Wired Network + Kablolu Ağ Ekle + + + create wired network successfully + Başarıyla kablolu ağ oluşturuldu + + + change configuration of wired network successfully + Kablolu ağın yapılandırmasını başarıyla değiştirildi + + + New settings already effective + Yeni ayarlar zaten etkili + + + + CreatNetPage + + + Connection Name + + + + + Ipv4Config + + + + + Address + + + + + Netmask + + + + + Default Gateway + + + + + Prefs DNS + + + + + Alternative DNS + + + + + Auto(DHCP) + Oto(DHCP) + + + + Manual + Elle + + + + DetailPage + + + Auto Connection + + + + + SSID: + + + + + Please input SSID: + + + + + Protocol: + + + + + Security Type: + + + + + Hz: + + + + + Chan: + + + + + BandWidth: + + + + + IPV6: + + + + + IPV4: + + + + + IPV4 Dns: + + + + + Mac: + + + + + DlgHideWifi + + Add Hidden WLAN + Gizli WLAN Ekle + + + Connection + Bağlantı + + + WLAN name + WLAN adı + + + WLAN security + WLAN güvenlik + + + Cancel + İptal + + + Connect + Bağlantı + + + C_reate… + Oluştur... + + + None + Yok + + + Conn WLAN Success + WLAN Bağlantısı Başarılı + + + Confirm your WLAN password or usable of wireless card + Kablosuz şifrenizi veya kablosuz kart kullanılabilirliğini onaylayın + + + WPA & WPA2 Personal + WPA & WPA2 Kişisel + + + WEP 40/128-bit Key (Hex or ASCII) + WEP 40/128-bit Key (Hex veya ASCII) + + + WEP 128-bit Passphrase + WEP 128-bit Passphrase + + + Dynamic WEP (802.1X) + Dinamik WEP (802.1x) + + + WPA & WPA2 Enterprise + WPA & WPA2 Enterprise + + + Connect to Hidden WLAN Network + Gizli WLAN Ağına Bağlan + + + + DlgHideWifiEapFast + + Connect to Hidden WLAN Network + Gizli WLAN Ağına Bağlan + + + Add hidden WLAN + Gizli WLAN Ekle + + + Connection + Bağlantı: + + + Network name + Ağ adı + + + WLAN security + WLAN güvenliği + + + Authentication + Kimlik Doğrulama + + + Anonymous identity + Anonim kimlik + + + Allow automatic PAC pro_visioning + Otomatik PAC pro_visioning'e izin ver + + + PAC file + PAC dosyası + + + Inner authentication + İç kimlik doğrulama: + + + Username + Kullanıcı adı + + + Password + Parola + + + Cancel + İptal + + + Connect + Bağlan + + + C_reate… + Oluştur... + + + None + Yok + + + WPA & WPA2 Personal + WPA & WPA2 Kişisel + + + WEP 40/128-bit Key (Hex or ASCII) + WEP 40/128-bit Key (Hex veya ASCII) + + + WEP 128-bit Passphrase + WEP 128-bit Passphrase + + + Dynamic WEP (802.1X) + Dinamik WEP (802.1x) + + + WPA & WPA2 Enterprise + WPA & WPA2 Enterprise + + + Tunneled TLS + Tünelli TLS + + + Protected EAP (PEAP) + Korumalı EAP (PEAP) + + + Anonymous + Anonim + + + Authenticated + Doğrulanmış + + + Both + Her ikisi de + + + + DlgHideWifiEapLeap + + Connect to Hidden WLAN Network + Gizli WLAN ağına bağlan + + + Add hidden WLAN + Gizli WLAN ekle + + + Connection + Bağlantı: + + + Network name + Ağ adı: + + + WLAN security + WLAN güvenliği: + + + Authentication + Kimlik Doğrulama: + + + Username + Kullanıcı adı: + + + Password + Parola: + + + Cancel + 取消 + + + Connect + Bağlan + + + C_reate… + Oluştur... + + + None + Yok + + + WPA & WPA2 Personal + WPA & WPA2 Kişisel + + + WEP 40/128-bit Key (Hex or ASCII) + WEP 40/128-bit Key (Hex veya ASCII) + + + WEP 128-bit Passphrase + WEP 128-bit Passphrase + + + Dynamic WEP (802.1X) + Dinamik WEP (802.1x) + + + WPA & WPA2 Enterprise + WPA & WPA2 Enterprise + + + Tunneled TLS + Tünelli TLS + + + Protected EAP (PEAP) + Korumalı EAP (PEAP) + + + + DlgHideWifiEapPeap + + Connect to Hidden WLAN Network + Gizli WLAN Ağına Bağlan + + + Add hidden WLAN + Gizli WLAN ekle + + + Connection + Bağlantı: + + + Network name + Ağ adı: + + + WLAN security + WLAN güvenliği: + + + Authentication + Kimlik Doğrulama: + + + Anonymous identity + Anonim kimlik: + + + Domain + Domain: + + + CA certificate + CA sertifikası: + + + CA certificate password + CA sertifika şifresi: + + + No CA certificate is required + CA sertifikası gerekmez + + + PEAP version + PEAP sürümü: + + + Inner authentication + İç kimlik doğrulama: + + + Username + Kullanıcı adı: + + + Password + Parola: + + + Cancel + İptal + + + Connect + Bağlan + + + None + Yok + + + WPA & WPA2 Personal + WPA & WPA2 Kişisel + + + WEP 40/128-bit Key (Hex or ASCII) + WEP 40/128-bit Key (Hex veya ASCII) + + + WEP 128-bit Passphrase + WEP 128-bit Passphrase + + + Dynamic WEP (802.1X) + Dinamik WEP (802.1x) + + + WPA & WPA2 Enterprise + WPA & WPA2 Enterprise + + + Tunneled TLS + Tünelli TLS + + + Protected EAP (PEAP) + Korumalı EAP (PEAP) + + + Choose from file + Dosyadan seçin... + + + Automatic + Otomatik + + + Version 0 + Sürüm 0 + + + Version 1 + Sürüm 1 + + + + DlgHideWifiEapPwd + + Connect to Hidden WLAN Network + Gizli WLAN Ağına Bağlan + + + Add hidden WLAN + Gizli WLAN ekle + + + Connection + Bağlantı: + + + Network name + Ağ adı: + + + WLAN security + WLAN güvenliği: + + + Authentication + Kimlik Doğrulama: + + + Username + Kullanıcı adı: + + + Password + Parola: + + + Cancel + İptal + + + Connect + Bağlan + + + C_reate… + Oluştur... + + + None + Yok + + + WPA & WPA2 Personal + WPA & WPA2 Kişisel + + + WEP 40/128-bit Key (Hex or ASCII) + WEP 40/128-bit Key (Hex veya ASCII) + + + WEP 128-bit Passphrase + WEP 128-bit Passphrase + + + Dynamic WEP (802.1X) + Dinamik WEP (802.1x) + + + WPA & WPA2 Enterprise + WPA & WPA2 Enterprise + + + Tunneled TLS + Tünelli TLS + + + Protected EAP (PEAP) + Korumalı EAP (PEAP) + + + + DlgHideWifiEapTTLS + + Connect to Hidden WLAN Network + Gizli WLAN Ağına Bağlan + + + Add hidden WLAN + Gizli WLAN ekle + + + Connection + Bağlantı: + + + Network name + Ağ adı: + + + WLAN security + WLAN Güvenliği: + + + Authentication + Kimlik Doğrulama: + + + Anonymous identity + Anonim kimlik: + + + Domain + Domain: + + + CA certificate + CA Sertifikası: + + + CA certificate password + CA sertifika şifresi: + + + No CA certificate is required + CA sertifikası gerekmez + + + Inner authentication + İç kimlik doğrulama: + + + Username + Kullanıcı adı: + + + Password + Parola: + + + Cancel + İptal + + + Connect + Bağlan + + + C_reate… + Oluştur... + + + None + Yok + + + WPA & WPA2 Personal + WPA & WPA2 Kişisel + + + WEP 40/128-bit Key (Hex or ASCII) + WEP 40/128-bit Key (Hex veya ASCII) + + + WEP 128-bit Passphrase + WEP 128-bit Passphrase + + + Dynamic WEP (802.1X) + Dinamik WEP (802.1x) + + + WPA & WPA2 Enterprise + WPA & WPA2 Enterprise + + + Tunneled TLS + Tünelli TLS + + + Protected EAP (PEAP) + Korumalı EAP (PEAP) + + + Choose from file + Dosyadan seçiniz... + + + + DlgHideWifiEapTls + + Connect to Hidden WLAN Network + Gizli WLAN Ağına Bağlan + + + Add hidden WLAN + Gizli WLAN ekle + + + Connection + Bağlantı: + + + Network name + Ağ adı: + + + WLAN security + WLAN güvenliği: + + + Authentication + Kimlik Doğrulama: + + + Identity + Kimlik: + + + Domain + Domain: + + + CA certificate + CA sertifikası: + + + CA certificate password + CA sertifika şifresi: + + + No CA certificate is required + CA sertifikası gerekmez + + + User certificate + Kullanıcı sertifikası: + + + User certificate password + Kullanıcı sertifikası şifresi: + + + User private key + Kullanıcı özel anahtarı: + + + User key password + Kullanıcı anahtarı şifresi: + + + Cancel + İptal + + + Connect + Bağlan + + + C_reate… + Oluştur... + + + None + Yok + + + WPA & WPA2 Personal + WPA & WPA2 Kişisel + + + WEP 40/128-bit Key (Hex or ASCII) + WEP 40/128-bit Key (Hex veya ASCII) + + + WEP 128-bit Passphrase + WEP 128-bit Passphrase + + + Dynamic WEP (802.1X) + Dinamik WEP (802.1x) + + + WPA & WPA2 Enterprise + WPA & WPA2 Enterprise + + + Tunneled TLS + Tünelli TLS + + + Protected EAP (PEAP) + Korumalı EAP (PEAP) + + + Choose from file + Dosyadan seç... + + + + DlgHideWifiLeap + + Connect to Hidden WLAN Network + Gizli WLAN Ağına Bağlan + + + Add hidden WLAN + Gizli WLAN Ekle + + + Connection + Bağlantı + + + Network name + Ağ adı + + + WLAN security + WLAN Güvenlik + + + Username + Kullanıcı adı + + + Password + Parola + + + Cancel + İptal + + + Connect + Bağlan + + + C_reate… + Oluştur... + + + None + Yok + + + WPA & WPA2 Personal + WPA & WPA2 Kişisel + + + WEP 40/128-bit Key (Hex or ASCII) + WEP 40/128-bit Key (Hex veya ASCII) + + + WEP 128-bit Passphrase + WEP 128-bit Passphrase + + + Dynamic WEP (802.1X) + Dinamik WEP (802.1X) + + + WPA & WPA2 Enterprise + WPA & WPA2 Enterprise + + + + DlgHideWifiWep + + Connect to Hidden WLAN Network + Gizli WLAN Ağına Bağlan + + + Add hidden WLAN + Gizli WLAN Ekle + + + Connection + Bağlantı: + + + Network name + Ağ adı: + + + WLAN security + WLAN Güvenliği: + + + Key + Anahtar + + + WEP index + WEP index + + + Authentication + Kimlik Doğrulama: + + + Cancel + İptal + + + Connect + Bağlan + + + C_reate… + Oluştur... + + + None + Yok + + + WPA & WPA2 Personal + WPA & WPA2 Kişisel + + + WEP 40/128-bit Key (Hex or ASCII) + WEP 40/128-bit Key (Hex veya ASCII) + + + WEP 128-bit Passphrase + WEP 128-bit Passphrase + + + Dynamic WEP (802.1X) + Dinamik WEP (802.1x) + + + WPA & WPA2 Enterprise + WPA & WPA2 Enterprise + + + 1(default) + 1(default) + + + Open System + Sistemi aç + + + Shared Key + Paylaşılan Anahtar + + + + DlgHideWifiWpa + + Connect to Hidden WLAN Network + Gizli WLAN Ağına Bağlan + + + Add Hidden WLAN + Gizli WLAN Ekle + + + Connection + Bağlantı: + + + WLAN name + WLAN adı: + + + WLAN security + WLAN güvenlik: + + + Password + Parola: + + + Cancel + İptal + + + Connect + Bağlan + + + C_reate… + Oluştur... + + + None + Yok + + + Conn WLAN Success + WLAN Bağlantısı Başarılı + + + Confirm your WLAN password or usable of wireless card + Kablosuz şifrenizi veya kablosuz kart kullanılabilirliğini onaylayın + + + WPA & WPA2 Personal + WPA & WPA2 Kişisel + + + WPA & WPA2 Enterprise + WPA & WPA2 Enterprise + + + WEP 40/128-bit Key (Hex or ASCII) + WEP 40/128-bit Key (Hex veya ASCII) + + + Dynamic WEP (802.1X) + Dinamik WEP (802.1x) + + + + DlgHotspotCreate + + Create Hotspot + Etkin Nokta Oluştur + + + Network name + Ağ adı: + + + WLAN security + WLAN Güvenlik: + + + Password + Parola: + + + Cancel + İptal + + + Ok + Tamam + + + None + Yok + + + WPA & WPA2 Personal + WPA & WPA2 Kişisel + + + + EnterpriseWlanDialog + + + Connect Enterprise WLAN + + + + + Close + + + + + Cancel + + + + + Connect + + + + + Ipv4Page + + + Ipv4Config + + + + + Address + + + + + Netmask + + + + + Default Gateway + + + + + Prefs DNS + + + + + Alternative DNS + + + + + Auto(DHCP) + Oto(DHCP) + + + + Manual + Elle + + + + Ipv6Page + + + Ipv6Config + + + + + Address + + + + + Subnet prefix Length + + + + + Default Gateway + + + + + Prefs DNS + + + + + Alternative DNS + + + + + Auto(DHCP) + Oto(DHCP) + + + + Manual + Elle + + + + KylinDBus + + kylin network applet desktop message + Kylin ağ uygulaması masaüstü mesajı + + + + LanListItem + + + Not connected + Bağlanamadı + + + + Wired Device not carried + + + + + + Disconnect + Bağlantıyı Kes + + + + + Connect + + + + + LanPage + + + No ethernet device avaliable + + + + + LAN + + + + + Activated LAN + + + + + Inactivated LAN + + + + + LAN Connected Successfully + + + + + LAN Disconnected Successfully + + + + + Wired Device not carried + + + + + ListItem + + + Kylin NM + + + + + kylin network applet desktop message + Kylin ağ uygulaması masaüstü mesajı + + + + MainWindow + + + + kylin-nm + + + + Network + + + + Advanced + Gelişmiş + + + Ethernet + Kablolu Ağ + + + Connect Hide Network + Gizli Ağı Bağlan + + + + LAN + + + + + WLAN + WLAN + + + + Settings + + + + Enabled + Aktif + + + Disabled + Pasif + + + HotSpot + HotSpot + + + + Show MainWindow + Ana Pencereyi Göster + + + Not connected + Bağlanamadı + + + Disconnected + Bağlantı Kesildi + + + No Other Wired Network Scheme + Başka Kablolu Ağ Düzeni Yok + + + No Other Wireless Network Scheme + Başka Kablosuz Ağ Düzeni Yok + + + Wired net is disconnected + Kablolu ağ bağlantısı kesildi + + + WLAN is disconnected + Kablosuz bağlantı kesildi + + + Confirm your WLAN password or usable of wireless card + Kablosuz şifrenizi veya kablosuz kart kullanılabilirliğini onaylayın + + + Confirm your WLAN password + WLAN parolasını doğrula + + + Ethernet Networks + Ethernet Ağları + + + New LAN + Yeni LAN + + + Hide WLAN + Gizli WLAN + + + No usable network in the list + Listede kullanılabilir ağ yok + + + WLAN Networks + WLAN Ağları + + + None + Yok + + + keep wired network switch is on before turning on wireless switch + Kablosuz anahtarı açmadan önce kablolu ağ anahtarını açık tut + + + please insert the wireless network adapter + Lütfen kablosuz ağ adaptörünü takın + + + Abnormal connection exist, program will delete it + Anormal bağlantı var, program onu ​​silecek + + + update WLAN list now, click again + Kablosuz listesini şimdi güncelle, tekrar tıkla + + + update WLAN list now + Kablosuz listesini şimdi güncelle + + + Conn Ethernet Success + Ethernet Bağlantısı Başarılı + + + Conn Ethernet Fail + Ethernet Bağlantısı Hatası + + + Conn WLAN Success + WLAN Bağlantısı Başarılı + + + + NetDetail + + + Kylin NM + + + + + kylin network desktop message + + + + + Detail + + + + + Ipv4 + + + + + Ipv6 + + + + + Security + + + + + Confirm + + + + + Cancel + + + + + Forget this network + + + + + Add Lan Connect + + + + + connect hiddin wlan + + + + + + None + Yok + + + + + + Auto + Oto + + + + start check ipv4 address conflict + + + + + start check ipv6 address conflict + + + + + + + ipv4 address conflict! + + + + + + ipv6 address conflict! + + + + + this wifi no support enterprise type + + + + + this wifi no support None type + + + + + this wifi no support WPA2 type + + + + + this wifi no support WPA3 type + + + + + NotifySend + + Form + -- + + + + OldMainWindow + + Ethernet Networks + Ethernet Ağları + + + New LAN + Yeni LAN + + + WLAN Networks + WLAN Ağları + + + Hide WLAN + Gizli WLAN + + + No usable network in the list + Listede kullanılabilir ağ yok + + + Ethernet + Kablolu Ağ + + + HotSpot + HotSpot + + + Advanced + Gelişmiş + + + Show MainWindow + Ana Pencereyi Göster + + + Wired net is disconnected + Kablolu ağ bağlantısı kesildi + + + Not connected + Bağlanamadı + + + Disconnected + Bağlantı Kesildi + + + No Other Wired Network Scheme + Başka Kablolu Ağ Düzeni Yok + + + No Other Wireless Network Scheme + Başka Kablosuz Ağ Düzeni Yok + + + WLAN is disconnected + Kablosuz bağlantı kesildi + + + Conn Ethernet Success + Ethernet Bağlantısı Başarılı + + + Conn WLAN Success + WLAN Bağlantısı Başarılı + + + Confirm your WLAN password or usable of wireless card + Kablosuz şifrenizi veya kablosuz kart kullanılabilirliğini onaylayın + + + Confirm your WLAN password + WLAN parolasını doğrula + + + + OneConnForm + + + Form + -- + + + Input password + Parola gir + + + Config + Ayar + + + Connect + Bağlan + + + Disconnect + Bağlantıyı Kes + + + Input Password... + Parola gir... + + + Connect to Hidden WLAN Network + Gizli WLAN Ağına Bağlan + + + Public + Halka açık + + + Safe + Güvenli + + + Rate + Oran + + + None + Yok + + + WLAN Security: + WLAN güvenliği: + + + Sifnal: + Sinyal gücü: + + + MAC: + Fiziksel adres: + + + Conn WLAN Success + WLAN Bağlantısı Başarılı + + + Confirm your WLAN password or usable of wireless card + Kablosuz şifrenizi veya kablosuz kart kullanılabilirliğini onaylayın + + + Conn WLAN Failed + WLAN Bağlantısı Başarısız + + + + OneLancForm + + + Form + -- + + + Config + Ayar + + + Connect + Bağlan + + + Disconnect + Bağlantıyı Kes + + + Not connected + Bağlanamadı + + + Disconnected + Bağlantı Kesildi + + + Ethernet + Kablolu Ağ + + + No Configuration + Yapılandırma Yok + + + IPv4: + IPv4 adresi: + + + IPv6: + IPv6 adresi: + + + BandWidth: + Bant genişliği: + + + MAC: + Fiziksel adres: + + + Auto + Oto + + + + SecurityPage + + + Security + + + + + + Password + + + + + EAP type + + + + + Identity + Kimlik: + + + + Domain + Domain: + + + + CA certficate + + + + + no need for CA certificate + + + + + User certificate + Kullanıcı sertifikası: + + + + User private key + Kullanıcı özel anahtarı: + + + + User key password + Kullanıcı anahtarı şifresi: + + + + Ineer authentication + + + + + Usename + + + + + Ask pwd each query + + + + + + + + + + + None + Yok + + + + WPA&WPA2 Personal + + + + + WPA&WPA2 Enterprise + + + + + WPA3 Personal + + + + + + + Choose from file... + + + + + + + Choose a CA certificate + + + + + + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) + + + + + TabPage + + + Current Device + + + + + Devices Closed! + + + + + Settings + + + + + Kylin NM + + + + + kylin network applet desktop message + Kylin ağ uygulaması masaüstü mesajı + + + + Utils + + kylin network applet desktop message + Kylin ağ uygulaması masaüstü mesajı + + + + WiFiConfigDialog + + + Dialog + + + + + WLAN Authentication + + + + + Input WLAN Information Please + + + + + WLAN ID: + + + + + WLAN Name: + + + + + Password: + + + + + Cancl + + + + + Ok + Tamam + + + + WlanListItem + + + Not connected + Bağlanamadı + + + + + Disconnect + Bağlantıyı Kes + + + + + + Connect + + + + + + Forget + + + + + Auto Connect + + + + + WlanMoreItem + + + Add Others... + + + + + WlanPage + + + WLAN + WLAN + + + + Activated WLAN + + + + + Other WLAN + + + + + No wireless network card detected + + + + + WLAN Connected Successfully + + + + + + WLAN Disconnected Successfully + + + + + WpaWifiDialog + + Identity + Kimlik: + + + Domain + Domain: + + + None + Yok + + + diff --git a/kylin-nm-gui/translations/kylin-nm_zh_CN.qm b/kylin-nm-gui/translations/kylin-nm_zh_CN.qm new file mode 100644 index 00000000..5b466418 Binary files /dev/null and b/kylin-nm-gui/translations/kylin-nm_zh_CN.qm differ diff --git a/kylin-nm-gui/translations/kylin-nm_zh_CN.ts b/kylin-nm-gui/translations/kylin-nm_zh_CN.ts new file mode 100644 index 00000000..6f32037f --- /dev/null +++ b/kylin-nm-gui/translations/kylin-nm_zh_CN.ts @@ -0,0 +1,1107 @@ + + + + + ConfForm + + Manual + 手动 + + + Cancel + 取消 + + + kylin-nm + 网络工具 + + + kylin network applet desktop message + 网络提示消息 + + + Will check the IP address conflict + 正在检测ip地址冲突 + + + IPV4 address conflict, Please change IP + ip地址冲突,请更改ip + + + IPV6 address conflict, Please change IP + ip地址冲突,请更改ip {6 ?} + + + + CreatNetPage + + + Connection Name + 网络名称 + + + + Ipv4Config + IPV4配置 + + + + Address + IPV4地址 + + + + Netmask + 子网掩码 + + + + Default Gateway + 默认网关 + + + + Prefs DNS + 首选DNS + + + + Alternative DNS + 备选DNS + + + + Auto(DHCP) + 自动(DHCP) + + + + Manual + 手动 + + + + DetailPage + + + Auto Connection + 自动连接 + + + + SSID: + SSID: + + + + Please input SSID: + 请输入SSID: + + + + Protocol: + 协议: + + + + Security Type: + 安全类型: + + + + Hz: + 网络频带: + + + + Chan: + 网络通道: + + + + BandWidth: + 带宽: + + + + IPV6: + 本地链接IPV6地址: + + + + IPV4: + IPV4地址: + + + + IPV4 Dns: + IPV4 DNS服务器: + + + + Mac: + 物理地址: + + + + DlgHideWifi + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiEapFast + + Username + 用户名 + + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiEapLeap + + Username + 用户名 + + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiEapPeap + + Domain + + + + Username + 用户名 + + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiEapPwd + + Username + 用户名 + + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiEapTTLS + + Domain + + + + Username + 用户名 + + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiEapTls + + Identity + 匿名身份 + + + Domain + + + + User certificate + 用户证书 + + + User private key + 用户私钥 + + + User key password + 用户密钥密码 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiLeap + + Username + 用户名 + + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiWep + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiWpa + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + EnterpriseWlanDialog + + + Connect Enterprise WLAN + 连接企业网 + + + + Close + 关闭 + + + + Cancel + 取消 + + + + Connect + 连接 + + + + Ipv4Page + + + Ipv4Config + Ipv4配置 + + + + Address + 地址 + + + + Netmask + 子网掩码 + + + + Default Gateway + 默认网关 + + + + Prefs DNS + 首选DNS + + + + Alternative DNS + 备选DNS + + + + Auto(DHCP) + 自动 + + + + Manual + 手动 + + + + Ipv6Page + + + Ipv6Config + Ipv6配置 + + + + Address + 地址 + + + + Subnet prefix Length + 子网前缀长度 + + + + Default Gateway + 默认网关 + + + + Prefs DNS + 首选DNS + + + + Alternative DNS + 备选DNS + + + + Auto(DHCP) + 自动 + + + + Manual + 手动 + + + + LanListItem + + + Not connected + 未连接 + + + + Wired Device not carried + 未插入网线 + + + + + Disconnect + 断开 + + + + + Connect + 连接 + + + + LanPage + + + No ethernet device avaliable + 未检测到有线设备 + + + + LAN + 有线网络 + + + + Activated LAN + 我的网络 + + + + Inactivated LAN + 其他网络 + + + + LAN Disconnected Successfully + 有线网络已断开 + + + + Wired Device not carried + 未插入网线 + + + + LAN Connected Successfully + 有线网络已连接 + + + + ListItem + + + Kylin NM + 麒麟网络设置工具 + + + + kylin network applet desktop message + 网络提示消息 + + + + MainWindow + + + + kylin-nm + 网络工具 + + + + LAN + 有线网络 + 有线网络 + + + + WLAN + 无线局域网 + 无线局域网 + + + + Show MainWindow + 打开网络工具 + + + + Settings + 设置网络项 + 设置网络项 + + + + NetDetail + + + Kylin NM + 麒麟网络设置工具 + + + + kylin network desktop message + 网络提示消息 + + + + Detail + 详情 + + + + Ipv4 + Ipv4 + + + + Ipv6 + Ipv6 + + + + Security + 安全 + + + Close + 关闭 + + + + Confirm + 确定 + + + + Cancel + 取消 + + + + Forget this network + 忘记此网络 + + + + Add Lan Connect + 添加有线网络 + + + + connect hiddin wlan + 连接到隐藏WLAN + + + + + None + + + + + + + Auto + 自动 + + + + start check ipv4 address conflict + 开始检测ipv4地址冲突 + + + + start check ipv6 address conflict + 开始检测ipv6地址冲突 + + + + + + ipv4 address conflict! + ipv4地址冲突! + + + + + ipv6 address conflict! + ipv6地址冲突! + + + + this wifi no support enterprise type + 此wifi不支持企业网类型 + + + + this wifi no support None type + 此wifi不支持空类型 + + + + this wifi no support WPA2 type + 此wifi不支持WPA2类型 + + + + this wifi no support WPA3 type + 此wifi不支持WPA3类型 + + + + OldMainWindow + + kylin-nm + 网络工具 + + + Show MainWindow + 打开网络工具 + + + Not connected + 未连接 + + + + OneConnForm + + + Form + + + + Connect + 连接 + + + Disconnect + 断开 + + + Cancel + 取消 + + + Forget + 忘记此网络 + + + None + + + + + OneLancForm + + + Form + + + + Connect + 连接 + + + Disconnect + 断开 + + + Cancel + 取消 + + + Not connected + 未连接 + + + + SecurityPage + + + Security + 安全性 + + + + + Password + 密钥 + + + + EAP type + EAP方法 + + + + Identity + 匿名身份 + + + + Domain + + + + + CA certficate + CA 证书 + + + + no need for CA certificate + 不需要CA证书 + + + + User certificate + 用户证书 + + + + User private key + 用户私钥 + + + + User key password + 用户密钥密码 + + + + Ineer authentication + 内部认证 + + + + Usename + 用户名 + + + Username + Usename + 用户名 + + + + Ask pwd each query + 每次询问密码 + + + + + + + + + + None + + + + + WPA&WPA2 Personal + WPA&WPA2 个人 + + + + WPA&WPA2 Enterprise + WPA&WPA2 企业 + + + + WPA3 Personal + WPA3 个人 + + + + + + Choose from file... + 从文件选择... + + + + + + Choose a CA certificate + 选择一个CA证书 + + + + + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) + CA 证书 (*.pem *.der *.p12 *.crt *.cer *.pfx) + + + + TabPage + + + Current Device + 当前网卡 + + + + Devices Closed! + 设备关闭! + + + + Settings + 网络设置 + + + + Kylin NM + 麒麟网络设置工具 + + + + kylin network applet desktop message + 网络提示消息 + + + + WiFiConfigDialog + + + Dialog + + + + + WLAN Authentication + + + + + Input WLAN Information Please + + + + + WLAN ID: + + + + + WLAN Name: + + + + + Password: + + + + + Cancl + + + + + Ok + + + + + WlanListItem + + + Not connected + 未连接 + + + + + Disconnect + 断开 + + + + + + Connect + 连接 + + + + + Forget + 忘记此网络 + + + + Auto Connect + 自动加入该网络 + + + + WlanMoreItem + + More... + 更多... + + + + Add Others... + 加入其他网络... + + + + WlanPage + + + WLAN + 无线局域网 + + + + No wireless network card detected + 未检测到无线网卡 + + + + Activated WLAN + 我的网络 + + + + Other WLAN + 其他网络 + + + More... + 更多... + + + + WLAN Connected Successfully + 无线网络已连接 + + + + + WLAN Disconnected Successfully + 无线网络已断开 + + + + WpaWifiDialog + + EAP type + EAP方法 + + + Username + 用户名 + + + Password + 密钥 + + + Ask pwd each query + 每次询问密码 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + Choose from file... + 从文件选择... + + + Choose a CA certificate + 选择一个CA证书 + + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) + CA 证书 (*.pem *.der *.p12 *.crt *.cer *.pfx) + + + Identity + 匿名身份 + + + Domain + + + + no need for CA certificate + 不需要CA证书 + + + diff --git a/kylin-nm-server/kylin-nm-server.pro b/kylin-nm-server/kylin-nm-server.pro new file mode 100644 index 00000000..96710850 --- /dev/null +++ b/kylin-nm-server/kylin-nm-server.pro @@ -0,0 +1 @@ +TEMPLATE = subdirs diff --git a/kylin-nm.pro b/kylin-nm.pro new file mode 100644 index 00000000..0b824963 --- /dev/null +++ b/kylin-nm.pro @@ -0,0 +1,19 @@ +TEMPLATE = subdirs + +CONFIG += ordered \ + qt + +SUBDIRS = \ +# plugins/plugin.pro \ + libnm-kylin \ + kylin-keyring/kylin-keyring.pro\ +# kylin-nm-gui \ +# kylin-nm-server \ + +#kylin-nm-gui.depends = libnm-kylin +#kylin-nm-server.depends = libnm-kylin + +#TRANSLATIONS += \ +# translations/kylin-nm_zh_CN.ts \ +# translations/kylin-nm_tr.ts \ +# translations/kylin-nm_bo.ts diff --git a/libnm-kylin/build/Makefile b/libnm-kylin/build/Makefile new file mode 100644 index 00000000..83ca7f9b --- /dev/null +++ b/libnm-kylin/build/Makefile @@ -0,0 +1,354 @@ +############################################################################# +# Makefile for building: libnm-kylin +# Generated by qmake (3.1) (Qt 5.12.8) +# Project: ../libnm-kylin.pro +# Template: subdirs +# Command: /usr/lib/qt5/bin/qmake -o Makefile ../libnm-kylin.pro +############################################################################# + +MAKEFILE = Makefile + +EQ = = + +first: make_first +QMAKE = /usr/lib/qt5/bin/qmake +DEL_FILE = rm -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p +COPY = cp -f +COPY_FILE = cp -f +COPY_DIR = cp -f -R +INSTALL_FILE = install -m 644 -p +INSTALL_PROGRAM = install -m 755 -p +INSTALL_DIR = cp -f -R +QINSTALL = /usr/lib/qt5/bin/qmake -install qinstall +QINSTALL_PROGRAM = /usr/lib/qt5/bin/qmake -install qinstall -exe +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +TAR = tar -cf +COMPRESS = gzip -9f +DISTNAME = libnm-kylin1.0.0 +DISTDIR = /home/crush/project/3.2/kylin-nm/libnm-kylin/build/.tmp/libnm-kylin1.0.0 +SUBTARGETS = \ + sub-libnm-base-kylin \ + sub-libnm-external-kylin + + +sub-libnm-base-kylin-qmake_all: FORCE + @test -d libnm-base-kylin/ || mkdir -p libnm-base-kylin/ + cd libnm-base-kylin/ && $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro + cd libnm-base-kylin/ && $(MAKE) -f Makefile qmake_all +sub-libnm-base-kylin: FORCE + @test -d libnm-base-kylin/ || mkdir -p libnm-base-kylin/ + cd libnm-base-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro ) && $(MAKE) -f Makefile +sub-libnm-base-kylin-make_first: FORCE + @test -d libnm-base-kylin/ || mkdir -p libnm-base-kylin/ + cd libnm-base-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro ) && $(MAKE) -f Makefile +sub-libnm-base-kylin-all: FORCE + @test -d libnm-base-kylin/ || mkdir -p libnm-base-kylin/ + cd libnm-base-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro ) && $(MAKE) -f Makefile all +sub-libnm-base-kylin-clean: FORCE + @test -d libnm-base-kylin/ || mkdir -p libnm-base-kylin/ + cd libnm-base-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro ) && $(MAKE) -f Makefile clean +sub-libnm-base-kylin-distclean: FORCE + @test -d libnm-base-kylin/ || mkdir -p libnm-base-kylin/ + cd libnm-base-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro ) && $(MAKE) -f Makefile distclean +sub-libnm-base-kylin-install_subtargets: FORCE + @test -d libnm-base-kylin/ || mkdir -p libnm-base-kylin/ + cd libnm-base-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro ) && $(MAKE) -f Makefile install +sub-libnm-base-kylin-uninstall_subtargets: FORCE + @test -d libnm-base-kylin/ || mkdir -p libnm-base-kylin/ + cd libnm-base-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro ) && $(MAKE) -f Makefile uninstall +sub-libnm-external-kylin-qmake_all: sub-libnm-base-kylin-qmake_all FORCE + @test -d libnm-external-kylin/ || mkdir -p libnm-external-kylin/ + cd libnm-external-kylin/ && $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro + cd libnm-external-kylin/ && $(MAKE) -f Makefile qmake_all +sub-libnm-external-kylin: sub-libnm-base-kylin FORCE + @test -d libnm-external-kylin/ || mkdir -p libnm-external-kylin/ + cd libnm-external-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro ) && $(MAKE) -f Makefile +sub-libnm-external-kylin-make_first: sub-libnm-base-kylin-make_first FORCE + @test -d libnm-external-kylin/ || mkdir -p libnm-external-kylin/ + cd libnm-external-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro ) && $(MAKE) -f Makefile +sub-libnm-external-kylin-all: sub-libnm-base-kylin-all FORCE + @test -d libnm-external-kylin/ || mkdir -p libnm-external-kylin/ + cd libnm-external-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro ) && $(MAKE) -f Makefile all +sub-libnm-external-kylin-clean: sub-libnm-base-kylin-clean FORCE + @test -d libnm-external-kylin/ || mkdir -p libnm-external-kylin/ + cd libnm-external-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro ) && $(MAKE) -f Makefile clean +sub-libnm-external-kylin-distclean: sub-libnm-base-kylin-distclean FORCE + @test -d libnm-external-kylin/ || mkdir -p libnm-external-kylin/ + cd libnm-external-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro ) && $(MAKE) -f Makefile distclean +sub-libnm-external-kylin-install_subtargets: sub-libnm-base-kylin-install_subtargets FORCE + @test -d libnm-external-kylin/ || mkdir -p libnm-external-kylin/ + cd libnm-external-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro ) && $(MAKE) -f Makefile install +sub-libnm-external-kylin-uninstall_subtargets: sub-libnm-base-kylin-uninstall_subtargets FORCE + @test -d libnm-external-kylin/ || mkdir -p libnm-external-kylin/ + cd libnm-external-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro ) && $(MAKE) -f Makefile uninstall + +Makefile: ../libnm-kylin.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_Attica.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_BluezQt.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuth.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuthCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCodecs.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCompletion.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigGui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigWidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCoreAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KDBusAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGlobalAccel.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGuiAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KI18n.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KIconThemes.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KItemViews.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KScreen.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KService.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KTextWidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWidgetsAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWindowSystem.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KXmlGui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_help.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimedia.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quickwidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_script.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_scripttools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sensors.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uiplugin.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_x11extras.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetUi.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \ + ../libnm-kylin.pro + $(QMAKE) -o Makefile ../libnm-kylin.pro +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_Attica.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_BluezQt.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuth.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuthCore.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCodecs.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCompletion.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigCore.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigGui.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigWidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCoreAddons.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KDBusAddons.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGlobalAccel.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGuiAddons.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KI18n.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KIconThemes.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KItemViews.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KScreen.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KService.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KTextWidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWidgetsAddons.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWindowSystem.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KXmlGui.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_help.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimedia.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quickwidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_script.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_scripttools.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sensors.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uiplugin.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_x11extras.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetCore.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetUi.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf: +../libnm-kylin.pro: +qmake: FORCE + @$(QMAKE) -o Makefile ../libnm-kylin.pro + +qmake_all: sub-libnm-base-kylin-qmake_all sub-libnm-external-kylin-qmake_all FORCE + +make_first: sub-libnm-base-kylin-make_first sub-libnm-external-kylin-make_first FORCE +all: sub-libnm-base-kylin-all sub-libnm-external-kylin-all FORCE +clean: sub-libnm-base-kylin-clean sub-libnm-external-kylin-clean FORCE +distclean: sub-libnm-base-kylin-distclean sub-libnm-external-kylin-distclean FORCE + -$(DEL_FILE) Makefile + -$(DEL_FILE) .qmake.stash +install_subtargets: sub-libnm-base-kylin-install_subtargets sub-libnm-external-kylin-install_subtargets FORCE +uninstall_subtargets: sub-libnm-base-kylin-uninstall_subtargets sub-libnm-external-kylin-uninstall_subtargets FORCE + +sub-libnm-base-kylin-check: + @test -d libnm-base-kylin/ || mkdir -p libnm-base-kylin/ + cd libnm-base-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro ) && $(MAKE) -f Makefile check +sub-libnm-external-kylin-check: sub-libnm-base-kylin-check + @test -d libnm-external-kylin/ || mkdir -p libnm-external-kylin/ + cd libnm-external-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro ) && $(MAKE) -f Makefile check +check: sub-libnm-base-kylin-check sub-libnm-external-kylin-check + +sub-libnm-base-kylin-benchmark: + @test -d libnm-base-kylin/ || mkdir -p libnm-base-kylin/ + cd libnm-base-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro ) && $(MAKE) -f Makefile benchmark +sub-libnm-external-kylin-benchmark: sub-libnm-base-kylin-benchmark + @test -d libnm-external-kylin/ || mkdir -p libnm-external-kylin/ + cd libnm-external-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro ) && $(MAKE) -f Makefile benchmark +benchmark: sub-libnm-base-kylin-benchmark sub-libnm-external-kylin-benchmark +install:install_subtargets FORCE + +uninstall: uninstall_subtargets FORCE + +FORCE: + +dist: distdir FORCE + (cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR) + +distdir: sub-libnm-base-kylin-distdir sub-libnm-external-kylin-distdir FORCE + @test -d $(DISTDIR) || mkdir -p $(DISTDIR) + $(COPY_FILE) --parents /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_Attica.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_BluezQt.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuth.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuthCore.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCodecs.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCompletion.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigCore.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigGui.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigWidgets.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCoreAddons.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KDBusAddons.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGlobalAccel.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGuiAddons.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KI18n.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KIconThemes.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KItemViews.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KScreen.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KService.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KTextWidgets.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWidgetsAddons.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWindowSystem.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KXmlGui.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_help.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimedia.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quickwidgets.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_script.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_scripttools.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sensors.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uiplugin.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_x11extras.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetCore.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetUi.pri /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf ../libnm-kylin.pro $(DISTDIR)/ + +sub-libnm-base-kylin-distdir: FORCE + @test -d libnm-base-kylin/ || mkdir -p libnm-base-kylin/ + cd libnm-base-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro ) && $(MAKE) -e -f Makefile distdir DISTDIR=$(DISTDIR)/libnm-base-kylin + +sub-libnm-external-kylin-distdir: FORCE + @test -d libnm-external-kylin/ || mkdir -p libnm-external-kylin/ + cd libnm-external-kylin/ && ( test -e Makefile || $(QMAKE) -o Makefile /home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro ) && $(MAKE) -e -f Makefile distdir DISTDIR=$(DISTDIR)/libnm-external-kylin + diff --git a/libnm-kylin/build/libnm-base-kylin/Makefile b/libnm-kylin/build/libnm-base-kylin/Makefile new file mode 100644 index 00000000..166059af --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/Makefile @@ -0,0 +1,992 @@ +############################################################################# +# Makefile for building: libkylin-nm-base.so.1.0.0 +# Generated by qmake (3.1) (Qt 5.12.8) +# Project: ../../libnm-base-kylin/libnm-base-kylin.pro +# Template: lib +# Command: /usr/lib/qt5/bin/qmake -o Makefile ../../libnm-base-kylin/libnm-base-kylin.pro +############################################################################# + +MAKEFILE = Makefile + +EQ = = + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DLIBNMBASEKYLIN_LIBRARY -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_DBUS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB +CFLAGS = -pipe -O2 -pthread -Wall -W -D_REENTRANT -fPIC $(DEFINES) +CXXFLAGS = -pipe -O2 -std=gnu++11 -pthread -Wall -W -D_REENTRANT -fPIC $(DEFINES) +INCPATH = -I../../libnm-base-kylin -I. -isystem /usr/include/KF5/NetworkManagerQt -isystem /usr/include/libnm -isystem /usr/include/libmount -isystem /usr/include/blkid -isystem /usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtDBus -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ +QMAKE = /usr/lib/qt5/bin/qmake +DEL_FILE = rm -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p +COPY = cp -f +COPY_FILE = cp -f +COPY_DIR = cp -f -R +INSTALL_FILE = install -m 644 -p +INSTALL_PROGRAM = install -m 755 -p +INSTALL_DIR = cp -f -R +QINSTALL = /usr/lib/qt5/bin/qmake -install qinstall +QINSTALL_PROGRAM = /usr/lib/qt5/bin/qmake -install qinstall -exe +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +TAR = tar -cf +COMPRESS = gzip -9f +DISTNAME = kylin-nm-base1.0.0 +DISTDIR = /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/.tmp/kylin-nm-base1.0.0 +LINK = g++ +LFLAGS = -Wl,-O1 -shared -Wl,-soname,libkylin-nm-base.so.1 +LIBS = $(SUBLIBS) -L/usr/lib/ -lKF5NetworkManagerQt -lnm -lgio-2.0 -lgobject-2.0 -lglib-2.0 /usr/lib/x86_64-linux-gnu/libQt5Gui.so /usr/lib/x86_64-linux-gnu/libQt5DBus.so /usr/lib/x86_64-linux-gnu/libQt5Network.so /usr/lib/x86_64-linux-gnu/libQt5Core.so /usr/lib/x86_64-linux-gnu/libGL.so -lpthread +AR = ar cqs +RANLIB = +SED = sed +STRIP = strip + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = ../../libnm-base-kylin/kyapnetresource.cpp \ + ../../libnm-base-kylin/kyenterpricesettinginfo.cpp \ + ../../libnm-base-kylin/kylinactiveconnectresource.cpp \ + ../../libnm-base-kylin/kylinconnectoperation.cpp \ + ../../libnm-base-kylin/kylinconnectsetting.cpp \ + ../../libnm-base-kylin/kylingeneral.cpp \ + ../../libnm-base-kylin/kylinnetresource.cpp \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.cpp \ + ../../libnm-base-kylin/kylinnetworkmanagerutil.cpp \ + ../../libnm-base-kylin/kylinnetworkmanger.cpp \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.cpp \ + ../../libnm-base-kylin/kylinvpnconnectitem.cpp \ + ../../libnm-base-kylin/kylinwiredconnectoperation.cpp \ + ../../libnm-base-kylin/kylinwirednetresource.cpp \ + ../../libnm-base-kylin/kywirelessconnectoperation.cpp \ + ../../libnm-base-kylin/kywirelessnetresource.cpp moc_kyapnetresource.cpp \ + moc_kylinactiveconnectresource.cpp \ + moc_kylinconnectoperation.cpp \ + moc_kylingeneral.cpp \ + moc_kylinnetresource.cpp \ + moc_kylinnetworkdeviceresource.cpp \ + moc_kylinnetworkmanager.cpp \ + moc_kylinnetworkresourcemanager.cpp \ + moc_kylinwiredconnectoperation.cpp \ + moc_kylinwirednetresource.cpp \ + moc_kywirelessconnectoperation.cpp \ + moc_kywirelessnetresource.cpp +OBJECTS = kyapnetresource.o \ + kyenterpricesettinginfo.o \ + kylinactiveconnectresource.o \ + kylinconnectoperation.o \ + kylinconnectsetting.o \ + kylingeneral.o \ + kylinnetresource.o \ + kylinnetworkdeviceresource.o \ + kylinnetworkmanagerutil.o \ + kylinnetworkmanger.o \ + kylinnetworkresourcemanager.o \ + kylinvpnconnectitem.o \ + kylinwiredconnectoperation.o \ + kylinwirednetresource.o \ + kywirelessconnectoperation.o \ + kywirelessnetresource.o \ + moc_kyapnetresource.o \ + moc_kylinactiveconnectresource.o \ + moc_kylinconnectoperation.o \ + moc_kylingeneral.o \ + moc_kylinnetresource.o \ + moc_kylinnetworkdeviceresource.o \ + moc_kylinnetworkmanager.o \ + moc_kylinnetworkresourcemanager.o \ + moc_kylinwiredconnectoperation.o \ + moc_kylinwirednetresource.o \ + moc_kywirelessconnectoperation.o \ + moc_kywirelessnetresource.o +DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_Attica.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_BluezQt.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuth.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuthCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCodecs.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCompletion.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigGui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigWidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCoreAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KDBusAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGlobalAccel.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGuiAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KI18n.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KIconThemes.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KItemViews.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KScreen.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KService.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KTextWidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWidgetsAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWindowSystem.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KXmlGui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_help.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimedia.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quickwidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_script.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_scripttools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sensors.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uiplugin.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_x11extras.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetUi.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \ + ../../.qmake.stash \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/link_pkgconfig.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbuscommon.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbusinterfaces.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbusadaptors.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \ + ../../../libnm-base-kylin/libnm-base-kylin.pro ../../libnm-base-kylin/kyapnetresource.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kylinactiveconnectresource.h \ + ../../libnm-base-kylin/kylinapconnectitem.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylingeneral.h \ + ../../libnm-base-kylin/kylinnetresource.h \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinnetworkmanager.h \ + ../../libnm-base-kylin/kylinnetworkmanagerutil.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinwirednetresource.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kywirelessnetitem.h \ + ../../libnm-base-kylin/kywirelessnetresource.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h ../../libnm-base-kylin/kyapnetresource.cpp \ + ../../libnm-base-kylin/kyenterpricesettinginfo.cpp \ + ../../libnm-base-kylin/kylinactiveconnectresource.cpp \ + ../../libnm-base-kylin/kylinconnectoperation.cpp \ + ../../libnm-base-kylin/kylinconnectsetting.cpp \ + ../../libnm-base-kylin/kylingeneral.cpp \ + ../../libnm-base-kylin/kylinnetresource.cpp \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.cpp \ + ../../libnm-base-kylin/kylinnetworkmanagerutil.cpp \ + ../../libnm-base-kylin/kylinnetworkmanger.cpp \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.cpp \ + ../../libnm-base-kylin/kylinvpnconnectitem.cpp \ + ../../libnm-base-kylin/kylinwiredconnectoperation.cpp \ + ../../libnm-base-kylin/kylinwirednetresource.cpp \ + ../../libnm-base-kylin/kywirelessconnectoperation.cpp \ + ../../libnm-base-kylin/kywirelessnetresource.cpp +QMAKE_TARGET = kylin-nm-base +DESTDIR = ../../libnm-base-kylin/ +TARGET = libkylin-nm-base.so.1.0.0 +TARGETA = ../../libnm-base-kylin/libkylin-nm-base.a +TARGET0 = libkylin-nm-base.so +TARGETD = libkylin-nm-base.so.1.0.0 +TARGET1 = libkylin-nm-base.so.1 +TARGET2 = libkylin-nm-base.so.1.0 + + +first: all +####### Build rules + +../../libnm-base-kylin/libkylin-nm-base.so.1.0.0: $(OBJECTS) $(SUBLIBS) $(OBJCOMP) + @test -d ../../libnm-base-kylin/ || mkdir -p ../../libnm-base-kylin/ + -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP) + -ln -s $(TARGET) $(TARGET0) + -ln -s $(TARGET) $(TARGET1) + -ln -s $(TARGET) $(TARGET2) + -$(DEL_FILE) ../../libnm-base-kylin/$(TARGET) + -$(MOVE) $(TARGET) ../../libnm-base-kylin/$(TARGET) + -$(DEL_FILE) ../../libnm-base-kylin/$(TARGET0) + -$(DEL_FILE) ../../libnm-base-kylin/$(TARGET1) + -$(DEL_FILE) ../../libnm-base-kylin/$(TARGET2) + -$(MOVE) $(TARGET0) ../../libnm-base-kylin/$(TARGET0) + -$(MOVE) $(TARGET1) ../../libnm-base-kylin/$(TARGET1) + -$(MOVE) $(TARGET2) ../../libnm-base-kylin/$(TARGET2) + + + +staticlib: ../../libnm-base-kylin/libkylin-nm-base.a + +../../libnm-base-kylin/libkylin-nm-base.a: $(OBJECTS) $(OBJCOMP) + -$(DEL_FILE) $(TARGETA) + $(AR) $(TARGETA) $(OBJECTS) + +Makefile: ../../libnm-base-kylin/libnm-base-kylin.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_Attica.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_BluezQt.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuth.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuthCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCodecs.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCompletion.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigGui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigWidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCoreAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KDBusAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGlobalAccel.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGuiAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KI18n.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KIconThemes.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KItemViews.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KScreen.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KService.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KTextWidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWidgetsAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWindowSystem.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KXmlGui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_help.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimedia.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quickwidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_script.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_scripttools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sensors.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uiplugin.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_x11extras.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetUi.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \ + ../.qmake.stash \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/link_pkgconfig.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbuscommon.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbusinterfaces.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbusadaptors.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \ + ../../libnm-base-kylin/libnm-base-kylin.pro + $(QMAKE) -o Makefile ../../libnm-base-kylin/libnm-base-kylin.pro +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_Attica.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_BluezQt.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuth.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuthCore.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCodecs.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCompletion.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigCore.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigGui.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigWidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCoreAddons.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KDBusAddons.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGlobalAccel.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGuiAddons.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KI18n.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KIconThemes.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KItemViews.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KScreen.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KService.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KTextWidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWidgetsAddons.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWindowSystem.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KXmlGui.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_help.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimedia.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quickwidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_script.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_scripttools.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sensors.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uiplugin.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_x11extras.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetCore.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetUi.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf: +../.qmake.stash: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/link_pkgconfig.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbuscommon.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbusinterfaces.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbusadaptors.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf: +../../libnm-base-kylin/libnm-base-kylin.pro: +qmake: FORCE + @$(QMAKE) -o Makefile ../../libnm-base-kylin/libnm-base-kylin.pro + +qmake_all: FORCE + + +all: Makefile ../../libnm-base-kylin/libkylin-nm-base.so.1.0.0 + +dist: distdir FORCE + (cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR) + +distdir: FORCE + @test -d $(DISTDIR) || mkdir -p $(DISTDIR) + $(COPY_FILE) --parents $(DIST) $(DISTDIR)/ + $(COPY_FILE) --parents /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp $(DISTDIR)/ + $(COPY_FILE) --parents ../../libnm-base-kylin/kyapnetresource.h ../../libnm-base-kylin/kyenterpricesettinginfo.h ../../libnm-base-kylin/kylinactiveconnectresource.h ../../libnm-base-kylin/kylinapconnectitem.h ../../libnm-base-kylin/kylinconnectitem.h ../../libnm-base-kylin/kylinconnectoperation.h ../../libnm-base-kylin/kylinconnectsetting.h ../../libnm-base-kylin/kylingeneral.h ../../libnm-base-kylin/kylinnetresource.h ../../libnm-base-kylin/kylinnetworkdeviceresource.h ../../libnm-base-kylin/kylinnetworkmanager.h ../../libnm-base-kylin/kylinnetworkmanagerutil.h ../../libnm-base-kylin/kylinnetworkresourcemanager.h ../../libnm-base-kylin/kylinnetworkresourcetype.h ../../libnm-base-kylin/kylinwiredconnectoperation.h ../../libnm-base-kylin/kylinwirednetresource.h ../../libnm-base-kylin/kywirelessconnectoperation.h ../../libnm-base-kylin/kywirelessnetitem.h ../../libnm-base-kylin/kywirelessnetresource.h ../../libnm-base-kylin/libnm-base-kylin_global.h $(DISTDIR)/ + $(COPY_FILE) --parents ../../libnm-base-kylin/kyapnetresource.cpp ../../libnm-base-kylin/kyenterpricesettinginfo.cpp ../../libnm-base-kylin/kylinactiveconnectresource.cpp ../../libnm-base-kylin/kylinconnectoperation.cpp ../../libnm-base-kylin/kylinconnectsetting.cpp ../../libnm-base-kylin/kylingeneral.cpp ../../libnm-base-kylin/kylinnetresource.cpp ../../libnm-base-kylin/kylinnetworkdeviceresource.cpp ../../libnm-base-kylin/kylinnetworkmanagerutil.cpp ../../libnm-base-kylin/kylinnetworkmanger.cpp ../../libnm-base-kylin/kylinnetworkresourcemanager.cpp ../../libnm-base-kylin/kylinvpnconnectitem.cpp ../../libnm-base-kylin/kylinwiredconnectoperation.cpp ../../libnm-base-kylin/kylinwirednetresource.cpp ../../libnm-base-kylin/kywirelessconnectoperation.cpp ../../libnm-base-kylin/kywirelessnetresource.cpp $(DISTDIR)/ + + +clean: compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +distclean: clean + -$(DEL_FILE) ../../libnm-base-kylin/$(TARGET) + -$(DEL_FILE) ../../libnm-base-kylin/$(TARGET0) ../../libnm-base-kylin/$(TARGET1) ../../libnm-base-kylin/$(TARGET2) $(TARGETA) + -$(DEL_FILE) Makefile + + +####### Sub-libraries + +mocclean: compiler_moc_header_clean compiler_moc_objc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_objc_header_make_all compiler_moc_source_make_all + +check: first + +benchmark: first + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_moc_predefs_make_all: moc_predefs.h +compiler_moc_predefs_clean: + -$(DEL_FILE) moc_predefs.h +moc_predefs.h: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp + g++ -pipe -O2 -std=gnu++11 -pthread -Wall -W -dM -E -o moc_predefs.h /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp + +compiler_moc_header_make_all: moc_kyapnetresource.cpp moc_kylinactiveconnectresource.cpp moc_kylinconnectoperation.cpp moc_kylingeneral.cpp moc_kylinnetresource.cpp moc_kylinnetworkdeviceresource.cpp moc_kylinnetworkmanager.cpp moc_kylinnetworkresourcemanager.cpp moc_kylinwiredconnectoperation.cpp moc_kylinwirednetresource.cpp moc_kywirelessconnectoperation.cpp moc_kywirelessnetresource.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_kyapnetresource.cpp moc_kylinactiveconnectresource.cpp moc_kylinconnectoperation.cpp moc_kylingeneral.cpp moc_kylinnetresource.cpp moc_kylinnetworkdeviceresource.cpp moc_kylinnetworkmanager.cpp moc_kylinnetworkresourcemanager.cpp moc_kylinwiredconnectoperation.cpp moc_kylinwirednetresource.cpp moc_kywirelessconnectoperation.cpp moc_kywirelessnetresource.cpp +moc_kyapnetresource.cpp: ../../libnm-base-kylin/kyapnetresource.h \ + ../../libnm-base-kylin/kylinapconnectitem.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/usr/include/KF5/NetworkManagerQt -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-base-kylin/kyapnetresource.h -o moc_kyapnetresource.cpp + +moc_kylinactiveconnectresource.cpp: ../../libnm-base-kylin/kylinactiveconnectresource.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinvpnconnectitem.h \ + ../../libnm-base-kylin/kylinapconnectitem.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/usr/include/KF5/NetworkManagerQt -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-base-kylin/kylinactiveconnectresource.h -o moc_kylinactiveconnectresource.cpp + +moc_kylinconnectoperation.cpp: ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/usr/include/KF5/NetworkManagerQt -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-base-kylin/kylinconnectoperation.h -o moc_kylinconnectoperation.cpp + +moc_kylingeneral.cpp: ../../libnm-base-kylin/kylingeneral.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/usr/include/KF5/NetworkManagerQt -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-base-kylin/kylingeneral.h -o moc_kylingeneral.cpp + +moc_kylinnetresource.cpp: ../../libnm-base-kylin/kylinnetresource.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/usr/include/KF5/NetworkManagerQt -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-base-kylin/kylinnetresource.h -o moc_kylinnetresource.cpp + +moc_kylinnetworkdeviceresource.cpp: ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/usr/include/KF5/NetworkManagerQt -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-base-kylin/kylinnetworkdeviceresource.h -o moc_kylinnetworkdeviceresource.cpp + +moc_kylinnetworkmanager.cpp: ../../libnm-base-kylin/kylinnetworkmanager.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinactiveconnectresource.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinvpnconnectitem.h \ + ../../libnm-base-kylin/kylinapconnectitem.h \ + ../../libnm-base-kylin/kylinwirednetresource.h \ + ../../libnm-base-kylin/kylinnetresource.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kywirelessnetresource.h \ + ../../libnm-base-kylin/kywirelessnetitem.h \ + ../../libnm-base-kylin/kyapnetresource.h \ + ../../libnm-base-kylin/kylingeneral.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/usr/include/KF5/NetworkManagerQt -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-base-kylin/kylinnetworkmanager.h -o moc_kylinnetworkmanager.cpp + +moc_kylinnetworkresourcemanager.cpp: ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/usr/include/KF5/NetworkManagerQt -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-base-kylin/kylinnetworkresourcemanager.h -o moc_kylinnetworkresourcemanager.cpp + +moc_kylinwiredconnectoperation.cpp: ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/usr/include/KF5/NetworkManagerQt -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-base-kylin/kylinwiredconnectoperation.h -o moc_kylinwiredconnectoperation.cpp + +moc_kylinwirednetresource.cpp: ../../libnm-base-kylin/kylinwirednetresource.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinnetresource.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinvpnconnectitem.h \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinapconnectitem.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/usr/include/KF5/NetworkManagerQt -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-base-kylin/kylinwirednetresource.h -o moc_kylinwirednetresource.cpp + +moc_kywirelessconnectoperation.cpp: ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/usr/include/KF5/NetworkManagerQt -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-base-kylin/kywirelessconnectoperation.h -o moc_kywirelessconnectoperation.cpp + +moc_kywirelessnetresource.cpp: ../../libnm-base-kylin/kywirelessnetresource.h \ + ../../libnm-base-kylin/kylinnetresource.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kywirelessnetitem.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-base-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/usr/include/KF5/NetworkManagerQt -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-base-kylin/kywirelessnetresource.h -o moc_kywirelessnetresource.cpp + +compiler_moc_objc_header_make_all: +compiler_moc_objc_header_clean: +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_predefs_clean compiler_moc_header_clean + +####### Compile + +kyapnetresource.o: ../../libnm-base-kylin/kyapnetresource.cpp ../../libnm-base-kylin/kyapnetresource.h \ + ../../libnm-base-kylin/kylinapconnectitem.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kylinnetworkmanagerutil.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kyapnetresource.o ../../libnm-base-kylin/kyapnetresource.cpp + +kyenterpricesettinginfo.o: ../../libnm-base-kylin/kyenterpricesettinginfo.cpp ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kyenterpricesettinginfo.o ../../libnm-base-kylin/kyenterpricesettinginfo.cpp + +kylinactiveconnectresource.o: ../../libnm-base-kylin/kylinactiveconnectresource.cpp ../../libnm-base-kylin/kylinactiveconnectresource.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinvpnconnectitem.h \ + ../../libnm-base-kylin/kylinapconnectitem.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kylinnetworkmanagerutil.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinactiveconnectresource.o ../../libnm-base-kylin/kylinactiveconnectresource.cpp + +kylinconnectoperation.o: ../../libnm-base-kylin/kylinconnectoperation.cpp ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectsetting.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinconnectoperation.o ../../libnm-base-kylin/kylinconnectoperation.cpp + +kylinconnectsetting.o: ../../libnm-base-kylin/kylinconnectsetting.cpp ../../libnm-base-kylin/kylinconnectsetting.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinconnectsetting.o ../../libnm-base-kylin/kylinconnectsetting.cpp + +kylingeneral.o: ../../libnm-base-kylin/kylingeneral.cpp ../../libnm-base-kylin/kylingeneral.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinconnectoperation.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylingeneral.o ../../libnm-base-kylin/kylingeneral.cpp + +kylinnetresource.o: ../../libnm-base-kylin/kylinnetresource.cpp ../../libnm-base-kylin/kylinnetresource.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinactiveconnectresource.h \ + ../../libnm-base-kylin/kylinvpnconnectitem.h \ + ../../libnm-base-kylin/kylinapconnectitem.h \ + ../../libnm-base-kylin/kywirelessnetresource.h \ + ../../libnm-base-kylin/kywirelessnetitem.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kylinnetworkmanagerutil.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinnetresource.o ../../libnm-base-kylin/kylinnetresource.cpp + +kylinnetworkdeviceresource.o: ../../libnm-base-kylin/kylinnetworkdeviceresource.cpp ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinnetworkmanagerutil.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinnetworkdeviceresource.o ../../libnm-base-kylin/kylinnetworkdeviceresource.cpp + +kylinnetworkmanagerutil.o: ../../libnm-base-kylin/kylinnetworkmanagerutil.cpp ../../libnm-base-kylin/kylinnetworkmanagerutil.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinnetworkmanagerutil.o ../../libnm-base-kylin/kylinnetworkmanagerutil.cpp + +kylinnetworkmanger.o: ../../libnm-base-kylin/kylinnetworkmanger.cpp ../../libnm-base-kylin/kylinnetworkmanager.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinactiveconnectresource.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinvpnconnectitem.h \ + ../../libnm-base-kylin/kylinapconnectitem.h \ + ../../libnm-base-kylin/kylinwirednetresource.h \ + ../../libnm-base-kylin/kylinnetresource.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kywirelessnetresource.h \ + ../../libnm-base-kylin/kywirelessnetitem.h \ + ../../libnm-base-kylin/kyapnetresource.h \ + ../../libnm-base-kylin/kylingeneral.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinnetworkmanger.o ../../libnm-base-kylin/kylinnetworkmanger.cpp + +kylinnetworkresourcemanager.o: ../../libnm-base-kylin/kylinnetworkresourcemanager.cpp ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinnetworkmanagerutil.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinnetworkresourcemanager.o ../../libnm-base-kylin/kylinnetworkresourcemanager.cpp + +kylinvpnconnectitem.o: ../../libnm-base-kylin/kylinvpnconnectitem.cpp ../../libnm-base-kylin/kylinvpnconnectitem.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinvpnconnectitem.o ../../libnm-base-kylin/kylinvpnconnectitem.cpp + +kylinwiredconnectoperation.o: ../../libnm-base-kylin/kylinwiredconnectoperation.cpp ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinnetworkmanagerutil.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinwiredconnectoperation.o ../../libnm-base-kylin/kylinwiredconnectoperation.cpp + +kylinwirednetresource.o: ../../libnm-base-kylin/kylinwirednetresource.cpp ../../libnm-base-kylin/kylinwirednetresource.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinnetresource.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinconnectitem.h \ + ../../libnm-base-kylin/kylinvpnconnectitem.h \ + ../../libnm-base-kylin/kylinnetworkdeviceresource.h \ + ../../libnm-base-kylin/kylinwiredconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinapconnectitem.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kylinnetworkmanagerutil.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinwirednetresource.o ../../libnm-base-kylin/kylinwirednetresource.cpp + +kywirelessconnectoperation.o: ../../libnm-base-kylin/kywirelessconnectoperation.cpp ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kylinnetworkmanagerutil.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kywirelessconnectoperation.o ../../libnm-base-kylin/kywirelessconnectoperation.cpp + +kywirelessnetresource.o: ../../libnm-base-kylin/kywirelessnetresource.cpp ../../libnm-base-kylin/kywirelessnetresource.h \ + ../../libnm-base-kylin/kylinnetresource.h \ + ../../libnm-base-kylin/kylinnetworkresourcemanager.h \ + ../../libnm-base-kylin/libnm-base-kylin_global.h \ + ../../libnm-base-kylin/kylinnetworkresourcetype.h \ + ../../libnm-base-kylin/kylinconnectsetting.h \ + ../../libnm-base-kylin/kywirelessnetitem.h \ + ../../libnm-base-kylin/kywirelessconnectoperation.h \ + ../../libnm-base-kylin/kyenterpricesettinginfo.h \ + ../../libnm-base-kylin/kylinconnectoperation.h \ + ../../libnm-base-kylin/kylinnetworkmanagerutil.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kywirelessnetresource.o ../../libnm-base-kylin/kywirelessnetresource.cpp + +moc_kyapnetresource.o: moc_kyapnetresource.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kyapnetresource.o moc_kyapnetresource.cpp + +moc_kylinactiveconnectresource.o: moc_kylinactiveconnectresource.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinactiveconnectresource.o moc_kylinactiveconnectresource.cpp + +moc_kylinconnectoperation.o: moc_kylinconnectoperation.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinconnectoperation.o moc_kylinconnectoperation.cpp + +moc_kylingeneral.o: moc_kylingeneral.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylingeneral.o moc_kylingeneral.cpp + +moc_kylinnetresource.o: moc_kylinnetresource.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinnetresource.o moc_kylinnetresource.cpp + +moc_kylinnetworkdeviceresource.o: moc_kylinnetworkdeviceresource.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinnetworkdeviceresource.o moc_kylinnetworkdeviceresource.cpp + +moc_kylinnetworkmanager.o: moc_kylinnetworkmanager.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinnetworkmanager.o moc_kylinnetworkmanager.cpp + +moc_kylinnetworkresourcemanager.o: moc_kylinnetworkresourcemanager.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinnetworkresourcemanager.o moc_kylinnetworkresourcemanager.cpp + +moc_kylinwiredconnectoperation.o: moc_kylinwiredconnectoperation.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinwiredconnectoperation.o moc_kylinwiredconnectoperation.cpp + +moc_kylinwirednetresource.o: moc_kylinwirednetresource.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinwirednetresource.o moc_kylinwirednetresource.cpp + +moc_kywirelessconnectoperation.o: moc_kywirelessconnectoperation.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kywirelessconnectoperation.o moc_kywirelessconnectoperation.cpp + +moc_kywirelessnetresource.o: moc_kywirelessnetresource.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kywirelessnetresource.o moc_kywirelessnetresource.cpp + +####### Install + +install_target: first FORCE + @test -d $(INSTALL_ROOT)/usr/lib || mkdir -p $(INSTALL_ROOT)/usr/lib + -$(QINSTALL_PROGRAM) ../../libnm-base-kylin/$(TARGET) $(INSTALL_ROOT)/usr/lib/$(TARGET) + -$(STRIP) --strip-unneeded $(INSTALL_ROOT)/usr/lib/$(TARGET) + -$(SYMLINK) $(TARGET) $(INSTALL_ROOT)/usr/lib/$(TARGET0) + -$(SYMLINK) $(TARGET) $(INSTALL_ROOT)/usr/lib/$(TARGET1) + -$(SYMLINK) $(TARGET) $(INSTALL_ROOT)/usr/lib/$(TARGET2) + +uninstall_target: FORCE + -$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/$(TARGET) + -$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/$(TARGET0) + -$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/$(TARGET1) + -$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/$(TARGET2) + -$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/ + + +install: install_target FORCE + +uninstall: uninstall_target FORCE + +FORCE: + diff --git a/libnm-kylin/build/libnm-base-kylin/kyapnetresource.o b/libnm-kylin/build/libnm-base-kylin/kyapnetresource.o new file mode 100644 index 00000000..7a6dbf78 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kyapnetresource.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kyenterpricesettinginfo.o b/libnm-kylin/build/libnm-base-kylin/kyenterpricesettinginfo.o new file mode 100644 index 00000000..6e10b221 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kyenterpricesettinginfo.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kylinactiveconnectresource.o b/libnm-kylin/build/libnm-base-kylin/kylinactiveconnectresource.o new file mode 100644 index 00000000..0a11359c Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kylinactiveconnectresource.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kylinconnectoperation.o b/libnm-kylin/build/libnm-base-kylin/kylinconnectoperation.o new file mode 100644 index 00000000..840ff05f Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kylinconnectoperation.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kylinconnectsetting.o b/libnm-kylin/build/libnm-base-kylin/kylinconnectsetting.o new file mode 100644 index 00000000..a60e0db0 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kylinconnectsetting.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kylingeneral.o b/libnm-kylin/build/libnm-base-kylin/kylingeneral.o new file mode 100644 index 00000000..3e795138 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kylingeneral.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kylinnetresource.o b/libnm-kylin/build/libnm-base-kylin/kylinnetresource.o new file mode 100644 index 00000000..a1faa223 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kylinnetresource.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kylinnetworkdeviceresource.o b/libnm-kylin/build/libnm-base-kylin/kylinnetworkdeviceresource.o new file mode 100644 index 00000000..7ca9a42f Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kylinnetworkdeviceresource.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kylinnetworkmanagerutil.o b/libnm-kylin/build/libnm-base-kylin/kylinnetworkmanagerutil.o new file mode 100644 index 00000000..0cd946c7 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kylinnetworkmanagerutil.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kylinnetworkmanger.o b/libnm-kylin/build/libnm-base-kylin/kylinnetworkmanger.o new file mode 100644 index 00000000..37ceb9f4 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kylinnetworkmanger.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kylinnetworkresourcemanager.o b/libnm-kylin/build/libnm-base-kylin/kylinnetworkresourcemanager.o new file mode 100644 index 00000000..d8f2e693 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kylinnetworkresourcemanager.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kylinvpnconnectitem.o b/libnm-kylin/build/libnm-base-kylin/kylinvpnconnectitem.o new file mode 100644 index 00000000..083de56b Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kylinvpnconnectitem.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kylinwiredconnectoperation.o b/libnm-kylin/build/libnm-base-kylin/kylinwiredconnectoperation.o new file mode 100644 index 00000000..6e4232a5 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kylinwiredconnectoperation.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kylinwirednetresource.o b/libnm-kylin/build/libnm-base-kylin/kylinwirednetresource.o new file mode 100644 index 00000000..9efa3eb1 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kylinwirednetresource.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kywirelessconnectoperation.o b/libnm-kylin/build/libnm-base-kylin/kywirelessconnectoperation.o new file mode 100644 index 00000000..ff1073d4 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kywirelessconnectoperation.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/kywirelessnetresource.o b/libnm-kylin/build/libnm-base-kylin/kywirelessnetresource.o new file mode 100644 index 00000000..c5a0b720 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/kywirelessnetresource.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kyapnetresource.cpp b/libnm-kylin/build/libnm-base-kylin/moc_kyapnetresource.cpp new file mode 100644 index 00000000..1e45d376 --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_kyapnetresource.cpp @@ -0,0 +1,134 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kyapnetresource.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-base-kylin/kyapnetresource.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kyapnetresource.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyApNetResource_t { + QByteArrayData data[3]; + char stringdata0[46]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyApNetResource_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyApNetResource_t qt_meta_stringdata_KyApNetResource = { + { +QT_MOC_LITERAL(0, 0, 15), // "KyApNetResource" +QT_MOC_LITERAL(1, 16, 28), // "wirelessApConnectStateChange" +QT_MOC_LITERAL(2, 45, 0) // "" + + }, + "KyApNetResource\0wirelessApConnectStateChange\0" + "" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyApNetResource[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 1, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 0, 19, 2, 0x06 /* Public */, + + // signals: parameters + QMetaType::Void, + + 0 // eod +}; + +void KyApNetResource::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + auto *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->wirelessApConnectStateChange(); break; + default: ; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + { + using _t = void (KyApNetResource::*)(); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyApNetResource::wirelessApConnectStateChange)) { + *result = 0; + return; + } + } + } + Q_UNUSED(_a); +} + +QT_INIT_METAOBJECT const QMetaObject KyApNetResource::staticMetaObject = { { + &QObject::staticMetaObject, + qt_meta_stringdata_KyApNetResource.data, + qt_meta_data_KyApNetResource, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyApNetResource::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyApNetResource::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyApNetResource.stringdata0)) + return static_cast(this); + return QObject::qt_metacast(_clname); +} + +int KyApNetResource::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 1) + qt_static_metacall(this, _c, _id, _a); + _id -= 1; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 1) + *reinterpret_cast(_a[0]) = -1; + _id -= 1; + } + return _id; +} + +// SIGNAL 0 +void KyApNetResource::wirelessApConnectStateChange() +{ + QMetaObject::activate(this, &staticMetaObject, 0, nullptr); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kyapnetresource.o b/libnm-kylin/build/libnm-base-kylin/moc_kyapnetresource.o new file mode 100644 index 00000000..ac7f8cd9 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/moc_kyapnetresource.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinactiveconnectresource.cpp b/libnm-kylin/build/libnm-base-kylin/moc_kylinactiveconnectresource.cpp new file mode 100644 index 00000000..870c10c8 --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_kylinactiveconnectresource.cpp @@ -0,0 +1,158 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinactiveconnectresource.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-base-kylin/kylinactiveconnectresource.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinactiveconnectresource.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyActiveConnectResourse_t { + QByteArrayData data[9]; + char stringdata0[104]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyActiveConnectResourse_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyActiveConnectResourse_t qt_meta_stringdata_KyActiveConnectResourse = { + { +QT_MOC_LITERAL(0, 0, 23), // "KyActiveConnectResourse" +QT_MOC_LITERAL(1, 24, 16), // "wiredStateChange" +QT_MOC_LITERAL(2, 41, 0), // "" +QT_MOC_LITERAL(3, 42, 10), // "deviceName" +QT_MOC_LITERAL(4, 53, 4), // "uuid" +QT_MOC_LITERAL(5, 58, 14), // "KyConnectState" +QT_MOC_LITERAL(6, 73, 5), // "state" +QT_MOC_LITERAL(7, 79, 19), // "wirelessStateChange" +QT_MOC_LITERAL(8, 99, 4) // "ssid" + + }, + "KyActiveConnectResourse\0wiredStateChange\0" + "\0deviceName\0uuid\0KyConnectState\0state\0" + "wirelessStateChange\0ssid" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyActiveConnectResourse[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 2, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 2, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 3, 24, 2, 0x06 /* Public */, + 7, 4, 31, 2, 0x06 /* Public */, + + // signals: parameters + QMetaType::Void, QMetaType::QString, QMetaType::QString, 0x80000000 | 5, 3, 4, 6, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, 0x80000000 | 5, 3, 8, 4, 6, + + 0 // eod +}; + +void KyActiveConnectResourse::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + auto *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->wiredStateChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< KyConnectState(*)>(_a[3]))); break; + case 1: _t->wirelessStateChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< KyConnectState(*)>(_a[4]))); break; + default: ; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + { + using _t = void (KyActiveConnectResourse::*)(QString , QString , KyConnectState ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyActiveConnectResourse::wiredStateChange)) { + *result = 0; + return; + } + } + { + using _t = void (KyActiveConnectResourse::*)(QString , QString , QString , KyConnectState ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyActiveConnectResourse::wirelessStateChange)) { + *result = 1; + return; + } + } + } +} + +QT_INIT_METAOBJECT const QMetaObject KyActiveConnectResourse::staticMetaObject = { { + &QObject::staticMetaObject, + qt_meta_stringdata_KyActiveConnectResourse.data, + qt_meta_data_KyActiveConnectResourse, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyActiveConnectResourse::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyActiveConnectResourse::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyActiveConnectResourse.stringdata0)) + return static_cast(this); + return QObject::qt_metacast(_clname); +} + +int KyActiveConnectResourse::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 2) + qt_static_metacall(this, _c, _id, _a); + _id -= 2; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 2) + *reinterpret_cast(_a[0]) = -1; + _id -= 2; + } + return _id; +} + +// SIGNAL 0 +void KyActiveConnectResourse::wiredStateChange(QString _t1, QString _t2, KyConnectState _t3) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} + +// SIGNAL 1 +void KyActiveConnectResourse::wirelessStateChange(QString _t1, QString _t2, QString _t3, KyConnectState _t4) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 1, _a); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinactiveconnectresource.o b/libnm-kylin/build/libnm-base-kylin/moc_kylinactiveconnectresource.o new file mode 100644 index 00000000..63f763f4 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/moc_kylinactiveconnectresource.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinconnectoperation.cpp b/libnm-kylin/build/libnm-base-kylin/moc_kylinconnectoperation.cpp new file mode 100644 index 00000000..036ec614 --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_kylinconnectoperation.cpp @@ -0,0 +1,209 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinconnectoperation.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-base-kylin/kylinconnectoperation.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinconnectoperation.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyConnectOperation_t { + QByteArrayData data[8]; + char stringdata0[149]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyConnectOperation_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyConnectOperation_t qt_meta_stringdata_KyConnectOperation = { + { +QT_MOC_LITERAL(0, 0, 18), // "KyConnectOperation" +QT_MOC_LITERAL(1, 19, 21), // "createConnectionError" +QT_MOC_LITERAL(2, 41, 0), // "" +QT_MOC_LITERAL(3, 42, 12), // "errorMessage" +QT_MOC_LITERAL(4, 55, 21), // "updateConnectionError" +QT_MOC_LITERAL(5, 77, 21), // "deleteConnectionError" +QT_MOC_LITERAL(6, 99, 23), // "activateConnectionError" +QT_MOC_LITERAL(7, 123, 25) // "deactivateConnectionError" + + }, + "KyConnectOperation\0createConnectionError\0" + "\0errorMessage\0updateConnectionError\0" + "deleteConnectionError\0activateConnectionError\0" + "deactivateConnectionError" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyConnectOperation[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 5, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 5, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 1, 39, 2, 0x06 /* Public */, + 4, 1, 42, 2, 0x06 /* Public */, + 5, 1, 45, 2, 0x06 /* Public */, + 6, 1, 48, 2, 0x06 /* Public */, + 7, 1, 51, 2, 0x06 /* Public */, + + // signals: parameters + QMetaType::Void, QMetaType::QString, 3, + QMetaType::Void, QMetaType::QString, 3, + QMetaType::Void, QMetaType::QString, 3, + QMetaType::Void, QMetaType::QString, 3, + QMetaType::Void, QMetaType::QString, 3, + + 0 // eod +}; + +void KyConnectOperation::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + auto *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->createConnectionError((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 1: _t->updateConnectionError((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 2: _t->deleteConnectionError((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 3: _t->activateConnectionError((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 4: _t->deactivateConnectionError((*reinterpret_cast< QString(*)>(_a[1]))); break; + default: ; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + { + using _t = void (KyConnectOperation::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyConnectOperation::createConnectionError)) { + *result = 0; + return; + } + } + { + using _t = void (KyConnectOperation::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyConnectOperation::updateConnectionError)) { + *result = 1; + return; + } + } + { + using _t = void (KyConnectOperation::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyConnectOperation::deleteConnectionError)) { + *result = 2; + return; + } + } + { + using _t = void (KyConnectOperation::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyConnectOperation::activateConnectionError)) { + *result = 3; + return; + } + } + { + using _t = void (KyConnectOperation::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyConnectOperation::deactivateConnectionError)) { + *result = 4; + return; + } + } + } +} + +QT_INIT_METAOBJECT const QMetaObject KyConnectOperation::staticMetaObject = { { + &QObject::staticMetaObject, + qt_meta_stringdata_KyConnectOperation.data, + qt_meta_data_KyConnectOperation, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyConnectOperation::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyConnectOperation::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyConnectOperation.stringdata0)) + return static_cast(this); + return QObject::qt_metacast(_clname); +} + +int KyConnectOperation::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 5) + qt_static_metacall(this, _c, _id, _a); + _id -= 5; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 5) + *reinterpret_cast(_a[0]) = -1; + _id -= 5; + } + return _id; +} + +// SIGNAL 0 +void KyConnectOperation::createConnectionError(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} + +// SIGNAL 1 +void KyConnectOperation::updateConnectionError(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 1, _a); +} + +// SIGNAL 2 +void KyConnectOperation::deleteConnectionError(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 2, _a); +} + +// SIGNAL 3 +void KyConnectOperation::activateConnectionError(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 3, _a); +} + +// SIGNAL 4 +void KyConnectOperation::deactivateConnectionError(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 4, _a); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinconnectoperation.o b/libnm-kylin/build/libnm-base-kylin/moc_kylinconnectoperation.o new file mode 100644 index 00000000..8e82acfb Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/moc_kylinconnectoperation.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylingeneral.cpp b/libnm-kylin/build/libnm-base-kylin/moc_kylingeneral.cpp new file mode 100644 index 00000000..cff79e55 --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_kylingeneral.cpp @@ -0,0 +1,173 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylingeneral.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-base-kylin/kylingeneral.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylingeneral.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KylinGeneralOpration_t { + QByteArrayData data[7]; + char stringdata0[114]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KylinGeneralOpration_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KylinGeneralOpration_t qt_meta_stringdata_KylinGeneralOpration = { + { +QT_MOC_LITERAL(0, 0, 20), // "KylinGeneralOpration" +QT_MOC_LITERAL(1, 21, 19), // "connectivityChanged" +QT_MOC_LITERAL(2, 41, 0), // "" +QT_MOC_LITERAL(3, 42, 14), // "KyConnectivity" +QT_MOC_LITERAL(4, 57, 12), // "connectivity" +QT_MOC_LITERAL(5, 70, 18), // "wifiEnabledChanged" +QT_MOC_LITERAL(6, 89, 24) // "networkingEnabledChanged" + + }, + "KylinGeneralOpration\0connectivityChanged\0" + "\0KyConnectivity\0connectivity\0" + "wifiEnabledChanged\0networkingEnabledChanged" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KylinGeneralOpration[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 3, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 3, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 1, 29, 2, 0x06 /* Public */, + 5, 1, 32, 2, 0x06 /* Public */, + 6, 1, 35, 2, 0x06 /* Public */, + + // signals: parameters + QMetaType::Void, 0x80000000 | 3, 4, + QMetaType::Void, QMetaType::Bool, 2, + QMetaType::Void, QMetaType::Bool, 2, + + 0 // eod +}; + +void KylinGeneralOpration::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + auto *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->connectivityChanged((*reinterpret_cast< KyConnectivity(*)>(_a[1]))); break; + case 1: _t->wifiEnabledChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 2: _t->networkingEnabledChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; + default: ; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + { + using _t = void (KylinGeneralOpration::*)(KyConnectivity ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KylinGeneralOpration::connectivityChanged)) { + *result = 0; + return; + } + } + { + using _t = void (KylinGeneralOpration::*)(bool ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KylinGeneralOpration::wifiEnabledChanged)) { + *result = 1; + return; + } + } + { + using _t = void (KylinGeneralOpration::*)(bool ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KylinGeneralOpration::networkingEnabledChanged)) { + *result = 2; + return; + } + } + } +} + +QT_INIT_METAOBJECT const QMetaObject KylinGeneralOpration::staticMetaObject = { { + &QObject::staticMetaObject, + qt_meta_stringdata_KylinGeneralOpration.data, + qt_meta_data_KylinGeneralOpration, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KylinGeneralOpration::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KylinGeneralOpration::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KylinGeneralOpration.stringdata0)) + return static_cast(this); + return QObject::qt_metacast(_clname); +} + +int KylinGeneralOpration::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 3) + qt_static_metacall(this, _c, _id, _a); + _id -= 3; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 3) + *reinterpret_cast(_a[0]) = -1; + _id -= 3; + } + return _id; +} + +// SIGNAL 0 +void KylinGeneralOpration::connectivityChanged(KyConnectivity _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} + +// SIGNAL 1 +void KylinGeneralOpration::wifiEnabledChanged(bool _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 1, _a); +} + +// SIGNAL 2 +void KylinGeneralOpration::networkingEnabledChanged(bool _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 2, _a); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylingeneral.o b/libnm-kylin/build/libnm-base-kylin/moc_kylingeneral.o new file mode 100644 index 00000000..a6cb97dc Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/moc_kylingeneral.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinnetresource.cpp b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetresource.cpp new file mode 100644 index 00000000..775b3ca6 --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetresource.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinnetresource.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-base-kylin/kylinnetresource.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinnetresource.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyNetResource_t { + QByteArrayData data[1]; + char stringdata0[14]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyNetResource_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyNetResource_t qt_meta_stringdata_KyNetResource = { + { +QT_MOC_LITERAL(0, 0, 13) // "KyNetResource" + + }, + "KyNetResource" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyNetResource[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +void KyNetResource::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +QT_INIT_METAOBJECT const QMetaObject KyNetResource::staticMetaObject = { { + &QObject::staticMetaObject, + qt_meta_stringdata_KyNetResource.data, + qt_meta_data_KyNetResource, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyNetResource::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyNetResource::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyNetResource.stringdata0)) + return static_cast(this); + return QObject::qt_metacast(_clname); +} + +int KyNetResource::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + return _id; +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinnetresource.o b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetresource.o new file mode 100644 index 00000000..ebdde838 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetresource.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkdeviceresource.cpp b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkdeviceresource.cpp new file mode 100644 index 00000000..fe6d0854 --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkdeviceresource.cpp @@ -0,0 +1,180 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinnetworkdeviceresource.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-base-kylin/kylinnetworkdeviceresource.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinnetworkdeviceresource.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyNetworkDeviceResourse_t { + QByteArrayData data[12]; + char stringdata0[180]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyNetworkDeviceResourse_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyNetworkDeviceResourse_t qt_meta_stringdata_KyNetworkDeviceResourse = { + { +QT_MOC_LITERAL(0, 0, 23), // "KyNetworkDeviceResourse" +QT_MOC_LITERAL(1, 24, 17), // "deviceStateChange" +QT_MOC_LITERAL(2, 42, 0), // "" +QT_MOC_LITERAL(3, 43, 10), // "deviceName" +QT_MOC_LITERAL(4, 54, 13), // "KyDeviceState" +QT_MOC_LITERAL(5, 68, 8), // "newstate" +QT_MOC_LITERAL(6, 77, 8), // "oldstate" +QT_MOC_LITERAL(7, 86, 41), // "NetworkManager::Device::State..." +QT_MOC_LITERAL(8, 128, 6), // "reason" +QT_MOC_LITERAL(9, 135, 13), // "carrierChange" +QT_MOC_LITERAL(10, 149, 6), // "pluged" +QT_MOC_LITERAL(11, 156, 23) // "wiredDeviceEnableChange" + + }, + "KyNetworkDeviceResourse\0deviceStateChange\0" + "\0deviceName\0KyDeviceState\0newstate\0" + "oldstate\0NetworkManager::Device::StateChangeReason\0" + "reason\0carrierChange\0pluged\0" + "wiredDeviceEnableChange" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyNetworkDeviceResourse[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 3, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 3, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 4, 29, 2, 0x06 /* Public */, + 9, 2, 38, 2, 0x06 /* Public */, + 11, 2, 43, 2, 0x06 /* Public */, + + // signals: parameters + QMetaType::Void, QMetaType::QString, 0x80000000 | 4, 0x80000000 | 4, 0x80000000 | 7, 3, 5, 6, 8, + QMetaType::Void, QMetaType::QString, QMetaType::Bool, 3, 10, + QMetaType::Void, QMetaType::QString, QMetaType::Bool, 2, 2, + + 0 // eod +}; + +void KyNetworkDeviceResourse::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + auto *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->deviceStateChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< KyDeviceState(*)>(_a[2])),(*reinterpret_cast< KyDeviceState(*)>(_a[3])),(*reinterpret_cast< NetworkManager::Device::StateChangeReason(*)>(_a[4]))); break; + case 1: _t->carrierChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; + case 2: _t->wiredDeviceEnableChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; + default: ; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + { + using _t = void (KyNetworkDeviceResourse::*)(QString , KyDeviceState , KyDeviceState , NetworkManager::Device::StateChangeReason ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkDeviceResourse::deviceStateChange)) { + *result = 0; + return; + } + } + { + using _t = void (KyNetworkDeviceResourse::*)(QString , bool ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkDeviceResourse::carrierChange)) { + *result = 1; + return; + } + } + { + using _t = void (KyNetworkDeviceResourse::*)(QString , bool ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkDeviceResourse::wiredDeviceEnableChange)) { + *result = 2; + return; + } + } + } +} + +QT_INIT_METAOBJECT const QMetaObject KyNetworkDeviceResourse::staticMetaObject = { { + &QObject::staticMetaObject, + qt_meta_stringdata_KyNetworkDeviceResourse.data, + qt_meta_data_KyNetworkDeviceResourse, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyNetworkDeviceResourse::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyNetworkDeviceResourse::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyNetworkDeviceResourse.stringdata0)) + return static_cast(this); + return QObject::qt_metacast(_clname); +} + +int KyNetworkDeviceResourse::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 3) + qt_static_metacall(this, _c, _id, _a); + _id -= 3; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 3) + *reinterpret_cast(_a[0]) = -1; + _id -= 3; + } + return _id; +} + +// SIGNAL 0 +void KyNetworkDeviceResourse::deviceStateChange(QString _t1, KyDeviceState _t2, KyDeviceState _t3, NetworkManager::Device::StateChangeReason _t4) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} + +// SIGNAL 1 +void KyNetworkDeviceResourse::carrierChange(QString _t1, bool _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 1, _a); +} + +// SIGNAL 2 +void KyNetworkDeviceResourse::wiredDeviceEnableChange(QString _t1, bool _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 2, _a); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkdeviceresource.o b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkdeviceresource.o new file mode 100644 index 00000000..7db46dea Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkdeviceresource.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkmanager.cpp b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkmanager.cpp new file mode 100644 index 00000000..354e69be --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkmanager.cpp @@ -0,0 +1,729 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinnetworkmanager.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-base-kylin/kylinnetworkmanager.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinnetworkmanager.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyNetworkManager_t { + QByteArrayData data[98]; + char stringdata0[1722]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyNetworkManager_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyNetworkManager_t qt_meta_stringdata_KyNetworkManager = { + { +QT_MOC_LITERAL(0, 0, 16), // "KyNetworkManager" +QT_MOC_LITERAL(1, 17, 16), // "wiredStateChange" +QT_MOC_LITERAL(2, 34, 0), // "" +QT_MOC_LITERAL(3, 35, 10), // "deviceName" +QT_MOC_LITERAL(4, 46, 4), // "uuid" +QT_MOC_LITERAL(5, 51, 14), // "KyConnectState" +QT_MOC_LITERAL(6, 66, 5), // "state" +QT_MOC_LITERAL(7, 72, 19), // "wirelessStateChange" +QT_MOC_LITERAL(8, 92, 4), // "ssid" +QT_MOC_LITERAL(9, 97, 17), // "deviceStateChange" +QT_MOC_LITERAL(10, 115, 13), // "KyDeviceState" +QT_MOC_LITERAL(11, 129, 8), // "newstate" +QT_MOC_LITERAL(12, 138, 8), // "oldstate" +QT_MOC_LITERAL(13, 147, 41), // "NetworkManager::Device::State..." +QT_MOC_LITERAL(14, 189, 6), // "reason" +QT_MOC_LITERAL(15, 196, 13), // "carrierChange" +QT_MOC_LITERAL(16, 210, 6), // "pluged" +QT_MOC_LITERAL(17, 217, 19), // "connectivityChanged" +QT_MOC_LITERAL(18, 237, 14), // "KyConnectivity" +QT_MOC_LITERAL(19, 252, 12), // "connectivity" +QT_MOC_LITERAL(20, 265, 18), // "wifiEnabledChanged" +QT_MOC_LITERAL(21, 284, 24), // "networkingEnabledChanged" +QT_MOC_LITERAL(22, 309, 18), // "wiredConnectionAdd" +QT_MOC_LITERAL(23, 328, 7), // "devName" +QT_MOC_LITERAL(24, 336, 11), // "connectUuid" +QT_MOC_LITERAL(25, 348, 11), // "connectName" +QT_MOC_LITERAL(26, 360, 11), // "connectPath" +QT_MOC_LITERAL(27, 372, 21), // "wiredConnectionRemove" +QT_MOC_LITERAL(28, 394, 4), // "path" +QT_MOC_LITERAL(29, 399, 14), // "wiredDeviceAdd" +QT_MOC_LITERAL(30, 414, 17), // "wiredDeviceUpdate" +QT_MOC_LITERAL(31, 432, 13), // "oldDeviceName" +QT_MOC_LITERAL(32, 446, 13), // "newDeviceName" +QT_MOC_LITERAL(33, 460, 17), // "wiredDeviceRemove" +QT_MOC_LITERAL(34, 478, 20), // "signalStrengthChange" +QT_MOC_LITERAL(35, 499, 8), // "strength" +QT_MOC_LITERAL(36, 508, 14), // "secuTypeChange" +QT_MOC_LITERAL(37, 523, 12), // "securityType" +QT_MOC_LITERAL(38, 536, 24), // "wirelessConnectionRemove" +QT_MOC_LITERAL(39, 561, 21), // "wirelessConnectionAdd" +QT_MOC_LITERAL(40, 583, 8), // "dbusPath" +QT_MOC_LITERAL(41, 592, 24), // "wirelessConnectionUpdate" +QT_MOC_LITERAL(42, 617, 10), // "KySecuType" +QT_MOC_LITERAL(43, 628, 15), // "connectSecuType" +QT_MOC_LITERAL(44, 644, 17), // "wifiNetworkUpdate" +QT_MOC_LITERAL(45, 662, 14), // "wifiNetworkAdd" +QT_MOC_LITERAL(46, 677, 18), // "KyWirelessNetItem&" +QT_MOC_LITERAL(47, 696, 4), // "item" +QT_MOC_LITERAL(48, 701, 17), // "wifiNetworkRemove" +QT_MOC_LITERAL(49, 719, 17), // "wirelessDeviceAdd" +QT_MOC_LITERAL(50, 737, 20), // "wirelessDeviceRemove" +QT_MOC_LITERAL(51, 758, 24), // "wirelessDeviceNameUpdate" +QT_MOC_LITERAL(52, 783, 7), // "oldName" +QT_MOC_LITERAL(53, 791, 7), // "newName" +QT_MOC_LITERAL(54, 799, 28), // "wirelessApConnectStateChange" +QT_MOC_LITERAL(55, 828, 27), // "onSetWirelessNetworkEnabled" +QT_MOC_LITERAL(56, 856, 7), // "enabled" +QT_MOC_LITERAL(57, 864, 22), // "onSetNetworkingEnabled" +QT_MOC_LITERAL(58, 887, 17), // "onSetWiredEnabled" +QT_MOC_LITERAL(59, 905, 15), // "onDeleteConnect" +QT_MOC_LITERAL(60, 921, 20), // "onActivateConnection" +QT_MOC_LITERAL(61, 942, 22), // "onDeactivateConnection" +QT_MOC_LITERAL(62, 965, 17), // "activeConnectUuid" +QT_MOC_LITERAL(63, 983, 22), // "onSetWiredDeviceEnable" +QT_MOC_LITERAL(64, 1006, 9), // "interface" +QT_MOC_LITERAL(65, 1016, 6), // "enable" +QT_MOC_LITERAL(66, 1023, 21), // "onRequestWirelessScan" +QT_MOC_LITERAL(67, 1045, 20), // "onCreateWiredConnect" +QT_MOC_LITERAL(68, 1066, 16), // "KyConnectSetting" +QT_MOC_LITERAL(69, 1083, 19), // "connectSettingsInfo" +QT_MOC_LITERAL(70, 1103, 26), // "onAddAndActivateNormalWifi" +QT_MOC_LITERAL(71, 1130, 25), // "KyWirelessConnectSetting&" +QT_MOC_LITERAL(72, 1156, 15), // "connSettingInfo" +QT_MOC_LITERAL(73, 1172, 11), // "KySecuType&" +QT_MOC_LITERAL(74, 1184, 4), // "type" +QT_MOC_LITERAL(75, 1189, 42), // "onAddAndActiveWirelessEnterPr..." +QT_MOC_LITERAL(76, 1232, 19), // "KyEapMethodTlsInfo&" +QT_MOC_LITERAL(77, 1252, 4), // "info" +QT_MOC_LITERAL(78, 1257, 43), // "onAddAndActiveWirelessEnterPr..." +QT_MOC_LITERAL(79, 1301, 20), // "KyEapMethodPeapInfo&" +QT_MOC_LITERAL(80, 1322, 43), // "onAddAndActiveWirelessEnterPr..." +QT_MOC_LITERAL(81, 1366, 20), // "KyEapMethodTtlsInfo&" +QT_MOC_LITERAL(82, 1387, 18), // "onAddNormalConnect" +QT_MOC_LITERAL(83, 1406, 24), // "KyWirelessConnectSetting" +QT_MOC_LITERAL(84, 1431, 15), // "onAddTlsConnect" +QT_MOC_LITERAL(85, 1447, 18), // "KyEapMethodTlsInfo" +QT_MOC_LITERAL(86, 1466, 7), // "tlsinfo" +QT_MOC_LITERAL(87, 1474, 16), // "onAddPeapConnect" +QT_MOC_LITERAL(88, 1491, 19), // "KyEapMethodPeapInfo" +QT_MOC_LITERAL(89, 1511, 8), // "peapInfo" +QT_MOC_LITERAL(90, 1520, 16), // "onAddTtlsConnect" +QT_MOC_LITERAL(91, 1537, 19), // "KyEapMethodTtlsInfo" +QT_MOC_LITERAL(92, 1557, 8), // "ttlsInfo" +QT_MOC_LITERAL(93, 1566, 31), // "onUpdateWirelessPersonalConnect" +QT_MOC_LITERAL(94, 1598, 10), // "bPwdChange" +QT_MOC_LITERAL(95, 1609, 36), // "onUpdateWirelessEnterPriseTls..." +QT_MOC_LITERAL(96, 1646, 37), // "onUpdateWirelessEnterPrisePea..." +QT_MOC_LITERAL(97, 1684, 37) // "onUpdateWirelessEnterPriseTtl..." + + }, + "KyNetworkManager\0wiredStateChange\0\0" + "deviceName\0uuid\0KyConnectState\0state\0" + "wirelessStateChange\0ssid\0deviceStateChange\0" + "KyDeviceState\0newstate\0oldstate\0" + "NetworkManager::Device::StateChangeReason\0" + "reason\0carrierChange\0pluged\0" + "connectivityChanged\0KyConnectivity\0" + "connectivity\0wifiEnabledChanged\0" + "networkingEnabledChanged\0wiredConnectionAdd\0" + "devName\0connectUuid\0connectName\0" + "connectPath\0wiredConnectionRemove\0" + "path\0wiredDeviceAdd\0wiredDeviceUpdate\0" + "oldDeviceName\0newDeviceName\0" + "wiredDeviceRemove\0signalStrengthChange\0" + "strength\0secuTypeChange\0securityType\0" + "wirelessConnectionRemove\0wirelessConnectionAdd\0" + "dbusPath\0wirelessConnectionUpdate\0" + "KySecuType\0connectSecuType\0wifiNetworkUpdate\0" + "wifiNetworkAdd\0KyWirelessNetItem&\0" + "item\0wifiNetworkRemove\0wirelessDeviceAdd\0" + "wirelessDeviceRemove\0wirelessDeviceNameUpdate\0" + "oldName\0newName\0wirelessApConnectStateChange\0" + "onSetWirelessNetworkEnabled\0enabled\0" + "onSetNetworkingEnabled\0onSetWiredEnabled\0" + "onDeleteConnect\0onActivateConnection\0" + "onDeactivateConnection\0activeConnectUuid\0" + "onSetWiredDeviceEnable\0interface\0" + "enable\0onRequestWirelessScan\0" + "onCreateWiredConnect\0KyConnectSetting\0" + "connectSettingsInfo\0onAddAndActivateNormalWifi\0" + "KyWirelessConnectSetting&\0connSettingInfo\0" + "KySecuType&\0type\0" + "onAddAndActiveWirelessEnterPriseTlsConnect\0" + "KyEapMethodTlsInfo&\0info\0" + "onAddAndActiveWirelessEnterPrisePeapConnect\0" + "KyEapMethodPeapInfo&\0" + "onAddAndActiveWirelessEnterPriseTtlsConnect\0" + "KyEapMethodTtlsInfo&\0onAddNormalConnect\0" + "KyWirelessConnectSetting\0onAddTlsConnect\0" + "KyEapMethodTlsInfo\0tlsinfo\0onAddPeapConnect\0" + "KyEapMethodPeapInfo\0peapInfo\0" + "onAddTtlsConnect\0KyEapMethodTtlsInfo\0" + "ttlsInfo\0onUpdateWirelessPersonalConnect\0" + "bPwdChange\0onUpdateWirelessEnterPriseTlsConnect\0" + "onUpdateWirelessEnterPrisePeapConnect\0" + "onUpdateWirelessEnterPriseTtlsConnect" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyNetworkManager[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 45, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 24, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 3, 239, 2, 0x06 /* Public */, + 7, 4, 246, 2, 0x06 /* Public */, + 9, 4, 255, 2, 0x06 /* Public */, + 15, 2, 264, 2, 0x06 /* Public */, + 17, 1, 269, 2, 0x06 /* Public */, + 20, 1, 272, 2, 0x06 /* Public */, + 21, 1, 275, 2, 0x06 /* Public */, + 22, 4, 278, 2, 0x06 /* Public */, + 27, 1, 287, 2, 0x06 /* Public */, + 29, 1, 290, 2, 0x06 /* Public */, + 30, 2, 293, 2, 0x06 /* Public */, + 33, 1, 298, 2, 0x06 /* Public */, + 34, 3, 301, 2, 0x06 /* Public */, + 36, 3, 308, 2, 0x06 /* Public */, + 38, 2, 315, 2, 0x06 /* Public */, + 39, 4, 320, 2, 0x06 /* Public */, + 41, 5, 329, 2, 0x06 /* Public */, + 44, 0, 340, 2, 0x06 /* Public */, + 45, 2, 341, 2, 0x06 /* Public */, + 48, 2, 346, 2, 0x06 /* Public */, + 49, 1, 351, 2, 0x06 /* Public */, + 50, 1, 354, 2, 0x06 /* Public */, + 51, 2, 357, 2, 0x06 /* Public */, + 54, 0, 362, 2, 0x06 /* Public */, + + // slots: name, argc, parameters, tag, flags + 55, 1, 363, 2, 0x0a /* Public */, + 57, 1, 366, 2, 0x0a /* Public */, + 58, 1, 369, 2, 0x0a /* Public */, + 59, 1, 372, 2, 0x0a /* Public */, + 60, 2, 375, 2, 0x0a /* Public */, + 61, 1, 380, 2, 0x0a /* Public */, + 63, 2, 383, 2, 0x0a /* Public */, + 66, 0, 388, 2, 0x0a /* Public */, + 67, 1, 389, 2, 0x0a /* Public */, + 70, 2, 392, 2, 0x0a /* Public */, + 75, 2, 397, 2, 0x0a /* Public */, + 78, 2, 402, 2, 0x0a /* Public */, + 80, 2, 407, 2, 0x0a /* Public */, + 82, 2, 412, 2, 0x0a /* Public */, + 84, 2, 417, 2, 0x0a /* Public */, + 87, 2, 422, 2, 0x0a /* Public */, + 90, 2, 427, 2, 0x0a /* Public */, + 93, 3, 432, 2, 0x0a /* Public */, + 95, 2, 439, 2, 0x0a /* Public */, + 96, 2, 444, 2, 0x0a /* Public */, + 97, 2, 449, 2, 0x0a /* Public */, + + // signals: parameters + QMetaType::Void, QMetaType::QString, QMetaType::QString, 0x80000000 | 5, 3, 4, 6, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, 0x80000000 | 5, 3, 8, 4, 6, + QMetaType::Void, QMetaType::QString, 0x80000000 | 10, 0x80000000 | 10, 0x80000000 | 13, 3, 11, 12, 14, + QMetaType::Void, QMetaType::QString, QMetaType::Bool, 3, 16, + QMetaType::Void, 0x80000000 | 18, 19, + QMetaType::Void, QMetaType::Bool, 2, + QMetaType::Void, QMetaType::Bool, 2, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, QMetaType::QString, 23, 24, 25, 26, + QMetaType::Void, QMetaType::QString, 28, + QMetaType::Void, QMetaType::QString, 3, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 31, 32, + QMetaType::Void, QMetaType::QString, 3, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::Int, 3, 8, 35, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, 3, 8, 37, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 3, 8, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, QMetaType::QString, 3, 8, 4, 40, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, QMetaType::QString, 0x80000000 | 42, 3, 8, 4, 40, 43, + QMetaType::Void, + QMetaType::Void, QMetaType::QString, 0x80000000 | 46, 3, 47, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 3, 8, + QMetaType::Void, QMetaType::QString, 3, + QMetaType::Void, QMetaType::QString, 3, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 52, 53, + QMetaType::Void, + + // slots: parameters + QMetaType::Void, QMetaType::Bool, 56, + QMetaType::Void, QMetaType::Bool, 56, + QMetaType::Void, QMetaType::Bool, 56, + QMetaType::Void, QMetaType::QString, 24, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 24, 3, + QMetaType::Void, QMetaType::QString, 62, + QMetaType::Void, QMetaType::QString, QMetaType::Bool, 64, 65, + QMetaType::Void, + QMetaType::Void, 0x80000000 | 68, 69, + QMetaType::Void, 0x80000000 | 71, 0x80000000 | 73, 72, 74, + QMetaType::Void, 0x80000000 | 76, 0x80000000 | 71, 77, 72, + QMetaType::Void, 0x80000000 | 79, 0x80000000 | 71, 77, 72, + QMetaType::Void, 0x80000000 | 81, 0x80000000 | 71, 77, 72, + QMetaType::Void, 0x80000000 | 83, 0x80000000 | 73, 72, 74, + QMetaType::Void, 0x80000000 | 83, 0x80000000 | 85, 72, 86, + QMetaType::Void, 0x80000000 | 83, 0x80000000 | 88, 72, 89, + QMetaType::Void, 0x80000000 | 83, 0x80000000 | 91, 72, 92, + QMetaType::Void, QMetaType::QString, 0x80000000 | 83, QMetaType::Bool, 4, 72, 94, + QMetaType::Void, QMetaType::QString, 0x80000000 | 85, 4, 86, + QMetaType::Void, QMetaType::QString, 0x80000000 | 88, 4, 89, + QMetaType::Void, QMetaType::QString, 0x80000000 | 91, 4, 92, + + 0 // eod +}; + +void KyNetworkManager::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + auto *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->wiredStateChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< KyConnectState(*)>(_a[3]))); break; + case 1: _t->wirelessStateChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< KyConnectState(*)>(_a[4]))); break; + case 2: _t->deviceStateChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< KyDeviceState(*)>(_a[2])),(*reinterpret_cast< KyDeviceState(*)>(_a[3])),(*reinterpret_cast< NetworkManager::Device::StateChangeReason(*)>(_a[4]))); break; + case 3: _t->carrierChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; + case 4: _t->connectivityChanged((*reinterpret_cast< KyConnectivity(*)>(_a[1]))); break; + case 5: _t->wifiEnabledChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 6: _t->networkingEnabledChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 7: _t->wiredConnectionAdd((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< QString(*)>(_a[4]))); break; + case 8: _t->wiredConnectionRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 9: _t->wiredDeviceAdd((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 10: _t->wiredDeviceUpdate((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 11: _t->wiredDeviceRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 12: _t->signalStrengthChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; + case 13: _t->secuTypeChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break; + case 14: _t->wirelessConnectionRemove((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 15: _t->wirelessConnectionAdd((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< QString(*)>(_a[4]))); break; + case 16: _t->wirelessConnectionUpdate((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< QString(*)>(_a[4])),(*reinterpret_cast< KySecuType(*)>(_a[5]))); break; + case 17: _t->wifiNetworkUpdate(); break; + case 18: _t->wifiNetworkAdd((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< KyWirelessNetItem(*)>(_a[2]))); break; + case 19: _t->wifiNetworkRemove((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 20: _t->wirelessDeviceAdd((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 21: _t->wirelessDeviceRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 22: _t->wirelessDeviceNameUpdate((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 23: _t->wirelessApConnectStateChange(); break; + case 24: _t->onSetWirelessNetworkEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 25: _t->onSetNetworkingEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 26: _t->onSetWiredEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 27: _t->onDeleteConnect((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 28: _t->onActivateConnection((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break; + case 29: _t->onDeactivateConnection((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 30: _t->onSetWiredDeviceEnable((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; + case 31: _t->onRequestWirelessScan(); break; + case 32: _t->onCreateWiredConnect((*reinterpret_cast< KyConnectSetting(*)>(_a[1]))); break; + case 33: _t->onAddAndActivateNormalWifi((*reinterpret_cast< KyWirelessConnectSetting(*)>(_a[1])),(*reinterpret_cast< KySecuType(*)>(_a[2]))); break; + case 34: _t->onAddAndActiveWirelessEnterPriseTlsConnect((*reinterpret_cast< KyEapMethodTlsInfo(*)>(_a[1])),(*reinterpret_cast< KyWirelessConnectSetting(*)>(_a[2]))); break; + case 35: _t->onAddAndActiveWirelessEnterPrisePeapConnect((*reinterpret_cast< KyEapMethodPeapInfo(*)>(_a[1])),(*reinterpret_cast< KyWirelessConnectSetting(*)>(_a[2]))); break; + case 36: _t->onAddAndActiveWirelessEnterPriseTtlsConnect((*reinterpret_cast< KyEapMethodTtlsInfo(*)>(_a[1])),(*reinterpret_cast< KyWirelessConnectSetting(*)>(_a[2]))); break; + case 37: _t->onAddNormalConnect((*reinterpret_cast< const KyWirelessConnectSetting(*)>(_a[1])),(*reinterpret_cast< KySecuType(*)>(_a[2]))); break; + case 38: _t->onAddTlsConnect((*reinterpret_cast< const KyWirelessConnectSetting(*)>(_a[1])),(*reinterpret_cast< const KyEapMethodTlsInfo(*)>(_a[2]))); break; + case 39: _t->onAddPeapConnect((*reinterpret_cast< const KyWirelessConnectSetting(*)>(_a[1])),(*reinterpret_cast< const KyEapMethodPeapInfo(*)>(_a[2]))); break; + case 40: _t->onAddTtlsConnect((*reinterpret_cast< const KyWirelessConnectSetting(*)>(_a[1])),(*reinterpret_cast< const KyEapMethodTtlsInfo(*)>(_a[2]))); break; + case 41: _t->onUpdateWirelessPersonalConnect((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const KyWirelessConnectSetting(*)>(_a[2])),(*reinterpret_cast< bool(*)>(_a[3]))); break; + case 42: _t->onUpdateWirelessEnterPriseTlsConnect((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const KyEapMethodTlsInfo(*)>(_a[2]))); break; + case 43: _t->onUpdateWirelessEnterPrisePeapConnect((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const KyEapMethodPeapInfo(*)>(_a[2]))); break; + case 44: _t->onUpdateWirelessEnterPriseTtlsConnect((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const KyEapMethodTtlsInfo(*)>(_a[2]))); break; + default: ; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + { + using _t = void (KyNetworkManager::*)(QString , QString , KyConnectState ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wiredStateChange)) { + *result = 0; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , QString , QString , KyConnectState ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wirelessStateChange)) { + *result = 1; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , KyDeviceState , KyDeviceState , NetworkManager::Device::StateChangeReason ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::deviceStateChange)) { + *result = 2; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , bool ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::carrierChange)) { + *result = 3; + return; + } + } + { + using _t = void (KyNetworkManager::*)(KyConnectivity ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::connectivityChanged)) { + *result = 4; + return; + } + } + { + using _t = void (KyNetworkManager::*)(bool ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wifiEnabledChanged)) { + *result = 5; + return; + } + } + { + using _t = void (KyNetworkManager::*)(bool ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::networkingEnabledChanged)) { + *result = 6; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , QString , QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wiredConnectionAdd)) { + *result = 7; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wiredConnectionRemove)) { + *result = 8; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wiredDeviceAdd)) { + *result = 9; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wiredDeviceUpdate)) { + *result = 10; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wiredDeviceRemove)) { + *result = 11; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , QString , int ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::signalStrengthChange)) { + *result = 12; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::secuTypeChange)) { + *result = 13; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wirelessConnectionRemove)) { + *result = 14; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , QString , QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wirelessConnectionAdd)) { + *result = 15; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , QString , QString , QString , KySecuType ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wirelessConnectionUpdate)) { + *result = 16; + return; + } + } + { + using _t = void (KyNetworkManager::*)(); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wifiNetworkUpdate)) { + *result = 17; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , KyWirelessNetItem & ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wifiNetworkAdd)) { + *result = 18; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wifiNetworkRemove)) { + *result = 19; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wirelessDeviceAdd)) { + *result = 20; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wirelessDeviceRemove)) { + *result = 21; + return; + } + } + { + using _t = void (KyNetworkManager::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wirelessDeviceNameUpdate)) { + *result = 22; + return; + } + } + { + using _t = void (KyNetworkManager::*)(); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkManager::wirelessApConnectStateChange)) { + *result = 23; + return; + } + } + } +} + +QT_INIT_METAOBJECT const QMetaObject KyNetworkManager::staticMetaObject = { { + &QObject::staticMetaObject, + qt_meta_stringdata_KyNetworkManager.data, + qt_meta_data_KyNetworkManager, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyNetworkManager::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyNetworkManager::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyNetworkManager.stringdata0)) + return static_cast(this); + return QObject::qt_metacast(_clname); +} + +int KyNetworkManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 45) + qt_static_metacall(this, _c, _id, _a); + _id -= 45; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 45) + *reinterpret_cast(_a[0]) = -1; + _id -= 45; + } + return _id; +} + +// SIGNAL 0 +void KyNetworkManager::wiredStateChange(QString _t1, QString _t2, KyConnectState _t3) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} + +// SIGNAL 1 +void KyNetworkManager::wirelessStateChange(QString _t1, QString _t2, QString _t3, KyConnectState _t4) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 1, _a); +} + +// SIGNAL 2 +void KyNetworkManager::deviceStateChange(QString _t1, KyDeviceState _t2, KyDeviceState _t3, NetworkManager::Device::StateChangeReason _t4) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 2, _a); +} + +// SIGNAL 3 +void KyNetworkManager::carrierChange(QString _t1, bool _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 3, _a); +} + +// SIGNAL 4 +void KyNetworkManager::connectivityChanged(KyConnectivity _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 4, _a); +} + +// SIGNAL 5 +void KyNetworkManager::wifiEnabledChanged(bool _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 5, _a); +} + +// SIGNAL 6 +void KyNetworkManager::networkingEnabledChanged(bool _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 6, _a); +} + +// SIGNAL 7 +void KyNetworkManager::wiredConnectionAdd(QString _t1, QString _t2, QString _t3, QString _t4) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 7, _a); +} + +// SIGNAL 8 +void KyNetworkManager::wiredConnectionRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 8, _a); +} + +// SIGNAL 9 +void KyNetworkManager::wiredDeviceAdd(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 9, _a); +} + +// SIGNAL 10 +void KyNetworkManager::wiredDeviceUpdate(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 10, _a); +} + +// SIGNAL 11 +void KyNetworkManager::wiredDeviceRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 11, _a); +} + +// SIGNAL 12 +void KyNetworkManager::signalStrengthChange(QString _t1, QString _t2, int _t3) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)) }; + QMetaObject::activate(this, &staticMetaObject, 12, _a); +} + +// SIGNAL 13 +void KyNetworkManager::secuTypeChange(QString _t1, QString _t2, QString _t3) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)) }; + QMetaObject::activate(this, &staticMetaObject, 13, _a); +} + +// SIGNAL 14 +void KyNetworkManager::wirelessConnectionRemove(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 14, _a); +} + +// SIGNAL 15 +void KyNetworkManager::wirelessConnectionAdd(QString _t1, QString _t2, QString _t3, QString _t4) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 15, _a); +} + +// SIGNAL 16 +void KyNetworkManager::wirelessConnectionUpdate(QString _t1, QString _t2, QString _t3, QString _t4, KySecuType _t5) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)), const_cast(reinterpret_cast(&_t5)) }; + QMetaObject::activate(this, &staticMetaObject, 16, _a); +} + +// SIGNAL 17 +void KyNetworkManager::wifiNetworkUpdate() +{ + QMetaObject::activate(this, &staticMetaObject, 17, nullptr); +} + +// SIGNAL 18 +void KyNetworkManager::wifiNetworkAdd(QString _t1, KyWirelessNetItem & _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 18, _a); +} + +// SIGNAL 19 +void KyNetworkManager::wifiNetworkRemove(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 19, _a); +} + +// SIGNAL 20 +void KyNetworkManager::wirelessDeviceAdd(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 20, _a); +} + +// SIGNAL 21 +void KyNetworkManager::wirelessDeviceRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 21, _a); +} + +// SIGNAL 22 +void KyNetworkManager::wirelessDeviceNameUpdate(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 22, _a); +} + +// SIGNAL 23 +void KyNetworkManager::wirelessApConnectStateChange() +{ + QMetaObject::activate(this, &staticMetaObject, 23, nullptr); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkmanager.o b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkmanager.o new file mode 100644 index 00000000..34ac1d3d Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkmanager.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkresourcemanager.cpp b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkresourcemanager.cpp new file mode 100644 index 00000000..eb913a65 --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkresourcemanager.cpp @@ -0,0 +1,889 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinnetworkresourcemanager.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-base-kylin/kylinnetworkresourcemanager.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinnetworkresourcemanager.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyNetworkResourceManager_t { + QByteArrayData data[91]; + char stringdata0[1677]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyNetworkResourceManager_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyNetworkResourceManager_t qt_meta_stringdata_KyNetworkResourceManager = { + { +QT_MOC_LITERAL(0, 0, 24), // "KyNetworkResourceManager" +QT_MOC_LITERAL(1, 25, 18), // "wiredConnectionAdd" +QT_MOC_LITERAL(2, 44, 0), // "" +QT_MOC_LITERAL(3, 45, 7), // "devName" +QT_MOC_LITERAL(4, 53, 11), // "connectUuid" +QT_MOC_LITERAL(5, 65, 11), // "connectName" +QT_MOC_LITERAL(6, 77, 11), // "connectPath" +QT_MOC_LITERAL(7, 89, 21), // "wiredConnectionRemove" +QT_MOC_LITERAL(8, 111, 4), // "path" +QT_MOC_LITERAL(9, 116, 13), // "connectionAdd" +QT_MOC_LITERAL(10, 130, 16), // "connectionUpdate" +QT_MOC_LITERAL(11, 147, 16), // "connectionRemove" +QT_MOC_LITERAL(12, 164, 14), // "wiredDeviceAdd" +QT_MOC_LITERAL(13, 179, 10), // "deviceName" +QT_MOC_LITERAL(14, 190, 17), // "wiredDeviceUpdate" +QT_MOC_LITERAL(15, 208, 13), // "oldDeviceName" +QT_MOC_LITERAL(16, 222, 13), // "newDeviceName" +QT_MOC_LITERAL(17, 236, 17), // "wiredDeviceRemove" +QT_MOC_LITERAL(18, 254, 17), // "wirelessDeviceAdd" +QT_MOC_LITERAL(19, 272, 20), // "wirelessDeviceUpdate" +QT_MOC_LITERAL(20, 293, 20), // "wirelessDeviceRemove" +QT_MOC_LITERAL(21, 314, 9), // "deviceAdd" +QT_MOC_LITERAL(22, 324, 12), // "KyDeviceType" +QT_MOC_LITERAL(23, 337, 10), // "deviceType" +QT_MOC_LITERAL(24, 348, 12), // "deviceUpdate" +QT_MOC_LITERAL(25, 361, 12), // "deviceRemove" +QT_MOC_LITERAL(26, 374, 18), // "deviceActiveChange" +QT_MOC_LITERAL(27, 393, 12), // "deviceActive" +QT_MOC_LITERAL(28, 406, 19), // "deviceCarrierChange" +QT_MOC_LITERAL(29, 426, 6), // "pluged" +QT_MOC_LITERAL(30, 433, 19), // "deviceBitRateChange" +QT_MOC_LITERAL(31, 453, 7), // "bitRate" +QT_MOC_LITERAL(32, 461, 22), // "deviceMacAddressChange" +QT_MOC_LITERAL(33, 484, 9), // "hwAddress" +QT_MOC_LITERAL(34, 494, 17), // "deviceStateChange" +QT_MOC_LITERAL(35, 512, 13), // "KyDeviceState" +QT_MOC_LITERAL(36, 526, 8), // "newstate" +QT_MOC_LITERAL(37, 535, 8), // "oldstate" +QT_MOC_LITERAL(38, 544, 41), // "NetworkManager::Device::State..." +QT_MOC_LITERAL(39, 586, 6), // "reason" +QT_MOC_LITERAL(40, 593, 18), // "wifiNetworkRemoved" +QT_MOC_LITERAL(41, 612, 16), // "wifiNetworkAdded" +QT_MOC_LITERAL(42, 629, 25), // "wifiNetworkPropertyChange" +QT_MOC_LITERAL(43, 655, 32), // "NetworkManager::WirelessNetwork*" +QT_MOC_LITERAL(44, 688, 3), // "net" +QT_MOC_LITERAL(45, 692, 26), // "wifiNetworkDeviceDisappear" +QT_MOC_LITERAL(46, 719, 21), // "wirelessConnectionAdd" +QT_MOC_LITERAL(47, 741, 24), // "wirelessConnectionRemove" +QT_MOC_LITERAL(48, 766, 19), // "activeConnectionAdd" +QT_MOC_LITERAL(49, 786, 4), // "uuid" +QT_MOC_LITERAL(50, 791, 22), // "activeConnectionRemove" +QT_MOC_LITERAL(51, 814, 23), // "wiredConnectStateChange" +QT_MOC_LITERAL(52, 838, 14), // "KyConnectState" +QT_MOC_LITERAL(53, 853, 5), // "state" +QT_MOC_LITERAL(54, 859, 26), // "wirelessConnectStateChange" +QT_MOC_LITERAL(55, 886, 4), // "ssid" +QT_MOC_LITERAL(56, 891, 28), // "wirelessApConnectStateChange" +QT_MOC_LITERAL(57, 920, 19), // "connectivityChanged" +QT_MOC_LITERAL(58, 940, 14), // "KyConnectivity" +QT_MOC_LITERAL(59, 955, 12), // "connectivity" +QT_MOC_LITERAL(60, 968, 18), // "wifiEnabledChanged" +QT_MOC_LITERAL(61, 987, 24), // "networkingEnabledChanged" +QT_MOC_LITERAL(62, 1012, 15), // "onServiceAppear" +QT_MOC_LITERAL(63, 1028, 13), // "onInitNetwork" +QT_MOC_LITERAL(64, 1042, 25), // "setWirelessNetworkEnabled" +QT_MOC_LITERAL(65, 1068, 7), // "enabled" +QT_MOC_LITERAL(66, 1076, 19), // "onConnectionUpdated" +QT_MOC_LITERAL(67, 1096, 25), // "onActiveConnectionChanged" +QT_MOC_LITERAL(68, 1122, 39), // "NetworkManager::ActiveConnect..." +QT_MOC_LITERAL(69, 1162, 31), // "onVpnActiveConnectChangedReason" +QT_MOC_LITERAL(70, 1194, 36), // "NetworkManager::VpnConnection..." +QT_MOC_LITERAL(71, 1231, 48), // "NetworkManager::VpnConnection..." +QT_MOC_LITERAL(72, 1280, 20), // "onDeviceActiveChange" +QT_MOC_LITERAL(73, 1301, 21), // "onDeviceCarrierChange" +QT_MOC_LITERAL(74, 1323, 21), // "onDeviceBitRateChange" +QT_MOC_LITERAL(75, 1345, 24), // "onDeviceMacAddressChange" +QT_MOC_LITERAL(76, 1370, 20), // "onDeviceStateChanged" +QT_MOC_LITERAL(77, 1391, 29), // "NetworkManager::Device::State" +QT_MOC_LITERAL(78, 1421, 21), // "onWifiNetworkAppeared" +QT_MOC_LITERAL(79, 1443, 24), // "onWifiNetworkDisappeared" +QT_MOC_LITERAL(80, 1468, 19), // "onUpdateWirelessNet" +QT_MOC_LITERAL(81, 1488, 21), // "onConnectivityChanged" +QT_MOC_LITERAL(82, 1510, 28), // "NetworkManager::Connectivity" +QT_MOC_LITERAL(83, 1539, 13), // "onDeviceAdded" +QT_MOC_LITERAL(84, 1553, 3), // "uni" +QT_MOC_LITERAL(85, 1557, 15), // "onDeviceRemoved" +QT_MOC_LITERAL(86, 1573, 15), // "onDeviceUpdated" +QT_MOC_LITERAL(87, 1589, 23), // "onActiveConnectionAdded" +QT_MOC_LITERAL(88, 1613, 25), // "onActiveConnectionRemoved" +QT_MOC_LITERAL(89, 1639, 17), // "onConnectionAdded" +QT_MOC_LITERAL(90, 1657, 19) // "onConnectionRemoved" + + }, + "KyNetworkResourceManager\0wiredConnectionAdd\0" + "\0devName\0connectUuid\0connectName\0" + "connectPath\0wiredConnectionRemove\0" + "path\0connectionAdd\0connectionUpdate\0" + "connectionRemove\0wiredDeviceAdd\0" + "deviceName\0wiredDeviceUpdate\0oldDeviceName\0" + "newDeviceName\0wiredDeviceRemove\0" + "wirelessDeviceAdd\0wirelessDeviceUpdate\0" + "wirelessDeviceRemove\0deviceAdd\0" + "KyDeviceType\0deviceType\0deviceUpdate\0" + "deviceRemove\0deviceActiveChange\0" + "deviceActive\0deviceCarrierChange\0" + "pluged\0deviceBitRateChange\0bitRate\0" + "deviceMacAddressChange\0hwAddress\0" + "deviceStateChange\0KyDeviceState\0" + "newstate\0oldstate\0" + "NetworkManager::Device::StateChangeReason\0" + "reason\0wifiNetworkRemoved\0wifiNetworkAdded\0" + "wifiNetworkPropertyChange\0" + "NetworkManager::WirelessNetwork*\0net\0" + "wifiNetworkDeviceDisappear\0" + "wirelessConnectionAdd\0wirelessConnectionRemove\0" + "activeConnectionAdd\0uuid\0" + "activeConnectionRemove\0wiredConnectStateChange\0" + "KyConnectState\0state\0wirelessConnectStateChange\0" + "ssid\0wirelessApConnectStateChange\0" + "connectivityChanged\0KyConnectivity\0" + "connectivity\0wifiEnabledChanged\0" + "networkingEnabledChanged\0onServiceAppear\0" + "onInitNetwork\0setWirelessNetworkEnabled\0" + "enabled\0onConnectionUpdated\0" + "onActiveConnectionChanged\0" + "NetworkManager::ActiveConnection::State\0" + "onVpnActiveConnectChangedReason\0" + "NetworkManager::VpnConnection::State\0" + "NetworkManager::VpnConnection::StateChangeReason\0" + "onDeviceActiveChange\0onDeviceCarrierChange\0" + "onDeviceBitRateChange\0onDeviceMacAddressChange\0" + "onDeviceStateChanged\0NetworkManager::Device::State\0" + "onWifiNetworkAppeared\0onWifiNetworkDisappeared\0" + "onUpdateWirelessNet\0onConnectivityChanged\0" + "NetworkManager::Connectivity\0onDeviceAdded\0" + "uni\0onDeviceRemoved\0onDeviceUpdated\0" + "onActiveConnectionAdded\0" + "onActiveConnectionRemoved\0onConnectionAdded\0" + "onConnectionRemoved" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyNetworkResourceManager[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 55, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 33, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 4, 289, 2, 0x06 /* Public */, + 7, 1, 298, 2, 0x06 /* Public */, + 9, 3, 301, 2, 0x06 /* Public */, + 10, 3, 308, 2, 0x06 /* Public */, + 11, 1, 315, 2, 0x06 /* Public */, + 12, 1, 318, 2, 0x06 /* Public */, + 14, 2, 321, 2, 0x06 /* Public */, + 17, 1, 326, 2, 0x06 /* Public */, + 18, 1, 329, 2, 0x06 /* Public */, + 19, 2, 332, 2, 0x06 /* Public */, + 20, 1, 337, 2, 0x06 /* Public */, + 21, 2, 340, 2, 0x06 /* Public */, + 24, 2, 345, 2, 0x06 /* Public */, + 25, 1, 350, 2, 0x06 /* Public */, + 26, 2, 353, 2, 0x06 /* Public */, + 28, 2, 358, 2, 0x06 /* Public */, + 30, 2, 363, 2, 0x06 /* Public */, + 32, 2, 368, 2, 0x06 /* Public */, + 34, 4, 373, 2, 0x06 /* Public */, + 40, 2, 382, 2, 0x06 /* Public */, + 41, 2, 387, 2, 0x06 /* Public */, + 42, 1, 392, 2, 0x06 /* Public */, + 45, 0, 395, 2, 0x06 /* Public */, + 46, 3, 396, 2, 0x06 /* Public */, + 47, 1, 403, 2, 0x06 /* Public */, + 48, 1, 406, 2, 0x06 /* Public */, + 50, 1, 409, 2, 0x06 /* Public */, + 51, 3, 412, 2, 0x06 /* Public */, + 54, 4, 419, 2, 0x06 /* Public */, + 56, 0, 428, 2, 0x06 /* Public */, + 57, 1, 429, 2, 0x06 /* Public */, + 60, 1, 432, 2, 0x06 /* Public */, + 61, 1, 435, 2, 0x06 /* Public */, + + // slots: name, argc, parameters, tag, flags + 62, 3, 438, 2, 0x08 /* Private */, + 63, 0, 445, 2, 0x0a /* Public */, + 64, 1, 446, 2, 0x0a /* Public */, + 66, 0, 449, 2, 0x0a /* Public */, + 67, 1, 450, 2, 0x0a /* Public */, + 69, 2, 453, 2, 0x0a /* Public */, + 72, 0, 458, 2, 0x0a /* Public */, + 73, 1, 459, 2, 0x0a /* Public */, + 74, 1, 462, 2, 0x0a /* Public */, + 75, 1, 465, 2, 0x0a /* Public */, + 76, 3, 468, 2, 0x0a /* Public */, + 78, 1, 475, 2, 0x0a /* Public */, + 79, 1, 478, 2, 0x0a /* Public */, + 80, 0, 481, 2, 0x0a /* Public */, + 81, 1, 482, 2, 0x0a /* Public */, + 83, 1, 485, 2, 0x0a /* Public */, + 85, 1, 488, 2, 0x0a /* Public */, + 86, 0, 491, 2, 0x0a /* Public */, + 87, 1, 492, 2, 0x0a /* Public */, + 88, 1, 495, 2, 0x0a /* Public */, + 89, 1, 498, 2, 0x0a /* Public */, + 90, 1, 501, 2, 0x0a /* Public */, + + // signals: parameters + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, QMetaType::QString, 3, 4, 5, 6, + QMetaType::Void, QMetaType::QString, 8, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, 4, 5, 6, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, 4, 5, 6, + QMetaType::Void, QMetaType::QString, 8, + QMetaType::Void, QMetaType::QString, 13, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 15, 16, + QMetaType::Void, QMetaType::QString, 13, + QMetaType::Void, QMetaType::QString, 13, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 15, 16, + QMetaType::Void, QMetaType::QString, 13, + QMetaType::Void, QMetaType::QString, 0x80000000 | 22, 13, 23, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 15, 16, + QMetaType::Void, QMetaType::QString, 13, + QMetaType::Void, QMetaType::QString, QMetaType::Bool, 13, 27, + QMetaType::Void, QMetaType::QString, QMetaType::Bool, 13, 29, + QMetaType::Void, QMetaType::QString, QMetaType::Int, 13, 31, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 13, 33, + QMetaType::Void, QMetaType::QString, 0x80000000 | 35, 0x80000000 | 35, 0x80000000 | 38, 13, 36, 37, 39, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 2, 2, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 2, 2, + QMetaType::Void, 0x80000000 | 43, 44, + QMetaType::Void, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, 4, 5, 6, + QMetaType::Void, QMetaType::QString, 8, + QMetaType::Void, QMetaType::QString, 49, + QMetaType::Void, QMetaType::QString, 49, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 0x80000000 | 52, 13, 49, 53, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, 0x80000000 | 52, 13, 55, 49, 53, + QMetaType::Void, + QMetaType::Void, 0x80000000 | 58, 59, + QMetaType::Void, QMetaType::Bool, 2, + QMetaType::Void, QMetaType::Bool, 2, + + // slots: parameters + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, 2, 2, 2, + QMetaType::Void, + QMetaType::Void, QMetaType::Bool, 65, + QMetaType::Void, + QMetaType::Void, 0x80000000 | 68, 53, + QMetaType::Void, 0x80000000 | 70, 0x80000000 | 71, 53, 39, + QMetaType::Void, + QMetaType::Void, QMetaType::Bool, 29, + QMetaType::Void, QMetaType::Int, 31, + QMetaType::Void, QMetaType::QString, 33, + QMetaType::Void, 0x80000000 | 77, 0x80000000 | 77, 0x80000000 | 38, 36, 37, 39, + QMetaType::Void, QMetaType::QString, 55, + QMetaType::Void, QMetaType::QString, 55, + QMetaType::Void, + QMetaType::Void, 0x80000000 | 82, 59, + QMetaType::Void, QMetaType::QString, 84, + QMetaType::Void, QMetaType::QString, 84, + QMetaType::Void, + QMetaType::Void, QMetaType::QString, 8, + QMetaType::Void, QMetaType::QString, 8, + QMetaType::Void, QMetaType::QString, 8, + QMetaType::Void, QMetaType::QString, 8, + + 0 // eod +}; + +void KyNetworkResourceManager::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + auto *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->wiredConnectionAdd((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< QString(*)>(_a[4]))); break; + case 1: _t->wiredConnectionRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 2: _t->connectionAdd((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break; + case 3: _t->connectionUpdate((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break; + case 4: _t->connectionRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 5: _t->wiredDeviceAdd((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 6: _t->wiredDeviceUpdate((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 7: _t->wiredDeviceRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 8: _t->wirelessDeviceAdd((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 9: _t->wirelessDeviceUpdate((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 10: _t->wirelessDeviceRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 11: _t->deviceAdd((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< KyDeviceType(*)>(_a[2]))); break; + case 12: _t->deviceUpdate((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 13: _t->deviceRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 14: _t->deviceActiveChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; + case 15: _t->deviceCarrierChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; + case 16: _t->deviceBitRateChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 17: _t->deviceMacAddressChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break; + case 18: _t->deviceStateChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< KyDeviceState(*)>(_a[2])),(*reinterpret_cast< KyDeviceState(*)>(_a[3])),(*reinterpret_cast< NetworkManager::Device::StateChangeReason(*)>(_a[4]))); break; + case 19: _t->wifiNetworkRemoved((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 20: _t->wifiNetworkAdded((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 21: _t->wifiNetworkPropertyChange((*reinterpret_cast< NetworkManager::WirelessNetwork*(*)>(_a[1]))); break; + case 22: _t->wifiNetworkDeviceDisappear(); break; + case 23: _t->wirelessConnectionAdd((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break; + case 24: _t->wirelessConnectionRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 25: _t->activeConnectionAdd((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 26: _t->activeConnectionRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 27: _t->wiredConnectStateChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< KyConnectState(*)>(_a[3]))); break; + case 28: _t->wirelessConnectStateChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< KyConnectState(*)>(_a[4]))); break; + case 29: _t->wirelessApConnectStateChange(); break; + case 30: _t->connectivityChanged((*reinterpret_cast< KyConnectivity(*)>(_a[1]))); break; + case 31: _t->wifiEnabledChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 32: _t->networkingEnabledChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 33: _t->onServiceAppear((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break; + case 34: _t->onInitNetwork(); break; + case 35: _t->setWirelessNetworkEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 36: _t->onConnectionUpdated(); break; + case 37: _t->onActiveConnectionChanged((*reinterpret_cast< NetworkManager::ActiveConnection::State(*)>(_a[1]))); break; + case 38: _t->onVpnActiveConnectChangedReason((*reinterpret_cast< NetworkManager::VpnConnection::State(*)>(_a[1])),(*reinterpret_cast< NetworkManager::VpnConnection::StateChangeReason(*)>(_a[2]))); break; + case 39: _t->onDeviceActiveChange(); break; + case 40: _t->onDeviceCarrierChange((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 41: _t->onDeviceBitRateChange((*reinterpret_cast< int(*)>(_a[1]))); break; + case 42: _t->onDeviceMacAddressChange((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 43: _t->onDeviceStateChanged((*reinterpret_cast< NetworkManager::Device::State(*)>(_a[1])),(*reinterpret_cast< NetworkManager::Device::State(*)>(_a[2])),(*reinterpret_cast< NetworkManager::Device::StateChangeReason(*)>(_a[3]))); break; + case 44: _t->onWifiNetworkAppeared((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 45: _t->onWifiNetworkDisappeared((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 46: _t->onUpdateWirelessNet(); break; + case 47: _t->onConnectivityChanged((*reinterpret_cast< NetworkManager::Connectivity(*)>(_a[1]))); break; + case 48: _t->onDeviceAdded((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 49: _t->onDeviceRemoved((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 50: _t->onDeviceUpdated(); break; + case 51: _t->onActiveConnectionAdded((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 52: _t->onActiveConnectionRemoved((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 53: _t->onConnectionAdded((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 54: _t->onConnectionRemoved((*reinterpret_cast< const QString(*)>(_a[1]))); break; + default: ; + } + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + switch (_id) { + default: *reinterpret_cast(_a[0]) = -1; break; + case 21: + switch (*reinterpret_cast(_a[1])) { + default: *reinterpret_cast(_a[0]) = -1; break; + case 0: + *reinterpret_cast(_a[0]) = qRegisterMetaType< NetworkManager::WirelessNetwork* >(); break; + } + break; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + { + using _t = void (KyNetworkResourceManager::*)(QString , QString , QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wiredConnectionAdd)) { + *result = 0; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wiredConnectionRemove)) { + *result = 1; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::connectionAdd)) { + *result = 2; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::connectionUpdate)) { + *result = 3; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::connectionRemove)) { + *result = 4; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wiredDeviceAdd)) { + *result = 5; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wiredDeviceUpdate)) { + *result = 6; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wiredDeviceRemove)) { + *result = 7; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wirelessDeviceAdd)) { + *result = 8; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wirelessDeviceUpdate)) { + *result = 9; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wirelessDeviceRemove)) { + *result = 10; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , KyDeviceType ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::deviceAdd)) { + *result = 11; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::deviceUpdate)) { + *result = 12; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::deviceRemove)) { + *result = 13; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , bool ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::deviceActiveChange)) { + *result = 14; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , bool ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::deviceCarrierChange)) { + *result = 15; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , int ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::deviceBitRateChange)) { + *result = 16; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , const QString & ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::deviceMacAddressChange)) { + *result = 17; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , KyDeviceState , KyDeviceState , NetworkManager::Device::StateChangeReason ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::deviceStateChange)) { + *result = 18; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wifiNetworkRemoved)) { + *result = 19; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wifiNetworkAdded)) { + *result = 20; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(NetworkManager::WirelessNetwork * ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wifiNetworkPropertyChange)) { + *result = 21; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wifiNetworkDeviceDisappear)) { + *result = 22; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wirelessConnectionAdd)) { + *result = 23; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wirelessConnectionRemove)) { + *result = 24; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::activeConnectionAdd)) { + *result = 25; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::activeConnectionRemove)) { + *result = 26; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , QString , KyConnectState ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wiredConnectStateChange)) { + *result = 27; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(QString , QString , QString , KyConnectState ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wirelessConnectStateChange)) { + *result = 28; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wirelessApConnectStateChange)) { + *result = 29; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(KyConnectivity ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::connectivityChanged)) { + *result = 30; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(bool ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::wifiEnabledChanged)) { + *result = 31; + return; + } + } + { + using _t = void (KyNetworkResourceManager::*)(bool ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyNetworkResourceManager::networkingEnabledChanged)) { + *result = 32; + return; + } + } + } +} + +QT_INIT_METAOBJECT const QMetaObject KyNetworkResourceManager::staticMetaObject = { { + &QObject::staticMetaObject, + qt_meta_stringdata_KyNetworkResourceManager.data, + qt_meta_data_KyNetworkResourceManager, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyNetworkResourceManager::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyNetworkResourceManager::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyNetworkResourceManager.stringdata0)) + return static_cast(this); + return QObject::qt_metacast(_clname); +} + +int KyNetworkResourceManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 55) + qt_static_metacall(this, _c, _id, _a); + _id -= 55; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 55) + qt_static_metacall(this, _c, _id, _a); + _id -= 55; + } + return _id; +} + +// SIGNAL 0 +void KyNetworkResourceManager::wiredConnectionAdd(QString _t1, QString _t2, QString _t3, QString _t4) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} + +// SIGNAL 1 +void KyNetworkResourceManager::wiredConnectionRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 1, _a); +} + +// SIGNAL 2 +void KyNetworkResourceManager::connectionAdd(QString _t1, QString _t2, QString _t3) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)) }; + QMetaObject::activate(this, &staticMetaObject, 2, _a); +} + +// SIGNAL 3 +void KyNetworkResourceManager::connectionUpdate(QString _t1, QString _t2, QString _t3) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)) }; + QMetaObject::activate(this, &staticMetaObject, 3, _a); +} + +// SIGNAL 4 +void KyNetworkResourceManager::connectionRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 4, _a); +} + +// SIGNAL 5 +void KyNetworkResourceManager::wiredDeviceAdd(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 5, _a); +} + +// SIGNAL 6 +void KyNetworkResourceManager::wiredDeviceUpdate(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 6, _a); +} + +// SIGNAL 7 +void KyNetworkResourceManager::wiredDeviceRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 7, _a); +} + +// SIGNAL 8 +void KyNetworkResourceManager::wirelessDeviceAdd(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 8, _a); +} + +// SIGNAL 9 +void KyNetworkResourceManager::wirelessDeviceUpdate(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 9, _a); +} + +// SIGNAL 10 +void KyNetworkResourceManager::wirelessDeviceRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 10, _a); +} + +// SIGNAL 11 +void KyNetworkResourceManager::deviceAdd(QString _t1, KyDeviceType _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 11, _a); +} + +// SIGNAL 12 +void KyNetworkResourceManager::deviceUpdate(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 12, _a); +} + +// SIGNAL 13 +void KyNetworkResourceManager::deviceRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 13, _a); +} + +// SIGNAL 14 +void KyNetworkResourceManager::deviceActiveChange(QString _t1, bool _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 14, _a); +} + +// SIGNAL 15 +void KyNetworkResourceManager::deviceCarrierChange(QString _t1, bool _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 15, _a); +} + +// SIGNAL 16 +void KyNetworkResourceManager::deviceBitRateChange(QString _t1, int _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 16, _a); +} + +// SIGNAL 17 +void KyNetworkResourceManager::deviceMacAddressChange(QString _t1, const QString & _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 17, _a); +} + +// SIGNAL 18 +void KyNetworkResourceManager::deviceStateChange(QString _t1, KyDeviceState _t2, KyDeviceState _t3, NetworkManager::Device::StateChangeReason _t4) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 18, _a); +} + +// SIGNAL 19 +void KyNetworkResourceManager::wifiNetworkRemoved(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 19, _a); +} + +// SIGNAL 20 +void KyNetworkResourceManager::wifiNetworkAdded(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 20, _a); +} + +// SIGNAL 21 +void KyNetworkResourceManager::wifiNetworkPropertyChange(NetworkManager::WirelessNetwork * _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 21, _a); +} + +// SIGNAL 22 +void KyNetworkResourceManager::wifiNetworkDeviceDisappear() +{ + QMetaObject::activate(this, &staticMetaObject, 22, nullptr); +} + +// SIGNAL 23 +void KyNetworkResourceManager::wirelessConnectionAdd(QString _t1, QString _t2, QString _t3) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)) }; + QMetaObject::activate(this, &staticMetaObject, 23, _a); +} + +// SIGNAL 24 +void KyNetworkResourceManager::wirelessConnectionRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 24, _a); +} + +// SIGNAL 25 +void KyNetworkResourceManager::activeConnectionAdd(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 25, _a); +} + +// SIGNAL 26 +void KyNetworkResourceManager::activeConnectionRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 26, _a); +} + +// SIGNAL 27 +void KyNetworkResourceManager::wiredConnectStateChange(QString _t1, QString _t2, KyConnectState _t3) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)) }; + QMetaObject::activate(this, &staticMetaObject, 27, _a); +} + +// SIGNAL 28 +void KyNetworkResourceManager::wirelessConnectStateChange(QString _t1, QString _t2, QString _t3, KyConnectState _t4) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 28, _a); +} + +// SIGNAL 29 +void KyNetworkResourceManager::wirelessApConnectStateChange() +{ + QMetaObject::activate(this, &staticMetaObject, 29, nullptr); +} + +// SIGNAL 30 +void KyNetworkResourceManager::connectivityChanged(KyConnectivity _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 30, _a); +} + +// SIGNAL 31 +void KyNetworkResourceManager::wifiEnabledChanged(bool _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 31, _a); +} + +// SIGNAL 32 +void KyNetworkResourceManager::networkingEnabledChanged(bool _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 32, _a); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkresourcemanager.o b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkresourcemanager.o new file mode 100644 index 00000000..568ecbc4 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/moc_kylinnetworkresourcemanager.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinwiredconnectoperation.cpp b/libnm-kylin/build/libnm-base-kylin/moc_kylinwiredconnectoperation.cpp new file mode 100644 index 00000000..fe8a1846 --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_kylinwiredconnectoperation.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinwiredconnectoperation.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-base-kylin/kylinwiredconnectoperation.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinwiredconnectoperation.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyWiredConnectOperation_t { + QByteArrayData data[1]; + char stringdata0[24]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyWiredConnectOperation_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyWiredConnectOperation_t qt_meta_stringdata_KyWiredConnectOperation = { + { +QT_MOC_LITERAL(0, 0, 23) // "KyWiredConnectOperation" + + }, + "KyWiredConnectOperation" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyWiredConnectOperation[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +void KyWiredConnectOperation::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +QT_INIT_METAOBJECT const QMetaObject KyWiredConnectOperation::staticMetaObject = { { + &KyConnectOperation::staticMetaObject, + qt_meta_stringdata_KyWiredConnectOperation.data, + qt_meta_data_KyWiredConnectOperation, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyWiredConnectOperation::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyWiredConnectOperation::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyWiredConnectOperation.stringdata0)) + return static_cast(this); + return KyConnectOperation::qt_metacast(_clname); +} + +int KyWiredConnectOperation::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = KyConnectOperation::qt_metacall(_c, _id, _a); + return _id; +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinwiredconnectoperation.o b/libnm-kylin/build/libnm-base-kylin/moc_kylinwiredconnectoperation.o new file mode 100644 index 00000000..1afab855 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/moc_kylinwiredconnectoperation.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinwirednetresource.cpp b/libnm-kylin/build/libnm-base-kylin/moc_kylinwirednetresource.cpp new file mode 100644 index 00000000..e0cca3df --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_kylinwirednetresource.cpp @@ -0,0 +1,218 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinwirednetresource.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-base-kylin/kylinwirednetresource.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinwirednetresource.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyWiredConnectResourse_t { + QByteArrayData data[15]; + char stringdata0[204]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyWiredConnectResourse_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyWiredConnectResourse_t qt_meta_stringdata_KyWiredConnectResourse = { + { +QT_MOC_LITERAL(0, 0, 22), // "KyWiredConnectResourse" +QT_MOC_LITERAL(1, 23, 18), // "wiredConnectionAdd" +QT_MOC_LITERAL(2, 42, 0), // "" +QT_MOC_LITERAL(3, 43, 7), // "devName" +QT_MOC_LITERAL(4, 51, 11), // "connectUuid" +QT_MOC_LITERAL(5, 63, 11), // "connectName" +QT_MOC_LITERAL(6, 75, 11), // "connectPath" +QT_MOC_LITERAL(7, 87, 21), // "wiredConnectionRemove" +QT_MOC_LITERAL(8, 109, 4), // "path" +QT_MOC_LITERAL(9, 114, 14), // "wiredDeviceAdd" +QT_MOC_LITERAL(10, 129, 10), // "deviceName" +QT_MOC_LITERAL(11, 140, 17), // "wiredDeviceUpdate" +QT_MOC_LITERAL(12, 158, 13), // "oldDeviceName" +QT_MOC_LITERAL(13, 172, 13), // "newDeviceName" +QT_MOC_LITERAL(14, 186, 17) // "wiredDeviceRemove" + + }, + "KyWiredConnectResourse\0wiredConnectionAdd\0" + "\0devName\0connectUuid\0connectName\0" + "connectPath\0wiredConnectionRemove\0" + "path\0wiredDeviceAdd\0deviceName\0" + "wiredDeviceUpdate\0oldDeviceName\0" + "newDeviceName\0wiredDeviceRemove" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyWiredConnectResourse[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 5, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 5, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 4, 39, 2, 0x06 /* Public */, + 7, 1, 48, 2, 0x06 /* Public */, + 9, 1, 51, 2, 0x06 /* Public */, + 11, 2, 54, 2, 0x06 /* Public */, + 14, 1, 59, 2, 0x06 /* Public */, + + // signals: parameters + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, QMetaType::QString, 3, 4, 5, 6, + QMetaType::Void, QMetaType::QString, 8, + QMetaType::Void, QMetaType::QString, 10, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 12, 13, + QMetaType::Void, QMetaType::QString, 10, + + 0 // eod +}; + +void KyWiredConnectResourse::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + auto *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->wiredConnectionAdd((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< QString(*)>(_a[4]))); break; + case 1: _t->wiredConnectionRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 2: _t->wiredDeviceAdd((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 3: _t->wiredDeviceUpdate((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 4: _t->wiredDeviceRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + default: ; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + { + using _t = void (KyWiredConnectResourse::*)(QString , QString , QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWiredConnectResourse::wiredConnectionAdd)) { + *result = 0; + return; + } + } + { + using _t = void (KyWiredConnectResourse::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWiredConnectResourse::wiredConnectionRemove)) { + *result = 1; + return; + } + } + { + using _t = void (KyWiredConnectResourse::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWiredConnectResourse::wiredDeviceAdd)) { + *result = 2; + return; + } + } + { + using _t = void (KyWiredConnectResourse::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWiredConnectResourse::wiredDeviceUpdate)) { + *result = 3; + return; + } + } + { + using _t = void (KyWiredConnectResourse::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWiredConnectResourse::wiredDeviceRemove)) { + *result = 4; + return; + } + } + } +} + +QT_INIT_METAOBJECT const QMetaObject KyWiredConnectResourse::staticMetaObject = { { + &KyNetResource::staticMetaObject, + qt_meta_stringdata_KyWiredConnectResourse.data, + qt_meta_data_KyWiredConnectResourse, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyWiredConnectResourse::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyWiredConnectResourse::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyWiredConnectResourse.stringdata0)) + return static_cast(this); + return KyNetResource::qt_metacast(_clname); +} + +int KyWiredConnectResourse::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = KyNetResource::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 5) + qt_static_metacall(this, _c, _id, _a); + _id -= 5; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 5) + *reinterpret_cast(_a[0]) = -1; + _id -= 5; + } + return _id; +} + +// SIGNAL 0 +void KyWiredConnectResourse::wiredConnectionAdd(QString _t1, QString _t2, QString _t3, QString _t4) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} + +// SIGNAL 1 +void KyWiredConnectResourse::wiredConnectionRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 1, _a); +} + +// SIGNAL 2 +void KyWiredConnectResourse::wiredDeviceAdd(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 2, _a); +} + +// SIGNAL 3 +void KyWiredConnectResourse::wiredDeviceUpdate(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 3, _a); +} + +// SIGNAL 4 +void KyWiredConnectResourse::wiredDeviceRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 4, _a); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kylinwirednetresource.o b/libnm-kylin/build/libnm-base-kylin/moc_kylinwirednetresource.o new file mode 100644 index 00000000..46187083 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/moc_kylinwirednetresource.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kywirelessconnectoperation.cpp b/libnm-kylin/build/libnm-base-kylin/moc_kywirelessconnectoperation.cpp new file mode 100644 index 00000000..851c935b --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_kywirelessconnectoperation.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kywirelessconnectoperation.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-base-kylin/kywirelessconnectoperation.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kywirelessconnectoperation.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyWirelessConnectOperation_t { + QByteArrayData data[1]; + char stringdata0[27]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyWirelessConnectOperation_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyWirelessConnectOperation_t qt_meta_stringdata_KyWirelessConnectOperation = { + { +QT_MOC_LITERAL(0, 0, 26) // "KyWirelessConnectOperation" + + }, + "KyWirelessConnectOperation" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyWirelessConnectOperation[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +void KyWirelessConnectOperation::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +QT_INIT_METAOBJECT const QMetaObject KyWirelessConnectOperation::staticMetaObject = { { + &KyConnectOperation::staticMetaObject, + qt_meta_stringdata_KyWirelessConnectOperation.data, + qt_meta_data_KyWirelessConnectOperation, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyWirelessConnectOperation::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyWirelessConnectOperation::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyWirelessConnectOperation.stringdata0)) + return static_cast(this); + return KyConnectOperation::qt_metacast(_clname); +} + +int KyWirelessConnectOperation::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = KyConnectOperation::qt_metacall(_c, _id, _a); + return _id; +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kywirelessconnectoperation.o b/libnm-kylin/build/libnm-base-kylin/moc_kywirelessconnectoperation.o new file mode 100644 index 00000000..bca96da9 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/moc_kywirelessconnectoperation.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kywirelessnetresource.cpp b/libnm-kylin/build/libnm-base-kylin/moc_kywirelessnetresource.cpp new file mode 100644 index 00000000..bbd30106 --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_kywirelessnetresource.cpp @@ -0,0 +1,398 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kywirelessnetresource.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-base-kylin/kywirelessnetresource.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kywirelessnetresource.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyWirelessNetResource_t { + QByteArrayData data[40]; + char stringdata0[629]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyWirelessNetResource_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyWirelessNetResource_t qt_meta_stringdata_KyWirelessNetResource = { + { +QT_MOC_LITERAL(0, 0, 21), // "KyWirelessNetResource" +QT_MOC_LITERAL(1, 22, 20), // "signalStrengthChange" +QT_MOC_LITERAL(2, 43, 0), // "" +QT_MOC_LITERAL(3, 44, 10), // "deviceName" +QT_MOC_LITERAL(4, 55, 4), // "ssid" +QT_MOC_LITERAL(5, 60, 8), // "strength" +QT_MOC_LITERAL(6, 69, 14), // "secuTypeChange" +QT_MOC_LITERAL(7, 84, 12), // "securityType" +QT_MOC_LITERAL(8, 97, 24), // "wirelessConnectionRemove" +QT_MOC_LITERAL(9, 122, 21), // "wirelessConnectionAdd" +QT_MOC_LITERAL(10, 144, 4), // "uuid" +QT_MOC_LITERAL(11, 149, 8), // "dbusPath" +QT_MOC_LITERAL(12, 158, 24), // "wirelessConnectionUpdate" +QT_MOC_LITERAL(13, 183, 10), // "KySecuType" +QT_MOC_LITERAL(14, 194, 15), // "connectSecuType" +QT_MOC_LITERAL(15, 210, 17), // "wifiNetworkUpdate" +QT_MOC_LITERAL(16, 228, 14), // "wifiNetworkAdd" +QT_MOC_LITERAL(17, 243, 18), // "KyWirelessNetItem&" +QT_MOC_LITERAL(18, 262, 4), // "item" +QT_MOC_LITERAL(19, 267, 17), // "wifiNetworkRemove" +QT_MOC_LITERAL(20, 285, 17), // "wirelessDeviceAdd" +QT_MOC_LITERAL(21, 303, 20), // "wirelessDeviceRemove" +QT_MOC_LITERAL(22, 324, 24), // "wirelessDeviceNameUpdate" +QT_MOC_LITERAL(23, 349, 7), // "oldName" +QT_MOC_LITERAL(24, 357, 7), // "newName" +QT_MOC_LITERAL(25, 365, 18), // "onWifiNetworkAdded" +QT_MOC_LITERAL(26, 384, 12), // "devIfaceName" +QT_MOC_LITERAL(27, 397, 20), // "onWifiNetworkRemoved" +QT_MOC_LITERAL(28, 418, 27), // "onWifiNetworkPropertyChange" +QT_MOC_LITERAL(29, 446, 32), // "NetworkManager::WirelessNetwork*" +QT_MOC_LITERAL(30, 479, 3), // "net" +QT_MOC_LITERAL(31, 483, 28), // "onWifiNetworkDeviceDisappear" +QT_MOC_LITERAL(32, 512, 15), // "onConnectionAdd" +QT_MOC_LITERAL(33, 528, 11), // "connectUuid" +QT_MOC_LITERAL(34, 540, 11), // "connectName" +QT_MOC_LITERAL(35, 552, 11), // "connectPath" +QT_MOC_LITERAL(36, 564, 18), // "onConnectionRemove" +QT_MOC_LITERAL(37, 583, 11), // "onDeviceAdd" +QT_MOC_LITERAL(38, 595, 14), // "onDeviceRemove" +QT_MOC_LITERAL(39, 610, 18) // "onDeviceNameUpdate" + + }, + "KyWirelessNetResource\0signalStrengthChange\0" + "\0deviceName\0ssid\0strength\0secuTypeChange\0" + "securityType\0wirelessConnectionRemove\0" + "wirelessConnectionAdd\0uuid\0dbusPath\0" + "wirelessConnectionUpdate\0KySecuType\0" + "connectSecuType\0wifiNetworkUpdate\0" + "wifiNetworkAdd\0KyWirelessNetItem&\0" + "item\0wifiNetworkRemove\0wirelessDeviceAdd\0" + "wirelessDeviceRemove\0wirelessDeviceNameUpdate\0" + "oldName\0newName\0onWifiNetworkAdded\0" + "devIfaceName\0onWifiNetworkRemoved\0" + "onWifiNetworkPropertyChange\0" + "NetworkManager::WirelessNetwork*\0net\0" + "onWifiNetworkDeviceDisappear\0" + "onConnectionAdd\0connectUuid\0connectName\0" + "connectPath\0onConnectionRemove\0" + "onDeviceAdd\0onDeviceRemove\0" + "onDeviceNameUpdate" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyWirelessNetResource[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 20, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 11, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 3, 114, 2, 0x06 /* Public */, + 6, 3, 121, 2, 0x06 /* Public */, + 8, 2, 128, 2, 0x06 /* Public */, + 9, 4, 133, 2, 0x06 /* Public */, + 12, 5, 142, 2, 0x06 /* Public */, + 15, 0, 153, 2, 0x06 /* Public */, + 16, 2, 154, 2, 0x06 /* Public */, + 19, 2, 159, 2, 0x06 /* Public */, + 20, 1, 164, 2, 0x06 /* Public */, + 21, 1, 167, 2, 0x06 /* Public */, + 22, 2, 170, 2, 0x06 /* Public */, + + // slots: name, argc, parameters, tag, flags + 25, 2, 175, 2, 0x0a /* Public */, + 27, 2, 180, 2, 0x0a /* Public */, + 28, 1, 185, 2, 0x0a /* Public */, + 31, 0, 188, 2, 0x0a /* Public */, + 32, 3, 189, 2, 0x0a /* Public */, + 36, 1, 196, 2, 0x0a /* Public */, + 37, 1, 199, 2, 0x0a /* Public */, + 38, 1, 202, 2, 0x0a /* Public */, + 39, 2, 205, 2, 0x0a /* Public */, + + // signals: parameters + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::Int, 3, 4, 5, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, 3, 4, 7, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 3, 4, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, QMetaType::QString, 3, 4, 10, 11, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, QMetaType::QString, 0x80000000 | 13, 3, 4, 10, 11, 14, + QMetaType::Void, + QMetaType::Void, QMetaType::QString, 0x80000000 | 17, 3, 18, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 3, 4, + QMetaType::Void, QMetaType::QString, 3, + QMetaType::Void, QMetaType::QString, 3, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 23, 24, + + // slots: parameters + QMetaType::Void, QMetaType::QString, QMetaType::QString, 26, 4, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 26, 4, + QMetaType::Void, 0x80000000 | 29, 30, + QMetaType::Void, + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::QString, 33, 34, 35, + QMetaType::Void, QMetaType::QString, 2, + QMetaType::Void, QMetaType::QString, 3, + QMetaType::Void, QMetaType::QString, 3, + QMetaType::Void, QMetaType::QString, QMetaType::QString, 23, 24, + + 0 // eod +}; + +void KyWirelessNetResource::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + auto *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->signalStrengthChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; + case 1: _t->secuTypeChange((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break; + case 2: _t->wirelessConnectionRemove((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 3: _t->wirelessConnectionAdd((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< QString(*)>(_a[4]))); break; + case 4: _t->wirelessConnectionUpdate((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< QString(*)>(_a[4])),(*reinterpret_cast< KySecuType(*)>(_a[5]))); break; + case 5: _t->wifiNetworkUpdate(); break; + case 6: _t->wifiNetworkAdd((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< KyWirelessNetItem(*)>(_a[2]))); break; + case 7: _t->wifiNetworkRemove((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 8: _t->wirelessDeviceAdd((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 9: _t->wirelessDeviceRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 10: _t->wirelessDeviceNameUpdate((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 11: _t->onWifiNetworkAdded((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 12: _t->onWifiNetworkRemoved((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + case 13: _t->onWifiNetworkPropertyChange((*reinterpret_cast< NetworkManager::WirelessNetwork*(*)>(_a[1]))); break; + case 14: _t->onWifiNetworkDeviceDisappear(); break; + case 15: _t->onConnectionAdd((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break; + case 16: _t->onConnectionRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 17: _t->onDeviceAdd((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 18: _t->onDeviceRemove((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 19: _t->onDeviceNameUpdate((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; + default: ; + } + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + switch (_id) { + default: *reinterpret_cast(_a[0]) = -1; break; + case 13: + switch (*reinterpret_cast(_a[1])) { + default: *reinterpret_cast(_a[0]) = -1; break; + case 0: + *reinterpret_cast(_a[0]) = qRegisterMetaType< NetworkManager::WirelessNetwork* >(); break; + } + break; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + { + using _t = void (KyWirelessNetResource::*)(QString , QString , int ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWirelessNetResource::signalStrengthChange)) { + *result = 0; + return; + } + } + { + using _t = void (KyWirelessNetResource::*)(QString , QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWirelessNetResource::secuTypeChange)) { + *result = 1; + return; + } + } + { + using _t = void (KyWirelessNetResource::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWirelessNetResource::wirelessConnectionRemove)) { + *result = 2; + return; + } + } + { + using _t = void (KyWirelessNetResource::*)(QString , QString , QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWirelessNetResource::wirelessConnectionAdd)) { + *result = 3; + return; + } + } + { + using _t = void (KyWirelessNetResource::*)(QString , QString , QString , QString , KySecuType ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWirelessNetResource::wirelessConnectionUpdate)) { + *result = 4; + return; + } + } + { + using _t = void (KyWirelessNetResource::*)(); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWirelessNetResource::wifiNetworkUpdate)) { + *result = 5; + return; + } + } + { + using _t = void (KyWirelessNetResource::*)(QString , KyWirelessNetItem & ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWirelessNetResource::wifiNetworkAdd)) { + *result = 6; + return; + } + } + { + using _t = void (KyWirelessNetResource::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWirelessNetResource::wifiNetworkRemove)) { + *result = 7; + return; + } + } + { + using _t = void (KyWirelessNetResource::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWirelessNetResource::wirelessDeviceAdd)) { + *result = 8; + return; + } + } + { + using _t = void (KyWirelessNetResource::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWirelessNetResource::wirelessDeviceRemove)) { + *result = 9; + return; + } + } + { + using _t = void (KyWirelessNetResource::*)(QString , QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyWirelessNetResource::wirelessDeviceNameUpdate)) { + *result = 10; + return; + } + } + } +} + +QT_INIT_METAOBJECT const QMetaObject KyWirelessNetResource::staticMetaObject = { { + &KyNetResource::staticMetaObject, + qt_meta_stringdata_KyWirelessNetResource.data, + qt_meta_data_KyWirelessNetResource, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyWirelessNetResource::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyWirelessNetResource::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyWirelessNetResource.stringdata0)) + return static_cast(this); + return KyNetResource::qt_metacast(_clname); +} + +int KyWirelessNetResource::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = KyNetResource::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 20) + qt_static_metacall(this, _c, _id, _a); + _id -= 20; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 20) + qt_static_metacall(this, _c, _id, _a); + _id -= 20; + } + return _id; +} + +// SIGNAL 0 +void KyWirelessNetResource::signalStrengthChange(QString _t1, QString _t2, int _t3) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} + +// SIGNAL 1 +void KyWirelessNetResource::secuTypeChange(QString _t1, QString _t2, QString _t3) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)) }; + QMetaObject::activate(this, &staticMetaObject, 1, _a); +} + +// SIGNAL 2 +void KyWirelessNetResource::wirelessConnectionRemove(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 2, _a); +} + +// SIGNAL 3 +void KyWirelessNetResource::wirelessConnectionAdd(QString _t1, QString _t2, QString _t3, QString _t4) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 3, _a); +} + +// SIGNAL 4 +void KyWirelessNetResource::wirelessConnectionUpdate(QString _t1, QString _t2, QString _t3, QString _t4, KySecuType _t5) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)), const_cast(reinterpret_cast(&_t5)) }; + QMetaObject::activate(this, &staticMetaObject, 4, _a); +} + +// SIGNAL 5 +void KyWirelessNetResource::wifiNetworkUpdate() +{ + QMetaObject::activate(this, &staticMetaObject, 5, nullptr); +} + +// SIGNAL 6 +void KyWirelessNetResource::wifiNetworkAdd(QString _t1, KyWirelessNetItem & _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 6, _a); +} + +// SIGNAL 7 +void KyWirelessNetResource::wifiNetworkRemove(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 7, _a); +} + +// SIGNAL 8 +void KyWirelessNetResource::wirelessDeviceAdd(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 8, _a); +} + +// SIGNAL 9 +void KyWirelessNetResource::wirelessDeviceRemove(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 9, _a); +} + +// SIGNAL 10 +void KyWirelessNetResource::wirelessDeviceNameUpdate(QString _t1, QString _t2) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 10, _a); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-base-kylin/moc_kywirelessnetresource.o b/libnm-kylin/build/libnm-base-kylin/moc_kywirelessnetresource.o new file mode 100644 index 00000000..fd4bd019 Binary files /dev/null and b/libnm-kylin/build/libnm-base-kylin/moc_kywirelessnetresource.o differ diff --git a/libnm-kylin/build/libnm-base-kylin/moc_predefs.h b/libnm-kylin/build/libnm-base-kylin/moc_predefs.h new file mode 100644 index 00000000..a2253264 --- /dev/null +++ b/libnm-kylin/build/libnm-base-kylin/moc_predefs.h @@ -0,0 +1,384 @@ +#define __SSP_STRONG__ 3 +#define __DBL_MIN_EXP__ (-1021) +#define __FLT32X_MAX_EXP__ 1024 +#define __cpp_attributes 200809 +#define __UINT_LEAST16_MAX__ 0xffff +#define __ATOMIC_ACQUIRE 2 +#define __FLT128_MAX_10_EXP__ 4932 +#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F +#define __GCC_IEC_559_COMPLEX 2 +#define __UINT_LEAST8_TYPE__ unsigned char +#define __SIZEOF_FLOAT80__ 16 +#define __INTMAX_C(c) c ## L +#define __CHAR_BIT__ 8 +#define __UINT8_MAX__ 0xff +#define __WINT_MAX__ 0xffffffffU +#define __FLT32_MIN_EXP__ (-125) +#define __cpp_static_assert 200410 +#define __ORDER_LITTLE_ENDIAN__ 1234 +#define __SIZE_MAX__ 0xffffffffffffffffUL +#define __WCHAR_MAX__ 0x7fffffff +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +#define __DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L) +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +#define __GCC_ATOMIC_CHAR_LOCK_FREE 2 +#define __GCC_IEC_559 2 +#define __FLT32X_DECIMAL_DIG__ 17 +#define __FLT_EVAL_METHOD__ 0 +#define __unix__ 1 +#define __cpp_binary_literals 201304 +#define __FLT64_DECIMAL_DIG__ 17 +#define __CET__ 3 +#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define __x86_64 1 +#define __cpp_variadic_templates 200704 +#define __UINT_FAST64_MAX__ 0xffffffffffffffffUL +#define __SIG_ATOMIC_TYPE__ int +#define __DBL_MIN_10_EXP__ (-307) +#define __FINITE_MATH_ONLY__ 0 +#define __GNUC_PATCHLEVEL__ 0 +#define __FLT32_HAS_DENORM__ 1 +#define __UINT_FAST8_MAX__ 0xff +#define __cpp_rvalue_reference 200610 +#define __has_include(STR) __has_include__(STR) +#define __DEC64_MAX_EXP__ 385 +#define __INT8_C(c) c +#define __INT_LEAST8_WIDTH__ 8 +#define __UINT_LEAST64_MAX__ 0xffffffffffffffffUL +#define __SHRT_MAX__ 0x7fff +#define __LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L +#define __FLT64X_MAX_10_EXP__ 4932 +#define __UINT_LEAST8_MAX__ 0xff +#define __GCC_ATOMIC_BOOL_LOCK_FREE 2 +#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128 +#define __UINTMAX_TYPE__ long unsigned int +#define __linux 1 +#define __DEC32_EPSILON__ 1E-6DF +#define __FLT_EVAL_METHOD_TS_18661_3__ 0 +#define __OPTIMIZE__ 1 +#define __unix 1 +#define __UINT32_MAX__ 0xffffffffU +#define __GXX_EXPERIMENTAL_CXX0X__ 1 +#define __LDBL_MAX_EXP__ 16384 +#define __FLT128_MIN_EXP__ (-16381) +#define __WINT_MIN__ 0U +#define __linux__ 1 +#define __FLT128_MIN_10_EXP__ (-4931) +#define __INT_LEAST16_WIDTH__ 16 +#define __SCHAR_MAX__ 0x7f +#define __FLT128_MANT_DIG__ 113 +#define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1) +#define __INT64_C(c) c ## L +#define __DBL_DIG__ 15 +#define __GCC_ATOMIC_POINTER_LOCK_FREE 2 +#define __FLT64X_MANT_DIG__ 64 +#define _FORTIFY_SOURCE 2 +#define __SIZEOF_INT__ 4 +#define __SIZEOF_POINTER__ 8 +#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define __USER_LABEL_PREFIX__ +#define __FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x +#define __STDC_HOSTED__ 1 +#define __LDBL_HAS_INFINITY__ 1 +#define __FLT32_DIG__ 6 +#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F +#define __GXX_WEAK__ 1 +#define __SHRT_WIDTH__ 16 +#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +#define __DEC32_MAX__ 9.999999E96DF +#define __cpp_threadsafe_static_init 200806 +#define __FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x +#define __FLT32X_HAS_INFINITY__ 1 +#define __INT32_MAX__ 0x7fffffff +#define __INT_WIDTH__ 32 +#define __SIZEOF_LONG__ 8 +#define __STDC_IEC_559__ 1 +#define __STDC_ISO_10646__ 201706L +#define __UINT16_C(c) c +#define __PTRDIFF_WIDTH__ 64 +#define __DECIMAL_DIG__ 21 +#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64 +#define __gnu_linux__ 1 +#define __INTMAX_WIDTH__ 64 +#define __FLT64_MIN_EXP__ (-1021) +#define __has_include_next(STR) __has_include_next__(STR) +#define __FLT64X_MIN_10_EXP__ (-4931) +#define __LDBL_HAS_QUIET_NAN__ 1 +#define __FLT64_MANT_DIG__ 53 +#define _REENTRANT 1 +#define __GNUC__ 9 +#define __GXX_RTTI 1 +#define __pie__ 2 +#define __MMX__ 1 +#define __cpp_delegating_constructors 200604 +#define __FLT_HAS_DENORM__ 1 +#define __SIZEOF_LONG_DOUBLE__ 16 +#define __BIGGEST_ALIGNMENT__ 16 +#define __STDC_UTF_16__ 1 +#define __FLT64_MAX_10_EXP__ 308 +#define __FLT32_HAS_INFINITY__ 1 +#define __DBL_MAX__ double(1.79769313486231570814527423731704357e+308L) +#define __cpp_raw_strings 200710 +#define __INT_FAST32_MAX__ 0x7fffffffffffffffL +#define __DBL_HAS_INFINITY__ 1 +#define __HAVE_SPECULATION_SAFE_VALUE 1 +#define __DEC32_MIN_EXP__ (-94) +#define __INTPTR_WIDTH__ 64 +#define __FLT32X_HAS_DENORM__ 1 +#define __INT_FAST16_TYPE__ long int +#define __LDBL_HAS_DENORM__ 1 +#define __cplusplus 201103L +#define __cpp_ref_qualifiers 200710 +#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL +#define __INT_LEAST32_MAX__ 0x7fffffff +#define __DEC32_MIN__ 1E-95DF +#define __DEPRECATED 1 +#define __cpp_rvalue_references 200610 +#define __DBL_MAX_EXP__ 1024 +#define __WCHAR_WIDTH__ 32 +#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32 +#define __DEC128_EPSILON__ 1E-33DL +#define __SSE2_MATH__ 1 +#define __ATOMIC_HLE_RELEASE 131072 +#define __PTRDIFF_MAX__ 0x7fffffffffffffffL +#define __amd64 1 +#define __ATOMIC_HLE_ACQUIRE 65536 +#define __FLT32_HAS_QUIET_NAN__ 1 +#define __GNUG__ 9 +#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL +#define __SIZEOF_SIZE_T__ 8 +#define __cpp_nsdmi 200809 +#define __FLT64X_MIN_EXP__ (-16381) +#define __SIZEOF_WINT_T__ 4 +#define __LONG_LONG_WIDTH__ 64 +#define __cpp_initializer_lists 200806 +#define __FLT32_MAX_EXP__ 128 +#define __cpp_hex_float 201603 +#define __GCC_HAVE_DWARF2_CFI_ASM 1 +#define __GXX_ABI_VERSION 1013 +#define __FLT128_HAS_INFINITY__ 1 +#define __FLT_MIN_EXP__ (-125) +#define __cpp_lambdas 200907 +#define __FLT64X_HAS_QUIET_NAN__ 1 +#define __INT_FAST64_TYPE__ long int +#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64 +#define __DBL_MIN__ double(2.22507385850720138309023271733240406e-308L) +#define __PIE__ 2 +#define __LP64__ 1 +#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x +#define __DECIMAL_BID_FORMAT__ 1 +#define __FLT64_MIN_10_EXP__ (-307) +#define __FLT64X_DECIMAL_DIG__ 21 +#define __DEC128_MIN__ 1E-6143DL +#define __REGISTER_PREFIX__ +#define __UINT16_MAX__ 0xffff +#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32 +#define __UINT8_TYPE__ unsigned char +#define __FLT_MANT_DIG__ 24 +#define __LDBL_DECIMAL_DIG__ 21 +#define __VERSION__ "9.3.0" +#define __UINT64_C(c) c ## UL +#define __cpp_unicode_characters 200704 +#define _STDC_PREDEF_H 1 +#define __GCC_ATOMIC_INT_LOCK_FREE 2 +#define __FLT128_MAX_EXP__ 16384 +#define __FLT32_MANT_DIG__ 24 +#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define __STDC_IEC_559_COMPLEX__ 1 +#define __FLT128_HAS_DENORM__ 1 +#define __FLT128_DIG__ 33 +#define __SCHAR_WIDTH__ 8 +#define __INT32_C(c) c +#define __DEC64_EPSILON__ 1E-15DD +#define __ORDER_PDP_ENDIAN__ 3412 +#define __DEC128_MIN_EXP__ (-6142) +#define __FLT32_MAX_10_EXP__ 38 +#define __INT_FAST32_TYPE__ long int +#define __UINT_LEAST16_TYPE__ short unsigned int +#define __FLT64X_HAS_INFINITY__ 1 +#define unix 1 +#define __DBL_HAS_DENORM__ 1 +#define __INT16_MAX__ 0x7fff +#define __cpp_rtti 199711 +#define __SIZE_TYPE__ long unsigned int +#define __UINT64_MAX__ 0xffffffffffffffffUL +#define __FLT64X_DIG__ 18 +#define __INT8_TYPE__ signed char +#define __ELF__ 1 +#define __GCC_ASM_FLAG_OUTPUTS__ 1 +#define __FLT_RADIX__ 2 +#define __INT_LEAST16_TYPE__ short int +#define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L +#define __UINTMAX_C(c) c ## UL +#define __GLIBCXX_BITSIZE_INT_N_0 128 +#define __k8 1 +#define __SIG_ATOMIC_MAX__ 0x7fffffff +#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define __SIZEOF_PTRDIFF_T__ 8 +#define __FLT32X_MANT_DIG__ 53 +#define __x86_64__ 1 +#define __FLT32X_MIN_EXP__ (-1021) +#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF +#define __INT_FAST16_MAX__ 0x7fffffffffffffffL +#define __FLT64_DIG__ 15 +#define __UINT_FAST32_MAX__ 0xffffffffffffffffUL +#define __UINT_LEAST64_TYPE__ long unsigned int +#define __FLT_HAS_QUIET_NAN__ 1 +#define __FLT_MAX_10_EXP__ 38 +#define __LONG_MAX__ 0x7fffffffffffffffL +#define __FLT64X_HAS_DENORM__ 1 +#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL +#define __FLT_HAS_INFINITY__ 1 +#define __cpp_unicode_literals 200710 +#define __UINT_FAST16_TYPE__ long unsigned int +#define __DEC64_MAX__ 9.999999999999999E384DD +#define __INT_FAST32_WIDTH__ 64 +#define __CHAR16_TYPE__ short unsigned int +#define __PRAGMA_REDEFINE_EXTNAME 1 +#define __SIZE_WIDTH__ 64 +#define __SEG_FS 1 +#define __INT_LEAST16_MAX__ 0x7fff +#define __DEC64_MANT_DIG__ 16 +#define __INT64_MAX__ 0x7fffffffffffffffL +#define __UINT_LEAST32_MAX__ 0xffffffffU +#define __SEG_GS 1 +#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32 +#define __GCC_ATOMIC_LONG_LOCK_FREE 2 +#define __SIG_ATOMIC_WIDTH__ 32 +#define __INT_LEAST64_TYPE__ long int +#define __INT16_TYPE__ short int +#define __INT_LEAST8_TYPE__ signed char +#define __DEC32_MAX_EXP__ 97 +#define __INT_FAST8_MAX__ 0x7f +#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128 +#define __INTPTR_MAX__ 0x7fffffffffffffffL +#define linux 1 +#define __cpp_range_based_for 200907 +#define __FLT64_HAS_QUIET_NAN__ 1 +#define __FLT32_MIN_10_EXP__ (-37) +#define __SSE2__ 1 +#define __EXCEPTIONS 1 +#define __LDBL_MANT_DIG__ 64 +#define __DBL_HAS_QUIET_NAN__ 1 +#define __FLT64_HAS_INFINITY__ 1 +#define __FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x +#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1) +#define __code_model_small__ 1 +#define __k8__ 1 +#define __INTPTR_TYPE__ long int +#define __UINT16_TYPE__ short unsigned int +#define __WCHAR_TYPE__ int +#define __SIZEOF_FLOAT__ 4 +#define __pic__ 2 +#define __UINTPTR_MAX__ 0xffffffffffffffffUL +#define __INT_FAST64_WIDTH__ 64 +#define __DEC64_MIN_EXP__ (-382) +#define __cpp_decltype 200707 +#define __FLT32_DECIMAL_DIG__ 9 +#define __INT_FAST64_MAX__ 0x7fffffffffffffffL +#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +#define __FLT_DIG__ 6 +#define __FLT64X_MAX_EXP__ 16384 +#define __UINT_FAST64_TYPE__ long unsigned int +#define __INT_MAX__ 0x7fffffff +#define __amd64__ 1 +#define __INT64_TYPE__ long int +#define __FLT_MAX_EXP__ 128 +#define __ORDER_BIG_ENDIAN__ 4321 +#define __DBL_MANT_DIG__ 53 +#define __cpp_inheriting_constructors 201511 +#define __SIZEOF_FLOAT128__ 16 +#define __INT_LEAST64_MAX__ 0x7fffffffffffffffL +#define __DEC64_MIN__ 1E-383DD +#define __WINT_TYPE__ unsigned int +#define __UINT_LEAST32_TYPE__ unsigned int +#define __SIZEOF_SHORT__ 2 +#define __SSE__ 1 +#define __LDBL_MIN_EXP__ (-16381) +#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64 +#define __WINT_WIDTH__ 32 +#define __INT_LEAST8_MAX__ 0x7f +#define __FLT32X_MAX_10_EXP__ 308 +#define __SIZEOF_INT128__ 16 +#define __LDBL_MAX_10_EXP__ 4932 +#define __ATOMIC_RELAXED 0 +#define __DBL_EPSILON__ double(2.22044604925031308084726333618164062e-16L) +#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128 +#define _LP64 1 +#define __UINT8_C(c) c +#define __FLT64_MAX_EXP__ 1024 +#define __INT_LEAST32_TYPE__ int +#define __SIZEOF_WCHAR_T__ 4 +#define __FLT128_HAS_QUIET_NAN__ 1 +#define __INT_FAST8_TYPE__ signed char +#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x +#define __GNUC_STDC_INLINE__ 1 +#define __FLT64_HAS_DENORM__ 1 +#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32 +#define __DBL_DECIMAL_DIG__ 17 +#define __STDC_UTF_32__ 1 +#define __INT_FAST8_WIDTH__ 8 +#define __FXSR__ 1 +#define __DEC_EVAL_METHOD__ 2 +#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x +#define __cpp_runtime_arrays 198712 +#define __UINT64_TYPE__ long unsigned int +#define __UINT32_C(c) c ## U +#define __INTMAX_MAX__ 0x7fffffffffffffffL +#define __cpp_alias_templates 200704 +#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F +#define __INT8_MAX__ 0x7f +#define __LONG_WIDTH__ 64 +#define __PIC__ 2 +#define __UINT_FAST32_TYPE__ long unsigned int +#define __CHAR32_TYPE__ unsigned int +#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F +#define __cpp_constexpr 200704 +#define __INT32_TYPE__ int +#define __SIZEOF_DOUBLE__ 8 +#define __cpp_exceptions 199711 +#define __FLT_MIN_10_EXP__ (-37) +#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64 +#define __INT_LEAST32_WIDTH__ 32 +#define __INTMAX_TYPE__ long int +#define __DEC128_MAX_EXP__ 6145 +#define __FLT32X_HAS_QUIET_NAN__ 1 +#define __ATOMIC_CONSUME 1 +#define __GNUC_MINOR__ 3 +#define __GLIBCXX_TYPE_INT_N_0 __int128 +#define __INT_FAST16_WIDTH__ 64 +#define __UINTMAX_MAX__ 0xffffffffffffffffUL +#define __DEC32_MANT_DIG__ 7 +#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x +#define __DBL_MAX_10_EXP__ 308 +#define __LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L +#define __INT16_C(c) c +#define __STDC__ 1 +#define __FLT32X_DIG__ 15 +#define __PTRDIFF_TYPE__ long int +#define __ATOMIC_SEQ_CST 5 +#define __UINT32_TYPE__ unsigned int +#define __FLT32X_MIN_10_EXP__ (-307) +#define __UINTPTR_TYPE__ long unsigned int +#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD +#define __DEC128_MANT_DIG__ 34 +#define __LDBL_MIN_10_EXP__ (-4931) +#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128 +#define __SSE_MATH__ 1 +#define __SIZEOF_LONG_LONG__ 8 +#define __cpp_user_defined_literals 200809 +#define __FLT128_DECIMAL_DIG__ 36 +#define __GCC_ATOMIC_LLONG_LOCK_FREE 2 +#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x +#define __LDBL_DIG__ 18 +#define __FLT_DECIMAL_DIG__ 9 +#define __UINT_FAST16_MAX__ 0xffffffffffffffffUL +#define __GCC_ATOMIC_SHORT_LOCK_FREE 2 +#define __INT_LEAST64_WIDTH__ 64 +#define __UINT_FAST8_TYPE__ unsigned char +#define _GNU_SOURCE 1 +#define __ATOMIC_ACQ_REL 4 +#define __ATOMIC_RELEASE 3 diff --git a/libnm-kylin/build/libnm-external-kylin/Makefile b/libnm-kylin/build/libnm-external-kylin/Makefile new file mode 100644 index 00000000..f565a861 --- /dev/null +++ b/libnm-kylin/build/libnm-external-kylin/Makefile @@ -0,0 +1,667 @@ +############################################################################# +# Makefile for building: libkylin-nm-external.so.1.0.0 +# Generated by qmake (3.1) (Qt 5.12.8) +# Project: ../../libnm-external-kylin/libnm-external-kylin.pro +# Template: lib +# Command: /usr/lib/qt5/bin/qmake -o Makefile ../../libnm-external-kylin/libnm-external-kylin.pro +############################################################################# + +MAKEFILE = Makefile + +EQ = = + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DLIBNMEXTERNALKYLIN_LIBRARY -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_NO_KEYWORDS -DQT_X11EXTRAS_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_DBUS_LIB -DQT_CONCURRENT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB +CFLAGS = -pipe -O2 -pthread -pthread -pthread -Wall -W -D_REENTRANT -fPIC $(DEFINES) +CXXFLAGS = -pipe -O2 -std=gnu++11 -pthread -pthread -pthread -Wall -W -D_REENTRANT -fPIC $(DEFINES) +INCPATH = -I../../libnm-external-kylin -I. -isystem /usr/include/KF5/NetworkManagerQt -I../../libnm-base-kylin -I../../libnm-external-kylin/kylin-agent -I../../libnm-external-kylin/kylin-tool -isystem /usr/include/libnm -isystem /usr/include/libmount -isystem /usr/include/blkid -isystem /usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/libnma -isystem /usr/include/libsecret-1 -isystem /usr/include/x86_64-linux-gnu/qt5/QGSettings -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtX11Extras -isystem /usr/include/KF5/KWindowSystem -isystem /usr/include/x86_64-linux-gnu/qt5/QtSvg -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtDBus -isystem /usr/include/x86_64-linux-gnu/qt5/QtConcurrent -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ +QMAKE = /usr/lib/qt5/bin/qmake +DEL_FILE = rm -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p +COPY = cp -f +COPY_FILE = cp -f +COPY_DIR = cp -f -R +INSTALL_FILE = install -m 644 -p +INSTALL_PROGRAM = install -m 755 -p +INSTALL_DIR = cp -f -R +QINSTALL = /usr/lib/qt5/bin/qmake -install qinstall +QINSTALL_PROGRAM = /usr/lib/qt5/bin/qmake -install qinstall -exe +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +TAR = tar -cf +COMPRESS = gzip -9f +DISTNAME = kylin-nm-external1.0.0 +DISTDIR = /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-external-kylin/.tmp/kylin-nm-external1.0.0 +LINK = g++ +LFLAGS = -Wl,-O1 -Wl,-rpath-link,/usr/lib/x86_64-linux-gnu -shared -Wl,-soname,libkylin-nm-external.so.1 +LIBS = $(SUBLIBS) -L/usr/lib/ -lX11 -lKF5NetworkManagerQt -L/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/../libnm-base-kylin/ -l kylin-nm-base -lnma -lnm -lsecret-1 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lgsettings-qt -lcap /usr/lib/x86_64-linux-gnu/libQt5X11Extras.so /usr/lib/x86_64-linux-gnu/libKF5WindowSystem.so /usr/lib/x86_64-linux-gnu/libQt5Svg.so /usr/lib/x86_64-linux-gnu/libQt5Widgets.so /usr/lib/x86_64-linux-gnu/libQt5Gui.so /usr/lib/x86_64-linux-gnu/libQt5DBus.so /usr/lib/x86_64-linux-gnu/libQt5Concurrent.so /usr/lib/x86_64-linux-gnu/libQt5Network.so /usr/lib/x86_64-linux-gnu/libQt5Core.so /usr/lib/x86_64-linux-gnu/libGL.so -lpthread +AR = ar cqs +RANLIB = +SED = sed +STRIP = strip + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = ../../libnm-external-kylin/kylin-agent/kylinagent.cpp \ + ../../libnm-external-kylin/kylin-agent/kylinagentobject.cpp \ + ../../libnm-external-kylin/kylin-agent/kylinpassworddialog.cpp \ + ../../libnm-external-kylin/kylin-agent/kylinsecretagent.cpp \ + ../../libnm-external-kylin/kylin-tool/kylinipv4arping.cpp \ + ../../libnm-external-kylin/kylin-tool/kylinipv6arping.cpp moc_kylinagent.cpp \ + moc_kylinagentobject.cpp \ + moc_kylinpassworddialog.cpp \ + moc_kylinsecretagent.cpp \ + moc_kylinipv4arping.cpp \ + moc_kylinipv6arping.cpp +OBJECTS = kylinagent.o \ + kylinagentobject.o \ + kylinpassworddialog.o \ + kylinsecretagent.o \ + kylinipv4arping.o \ + kylinipv6arping.o \ + moc_kylinagent.o \ + moc_kylinagentobject.o \ + moc_kylinpassworddialog.o \ + moc_kylinsecretagent.o \ + moc_kylinipv4arping.o \ + moc_kylinipv6arping.o +DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_Attica.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_BluezQt.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuth.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuthCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCodecs.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCompletion.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigGui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigWidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCoreAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KDBusAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGlobalAccel.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGuiAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KI18n.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KIconThemes.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KItemViews.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KScreen.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KService.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KTextWidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWidgetsAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWindowSystem.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KXmlGui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_help.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimedia.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quickwidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_script.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_scripttools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sensors.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uiplugin.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_x11extras.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetUi.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \ + ../../.qmake.stash \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \ + ../../../libnm-external-kylin/kylin-agent/kylin-agent.pri \ + ../../../libnm-external-kylin/kylin-tool/kylin-tool.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/link_pkgconfig.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbuscommon.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbusinterfaces.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbusadaptors.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/uic.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \ + ../../../libnm-external-kylin/libnm-external-kylin.pro ../../libnm-external-kylin/kylin-agent/kylinagent.h \ + ../../libnm-external-kylin/kylin-agent/kylinagentobject.h \ + ../../libnm-external-kylin/kylin-agent/kylinagentutils.h \ + ../../libnm-external-kylin/kylin-agent/kylinpassworddialog.h \ + ../../libnm-external-kylin/kylin-agent/kylinsecretagent.h \ + ../../libnm-external-kylin/kylin-tool/kylinarping.h \ + ../../libnm-external-kylin/kylin-tool/kylinipv4arping.h \ + ../../libnm-external-kylin/kylin-tool/kylinipv6arping.h \ + ../../libnm-external-kylin/libnm-external-kylin_global.h ../../libnm-external-kylin/kylin-agent/kylinagent.cpp \ + ../../libnm-external-kylin/kylin-agent/kylinagentobject.cpp \ + ../../libnm-external-kylin/kylin-agent/kylinpassworddialog.cpp \ + ../../libnm-external-kylin/kylin-agent/kylinsecretagent.cpp \ + ../../libnm-external-kylin/kylin-tool/kylinipv4arping.cpp \ + ../../libnm-external-kylin/kylin-tool/kylinipv6arping.cpp +QMAKE_TARGET = kylin-nm-external +DESTDIR = ../../libnm-external-kylin/ +TARGET = libkylin-nm-external.so.1.0.0 +TARGETA = ../../libnm-external-kylin/libkylin-nm-external.a +TARGET0 = libkylin-nm-external.so +TARGETD = libkylin-nm-external.so.1.0.0 +TARGET1 = libkylin-nm-external.so.1 +TARGET2 = libkylin-nm-external.so.1.0 + + +first: all +####### Build rules + +../../libnm-external-kylin/libkylin-nm-external.so.1.0.0: $(OBJECTS) $(SUBLIBS) $(OBJCOMP) + @test -d ../../libnm-external-kylin/ || mkdir -p ../../libnm-external-kylin/ + -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP) + -ln -s $(TARGET) $(TARGET0) + -ln -s $(TARGET) $(TARGET1) + -ln -s $(TARGET) $(TARGET2) + -$(DEL_FILE) ../../libnm-external-kylin/$(TARGET) + -$(MOVE) $(TARGET) ../../libnm-external-kylin/$(TARGET) + -$(DEL_FILE) ../../libnm-external-kylin/$(TARGET0) + -$(DEL_FILE) ../../libnm-external-kylin/$(TARGET1) + -$(DEL_FILE) ../../libnm-external-kylin/$(TARGET2) + -$(MOVE) $(TARGET0) ../../libnm-external-kylin/$(TARGET0) + -$(MOVE) $(TARGET1) ../../libnm-external-kylin/$(TARGET1) + -$(MOVE) $(TARGET2) ../../libnm-external-kylin/$(TARGET2) + + + +staticlib: ../../libnm-external-kylin/libkylin-nm-external.a + +../../libnm-external-kylin/libkylin-nm-external.a: $(OBJECTS) $(OBJCOMP) + -$(DEL_FILE) $(TARGETA) + $(AR) $(TARGETA) $(OBJECTS) + +Makefile: ../../libnm-external-kylin/libnm-external-kylin.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_Attica.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_BluezQt.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuth.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuthCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCodecs.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCompletion.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigGui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigWidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCoreAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KDBusAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGlobalAccel.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGuiAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KI18n.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KIconThemes.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KItemViews.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KScreen.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KService.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KTextWidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWidgetsAddons.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWindowSystem.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KXmlGui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_help.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimedia.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quickwidgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_script.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_scripttools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sensors.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uiplugin.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_x11extras.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetCore.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetUi.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \ + ../.qmake.stash \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \ + ../../libnm-external-kylin/kylin-agent/kylin-agent.pri \ + ../../libnm-external-kylin/kylin-tool/kylin-tool.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/link_pkgconfig.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbuscommon.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbusinterfaces.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbusadaptors.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/uic.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \ + ../../libnm-external-kylin/libnm-external-kylin.pro + $(QMAKE) -o Makefile ../../libnm-external-kylin/libnm-external-kylin.pro +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_Attica.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_BluezQt.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuth.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KAuthCore.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCodecs.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCompletion.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigCore.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigGui.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KConfigWidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KCoreAddons.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KDBusAddons.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGlobalAccel.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KGuiAddons.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KI18n.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KIconThemes.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KItemViews.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KScreen.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KService.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KTextWidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWidgetsAddons.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KWindowSystem.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KXmlGui.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_help.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimedia.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qml.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_qmltest.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quick.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_quickwidgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_script.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_scripttools.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sensors.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uiplugin.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_x11extras.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetCore.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_SonnetUi.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf: +../.qmake.stash: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf: +../../libnm-external-kylin/kylin-agent/kylin-agent.pri: +../../libnm-external-kylin/kylin-tool/kylin-tool.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/link_pkgconfig.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbuscommon.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbusinterfaces.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/dbusadaptors.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/uic.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf: +../../libnm-external-kylin/libnm-external-kylin.pro: +qmake: FORCE + @$(QMAKE) -o Makefile ../../libnm-external-kylin/libnm-external-kylin.pro + +qmake_all: FORCE + + +all: Makefile ../../libnm-external-kylin/libkylin-nm-external.so.1.0.0 + +dist: distdir FORCE + (cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR) + +distdir: FORCE + @test -d $(DISTDIR) || mkdir -p $(DISTDIR) + $(COPY_FILE) --parents $(DIST) $(DISTDIR)/ + $(COPY_FILE) --parents /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp $(DISTDIR)/ + $(COPY_FILE) --parents ../../libnm-external-kylin/kylin-agent/kylinagent.h ../../libnm-external-kylin/kylin-agent/kylinagentobject.h ../../libnm-external-kylin/kylin-agent/kylinagentutils.h ../../libnm-external-kylin/kylin-agent/kylinpassworddialog.h ../../libnm-external-kylin/kylin-agent/kylinsecretagent.h ../../libnm-external-kylin/kylin-tool/kylinarping.h ../../libnm-external-kylin/kylin-tool/kylinipv4arping.h ../../libnm-external-kylin/kylin-tool/kylinipv6arping.h ../../libnm-external-kylin/libnm-external-kylin_global.h $(DISTDIR)/ + $(COPY_FILE) --parents ../../libnm-external-kylin/kylin-agent/kylinagent.cpp ../../libnm-external-kylin/kylin-agent/kylinagentobject.cpp ../../libnm-external-kylin/kylin-agent/kylinpassworddialog.cpp ../../libnm-external-kylin/kylin-agent/kylinsecretagent.cpp ../../libnm-external-kylin/kylin-tool/kylinipv4arping.cpp ../../libnm-external-kylin/kylin-tool/kylinipv6arping.cpp $(DISTDIR)/ + + +clean: compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +distclean: clean + -$(DEL_FILE) ../../libnm-external-kylin/$(TARGET) + -$(DEL_FILE) ../../libnm-external-kylin/$(TARGET0) ../../libnm-external-kylin/$(TARGET1) ../../libnm-external-kylin/$(TARGET2) $(TARGETA) + -$(DEL_FILE) Makefile + + +####### Sub-libraries + +mocclean: compiler_moc_header_clean compiler_moc_objc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_objc_header_make_all compiler_moc_source_make_all + +check: first + +benchmark: first + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_moc_predefs_make_all: moc_predefs.h +compiler_moc_predefs_clean: + -$(DEL_FILE) moc_predefs.h +moc_predefs.h: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp + g++ -pipe -O2 -std=gnu++11 -pthread -pthread -pthread -Wall -W -dM -E -o moc_predefs.h /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp + +compiler_moc_header_make_all: moc_kylinagent.cpp moc_kylinagentobject.cpp moc_kylinpassworddialog.cpp moc_kylinsecretagent.cpp moc_kylinipv4arping.cpp moc_kylinipv6arping.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_kylinagent.cpp moc_kylinagentobject.cpp moc_kylinpassworddialog.cpp moc_kylinsecretagent.cpp moc_kylinipv4arping.cpp moc_kylinipv6arping.cpp +moc_kylinagent.cpp: ../../libnm-external-kylin/kylin-agent/kylinagent.h \ + ../../libnm-external-kylin/kylin-agent/kylinagentobject.h \ + ../../libnm-external-kylin/kylin-agent/kylinsecretagent.h \ + ../../libnm-external-kylin/kylin-agent/kylinagentutils.h \ + ../../libnm-external-kylin/libnm-external-kylin_global.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-external-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin -I/usr/include/KF5/NetworkManagerQt -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/kylin-agent -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/kylin-tool -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libnma -I/usr/include/libsecret-1 -I/usr/include/x86_64-linux-gnu/qt5/QGSettings -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtX11Extras -I/usr/include/KF5/KWindowSystem -I/usr/include/x86_64-linux-gnu/qt5/QtSvg -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtConcurrent -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-external-kylin/kylin-agent/kylinagent.h -o moc_kylinagent.cpp + +moc_kylinagentobject.cpp: ../../libnm-external-kylin/kylin-agent/kylinagentobject.h \ + ../../libnm-external-kylin/kylin-agent/kylinsecretagent.h \ + ../../libnm-external-kylin/kylin-agent/kylinagentutils.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-external-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin -I/usr/include/KF5/NetworkManagerQt -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/kylin-agent -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/kylin-tool -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libnma -I/usr/include/libsecret-1 -I/usr/include/x86_64-linux-gnu/qt5/QGSettings -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtX11Extras -I/usr/include/KF5/KWindowSystem -I/usr/include/x86_64-linux-gnu/qt5/QtSvg -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtConcurrent -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-external-kylin/kylin-agent/kylinagentobject.h -o moc_kylinagentobject.cpp + +moc_kylinpassworddialog.cpp: ../../libnm-external-kylin/kylin-agent/kylinpassworddialog.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-external-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin -I/usr/include/KF5/NetworkManagerQt -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/kylin-agent -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/kylin-tool -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libnma -I/usr/include/libsecret-1 -I/usr/include/x86_64-linux-gnu/qt5/QGSettings -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtX11Extras -I/usr/include/KF5/KWindowSystem -I/usr/include/x86_64-linux-gnu/qt5/QtSvg -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtConcurrent -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-external-kylin/kylin-agent/kylinpassworddialog.h -o moc_kylinpassworddialog.cpp + +moc_kylinsecretagent.cpp: ../../libnm-external-kylin/kylin-agent/kylinsecretagent.h \ + ../../libnm-external-kylin/kylin-agent/kylinagentutils.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-external-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin -I/usr/include/KF5/NetworkManagerQt -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/kylin-agent -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/kylin-tool -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libnma -I/usr/include/libsecret-1 -I/usr/include/x86_64-linux-gnu/qt5/QGSettings -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtX11Extras -I/usr/include/KF5/KWindowSystem -I/usr/include/x86_64-linux-gnu/qt5/QtSvg -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtConcurrent -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-external-kylin/kylin-agent/kylinsecretagent.h -o moc_kylinsecretagent.cpp + +moc_kylinipv4arping.cpp: ../../libnm-external-kylin/kylin-tool/kylinipv4arping.h \ + ../../libnm-external-kylin/kylin-tool/kylinarping.h \ + ../../libnm-external-kylin/libnm-external-kylin_global.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-external-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin -I/usr/include/KF5/NetworkManagerQt -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/kylin-agent -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/kylin-tool -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libnma -I/usr/include/libsecret-1 -I/usr/include/x86_64-linux-gnu/qt5/QGSettings -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtX11Extras -I/usr/include/KF5/KWindowSystem -I/usr/include/x86_64-linux-gnu/qt5/QtSvg -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtConcurrent -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-external-kylin/kylin-tool/kylinipv4arping.h -o moc_kylinipv4arping.cpp + +moc_kylinipv6arping.cpp: ../../libnm-external-kylin/kylin-tool/kylinipv6arping.h \ + ../../libnm-external-kylin/libnm-external-kylin_global.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/crush/project/3.2/kylin-nm/libnm-kylin/build/libnm-external-kylin/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin -I/usr/include/KF5/NetworkManagerQt -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-base-kylin -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/kylin-agent -I/home/crush/project/3.2/kylin-nm/libnm-kylin/libnm-external-kylin/kylin-tool -I/usr/include/libnm -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libnma -I/usr/include/libsecret-1 -I/usr/include/x86_64-linux-gnu/qt5/QGSettings -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtX11Extras -I/usr/include/KF5/KWindowSystem -I/usr/include/x86_64-linux-gnu/qt5/QtSvg -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtConcurrent -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include ../../libnm-external-kylin/kylin-tool/kylinipv6arping.h -o moc_kylinipv6arping.cpp + +compiler_moc_objc_header_make_all: +compiler_moc_objc_header_clean: +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: +compiler_uic_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_predefs_clean compiler_moc_header_clean + +####### Compile + +kylinagent.o: ../../libnm-external-kylin/kylin-agent/kylinagent.cpp ../../libnm-external-kylin/kylin-agent/kylinagent.h \ + ../../libnm-external-kylin/kylin-agent/kylinagentobject.h \ + ../../libnm-external-kylin/kylin-agent/kylinsecretagent.h \ + ../../libnm-external-kylin/kylin-agent/kylinagentutils.h \ + ../../libnm-external-kylin/libnm-external-kylin_global.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinagent.o ../../libnm-external-kylin/kylin-agent/kylinagent.cpp + +kylinagentobject.o: ../../libnm-external-kylin/kylin-agent/kylinagentobject.cpp ../../libnm-external-kylin/kylin-agent/kylinagentobject.h \ + ../../libnm-external-kylin/kylin-agent/kylinsecretagent.h \ + ../../libnm-external-kylin/kylin-agent/kylinagentutils.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinagentobject.o ../../libnm-external-kylin/kylin-agent/kylinagentobject.cpp + +kylinpassworddialog.o: ../../libnm-external-kylin/kylin-agent/kylinpassworddialog.cpp ../../libnm-external-kylin/kylin-agent/kylinpassworddialog.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinpassworddialog.o ../../libnm-external-kylin/kylin-agent/kylinpassworddialog.cpp + +kylinsecretagent.o: ../../libnm-external-kylin/kylin-agent/kylinsecretagent.cpp ../../libnm-external-kylin/kylin-agent/kylinsecretagent.h \ + ../../libnm-external-kylin/kylin-agent/kylinagentutils.h \ + ../../libnm-external-kylin/kylin-agent/kylinpassworddialog.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinsecretagent.o ../../libnm-external-kylin/kylin-agent/kylinsecretagent.cpp + +kylinipv4arping.o: ../../libnm-external-kylin/kylin-tool/kylinipv4arping.cpp ../../libnm-external-kylin/kylin-tool/kylinipv4arping.h \ + ../../libnm-external-kylin/kylin-tool/kylinarping.h \ + ../../libnm-external-kylin/libnm-external-kylin_global.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinipv4arping.o ../../libnm-external-kylin/kylin-tool/kylinipv4arping.cpp + +kylinipv6arping.o: ../../libnm-external-kylin/kylin-tool/kylinipv6arping.cpp ../../libnm-external-kylin/kylin-tool/kylinipv6arping.h \ + ../../libnm-external-kylin/libnm-external-kylin_global.h \ + ../../libnm-external-kylin/kylin-tool/kylinarping.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kylinipv6arping.o ../../libnm-external-kylin/kylin-tool/kylinipv6arping.cpp + +moc_kylinagent.o: moc_kylinagent.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinagent.o moc_kylinagent.cpp + +moc_kylinagentobject.o: moc_kylinagentobject.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinagentobject.o moc_kylinagentobject.cpp + +moc_kylinpassworddialog.o: moc_kylinpassworddialog.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinpassworddialog.o moc_kylinpassworddialog.cpp + +moc_kylinsecretagent.o: moc_kylinsecretagent.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinsecretagent.o moc_kylinsecretagent.cpp + +moc_kylinipv4arping.o: moc_kylinipv4arping.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinipv4arping.o moc_kylinipv4arping.cpp + +moc_kylinipv6arping.o: moc_kylinipv6arping.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kylinipv6arping.o moc_kylinipv6arping.cpp + +####### Install + +install_target: first FORCE + @test -d $(INSTALL_ROOT)/usr/lib || mkdir -p $(INSTALL_ROOT)/usr/lib + -$(QINSTALL_PROGRAM) ../../libnm-external-kylin/$(TARGET) $(INSTALL_ROOT)/usr/lib/$(TARGET) + -$(STRIP) --strip-unneeded $(INSTALL_ROOT)/usr/lib/$(TARGET) + -$(SYMLINK) $(TARGET) $(INSTALL_ROOT)/usr/lib/$(TARGET0) + -$(SYMLINK) $(TARGET) $(INSTALL_ROOT)/usr/lib/$(TARGET1) + -$(SYMLINK) $(TARGET) $(INSTALL_ROOT)/usr/lib/$(TARGET2) + +uninstall_target: FORCE + -$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/$(TARGET) + -$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/$(TARGET0) + -$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/$(TARGET1) + -$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/$(TARGET2) + -$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/ + + +install: install_target FORCE + +uninstall: uninstall_target FORCE + +FORCE: + diff --git a/libnm-kylin/build/libnm-external-kylin/kylinagent.o b/libnm-kylin/build/libnm-external-kylin/kylinagent.o new file mode 100644 index 00000000..0462820f Binary files /dev/null and b/libnm-kylin/build/libnm-external-kylin/kylinagent.o differ diff --git a/libnm-kylin/build/libnm-external-kylin/kylinagentobject.o b/libnm-kylin/build/libnm-external-kylin/kylinagentobject.o new file mode 100644 index 00000000..0ea01a48 Binary files /dev/null and b/libnm-kylin/build/libnm-external-kylin/kylinagentobject.o differ diff --git a/libnm-kylin/build/libnm-external-kylin/kylinipv4arping.o b/libnm-kylin/build/libnm-external-kylin/kylinipv4arping.o new file mode 100644 index 00000000..87e7c773 Binary files /dev/null and b/libnm-kylin/build/libnm-external-kylin/kylinipv4arping.o differ diff --git a/libnm-kylin/build/libnm-external-kylin/kylinipv6arping.o b/libnm-kylin/build/libnm-external-kylin/kylinipv6arping.o new file mode 100644 index 00000000..a048d3b7 Binary files /dev/null and b/libnm-kylin/build/libnm-external-kylin/kylinipv6arping.o differ diff --git a/libnm-kylin/build/libnm-external-kylin/kylinpassworddialog.o b/libnm-kylin/build/libnm-external-kylin/kylinpassworddialog.o new file mode 100644 index 00000000..d4641b48 Binary files /dev/null and b/libnm-kylin/build/libnm-external-kylin/kylinpassworddialog.o differ diff --git a/libnm-kylin/build/libnm-external-kylin/kylinsecretagent.o b/libnm-kylin/build/libnm-external-kylin/kylinsecretagent.o new file mode 100644 index 00000000..02e4e7e7 Binary files /dev/null and b/libnm-kylin/build/libnm-external-kylin/kylinsecretagent.o differ diff --git a/libnm-kylin/build/libnm-external-kylin/moc_kylinagent.cpp b/libnm-kylin/build/libnm-external-kylin/moc_kylinagent.cpp new file mode 100644 index 00000000..fbd5f0d2 --- /dev/null +++ b/libnm-kylin/build/libnm-external-kylin/moc_kylinagent.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinagent.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-external-kylin/kylin-agent/kylinagent.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinagent.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KylinAgent_t { + QByteArrayData data[1]; + char stringdata0[11]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KylinAgent_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KylinAgent_t qt_meta_stringdata_KylinAgent = { + { +QT_MOC_LITERAL(0, 0, 10) // "KylinAgent" + + }, + "KylinAgent" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KylinAgent[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +void KylinAgent::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +QT_INIT_METAOBJECT const QMetaObject KylinAgent::staticMetaObject = { { + &QObject::staticMetaObject, + qt_meta_stringdata_KylinAgent.data, + qt_meta_data_KylinAgent, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KylinAgent::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KylinAgent::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KylinAgent.stringdata0)) + return static_cast(this); + return QObject::qt_metacast(_clname); +} + +int KylinAgent::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + return _id; +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-external-kylin/moc_kylinagent.o b/libnm-kylin/build/libnm-external-kylin/moc_kylinagent.o new file mode 100644 index 00000000..74d80a00 Binary files /dev/null and b/libnm-kylin/build/libnm-external-kylin/moc_kylinagent.o differ diff --git a/libnm-kylin/build/libnm-external-kylin/moc_kylinagentobject.cpp b/libnm-kylin/build/libnm-external-kylin/moc_kylinagentobject.cpp new file mode 100644 index 00000000..0adae813 --- /dev/null +++ b/libnm-kylin/build/libnm-external-kylin/moc_kylinagentobject.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinagentobject.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-external-kylin/kylin-agent/kylinagentobject.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinagentobject.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KylinAgentObject_t { + QByteArrayData data[3]; + char stringdata0[34]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KylinAgentObject_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KylinAgentObject_t qt_meta_stringdata_KylinAgentObject = { + { +QT_MOC_LITERAL(0, 0, 16), // "KylinAgentObject" +QT_MOC_LITERAL(1, 17, 15), // "onIntKylinAgent" +QT_MOC_LITERAL(2, 33, 0) // "" + + }, + "KylinAgentObject\0onIntKylinAgent\0" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KylinAgentObject[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // slots: name, argc, parameters, tag, flags + 1, 0, 19, 2, 0x0a /* Public */, + + // slots: parameters + QMetaType::Void, + + 0 // eod +}; + +void KylinAgentObject::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + auto *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->onIntKylinAgent(); break; + default: ; + } + } + Q_UNUSED(_a); +} + +QT_INIT_METAOBJECT const QMetaObject KylinAgentObject::staticMetaObject = { { + &QObject::staticMetaObject, + qt_meta_stringdata_KylinAgentObject.data, + qt_meta_data_KylinAgentObject, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KylinAgentObject::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KylinAgentObject::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KylinAgentObject.stringdata0)) + return static_cast(this); + return QObject::qt_metacast(_clname); +} + +int KylinAgentObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 1) + qt_static_metacall(this, _c, _id, _a); + _id -= 1; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 1) + *reinterpret_cast(_a[0]) = -1; + _id -= 1; + } + return _id; +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-external-kylin/moc_kylinagentobject.o b/libnm-kylin/build/libnm-external-kylin/moc_kylinagentobject.o new file mode 100644 index 00000000..9d256d38 Binary files /dev/null and b/libnm-kylin/build/libnm-external-kylin/moc_kylinagentobject.o differ diff --git a/libnm-kylin/build/libnm-external-kylin/moc_kylinipv4arping.cpp b/libnm-kylin/build/libnm-external-kylin/moc_kylinipv4arping.cpp new file mode 100644 index 00000000..a0a696aa --- /dev/null +++ b/libnm-kylin/build/libnm-external-kylin/moc_kylinipv4arping.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinipv4arping.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-external-kylin/kylin-tool/kylinipv4arping.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinipv4arping.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyIpv4Arping_t { + QByteArrayData data[1]; + char stringdata0[13]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyIpv4Arping_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyIpv4Arping_t qt_meta_stringdata_KyIpv4Arping = { + { +QT_MOC_LITERAL(0, 0, 12) // "KyIpv4Arping" + + }, + "KyIpv4Arping" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyIpv4Arping[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +void KyIpv4Arping::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +QT_INIT_METAOBJECT const QMetaObject KyIpv4Arping::staticMetaObject = { { + &QObject::staticMetaObject, + qt_meta_stringdata_KyIpv4Arping.data, + qt_meta_data_KyIpv4Arping, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyIpv4Arping::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyIpv4Arping::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyIpv4Arping.stringdata0)) + return static_cast(this); + return QObject::qt_metacast(_clname); +} + +int KyIpv4Arping::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + return _id; +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-external-kylin/moc_kylinipv4arping.o b/libnm-kylin/build/libnm-external-kylin/moc_kylinipv4arping.o new file mode 100644 index 00000000..ab8e3303 Binary files /dev/null and b/libnm-kylin/build/libnm-external-kylin/moc_kylinipv4arping.o differ diff --git a/libnm-kylin/build/libnm-external-kylin/moc_kylinipv6arping.cpp b/libnm-kylin/build/libnm-external-kylin/moc_kylinipv6arping.cpp new file mode 100644 index 00000000..93b82419 --- /dev/null +++ b/libnm-kylin/build/libnm-external-kylin/moc_kylinipv6arping.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinipv6arping.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-external-kylin/kylin-tool/kylinipv6arping.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinipv6arping.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyIpv6Arping_t { + QByteArrayData data[1]; + char stringdata0[13]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyIpv6Arping_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyIpv6Arping_t qt_meta_stringdata_KyIpv6Arping = { + { +QT_MOC_LITERAL(0, 0, 12) // "KyIpv6Arping" + + }, + "KyIpv6Arping" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyIpv6Arping[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +void KyIpv6Arping::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +QT_INIT_METAOBJECT const QMetaObject KyIpv6Arping::staticMetaObject = { { + &QObject::staticMetaObject, + qt_meta_stringdata_KyIpv6Arping.data, + qt_meta_data_KyIpv6Arping, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyIpv6Arping::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyIpv6Arping::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyIpv6Arping.stringdata0)) + return static_cast(this); + return QObject::qt_metacast(_clname); +} + +int KyIpv6Arping::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + return _id; +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-external-kylin/moc_kylinipv6arping.o b/libnm-kylin/build/libnm-external-kylin/moc_kylinipv6arping.o new file mode 100644 index 00000000..ecfd2959 Binary files /dev/null and b/libnm-kylin/build/libnm-external-kylin/moc_kylinipv6arping.o differ diff --git a/libnm-kylin/build/libnm-external-kylin/moc_kylinpassworddialog.cpp b/libnm-kylin/build/libnm-external-kylin/moc_kylinpassworddialog.cpp new file mode 100644 index 00000000..16f6da63 --- /dev/null +++ b/libnm-kylin/build/libnm-external-kylin/moc_kylinpassworddialog.cpp @@ -0,0 +1,146 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinpassworddialog.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-external-kylin/kylin-agent/kylinpassworddialog.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinpassworddialog.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KyPasswordDialog_t { + QByteArrayData data[5]; + char stringdata0[46]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KyPasswordDialog_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KyPasswordDialog_t qt_meta_stringdata_KyPasswordDialog = { + { +QT_MOC_LITERAL(0, 0, 16), // "KyPasswordDialog" +QT_MOC_LITERAL(1, 17, 15), // "signal_username" +QT_MOC_LITERAL(2, 33, 0), // "" +QT_MOC_LITERAL(3, 34, 5), // "login" +QT_MOC_LITERAL(4, 40, 5) // "close" + + }, + "KyPasswordDialog\0signal_username\0\0" + "login\0close" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KyPasswordDialog[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 3, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 1, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 1, 29, 2, 0x06 /* Public */, + + // slots: name, argc, parameters, tag, flags + 3, 0, 32, 2, 0x08 /* Private */, + 4, 0, 33, 2, 0x08 /* Private */, + + // signals: parameters + QMetaType::Void, QMetaType::QString, 2, + + // slots: parameters + QMetaType::Void, + QMetaType::Void, + + 0 // eod +}; + +void KyPasswordDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + auto *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->signal_username((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 1: _t->login(); break; + case 2: _t->close(); break; + default: ; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + { + using _t = void (KyPasswordDialog::*)(QString ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&KyPasswordDialog::signal_username)) { + *result = 0; + return; + } + } + } +} + +QT_INIT_METAOBJECT const QMetaObject KyPasswordDialog::staticMetaObject = { { + &QDialog::staticMetaObject, + qt_meta_stringdata_KyPasswordDialog.data, + qt_meta_data_KyPasswordDialog, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KyPasswordDialog::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KyPasswordDialog::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KyPasswordDialog.stringdata0)) + return static_cast(this); + return QDialog::qt_metacast(_clname); +} + +int KyPasswordDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QDialog::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 3) + qt_static_metacall(this, _c, _id, _a); + _id -= 3; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 3) + *reinterpret_cast(_a[0]) = -1; + _id -= 3; + } + return _id; +} + +// SIGNAL 0 +void KyPasswordDialog::signal_username(QString _t1) +{ + void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-external-kylin/moc_kylinpassworddialog.o b/libnm-kylin/build/libnm-external-kylin/moc_kylinpassworddialog.o new file mode 100644 index 00000000..3621a8b3 Binary files /dev/null and b/libnm-kylin/build/libnm-external-kylin/moc_kylinpassworddialog.o differ diff --git a/libnm-kylin/build/libnm-external-kylin/moc_kylinsecretagent.cpp b/libnm-kylin/build/libnm-external-kylin/moc_kylinsecretagent.cpp new file mode 100644 index 00000000..5410fc6f --- /dev/null +++ b/libnm-kylin/build/libnm-external-kylin/moc_kylinsecretagent.cpp @@ -0,0 +1,178 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'kylinsecretagent.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../../libnm-external-kylin/kylin-agent/kylinsecretagent.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'kylinsecretagent.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.12.8. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_KylinSecretAgent_t { + QByteArrayData data[13]; + char stringdata0[156]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_KylinSecretAgent_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_KylinSecretAgent_t qt_meta_stringdata_KylinSecretAgent = { + { +QT_MOC_LITERAL(0, 0, 16), // "KylinSecretAgent" +QT_MOC_LITERAL(1, 17, 10), // "GetSecrets" +QT_MOC_LITERAL(2, 28, 15), // "NMVariantMapMap" +QT_MOC_LITERAL(3, 44, 0), // "" +QT_MOC_LITERAL(4, 45, 10), // "connection" +QT_MOC_LITERAL(5, 56, 15), // "QDBusObjectPath" +QT_MOC_LITERAL(6, 72, 15), // "connection_path" +QT_MOC_LITERAL(7, 88, 12), // "setting_name" +QT_MOC_LITERAL(8, 101, 5), // "hints" +QT_MOC_LITERAL(9, 107, 5), // "flags" +QT_MOC_LITERAL(10, 113, 16), // "CancelGetSecrets" +QT_MOC_LITERAL(11, 130, 11), // "SaveSecrets" +QT_MOC_LITERAL(12, 142, 13) // "DeleteSecrets" + + }, + "KylinSecretAgent\0GetSecrets\0NMVariantMapMap\0" + "\0connection\0QDBusObjectPath\0connection_path\0" + "setting_name\0hints\0flags\0CancelGetSecrets\0" + "SaveSecrets\0DeleteSecrets" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_KylinSecretAgent[] = { + + // content: + 8, // revision + 0, // classname + 0, 0, // classinfo + 4, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // slots: name, argc, parameters, tag, flags + 1, 5, 34, 3, 0x0a /* Public */, + 10, 2, 45, 3, 0x0a /* Public */, + 11, 2, 50, 3, 0x0a /* Public */, + 12, 2, 55, 3, 0x0a /* Public */, + + // slots: parameters + 0x80000000 | 2, 0x80000000 | 2, 0x80000000 | 5, QMetaType::QString, QMetaType::QStringList, QMetaType::UInt, 4, 6, 7, 8, 9, + QMetaType::Void, 0x80000000 | 5, QMetaType::QString, 6, 7, + QMetaType::Void, 0x80000000 | 2, 0x80000000 | 5, 4, 6, + QMetaType::Void, 0x80000000 | 2, 0x80000000 | 5, 4, 6, + + 0 // eod +}; + +void KylinSecretAgent::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + auto *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: { NMVariantMapMap _r = _t->GetSecrets((*reinterpret_cast< const NMVariantMapMap(*)>(_a[1])),(*reinterpret_cast< const QDBusObjectPath(*)>(_a[2])),(*reinterpret_cast< const QString(*)>(_a[3])),(*reinterpret_cast< const QStringList(*)>(_a[4])),(*reinterpret_cast< uint(*)>(_a[5]))); + if (_a[0]) *reinterpret_cast< NMVariantMapMap*>(_a[0]) = std::move(_r); } break; + case 1: _t->CancelGetSecrets((*reinterpret_cast< const QDBusObjectPath(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break; + case 2: _t->SaveSecrets((*reinterpret_cast< const NMVariantMapMap(*)>(_a[1])),(*reinterpret_cast< const QDBusObjectPath(*)>(_a[2]))); break; + case 3: _t->DeleteSecrets((*reinterpret_cast< const NMVariantMapMap(*)>(_a[1])),(*reinterpret_cast< const QDBusObjectPath(*)>(_a[2]))); break; + default: ; + } + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + switch (_id) { + default: *reinterpret_cast(_a[0]) = -1; break; + case 0: + switch (*reinterpret_cast(_a[1])) { + default: *reinterpret_cast(_a[0]) = -1; break; + case 0: + *reinterpret_cast(_a[0]) = qRegisterMetaType< NMVariantMapMap >(); break; + case 1: + *reinterpret_cast(_a[0]) = qRegisterMetaType< QDBusObjectPath >(); break; + } + break; + case 1: + switch (*reinterpret_cast(_a[1])) { + default: *reinterpret_cast(_a[0]) = -1; break; + case 0: + *reinterpret_cast(_a[0]) = qRegisterMetaType< QDBusObjectPath >(); break; + } + break; + case 2: + switch (*reinterpret_cast(_a[1])) { + default: *reinterpret_cast(_a[0]) = -1; break; + case 0: + *reinterpret_cast(_a[0]) = qRegisterMetaType< NMVariantMapMap >(); break; + case 1: + *reinterpret_cast(_a[0]) = qRegisterMetaType< QDBusObjectPath >(); break; + } + break; + case 3: + switch (*reinterpret_cast(_a[1])) { + default: *reinterpret_cast(_a[0]) = -1; break; + case 0: + *reinterpret_cast(_a[0]) = qRegisterMetaType< NMVariantMapMap >(); break; + case 1: + *reinterpret_cast(_a[0]) = qRegisterMetaType< QDBusObjectPath >(); break; + } + break; + } + } +} + +QT_INIT_METAOBJECT const QMetaObject KylinSecretAgent::staticMetaObject = { { + &NetworkManager::SecretAgent::staticMetaObject, + qt_meta_stringdata_KylinSecretAgent.data, + qt_meta_data_KylinSecretAgent, + qt_static_metacall, + nullptr, + nullptr +} }; + + +const QMetaObject *KylinSecretAgent::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *KylinSecretAgent::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_KylinSecretAgent.stringdata0)) + return static_cast(this); + return NetworkManager::SecretAgent::qt_metacast(_clname); +} + +int KylinSecretAgent::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = NetworkManager::SecretAgent::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 4) + qt_static_metacall(this, _c, _id, _a); + _id -= 4; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 4) + qt_static_metacall(this, _c, _id, _a); + _id -= 4; + } + return _id; +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/libnm-kylin/build/libnm-external-kylin/moc_kylinsecretagent.o b/libnm-kylin/build/libnm-external-kylin/moc_kylinsecretagent.o new file mode 100644 index 00000000..7e1f460a Binary files /dev/null and b/libnm-kylin/build/libnm-external-kylin/moc_kylinsecretagent.o differ diff --git a/libnm-kylin/build/libnm-external-kylin/moc_predefs.h b/libnm-kylin/build/libnm-external-kylin/moc_predefs.h new file mode 100644 index 00000000..a2253264 --- /dev/null +++ b/libnm-kylin/build/libnm-external-kylin/moc_predefs.h @@ -0,0 +1,384 @@ +#define __SSP_STRONG__ 3 +#define __DBL_MIN_EXP__ (-1021) +#define __FLT32X_MAX_EXP__ 1024 +#define __cpp_attributes 200809 +#define __UINT_LEAST16_MAX__ 0xffff +#define __ATOMIC_ACQUIRE 2 +#define __FLT128_MAX_10_EXP__ 4932 +#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F +#define __GCC_IEC_559_COMPLEX 2 +#define __UINT_LEAST8_TYPE__ unsigned char +#define __SIZEOF_FLOAT80__ 16 +#define __INTMAX_C(c) c ## L +#define __CHAR_BIT__ 8 +#define __UINT8_MAX__ 0xff +#define __WINT_MAX__ 0xffffffffU +#define __FLT32_MIN_EXP__ (-125) +#define __cpp_static_assert 200410 +#define __ORDER_LITTLE_ENDIAN__ 1234 +#define __SIZE_MAX__ 0xffffffffffffffffUL +#define __WCHAR_MAX__ 0x7fffffff +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +#define __DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L) +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +#define __GCC_ATOMIC_CHAR_LOCK_FREE 2 +#define __GCC_IEC_559 2 +#define __FLT32X_DECIMAL_DIG__ 17 +#define __FLT_EVAL_METHOD__ 0 +#define __unix__ 1 +#define __cpp_binary_literals 201304 +#define __FLT64_DECIMAL_DIG__ 17 +#define __CET__ 3 +#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define __x86_64 1 +#define __cpp_variadic_templates 200704 +#define __UINT_FAST64_MAX__ 0xffffffffffffffffUL +#define __SIG_ATOMIC_TYPE__ int +#define __DBL_MIN_10_EXP__ (-307) +#define __FINITE_MATH_ONLY__ 0 +#define __GNUC_PATCHLEVEL__ 0 +#define __FLT32_HAS_DENORM__ 1 +#define __UINT_FAST8_MAX__ 0xff +#define __cpp_rvalue_reference 200610 +#define __has_include(STR) __has_include__(STR) +#define __DEC64_MAX_EXP__ 385 +#define __INT8_C(c) c +#define __INT_LEAST8_WIDTH__ 8 +#define __UINT_LEAST64_MAX__ 0xffffffffffffffffUL +#define __SHRT_MAX__ 0x7fff +#define __LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L +#define __FLT64X_MAX_10_EXP__ 4932 +#define __UINT_LEAST8_MAX__ 0xff +#define __GCC_ATOMIC_BOOL_LOCK_FREE 2 +#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128 +#define __UINTMAX_TYPE__ long unsigned int +#define __linux 1 +#define __DEC32_EPSILON__ 1E-6DF +#define __FLT_EVAL_METHOD_TS_18661_3__ 0 +#define __OPTIMIZE__ 1 +#define __unix 1 +#define __UINT32_MAX__ 0xffffffffU +#define __GXX_EXPERIMENTAL_CXX0X__ 1 +#define __LDBL_MAX_EXP__ 16384 +#define __FLT128_MIN_EXP__ (-16381) +#define __WINT_MIN__ 0U +#define __linux__ 1 +#define __FLT128_MIN_10_EXP__ (-4931) +#define __INT_LEAST16_WIDTH__ 16 +#define __SCHAR_MAX__ 0x7f +#define __FLT128_MANT_DIG__ 113 +#define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1) +#define __INT64_C(c) c ## L +#define __DBL_DIG__ 15 +#define __GCC_ATOMIC_POINTER_LOCK_FREE 2 +#define __FLT64X_MANT_DIG__ 64 +#define _FORTIFY_SOURCE 2 +#define __SIZEOF_INT__ 4 +#define __SIZEOF_POINTER__ 8 +#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define __USER_LABEL_PREFIX__ +#define __FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x +#define __STDC_HOSTED__ 1 +#define __LDBL_HAS_INFINITY__ 1 +#define __FLT32_DIG__ 6 +#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F +#define __GXX_WEAK__ 1 +#define __SHRT_WIDTH__ 16 +#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +#define __DEC32_MAX__ 9.999999E96DF +#define __cpp_threadsafe_static_init 200806 +#define __FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x +#define __FLT32X_HAS_INFINITY__ 1 +#define __INT32_MAX__ 0x7fffffff +#define __INT_WIDTH__ 32 +#define __SIZEOF_LONG__ 8 +#define __STDC_IEC_559__ 1 +#define __STDC_ISO_10646__ 201706L +#define __UINT16_C(c) c +#define __PTRDIFF_WIDTH__ 64 +#define __DECIMAL_DIG__ 21 +#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64 +#define __gnu_linux__ 1 +#define __INTMAX_WIDTH__ 64 +#define __FLT64_MIN_EXP__ (-1021) +#define __has_include_next(STR) __has_include_next__(STR) +#define __FLT64X_MIN_10_EXP__ (-4931) +#define __LDBL_HAS_QUIET_NAN__ 1 +#define __FLT64_MANT_DIG__ 53 +#define _REENTRANT 1 +#define __GNUC__ 9 +#define __GXX_RTTI 1 +#define __pie__ 2 +#define __MMX__ 1 +#define __cpp_delegating_constructors 200604 +#define __FLT_HAS_DENORM__ 1 +#define __SIZEOF_LONG_DOUBLE__ 16 +#define __BIGGEST_ALIGNMENT__ 16 +#define __STDC_UTF_16__ 1 +#define __FLT64_MAX_10_EXP__ 308 +#define __FLT32_HAS_INFINITY__ 1 +#define __DBL_MAX__ double(1.79769313486231570814527423731704357e+308L) +#define __cpp_raw_strings 200710 +#define __INT_FAST32_MAX__ 0x7fffffffffffffffL +#define __DBL_HAS_INFINITY__ 1 +#define __HAVE_SPECULATION_SAFE_VALUE 1 +#define __DEC32_MIN_EXP__ (-94) +#define __INTPTR_WIDTH__ 64 +#define __FLT32X_HAS_DENORM__ 1 +#define __INT_FAST16_TYPE__ long int +#define __LDBL_HAS_DENORM__ 1 +#define __cplusplus 201103L +#define __cpp_ref_qualifiers 200710 +#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL +#define __INT_LEAST32_MAX__ 0x7fffffff +#define __DEC32_MIN__ 1E-95DF +#define __DEPRECATED 1 +#define __cpp_rvalue_references 200610 +#define __DBL_MAX_EXP__ 1024 +#define __WCHAR_WIDTH__ 32 +#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32 +#define __DEC128_EPSILON__ 1E-33DL +#define __SSE2_MATH__ 1 +#define __ATOMIC_HLE_RELEASE 131072 +#define __PTRDIFF_MAX__ 0x7fffffffffffffffL +#define __amd64 1 +#define __ATOMIC_HLE_ACQUIRE 65536 +#define __FLT32_HAS_QUIET_NAN__ 1 +#define __GNUG__ 9 +#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL +#define __SIZEOF_SIZE_T__ 8 +#define __cpp_nsdmi 200809 +#define __FLT64X_MIN_EXP__ (-16381) +#define __SIZEOF_WINT_T__ 4 +#define __LONG_LONG_WIDTH__ 64 +#define __cpp_initializer_lists 200806 +#define __FLT32_MAX_EXP__ 128 +#define __cpp_hex_float 201603 +#define __GCC_HAVE_DWARF2_CFI_ASM 1 +#define __GXX_ABI_VERSION 1013 +#define __FLT128_HAS_INFINITY__ 1 +#define __FLT_MIN_EXP__ (-125) +#define __cpp_lambdas 200907 +#define __FLT64X_HAS_QUIET_NAN__ 1 +#define __INT_FAST64_TYPE__ long int +#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64 +#define __DBL_MIN__ double(2.22507385850720138309023271733240406e-308L) +#define __PIE__ 2 +#define __LP64__ 1 +#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x +#define __DECIMAL_BID_FORMAT__ 1 +#define __FLT64_MIN_10_EXP__ (-307) +#define __FLT64X_DECIMAL_DIG__ 21 +#define __DEC128_MIN__ 1E-6143DL +#define __REGISTER_PREFIX__ +#define __UINT16_MAX__ 0xffff +#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32 +#define __UINT8_TYPE__ unsigned char +#define __FLT_MANT_DIG__ 24 +#define __LDBL_DECIMAL_DIG__ 21 +#define __VERSION__ "9.3.0" +#define __UINT64_C(c) c ## UL +#define __cpp_unicode_characters 200704 +#define _STDC_PREDEF_H 1 +#define __GCC_ATOMIC_INT_LOCK_FREE 2 +#define __FLT128_MAX_EXP__ 16384 +#define __FLT32_MANT_DIG__ 24 +#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define __STDC_IEC_559_COMPLEX__ 1 +#define __FLT128_HAS_DENORM__ 1 +#define __FLT128_DIG__ 33 +#define __SCHAR_WIDTH__ 8 +#define __INT32_C(c) c +#define __DEC64_EPSILON__ 1E-15DD +#define __ORDER_PDP_ENDIAN__ 3412 +#define __DEC128_MIN_EXP__ (-6142) +#define __FLT32_MAX_10_EXP__ 38 +#define __INT_FAST32_TYPE__ long int +#define __UINT_LEAST16_TYPE__ short unsigned int +#define __FLT64X_HAS_INFINITY__ 1 +#define unix 1 +#define __DBL_HAS_DENORM__ 1 +#define __INT16_MAX__ 0x7fff +#define __cpp_rtti 199711 +#define __SIZE_TYPE__ long unsigned int +#define __UINT64_MAX__ 0xffffffffffffffffUL +#define __FLT64X_DIG__ 18 +#define __INT8_TYPE__ signed char +#define __ELF__ 1 +#define __GCC_ASM_FLAG_OUTPUTS__ 1 +#define __FLT_RADIX__ 2 +#define __INT_LEAST16_TYPE__ short int +#define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L +#define __UINTMAX_C(c) c ## UL +#define __GLIBCXX_BITSIZE_INT_N_0 128 +#define __k8 1 +#define __SIG_ATOMIC_MAX__ 0x7fffffff +#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define __SIZEOF_PTRDIFF_T__ 8 +#define __FLT32X_MANT_DIG__ 53 +#define __x86_64__ 1 +#define __FLT32X_MIN_EXP__ (-1021) +#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF +#define __INT_FAST16_MAX__ 0x7fffffffffffffffL +#define __FLT64_DIG__ 15 +#define __UINT_FAST32_MAX__ 0xffffffffffffffffUL +#define __UINT_LEAST64_TYPE__ long unsigned int +#define __FLT_HAS_QUIET_NAN__ 1 +#define __FLT_MAX_10_EXP__ 38 +#define __LONG_MAX__ 0x7fffffffffffffffL +#define __FLT64X_HAS_DENORM__ 1 +#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL +#define __FLT_HAS_INFINITY__ 1 +#define __cpp_unicode_literals 200710 +#define __UINT_FAST16_TYPE__ long unsigned int +#define __DEC64_MAX__ 9.999999999999999E384DD +#define __INT_FAST32_WIDTH__ 64 +#define __CHAR16_TYPE__ short unsigned int +#define __PRAGMA_REDEFINE_EXTNAME 1 +#define __SIZE_WIDTH__ 64 +#define __SEG_FS 1 +#define __INT_LEAST16_MAX__ 0x7fff +#define __DEC64_MANT_DIG__ 16 +#define __INT64_MAX__ 0x7fffffffffffffffL +#define __UINT_LEAST32_MAX__ 0xffffffffU +#define __SEG_GS 1 +#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32 +#define __GCC_ATOMIC_LONG_LOCK_FREE 2 +#define __SIG_ATOMIC_WIDTH__ 32 +#define __INT_LEAST64_TYPE__ long int +#define __INT16_TYPE__ short int +#define __INT_LEAST8_TYPE__ signed char +#define __DEC32_MAX_EXP__ 97 +#define __INT_FAST8_MAX__ 0x7f +#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128 +#define __INTPTR_MAX__ 0x7fffffffffffffffL +#define linux 1 +#define __cpp_range_based_for 200907 +#define __FLT64_HAS_QUIET_NAN__ 1 +#define __FLT32_MIN_10_EXP__ (-37) +#define __SSE2__ 1 +#define __EXCEPTIONS 1 +#define __LDBL_MANT_DIG__ 64 +#define __DBL_HAS_QUIET_NAN__ 1 +#define __FLT64_HAS_INFINITY__ 1 +#define __FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x +#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1) +#define __code_model_small__ 1 +#define __k8__ 1 +#define __INTPTR_TYPE__ long int +#define __UINT16_TYPE__ short unsigned int +#define __WCHAR_TYPE__ int +#define __SIZEOF_FLOAT__ 4 +#define __pic__ 2 +#define __UINTPTR_MAX__ 0xffffffffffffffffUL +#define __INT_FAST64_WIDTH__ 64 +#define __DEC64_MIN_EXP__ (-382) +#define __cpp_decltype 200707 +#define __FLT32_DECIMAL_DIG__ 9 +#define __INT_FAST64_MAX__ 0x7fffffffffffffffL +#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +#define __FLT_DIG__ 6 +#define __FLT64X_MAX_EXP__ 16384 +#define __UINT_FAST64_TYPE__ long unsigned int +#define __INT_MAX__ 0x7fffffff +#define __amd64__ 1 +#define __INT64_TYPE__ long int +#define __FLT_MAX_EXP__ 128 +#define __ORDER_BIG_ENDIAN__ 4321 +#define __DBL_MANT_DIG__ 53 +#define __cpp_inheriting_constructors 201511 +#define __SIZEOF_FLOAT128__ 16 +#define __INT_LEAST64_MAX__ 0x7fffffffffffffffL +#define __DEC64_MIN__ 1E-383DD +#define __WINT_TYPE__ unsigned int +#define __UINT_LEAST32_TYPE__ unsigned int +#define __SIZEOF_SHORT__ 2 +#define __SSE__ 1 +#define __LDBL_MIN_EXP__ (-16381) +#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64 +#define __WINT_WIDTH__ 32 +#define __INT_LEAST8_MAX__ 0x7f +#define __FLT32X_MAX_10_EXP__ 308 +#define __SIZEOF_INT128__ 16 +#define __LDBL_MAX_10_EXP__ 4932 +#define __ATOMIC_RELAXED 0 +#define __DBL_EPSILON__ double(2.22044604925031308084726333618164062e-16L) +#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128 +#define _LP64 1 +#define __UINT8_C(c) c +#define __FLT64_MAX_EXP__ 1024 +#define __INT_LEAST32_TYPE__ int +#define __SIZEOF_WCHAR_T__ 4 +#define __FLT128_HAS_QUIET_NAN__ 1 +#define __INT_FAST8_TYPE__ signed char +#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x +#define __GNUC_STDC_INLINE__ 1 +#define __FLT64_HAS_DENORM__ 1 +#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32 +#define __DBL_DECIMAL_DIG__ 17 +#define __STDC_UTF_32__ 1 +#define __INT_FAST8_WIDTH__ 8 +#define __FXSR__ 1 +#define __DEC_EVAL_METHOD__ 2 +#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x +#define __cpp_runtime_arrays 198712 +#define __UINT64_TYPE__ long unsigned int +#define __UINT32_C(c) c ## U +#define __INTMAX_MAX__ 0x7fffffffffffffffL +#define __cpp_alias_templates 200704 +#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F +#define __INT8_MAX__ 0x7f +#define __LONG_WIDTH__ 64 +#define __PIC__ 2 +#define __UINT_FAST32_TYPE__ long unsigned int +#define __CHAR32_TYPE__ unsigned int +#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F +#define __cpp_constexpr 200704 +#define __INT32_TYPE__ int +#define __SIZEOF_DOUBLE__ 8 +#define __cpp_exceptions 199711 +#define __FLT_MIN_10_EXP__ (-37) +#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64 +#define __INT_LEAST32_WIDTH__ 32 +#define __INTMAX_TYPE__ long int +#define __DEC128_MAX_EXP__ 6145 +#define __FLT32X_HAS_QUIET_NAN__ 1 +#define __ATOMIC_CONSUME 1 +#define __GNUC_MINOR__ 3 +#define __GLIBCXX_TYPE_INT_N_0 __int128 +#define __INT_FAST16_WIDTH__ 64 +#define __UINTMAX_MAX__ 0xffffffffffffffffUL +#define __DEC32_MANT_DIG__ 7 +#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x +#define __DBL_MAX_10_EXP__ 308 +#define __LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L +#define __INT16_C(c) c +#define __STDC__ 1 +#define __FLT32X_DIG__ 15 +#define __PTRDIFF_TYPE__ long int +#define __ATOMIC_SEQ_CST 5 +#define __UINT32_TYPE__ unsigned int +#define __FLT32X_MIN_10_EXP__ (-307) +#define __UINTPTR_TYPE__ long unsigned int +#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD +#define __DEC128_MANT_DIG__ 34 +#define __LDBL_MIN_10_EXP__ (-4931) +#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128 +#define __SSE_MATH__ 1 +#define __SIZEOF_LONG_LONG__ 8 +#define __cpp_user_defined_literals 200809 +#define __FLT128_DECIMAL_DIG__ 36 +#define __GCC_ATOMIC_LLONG_LOCK_FREE 2 +#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x +#define __LDBL_DIG__ 18 +#define __FLT_DECIMAL_DIG__ 9 +#define __UINT_FAST16_MAX__ 0xffffffffffffffffUL +#define __GCC_ATOMIC_SHORT_LOCK_FREE 2 +#define __INT_LEAST64_WIDTH__ 64 +#define __UINT_FAST8_TYPE__ unsigned char +#define _GNU_SOURCE 1 +#define __ATOMIC_ACQ_REL 4 +#define __ATOMIC_RELEASE 3 diff --git a/libnm-kylin/libnm-base-kylin/depend/kyapnetresource.cpp b/libnm-kylin/libnm-base-kylin/depend/kyapnetresource.cpp new file mode 100644 index 00000000..fe745732 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kyapnetresource.cpp @@ -0,0 +1,117 @@ +#include "kyapnetresource.h" +#include "kylinnetworkdeviceresource.h" +#include "kywirelessconnectoperation.h" +#include "kylinnetworkmanagerutil.h" + +const QString str2GBand = "2.4Ghz"; +const QString str5GBand = "5Ghz"; + +KyApNetResource::KyApNetResource(QObject *parent) : QObject(parent) +{ + m_networkResourceInstance = KyNetworkResourceManager::getInstance(); + connect(m_networkResourceInstance, &KyNetworkResourceManager::wirelessApConnectStateChange, + this, &KyApNetResource::wirelessApConnectStateChange); +} + +KyApNetResource::~KyApNetResource() +{ + m_networkResourceInstance = nullptr; +} + +KyApConnectItem KyApNetResource::getApConnectItem(NetworkManager::Connection::Ptr connectPtr) +{ + if (nullptr == connectPtr) { + qWarning()<<"[KyConnectResourse]"<<"get bluetooth connection item failed, the connect is empty"; + return KyApConnectItem(); + } + + NetworkManager::ConnectionSettings::Ptr settingPtr = connectPtr->settings(); + NetworkManager::WirelessSetting::Ptr wirelessSetting + = settingPtr->setting(NetworkManager::Setting::Wireless).dynamicCast(); + if (NetworkManager::WirelessSetting::NetworkMode::Ap + != wirelessSetting->mode()) { + qWarning() << "[KyConnectResourse]" <<"get ap item failed, the active connect mode is not ap."; + return KyApConnectItem(); + } + + KyNetworkDeviceResourse deviceResource; + if (!deviceResource.wirelessDeviceIsExist(settingPtr->interfaceName())) { + qWarning() << "[KyConnectResourse]" <<"get ap item failed, the ap device is not exist yet"; + return KyApConnectItem(); + } + + QByteArray rawSsid = wirelessSetting->ssid(); + + KyApConnectItem apConnectItem; + apConnectItem.m_connectName = connectPtr->name(); + apConnectItem.m_connectSsid = getSsidFromByteArray(rawSsid); + apConnectItem.m_connectUuid = connectPtr->uuid(); + if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::A) { + apConnectItem.m_band = str2GBand; + } else if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::Bg) { + apConnectItem.m_band = str5GBand; + } + apConnectItem.m_ifaceName = settingPtr->interfaceName(); + apConnectItem.m_isActivated = KyNetworkResourceManager::getInstance()->isActiveConnection(connectPtr->uuid()); + + //NetworkManager::WirelessSecuritySetting::Ptr wirelessSecuritySetting + // = settingPtr->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + KyWirelessConnectOperation wirelessOperation; + apConnectItem.m_password = wirelessOperation.getPsk(apConnectItem.m_connectUuid);// wirelessSecuritySetting->psk(); + + return apConnectItem; +} + +KyApConnectItem KyApNetResource::getApConnectionByUuid(QString connectUuid) +{ + NetworkManager::Connection::Ptr connectPtr = nullptr; + + connectPtr = KyNetworkResourceManager::getInstance()->findConnectByUuid(connectUuid); + if (nullptr == connectPtr) { + return KyApConnectItem(); + } + + if (NetworkManager::ConnectionSettings::ConnectionType::Wireless + != connectPtr->settings()->connectionType()) { + return KyApConnectItem(); + } + + KyApConnectItem connectItem = getApConnectItem(connectPtr); + + return connectItem; +} + +void KyApNetResource::getApConnections(QList &apConnectItemList) +{ + QList apActiveConnectItemList; + QList apDeactiveConnectItemList; + NetworkManager::Connection::List connectList; + + connectList.clear(); + connectList = KyNetworkResourceManager::getInstance()->getConnectList(); + + if (connectList.empty()) { + qWarning()<<"[KyConnectResourse]"<<"get ap connections failed, the connect list is empty"; + return; + } + + NetworkManager::Connection::Ptr connectPtr = nullptr; + for (int index = 0; index < connectList.size(); index++) { + connectPtr = connectList.at(index); + if (NetworkManager::ConnectionSettings::ConnectionType::Wireless + != connectPtr->settings()->connectionType()) { + continue; + } + + KyApConnectItem connectItem = getApConnectItem(connectPtr); + if (connectItem.m_isActivated) { + apActiveConnectItemList << connectItem; + } else { + apDeactiveConnectItemList << connectItem; + } + } + + apConnectItemList << apActiveConnectItemList << apDeactiveConnectItemList; + + return; +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kyapnetresource.h b/libnm-kylin/libnm-base-kylin/depend/kyapnetresource.h new file mode 100644 index 00000000..acc4e020 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kyapnetresource.h @@ -0,0 +1,25 @@ +#ifndef KYAPNETRESOURCE_H +#define KYAPNETRESOURCE_H + +#include +#include "kylinapconnectitem.h" +#include "kylinnetworkresourcemanager.h" + +class KyApNetResource : public QObject +{ + Q_OBJECT +public: + explicit KyApNetResource(QObject *parent = nullptr); + ~KyApNetResource(); + + void getApConnections(QList &apConnectItemList); +Q_SIGNALS: + void wirelessApConnectStateChange(); +private: + KyApConnectItem getApConnectItem(NetworkManager::Connection::Ptr connectPtr); + KyApConnectItem getApConnectionByUuid(QString connectUuid); + + KyNetworkResourceManager *m_networkResourceInstance = nullptr; +}; + +#endif // KYAPNETRESOURCE_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kyenterpricesettinginfo.cpp b/libnm-kylin/libnm-base-kylin/depend/kyenterpricesettinginfo.cpp new file mode 100644 index 00000000..bcf3a464 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kyenterpricesettinginfo.cpp @@ -0,0 +1,171 @@ +#include "kyenterpricesettinginfo.h" + +void assembleEapMethodTlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTlsInfo &info) +{ + NetworkManager::Security8021xSetting::Ptr wifi_8021x_sett + = connSettingPtr->setting(NetworkManager::Setting::Security8021x).dynamicCast(); + + QList list; + list.append(NetworkManager::Security8021xSetting::EapMethod::EapMethodTls); + wifi_8021x_sett->setInitialized(true); + wifi_8021x_sett->setEapMethods(list); + wifi_8021x_sett->setIdentity(info.identity); + if (!info.domain.isEmpty()){ + wifi_8021x_sett->setDomainSuffixMatch(info.domain); + } + if (info.bNeedCa) { + QByteArray caCerEndWithNull("file://" + info.caCertPath.toUtf8() + '\0'); + wifi_8021x_sett->setCaCertificate(caCerEndWithNull); + } else { + QByteArray caCerEndWithNull(""); + wifi_8021x_sett->setCaCertificate(caCerEndWithNull); + } + QByteArray cliCertEndWithNull("file://" + info.clientCertPath.toUtf8() + '\0'); + wifi_8021x_sett->setClientCertificate(cliCertEndWithNull); + QByteArray cliPriKeyEndWithNull("file://" + info.clientPrivateKey.toUtf8() + '\0'); + wifi_8021x_sett->setPrivateKey(cliPriKeyEndWithNull); + wifi_8021x_sett->setPrivateKeyPassword(info.clientPrivateKeyPWD); + wifi_8021x_sett->setPrivateKeyPasswordFlags(info.m_privateKeyPWDFlag); + + NetworkManager::WirelessSecuritySetting::Ptr security_sett + = connSettingPtr->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + security_sett->setInitialized(true); + security_sett->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaEap); + + return; +} + +void assembleEapMethodPeapSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodPeapInfo &info) +{ + NetworkManager::Security8021xSetting::Ptr wifi_8021x_sett + = connSettingPtr->setting(NetworkManager::Setting::Security8021x).dynamicCast(); + + QList list; + list.append(NetworkManager::Security8021xSetting::EapMethod::EapMethodPeap); + wifi_8021x_sett->setInitialized(true); + wifi_8021x_sett->setEapMethods(list); + wifi_8021x_sett->setPhase2AuthMethod((NetworkManager::Security8021xSetting::AuthMethod)info.phase2AuthMethod); + wifi_8021x_sett->setIdentity(info.userName); + wifi_8021x_sett->setPassword(info.userPWD); + wifi_8021x_sett->setPasswordFlags(info.m_passwdFlag); + + + NetworkManager::WirelessSecuritySetting::Ptr security_sett + = connSettingPtr->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + security_sett->setInitialized(true); + security_sett->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaEap); + return; +} + +void assembleEapMethodTtlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTtlsInfo &info) +{ + + NetworkManager::Security8021xSetting::Ptr wifi_8021x_sett + = connSettingPtr->setting(NetworkManager::Setting::Security8021x).dynamicCast(); + + QList list; + list.append(NetworkManager::Security8021xSetting::EapMethod::EapMethodTtls); + wifi_8021x_sett->setInitialized(true); + wifi_8021x_sett->setEapMethods(list); + if (info.authType == KyTtlsAuthMethod::AUTH_EAP) + { + wifi_8021x_sett->setPhase2AuthEapMethod((NetworkManager::Security8021xSetting::AuthEapMethod)info.authEapMethod);//gtc md5 mschapv2 otp tls + } else if (info.authType == KyTtlsAuthMethod::AUTH_NO_EAP) + { + wifi_8021x_sett->setPhase2AuthMethod((NetworkManager::Security8021xSetting::AuthMethod)info.authNoEapMethod);//chap md5 mschapv2 pap gtc mschap otp tls + } + wifi_8021x_sett->setIdentity(info.userName); + wifi_8021x_sett->setPassword(info.userPWD); + wifi_8021x_sett->setPasswordFlags(info.m_passwdFlag); + + NetworkManager::WirelessSecuritySetting::Ptr security_sett + = connSettingPtr->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + security_sett->setInitialized(true); + security_sett->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaEap); + return; +} + + +void modifyEapMethodTlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTlsInfo &tlsInfo) +{ + NetworkManager::Security8021xSetting::Ptr setting = connSettingPtr->setting(NetworkManager::Setting::Security8021x).dynamicCast(); + setting->setInitialized(true); + + QList list; + list.append(NetworkManager::Security8021xSetting::EapMethod::EapMethodTls); + setting->setEapMethods(list); + setting->setIdentity(tlsInfo.identity); + if(!tlsInfo.domain.isEmpty()) + { + setting->setDomainSuffixMatch(tlsInfo.domain); + } + if (tlsInfo.bNeedCa) + { + QByteArray caCerEndWithNull("file://" + tlsInfo.caCertPath.toUtf8() + '\0'); + setting->setCaCertificate(caCerEndWithNull); + } else { + QByteArray caCerEndWithNull(""); + setting->setCaCertificate(caCerEndWithNull); + } + + QByteArray cliCertEndWithNull("file://" + tlsInfo.clientCertPath.toUtf8() + '\0'); + setting->setClientCertificate(cliCertEndWithNull); + QByteArray cliPriKeyEndWithNull("file://" + tlsInfo.clientPrivateKey.toUtf8() + '\0'); + setting->setPrivateKey(cliPriKeyEndWithNull); + setting->setPrivateKeyPasswordFlags(tlsInfo.m_privateKeyPWDFlag); + if(tlsInfo.bChanged) + { + setting->setPrivateKeyPassword(tlsInfo.clientPrivateKeyPWD); + } + return; +} + +void modifyEapMethodPeapSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodPeapInfo &peapInfo) +{ + NetworkManager::Security8021xSetting::Ptr wifi_8021x_sett + = connSettingPtr->setting(NetworkManager::Setting::Security8021x).dynamicCast(); + wifi_8021x_sett->setInitialized(true); + + QList list; + list.append(NetworkManager::Security8021xSetting::EapMethod::EapMethodPeap); + wifi_8021x_sett->setEapMethods(list); + wifi_8021x_sett->setPhase2AuthMethod((NetworkManager::Security8021xSetting::AuthMethod)peapInfo.phase2AuthMethod); + wifi_8021x_sett->setIdentity(peapInfo.userName); + if(peapInfo.bChanged) { + wifi_8021x_sett->setPassword(peapInfo.userPWD); + } + wifi_8021x_sett->setPasswordFlags(peapInfo.m_passwdFlag); + + QByteArray caCerEndWithNull(""); + wifi_8021x_sett->setCaCertificate(caCerEndWithNull); + + return; +} + +void modifyEapMethodTtlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTtlsInfo &ttlsInfo) +{ + NetworkManager::Security8021xSetting::Ptr wifi_8021x_sett + = connSettingPtr->setting(NetworkManager::Setting::Security8021x).dynamicCast(); + + QList list; + list.append(NetworkManager::Security8021xSetting::EapMethod::EapMethodTtls); + wifi_8021x_sett->setInitialized(true); + wifi_8021x_sett->setEapMethods(list); + if (ttlsInfo.authType == KyTtlsAuthMethod::AUTH_EAP) + { + wifi_8021x_sett->setPhase2AuthEapMethod((NetworkManager::Security8021xSetting::AuthEapMethod)ttlsInfo.authEapMethod);//gtc md5 mschapv2 otp tls + } else if (ttlsInfo.authType == KyTtlsAuthMethod::AUTH_NO_EAP) + { + wifi_8021x_sett->setPhase2AuthMethod((NetworkManager::Security8021xSetting::AuthMethod)ttlsInfo.authNoEapMethod);//chap md5 mschapv2 pap gtc mschap otp tls + } + wifi_8021x_sett->setIdentity(ttlsInfo.userName); + if(ttlsInfo.bChanged) + { + wifi_8021x_sett->setPassword(ttlsInfo.userPWD); + } + wifi_8021x_sett->setPasswordFlags(ttlsInfo.m_passwdFlag); + + QByteArray caCerEndWithNull(""); + wifi_8021x_sett->setCaCertificate(caCerEndWithNull); + return; +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kyenterpricesettinginfo.h b/libnm-kylin/libnm-base-kylin/depend/kyenterpricesettinginfo.h new file mode 100644 index 00000000..01c8b29e --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kyenterpricesettinginfo.h @@ -0,0 +1,146 @@ +#ifndef KYENTERPRICESETTINGINFO_H +#define KYENTERPRICESETTINGINFO_H + +#include +#include + +#include "kylinnetworkresourcemanager.h" +#include + +enum KyEapMethodType { + TLS = 0, + PEAP, + TTLS, +}; + +class KyEapMethodTlsInfo +{ +public: + QString identity; + QString domain; + QString devIfaceName; + QString caCertPath; + bool bNeedCa; + QString clientCertPath; + QString clientPrivateKey; + QString clientPrivateKeyPWD; + NetworkManager::Setting::SecretFlags m_privateKeyPWDFlag; + // only valid when update + bool bChanged; + + inline bool operator == (const KyEapMethodTlsInfo& info) const + { + if (this->identity == info.identity + && this->domain == info.domain +// && this->devIfaceName == info.devIfaceName + && this->caCertPath == info.caCertPath + && this->bNeedCa == info.bNeedCa + && this->clientCertPath == info.clientCertPath + && this->clientPrivateKey == info.clientPrivateKey + && this->clientPrivateKeyPWD == info.clientPrivateKeyPWD + && this->m_privateKeyPWDFlag == info.m_privateKeyPWDFlag) { + return true; + } else { + return false; + } + } +}; + +typedef enum { + KyAuthEapMethodUnknown = 0, + KyAuthEapMethodMd5, + KyAuthEapMethodMschapv2, + KyAuthEapMethodOtp, + KyAuthEapMethodGtc, + KyAuthEapMethodTls +} KyEapMethodAuth; + +typedef enum{ + KyAuthMethodUnknown = 0, + KyAuthMethodPap, + KyAuthMethodChap, + KyAuthMethodMschap, + KyAuthMethodMschapv2, + KyAuthMethodGtc, + KyAuthMethodOtp, + KyAuthMethodMd5, + KyAuthMethodTls +} KyNoEapMethodAuth; + + +class KyEapMethodPeapInfo +{ +public: + KyNoEapMethodAuth phase2AuthMethod; + QString userName; + QString userPWD; + NetworkManager::Setting::SecretFlags m_passwdFlag; + // only valid when update + bool bChanged; + + inline bool operator == (const KyEapMethodPeapInfo& info) const + { + if (this->phase2AuthMethod == info.phase2AuthMethod + && this->userName == info.userName + && this->userPWD == info.userPWD + && this->m_passwdFlag == info.m_passwdFlag) { + return true; + } else { + return false; + } + } +}; + +enum KyTtlsAuthMethod +{ + AUTH_EAP, + AUTH_NO_EAP +}; + +class KyEapMethodTtlsInfo +{ +public: + KyTtlsAuthMethod authType; + KyEapMethodAuth authEapMethod; + KyNoEapMethodAuth authNoEapMethod; + QString userName; + QString userPWD; + NetworkManager::Setting::SecretFlags m_passwdFlag; + // only valid when update + bool bChanged; + + inline bool operator == (const KyEapMethodTtlsInfo& info) const + { + if (this->authType == info.authType) { + if (authType == AUTH_EAP) { + if (this->authEapMethod == info.authEapMethod + && this ->userName == info.userName + && this->userPWD == info.userPWD + && this->m_passwdFlag == info.m_passwdFlag) { + return true; + } + } else { + if (authType == AUTH_EAP) { + if (this->authNoEapMethod == info.authNoEapMethod + && this ->userName == info.userName + && this->userPWD == info.userPWD + && this->m_passwdFlag == info.m_passwdFlag) { + return true; + } + } + } + + } + return false; + } +}; + +void assembleEapMethodTlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTlsInfo &tlsInfo); +void assembleEapMethodPeapSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodPeapInfo &peapInfo); +void assembleEapMethodTtlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTtlsInfo &ttlsInfo); + +void modifyEapMethodTlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTlsInfo &tlsInfo); +void modifyEapMethodPeapSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodPeapInfo &peapInfo); +void modifyEapMethodTtlsSettings(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyEapMethodTtlsInfo &ttlsInfo); + +#endif // KYENTERPRICESETTINGINFO_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinactiveconnectresource.cpp b/libnm-kylin/libnm-base-kylin/depend/kylinactiveconnectresource.cpp new file mode 100644 index 00000000..01da8f25 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinactiveconnectresource.cpp @@ -0,0 +1,283 @@ + +#include "kylinactiveconnectresource.h" +#include "kywirelessconnectoperation.h" +#include "kylinnetworkmanagerutil.h" +#include "kylinnetworkdeviceresource.h" + +#include +#include +#include + +#define LOG_FLAG "[KyActiveConnectResourse]" + +KyActiveConnectResourse::KyActiveConnectResourse(QObject *parent) : QObject(parent) +{ + m_networkResourceInstance = KyNetworkResourceManager::getInstance(); + + connect(m_networkResourceInstance, &KyNetworkResourceManager::wiredConnectStateChange, + this, &KyActiveConnectResourse::wiredStateChange); + connect(m_networkResourceInstance, &KyNetworkResourceManager::wirelessConnectStateChange, + this, &KyActiveConnectResourse::wirelessStateChange); +} + +KyActiveConnectResourse::~KyActiveConnectResourse() +{ + m_networkResourceInstance = nullptr; +} + +KyActivateItem KyActiveConnectResourse::getActiveConnectionItem(NetworkManager::ActiveConnection::Ptr activeConnectPtr) +{ + if (nullptr == activeConnectPtr) { + qWarning() << LOG_FLAG <<"the active connect is empty"; + return KyActivateItem(); + } + + if (NetworkManager::ActiveConnection::State::Activated != activeConnectPtr->state()) { + return KyActivateItem(); + } + + KyActivateItem activeConnectItem; + activeConnectItem.m_uuid = activeConnectPtr->uuid(); + + NetworkManager::Connection::Ptr connectPtr = activeConnectPtr->connection(); + activeConnectItem.m_connName = connectPtr->name(); + activeConnectItem.m_dbusPath = connectPtr->path(); + if (activeConnectPtr->type() == CONNECT_TYPE_WIRELESS) { + NetworkManager::WirelessSetting::Ptr wireless_sett = + connectPtr->settings()->setting(NetworkManager::Setting::Wireless).dynamicCast(); + QByteArray rawSsid = wireless_sett->ssid(); + activeConnectItem.m_ssid = getSsidFromByteArray(rawSsid); + } + + activeConnectItem.m_connStatus = CONNECT_STATE_ACTIVATED; + + return activeConnectItem; +} + +void KyActiveConnectResourse::getActiveConnectionList(QString deviceName, + KyConnectionType connectionType, + QList &activeConnectItemList) +{ + NetworkManager::ActiveConnection::List activeConnectList = m_networkResourceInstance->getActiveConnectList(); + + if (activeConnectList.isEmpty()) { + qWarning() << LOG_FLAG <<"the active connect list is empty"; + return; + } + NetworkManager::ActiveConnection::Ptr activeConnectPtr = nullptr; + for (int index = 0; index < activeConnectList.size(); index++) { + activeConnectPtr = nullptr; + activeConnectPtr = activeConnectList.at(index); + if (activeConnectPtr.isNull()) { + continue; + } + + if (connectionType != activeConnectPtr->type()) { + continue; + } + + QStringList interfaces = activeConnectPtr->devices(); + for (int index = 0; index < interfaces.size(); ++index) { + QString ifaceUni = interfaces.at(index); + NetworkManager::Device:: Ptr devicePtr = + m_networkResourceInstance->findDeviceByUni(ifaceUni); + if (devicePtr->interfaceName() == deviceName) { + KyActivateItem activeConnectItem = + getActiveConnectionItem(activeConnectPtr); + activeConnectItem.m_interface = deviceName; + activeConnectItemList << activeConnectItem; + break; + } + } + } +} + +//动态ip地址 +void KyActiveConnectResourse::getActiveConnectIpInfo( + const QString &connectUuid, + QString &ipv4Address, + QString &ipv6Address) +{ + ipv4Address.clear(); + ipv6Address.clear(); + NetworkManager::ActiveConnection::Ptr activeConnectPtr = + m_networkResourceInstance->findActiveConnectByUuid(connectUuid); + + if (activeConnectPtr.isNull()) { + qWarning() << LOG_FLAG <<"it can not find connect "<< connectUuid; + return; + } + + getActiveConnectIp(activeConnectPtr, ipv4Address, ipv6Address); +} + +void KyActiveConnectResourse::getActiveConnectIp( + NetworkManager::ActiveConnection::Ptr activeConnectPtr, + QString &ipv4Address, + QString &ipv6Address) +{ + NetworkManager::IpConfig ipv4Config =activeConnectPtr->ipV4Config(); + if (ipv4Config.isValid()) { + if (!ipv4Config.addresses().isEmpty()) { + NetworkManager::IpAddress address = ipv4Config.addresses().at(0); + ipv4Address = address.ip().toString(); + } else { + qWarning()<<"[KyActiveConnectResourse]"<<"the ipv4 address is empty."; + } + } else { + qWarning()<<"[KyActiveConnectResourse]"<<"ipv4 config is not valid"; + } + + NetworkManager::IpConfig ipv6Config =activeConnectPtr->ipV6Config(); + if (ipv6Config.isValid()) { + if (!ipv6Config.addresses().isEmpty()) { + NetworkManager::IpAddress address = ipv6Config.addresses().at(0); + ipv6Address = address.ip().toString(); + } else { + qWarning()<<"[KyActiveConnectResourse]"<<"ipv6 address is empty"; + } + } else { + qWarning()<<"[KyActiveConnectResourse]"<<"ipv6 config is not valid"; + } +} + +void KyActiveConnectResourse::getActiveConnectDnsInfo( + const QString &connectUuid, + QList &ipv4Dns, + QList &ipv6Dns) +{ + NetworkManager::ActiveConnection::Ptr activeConnectPtr = + m_networkResourceInstance->findActiveConnectByUuid(connectUuid); + if (activeConnectPtr.isNull()) { + qWarning()<< "[KyActiveConnectResourse]" <<"it can not find connect "<< connectUuid; + return; + } + + getActiveConnectDns(activeConnectPtr, ipv4Dns, ipv6Dns); +} + +void KyActiveConnectResourse::getActiveConnectDns( + NetworkManager::ActiveConnection::Ptr activeConnectPtr, + QList &ipv4Dns, + QList &ipv6Dns) +{ + NetworkManager::IpConfig ipv4Config = activeConnectPtr->ipV4Config(); + if (ipv4Config.isValid()) { + ipv4Dns = ipv4Config.nameservers(); + } else { + qWarning()<<"[KyActiveConnectResourse]"<<"ipv4 config is not valid"; + } + + NetworkManager::IpConfig ipv6Config =activeConnectPtr->ipV6Config(); + if (ipv6Config.isValid()) { + ipv6Dns = ipv6Config.nameservers(); + } else { + qWarning()<<"[KyActiveConnectResourse]"<<"ipv6 config is not valid"; + } + + return; +} + +bool KyActiveConnectResourse::wiredConnectIsActived() +{ + int index = 0; + NetworkManager::ActiveConnection::List activeConnectList; + + activeConnectList.clear(); + activeConnectList = m_networkResourceInstance->getActiveConnectList(); + + if (activeConnectList.empty()) { + qWarning()<<"[KyActiveConnectResourse]" + <<"get active connect failed, the active connect list is empty"; + return false; + } + + NetworkManager::ActiveConnection::Ptr activeConnectPtr = nullptr; + for (index = 0; index < activeConnectList.size(); index++) { + activeConnectPtr = activeConnectList.at(index); + if (activeConnectPtr.isNull()) { + continue; + } + + if (NetworkManager::ConnectionSettings::ConnectionType::Wired + != activeConnectPtr->type()) { + continue; + } + + if (m_networkResourceInstance->isWiredConnect(activeConnectPtr->path())) { + continue; + } + + if (activeConnectPtr->state() == NetworkManager::ActiveConnection::State::Activated) { + return true; + } + } + + return false; +} + +bool KyActiveConnectResourse::wirelessConnectIsActived() +{ + int index = 0; + NetworkManager::ActiveConnection::List activeConnectList; + + activeConnectList.clear(); + activeConnectList = m_networkResourceInstance->getActiveConnectList(); + + if (activeConnectList.empty()) { + qWarning()<<"[KyActiveConnectResourse]" + <<"get active connect failed, the active connect list is empty"; + return false; + } + + NetworkManager::ActiveConnection::Ptr activeConnectPtr = nullptr; + for (index = 0; index < activeConnectList.size(); index++) { + activeConnectPtr = activeConnectList.at(index); + if (activeConnectPtr.isNull()) { + continue; + } + + if (NetworkManager::ConnectionSettings::ConnectionType::Wireless + != activeConnectPtr->type()) { + continue; + } + + if (activeConnectPtr->state() == NetworkManager::ActiveConnection::State::Activated) { + return true; + } + } + + return false; +} + +int KyActiveConnectResourse::getAcivateWifiSignal() +{ + int signalStrength = 0; + KyNetworkDeviceResourse devResource; + QStringList devList; + devResource.getNetworkDeviceList(DEVICE_TYPE_WIFI, devList); + + for (int i = 0; i < devList.size(); ++i) { + + NetworkManager::Device::Ptr connectDevice = + m_networkResourceInstance->findDeviceByName(devList.at(i)); + + if (nullptr == connectDevice || !connectDevice->isValid()) { + qWarning()<< LOG_FLAG <<"getDeviceActiveAPInfo failed, the device" << devList.at(i) << "is not existed"; + continue; + } + + if (connectDevice->type() == NetworkManager::Device::Wifi) { + NetworkManager::WirelessDevice *wirelessDevicePtr = + qobject_cast(connectDevice.data()); + NetworkManager::AccessPoint::Ptr apPtr = wirelessDevicePtr->activeAccessPoint(); + if (apPtr.isNull()) { + continue; + } + signalStrength = apPtr->signalStrength(); + break; + } + } + + return signalStrength; +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinactiveconnectresource.h b/libnm-kylin/libnm-base-kylin/depend/kylinactiveconnectresource.h new file mode 100644 index 00000000..d541a1aa --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinactiveconnectresource.h @@ -0,0 +1,59 @@ +#ifndef KYLINACTIVECONNECTRESOURCE_H +#define KYLINACTIVECONNECTRESOURCE_H + +#include +#include "kylinnetworkresourcemanager.h" +#include "kylinconnectitem.h" +#include "kylinnetworkdeviceresource.h" +#include "kylinapconnectitem.h" +#include "kylinnetworkresourcetype.h" + +class KyActivateItem +{ +public: + QString m_interface; + QString m_uuid; + QString m_ssid; + QString m_connName; + QString m_dbusPath; + KyConnectState m_connStatus; +}; + +class KyActiveConnectResourse : public QObject +{ + Q_OBJECT + +public: + explicit KyActiveConnectResourse(QObject *parent = nullptr); + ~KyActiveConnectResourse(); + +public: + void getActiveConnectionList(QString deviceName, + KyConnectionType connectionType, QList &connectItemList); + + void getActiveConnectIpInfo(const QString &uuid, + QString &ipv4Address, QString &ipv6Address); + void getActiveConnectDnsInfo(const QString &uuid, + QList &ipv4Dns, QList &ipv6Dns); + + bool wiredConnectIsActived(); + bool wirelessConnectIsActived(); + + int getAcivateWifiSignal(); + +private: + void getActiveConnectIp(NetworkManager::ActiveConnection::Ptr activeConnectPtr, + QString &ipv4Address, QString &ipv6Address); + void getActiveConnectDns(NetworkManager::ActiveConnection::Ptr activeConnectPtr, + QList &ipv4Dns, QList &ipv6Dns); + + KyActivateItem getActiveConnectionItem(NetworkManager::ActiveConnection::Ptr activeConnectPtr); + +Q_SIGNALS: + void wiredStateChange(QString deviceName, QString uuid, KyConnectState state); + void wirelessStateChange(QString deviceName, QString ssid, QString uuid, KyConnectState state); + +private: + KyNetworkResourceManager *m_networkResourceInstance = nullptr; +}; +#endif // KYLINACTIVECONNECTRESOURCE_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinapconnectitem.cpp b/libnm-kylin/libnm-base-kylin/depend/kylinapconnectitem.cpp new file mode 100644 index 00000000..6daa0d49 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinapconnectitem.cpp @@ -0,0 +1,13 @@ + +#include "kylinapconnectitem.h" + +KyApConnectItem::KyApConnectItem(QObject *parent) : QObject(parent) +{ + m_connectName = ""; + m_connectUuid = ""; + m_connectSsid = ""; + m_ifaceName = ""; + m_password = ""; + m_band = ""; + m_isActivated = false; +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinapconnectitem.h b/libnm-kylin/libnm-base-kylin/depend/kylinapconnectitem.h new file mode 100644 index 00000000..8d7b44f4 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinapconnectitem.h @@ -0,0 +1,19 @@ +#ifndef KYLINAPCONNECTITEM_H +#define KYLINAPCONNECTITEM_H + +#include + +class KyApConnectItem +{ +public: + QString m_connectName = ""; + QString m_connectSsid = ""; + QString m_connectUuid = ""; + QString m_ifaceName = ""; + QString m_password = ""; + QString m_band = ""; + bool m_isActivated = false; + +}; + +#endif // KYLINAPCONNECTITEM_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinconnectitem.cpp b/libnm-kylin/libnm-base-kylin/depend/kylinconnectitem.cpp new file mode 100644 index 00000000..e69de29b diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinconnectitem.h b/libnm-kylin/libnm-base-kylin/depend/kylinconnectitem.h new file mode 100644 index 00000000..9a65e8c0 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinconnectitem.h @@ -0,0 +1,15 @@ +#ifndef KYLINCONNECTITEM_H +#define KYLINCONNECTITEM_H + +#include + +class KyWiredItem +{ +public: + QString m_connectName; + QString m_connectUuid; + QString m_connectPath; + +}; + +#endif // KYLINWIREDCONNECTITEM_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinconnectoperation.cpp b/libnm-kylin/libnm-base-kylin/depend/kylinconnectoperation.cpp new file mode 100644 index 00000000..9f93d3a2 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinconnectoperation.cpp @@ -0,0 +1,289 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 +#include +#include +#include +#include + +KyConnectOperation::KyConnectOperation(QObject *parent) : QObject(parent) +{ + m_networkResourceInstance = KyNetworkResourceManager::getInstance(); +} + +KyConnectOperation::~KyConnectOperation() +{ + m_networkResourceInstance = nullptr; +} + +void KyConnectOperation::ipv4SettingSet( + NetworkManager::Ipv4Setting::Ptr &ipv4Setting, + const KyConnectSetting &connectSettingsInfo) +{ + ipv4Setting->setInitialized(true); + ipv4Setting->setDns(connectSettingsInfo.m_ipv4Dns); + + if (CONFIG_IP_DHCP == connectSettingsInfo.m_ipv4ConfigIpType) { + ipv4Setting->setMethod(NetworkManager::Ipv4Setting::Automatic); + return; + } else { + ipv4Setting->setMethod(NetworkManager::Ipv4Setting::Manual); + } + ipv4Setting->setAddresses(connectSettingsInfo.m_ipv4Address); + + return; +} +void KyConnectOperation::ipv6SettingSet( + NetworkManager::Ipv6Setting::Ptr &ipv6Setting, + const KyConnectSetting &connectSettingsInfo) +{ + ipv6Setting->setInitialized(true); + ipv6Setting->setDns(connectSettingsInfo.m_ipv6Dns); + + if (CONFIG_IP_DHCP == connectSettingsInfo.m_ipv6ConfigIpType) { + ipv6Setting->setMethod(NetworkManager::Ipv6Setting::Automatic); + ipv6Setting->setPrivacy(NetworkManager::Ipv6Setting::Disabled); + return; + } + + ipv6Setting->setMethod(NetworkManager::Ipv6Setting::Manual); + ipv6Setting->setAddresses(connectSettingsInfo.m_ipv6Address); + + return ; +} + +void KyConnectOperation::connectSettingSet( + NetworkManager::ConnectionSettings::Ptr connectionSettings, + const KyConnectSetting &connectSettingsInfo) +{ + connectionSettings->setId(connectSettingsInfo.m_connectName); + connectionSettings->setUuid(NetworkManager::ConnectionSettings::createNewUuid()); + connectionSettings->setAutoconnect(true); + connectionSettings->setAutoconnectPriority(0); + if (!connectSettingsInfo.m_ifaceName.isEmpty()) { + connectionSettings->setInterfaceName(connectSettingsInfo.m_ifaceName); + } + return; +} + +void KyConnectOperation::setAutoConnect(NetworkManager::ConnectionSettings::Ptr &connectSetting, + bool bAutoConnect) +{ + if (connectSetting.isNull()) { + return; + } + + connectSetting->setAutoconnect(bAutoConnect); + + return; +} + +//ipv4 ipv6更新 +void KyConnectOperation::updateConnect(QString connectUuid, const KyConnectSetting &connectSettingsInfo) +{ + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(connectUuid); + if (nullptr == connectPtr) { + QString errorMessage = tr("it can not find connection") + connectUuid; + qWarning() << errorMessage; + Q_EMIT updateConnectionError(errorMessage); + return; + } + + NetworkManager::ConnectionSettings::Ptr connectSettingPtr = connectPtr->settings(); + + NetworkManager::Ipv4Setting::Ptr ipv4Setting = connectSettingPtr->setting(NetworkManager::Setting::Ipv4).dynamicCast(); + ipv4SettingSet(ipv4Setting, connectSettingsInfo); + + NetworkManager::Ipv6Setting::Ptr ipv6Setting = connectSettingPtr->setting(NetworkManager::Setting::Ipv6).dynamicCast(); + ipv6SettingSet(ipv6Setting, connectSettingsInfo); + + + NMVariantMapMap connectMapMap = connectSettingPtr->toMap(); + + if (connectMapMap.contains("ipv4")) { + QVariantMap ipv4SettingMap = connectMapMap.value(QLatin1String("ipv4")); + if (ipv4SettingMap.contains("method") && ipv4SettingMap["method"] == "auto") { + if (ipv4SettingMap.contains("address-data")) { + ipv4SettingMap.remove("address-data"); + } + if (ipv4SettingMap.contains("addresses")) { + ipv4SettingMap.remove("addresses"); + } + if (ipv4SettingMap.contains("gateway")) { + ipv4SettingMap.remove("gateway"); + } + } + connectMapMap["ipv4"] = ipv4SettingMap; + } + + if (connectMapMap.contains("ipv6")) { + QVariantMap ipv4SettingMap = connectMapMap.value(QLatin1String("ipv6")); + if (ipv4SettingMap.contains("method") && ipv4SettingMap["method"] == "auto") { + if (ipv4SettingMap.contains("address-data")) { + ipv4SettingMap.remove("address-data"); + } + if (ipv4SettingMap.contains("addresses")) { + ipv4SettingMap.remove("addresses"); + } + if (ipv4SettingMap.contains("gateway")) { + ipv4SettingMap.remove("gateway"); + } + } + + connectMapMap["ipv6"] = ipv4SettingMap; + } + + connectPtr->update(connectMapMap); +} + +void KyConnectOperation::deleteConnect(const QString &connectUuid) +{ + qDebug()<<"delete connect uuid " << connectUuid; + + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(connectUuid); + if (nullptr == connectPtr) { + QString errorMessage = tr("it can not find connection") + connectUuid; + qWarning()<remove(); + + return ; +} + +void KyConnectOperation::activateConnection(const QString connectUuid, const QString deviceName) +{ + QString connectPath = ""; + QString deviceIdentifier = ""; + QString connectName = ""; + QString specificObject = ""; + NetworkManager::Connection::Ptr connectPtr = nullptr; + + qDebug()<<"it will activate connect"<settings()->connectionType()) { + QString errorMessage = tr("the connect type is") + + connectPtr->settings()->connectionType() + + tr(", but it is not wired"); + qWarning()<path(); + connectName = connectPtr->name(); +// deviceName = connectPtr->settings()->interfaceName(); + +// for (auto const & dev : m_networkResourceInstance->m_devices) { +// for (auto const & dev_conn : dev->availableConnections()) { +// if (dev_conn == connectPtr) { +// deviceIdentifier = dev->uni(); +// deviceName = dev->interfaceName(); +// break; +// } +// } +// } + + auto dev = m_networkResourceInstance->findDeviceByName(deviceName); + if (!dev.isNull()) { + deviceIdentifier = dev->uni(); + } + + + if (deviceIdentifier.isEmpty()) { + QString errorMessage = tr("device Identifier is empty, its name") + deviceName; + qWarning() << errorMessage; + Q_EMIT activateConnectionError(errorMessage); + return; + } + + if (NetworkManager::ConnectionSettings::Wired == connectPtr->settings()->connectionType()) { + KyNetworkDeviceResourse deviceResource; + if (!deviceResource.wiredDeviceIsCarriered(deviceName)) { + qWarning() << deviceName << "is not carried, so can not activate connection"; + return; + } + } + + qDebug() <<"active wired connect: path "<< connectPath + << "device identify " << deviceIdentifier + << "connect name " << connectName + << "device name" << deviceName + << "specific parameter"<< specificObject; + + QDBusPendingCallWatcher * watcher; + watcher = new QDBusPendingCallWatcher{NetworkManager::activateConnection(connectPath, deviceIdentifier, specificObject), this}; + connect(watcher, &QDBusPendingCallWatcher::finished, [this, connectName, deviceName] (QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMessage = tr("activate connection failed: ") + watcher->error().message(); + qWarning()<activateConnectionError(errorMessage); + } else { + qWarning()<<"active wired connect complete."; + } + + watcher->deleteLater(); + }); +} + +void KyConnectOperation::deactivateConnection(const QString &activeConnectUuid) +{ + NetworkManager::ActiveConnection::Ptr activateConnectPtr = nullptr; + + + activateConnectPtr = m_networkResourceInstance->findActiveConnectByUuid(activeConnectUuid); + if (nullptr == activateConnectPtr) { + QString errorMessage = tr("it can not find the activate connect") + + tr("uuid") + activeConnectUuid; + qWarning()<path(); + QDBusPendingReply<> reply = NetworkManager::deactivateConnection(activateConnectPtr->path()); + QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); + connect(watcher, &QDBusPendingCallWatcher::finished, [this, activateConnectPtr] (QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMessage = tr("deactivation of connection") + + activateConnectPtr->connection()->name() + tr("failed:") + + watcher->error().message(); + + qWarning()<deactivateConnectionError(errorMessage); + } else { + qWarning() << "deactive connect operation finished" << activateConnectPtr->connection()->name(); + } + watcher->deleteLater(); + }); +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinconnectoperation.h b/libnm-kylin/libnm-base-kylin/depend/kylinconnectoperation.h new file mode 100644 index 00000000..1a253698 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinconnectoperation.h @@ -0,0 +1,40 @@ +#ifndef KYLINCONNECTOPERATION_H +#define KYLINCONNECTOPERATION_H + +#include "kylinnetworkresourcemanager.h" +#include "kylinconnectsetting.h" + +class KyConnectOperation : public QObject +{ + Q_OBJECT +public: + explicit KyConnectOperation(QObject *parent = nullptr); + ~KyConnectOperation(); + + void updateConnect(QString connectUuid, const KyConnectSetting &connectSettingsInfo); + void deleteConnect(const QString &connectUuid); + void activateConnection(const QString connectUuid, const QString deviceName); + void deactivateConnection(const QString &activeConnectUuid); + +protected: + void connectSettingSet(NetworkManager::ConnectionSettings::Ptr connectionSettings, + const KyConnectSetting &connectSettingsInfo); + void ipv4SettingSet(NetworkManager::Ipv4Setting::Ptr &ipv4Setting, + const KyConnectSetting &connectSettingsInfo); + void ipv6SettingSet(NetworkManager::Ipv6Setting::Ptr &ipv6Setting, + const KyConnectSetting &connectSettingsInfo); + void setAutoConnect(NetworkManager::ConnectionSettings::Ptr &connectSetting, bool bAutoConnect); + inline void errorProcess(QString errorMessage); + +Q_SIGNALS: + void createConnectionError(QString errorMessage); + void updateConnectionError(QString errorMessage); + void deleteConnectionError(QString errorMessage); + void activateConnectionError(QString errorMessage); + void deactivateConnectionError(QString errorMessage); + +protected: + KyNetworkResourceManager *m_networkResourceInstance = nullptr; +}; + +#endif // KYLINCONNECTOPERATION_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinconnectsetting.cpp b/libnm-kylin/libnm-base-kylin/depend/kylinconnectsetting.cpp new file mode 100644 index 00000000..88aeb57d --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinconnectsetting.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 + +KyConnectSetting::KyConnectSetting(/*QObject *parent) : QObject(parent*/) +{ + m_connectName = ""; + m_ifaceName = ""; + + m_ipv4ConfigIpType = CONFIG_IP_DHCP; + m_ipv4Address.clear(); + m_ipv4Dns.clear(); + + m_ipv6ConfigIpType = CONFIG_IP_DHCP; + m_ipv6Address.clear(); + m_ipv6Dns.clear(); + + m_isAutoConnect = true; +} + +KyConnectSetting::~KyConnectSetting() +{ + +} + +void KyConnectSetting::setIfaceName(QString &ifaceName) +{ + m_ifaceName = ifaceName; +} + +void KyConnectSetting::setConnectName(QString &connectName) +{ + m_connectName = connectName; +} + +int KyConnectSetting::setIpConfigType(KyIpAddressType ipType, KyIpConfigType ipConfigType) +{ + if (ipType != IPADDRESS_V4 && ipType != IPADDRESS_V6) { + qWarning()<<"set config ip type failed, the ip address type undefined"< +#include +//#include + +#include +#include +#include +#include +#include + +typedef enum { + CONFIG_IP_MANUAL, + CONFIG_IP_DHCP, +}KyIpConfigType; + +typedef enum { + IPADDRESS_V4, + IPADDRESS_V6, +}KyIpAddressType; + +class KyConnectSetting/* : public QObject*/ +{ +// Q_OBJECT +public: +/* explicit*/ KyConnectSetting(/*QObject *parent = nullptr*/); + ~KyConnectSetting(); + +public: + void setIfaceName(QString &ifaceName); + void setConnectName(QString &connectName); + int setIpConfigType(KyIpAddressType ipType, KyIpConfigType configType); + void ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay, QStringList &ipv4Dns); + void ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay, QStringList &ipv6Dns); + void dumpInfo(); + +public: + QString m_connectName; + QString m_ifaceName; + + KyIpConfigType m_ipv4ConfigIpType; + QList m_ipv4Address; + QList m_ipv4Dns; + + KyIpConfigType m_ipv6ConfigIpType; + QList m_ipv6Address; + QList m_ipv6Dns; + + bool m_isAutoConnect = true; +}; + +#endif // KYLINCONNECTSETTING_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylingeneral.cpp b/libnm-kylin/libnm-base-kylin/depend/kylingeneral.cpp new file mode 100644 index 00000000..71aeb45a --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylingeneral.cpp @@ -0,0 +1,144 @@ +#include "kylingeneral.h" +#include "kylinnetworkdeviceresource.h" +#include "kylinactiveconnectresource.h" + +const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch"; +const QString KEY_WIRED_SWITCH = "wiredswitch"; + +KylinGeneralOpration::KylinGeneralOpration(QObject *parent) : QObject(parent) +{ + m_networkResourceInstance = KyNetworkResourceManager::getInstance(); + + connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiEnabledChanged, + this, &KylinGeneralOpration::wifiEnabledChanged); + connect(m_networkResourceInstance, &KyNetworkResourceManager::networkingEnabledChanged, + this, &KylinGeneralOpration::networkingEnabledChanged); + connect(m_networkResourceInstance, &KyNetworkResourceManager::primaryConnectionTypeChanged, + this, &KylinGeneralOpration::updateConnectStatus); + connect(m_networkResourceInstance, &KyNetworkResourceManager::connectivityChanged, + this, &KylinGeneralOpration::updateConnectStatus); + + if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) { + gsettings = new QGSettings(GSETTINGS_SCHEMA); + if (gsettings->keys().contains(KEY_WIRED_SWITCH)) { + connect(gsettings, &QGSettings::changed, [&](QString key){ + if (key == KEY_WIRED_SWITCH) { + setWiredEnabled(gsettings->get(key).toBool()); + } + }); + } + } +} + +KylinGeneralOpration::~KylinGeneralOpration() +{ + m_networkResourceInstance = nullptr; + delete gsettings; + gsettings = nullptr; +} + +void KylinGeneralOpration::getConnectStatus(KyConnectStatus &status) +{ + updateConnectStatus(); + status = m_status; +} + +void KylinGeneralOpration::updateConnectStatus() +{ + KyConnectStatus status; + + KyConnectionType connectType; + KyActiveConnectResourse activeResource; + getPrimaryConnectionType(connectType); + if (activeResource.wiredConnectIsActived()) { + status = LAN_CONNECTED; + } else if (activeResource.wirelessConnectIsActived()) { + status = WLAN_CONNECTED; + } else { + status = NOT_CONNECTED; + } + + KyConnectivity connecttivity; + getConnectivity(connecttivity); + if (connecttivity != CONNECTIVITY_FULL) { + if (status == LAN_CONNECTED) { + status = LAN_CONNECTED_LIMITED; + } else if (status == WLAN_CONNECTED) { + status = WLAN_CONNECTED_LIMITED; + } + } + + if (status != m_status) { + m_status = status; + Q_EMIT connectStatusChanged(m_status); + } +} + +void KylinGeneralOpration::getConnectivity(KyConnectivity &connectivity) +{ + connectivity = (KyConnectivity)NetworkManager::connectivity(); +} + +void KylinGeneralOpration::getPrimaryConnectionType(KyConnectionType &connectType) +{ + connectType = (KyConnectionType)NetworkManager::primaryConnectionType(); +} + +bool KylinGeneralOpration::getWirelessEnabled() +{ + return NetworkManager::isWirelessEnabled(); +} + +void KylinGeneralOpration::setWirelessNetworkEnabled(bool enabled) +{ + NetworkManager::setWirelessEnabled(enabled); +} + +bool KylinGeneralOpration::getNetworkingEnabled() +{ + return NetworkManager::isNetworkingEnabled(); +} + +void KylinGeneralOpration::setNetworkingEnabled(bool enabled) +{ + NetworkManager::setNetworkingEnabled(enabled); +} + +void KylinGeneralOpration::setWiredEnabled(bool enabled) +{ + KyNetworkDeviceResourse devResource; + QStringList devList; + devResource.getNetworkDeviceList(DEVICE_TYPE_ETHERNET, devList); + + if (!enabled) { + for (int i = 0; i < devList.size(); ++i) { + devResource.closeWiredNetworkWithDevice(devList.at(i)); + } + } else { + QMap stateMap; + devResource.getWiredDeviceEnableState(stateMap); + for (int i = 0; i < devList.size(); ++i) { + if (stateMap.contains(devList.at(i)) + && !stateMap[devList.at(i)]) { + //do nothing + } else { + qDebug() << "openWiredNetworkWithDevice" << devList.at(i); + devResource.openWiredNetworkWithDevice(devList.at(i)); + } + } + } + updateGsetting(enabled); +} + +void KylinGeneralOpration::updateGsetting(bool enable) +{ + if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) { + QGSettings *gsettings = new QGSettings(GSETTINGS_SCHEMA); + if (gsettings->keys().contains(KEY_WIRED_SWITCH)) { + if (enable != gsettings->get(KEY_WIRED_SWITCH).toBool()) { + qDebug() << "updateGsetting set " << enable; + gsettings->set(KEY_WIRED_SWITCH, enable); + } + } + } +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kylingeneral.h b/libnm-kylin/libnm-base-kylin/depend/kylingeneral.h new file mode 100644 index 00000000..3486ab01 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylingeneral.h @@ -0,0 +1,47 @@ +#ifndef KYLINGENERAL_H +#define KYLINGENERAL_H + +#include +#include +#include "kylinnetworkresourcemanager.h" + +enum KyConnectStatus { + NOT_CONNECTED = 0, + LAN_CONNECTED, + WLAN_CONNECTED, + LAN_CONNECTED_LIMITED, + WLAN_CONNECTED_LIMITED, +}; + +class KylinGeneralOpration : public QObject +{ + Q_OBJECT +public: + explicit KylinGeneralOpration(QObject *parent = nullptr); + ~KylinGeneralOpration(); + void getConnectStatus(KyConnectStatus &status); + bool getWirelessEnabled(); + void setWirelessNetworkEnabled(bool enabled); + bool getNetworkingEnabled(); + void setNetworkingEnabled(bool enabled); + void setWiredEnabled(bool enabled); + +Q_SIGNALS: + void connectStatusChanged(KyConnectStatus); + void wifiEnabledChanged(bool); + void networkingEnabledChanged(bool); + +private Q_SLOTS: + void updateConnectStatus(); + +private: + KyNetworkResourceManager *m_networkResourceInstance = nullptr; + QGSettings *gsettings; + KyConnectStatus m_status = NOT_CONNECTED; + + void updateGsetting(bool); + void getConnectivity(KyConnectivity &connectivity); + void getPrimaryConnectionType(KyConnectionType &connectType); +}; + +#endif // KYLINGENERAL_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinnetresource.cpp b/libnm-kylin/libnm-base-kylin/depend/kylinnetresource.cpp new file mode 100644 index 00000000..1795fd5e --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinnetresource.cpp @@ -0,0 +1,143 @@ +#include "kylinnetresource.h" +#include "kylinnetworkdeviceresource.h" +#include "kylinactiveconnectresource.h" +#include "kywirelessnetresource.h" +#include "kylinnetworkmanagerutil.h" + +KyNetResource::KyNetResource(QObject *parent) : QObject(parent) +{ + m_networkResourceInstance = KyNetworkResourceManager::getInstance(); +} + +KyNetResource::~KyNetResource() { + m_networkResourceInstance = nullptr; +} + +void KyNetResource::getIpv4ConnectSetting( + NetworkManager::Ipv4Setting::Ptr &ipv4Setting, + KyConnectSetting &connectSetting) +{ + if (NetworkManager::Ipv4Setting::Automatic == ipv4Setting->method()) { + connectSetting.m_ipv4ConfigIpType = CONFIG_IP_DHCP; + return; + } + + connectSetting.m_ipv4ConfigIpType = CONFIG_IP_MANUAL; + + connectSetting.m_ipv4Address = ipv4Setting->addresses(); + connectSetting.m_ipv4Dns = ipv4Setting->dns(); +} + +void KyNetResource::getIpv6ConnectSetting( + NetworkManager::Ipv6Setting::Ptr &ipv6Setting, + KyConnectSetting &connectSetting) +{ + + if (NetworkManager::Ipv6Setting::Automatic == ipv6Setting->method()) { + connectSetting.m_ipv6ConfigIpType = CONFIG_IP_DHCP; + return; + } + + connectSetting.m_ipv6ConfigIpType = CONFIG_IP_MANUAL; + connectSetting.m_ipv6Address = ipv6Setting->addresses(); + connectSetting.m_ipv6Dns = ipv6Setting->dns(); +} + +void KyNetResource::getConnectionSetting(QString connectUuid, KyConnectSetting &connectSetting) +{ + NetworkManager::Connection::Ptr connectPtr = + m_networkResourceInstance->findConnectByUuid(connectUuid); + + if (nullptr == connectPtr + || !connectPtr->isValid()) { + qWarning() <<"[KyConnectResourse]" << "it can not find valid connection" << connectUuid; + return; + } + + connectSetting.m_connectName = connectPtr->name(); + + NetworkManager::ConnectionSettings::Ptr connectionSettings = connectPtr->settings(); + connectSetting.m_ifaceName = connectionSettings->interfaceName(); + connectSetting.m_isAutoConnect = connectionSettings->autoconnect(); + + NetworkManager::Ipv4Setting::Ptr ipv4Setting = connectionSettings->setting(NetworkManager::Setting::Ipv4).dynamicCast(); + getIpv4ConnectSetting(ipv4Setting, connectSetting); + + NetworkManager::Ipv6Setting::Ptr ipv6Setting = connectionSettings->setting(NetworkManager::Setting::Ipv6).dynamicCast(); + getIpv6ConnectSetting(ipv6Setting, connectSetting); +} + +void KyNetResource::getBaseInfo(QString devName,QString ssid, bool isWlan, bool isActive, KyDetailInfo &conInfo) +{ + //有线无线公有 + KyNetworkDeviceResourse devResource; + + QString hardAddress; + int bandWith; + devResource.getHardwareInfo(devName, hardAddress, bandWith); + + if (!hardAddress.isEmpty()) { + conInfo.strBandWidth = QString("%1").arg(bandWith/1000) + "Mbps"; + conInfo.strMac = hardAddress; + } + + if (isWlan) { + if (!isActive) { + NetworkManager::Device::Ptr devPtr = + KyNetworkResourceManager::getInstance()->findDeviceByName(devName); + if (devPtr.isNull()) { + return; + } + + NetworkManager::WirelessNetwork::Ptr netPtr = + KyNetworkResourceManager::getInstance()->findWifiNetwork(ssid, devPtr->uni()); + if (netPtr.isNull()) { + return; + } + + NetworkManager::AccessPoint::Ptr bestApPtr = netPtr->referenceAccessPoint(); + conInfo.strHz = QString::number(bestApPtr->frequency()) + "MHz"; + conInfo.strChan = QString::number(NetworkManager::findChannel(bestApPtr->frequency())); + NetworkManager::AccessPoint::Capabilities cap = bestApPtr->capabilities(); + NetworkManager::AccessPoint::WpaFlags wpaFlag = bestApPtr->wpaFlags(); + NetworkManager::AccessPoint::WpaFlags rsnFlag = bestApPtr->rsnFlags(); + conInfo.strSecType = enumToQstring(cap, wpaFlag, rsnFlag); + } else { + uint iHz,iChan; + QString strMac; + devResource.getDeviceActiveAPInfo(devName, strMac, iHz, iChan, conInfo.strSecType); + + conInfo.strHz = QString::number(iHz); + conInfo.strChan = QString::number(iChan); + } + + if (conInfo.strSecType.isEmpty()) { + conInfo.strSecType = tr("None"); + } + } +} + +//详情ipv4 ipv6 ipv4Dns +void KyNetResource::getDynamicIpInfo(QString uuid, KyDetailInfo &conInfo) +{ + //已激活的网络 详情页显示动态ipv4 ipv6 dns + QString ipv4,ipv6; + QList ipv4Dns,ipv6Dns; + KyActiveConnectResourse activeResourse; + activeResourse.getActiveConnectIpInfo(uuid,ipv4,ipv6); + activeResourse.getActiveConnectDnsInfo(uuid,ipv4Dns,ipv6Dns); + + //Ipv6 + if (!ipv6.isEmpty()) { + conInfo.strDynamicIpv6 = ipv6; + } + + //IPv4 + if (!ipv4.isEmpty()) { + conInfo.strDynamicIpv4 = ipv4; + } + + if (!ipv4Dns.isEmpty()) { + conInfo.strDynamicIpv4Dns = ipv4Dns.at(0).toString(); + } +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinnetresource.h b/libnm-kylin/libnm-base-kylin/depend/kylinnetresource.h new file mode 100644 index 00000000..ea77bf45 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinnetresource.h @@ -0,0 +1,45 @@ +#ifndef KYNETRESOURCE_H +#define KYNETRESOURCE_H + +#include "kylinnetworkresourcemanager.h" +#include "kylinconnectsetting.h" +#include +#include + +class KyDetailInfo +{ +public: + QString strSecType; + QString strChan; + QString strMac; + QString strHz; + QString strBandWidth; + QString strDynamicIpv4; + QString strDynamicIpv6; + QString strDynamicIpv4Dns; + bool isAutoConnect = false; +}; + +class KyNetResource : public QObject +{ + Q_OBJECT +public: + explicit KyNetResource(QObject *parent = nullptr); + ~KyNetResource(); + + void getConnectionSetting(QString connectUuid, KyConnectSetting &connectSetting); + +protected: + KyNetworkResourceManager *m_networkResourceInstance = nullptr; + + void getBaseInfo(QString devName,QString ssid, bool isWlan, bool isActive, KyDetailInfo &conInfo); + void getDynamicIpInfo(QString uuid, KyDetailInfo &conInfo); + +private: + void getIpv4ConnectSetting(NetworkManager::Ipv4Setting::Ptr &ipv4Setting, + KyConnectSetting &connectSetting); + void getIpv6ConnectSetting(NetworkManager::Ipv6Setting::Ptr &ipv6Setting, + KyConnectSetting &connectSetting); +}; + +#endif // KYNETRESOURCE_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinnetworkdeviceresource.cpp b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkdeviceresource.cpp new file mode 100644 index 00000000..d4d8c4e2 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkdeviceresource.cpp @@ -0,0 +1,327 @@ + +#include "kylinnetworkdeviceresource.h" +#include "kylinnetworkmanagerutil.h" +#include "kylinconnectoperation.h" + +#define VIRTURAL_DEVICE_PATH "/sys/devices/virtual/net" +#define LOG_FLAG "KyNetworkDeviceResourse" + +KyNetworkDeviceResourse::KyNetworkDeviceResourse(QObject *parent) : QObject(parent) +{ + m_networkResourceInstance = KyNetworkResourceManager::getInstance(); + + connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceCarrierChange, + this, &KyNetworkDeviceResourse::carrierChange); + connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceStateChange, + this, &KyNetworkDeviceResourse::deviceStateChange); +// connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceBitRateChange, +// this, &KyNetworkDeviceResourse::deviceBitRateChange); +// connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceMacAddressChange, +// this, &KyNetworkDeviceResourse::deviceMacAddressChange); +// connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceActiveChange, +// this, &KyNetworkDeviceResourse::deviceActiveChange); + +} + +KyNetworkDeviceResourse::~KyNetworkDeviceResourse() +{ + m_networkResourceInstance = nullptr; +} + +void KyNetworkDeviceResourse::getNetworkDeviceList( + KyDeviceType deviceType, + QStringList &networkDeviceList) +{ + NetworkManager::Device::List deviceList + = m_networkResourceInstance->getNetworkDeviceList(); + + if (deviceList.isEmpty()) { + qDebug() << LOG_FLAG <<"network device is not exist. device type" << deviceType; + return; + } + + NetworkManager::Device::Ptr devicePtr = nullptr; + for (int index = 0; index < deviceList.size(); ++index) { + devicePtr = deviceList.at(index); + if (devicePtr.isNull()) { + continue; + } + + if (devicePtr->type() == deviceType) { + if (DEVICE_TYPE_ETHERNET == deviceType) { + //为了区分有线网卡和虚拟网卡 + qDebug()<< LOG_FLAG << "device uni" << devicePtr->udi(); + if (devicePtr->udi().startsWith(VIRTURAL_DEVICE_PATH)) { + continue; + } + } + + networkDeviceList<interfaceName(); + } + } + + return; +} + +void KyNetworkDeviceResourse::getHardwareInfo(QString ifaceName, QString &hardAddress, int &bandWith) +{ + NetworkManager::Device::Ptr connectDevice = + m_networkResourceInstance->findDeviceByName(ifaceName); + + if (nullptr == connectDevice || !connectDevice->isValid()) { + qWarning()<< LOG_FLAG <<"get hardware info failed, the device" << ifaceName << "is not existed"; + hardAddress.clear(); + bandWith = 0; + return; + } + + switch (connectDevice->type()) { + case NetworkManager::Device::Ethernet: + { + NetworkManager::WiredDevice *wiredDevicePtr = + qobject_cast(connectDevice.data()); + hardAddress = wiredDevicePtr->hardwareAddress(); + bandWith = wiredDevicePtr->bitRate(); + break; + } + case NetworkManager::Device::Wifi: + { + NetworkManager::WirelessDevice *wirelessDevicePtr = + qobject_cast(connectDevice.data()); + hardAddress = wirelessDevicePtr->hardwareAddress(); + bandWith = wirelessDevicePtr->bitRate(); + break; + } + default: + { + hardAddress = ""; + bandWith = 0; + qWarning()<< LOG_FLAG << "the network device type is undefined" << connectDevice->type(); + break; + } + } +} + + +void KyNetworkDeviceResourse::setWiredDeviceEnable(const QString& devName, bool enable) +{ + saveDeviceEnableState(devName, enable); + + KyNetworkDeviceResourse deviceResource; + if (enable) { + deviceResource.openWiredNetworkWithDevice(devName); + } else { + deviceResource.closeWiredNetworkWithDevice(devName); + } + Q_EMIT wiredDeviceEnableChange(devName, enable); +} + +void KyNetworkDeviceResourse::getWiredDeviceEnableState(QMap &map) +{ + getDeviceEnableState(map); +} + +//用于有线开关回连处理 关闭调用 +void KyNetworkDeviceResourse::saveActiveConnection(QString &deviceName, QString &connectUuid) +{ + QSettings *p_settings = new QSettings(WIRED_NETWORK_STATE_CONF_FILE, QSettings::IniFormat); + + QString settingValue = p_settings->value(deviceName).toString(); + if (settingValue.isEmpty()) { + p_settings->setValue(deviceName, connectUuid); + p_settings->sync(); + } + + delete p_settings; + p_settings = nullptr; + + return; +} + +//用于有线开关回连处理 开启调用 +void KyNetworkDeviceResourse::getActiveConnection(QString &deviceName, QString &connectUuid) +{ + QSettings *p_settings = new QSettings(WIRED_NETWORK_STATE_CONF_FILE, QSettings::IniFormat); + + connectUuid = p_settings->value(deviceName).toString(); + p_settings->remove(deviceName); + + delete p_settings; + p_settings = nullptr; + + return; +} + +//用于有线开关回连处理 关闭调用 +int KyNetworkDeviceResourse::closeWiredNetworkWithDevice(QString deviceName) +{ + NetworkManager::Device::Ptr wiredDevicePtr = + m_networkResourceInstance->findDeviceByName(deviceName); + + if (wiredDevicePtr.isNull()) { + qWarning()<<"[KyWiredConnectOperation]"<<"the network device" << deviceName <<"is not exist."; + return -ENXIO; + } + + if (NetworkManager::Device::Type::Ethernet != wiredDevicePtr->type()) { + qWarning()<<"[KyWiredConnectOperation]"<<"the device type" + << wiredDevicePtr->type() <<"is not Ethernet."; + return -EINVAL; + } + + NetworkManager::ActiveConnection::Ptr activeConnectPtr = wiredDevicePtr->activeConnection(); + if (nullptr != activeConnectPtr) { + QString activeConnectUuid = activeConnectPtr->uuid(); + if (!activeConnectUuid.isEmpty()) { + qDebug()<<"[KyWiredConnectOperation]" <<"close wired network save connection uuid" + << activeConnectUuid <<"device name " << deviceName; + saveActiveConnection(deviceName, activeConnectUuid); + } + } + + wiredDevicePtr->disconnectInterface(); + + return 0; +} + +//用于有线开关回连处理 开启调用 +int KyNetworkDeviceResourse::openWiredNetworkWithDevice(QString deviceName) +{ + NetworkManager::Device::Ptr wiredDevicePtr = + m_networkResourceInstance->findDeviceByName(deviceName); + + if (wiredDevicePtr.isNull() || !wiredDevicePtr->isValid()) { + qWarning()<<"[KyWiredConnectOperation]"<<"the network device" << deviceName <<"is not exist."; + return -ENXIO; + } + + if (NetworkManager::Device::Type::Ethernet != wiredDevicePtr->type()) { + qWarning()<<"[KyWiredConnectOperation]"<<"the device type" + << wiredDevicePtr->type() <<"is not Ethernet."; + return -EINVAL; + } + + NetworkManager::WiredDevice *p_wiredDevice = + qobject_cast(wiredDevicePtr.data()); + + if (p_wiredDevice->carrier()) { + QString connectUuid; + getActiveConnection(deviceName, connectUuid); + if (!connectUuid.isEmpty()) { + KyConnectOperation operate; + operate.activateConnection(connectUuid, deviceName); + } + } + + return 0; +} + + +KyDeviceState KyNetworkDeviceResourse::getDeviceState(QString deviceName) +{ + NetworkManager::Device::Ptr connectDevice = + m_networkResourceInstance->findDeviceByName(deviceName); + if (!connectDevice.isNull() && connectDevice->isValid()) { + return (KyDeviceState)connectDevice->state(); + } + + qWarning()<< LOG_FLAG <<"get device state failed, the device is " << deviceName; + + return DEVICE_STATE_UNKNOWN; +} + +bool KyNetworkDeviceResourse::wiredDeviceIsCarriered(QString deviceName) +{ + NetworkManager::Device::Ptr connectDevice = + m_networkResourceInstance->findDeviceByName(deviceName); + if (connectDevice.isNull()) { + qWarning()<< LOG_FLAG << "check device carriered failed."; + return false; + } + + if (connectDevice->isValid() + && NetworkManager::Device::Type::Ethernet == connectDevice->type()) { + NetworkManager::WiredDevice *wiredDevicePtr = + qobject_cast(connectDevice.data()); + return wiredDevicePtr->carrier(); + } + + qWarning()<< LOG_FLAG << deviceName <<" can not get carrier state."; + + return false; +} + +void KyNetworkDeviceResourse::getDeviceActiveAPInfo(const QString devName, QString &strMac, uint &iHz, uint &iChan, QString &secuType) +{ + strMac.clear(); + iHz = 0; + iChan = 0; + secuType.clear(); + + NetworkManager::Device::Ptr connectDevice = + m_networkResourceInstance->findDeviceByName(devName); + + if (nullptr == connectDevice || !connectDevice->isValid()) { + qWarning()<< LOG_FLAG <<"getDeviceActiveAPInfo failed, the device" << devName << "is not existed"; + return; + } + + switch (connectDevice->type()) { + case NetworkManager::Device::Wifi: + { + NetworkManager::WirelessDevice *wirelessDevicePtr = + qobject_cast(connectDevice.data()); + NetworkManager::AccessPoint::Ptr apPtr = wirelessDevicePtr->activeAccessPoint(); + if (apPtr.isNull()) { + break; + } + strMac = apPtr->hardwareAddress(); + iHz = apPtr->frequency(); + iChan = NetworkManager::findChannel(iHz); + NetworkManager::AccessPoint::Capabilities capability = apPtr->capabilities(); + NetworkManager::AccessPoint::WpaFlags wpaFlag = apPtr->wpaFlags(); + NetworkManager::AccessPoint::WpaFlags rsnFlag = apPtr->rsnFlags(); + secuType = enumToQstring(capability, wpaFlag, rsnFlag); + break; + } + case NetworkManager::Device::Ethernet: + break; + default: + break; + } +} + +int KyNetworkDeviceResourse::getWirelessDeviceCapability(const QString deviceName) +{ + NetworkManager::Device::Ptr connectDevice = + m_networkResourceInstance->findDeviceByName(deviceName); + if (connectDevice->isValid() + && NetworkManager::Device::Type::Wifi == connectDevice->type()) { + NetworkManager::WirelessDevice *wirelessDevicePtr = + qobject_cast(connectDevice.data()); + + int cap = 0; + if (wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::ApCap) { + cap = cap | 0x01; + } + if (wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::Freq2Ghz) { + cap = cap | 0x02; + } + if (wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::Freq5Ghz) { + cap = cap | 0x04; + } + return cap; + } else { + qWarning()<<"[KyNetworkDeviceResourse]"< +#include "kylinnetworkresourcemanager.h" +#include "kylinconnectitem.h" +#include "kylinwiredconnectoperation.h" + +//设备操作和信息获取 +class KyNetworkDeviceResourse : public QObject +{ + Q_OBJECT +public: + explicit KyNetworkDeviceResourse(QObject *parent = nullptr); + ~KyNetworkDeviceResourse(); + +public: + void getNetworkDeviceList(KyDeviceType deviceType, QStringList &networkDeviceList); + void getHardwareInfo(QString ifaceName, QString &hardAddress, int &bandWith); + + //移动热点有关 + void getDeviceActiveAPInfo(const QString devName, QString &strMac, uint &iHz, uint &iChan, QString &secuType); + int getWirelessDeviceCapability(const QString deviceName); + + KyDeviceState getDeviceState(QString deviceName); + + bool wiredDeviceIsCarriered(QString deviceName); + bool wirelessDeviceIsExist(const QString devName); + + //设置单个有线设备开关 + void setWiredDeviceEnable(const QString& devName, bool enable); + void getWiredDeviceEnableState(QMap &map); + + int closeWiredNetworkWithDevice(QString deviceName); + int openWiredNetworkWithDevice(QString deviceName); + +private: + void getActiveConnection(QString &deviceName, QString &connectUuid); + void saveActiveConnection(QString &deviceName, QString &connectUuid); + +Q_SIGNALS: + void deviceStateChange(QString deviceName, KyDeviceState newstate, KyDeviceState oldstate, + NetworkManager::Device::StateChangeReason reason); + void carrierChange(QString deviceName, bool pluged); + + void wiredDeviceEnableChange(QString, bool); + +// void deviceBitRateChanage(QString deviceName, int bitRate); +// void deviceMacAddressChanage(QString deviceName, const QString &hwAddress); +// void deviceActiveChanage(QString deviceName, bool deivceActive); + +private: + KyNetworkResourceManager *m_networkResourceInstance = nullptr; +}; +#endif // KYLINNETORKDEVICERESOURCE_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinnetworkmanagerutil.cpp b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkmanagerutil.cpp new file mode 100644 index 00000000..5f0a9e70 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkmanagerutil.cpp @@ -0,0 +1,138 @@ +#include "kylinnetworkmanagerutil.h" +#include +#include +#include +#include "kylinnetworkdeviceresource.h" +#define LOG_FLAG "[kylin-util]" +const QString CONFIG_FILE_PATH = QDir::homePath() + "/.config/ukui/kylin-nm.conf"; + +QString getConnectTypeByDbus(QString &connectPath) +{ + QString connectType = ""; + + if (connectPath.isEmpty()) { + qWarning() << LOG_FLAG << "connect path is empty, so can not get connect type"; + return connectType; + } + + QDBusInterface dbusInterface("org.freedesktop.NetworkManager", + connectPath, + "org.freedesktop.NetworkManager.Settings.Connection", + QDBusConnection::systemBus()); + + QDBusMessage result = dbusInterface.call("GetSettings"); + const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); + QMap> map; + dbusArg1st >> map; + + if (map.isEmpty()) { + qWarning() << LOG_FLAG <<"get connection settings failed."; + return connectType; + } + + QMap connectMap = map.value(KEY_CONNECTION); + if (connectMap.isEmpty()) { + qWarning() << LOG_FLAG <<"threre is not connection settings"; + return connectType; + } + + connectType = connectMap.value(KEY_CONNECT_TYPE).toString(); + return connectType; +} + +QString getSsidFromByteArray(QByteArray &rawSsid) +{ + QString wifiSsid = ""; + + if (rawSsid.isEmpty()) { + qWarning() << LOG_FLAG << "wifi raw ssid is empty"; + return wifiSsid; + } + + QTextCodec::ConverterState state; + QTextCodec *codec = QTextCodec::codecForName("UTF-8"); + codec->toUnicode( rawSsid.constData(), rawSsid.size(), &state); + if (state.invalidChars > 0) { + wifiSsid = QTextCodec::codecForName("GBK")->toUnicode(rawSsid); + } else { + wifiSsid = rawSsid; + } + + return wifiSsid; +} + +QString enumToQstring(NetworkManager::AccessPoint::Capabilities apCapability, + NetworkManager::AccessPoint::WpaFlags wpaFlags, + NetworkManager::AccessPoint::WpaFlags rsnFlags) +{ + QString out; + + if ((apCapability & AP_CAPABILITY_PRIVACY) + && (wpaFlags == AP_SECURITY_NONE) + && (rsnFlags == AP_SECURITY_NONE)) { + out += "WEP "; + } + + if (wpaFlags != AP_SECURITY_NONE) { + out += "WPA1 "; + } + + if ((rsnFlags & AP_SECURITY_KEY_MGMT_PSK) + || (rsnFlags & AP_SECURITY_KEY_MGMT_802_1X)) { + out += "WPA2 "; + } + + if (rsnFlags & AP_SECURITY_KEY_MGMT_SAE) { + out += "WPA3 "; + } + + if ((wpaFlags & AP_SECURITY_KEY_MGMT_802_1X) + || (rsnFlags & AP_SECURITY_KEY_MGMT_802_1X)) { + out += "802.1X "; + } + + return out; +} + +void saveDeviceEnableState(QString deviceName, bool enable) +{ + QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat); + m_settings->beginGroup("CARDEABLE"); + m_settings->setValue(deviceName, enable); + m_settings->endGroup(); + m_settings->sync(); + delete m_settings; + m_settings = nullptr; +} + +void getDeviceEnableState(QMap &map) +{ + map.clear(); + if (!QFile::exists(CONFIG_FILE_PATH)) { + qDebug() << "CONFIG_FILE_PATH not exist"; + return; + } + + KyNetworkDeviceResourse kdr; + QStringList wiredDevList; + wiredDevList.clear(); + + QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat); + m_settings->beginGroup("CARDEABLE"); + + kdr.getNetworkDeviceList(DEVICE_TYPE_ETHERNET, wiredDevList); + if (!wiredDevList.isEmpty()) { + for (int i = 0; i < wiredDevList.size(); ++i) { + if (!m_settings->contains(wiredDevList.at(i))) { + saveDeviceEnableState(wiredDevList.at(i),true); + } + bool enable = m_settings->value(wiredDevList.at(i), true).toBool(); + map.insert(wiredDevList.at(i), enable); + } + } + + m_settings->endGroup(); + delete m_settings; + m_settings = nullptr; +} + diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinnetworkmanagerutil.h b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkmanagerutil.h new file mode 100644 index 00000000..8a7445c8 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkmanagerutil.h @@ -0,0 +1,29 @@ +#ifndef KYLINUTIL_H +#define KYLINUTIL_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "kylinnetworkresourcetype.h" +#include "kywirelessconnectoperation.h" + +#define KEY_CONNECTION "connection" +#define KEY_CONNECT_TYPE "type" +#define ETHERNET_TYPE "802-3-ethernet" + +QString getConnectTypeByDbus(QString &connectPath); +QString getSsidFromByteArray(QByteArray &rawSsid); +QString enumToQstring(NetworkManager::AccessPoint::Capabilities cap, NetworkManager::AccessPoint::WpaFlags wpa_flags,NetworkManager::AccessPoint::WpaFlags rsn_flags); + + +void saveDeviceEnableState(QString deviceName, bool enable); +void getDeviceEnableState(QMap &map); + +#endif // KYLINUTIL_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.cpp b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.cpp new file mode 100644 index 00000000..fda544d9 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.cpp @@ -0,0 +1,1084 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 +#include "kylinnetworkmanagerutil.h" +#include +#include + +#define SIGNAL_DELAY 80000 +#define EMIT_DELAY 10000 + +#define LOG_FLAG "[KyNetworkResourceManager]" + +//单例部分 +KyNetworkResourceManager* KyNetworkResourceManager::m_pInstance = nullptr; + +KyNetworkResourceManager* KyNetworkResourceManager::getInstance() +{ + if (m_pInstance == NULL) { + m_pInstance = new KyNetworkResourceManager(); + } + + return m_pInstance; +} + +void KyNetworkResourceManager::Release() +{ + if (m_pInstance != NULL) { + delete m_pInstance; + m_pInstance = NULL; + } +} + +KyNetworkResourceManager::KyNetworkResourceManager(QObject *parent) : QObject(parent) +{ + //线程 信号槽 类型声明 + qRegisterMetaType("KyConnectState"); + qRegisterMetaType("KyConnectivity"); + qRegisterMetaType("KyDeviceType"); +} + +//start后执行 循环检查m_initFinished 非true阻塞 +void KyNetworkResourceManager::onInitNetwork() +{ + insertActiveConnections(); + insertConnections(); + insertDevices(); + insertWifiNetworks(); + + //设备 + connect(NetworkManager::notifier(), &NetworkManager::Notifier::deviceAdded, + this, &KyNetworkResourceManager::onDeviceAdded); + connect(NetworkManager::notifier(), &NetworkManager::Notifier::deviceRemoved, + this, &KyNetworkResourceManager::onDeviceRemoved); + + //已连接 + connect(NetworkManager::notifier(), &NetworkManager::Notifier::activeConnectionAdded, + this, &KyNetworkResourceManager::onActiveConnectionAdded); + connect(NetworkManager::notifier(), &NetworkManager::Notifier::activeConnectionRemoved, + this, &KyNetworkResourceManager::onActiveConnectionRemoved); + + //Connection + connect(NetworkManager::settingsNotifier(), &NetworkManager::SettingsNotifier::connectionAdded, + this, &KyNetworkResourceManager::onConnectionAdded); + connect(NetworkManager::settingsNotifier(), &NetworkManager::SettingsNotifier::connectionRemoved, + this, static_cast(&KyNetworkResourceManager::onConnectionRemoved)); + + //通用能力 + connect(NetworkManager::notifier(), &NetworkManager::Notifier::connectivityChanged, + this, &KyNetworkResourceManager::onConnectivityChanged); + connect(NetworkManager::notifier(), &NetworkManager::Notifier::networkingEnabledChanged, + this, &KyNetworkResourceManager::networkingEnabledChanged); + connect(NetworkManager::notifier(), &NetworkManager::Notifier::wirelessEnabledChanged, + this, &KyNetworkResourceManager::wifiEnabledChanged); + connect(NetworkManager::notifier(), &NetworkManager::Notifier::primaryConnectionTypeChanged, + this, &KyNetworkResourceManager::onPrimaryConnectionTypeChanged); + + // Note: the connectionRemoved is never emitted in case network-manager service stop, + // we need remove the connections manually. + //NetworkManager服务 + connect(NetworkManager::notifier(), &NetworkManager::Notifier::serviceDisappeared, + this, &KyNetworkResourceManager::clearConnections); + connect(NetworkManager::notifier(), &NetworkManager::Notifier::serviceDisappeared, + this, &KyNetworkResourceManager::clearWifiNetworks); + + QDBusConnection::systemBus().connect(QString("org.freedesktop.DBus"), + QString("/org/freedesktop/DBus"), + QString("org.freedesktop.DBus"), + QString("NameOwnerChanged"), this, SLOT(onServiceAppear(QString,QString,QString))); + + m_initFinished = true; +} + +bool KyNetworkResourceManager::NetworkManagerIsInited() +{ + return m_initFinished; +} + +KyNetworkResourceManager::~KyNetworkResourceManager() +{ + +} + +//服务重启后 没有add信号 需要重新初始化wifi +void KyNetworkResourceManager::onServiceAppear(QString interface, QString oldOwner, QString newOwner) +{ + if (interface == "org.freedesktop.NetworkManager" + && oldOwner.isEmpty() && !newOwner.isEmpty()) { + qDebug() << LOG_FLAG << "org.freedesktop.NetworkManager start"; + QTimer::singleShot(500,this,&KyNetworkResourceManager::insertWifiNetworks); + } +} + +//m_activeConnectList 删除 +void KyNetworkResourceManager::removeActiveConnection(int pos) +{ + //active connections signals + NetworkManager::ActiveConnection::Ptr connectPtr = m_activeConnectList.takeAt(pos); + connectPtr->disconnect(this); +} + +//m_activeConnectList 清空 +void KyNetworkResourceManager::clearActiveConnections() +{ + while (0 < m_activeConnectList.size()) { + removeActiveConnection(0); + } +} + +//m_activeConnectList 增加 +void KyNetworkResourceManager::addActiveConnection(NetworkManager::ActiveConnection::Ptr conn) +{ + m_activeConnectList.push_back(conn); + + connect(conn.data(), &NetworkManager::ActiveConnection::stateChanged, this, &KyNetworkResourceManager::onActiveConnectionChanged); + +// if (conn->vpn()) { +// connect(qobject_cast(conn.data()), &NetworkManager::VpnConnection::bannerChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated); +// connect(qobject_cast(conn.data()), &NetworkManager::VpnConnection::stateChanged, this, &KyNetworkResourceManager::onVpnActiveConnectChangedReason); +// } +} + +//初始化m_activeConnectList +void KyNetworkResourceManager::insertActiveConnections() +{ + for (auto const & conn : NetworkManager::activeConnections()) { + if (conn.isNull()) { + continue; + } + addActiveConnection(conn); + } +} + +//m_connectList 删除 +void KyNetworkResourceManager::removeConnection(int pos) +{ + NetworkManager::Connection::Ptr conn = m_connectList.takeAt(pos); + conn->disconnect(this); +} + +//m_connectList 清空 +void KyNetworkResourceManager::clearConnections() +{ + while (0 < m_connectList.size()) { + removeConnection(0); + } +} + +//m_connectList 增加 +void KyNetworkResourceManager::addConnection(NetworkManager::Connection::Ptr connectPtr) +{ + m_connectList.push_back(connectPtr); + + connect(connectPtr.data(), &NetworkManager::Connection::updated, this, &KyNetworkResourceManager::onConnectionUpdated); +// connect(connectPtr.data(), &NetworkManager::Connection::removed, this, &KyNetworkResourceManager::onConnectionRemoved); +} + +//m_connectList 初始化 +void KyNetworkResourceManager::insertConnections() +{ + for (auto const & connectPtr : NetworkManager::listConnections()) { + if (connectPtr.isNull()) { + continue; + } + + if (connectPtr->name().isEmpty() || connectPtr->uuid().isEmpty()) { + qWarning() << LOG_FLAG << " the name of connection is empty."; + continue; + } + + addConnection(connectPtr); + } +} + +//m_deviceList 删除 +void KyNetworkResourceManager::removeDevice(int pos) +{ + //connections signals + NetworkManager::Device::Ptr devicePtr = m_deviceList.takeAt(pos); + devicePtr->disconnect(this); + + m_deviceMap.remove(devicePtr->uni()); + Q_EMIT deviceRemove(devicePtr->interfaceName()); +} + +//m_deviceList 清空 +void KyNetworkResourceManager::clearDevices() +{ + while (0 < m_deviceList.size()) + removeDevice(0); +} + +//m_deviceList 增加 +void KyNetworkResourceManager::addDevice(NetworkManager::Device::Ptr device) +{ + m_deviceList.push_back(device); + m_deviceMap.insert(device->uni(), device->interfaceName()); + + connect(device.data(), &NetworkManager::Device::activeConnectionChanged, this, &KyNetworkResourceManager::onDeviceActiveChange); + connect(device.data(), &NetworkManager::Device::interfaceNameChanged, this, &KyNetworkResourceManager::onDeviceUpdated); + + switch (device->type()) + { + case NetworkManager::Device::Ethernet: + connect(qobject_cast(device.data()), &NetworkManager::WiredDevice::bitRateChanged, + this, &KyNetworkResourceManager::onDeviceBitRateChange); + connect(qobject_cast(device.data()), &NetworkManager::WiredDevice::carrierChanged, + this, &KyNetworkResourceManager::onDeviceCarrierChange); + connect(qobject_cast(device.data()), + &NetworkManager::WiredDevice::hardwareAddressChanged, this, &KyNetworkResourceManager::onDeviceMacAddressChange); + break; + + case NetworkManager::Device::Wifi: + connect(qobject_cast(device.data()), + &NetworkManager::WirelessDevice::networkAppeared, this, &KyNetworkResourceManager::onWifiNetworkAppeared); + connect(qobject_cast(device.data()), + &NetworkManager::WirelessDevice::networkDisappeared, this, &KyNetworkResourceManager::onWifiNetworkDisappeared); + break; + + default: + //TODO: other device types! + break; + } +} + +//m_deviceList 初始化 +void KyNetworkResourceManager::insertDevices() +{ + for (auto const & device : NetworkManager::networkInterfaces()) { + if (device.isNull()) { + continue; + } + addDevice(device); + } +} + +//m_wifiNetList 删除 +void KyNetworkResourceManager::removeWifiNetwork(int pos) +{ + //network signals + NetworkManager::WirelessNetwork::Ptr net = m_wifiNetList.takeAt(pos); + net->disconnect(this); +} + +//m_wifiNetList 清空 +void KyNetworkResourceManager::clearWifiNetworks() +{ + while (0 < m_wifiNetList.size()) + removeWifiNetwork(0); +} + +//m_wifiNetList 增加 +void KyNetworkResourceManager::addWifiNetwork(NetworkManager::WirelessNetwork::Ptr net) +{ + m_wifiNetList.push_back(net); + + connect(net.data(), &NetworkManager::WirelessNetwork::signalStrengthChanged, this, &KyNetworkResourceManager::onUpdateWirelessNet); + connect(net.data(), &NetworkManager::WirelessNetwork::referenceAccessPointChanged, this, &KyNetworkResourceManager::onUpdateWirelessNet); + connect(net.data(), &NetworkManager::WirelessNetwork::disappeared, this, &KyNetworkResourceManager::onUpdateWirelessNet); +} + +//m_wifiNetList 初始化 +void KyNetworkResourceManager::insertWifiNetworks() +{ + for (auto const & device : m_deviceList) { + if (device.isNull()) { + continue; + } + + if (NetworkManager::Device::Wifi == device->type()) { + NetworkManager::WirelessDevice::Ptr w_dev = device.objectCast(); + for (auto const & net : w_dev->networks()) { + if (!net.isNull()) { + addWifiNetwork(net); + Q_EMIT wifiNetworkAdded(device->interfaceName(),net->ssid()); + } + } + } + } +} + +//get +NetworkManager::ActiveConnection::List KyNetworkResourceManager::getActiveConnectList() +{ + return m_activeConnectList; +} + +NetworkManager::Connection::List KyNetworkResourceManager::getConnectList() +{ + return m_connectList; +} + +NetworkManager::Device::List KyNetworkResourceManager::getNetworkDeviceList() +{ + return m_deviceList; +} + +NetworkManager::WirelessNetwork::List KyNetworkResourceManager::getWifiNetworkList() +{ + return m_wifiNetList; +} + +//查找类接口===================================================================================================== +NetworkManager::ActiveConnection::Ptr KyNetworkResourceManager::findActiveConnectionByPath(QString const & path) +{ + NetworkManager::ActiveConnection::Ptr activeConnectPtr = nullptr; + + if (path.isEmpty()) { + return nullptr; + } + + if (m_activeConnectList.isEmpty()) { + return nullptr; + } + + for (int index = 0; index < m_activeConnectList.size(); ++index) { + activeConnectPtr = m_activeConnectList.at(index); + if (activeConnectPtr.isNull()) { + continue; + } + + if (activeConnectPtr->path() == path) { + return activeConnectPtr; + } + } + + return nullptr; +} + +NetworkManager::Device::Ptr KyNetworkResourceManager::findDeviceByUni(QString const & deviceUni) +{ + NetworkManager::Device::Ptr devicePtr = nullptr; + + if (deviceUni.isEmpty()) { + return nullptr; + } + + for (int index = 0; index < m_deviceList.size(); ++index) { + devicePtr = m_deviceList.at(index); + if (devicePtr.isNull()) { + continue; + } + + if (devicePtr->uni() == deviceUni) { + return devicePtr; + } + } + + return nullptr; +} + +NetworkManager::Device::Ptr KyNetworkResourceManager::findDeviceByName(QString const &interfaceName) +{ + NetworkManager::Device::Ptr devicePtr = nullptr; + + if (interfaceName.isEmpty()) { + return nullptr; + } + + for (int index = 0; index < m_deviceList.size(); ++index) { + devicePtr = m_deviceList.at(index); + if (devicePtr.isNull()) { + continue; + } + + if (devicePtr->interfaceName() == interfaceName) { + return devicePtr; + } + } + + return nullptr; +} + +NetworkManager::WirelessNetwork::Ptr KyNetworkResourceManager::findWifiNetwork(QString const & ssid, QString const & deviceUni) +{ + NetworkManager::WirelessNetwork::Ptr wifiNetPtr = nullptr; + + if (ssid.isEmpty() || deviceUni.isEmpty()) { + return nullptr; + } + + if (m_wifiNetList.isEmpty()) { + return nullptr; + } + + for (int index = 0; index < m_wifiNetList.size(); ++index) { + wifiNetPtr = m_wifiNetList.at(index); + if (wifiNetPtr.isNull()) { + continue; + } + + if (wifiNetPtr->ssid() == ssid && wifiNetPtr->device() == deviceUni) { + return wifiNetPtr; + } + } + + return nullptr; +} + +NetworkManager::ActiveConnection::Ptr KyNetworkResourceManager::findActiveConnectByUuid(const QString activeConnectUuid) +{ + int index = 0; + NetworkManager::ActiveConnection::Ptr activateConnectPtr = nullptr; + + qDebug()<<"[KyNetworkResourceManager]"<<"get activetate connect with uuid"<< activeConnectUuid; + if (activeConnectUuid.isEmpty()) { + return nullptr; + } + + for (index = 0; index < m_activeConnectList.size(); ++index) { + activateConnectPtr = m_activeConnectList.at(index); + if (activateConnectPtr.isNull()) { + continue; + } + + if (activateConnectPtr->uuid() == activeConnectUuid) { + return activateConnectPtr; + } + } + + qWarning()<<"[KyNetworkResourceManager]"<<"it can not find the activate connect with uuid" <uuid() == connectUuid) { + return connectPtr; + } + } + + qWarning()<<"[KyNetworkResourceManager]"<<"it can not find connect with uuid"<uuid() == uuid + && NetworkManager::ActiveConnection::State::Activated == activateConnectPtr->state()) { + return true; + } + } + + return false; +} + +//属性判断类接口===================================================================== +bool KyNetworkResourceManager::isWiredConnect(QString connectPath) +{ + QString connectionType = getConnectTypeByDbus(connectPath); + if (ETHERNET_TYPE == connectionType) { + return true; + } + + return false; +} + +bool KyNetworkResourceManager::isActivatingConnection(QString uuid) +{ + int index = 0; + NetworkManager::ActiveConnection::Ptr activateConnectPtr = nullptr; + + if (uuid.isEmpty()) { + return false; + } + + for (index = 0; index < m_activeConnectList.size(); ++index) { + activateConnectPtr = m_activeConnectList.at(index); + if (activateConnectPtr.isNull()) { + continue; + } + + if (activateConnectPtr->uuid() == uuid + && NetworkManager::ActiveConnection::State::Activating == activateConnectPtr->state()) { + return true; + } + } + + return false; +} + +bool KyNetworkResourceManager::isApConnection(NetworkManager::Connection::Ptr connectPtr) +{ + if (nullptr == connectPtr) { + return false; + } + + if (NetworkManager::ConnectionSettings::ConnectionType::Wireless + != connectPtr->settings()->connectionType()) { + return false; + } + + NetworkManager::ConnectionSettings::Ptr settingPtr = connectPtr->settings(); + NetworkManager::WirelessSetting::Ptr wirelessSetting + = settingPtr->setting(NetworkManager::Setting::Wireless).dynamicCast(); + if (NetworkManager::WirelessSetting::NetworkMode::Ap + != wirelessSetting->mode()) { + return false; + } + + return true; +} + +void KyNetworkResourceManager::getConnectivity(KyConnectivity &connectivity) +{ + connectivity = (KyConnectivity)NetworkManager::connectivity(); +} + +void KyNetworkResourceManager::requestScan(NetworkManager::WirelessDevice *p_wirelessDevice) +{ + if (nullptr == p_wirelessDevice) { + qWarning() << LOG_FLAG << "request scan failed, wireless device is invalid."; + return; + } + + QDBusPendingReply<> reply = p_wirelessDevice->requestScan(); + QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, p_wirelessDevice); + connect(watcher, &QDBusPendingCallWatcher::finished, [p_wirelessDevice] (QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + //TODO: in what form should we output the warning messages + qWarning() << QStringLiteral("requestScan on device '%1' failed: %3").arg(p_wirelessDevice->interfaceName()) + .arg(watcher->error().message()); + } + watcher->deleteLater(); + }); + + return; +} + +void KyNetworkResourceManager::onConnectionUpdated() +{ + NetworkManager::Connection *connectPtr = + qobject_cast(sender()); + if (nullptr != connectPtr && connectPtr->isValid()) { + NetworkManager::ConnectionSettings::Ptr connectSettingPtr = connectPtr->settings(); + if (NetworkManager::ConnectionSettings::ConnectionType::Wireless == connectSettingPtr->connectionType()) { + Q_EMIT wirelessConnectionUpdate(connectSettingPtr->interfaceName(), connectPtr->uuid(), connectPtr->name(), connectPtr->path()); + } else if (isWiredConnect(connectPtr->path())) { + Q_EMIT wiredConnectionUpdate(connectSettingPtr->interfaceName(), connectPtr->uuid(), connectPtr->name(), connectPtr->path()); + } else { + Q_EMIT connectionUpdate(connectPtr->uuid(), connectPtr->name(), connectPtr->path()); + } + } else { + qWarning()<< LOG_FLAG + <<"onConnectionUpdate failed, the connect is invalid"; + } +} + +void KyNetworkResourceManager::wirelessActiveStateChange(NetworkManager::ConnectionSettings::Ptr connectSettingsPtr, + QString deviceName, + QString uuid, + KyConnectState state) +{ + NetworkManager::WirelessSetting::Ptr wirelessSettingsPtr + = connectSettingsPtr->setting(NetworkManager::Setting::Wireless).dynamicCast(); + if (wirelessSettingsPtr.isNull()) { + qDebug()<< LOG_FLAG << "don't have WirelessSetting connection"; + return; + } + + QByteArray rawSsid = wirelessSettingsPtr->ssid(); + QString ssid = getSsidFromByteArray(rawSsid); + + Q_EMIT wirelessConnectStateChange(deviceName, ssid, uuid, state); +} + +void KyNetworkResourceManager::wiredActiveStateChange(QString connectPath, + QString deviceName, + QString uuid, + KyConnectState state) +{ + QString connectionType = getConnectTypeByDbus(connectPath); + if (ETHERNET_TYPE == connectionType) { + Q_EMIT wiredConnectStateChange(deviceName, uuid, state); + } else { + qWarning() << LOG_FLAG << "the connect type is not wired" << connectionType; + } +} + +void KyNetworkResourceManager::connectActiveStateChange(NetworkManager::Connection::Ptr connectPtr, + QString deviceName, + KyConnectState state) +{ + QString uuid = connectPtr->uuid(); + NetworkManager::ConnectionSettings::Ptr connectSettingsPtr = connectPtr->settings(); + KyConnectionType connectionType = (KyConnectionType)connectSettingsPtr->connectionType(); + + if (connectionType == CONNECT_TYPE_WIRELESS) { + wirelessActiveStateChange(connectSettingsPtr, deviceName, uuid, state); + NetworkManager::WirelessSetting::Ptr wirelessSetting + = connectSettingsPtr->setting(NetworkManager::Setting::Wireless).dynamicCast(); + if (NetworkManager::WirelessSetting::NetworkMode::Ap + == wirelessSetting->mode()) { + Q_EMIT wirelessApConnectStateChange(); + } + } else if (connectionType == CONNECT_TYPE_WIRED) { + wiredActiveStateChange(connectPtr->path(), deviceName, uuid, state); + } else { + qWarning() << LOG_FLAG << "connect type is undefined" << connectionType; + } +} + +void KyNetworkResourceManager::onActiveConnectionChanged( + NetworkManager::ActiveConnection::State state) +{ + NetworkManager::ActiveConnection * activeConnect = + qobject_cast(sender()); + if (nullptr != activeConnect && activeConnect->isValid()) { + QString deviceName = ""; + QStringList interfaces = activeConnect->devices(); + if (interfaces.size() > 0) { + QString ifaceUni = interfaces.at(0); + NetworkManager::Device:: Ptr devicePtr = findDeviceByUni(ifaceUni); + deviceName = devicePtr->interfaceName(); + } + + NetworkManager::Connection::Ptr connectPtr = activeConnect->connection(); + connectActiveStateChange(connectPtr, deviceName, (KyConnectState)state); + } else { + qWarning() << LOG_FLAG << "onActiveConnectionChanged failed, the connection is invalid."; + } +} + +void KyNetworkResourceManager::onVpnActiveConnectChangedReason(NetworkManager::VpnConnection::State state, + NetworkManager::VpnConnection::StateChangeReason reason) +{ + NetworkManager::ActiveConnection *activeConnect = + qobject_cast(sender()); + + if (nullptr != activeConnect && activeConnect->isValid()) { + qDebug()<<"vpn connect uuid" << activeConnect->uuid() + <<"state change " <uuid(), state, reason); + } else { + qWarning() << LOG_FLAG << "onVpnActiveConnectChangedReason failed, the connection is invalid."; + } +} + +void KyNetworkResourceManager::onDeviceActiveChange() +{ + NetworkManager::Device *p_device = qobject_cast(sender()); + if (nullptr == p_device) { + return; + } + + QString deviceName = p_device->interfaceName(); + //此处需要取反,因为激活连接的网卡状态是false,断开连接的网卡状态是true + bool isActive = !p_device->isActive(); + + qDebug()<< LOG_FLAG << "device active change, device name " << deviceName + << "active state" << isActive; + + Q_EMIT deviceActiveChange(deviceName, isActive); +} + +void KyNetworkResourceManager::updateDeviceName(NetworkManager::Device *p_device) +{ + QString newDeviceName = p_device->interfaceName(); + QString deviceUni = p_device->uni(); + + if (m_deviceMap.contains(deviceUni)) { + if (m_deviceMap[deviceUni] != newDeviceName) { + QString oldDeviceName = m_deviceMap[deviceUni]; + m_deviceMap[deviceUni] = newDeviceName; + if (DEVICE_TYPE_WIFI == (KyDeviceType)p_device->type()) { + Q_EMIT wirelessDeviceUpdate(oldDeviceName, newDeviceName); + } else if (DEVICE_TYPE_ETHERNET == (KyDeviceType)p_device->type() + && !p_device->udi().startsWith(VIRTURAL_DEVICE_PATH)) { + Q_EMIT wiredDeviceUpdate(oldDeviceName, newDeviceName);; + } else { + Q_EMIT deviceUpdate(oldDeviceName, newDeviceName); + } + } + } +} + +void KyNetworkResourceManager::onDeviceUpdated() +{ + NetworkManager::Device *p_device = qobject_cast(sender()); + if (nullptr == p_device) { + return; + } + + updateDeviceName(p_device); +} + +void KyNetworkResourceManager::onDeviceCarrierChange(bool pluged) +{ + NetworkManager::WiredDevice * networkDevice + = qobject_cast(sender()); + + qDebug()<< LOG_FLAG<<"device carrier change"<< pluged; + if (nullptr !=networkDevice && networkDevice->isValid()) { + Q_EMIT deviceCarrierChange(networkDevice->interfaceName(), pluged); + } else { + qWarning()<< LOG_FLAG<<"onDeviceCarrierChange failed."; + } +} + +void KyNetworkResourceManager::onDeviceBitRateChange(int bitRate) +{ + NetworkManager::WiredDevice * networkDevice + = qobject_cast(sender()); + + if (nullptr != networkDevice + && networkDevice->isValid()) { + Q_EMIT deviceBitRateChange(networkDevice->interfaceName(), bitRate); + } else { + qWarning()<< LOG_FLAG <<"the device is not invalid with bitrate" << bitRate; + } +} + +//暂未用到 +void KyNetworkResourceManager::onDeviceMacAddressChange(const QString &hwAddress) +{ + NetworkManager::WiredDevice * networkDevice + = qobject_cast(sender()); + + if (nullptr != networkDevice && networkDevice->isValid()) { + Q_EMIT deviceMacAddressChange(networkDevice->interfaceName(), hwAddress); + } else { + qWarning()<< LOG_FLAG <<"the device is not invalid with mac" << hwAddress; + } +} + +//设备状态变化 +void KyNetworkResourceManager::onDeviceStateChanged( + NetworkManager::Device::State newstate, + NetworkManager::Device::State oldstate, + NetworkManager::Device::StateChangeReason reason) +{ + qDebug() << LOG_FLAG <<"the device state "<(sender()); + Q_EMIT deviceStateChange(networkDevice->interfaceName(), (KyDeviceState)newstate, (KyDeviceState)oldstate, reason); +} + + +void KyNetworkResourceManager::wifiNetworkAdd(NetworkManager::Device * dev, QString const & ssid) +{ + if (nullptr == dev) { + return; + } + + NetworkManager::WirelessDevice * w_dev = qobject_cast(dev); + NetworkManager::WirelessNetwork::Ptr net = w_dev->findNetwork(ssid); + if (!net.isNull()) { + if (0 > m_wifiNetList.indexOf(net)){ + addWifiNetwork(net); + } else { + //TODO: onWifiNetworkUpdate + qDebug()<< LOG_FLAG << "add but already exist"; + } + + NetworkManager::AccessPoint::Ptr accessPoitPtr = net->referenceAccessPoint(); + QByteArray rawSsid = accessPoitPtr->rawSsid(); + QString wifiSsid = getSsidFromByteArray(rawSsid); + Q_EMIT wifiNetworkAdded(dev->interfaceName(), wifiSsid); + } + + return; +} + +void KyNetworkResourceManager::wifiNetworkUpdate(NetworkManager::WirelessNetwork * net) +{ + if (nullptr == net) { + return; + } + + auto index = std::find(m_wifiNetList.cbegin(), m_wifiNetList.cend(), net); + if (m_wifiNetList.cend() != index) { + if (net->accessPoints().isEmpty()) { + //emit + bool bFlag = false; + QString devIface; + NetworkManager::Device::Ptr dev = findDeviceByUni(net->device()); + if(dev.isNull()) { + qDebug()<< LOG_FLAG << "device invalid"; + bFlag = true; + } else { + devIface = dev->interfaceName(); + } + + //remove + auto pos = index - m_wifiNetList.cbegin(); + removeWifiNetwork(pos); + if(bFlag) { + Q_EMIT wifiNetworkDeviceDisappear(); + } else { + NetworkManager::AccessPoint::Ptr accessPoitPtr = net->referenceAccessPoint(); + if (accessPoitPtr.isNull()) { + return; + } + QByteArray rawSsid = accessPoitPtr->rawSsid(); + QString wifiSsid = getSsidFromByteArray(rawSsid); + Q_EMIT wifiNetworkRemoved(devIface, wifiSsid); + } + } else { + Q_EMIT wifiNetworkPropertyChange(*index); + } + } + + return; +} + +void KyNetworkResourceManager::wifiNetworkRemove(NetworkManager::Device * dev, QString const & ssid) +{ + if (nullptr == dev) { + return; + } + + NetworkManager::WirelessNetwork::Ptr net = findWifiNetwork(ssid, dev->uni()); + if (!net.isNull()) { + auto pos = m_wifiNetList.indexOf(net); + if (0 <= pos) { + removeWifiNetwork(pos); + NetworkManager::AccessPoint::Ptr accessPoitPtr = net->referenceAccessPoint(); + QByteArray rawSsid = accessPoitPtr->rawSsid(); + QString wifiSsid = getSsidFromByteArray(rawSsid); + Q_EMIT wifiNetworkRemoved(dev->interfaceName(), wifiSsid); + } + } + + return; +} + +void KyNetworkResourceManager::onWifiNetworkAppeared(QString const & ssid) +{ + NetworkManager::Device * p_device = qobject_cast(sender()); + if (nullptr != p_device) { + wifiNetworkAdd(p_device, ssid); + updateDeviceName(p_device); + } else { + qWarning()<< LOG_FLAG << "onWifiNetworkAppeared failed."; + } +} + +void KyNetworkResourceManager::onWifiNetworkDisappeared(QString const & ssid) +{ + NetworkManager::Device *p_device = qobject_cast(sender()); + if (nullptr != p_device) { + wifiNetworkRemove(p_device, ssid); + updateDeviceName(p_device); + } else { + qWarning()<< LOG_FLAG << "onWifiNetworkDisappeared failed."; + } +} + +void KyNetworkResourceManager::onUpdateWirelessNet() +{ + NetworkManager::WirelessNetwork *p_wirelessNet = + qobject_cast(sender()); + if (nullptr != p_wirelessNet) { + wifiNetworkUpdate(p_wirelessNet); + } +} + +void KyNetworkResourceManager::onDeviceAdded(QString const & uni) +{ + NetworkManager::Device::Ptr networkDevicePtr = NetworkManager::findNetworkInterface(uni); + if (networkDevicePtr.isNull()) { + qWarning()<<"the device is not exist in networkmanager."<< uni; + return; + } + + if (!networkDevicePtr->isValid()) { + qWarning() << uni << " is currently not invalid"; + return; + } + + if (0 > m_deviceList.indexOf(networkDevicePtr)) { + addDevice(networkDevicePtr); + if (DEVICE_TYPE_WIFI == (KyDeviceType)networkDevicePtr->type()) { + Q_EMIT wirelessDeviceAdd(networkDevicePtr->interfaceName()); + } else if (DEVICE_TYPE_ETHERNET == (KyDeviceType)networkDevicePtr->type() + && !networkDevicePtr->udi().startsWith(VIRTURAL_DEVICE_PATH)) { + Q_EMIT wiredDeviceAdd(networkDevicePtr->interfaceName()); + saveDeviceEnableState(networkDevicePtr->interfaceName(), true); + } else { + Q_EMIT deviceAdd(networkDevicePtr->interfaceName(), (KyDeviceType)networkDevicePtr->type()); + } + } else { + qWarning() << networkDevicePtr->interfaceName() <<"the device is exist in network device list."; + } +} + +void KyNetworkResourceManager::onDeviceRemoved(QString const & uni) +{ + NetworkManager::Device::Ptr networkDevice = findDeviceByUni(uni); + if (networkDevice.isNull()) { + qWarning()<<"the device is not exist in network device list ."<< uni; + return; + } + + auto index = std::find(m_deviceList.cbegin(), m_deviceList.cend(), networkDevice); + if (m_deviceList.cend() != index) { + const int pos = index - m_deviceList.cbegin(); + removeDevice(pos); + } +} + +void KyNetworkResourceManager::onActiveConnectionAdded(QString const & path) +{ + NetworkManager::ActiveConnection::Ptr activeConnectPtr = NetworkManager::findActiveConnection(path); + if (activeConnectPtr.isNull()) { + qWarning() << "[KyNetworkResourceManager]" << "the active connect is null, so do not add it."<isValid()) { + qWarning() << "[KyNetworkResourceManager]" << path << " connect is currently not valid"; + return; + } + +// qDebug()<<"add active connect"<connection()->name(); + + if (0 > m_activeConnectList.indexOf(activeConnectPtr)) { + addActiveConnection(activeConnectPtr); + Q_EMIT activeConnectionAdd(activeConnectPtr->uuid()); + } else { + //TODO: onActiveConnectionUpdate + qWarning() << "[KyNetworkResourceManager]" << "update active connection to do"; + //emit activeConnectionUpdate(conn->uuid()); + } +} + +void KyNetworkResourceManager::onActiveConnectionRemoved(QString const & path) +{ + NetworkManager::ActiveConnection::Ptr activeConnectPtr = findActiveConnectionByPath(path);//XXX: const QString &uni + if (activeConnectPtr.isNull()) { + qWarning() <<"[KyNetworkResourceManager]" + <<"the active connect is null, so do not remove it. "<< path; + return; + } + + auto index = std::find(m_activeConnectList.cbegin(), m_activeConnectList.cend(), activeConnectPtr); + if (m_activeConnectList.cend() != index) { + const int pos = index - m_activeConnectList.cbegin(); + removeActiveConnection(pos); + Q_EMIT activeConnectionRemove(activeConnectPtr->uuid()); + } +} + +void KyNetworkResourceManager::onConnectionAdded(QString const & path) +{ + NetworkManager::Connection::Ptr connectPtr = NetworkManager::findConnection(path); + if (connectPtr.isNull()) { + qWarning() <<"[KyNetworkResourceManager]" <<"it can not find in networkmanager."<isValid()) { + qWarning() <<"[KyNetworkResourceManager]" << path << " is currently not invalid"; + return; + } + + if (connectPtr->name().isEmpty() || connectPtr->uuid().isEmpty()) { + qWarning() <<"[KyNetworkResourceManager]" << "the name or uuid of connection is empty"; + return; + } + + if (0 > m_connectList.indexOf(connectPtr)) { + addConnection(connectPtr); + NetworkManager::ConnectionSettings::Ptr connectSettingPtr = connectPtr->settings(); + if (NetworkManager::ConnectionSettings::ConnectionType::Wireless == connectSettingPtr->connectionType()) { + Q_EMIT wirelessConnectionAdd(connectPtr->uuid(), connectPtr->name(), connectPtr->path()); + } else if (isWiredConnect(connectPtr->path())) { + Q_EMIT wiredConnectionAdd(connectPtr->settings()->interfaceName(), connectPtr->uuid(), connectPtr->name(), connectPtr->path()); + } else { + Q_EMIT connectionAdd(connectPtr->uuid(), connectPtr->name(), connectPtr->path()); + } + } else { + //TODO::updateconnect + qWarning() << "[KyNetworkResourceManager]" << connectPtr->uuid() <<" connect is exist in connect list."; + } +} + +void KyNetworkResourceManager::onConnectionRemoved(QString const & path) +{ + if (path.isEmpty()) { + qDebug() <<"[KyNetworkResourceManager]" <<"the connect path is empty"; + return; + } + NetworkManager::Connection::Ptr connectionPtr = nullptr; + for (int index = 0; index < m_connectList.size(); ++index) { + connectionPtr = m_connectList.at(index); + if (connectionPtr->path() == path) { + removeConnection(index); + Q_EMIT connectionRemove(path); + return; + } + } + + qWarning() <<"[KyNetworkResourceManager]" << path <<" connect is no exist in connect list"; +} + +void KyNetworkResourceManager::onConnectivityChanged(NetworkManager::Connectivity connectivity) +{ + qDebug() << "onConnectivityChanged"; + Q_EMIT connectivityChanged((KyConnectivity)connectivity); +} + +void KyNetworkResourceManager::onPrimaryConnectionTypeChanged(NetworkManager::ConnectionSettings::ConnectionType type) +{ + Q_EMIT primaryConnectionTypeChanged((KyConnectionType)type); +} + +void KyNetworkResourceManager::connectionDump() +{ + NetworkManager::Connection::Ptr connectionPtr = nullptr; + for (int index = 0; index < m_connectList.size(); ++index) { + connectionPtr = m_connectList.at(index); + qDebug()<<"connection info**********************"; + qDebug()<<"connection name"<< connectionPtr->name(); + qDebug()<<"connection uuid"<< connectionPtr->uuid(); + qDebug()<<"connection path"<< connectionPtr->path(); + } +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.h b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.h new file mode 100644 index 00000000..50ae4323 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.h @@ -0,0 +1,241 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 +#include + +#include "kylinnetworkresourcetype.h" + +#define VIRTURAL_DEVICE_PATH "/sys/devices/virtual/net" + +class KyNetworkResourceManager : public QObject +{ + Q_OBJECT +public: + static KyNetworkResourceManager* getInstance(); + static void Release(); + +public: + explicit KyNetworkResourceManager(QObject *parent = nullptr); + ~KyNetworkResourceManager(); + +public: + NetworkManager::ActiveConnection::Ptr findActiveConnectionByPath(QString const & path); + NetworkManager::ActiveConnection::Ptr findActiveConnectByUuid(const QString activeConnectUuid); + + NetworkManager::Connection::Ptr findConnectByUuid(const QString uuid); + + NetworkManager::Device::Ptr findDeviceByUni(QString const &deviceUni); + NetworkManager::Device::Ptr findDeviceByName(QString const &interfaceName); + + NetworkManager::WirelessNetwork::Ptr findWifiNetwork(QString const &ssid, QString const &deviceUni); + + NetworkManager::ActiveConnection::List getActiveConnectList(); + NetworkManager::Connection::List getConnectList(); + NetworkManager::Device::List getNetworkDeviceList(); + NetworkManager::WirelessNetwork::List getWifiNetworkList(); + + bool isActiveConnection(QString uuid); + bool isActivatingConnection(QString uuid); + + void getConnectivity(KyConnectivity &connectivity); + + bool NetworkManagerIsInited(); + + void requestScan(NetworkManager::WirelessDevice *p_wirelessDevice); + + bool isWiredConnect(QString connectPath); + bool isApConnection(NetworkManager::Connection::Ptr connectPtr); + +private: + void removeActiveConnection(int pos); + void clearActiveConnections(); + void insertActiveConnections(); + void addActiveConnection(NetworkManager::ActiveConnection::Ptr conn); + + void removeConnection(int pos); + void clearConnections(); + void insertConnections(); + void addConnection(NetworkManager::Connection::Ptr conn); + + void removeDevice(int pos); + void clearDevices(); + void insertDevices(); + void addDevice(NetworkManager::Device::Ptr conn); + void updateDeviceName(NetworkManager::Device *p_device); + + void removeWifiNetwork(int pos); + void clearWifiNetworks(); + void insertWifiNetworks(); + void addWifiNetwork(NetworkManager::WirelessNetwork::Ptr net); + + void connectionDump(); + + void wifiNetworkAdd(NetworkManager::Device * dev, QString const & ssid); + void wifiNetworkUpdate(NetworkManager::WirelessNetwork * net); + void wifiNetworkRemove(NetworkManager::Device * dev, QString const & ssid); + + + void wirelessActiveStateChange(NetworkManager::ConnectionSettings::Ptr connectSettingsPtr, + QString deviceName, QString uuid, KyConnectState state); + void wiredActiveStateChange(QString connectPath, QString deviceName, + QString uuid, KyConnectState state); + void connectActiveStateChange(NetworkManager::Connection::Ptr connectPtr, + QString deviceName, KyConnectState state); + +private Q_SLOTS: + void onServiceAppear(QString, QString, QString); + +Q_SIGNALS: + + // wired connect + void wiredConnectionAdd(QString devName, QString connectUuid, QString connectName, QString connectPath); + void wiredConnectionUpdate(QString devName, QString connectUuid, QString connectName, QString connectPath); +// void wiredConnectionRemove(QString path); + + void connectionAdd(QString connectUuid, QString connectName, QString connectPath); + void connectionUpdate(QString connectUuid, QString connectName, QString connectPath); + void connectionRemove(QString path); + + //device + void wiredDeviceAdd(QString deviceName); + void wiredDeviceUpdate(QString oldDeviceName, QString newDeviceName); + + void wirelessDeviceAdd(QString deviceName); + void wirelessDeviceUpdate(QString oldDeviceName, QString newDeviceName); + + void deviceAdd(QString deviceName, KyDeviceType deviceType); + void deviceUpdate(QString oldDeviceName, QString newDeviceName); + void deviceRemove(QString deviceName); + + void deviceActiveChange(QString deviceName, bool deviceActive); + void deviceCarrierChange(QString deviceName, bool pluged); + void deviceBitRateChange(QString deviceName, int bitRate); + void deviceMacAddressChange(QString deviceName, const QString &hwAddress); + void deviceStateChange(QString deviceName, KyDeviceState newstate, KyDeviceState oldstate, + NetworkManager::Device::StateChangeReason reason); + + //wireless + void wifiNetworkRemoved(QString, QString); + void wifiNetworkAdded(QString, QString); + void wifiNetworkPropertyChange(NetworkManager::WirelessNetwork::Ptr net); + void wifiNetworkDeviceDisappear(); + + void wirelessConnectionAdd(QString connectUuid, QString connectName, QString connectPath); + void wirelessConnectionUpdate(QString devName,QString connectUuid, QString connectName, QString connectPath); +// void wirelessConnectionRemove(QString path); + +// void wiredConnectionUpdate(QString connectUuid, QString connectName, QString connectPath); + + + //activate connection + void activeConnectionAdd(QString uuid); + void activeConnectionRemove(QString uuid); + + void wiredConnectStateChange(QString deviceName, QString uuid, KyConnectState state); + void wirelessConnectStateChange(QString deviceName, QString ssid, QString uuid, KyConnectState state); + void wirelessApConnectStateChange(); + + + //general + void connectivityChanged(KyConnectivity connectivity); + void wifiEnabledChanged(bool); + void networkingEnabledChanged(bool); + void primaryConnectionTypeChanged(KyConnectionType type); + +public Q_SLOTS: + void onInitNetwork(); + + //connection + void onConnectionUpdated(); + //void onConnectionRemoved(); + + //active connection + void onActiveConnectionChanged(NetworkManager::ActiveConnection::State state); + void onVpnActiveConnectChangedReason(NetworkManager::VpnConnection::State state, + NetworkManager::VpnConnection::StateChangeReason reason); + + void onDeviceActiveChange(); + void onDeviceCarrierChange(bool pluged); + void onDeviceBitRateChange(int bitRate); + void onDeviceMacAddressChange(const QString &hwAddress); + void onDeviceStateChanged(NetworkManager::Device::State newstate, + NetworkManager::Device::State oldstate, NetworkManager::Device::StateChangeReason reason); + + void onWifiNetworkAppeared(QString const & ssid); + void onWifiNetworkDisappeared(QString const & ssid); + + //wifi network + void onUpdateWirelessNet(); + void onConnectivityChanged(NetworkManager::Connectivity connectivity); + + //notifier + void onDeviceAdded(QString const & uni); + void onDeviceRemoved(QString const & uni); + void onDeviceUpdated(); + + //active connection notifier + void onActiveConnectionAdded(QString const & path); + void onActiveConnectionRemoved(QString const & path); + + //settings notifier + void onConnectionAdded(QString const & path); + void onConnectionRemoved(QString const & path); + + void onPrimaryConnectionTypeChanged(NetworkManager::ConnectionSettings::ConnectionType); + +public: + static KyNetworkResourceManager* m_pInstance; + +private: + bool m_initFinished = false; + NetworkManager::ActiveConnection::List m_activeConnectList; + NetworkManager::Connection::List m_connectList; + NetworkManager::Device::List m_deviceList; + NetworkManager::WirelessNetwork::List m_wifiNetList; + + QMap m_deviceMap; +}; + + +#endif // KYLINNETWORKRESOURCEMANAGER_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcetype.h b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcetype.h new file mode 100644 index 00000000..8e6ab66e --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcetype.h @@ -0,0 +1,207 @@ +#ifndef KYLINNETWORKRESOURCETYPE_H +#define KYLINNETWORKRESOURCETYPE_H + + +typedef enum{ + CONNECT_STATE_UNKONW = 0, /**< The active connection is in an unknown state */ + CONNECT_STATE_ACTIVATING, /**< The connection is activating */ + CONNECT_STATE_ACTIVATED, /**< The connection is activated */ + CONNECT_STATE_DEACTIVATING, /**< The connection is being torn down and cleaned up */ + CONNECT_STATE_DEACTIVATED, /**< The connection is no longer active */ + + CONNECT_STATE_COUNT +}KyConnectState; + +typedef enum{ + CHANGE_REASON_UNKNOWN = 0, /**< The reason for the active connection state change is unknown */ + CHANGE_REASON_NONE, /**< No reason was given for the active connection state change */ + CHANGE_REASON_USER_DISCONNECTED, /**< The active connection changed state because the user disconnected it */ + CHANGE_REASON_DEVICE_DISCONNECTIED, /**< The active connection changed state because the device it was using was disconnected */ + CHANGE_REASON_SERVICE_STOP, /**< The service providing the VPN connection was stopped */ + + CHANGE_REASON_IPCONFIG_INVALID = 5, /**< The IP config of the active connection was invalid */ + CHANGE_REASON_CONNECT_TIMEOUT, /**< The connection attempt to the VPN service timed out */ + CHANGE_REASON_SERVICE_START_TIMEOUT,/**< A timeout occurred while starting the service providing the VPN connection */ + CHANGE_REASON_SERVICE_START_FAILED, /**< Starting the service providing the VPN connection failed */ + CHANGE_REASON_NO_SECRET, /**< Necessary secrets for the connection were not provided */ + + CHANGE_REASON_LOGIN_FAILED = 10, /**< Authentication to the server failed */ + CHANGE_REASON_CONNECT_REMOVED, /**< The connection was deleted from settings */ + CHANGE_REASON_DEPENDENCY_FAILED, /**< Master connection of this connection failed to activate */ + CHANGE_REASON_DEVICE_REALIZE_FAILED,/**< Could not create the software device link */ + CHANGE_REASON_DEVICE_REMOVED, /**< The device this connection depended on disappeared */ + + CHANGE_REASON_COUNT +}KyConnectChangeReason; + +typedef enum { + CONNECT_TYPE_UNKNOWN = 0, + CONNECT_TYPE_ADSL, + CONNECT_TYPE_BLUETOOTH, + CONNECT_TYPE_BOND, + CONNECT_TYPE_BRIDGE, + + CONNECT_TYPE_CDMA = 5, + CONNECT_TYPE_GSM, + CONNECT_TYPE_INFINIBAND, + CONNECT_TYPE_OLPCMESH, + CONNECT_TYPE_PPPOE, + + CONNECT_TYPE_VLAN = 10, + CONNECT_TYPE_VPN, + CONNECT_TYPE_WIMAX, + CONNECT_TYPE_WIRED, + CONNECT_TYPE_WIRELESS, + + CONNECT_TYPE_TEAM = 15, + CONNECT_TYPE_GENERIC, + CONNECT_TYPE_TUN, + CONNECT_TYPE_IPTUNNEL, + CONNECT_TYPE_WIREDGUARD, + + CONNECT_TYPE_COUNT +}KyConnectionType; + +typedef enum { + CONNECTIVITY_UNKNOWN = 0, /**< Network connectivity is unknown. */ + CONNECTIVITY_NO, /**< The host is not connected to any network. */ + CONNECTIVITY_PORTAL, /**< The host is behind a captive portal and cannot reach the full Internet. */ + CONNECTIVITY_LIMITED, /**< The host is connected to a network, but does not appear to be able to reach the full Internet. */ + CONNECTIVITY_FULL, /**< The host is connected to a network, and appears to be able to reach the full Internet. */ + + CONNECTIVITY_COUNT +}KyConnectivity; + +typedef enum { + DEVICE_TYPE_UNKNOWN = 0, /**< Unknown device type */ + DEVICE_TYPE_ETHERNET, /**< Ieee8023 wired ethernet */ + DEVICE_TYPE_WIFI, /**< the Ieee80211 family of wireless networks */ + DEVICE_TYPE_UNUSED1, /**< Currently unused */ + DEVICE_TYPE_UNUSED2, /**< Currently unused */ + + DEVICE_TYPE_BLUETOOTH = 5, /**< network bluetooth device (usually a cell phone) */ + DEVICE_TYPE_OLPCMESH, /**< OLPC Mesh networking device */ + DEVICE_TYPE_WIMAX, /**< WiMax WWAN technology */ + DEVICE_TYPE_MODEM, /**< POTS, GSM, CDMA or LTE modems */ + DEVICE_TYPE_INFINIBAND, /**< Infiniband network device */ + + DEVICE_TYPE_BOND = 10, /**< Bond virtual device */ + DEVICE_TYPE_VLAN, /**< Vlan virtual device */ + DEVICE_TYPE_ADSL, /**< ADSL modem device */ + DEVICE_TYPE_BRIDGE, /**< Bridge virtual device */ + DEVICE_TYPE_GENERIC, /**< Generic device @since 1.0.0 */ + + DEVICE_TYPE_TEAM = 15, /**< Team master device @since 1.0.0 */ + DEVICE_TYPE_GRE, /**< Gre virtual device @since 1.2.0, @deprecated use IpTunnel instead*/ + DEVICE_TYPE_MACVLAN, /**< MacVlan virtual device @since 1.2.0 */ + DEVICE_TYPE_TUN, /**< Tun virtual device @since 1.2.0 */ + DEVICE_TYPE_VETH, /**< Veth virtual device @since 1.2.0 */ + + DEVICE_TYPE_IPTUNNEL = 20, /**< IP Tunneling Device @since 1.2.0 */ + DEVICE_TYPE_VXLAN, /**< Vxlan Device @since 1.2.0 */ + DEVICE_TYPE_MACSEC, /**< MacSec Device @since 1.6.0 */ + DEVICE_TYPE_DUMMY, /**< Dummy Device @since 1.8.0 */ + DEVICE_TYPE_PPP, /**< Ppp Device @since 1.10 */ + + DEVICE_TYPE_OVSINTERFACE = 25, /**< OvsInterface Device @since 1.10 */ + DEVICE_TYPE_OVSPORT, /**< OvsPort Device @since 1.10 */ + DEVICE_TYPE_OVSBRIDGE, /**< OvsBridge Device @since 1.10 */ + DEVICE_TYPE_WPAN, /**< Wpan Device @since 1.14 */ + DEVICE_TYPE_LOWPAN, /**< Lowpan Device @since 1.14 */ + + DEVICE_TYPE_WIREGUARD = 30, /**< WireGuard Device @since 1.14 */ + DEVICE_TYPE_WIFIP2P, /**< WifiP2P Device @since 1.16 */ + DEVICE_TYPE_COUNT +}KyDeviceType; + +typedef enum { + DEVICE_STATE_UNKNOWN = 0, /**< The device is in an unknown state */ + DEVICE_STATE_UNMANAGED = 10, /**< The device is recognized but not managed by NetworkManager */ + DEVICE_STATE_UNAVAILABLE = 20, /**< The device cannot be used (carrier off, rfkill, etc) */ + DEVICE_STATE_DISCONNECTED = 30, /**< The device is not connected */ + DEVICE_STATE_PREPARING = 40, /**< The device is preparing to connect */ + DEVICE_STATE_CONFIGURINGHARDWARE = 50, /**< The device is being configured */ + DEVICE_STATE_NEEDAUTH = 60, /**< The device is awaiting secrets necessary to continue connection */ + DEVICE_STATE_CONFIGURINGIP = 70, /**< The IP settings of the device are being requested and configured */ + DEVICE_STATE_CHECKINGIP = 80, /**< The device's IP connectivity ability is being determined */ + DEVICE_STATE_WAITINGFORSECONDARIES = 90, /**< The device is waiting for secondary connections to be activated */ + DEVICE_STATE_ACTIVATED = 100, /**< The device is active */ + DEVICE_STATE_DEACTIVATING = 110, /**< The device's network connection is being torn down */ + DEVICE_STATE_FAILED = 120 /**< The device is in a failure state following an attempt to activate it */ +}KyDeviceState; + + +/** + * KyApSecurityFlags: + * @AP_SEC_NONE: the access point has no special security requirements + * @AP_SEC_PAIR_WEP40: 40/64-bit WEP is supported for + * pairwise/unicast encryption + * @AP_SEC_PAIR_WEP104: 104/128-bit WEP is supported for + * pairwise/unicast encryption + * @AP_SEC_PAIR_TKIP: TKIP is supported for pairwise/unicast encryption + * @AP_SEC_PAIR_CCMP: AES/CCMP is supported for pairwise/unicast encryption + * @AP_SEC_GROUP_WEP40: 40/64-bit WEP is supported for group/broadcast + * encryption + * @AP_SEC_GROUP_WEP104: 104/128-bit WEP is supported for + * group/broadcast encryption + * @AP_SEC_GROUP_TKIP: TKIP is supported for group/broadcast encryption + * @AP_SEC_GROUP_CCMP: AES/CCMP is supported for group/broadcast + * encryption + * @AP_SEC_KEY_MGMT_PSK: WPA/RSN Pre-Shared Key encryption is + * supported + * @AP_SEC_KEY_MGMT_802_1X: 802.1x authentication and key management + * is supported + * @AP_SEC_KEY_MGMT_SAE: WPA/RSN Simultaneous Authentication of Equals is + * supported + * + * 802.11 access point security and authentication flags. These flags describe + * the current security requirements of an access point as determined from the + * access point's beacon. + **/ +typedef enum { /*< underscore_name=nm_802_11_ap_security_flags, flags >*/ + AP_SECURITY_NONE = 0x00000000, + AP_SECURITY_PAIR_WEP40 = 0x00000001, + AP_SECURITY_PAIR_WEP104 = 0x00000002, + AP_SECURITY_PAIR_TKIP = 0x00000004, + AP_SECURITY_PAIR_CCMP = 0x00000008, + AP_SECURITY_GROUP_WEP40 = 0x00000010, + AP_SECURITY_GROUP_WEP104 = 0x00000020, + AP_SECURITY_GROUP_TKIP = 0x00000040, + AP_SECURITY_GROUP_CCMP = 0x00000080, + AP_SECURITY_KEY_MGMT_PSK = 0x00000100, + AP_SECURITY_KEY_MGMT_802_1X = 0x00000200, + AP_SECURITY_KEY_MGMT_SAE = 0x00000400, +}KyApSecurityFlags; + +/** + * KyApCapabilities: + * @AP_FLAGS_NONE: access point has no special capabilities + * @AP_FLAGS_PRIVACY: access point requires authentication and + * encryption (usually means WEP) + * @AP_FLAGS_WPS: access point supports some WPS method + * @AP_FLAGS_WPS_PBC: access point supports push-button WPS + * @AP_FLAGS_WPS_PIN: access point supports PIN-based WPS + * + * 802.11 access point fCapabilities. + **/ +typedef enum { + AP_CAPABILITY_NONE = 0x00000000, + AP_CAPABILITY_PRIVACY = 0x00000001, + AP_CAPABILITY_WPS = 0x00000002, + AP_CAPABILITY_WPS_PBC = 0x00000004, + AP_CAPABILITY_WPS_PIN = 0x00000008, +}KyApCapabilities; + +//class KySecretFlagType { +//public: +// enum KySecretFlag{ +// SECRET_FLAG_NONE = 0, +// SECRET_FLAG_AgentOWNED = 0x01, +// SECRET_FLAG_NOTSAVED = 0x02, +// SECRET_FLAG_NOTREQUIRED = 0x04 +// }; +// Q_DECLARE_FLAGS(kySecretFlags, KySecretFlag) +//}; +//Q_DECLARE_OPERATORS_FOR_FLAGS(KySecretFlagType::KySecretFlags) + +#endif // KYLINNETWORKRESOURCETYPE_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinwiredconnectoperation.cpp b/libnm-kylin/libnm-base-kylin/depend/kylinwiredconnectoperation.cpp new file mode 100644 index 00000000..38230bab --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinwiredconnectoperation.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 +#include +#include +#include +#include + +KyWiredConnectOperation::KyWiredConnectOperation(QObject *parent) : KyConnectOperation(parent) +{ + +} + +void KyWiredConnectOperation::createWiredConnect(KyConnectSetting &connectSettingsInfo) +{ + connectSettingsInfo.dumpInfo(); + + NetworkManager::ConnectionSettings::Ptr wiredConnectionSettings = NetworkManager::ConnectionSettings::Ptr(new NetworkManager::ConnectionSettings(NetworkManager::ConnectionSettings::Wired)); + connectSettingSet(wiredConnectionSettings, connectSettingsInfo); + + NetworkManager::Ipv4Setting::Ptr ipv4Setting = wiredConnectionSettings->setting(NetworkManager::Setting::Ipv4).dynamicCast(); + ipv4SettingSet(ipv4Setting, connectSettingsInfo); + + NetworkManager::Ipv6Setting::Ptr ipv6Setting = wiredConnectionSettings->setting(NetworkManager::Setting::Ipv6).dynamicCast(); + ipv6SettingSet(ipv6Setting, connectSettingsInfo); + + NetworkManager::WiredSetting::Ptr wiredSetting = wiredConnectionSettings->setting(NetworkManager::Setting::Wired).dynamicCast(); + wiredSetting->setInitialized(true); + + QDBusPendingCallWatcher * watcher; + watcher = new QDBusPendingCallWatcher{NetworkManager::addConnection(wiredConnectionSettings->toMap()), this}; + connect(watcher, &QDBusPendingCallWatcher::finished, [this](QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMessage = tr("create wired connection failed: ") + watcher->error().message(); + qWarning() << errorMessage; + Q_EMIT this->createConnectionError(errorMessage); + } + watcher->deleteLater(); + }); +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinwiredconnectoperation.h b/libnm-kylin/libnm-base-kylin/depend/kylinwiredconnectoperation.h new file mode 100644 index 00000000..bbf403bc --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinwiredconnectoperation.h @@ -0,0 +1,22 @@ +#ifndef KYLINWIREDCONNECTOPERATION_H +#define KYLINWIREDCONNECTOPERATION_H + +#include +#include + +#include "kylinnetworkresourcemanager.h" +#include "kylinconnectsetting.h" +#include "kylinconnectoperation.h" + +const QString WIRED_NETWORK_STATE_CONF_FILE = QDir::homePath() + "/.config/ukui/kylin-nm-wired.ini"; + +class KyWiredConnectOperation : public KyConnectOperation +{ + Q_OBJECT +public: + explicit KyWiredConnectOperation(QObject *parent = nullptr); + + void createWiredConnect(KyConnectSetting &connectSettingsInfo); +}; + +#endif // KYLINWIREDCONNECTOPERATION_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinwirednetresource.cpp b/libnm-kylin/libnm-base-kylin/depend/kylinwirednetresource.cpp new file mode 100644 index 00000000..b53885f8 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinwirednetresource.cpp @@ -0,0 +1,127 @@ + +#include "kylinwirednetresource.h" +#include "kywirelessconnectoperation.h" +#include "kylinnetworkmanagerutil.h" + +#include +#include +#include +#include +#include + +static bool subLanListSort(const KyWiredItem info1, const KyWiredItem info2) +{ + QString name1 = info1.m_connectName; + QString name2 = info2.m_connectName; + bool result = true; + if (QString::compare(name1, name2, Qt::CaseInsensitive) > 0) { + result = false; + } + return result; +} + +static void lanListSort(QList &list) +{ + qSort(list.begin(), list.end(), subLanListSort); +} + +KyWiredConnectResourse::KyWiredConnectResourse(QObject *parent) : KyNetResource(parent) +{ + connect(m_networkResourceInstance, &KyNetworkResourceManager::wiredConnectionAdd, this, &KyWiredConnectResourse::wiredConnectionAdd); + connect(m_networkResourceInstance, &KyNetworkResourceManager::wiredConnectionUpdate, this, &KyWiredConnectResourse::wiredConnectionUpdate); + connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionRemove, this, &KyWiredConnectResourse::connectionRemove); + + connect(m_networkResourceInstance, &KyNetworkResourceManager::wiredDeviceAdd, this, &KyWiredConnectResourse::wiredDeviceAdd); + connect(m_networkResourceInstance, &KyNetworkResourceManager::wiredDeviceUpdate, this, &KyWiredConnectResourse::wiredDeviceUpdate); + connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceRemove, this, &KyWiredConnectResourse::deviceRemove); +} + +//配合activeconnection 此处未单独区分已连接的wifi +void KyWiredConnectResourse::getWiredList(QMap> &map) +{ + map.clear(); + kyWirdNetItemListInit(); + if (m_wiredNetworkMap.isEmpty()) { + return; + } else { + QMap >::iterator iter = m_wiredNetworkMap.begin(); + while (iter != m_wiredNetworkMap.end()) { + lanListSort(m_wiredNetworkMap[iter.key()]); + iter++; + } + map = m_wiredNetworkMap; + } +} + +void KyWiredConnectResourse::getWiredConnectDetail(QString interface, QString uuid, KyDetailInfo &connectSetting) +{ + getBaseInfo(interface, "", false, false, connectSetting); + getDynamicIpInfo(uuid, connectSetting); +} + +KyWiredItem KyWiredConnectResourse::getConnectionItem(NetworkManager::Connection::Ptr connectPtr) +{ + if (nullptr == connectPtr) { + qWarning()<<"[KyConnectResourse]"<<"the connect is empty"; + return KyWiredItem(); + } + + KyWiredItem connectionItem; + connectionItem.m_connectName = connectPtr->name(); + connectionItem.m_connectUuid = connectPtr->uuid(); + connectionItem.m_connectPath = connectPtr->path(); + + return connectionItem; +} + + +void KyWiredConnectResourse::kyWirdNetItemListInit() +{ + m_wiredNetworkMap.clear(); + NetworkManager::Connection::List connectList = m_networkResourceInstance->getConnectList(); + + if (connectList.empty()) { + qWarning()<<"[KyConnectResourse]"<<"kyWirdNetItemListInit failed, the connect list is empty"; + return; + } + + KyNetworkDeviceResourse deviceResource; + QStringList devList; + deviceResource.getNetworkDeviceList(DEVICE_TYPE_ETHERNET, devList); + if (devList.isEmpty()) { + qWarning()<<"[KyConnectResourse]"<<"kyWirdNetItemListInit failed, the device list is empty"; + return; + } else { + for (int i = 0; i < devList.size(); ++i) { + m_wiredNetworkMap.insert(devList.at(i), QList()); + } + } + + NetworkManager::Connection::Ptr connectPtr = nullptr; + for (int index = 0; index < connectList.size(); index++) { + connectPtr = connectList.at(index); + if (connectPtr.isNull()) { + continue; + } + + if (!m_networkResourceInstance->isWiredConnect(connectPtr->path())) { + continue; + } + + KyWiredItem connectItem = getConnectionItem(connectPtr); + if (connectItem.m_connectUuid.isEmpty()) { + continue; + } + + QString connectInterface = connectPtr->settings()->interfaceName(); + if (connectInterface.isEmpty()) { + for (int i = 0; i < m_wiredNetworkMap.keys().size(); ++i) { + m_wiredNetworkMap[m_wiredNetworkMap.keys().at(i)] << connectItem; + } + } else { + if (m_wiredNetworkMap.contains(connectInterface)) { + m_wiredNetworkMap[connectInterface] << connectItem; + } + } + } +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinwirednetresource.h b/libnm-kylin/libnm-base-kylin/depend/kylinwirednetresource.h new file mode 100644 index 00000000..cc238267 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kylinwirednetresource.h @@ -0,0 +1,38 @@ +#ifndef KYLINCONNECTRESOURCE_H +#define KYLINCONNECTRESOURCE_H + +#include +#include "kylinnetworkresourcemanager.h" +#include "kylinnetresource.h" +#include "kylinconnectitem.h" +#include "kylinnetworkdeviceresource.h" +#include "kylinconnectsetting.h" +#include "kylinapconnectitem.h" + +class KyWiredConnectResourse : public KyNetResource +{ + Q_OBJECT +public: + explicit KyWiredConnectResourse(QObject *parent = nullptr); + +public: + void getWiredList(QMap> &map); + + void getWiredConnectDetail(QString interface, QString uuid, KyDetailInfo &connectSetting); +private: + void kyWirdNetItemListInit(); + KyWiredItem getConnectionItem(NetworkManager::Connection::Ptr connectPtr); + +Q_SIGNALS: + void wiredConnectionAdd(QString devName, QString connectUuid, QString connectName, QString connectPath); + void wiredConnectionUpdate(QString devName, QString connectUuid, QString connectName, QString connectPath); + void connectionRemove(QString path); + + void wiredDeviceAdd(QString deviceName); + void wiredDeviceUpdate(QString oldDeviceName, QString newDeviceName); + void deviceRemove(QString deviceName); + +private: + QMap> m_wiredNetworkMap; +}; +#endif // KYLINCONNECTRESOURCE_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kywirelessconnectoperation.cpp b/libnm-kylin/libnm-base-kylin/depend/kywirelessconnectoperation.cpp new file mode 100644 index 00000000..1efc2560 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kywirelessconnectoperation.cpp @@ -0,0 +1,972 @@ +#include "kywirelessconnectoperation.h" +#include "kylinnetworkmanagerutil.h" + +#include + +#define PSK_SETTING_NAME "802-11-wireless-security" +#define PRIVATE_PSK_SETTING_NAME "802-1x" + +NetworkManager::ConnectionSettings::Ptr assembleWpaXPskSettings(NetworkManager::AccessPoint::Ptr accessPoint, QString &psk, bool isAutoConnect) +{ + QByteArray rawSsid = accessPoint->rawSsid(); + QString wifiSsid = getSsidFromByteArray(rawSsid); + + NetworkManager::ConnectionSettings::Ptr settings{new NetworkManager::ConnectionSettings{NetworkManager::ConnectionSettings::Wireless}}; + settings->setId(wifiSsid); + settings->setUuid(NetworkManager::ConnectionSettings::createNewUuid()); + settings->setAutoconnect(isAutoConnect); + //Note: workaround for wrongly (randomly) initialized gateway-ping-timeout + settings->setGatewayPingTimeout(0); + + NetworkManager::WirelessSetting::Ptr wifi_sett + = settings->setting(NetworkManager::Setting::Wireless).dynamicCast(); + wifi_sett->setInitialized(true); + wifi_sett->setSsid(rawSsid); + wifi_sett->setSecurity("802-11-wireless-security"); + + NetworkManager::WirelessSecuritySetting::Ptr security_sett + = settings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + security_sett->setInitialized(true); + if (NetworkManager::AccessPoint::Adhoc == accessPoint->mode()) { + wifi_sett->setMode(NetworkManager::WirelessSetting::Adhoc); + security_sett->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaNone); + } else { + security_sett->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaPsk); + } + if (!psk.isEmpty()) { + security_sett->setPsk(psk); + } + + return settings; +} + +NetworkManager::ConnectionSettings::Ptr assembleSaeSettings(NetworkManager::AccessPoint::Ptr accessPoint, QString &psk, bool isAutoConnect) +{ + QByteArray rawSsid = accessPoint->rawSsid(); + QString wifiSsid = getSsidFromByteArray(rawSsid); + + NetworkManager::ConnectionSettings::Ptr settings{new NetworkManager::ConnectionSettings{NetworkManager::ConnectionSettings::Wireless}}; + settings->setId(wifiSsid); + settings->setUuid(NetworkManager::ConnectionSettings::createNewUuid()); + settings->setAutoconnect(isAutoConnect); + //Note: workaround for wrongly (randomly) initialized gateway-ping-timeout + settings->setGatewayPingTimeout(0); + + NetworkManager::WirelessSetting::Ptr wifi_sett + = settings->setting(NetworkManager::Setting::Wireless).dynamicCast(); + wifi_sett->setInitialized(true); + wifi_sett->setSsid(rawSsid); + wifi_sett->setSecurity("802-11-wireless-security"); + + NetworkManager::WirelessSecuritySetting::Ptr security_sett + = settings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + security_sett->setInitialized(true); + if (NetworkManager::AccessPoint::Adhoc == accessPoint->mode()) { + wifi_sett->setMode(NetworkManager::WirelessSetting::Adhoc); + security_sett->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaNone); + } else { + security_sett->setKeyMgmt(NetworkManager::WirelessSecuritySetting::SAE); + } + if (!psk.isEmpty()) { + security_sett->setPsk(psk); + } + + return settings; +} + +NetworkManager::ConnectionSettings::Ptr assembleWirelessSettings(const NetworkManager::AccessPoint::Ptr accessPointPtr, + const KyWirelessConnectSetting &connSettingInfo, + KyKeyMgmt type, + bool isHidden) +{ + QByteArray rawSsid; + if (nullptr == accessPointPtr || accessPointPtr.isNull()) { + rawSsid = connSettingInfo.m_ssid.toUtf8(); + } else { + rawSsid = accessPointPtr->rawSsid(); + } + + NetworkManager::ConnectionSettings::Ptr settings{new NetworkManager::ConnectionSettings{NetworkManager::ConnectionSettings::Wireless}}; + settings->setId(connSettingInfo.m_connectName); + settings->setUuid(NetworkManager::ConnectionSettings::createNewUuid()); + settings->setAutoconnect(connSettingInfo.m_isAutoConnect); + //Note: workaround for wrongly (randomly) initialized gateway-ping-timeout + settings->setGatewayPingTimeout(0); + settings->setInterfaceName(connSettingInfo.m_ifaceName); + + NetworkManager::WirelessSetting::Ptr wifi_sett + = settings->setting(NetworkManager::Setting::Wireless).dynamicCast(); + wifi_sett->setInitialized(true); + wifi_sett->setSsid(rawSsid); + wifi_sett->setSecurity("802-11-wireless-security"); + wifi_sett->setHidden(isHidden); + + + if (type != KyKeyMgmt::WpaNone && type != KyKeyMgmt::Unknown) + { + NetworkManager::WirelessSecuritySetting::Ptr security_sett + = settings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + security_sett->setInitialized(true); + security_sett->setKeyMgmt((NetworkManager::WirelessSecuritySetting::KeyMgmt)type); + if (KyKeyMgmt::SAE == type || KyKeyMgmt::WpaPsk == type) + { + security_sett->setPsk(connSettingInfo.m_psk); + } + } + return settings; +} + + +KyWirelessConnectOperation::KyWirelessConnectOperation(QObject *parent) : KyConnectOperation(parent) +{ +} + +void KyWirelessConnectOperation::requestWirelessScan() +{ + NetworkManager::Device::List deviceList = m_networkResourceInstance->getNetworkDeviceList(); + + for (auto const & dev : deviceList) { + auto spec_dev = dev->as(); + if (nullptr != spec_dev) { + m_networkResourceInstance->requestScan(spec_dev); + } + } +} + +//普通wifi +void KyWirelessConnectOperation::addConnect(const KyWirelessConnectSetting &connSettingInfo, KySecuType &type) +{ + KyKeyMgmt mgmt; + if (type == NONE) { + mgmt = WpaNone; + } else if (type == WPA_AND_WPA2_PERSONAL) { + mgmt = WpaPsk; + } else if (type == WPA3_PERSONAL) { + mgmt = WpaEap; + } else { + return; + } + + NetworkManager::WirelessNetwork::Ptr wifiNet = + checkWifiNetExist(connSettingInfo.m_ssid, connSettingInfo.m_ifaceName); + if (wifiNet.isNull()) { + QString errorMessage = "the ssid " + connSettingInfo.m_ssid + + " is not exsit in " + connSettingInfo.m_ifaceName; + qWarning()<referenceAccessPoint(); + NetworkManager::ConnectionSettings::Ptr connSetting = + assembleWirelessSettings(accessPointPtr, connSettingInfo, mgmt, false); + setIpv4AndIpv6Setting(connSetting, connSettingInfo); + + QDBusPendingCallWatcher * watcher; + watcher = new QDBusPendingCallWatcher{NetworkManager::addConnection(connSetting->toMap()), this}; + connect(watcher, &QDBusPendingCallWatcher::finished, [this](QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMessage = tr("create wireless connection failed: ") + watcher->error().message(); + qWarning()<createConnectionError(errorMessage); + } + watcher->deleteLater(); + }); +} +//tls +void KyWirelessConnectOperation::addTlsConnect(const KyWirelessConnectSetting &connSettingInfo, const KyEapMethodTlsInfo &tlsInfo) +{ + + NetworkManager::WirelessNetwork::Ptr wifiNet = + checkWifiNetExist(connSettingInfo.m_ssid, connSettingInfo.m_ifaceName); + if (wifiNet.isNull()) { + QString errorMessage = "the ssid " + connSettingInfo.m_ssid + + " is not exsit in " + connSettingInfo.m_ifaceName; + qWarning() << errorMessage; + Q_EMIT createConnectionError(errorMessage); + return; + } + + NetworkManager::AccessPoint::Ptr accessPointPtr = wifiNet->referenceAccessPoint(); + NetworkManager::ConnectionSettings::Ptr connSetting = + assembleWirelessSettings(accessPointPtr, connSettingInfo, WpaEap, false); + setIpv4AndIpv6Setting(connSetting, connSettingInfo); + assembleEapMethodTlsSettings(connSetting, tlsInfo); + + QDBusPendingCallWatcher * watcher; + watcher = new QDBusPendingCallWatcher{NetworkManager::addConnection(connSetting->toMap()), this}; + connect(watcher, &QDBusPendingCallWatcher::finished, [this](QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMessage = tr("create wireless tls connection failed: ") + watcher->error().message(); + qWarning()<createConnectionError(errorMessage); + } + watcher->deleteLater(); + }); + +} +//peap +void KyWirelessConnectOperation::addPeapConnect(const KyWirelessConnectSetting &connSettingInfo, const KyEapMethodPeapInfo &peapInfo) +{ + NetworkManager::WirelessNetwork::Ptr wifiNet = + checkWifiNetExist(connSettingInfo.m_ssid, connSettingInfo.m_ifaceName); + if (wifiNet.isNull()) { + QString errorMessage = "the ssid " + connSettingInfo.m_ssid + + " is not exsit in " + connSettingInfo.m_ifaceName; + qWarning()<referenceAccessPoint(); + NetworkManager::ConnectionSettings::Ptr connSetting = + assembleWirelessSettings(accessPointPtr, connSettingInfo, WpaEap, false); + setIpv4AndIpv6Setting(connSetting, connSettingInfo); + assembleEapMethodPeapSettings(connSetting, peapInfo); + + QDBusPendingCallWatcher * watcher; + watcher = new QDBusPendingCallWatcher{NetworkManager::addConnection(connSetting->toMap()), this}; + connect(watcher, &QDBusPendingCallWatcher::finished, [this](QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMessage = tr("create wireless peap connection failed: ") + watcher->error().message(); + qWarning()<createConnectionError(errorMessage); + } + watcher->deleteLater(); + }); +} + +void KyWirelessConnectOperation::addTtlsConnect(const KyWirelessConnectSetting &connSettingInfo, const KyEapMethodTtlsInfo &ttlsInfo) +{ + NetworkManager::WirelessNetwork::Ptr wifiNet = + checkWifiNetExist(connSettingInfo.m_ssid, connSettingInfo.m_ifaceName); + if (wifiNet.isNull()) { + QString errorMessage = "the ssid " + connSettingInfo.m_ssid + + " is not exsit in " + connSettingInfo.m_ifaceName; + qWarning()<referenceAccessPoint(); + NetworkManager::ConnectionSettings::Ptr connSetting = + assembleWirelessSettings(accessPointPtr, connSettingInfo, WpaEap, false); + setIpv4AndIpv6Setting(connSetting, connSettingInfo); + assembleEapMethodTtlsSettings(connSetting, ttlsInfo); + + QDBusPendingCallWatcher * watcher; + watcher = new QDBusPendingCallWatcher{NetworkManager::addConnection(connSetting->toMap()), this}; + connect(watcher, &QDBusPendingCallWatcher::finished, [this](QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMessage = tr("create wireless ttls connection failed: ") + watcher->error().message(); + qWarning()<createConnectionError(errorMessage); + } + watcher->deleteLater(); + }); + + return; +} + +void KyWirelessConnectOperation::setWirelessAutoConnect(const QString &uuid, bool bAutoConnect) +{ + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(uuid); + if (nullptr == connectPtr) { + QString errorMessage = tr("it can not find connection") + uuid; + qWarning()<settings(); + setAutoConnect(connectionSettings, bAutoConnect); + connectPtr->update(connectionSettings->toMap()); +} + +QString KyWirelessConnectOperation::getPsk(const QString &connectUuid) +{ + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(connectUuid); + if (connectPtr.isNull()) { + QString errorMessage = tr("it can not find connection") + connectUuid; + qWarning()< reply = connectPtr->secrets(PSK_SETTING_NAME); + QMap map(reply.value()); + if (map.contains("802-11-wireless-security") + && map.value("802-11-wireless-security").contains("psk")) { + QString psk = map.value("802-11-wireless-security").value("psk").toString(); + return psk; + } + return ""; +} + +QString KyWirelessConnectOperation::getPrivateKeyPassword(const QString &connectUuid) +{ + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(connectUuid); + if (connectPtr.isNull()) { + QString errorMessage = tr("it can not find connection") + connectUuid; + qWarning()< reply = connectPtr->secrets(PRIVATE_PSK_SETTING_NAME); + QMap map(reply.value()); + if (map.contains("802-1x") + && map.value("802-1x").contains("private-key-password")) { + QString psk = map.value("802-1x").value("private-key-password").toString(); + return psk; + } + return ""; +} + +QString KyWirelessConnectOperation::get8021xPassword(const QString &connectUuid) +{ + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(connectUuid); + if (connectPtr.isNull()) { + QString errorMessage = tr("it can not find connection") + connectUuid; + qWarning()< reply = connectPtr->secrets(PRIVATE_PSK_SETTING_NAME); + QMap map(reply.value()); + if (map.contains("802-1x") && map.value("802-1x").contains("password")) + { + QString psk = map.value("802-1x").value("password").toString(); + return psk; + } + return ""; +} + +void KyWirelessConnectOperation::updateIpv4AndIpv6SettingInfo(const QString &uuid, const KyConnectSetting &connectSettingsInfo) +{ + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(uuid); + if (nullptr == connectPtr) { + QString errorMessage = tr("it can not find connection") + uuid; + qWarning()<settings(); + + setIpv4AndIpv6Setting(connectionSettings,connectSettingsInfo); + connectPtr->update(connectionSettings->toMap()); + return; +} + +void KyWirelessConnectOperation::updateWirelessPersonalConnect(const QString &uuid, const KyWirelessConnectSetting &connSettingInfo, bool bPwdChange) +{ + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(uuid); + if (nullptr == connectPtr) { + QString errorMessage = tr("it can not find connection") + uuid; + qWarning()<settings(); + + NetworkManager::Security8021xSetting::Ptr wifi_8021x_sett + = connectionSettings->setting(NetworkManager::Setting::Security8021x).dynamicCast(); + wifi_8021x_sett->setInitialized(false); + + updateWirelessSecu(connectionSettings, connSettingInfo, bPwdChange); + connectPtr->update(connectionSettings->toMap()); + return; +} + +void KyWirelessConnectOperation::updateWirelessEnterPriseTlsConnect(const QString &uuid, const KyEapMethodTlsInfo &tlsInfo) +{ + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(uuid); + if (connectPtr.isNull()) { + QString errorMessage = tr("it can not find connection") + uuid; + qWarning()<settings(); + + setWirelessSecuWpaXEap(connectionSettings); + modifyEapMethodTlsSettings(connectionSettings, tlsInfo); + connectPtr->update(connectionSettings->toMap()); + return; +} + +void KyWirelessConnectOperation::updateWirelessEnterPrisePeapConnect(const QString &uuid, const KyEapMethodPeapInfo &peapInfo) +{ + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(uuid); + if (nullptr == connectPtr) { + QString errorMessage = tr("it can not find connection") + uuid; + qWarning()<settings(); + + setWirelessSecuWpaXEap(connectionSettings); + modifyEapMethodPeapSettings(connectionSettings, peapInfo); + connectPtr->update(connectionSettings->toMap()); + return; +} + +void KyWirelessConnectOperation::updateWirelessEnterPriseTtlsConnect(const QString &uuid, const KyEapMethodTtlsInfo &ttlsInfo) +{ + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(uuid); + if (nullptr == connectPtr) { + QString errorMessage = tr("it can not find connection") + uuid; + qWarning()<settings(); + + setWirelessSecuWpaXEap(connectionSettings); + modifyEapMethodTtlsSettings(connectionSettings, ttlsInfo); + connectPtr->update(connectionSettings->toMap()); + return; +} + +void KyWirelessConnectOperation::addAndActiveWirelessConnect(KyWirelessConnectSetting &connSettingInfo, KySecuType &type) +{ + KyKeyMgmt mgmt; + if (type == NONE) { + mgmt = WpaNone; + } else if (type == WPA_AND_WPA2_PERSONAL) { + mgmt = WpaPsk; + } else if (type == WPA3_PERSONAL) { + mgmt = WpaEap; + } else { + return; + } + + QString devIface = connSettingInfo.m_ifaceName; + QString conn_uni, dev_uni, conn_name, spec_object; + NMVariantMapMap map_settings; + + //检测wifi是否存在 + NetworkManager::WirelessNetwork::Ptr wifiNet = checkWifiNetExist(connSettingInfo.m_ssid, devIface); + if (!connSettingInfo.isHidden && wifiNet.isNull()) { + QString errorMessage = "the ssid " + connSettingInfo.m_ssid + " is not exsit in " + devIface; + qWarning() << errorMessage; + Q_EMIT activateConnectionError(errorMessage); + return; + } + //配置生成 + auto dev = m_networkResourceInstance->findDeviceByName(devIface); + if (dev.isNull()) { + return; + } + + dev_uni = dev->uni(); + auto spec_dev = dev->as(); + if (!connSettingInfo.isHidden) { + //非隐藏wifi + auto access_point = wifiNet->referenceAccessPoint(); + conn_uni = access_point->uni(); + conn_name = access_point->ssid(); + spec_object = conn_uni; + + NetworkManager::WirelessSecurityType sec_type = NetworkManager::findBestWirelessSecurity(spec_dev->wirelessCapabilities() + , true, (spec_dev->mode() == NetworkManager::WirelessDevice::Adhoc) + , access_point->capabilities(), access_point->wpaFlags(), access_point->rsnFlags()); + NetworkManager::ConnectionSettings::Ptr settings = nullptr; + switch (sec_type) + { + case NetworkManager::UnknownSecurity: + qWarning() << QStringLiteral("unknown security to use for '%1'").arg(conn_name); + case NetworkManager::NoneSecurity: + //nothing to do + break; + case NetworkManager::WpaPsk: + case NetworkManager::Wpa2Psk: + settings = assembleWpaXPskSettings(access_point, connSettingInfo.m_psk, connSettingInfo.m_isAutoConnect); + if (nullptr != settings) { + map_settings = settings->toMap(); + } else { + qWarning() << QStringLiteral("connection settings assembly for '%1' failed, abandoning activation...").arg(conn_name); + return; + } + break; + case NetworkManager::SAE: + settings = assembleSaeSettings(access_point, connSettingInfo.m_psk, connSettingInfo.m_isAutoConnect); + if (nullptr != settings) { + map_settings = settings->toMap(); + } else { + qWarning() << QStringLiteral("connection settings assembly for '%1' failed, abandoning activation...").arg(conn_name); + return; + } + break; + //TODO:其他加密类型 + default: + qWarning() << "addAndActiveWirelessConnect not support"; + return; + } + } else { + //隐藏wifi + map_settings = assembleWirelessSettings(nullptr, connSettingInfo, mgmt, connSettingInfo.isHidden)->toMap(); + } + //激活 + QDBusPendingCallWatcher * watcher; + watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this}; + connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMessage = watcher->error().message(); + qWarning() << "activation of connection failed " << errorMessage; + } + watcher->deleteLater(); + }); +} + +void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTlsConnect(KyEapMethodTlsInfo &info, KyWirelessConnectSetting &connSettingInfo) +{ + QString devIface = connSettingInfo.m_ifaceName; + QString conn_uni, dev_uni, spec_object; + NMVariantMapMap map_settings; + NetworkManager::AccessPoint::Ptr accessPointPtr = nullptr; + + if (!connSettingInfo.isHidden) { + NetworkManager::WirelessNetwork::Ptr wifiNet = checkWifiNetExist(connSettingInfo.m_ssid, devIface); + if (wifiNet.isNull()) { + QString errorMessage = "the ssid " + connSettingInfo.m_ssid + " is not exsit in " + devIface; + qWarning()<referenceAccessPoint(); + conn_uni = accessPointPtr->uni(); + spec_object = conn_uni; + } + + auto dev = m_networkResourceInstance->findDeviceByName(devIface); + if (dev.isNull()) { + return; + } + dev_uni = dev->uni(); + + NetworkManager::ConnectionSettings::Ptr settings = assembleWirelessSettings(accessPointPtr, connSettingInfo, WpaEap, connSettingInfo.isHidden); + assembleEapMethodTlsSettings(settings, info); + + if(settings.isNull()) { + qWarning() << "assembleEapMethodTlsSettings failed"; + return; + } + + map_settings = settings->toMap(); + + QDBusPendingCallWatcher * watcher; + watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this}; + connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMessage = watcher->error().message(); + qWarning() << "addAndActiveWirelessEnterPriseTlsConnect failed " << errorMessage; + } + watcher->deleteLater(); + }); + +} + +void KyWirelessConnectOperation::addAndActiveWirelessEnterPrisePeapConnect(KyEapMethodPeapInfo &info, KyWirelessConnectSetting &connSettingInfo) +{ + qDebug() << "addAndActiveWirelessEnterPrisePeapConnect"; + QString devIface = connSettingInfo.m_ifaceName; + QString conn_uni, dev_uni, spec_object; + NMVariantMapMap map_settings; + NetworkManager::AccessPoint::Ptr accessPointPtr = nullptr; + + if (!connSettingInfo.isHidden) { + NetworkManager::WirelessNetwork::Ptr wifiNet = checkWifiNetExist(connSettingInfo.m_ssid, devIface); + if (wifiNet.isNull()) { + QString errorMessage = "the ssid " + connSettingInfo.m_ssid + " is not exsit in " + devIface; + qWarning() << errorMessage; + Q_EMIT activateConnectionError(errorMessage); + return; + } + + accessPointPtr = wifiNet->referenceAccessPoint(); + conn_uni = accessPointPtr->uni(); + spec_object = conn_uni; + } + + auto dev = m_networkResourceInstance->findDeviceByName(devIface); + if (dev.isNull()) { + return; + } + dev_uni = dev->uni(); + + NetworkManager::ConnectionSettings::Ptr settings = + assembleWirelessSettings(accessPointPtr, connSettingInfo, WpaEap, connSettingInfo.isHidden); + assembleEapMethodPeapSettings(settings, info); + + if(settings.isNull()) { + qWarning() << "assembleEapMethodPeapSettings failed"; + return; + } + map_settings = settings->toMap(); + + QDBusPendingCallWatcher * watcher; + watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this}; + connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMessage = watcher->error().message(); + qWarning() << "addAndActiveWirelessEnterPrisePeapConnect failed " << errorMessage; + } + watcher->deleteLater(); + }); + +} + +void KyWirelessConnectOperation::addAndActiveWirelessEnterPriseTtlsConnect(KyEapMethodTtlsInfo &info, KyWirelessConnectSetting &connSettingInfo) +{ + QString devIface = connSettingInfo.m_ifaceName; + QString conn_uni, dev_uni, spec_object; + NMVariantMapMap map_settings; + NetworkManager::AccessPoint::Ptr accessPointPtr = nullptr; + + if (!connSettingInfo.isHidden) { + NetworkManager::WirelessNetwork::Ptr wifiNet = checkWifiNetExist(connSettingInfo.m_ssid, devIface); + if (wifiNet.isNull()) { + QString errorMessage = "the ssid " + connSettingInfo.m_ssid + " is not exsit in " + devIface; + qWarning()<referenceAccessPoint(); + conn_uni = accessPointPtr->uni(); + spec_object = conn_uni; + } + + auto dev = m_networkResourceInstance->findDeviceByName(devIface); + if (dev.isNull()) { + return; + } + dev_uni = dev->uni(); + + NetworkManager::ConnectionSettings::Ptr settings = + assembleWirelessSettings(accessPointPtr, connSettingInfo, WpaEap, connSettingInfo.isHidden); + assembleEapMethodTtlsSettings(settings, info); + + if(settings.isNull()) { + qWarning() << "assembleEapMethodTtlsSettings failed"; + return; + } + + map_settings = settings->toMap(); + + QDBusPendingCallWatcher * watcher; + watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(map_settings, dev_uni, spec_object), this}; + connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMessage = watcher->error().message(); + qWarning() << "addAndActiveWirelessEnterPriseTtlsConnect failed " << errorMessage; + } + watcher->deleteLater(); + }); +} + +bool KyWirelessConnectOperation::getConnSecretFlags(QString &connUuid, NetworkManager::Setting::SecretFlags &flag) +{ + NetworkManager::Connection::Ptr conn; + conn = m_networkResourceInstance->findConnectByUuid(connUuid); + if (conn.isNull()) { + qWarning() <<"get failed"; + return false; + } + + NetworkManager::WirelessSecuritySetting::Ptr security_sett + = conn->settings()->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + flag = security_sett->pskFlags(); + return true; +} + +NetworkManager::ConnectionSettings::Ptr + KyWirelessConnectOperation::createWirelessApSetting(const QString apSsid, + const QString apPassword, + const QString apDevice, + const QString wirelessBand) +{ + NetworkManager::ConnectionSettings::Ptr connectionSettings = + NetworkManager::ConnectionSettings::Ptr(new NetworkManager::ConnectionSettings(NetworkManager::ConnectionSettings::Wireless)); + connectionSettings->setId(apSsid); + connectionSettings->setUuid(NetworkManager::ConnectionSettings::createNewUuid()); + connectionSettings->setAutoconnect(false); + connectionSettings->setAutoconnectPriority(0); + connectionSettings->setInterfaceName(apDevice); + //Note: workaround for wrongly (randomly) initialized gateway-ping-timeout + connectionSettings->setGatewayPingTimeout(0); + + NetworkManager::Ipv4Setting::Ptr ipv4Setting = connectionSettings->setting(NetworkManager::Setting::Ipv4).dynamicCast(); + ipv4Setting->setInitialized(true); + ipv4Setting->setMethod(NetworkManager::Ipv4Setting::Shared); + + NetworkManager::Ipv6Setting::Ptr ipv6Setting = connectionSettings->setting(NetworkManager::Setting::Ipv6).dynamicCast(); + ipv6Setting->setInitialized(true); + ipv6Setting->setMethod(NetworkManager::Ipv6Setting::Ignored); + + NetworkManager::WirelessSetting::Ptr wirelessSetting + = connectionSettings->setting(NetworkManager::Setting::Wireless).dynamicCast(); + wirelessSetting->setInitialized(true); + wirelessSetting->setSsid(apSsid.toUtf8()); + wirelessSetting->setMode(NetworkManager::WirelessSetting::NetworkMode::Ap); + wirelessSetting->setSecurity("802-11-wireless-security"); + if (wirelessBand == WIFI_BAND_2_4GHZ) { + wirelessSetting->setBand(NetworkManager::WirelessSetting::FrequencyBand::Bg); + } else if (wirelessBand == WIFI_BAND_5GHZ) { + wirelessSetting->setBand(NetworkManager::WirelessSetting::FrequencyBand::A); + } else { + qWarning()<<"[KyWirelessConnectOperation] the band type undefined"<setBand(NetworkManager::WirelessSetting::FrequencyBand::Automatic); + } + + + NetworkManager::WirelessSecuritySetting::Ptr wirelessSecuritySetting + = connectionSettings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + if (apPassword.isEmpty()) { + wirelessSecuritySetting->setInitialized(false); + } else { + wirelessSecuritySetting->setInitialized(true); + wirelessSecuritySetting->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaPsk); + wirelessSecuritySetting->setPsk(apPassword); + } + + return connectionSettings; +} + +void KyWirelessConnectOperation::updateWirelessApSetting( + NetworkManager::Connection::Ptr apConnectPtr, + const QString apName, const QString apPassword, + const QString apDevice, const QString wirelessBand) + +{ + NetworkManager::ConnectionSettings::Ptr apConnectSettingPtr = apConnectPtr->settings(); + apConnectSettingPtr->setId(apName); + apConnectSettingPtr->setInterfaceName(apDevice); + apConnectSettingPtr->setAutoconnect(false); + + NetworkManager::WirelessSetting::Ptr wirelessSetting + = apConnectSettingPtr->setting(NetworkManager::Setting::Wireless).dynamicCast(); + wirelessSetting->setInitialized(true); + wirelessSetting->setSsid(apName.toUtf8()); + if (wirelessBand == WIFI_BAND_2_4GHZ) { + wirelessSetting->setBand(NetworkManager::WirelessSetting::FrequencyBand::Bg); + } else if (wirelessBand == WIFI_BAND_5GHZ) { + wirelessSetting->setBand(NetworkManager::WirelessSetting::FrequencyBand::A); + } else { + qWarning()<<"[KyWirelessConnectOperation] the band type undefined"<setBand(NetworkManager::WirelessSetting::FrequencyBand::Automatic); + } + + + NetworkManager::WirelessSecuritySetting::Ptr wirelessSecuritySetting + = apConnectSettingPtr->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + if (apPassword.isEmpty()) { + wirelessSecuritySetting->setInitialized(false); + } else { + wirelessSecuritySetting->setInitialized(true); + wirelessSecuritySetting->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaPsk); + wirelessSecuritySetting->setPsk(apPassword); + } + + apConnectPtr->update(apConnectSettingPtr->toMap()); +} + +void KyWirelessConnectOperation::activeWirelessAp(const QString apUuid, const QString apName, + const QString apPassword, const QString apDevice, + const QString wirelessBand) + +{ + //1、检查连接是否存在 + NetworkManager::Connection::Ptr connectPtr = m_networkResourceInstance->findConnectByUuid(apUuid); + if (nullptr == connectPtr) { + NetworkManager::Device::Ptr devicePtr = m_networkResourceInstance->findDeviceByName(apDevice); + if (devicePtr.isNull()) { + QString errorMsg ="Create hotspot faild. " + apDevice + " is not existed"; + qWarning()<< errorMsg; + return; + } + + QString deviceIdentifier = devicePtr->uni(); + + NetworkManager::ConnectionSettings::Ptr apConnectSettingPtr = + createWirelessApSetting(apName, apPassword, apDevice, wirelessBand); + QString specificObject = ""; + QDBusPendingCallWatcher * watcher; + watcher = new QDBusPendingCallWatcher{NetworkManager::addAndActivateConnection(apConnectSettingPtr->toMap(), deviceIdentifier, specificObject), this}; + connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMsg = "Create hotspot faild. " + watcher->error().message(); + qWarning() << errorMsg; + } + watcher->deleteLater(); + }); + } else { + updateWirelessApSetting(connectPtr, apName, apPassword, apDevice, wirelessBand); + QTimer::singleShot(500, this, [=](){ + activateApConnectionByUuid(apUuid, apDevice); + }); + } +} + +void KyWirelessConnectOperation::deactiveWirelessAp(const QString apName, const QString apUuid) +{ + deactivateConnection(apUuid); +} + +//private +NetworkManager::WirelessNetwork::Ptr KyWirelessConnectOperation::checkWifiNetExist(QString ssid, QString devName) +{ + NetworkManager::WirelessNetwork::List wifiNetList = m_networkResourceInstance->getWifiNetworkList(); + + for (auto const & net : wifiNetList) { + auto dev = m_networkResourceInstance->findDeviceByUni(net->device()); + if (dev == nullptr) { + continue; + } + + if (dev->type() != NetworkManager::Device::Wifi || dev->interfaceName() != devName) { + continue; + } + + NetworkManager::AccessPoint::Ptr accessPointPtr = net->referenceAccessPoint(); + QByteArray rawSsid = accessPointPtr->rawSsid(); + QString wifiSsid = getSsidFromByteArray(rawSsid); + + if (ssid == wifiSsid) { + return net; + } + } + + return nullptr; +} + +KyKeyMgmt KyWirelessConnectOperation::getConnectKeyMgmt(const QString &uuid) +{ + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(uuid); + if (connectPtr.isNull()) { + return KyKeyMgmt::Unknown; + } + + NetworkManager::WirelessSecuritySetting::Ptr security_sett + = connectPtr->settings()->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + + if(security_sett.isNull()) { + return KyKeyMgmt::Unknown; + } + return (KyKeyMgmt)security_sett->keyMgmt(); +} + +KySecuType KyWirelessConnectOperation::getConnectSecuType(const QString &uuid) +{ + KyKeyMgmt type = getConnectKeyMgmt(uuid); + if (type == WpaNone) { + return KySecuType::NONE; + } else if (type == WpaPsk) { + return KySecuType::WPA_AND_WPA2_PERSONAL; + } else if (type == SAE) { + return KySecuType::WPA3_PERSONAL; + } else if (type == WpaEap) { + return KySecuType::WPA_AND_WPA2_ENTERPRISE; + } else { + qWarning() << "KeyMgmt not support now " << type; + return KySecuType::UNKNOWN; + } +} + +void KyWirelessConnectOperation::updateWirelessSecu(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyWirelessConnectSetting &connSettingInfo, bool bPwdChange) +{ + NetworkManager::WirelessSecuritySetting::Ptr security_sett + = connSettingPtr->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + + KyKeyMgmt type = getConnectKeyMgmt(connSettingPtr->uuid()); + if (type == WpaNone) { + security_sett->setInitialized(false); + return; + } else { + security_sett->setInitialized(true); + } + security_sett->setKeyMgmt((NetworkManager::WirelessSecuritySetting::KeyMgmt)type); + if (bPwdChange) { + security_sett->setPsk(connSettingInfo.m_psk); + NetworkManager::Setting::SecretFlags flag = NetworkManager::Setting::None; + security_sett->setPskFlags(flag); + } +} + +void KyWirelessConnectOperation::setWirelessSecuWpaXEap(NetworkManager::ConnectionSettings::Ptr connSettingPtr) +{ + NetworkManager::WirelessSecuritySetting::Ptr security_sett + = connSettingPtr->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + + security_sett->setInitialized(true); + security_sett->setKeyMgmt(NetworkManager::WirelessSecuritySetting::KeyMgmt::WpaEap); +} + +void KyWirelessConnectOperation::setIpv4AndIpv6Setting(NetworkManager::ConnectionSettings::Ptr connSetting, const KyConnectSetting &connSettingInfo) +{ + NetworkManager::Ipv4Setting::Ptr ipv4Setting = connSetting->setting(NetworkManager::Setting::Ipv4).dynamicCast(); + ipv4SettingSet(ipv4Setting, connSettingInfo); + + NetworkManager::Ipv6Setting::Ptr ipv6Setting = connSetting->setting(NetworkManager::Setting::Ipv6).dynamicCast(); + ipv6SettingSet(ipv6Setting, connSettingInfo); +} + +void KyWirelessConnectOperation::activateApConnectionByUuid(const QString apUuid, const QString apDevice) +{ + QString connectPath = ""; + QString deviceIdentifier = ""; + QString connectName = ""; + QString specificObject = ""; + + NetworkManager::Connection::Ptr connectPtr = m_networkResourceInstance->findConnectByUuid(apUuid); + if (connectPtr.isNull()) + { + QString errorMessage = tr("Create hotspot faild.UUID is empty, its name") + apUuid; + qWarning() << errorMessage; + Q_EMIT activateConnectionError(errorMessage); + return; + } + connectPath = connectPtr->path(); + connectName = connectPtr->name(); + + auto dev = m_networkResourceInstance->findDeviceByName(apDevice); + if (!dev.isNull()) { + deviceIdentifier = dev->uni(); + } + + if (deviceIdentifier.isEmpty()) { + QString errorMessage = tr("Create hotspot faild.Device Identifier is empty, its name") + apDevice; + qWarning() << errorMessage; + Q_EMIT activateConnectionError(errorMessage); + return ; + } + + QDBusPendingCallWatcher * watcher; + watcher = new QDBusPendingCallWatcher{NetworkManager::activateConnection(connectPath, deviceIdentifier, specificObject), this}; + connect(watcher, &QDBusPendingCallWatcher::finished, [this, connectName, apDevice] (QDBusPendingCallWatcher * watcher) { + if (watcher->isError() || !watcher->isValid()) { + QString errorMessage = tr("Create hotspot faild. ") + watcher->error().message(); + qWarning()<activateConnectionError(errorMessage); + } else { + qWarning()<<"active wired connect complete."; + } + + watcher->deleteLater(); + }); +} + +bool KyWirelessConnectOperation::isApConnection(QString uuid) +{ + NetworkManager::Connection::Ptr connectPtr = nullptr; + + connectPtr = m_networkResourceInstance->findConnectByUuid(uuid); + return m_networkResourceInstance->isApConnection(connectPtr); +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kywirelessconnectoperation.h b/libnm-kylin/libnm-base-kylin/depend/kywirelessconnectoperation.h new file mode 100644 index 00000000..7481f07d --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kywirelessconnectoperation.h @@ -0,0 +1,116 @@ +#ifndef KYWIRELESSCONNECTOPERATION_H +#define KYWIRELESSCONNECTOPERATION_H + +#include +#include +#include "kyenterpricesettinginfo.h" +#include "kylinconnectoperation.h" +#include "kyenterpricesettinginfo.h" + +const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch"; +const QString WIRELESS_SWITCH = "wirelessswitch"; + +const QString WIFI_BAND_2_4GHZ = "2.4Ghz"; +const QString WIFI_BAND_5GHZ = "5Ghz"; + +enum KySecuType { + UNKNOWN, + NONE, + WPA_AND_WPA2_PERSONAL, + WPA_AND_WPA2_ENTERPRISE, + WPA3_PERSONAL, +}; + +enum KyKeyMgmt { + Unknown = -1, + Wep, Ieee8021x, + WpaNone, + WpaPsk, + WpaEap, + SAE +}; + +class KyWirelessConnectSetting : public KyConnectSetting +{ +public: + QString m_ssid; + QString m_psk; + NetworkManager::Setting::SecretFlags m_secretFlag = NetworkManager::Setting::SecretFlagType::None; + bool isHidden = false; +}; + + +class KyWirelessConnectOperation : public KyConnectOperation +{ + Q_OBJECT +public: + explicit KyWirelessConnectOperation(QObject *parent = nullptr); + +public: + + void requestWirelessScan(); + //获取密码保存策略 + bool getConnSecretFlags(QString &connUuid, NetworkManager::Setting::SecretFlags &); + + //获取KeyMgmt + KyKeyMgmt getConnectKeyMgmt(const QString &uuid); + KySecuType getConnectSecuType(const QString &uuid); + + //激活连接 + void activeWirelessConnect(QString , QString); + //断开连接 + void deActivateWirelessConnection(const QString activeConnectName, const QString &activeConnectUuid); + //新增普通连接 + void addConnect(const KyWirelessConnectSetting &connSettingInfo, KySecuType &type); + //新增TLS连接 + void addTlsConnect(const KyWirelessConnectSetting &connSettingInfo, const KyEapMethodTlsInfo &tlsinfo); + //新增PEAP连接 + void addPeapConnect(const KyWirelessConnectSetting &connSettingInfo, const KyEapMethodPeapInfo &peapInfo); + //新增TTLS连接 + void addTtlsConnect(const KyWirelessConnectSetting &connSettingInfo, const KyEapMethodTtlsInfo &ttlsInfo); + //新增连接并激活(普通wifi) + void addAndActiveWirelessConnect(KyWirelessConnectSetting &connSettingInfo, KySecuType &type); + + //新增连接并激活(企业wifi) + void addAndActiveWirelessEnterPriseTlsConnect(KyEapMethodTlsInfo &info, KyWirelessConnectSetting &connSettingInfo); + void addAndActiveWirelessEnterPrisePeapConnect(KyEapMethodPeapInfo &info, KyWirelessConnectSetting &connSettingInfo); + void addAndActiveWirelessEnterPriseTtlsConnect(KyEapMethodTtlsInfo &info, KyWirelessConnectSetting &connSettingInfo); + //属性页 page1 AutoConnect + void setWirelessAutoConnect(const QString &uuid, bool bAutoConnect); + //属性页 page2 page3 ipv6 + void updateIpv4AndIpv6SettingInfo(const QString &uuid, const KyConnectSetting &connectSettingsInfo); + //属性页 page4 wifi Security + //连接修改(安全改为个人/None) + void updateWirelessPersonalConnect(const QString &uuid, const KyWirelessConnectSetting &connSettingInfo, bool bPwdChange); + //连接修改(安全改为改为企业) + void updateWirelessEnterPriseTlsConnect(const QString &uuid, const KyEapMethodTlsInfo &tlsinfo); + void updateWirelessEnterPrisePeapConnect(const QString &uuid, const KyEapMethodPeapInfo &peapInfo); + void updateWirelessEnterPriseTtlsConnect(const QString &uuid, const KyEapMethodTtlsInfo &ttlsInfo); + //忘记 + void deleteWirelessConnect(const QString &connectUuid); + //获取密码 + QString getPsk(const QString &connectUuid); + QString getPrivateKeyPassword(const QString &connectUuid); + QString get8021xPassword(const QString &connectUuid); + + void activeWirelessAp(const QString apUuid, const QString apName, + const QString apPassword, const QString apDevice, + const QString wirelessBand); + void deactiveWirelessAp(const QString apName, const QString apUuid); + + bool isApConnection(QString uuid); + +private: + NetworkManager::ConnectionSettings::Ptr createWirelessApSetting(const QString apSsid, + const QString apPassword, const QString apDevice, const QString wirelessBand); + void updateWirelessApSetting(NetworkManager::Connection::Ptr apConnectPtr, const QString apName, + const QString apPassword, const QString apDevice, const QString wirelessBand); + + NetworkManager::WirelessNetwork::Ptr checkWifiNetExist(QString ssid, QString devName); + void updateWirelessSecu(NetworkManager::ConnectionSettings::Ptr connSettingPtr, const KyWirelessConnectSetting &connSettingInfo, bool bPwdChange = false); + void setIpv4AndIpv6Setting(NetworkManager::ConnectionSettings::Ptr connSetting, const KyConnectSetting &connSettingInfo); + void setWirelessSecuWpaXEap(NetworkManager::ConnectionSettings::Ptr connSettingPtr); + void activateApConnectionByUuid(const QString apUuid, const QString apDevice); +}; + +#endif // KYWIRELESSCONNECTOPERATION_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kywirelessnetitem.cpp b/libnm-kylin/libnm-base-kylin/depend/kywirelessnetitem.cpp new file mode 100644 index 00000000..81208fdd --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kywirelessnetitem.cpp @@ -0,0 +1,10 @@ +#include "kywirelessnetitem.h" + +KyWirelessNetItem::KyWirelessNetItem() +{ + m_NetSsid = ""; + m_connectUuid = ""; + m_connectSecuType = KySecuType::NONE; + m_secuType = ""; + m_signalStrength = 0; +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kywirelessnetitem.h b/libnm-kylin/libnm-base-kylin/depend/kywirelessnetitem.h new file mode 100644 index 00000000..cf4191b2 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kywirelessnetitem.h @@ -0,0 +1,19 @@ +#ifndef KYWIRELESSNETITEM_H +#define KYWIRELESSNETITEM_H + +#include +#include "kywirelessconnectoperation.h" + +class KyWirelessNetItem +{ +public: + QString m_NetSsid = ""; + QString m_connectUuid = ""; + QString m_dbusPath = ""; + KySecuType m_connectSecuType = KySecuType::NONE; + bool m_isApConnection = false; + QString m_secuType = ""; + int m_signalStrength = 0; +}; + +#endif // KYWIRELESSNETITEM_H diff --git a/libnm-kylin/libnm-base-kylin/depend/kywirelessnetresource.cpp b/libnm-kylin/libnm-base-kylin/depend/kywirelessnetresource.cpp new file mode 100644 index 00000000..440f1144 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kywirelessnetresource.cpp @@ -0,0 +1,584 @@ +#include "kywirelessnetresource.h" +#include "kylinnetworkmanagerutil.h" + +#define LOG_FLAG "[KyWirelessNetResource]" + +#define PSK_SETTING_NAME "802-11-wireless-security" +#define PRIVATE_PSK_SETTING_NAME "802-1x" + +static bool subWifiListSort(const KyWirelessNetItem info1, const KyWirelessNetItem info2) +{ + if (info1.m_connectUuid.isEmpty() == info2.m_connectUuid.isEmpty()) { + if (info1.m_signalStrength != info2.m_signalStrength) { + return info1.m_signalStrength > info2.m_signalStrength; + } else { + if (QString::compare(info1.m_NetSsid, info2.m_NetSsid, Qt::CaseInsensitive) > 0) { + return false; + } else { + return true; + } + } + } + return !info1.m_connectUuid.isEmpty(); +} + +static void wifiListSort(QList &list) +{ + qSort(list.begin(), list.end(), subWifiListSort); +} + +KyWirelessNetResource::KyWirelessNetResource(QObject *parent) : KyNetResource(parent) +{ + qRegisterMetaType("KyWirelessNetItem&"); + qRegisterMetaType("NetworkManager::WirelessNetwork::Ptr"); + + kyWirelessNetItemListInit(); + + //无线出现/消失-->item 增删 + connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkAdded, + this, &KyWirelessNetResource::onWifiNetworkAdded); + connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkRemoved, + this, &KyWirelessNetResource::onWifiNetworkRemoved); + connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkPropertyChange, + this, &KyWirelessNetResource::onWifiNetworkPropertyChange); + connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkDeviceDisappear, + this, &KyWirelessNetResource::onWifiNetworkDeviceDisappear); + + //无线配置变化-->item uuid变化 + connect(m_networkResourceInstance, &KyNetworkResourceManager::wirelessConnectionAdd, + this, &KyWirelessNetResource::onConnectionAdd); + connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionRemove, + this, &KyWirelessNetResource::onConnectionRemove); + + //设备变化-->map key变化 + connect(m_networkResourceInstance, &KyNetworkResourceManager::wirelessDeviceAdd, + this, &KyWirelessNetResource::onDeviceAdd); + connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceRemove, + this, &KyWirelessNetResource::onDeviceRemove); + connect(m_networkResourceInstance, &KyNetworkResourceManager::wirelessDeviceUpdate, + this, &KyWirelessNetResource::onDeviceNameUpdate); + + m_updateTimer = new QTimer(this); + m_updateTimer->start(10*1000); + connect(m_updateTimer, &QTimer::timeout, this, &KyWirelessNetResource::updateList); + +} + +//配合activeconnection 此处未单独区分已连接的wifi +void KyWirelessNetResource::getWifiNetworkList(QString devName, QList &list) +{ + list.clear(); + if (m_WifiNetworkList.isEmpty() || !m_WifiNetworkList.contains(devName)) { + return; + } else { + QMap >::iterator iter = m_WifiNetworkList.begin(); + while (iter != m_WifiNetworkList.end()) { + if (iter.key() == devName) { + list = m_WifiNetworkList[iter.key()]; + wifiListSort(list); + return; + } + iter++; + } + } +} + +void KyWirelessNetResource::kyWirelessNetItemListInit() +{ + m_WifiNetworkList.clear(); + + NetworkManager::WirelessNetwork::List m_wifiNetList = m_networkResourceInstance->getWifiNetworkList(); + for (auto const & net : m_wifiNetList) { + QString devIface = getDeviceIFace(net); + if (devIface.isEmpty()) { + continue; + } + + KyWirelessNetItem item; + wirelessNetItemInit(item, net); + if (!m_WifiNetworkList.contains(devIface)){ + QList list; + list.append(item); + m_WifiNetworkList.insert(devIface,list); + } else { + m_WifiNetworkList[devIface].append(item); + } + } + + return; +} + +void KyWirelessNetResource::wirelessNetItemInit(KyWirelessNetItem &wirelessItem, + NetworkManager::WirelessNetwork::Ptr wirelessNetPtr) +{ + if(wirelessNetPtr.isNull()) { + return; + } + + NetworkManager::AccessPoint::Ptr accessPointPtr = wirelessNetPtr->referenceAccessPoint(); + QByteArray rawSsid = accessPointPtr->rawSsid(); + wirelessItem.m_NetSsid = getSsidFromByteArray(rawSsid); + + wirelessItem.m_signalStrength = accessPointPtr->signalStrength(); + NetworkManager::AccessPoint::Capabilities cap = accessPointPtr->capabilities(); + NetworkManager::AccessPoint::WpaFlags wpaFlag = accessPointPtr->wpaFlags(); + NetworkManager::AccessPoint::WpaFlags rsnFlag = accessPointPtr->rsnFlags(); + wirelessItem.m_secuType = enumToQstring(cap, wpaFlag, rsnFlag); + QString interface = getDeviceIFace(wirelessNetPtr); + getUuidBySsid(wirelessItem.m_NetSsid, interface, wirelessItem.m_connectUuid, wirelessItem.m_dbusPath); + KyWirelessConnectOperation operation; + wirelessItem.m_connectSecuType = operation.getConnectSecuType(wirelessItem.m_connectUuid); + wirelessItem.m_isApConnection = operation.isApConnection(wirelessItem.m_connectUuid); +} + +void KyWirelessNetResource::getUuidBySsid(const QString &ssid, QString &deviceName, QString &uuid, QString &dbusPath) +{ + uuid.clear(); + dbusPath.clear(); + NetworkManager::Connection::List connectList; + + connectList.clear(); + connectList = m_networkResourceInstance->getConnectList(); + + if (connectList.empty()) { + qWarning()<<"[KyConnectResourse]"<<"get connection failed, the connect list is empty"; + return; + } + + NetworkManager::Connection::Ptr connectPtr = nullptr; + for (int index = 0; index < connectList.size(); index++) { + connectPtr = connectList.at(index); + if (connectPtr.isNull()) { + continue; + } + + if (NetworkManager::ConnectionSettings::Wireless != connectPtr->settings()->connectionType()) { + continue; + } + + QString connectInterface = connectPtr->settings()->interfaceName(); + if (!connectInterface.isEmpty() + && deviceName != connectInterface) { + continue; + } + + NetworkManager::WirelessSetting::Ptr wifi_sett + = connectPtr->settings()->setting(NetworkManager::Setting::Wireless).dynamicCast(); + if (wifi_sett->ssid() == ssid) { + uuid = connectPtr->settings()->uuid(); + dbusPath = connectPtr->path(); + } + } +} + +void KyWirelessNetResource::onWifiNetworkAdded(QString devIfaceName, QString ssid) +{ + NetworkManager::WirelessNetwork::Ptr wifi = nullptr; + NetworkManager::WirelessNetwork::List m_wifiNetList = m_networkResourceInstance->getWifiNetworkList(); + for (auto const & net : m_wifiNetList) { + if (net.isNull()) { + continue; + } + + NetworkManager::AccessPoint::Ptr accessPointPtr = net->referenceAccessPoint(); + QByteArray rawSsid = accessPointPtr->rawSsid(); + QString wifiSsid = getSsidFromByteArray(rawSsid); + + if (wifiSsid == ssid + && m_networkResourceInstance->findDeviceByUni(net->device())->interfaceName() == devIfaceName) { + wifi = net; + } + } + + if (wifi.isNull()) { + return; + } + + KyWirelessNetItem item; + wirelessNetItemInit(item, wifi); + + if (m_WifiNetworkList.contains(devIfaceName)) { + m_WifiNetworkList[devIfaceName].append(item); + } else { + QList list; + list.append(item); + m_WifiNetworkList.insert(devIfaceName,list); + } + + Q_EMIT wifiNetworkAdd(devIfaceName, item); +} + +void KyWirelessNetResource::onWifiNetworkRemoved(QString devIfaceName, QString ssid) +{ + if (m_WifiNetworkList.contains(devIfaceName)) { + int index = 0; + for ( ; index < m_WifiNetworkList.value(devIfaceName).size(); index++) { + if ( m_WifiNetworkList[devIfaceName].at(index).m_NetSsid == ssid) { + m_WifiNetworkList[devIfaceName].removeAt(index); + } + } + //remove后为空则删除 + if (m_WifiNetworkList.value(devIfaceName).isEmpty()) { + m_WifiNetworkList.remove(devIfaceName); + } + Q_EMIT wifiNetworkRemove(devIfaceName, ssid); + } +} + +void KyWirelessNetResource::onWifiNetworkPropertyChange(NetworkManager::WirelessNetwork::Ptr net) +{ + if (nullptr == net) { + return; + } + + NetworkManager::AccessPoint::Ptr accessPointPtr = net->referenceAccessPoint(); + QByteArray rawSsid = accessPointPtr->rawSsid(); + QString wifiSsid = getSsidFromByteArray(rawSsid); + + QString devIface = m_networkResourceInstance->findDeviceByUni(net->device())->interfaceName(); + if (m_WifiNetworkList.contains(devIface)) { + QList::iterator iter = m_WifiNetworkList[devIface].begin(); + while (iter != m_WifiNetworkList[devIface].end()) { + if (iter->m_NetSsid == wifiSsid) { + if (iter->m_signalStrength != net->signalStrength()) { + iter->m_signalStrength = net->signalStrength(); + } + + QString secuType = enumToQstring(accessPointPtr->capabilities(), + accessPointPtr->wpaFlags(), + accessPointPtr->rsnFlags()); + if (iter->m_secuType != secuType) { + iter->m_secuType = secuType; + KyWirelessNetItem item = *iter; + Q_EMIT wifiNetworkUpdate(devIface, wifiSsid, item); + } + break; + } + iter++; + } + } +} + +void KyWirelessNetResource::onWifiNetworkDeviceDisappear() +{ + qWarning() << "wifiNetworkDeviceDisappear!!!!!!!!!"; + for (int i = 0; i < m_WifiNetworkList.keys().size(); ++i) { + Q_EMIT deviceRemove(m_WifiNetworkList.keys().at(i)); + } + kyWirelessNetItemListInit(); +} + +//对应属性页-->安全 +bool KyWirelessNetResource::getNormalWifiConnectSecuInfo(QString &uuid, KyWpaPasswordInfo &info) +{ + KyWirelessConnectOperation operation; + info.pwd = operation.getPsk(uuid); + return operation.getConnSecretFlags(uuid, info.flag); +} + +bool KyWirelessNetResource::getEnterpiseEapMethod(const QString &uuid, KyEapMethodType &type) +{ + NetworkManager::Connection::Ptr connectPtr = + NetworkManager::findConnectionByUuid(uuid); + if (connectPtr.isNull()) { + qWarning() << "getEnterpiseEapMethod faild.Can't find uuid = " << uuid; + return false; + } + + KyWirelessConnectOperation operation; + KyKeyMgmt keyMgmt = operation.getConnectKeyMgmt(uuid); + if (keyMgmt != WpaEap) { + qWarning() << "getEnterpiseEapMethod but not WpaEap.it's " << keyMgmt; + return false; + } + + NetworkManager::ConnectionSettings::Ptr connectionSettings = connectPtr->settings(); + + NetworkManager::Security8021xSetting::Ptr wifi_8021x_sett + = connectionSettings->setting(NetworkManager::Setting::Security8021x).dynamicCast(); + + QList list = wifi_8021x_sett->eapMethods(); + + if (list.contains(NetworkManager::Security8021xSetting::EapMethod::EapMethodTls)) { + type = TLS; + } else if (list.contains(NetworkManager::Security8021xSetting::EapMethod::EapMethodPeap)) { + type = PEAP; + } else if (list.contains(NetworkManager::Security8021xSetting::EapMethod::EapMethodTtls)) { + type = TTLS; + } + return true; +} + + +bool KyWirelessNetResource::getEnterPriseInfoTls(QString &uuid, KyEapMethodTlsInfo &info) +{ + NetworkManager::Connection::Ptr conn = m_networkResourceInstance->findConnectByUuid(uuid); + if (conn.isNull()) { + qWarning() << LOG_FLAG << "modifyEnterPriseInfoTls connection missing"; + return false; + } + + NetworkManager::WirelessSecuritySetting::Ptr security_sett = + conn->settings()->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + if (security_sett.isNull()) { + qWarning()<< LOG_FLAG << "don't have WirelessSecurity connection"; + return false; + } + if (security_sett->keyMgmt() != NetworkManager::WirelessSecuritySetting::WpaEap) { + return false; + } + NetworkManager::Security8021xSetting::Ptr setting = + conn->settings()->setting(NetworkManager::Setting::Security8021x).dynamicCast(); + if (setting.isNull()) { + qWarning()<< LOG_FLAG << "don't have Security8021x connection"; + return false; + } + + + info.identity = setting->identity(); + info.domain = setting->domainSuffixMatch(); + info.caCertPath = setting->caPath(); + if (info.caCertPath.left(7) == "file://") { + info.caCertPath = info.caCertPath.mid(7); + } + + info.clientCertPath = setting->clientCertificate(); + if (info.clientCertPath.left(7) == "file://") { + info.clientCertPath = info.clientCertPath.mid(7); + } + + info.clientPrivateKey = QString(setting->privateKey()); + if (info.clientPrivateKey.left(7) == "file://") { + info.clientPrivateKey = info.clientPrivateKey.mid(7); + } + + info.m_privateKeyPWDFlag = setting->privateKeyPasswordFlags(); + if (!info.m_privateKeyPWDFlag) { + KyWirelessConnectOperation operation; + info.clientPrivateKeyPWD = operation.getPrivateKeyPassword(conn->uuid()); + } + + return true; +} + +bool KyWirelessNetResource::getEnterPriseInfoPeap(QString &uuid, KyEapMethodPeapInfo &info) +{ + NetworkManager::Connection::Ptr conn = m_networkResourceInstance->findConnectByUuid(uuid); + if (conn.isNull()) { + qWarning() << LOG_FLAG << "getEnterPriseInfoPeap connection missing"; + return false; + } + NetworkManager::WirelessSecuritySetting::Ptr security_sett + = conn->settings()->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + if (security_sett.isNull()) { + qWarning() << LOG_FLAG << "don't have WirelessSecurity connection"; + return false; + } + + if (security_sett->keyMgmt() != NetworkManager::WirelessSecuritySetting::WpaEap) { + qWarning() << LOG_FLAG << "keyMgmt not WpaEap " << security_sett->keyMgmt(); + return false; + } + + NetworkManager::Security8021xSetting::Ptr setting = + conn->settings()->setting(NetworkManager::Setting::Security8021x).dynamicCast(); + if (setting.isNull() || !setting->eapMethods().contains(NetworkManager::Security8021xSetting::EapMethod::EapMethodPeap)) { + qWarning()<< LOG_FLAG << "don't have Security8021x connection"; + return false; + } + + info.phase2AuthMethod = (KyNoEapMethodAuth)setting->phase2AuthMethod(); + info.userName = setting->identity(); + info.m_passwdFlag = setting->passwordFlags(); + if (!info.m_passwdFlag) { + KyWirelessConnectOperation operation; + info.userPWD = operation.get8021xPassword(conn->uuid()); + } + + return true; +} + +bool KyWirelessNetResource::getEnterPriseInfoTtls(QString &uuid, KyEapMethodTtlsInfo &info) +{ + NetworkManager::Connection::Ptr conn = m_networkResourceInstance->findConnectByUuid(uuid); + if (conn.isNull()) { + qWarning() << LOG_FLAG << "modifyEnterPriseInfoTtls connection missing"; + return false; + } + + NetworkManager::WirelessSecuritySetting::Ptr security_sett + = conn->settings()->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast(); + if (security_sett.isNull()) { + qWarning() << LOG_FLAG << "don't have WirelessSecurity connection"; + return false; + } + if (security_sett->keyMgmt() != NetworkManager::WirelessSecuritySetting::WpaEap) { + qWarning() << LOG_FLAG << "not wpaeap"<keyMgmt(); + return false; + } + + NetworkManager::Security8021xSetting::Ptr setting = conn->settings()->setting(NetworkManager::Setting::Security8021x).dynamicCast(); + if (setting.isNull() || !setting->eapMethods().contains(NetworkManager::Security8021xSetting::EapMethod::EapMethodTtls)) { + qWarning() << LOG_FLAG << "don't have Security8021x connection"; + return false; + } + + info.authEapMethod = (KyEapMethodAuth)setting->phase2AuthEapMethod(); + info.authNoEapMethod = (KyNoEapMethodAuth)setting->phase2AuthMethod(); + + info.authType = KyTtlsAuthMethod::AUTH_EAP; + if (info.authEapMethod != KyAuthEapMethodUnknown) { + info.authType = KyTtlsAuthMethod::AUTH_EAP; + } else { + info.authType = KyTtlsAuthMethod::AUTH_NO_EAP; + } + + info.userName = setting->identity(); + info.m_passwdFlag = setting->passwordFlags(); + if (!info.m_passwdFlag) { + KyWirelessConnectOperation operation; + info.userPWD = operation.get8021xPassword(conn->uuid()); + } + + return true; +} + +void KyWirelessNetResource::getWirelessConnectDetail(QString interface, QString ssid, QString uuid, KyDetailInfo &connectSetting) +{ + getBaseInfo(interface, ssid, true, !uuid.isEmpty(), connectSetting); + if (!uuid.isEmpty()) { + getDynamicIpInfo(uuid, connectSetting); + } +} + +void KyWirelessNetResource::onConnectionAdd(QString connectUuid, QString connectName, QString connectPath) +{ + Q_UNUSED(connectName); + NetworkManager::Connection::Ptr conn = m_networkResourceInstance->findConnectByUuid(connectUuid); + if (conn.isNull()) { + qWarning() << LOG_FLAG << "onConnectionAdd can not find connection" << connectUuid; + return; + } + + NetworkManager::ConnectionSettings::Ptr sett = conn->settings(); + NetworkManager::WirelessSetting::Ptr wireless_sett = + sett->setting(NetworkManager::Setting::Wireless).dynamicCast(); + + QByteArray rawSsid = wireless_sett->ssid(); + QString wifiSsid = getSsidFromByteArray(rawSsid); + + QMap map; + map.clear(); + QMap >::iterator iter = m_WifiNetworkList.begin(); + while (iter != m_WifiNetworkList.end()) { + for(int i = 0; i < iter.value().size(); i++) { + if (iter.value().at(i).m_NetSsid == wifiSsid + && (sett->interfaceName() == iter.key() || sett->interfaceName().isEmpty())) { + QString devIfaceName; + QString ssid; + KyWirelessConnectOperation operation; + m_WifiNetworkList[iter.key()][i].m_connectUuid = conn->uuid(); + m_WifiNetworkList[iter.key()][i].m_dbusPath = conn->path(); + m_WifiNetworkList[iter.key()][i].m_connectSecuType = operation.getConnectSecuType(conn->uuid()); + + devIfaceName = iter.key(); + ssid = iter.value().at(i).m_NetSsid; + + Q_EMIT wirelessConnectionAdd(devIfaceName, ssid, connectUuid, connectPath); + map.insert(devIfaceName, ssid); + + break; + } + } + iter++; + } +} + +void KyWirelessNetResource::onConnectionRemove(QString path) +{ + QMap map; + map.clear(); + + QMap >::iterator iter = m_WifiNetworkList.begin(); + while (iter != m_WifiNetworkList.end()) { + for(int i = 0; i < iter.value().size(); i++) { + if (iter.value().at(i).m_dbusPath == path) { + KyWirelessConnectOperation operation; + QString devIfaceName = iter.key(); + QString ssid = iter.value().at(i).m_NetSsid; + + getUuidBySsid(ssid, devIfaceName, m_WifiNetworkList[iter.key()][i].m_connectUuid, m_WifiNetworkList[iter.key()][i].m_dbusPath); + if (m_WifiNetworkList[iter.key()][i].m_connectUuid.isEmpty()) { + Q_EMIT wirelessConnectionRemove(devIfaceName, ssid); + } else { + Q_EMIT wirelessConnectionUpdate(devIfaceName, ssid, + m_WifiNetworkList[iter.key()][i].m_connectUuid, + m_WifiNetworkList[iter.key()][i].m_dbusPath, + operation.getConnectSecuType(m_WifiNetworkList[iter.key()][i].m_connectUuid)); + } + + map.insert(devIfaceName, ssid); + break; + + } + } + iter++; + } +} + +void KyWirelessNetResource::onDeviceAdd(QString deviceName) +{ + if (!m_WifiNetworkList.contains(deviceName)) { + m_WifiNetworkList.insert(deviceName,QList()); + Q_EMIT wirelessDeviceAdd(deviceName); + } +} + +void KyWirelessNetResource::onDeviceRemove(QString deviceName) +{ + if (m_WifiNetworkList.contains(deviceName)) { + m_WifiNetworkList.remove(deviceName); + Q_EMIT deviceRemove(deviceName); + } +} + +void KyWirelessNetResource::onDeviceNameUpdate(QString oldName, QString newName) +{ + if (m_WifiNetworkList.contains(oldName)) { + QMap> newWifiNetworkList(m_WifiNetworkList); + QList list = m_WifiNetworkList[oldName]; + newWifiNetworkList.remove(oldName); + newWifiNetworkList.insert(newName,list); + m_WifiNetworkList = newWifiNetworkList; + Q_EMIT wirelessDeviceNameUpdate(oldName, newName); + } +} + +void KyWirelessNetResource::updateList() +{ + for (int i = 0; i< m_WifiNetworkList.keys().size(); ++i) { + QString devName = m_WifiNetworkList.keys().at(i); + QList connectItemList; + KyActiveConnectResourse actResource; + actResource.getActiveConnectionList(devName, CONNECT_TYPE_WIRELESS, connectItemList); + QList list = m_WifiNetworkList[devName]; + wifiListSort(list); + Q_EMIT updateWifiList(devName, connectItemList, list); + } +} + +QString KyWirelessNetResource::getDeviceIFace(NetworkManager::WirelessNetwork::Ptr net) +{ + if (net.isNull()) { + return ""; + } + + QString devUni = net->device(); + NetworkManager::Device::Ptr dev = m_networkResourceInstance->findDeviceByUni(devUni); + if (dev.isNull()) { + qDebug()<< LOG_FLAG << "KyWirelessNetResource: can't find " << net->ssid() << " find in device list"; + return ""; + } + + return dev->interfaceName(); +} diff --git a/libnm-kylin/libnm-base-kylin/depend/kywirelessnetresource.h b/libnm-kylin/libnm-base-kylin/depend/kywirelessnetresource.h new file mode 100644 index 00000000..8329b6d3 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/depend/kywirelessnetresource.h @@ -0,0 +1,85 @@ +#ifndef KYWIRELESSNETRESOURCE_H +#define KYWIRELESSNETRESOURCE_H + +#include +#include "kylinnetresource.h" +#include "kywirelessnetitem.h" +#include "kylinnetworkresourcemanager.h" +#include "kyenterpricesettinginfo.h" +#include "kywirelessconnectoperation.h" +#include "kylinactiveconnectresource.h" + +class KyWpaPasswordInfo{ +public: + QString pwd; + NetworkManager::Setting::SecretFlags flag; +}; + +class KyWirelessNetResource : public KyNetResource +{ + Q_OBJECT +public: + explicit KyWirelessNetResource(QObject *parent = nullptr); + +public: + //初始化列表用到的接口 + void getWifiNetworkList(QString devName, QList &list); + + //属性页---->安全 + bool getNormalWifiConnectSecuInfo(QString &uuid, KyWpaPasswordInfo &info); + bool getEnterPriseInfoTls(QString &uuid, KyEapMethodTlsInfo &info); + bool getEnterPriseInfoPeap(QString &uuid, KyEapMethodPeapInfo &info); + bool getEnterPriseInfoTtls(QString &uuid, KyEapMethodTtlsInfo &info); + + //获取企业网类型 + bool getEnterpiseEapMethod(const QString &uuid, KyEapMethodType &type); + + void getWirelessConnectDetail(QString interface, QString ssid, QString uuid, KyDetailInfo &connectSetting); + +private: + void kyWirelessNetItemListInit(); + void wirelessNetItemInit(KyWirelessNetItem &wirelessItem, + NetworkManager::WirelessNetwork::Ptr wirelessNetPtr); + void getUuidBySsid(const QString &ssid, QString &deviceName, QString &uuid, QString &dbusPath); + +public Q_SLOTS: + void onWifiNetworkAdded(QString devIfaceName, QString ssid); + void onWifiNetworkRemoved(QString devIfaceName, QString ssid); + void onWifiNetworkPropertyChange(NetworkManager::WirelessNetwork::Ptr net); + void onWifiNetworkDeviceDisappear(); + + void onConnectionAdd(QString connectUuid, QString connectName, QString connectPath); + void onConnectionRemove(QString); + + void onDeviceAdd(QString deviceName); + void onDeviceRemove(QString deviceName); + void onDeviceNameUpdate(QString oldName, QString newName); +private Q_SLOTS: + void updateList(); + +Q_SIGNALS: + void signalStrengthChange(QString deviceName, QString ssid, int strength); + void secuTypeChange(QString deviceName, QString ssid, QString securityType); + + void wirelessConnectionRemove(QString deviceName, QString ssid); + void wirelessConnectionAdd(QString deviceName, QString ssid, QString uuid, QString dbusPath); + void wirelessConnectionUpdate(QString deviceName, QString ssid, QString uuid, QString dbusPath, KySecuType connectSecuType); + + void wifiNetworkUpdate(QString, QString, KyWirelessNetItem); + void wifiNetworkAdd(QString deviceName, KyWirelessNetItem &item); + void wifiNetworkRemove(QString deviceName, QString ssid); + + void wirelessDeviceAdd(QString deviceName); + void deviceRemove(QString deviceName); + void wirelessDeviceNameUpdate(QString oldName, QString newName); + + void updateWifiList(QString, QList, QList); + +private: + QMap> m_WifiNetworkList; + QTimer * m_updateTimer = nullptr; + + QString getDeviceIFace(NetworkManager::WirelessNetwork::Ptr net); +}; + +#endif // KYWIRELESSNETRESOURCE_H diff --git a/libnm-kylin/libnm-base-kylin/kylin-nm-interface.h b/libnm-kylin/libnm-base-kylin/kylin-nm-interface.h new file mode 100644 index 00000000..9d290e3c --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/kylin-nm-interface.h @@ -0,0 +1,24 @@ +#ifndef KYLINNMINTERFACE_H +#define KYLINNMINTERFACE_H + +#include "libnm-base-kylin_global.h" + +class QWidget; +enum PluginType { + SIMPLE = 0, //锁屏 && 登录 + COMPLEX, //托盘 +}; + +class LIBNMBASEKYLIN_EXPORT Interface{ +public: + virtual ~Interface(){} + virtual QWidget * pluginUi() = 0; // 插件主界面---setPluginType后调用 + virtual void setPluginType(PluginType type, bool useSwitch = true) = 0; // 设置插件类型 + virtual void setParentWidget(QWidget* widget) = 0; +}; + +#define Interface_iid "org.kylin.network" + +Q_DECLARE_INTERFACE(Interface, Interface_iid) + +#endif // KYLINNMINTERFACE_H diff --git a/libnm-kylin/libnm-base-kylin/kylinnetworkmanager.h b/libnm-kylin/libnm-base-kylin/kylinnetworkmanager.h new file mode 100644 index 00000000..474c555f --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/kylinnetworkmanager.h @@ -0,0 +1,178 @@ +#ifndef KYLINNETWORKMANAGER_H +#define KYLINNETWORKMANAGER_H + +#include +#include "libnm-base-kylin_global.h" + +#include "depend/kylinnetworkresourcemanager.h" +#include "depend/kylinactiveconnectresource.h" +#include "depend/kylinnetworkdeviceresource.h" +#include "depend/kylinconnectoperation.h" +#include "depend/kylinwiredconnectoperation.h" +#include "depend/kylinwirednetresource.h" +#include "depend/kywirelessconnectoperation.h" +#include "depend/kywirelessnetresource.h" +#include "depend/kylinnetresource.h" +#include "depend/kyapnetresource.h" +#include "depend/kylingeneral.h" + +class LIBNMBASEKYLIN_EXPORT KyNetworkManager : public QObject +{ + Q_OBJECT +public: + explicit KyNetworkManager(QObject *parent = nullptr); + ~KyNetworkManager(); + +private: + bool m_init = false; + KyNetworkResourceManager *m_networkResource; + KyActiveConnectResourse *m_activeConnectResource; + KyNetworkDeviceResourse *m_deviceResource; + KylinGeneralOpration *m_general; + KyWiredConnectResourse *m_wiredConnectResourse; + KyWirelessNetResource *m_wirelessNetResource; + KyApNetResource *m_apNetResource; + + void initConnect(); + +Q_SIGNALS: + //activeConnection + void wiredStateChange(QString deviceName, QString uuid, KyConnectState state); + void wirelessStateChange(QString deviceName, QString ssid, QString uuid, KyConnectState state); + + //device + void deviceStateChange(QString deviceName, KyDeviceState newstate, KyDeviceState oldstate, + NetworkManager::Device::StateChangeReason reason); + void carrierChange(QString deviceName, bool pluged); + void deviceRemove(QString deviceName); + + //general + void wifiEnabledChanged(bool); + void networkingEnabledChanged(bool); + void connectStatusChanged(KyConnectStatus); + + //wired + void wiredConnectionAdd(QString devName, QString connectUuid, QString connectName, QString connectPath); + void wiredConnectionUpdate(QString devName, QString connectUuid, QString connectName, QString connectPath); + void connectionRemove(QString path); + + void wiredDeviceAdd(QString deviceName); + void wiredDeviceUpdate(QString oldDeviceName, QString newDeviceName); + + //wireless + void signalStrengthChange(QString deviceName, QString ssid, int strength); + void secuTypeChange(QString deviceName, QString ssid, QString securityType); + + void wirelessConnectionRemove(QString deviceName, QString ssid); + void wirelessConnectionAdd(QString deviceName, QString ssid, QString uuid, QString dbusPath); + void wirelessConnectionUpdate(QString deviceName, QString ssid, QString uuid, QString dbusPath, KySecuType connectSecuType); + + void wifiNetworkUpdate(QString, QString, KyWirelessNetItem); + void wifiNetworkAdd(QString deviceName, KyWirelessNetItem &item); + void wifiNetworkRemove(QString deviceName, QString ssid); + + void wirelessDeviceAdd(QString deviceName); + void wirelessDeviceNameUpdate(QString oldName, QString newName); + + void updateWifiList(QString, QList, QList); + + //移动热点 + void wirelessApConnectStateChange(); + + + +public: + bool isInitFinished(){return m_init;} + //activeConnection + void getActiveConnectionList(QString deviceName, + KyConnectionType connectionType, QList &connectItemList); + int getAcivateWifiSignal(); + + //device + void getNetworkDeviceList(KyDeviceType deviceType, QStringList &networkDeviceList); + + //general + bool getWirelessEnabled(); + bool getNetworkingEnabled(); + void getConnectStatus(KyConnectStatus &status); + + //wired + void getWiredList(QMap> &map); + //wireless + void getWifiNetworkList(QString devName, QList &list); + //移动热点 + void getApConnections(QList &apConnectItemList); + + //详情页-->ipv4 + ipv6 + autoconnect + void getConnectIpInfo(QString uuid, KyConnectSetting &connectSetting); + + //详情页-->有线连接detail + void getWiredConnectDetail(QString interface, QString uuid, KyDetailInfo &connectSetting); + + //详情页-->无线连接detail + void getWirelessConnectDetail(QString interface, QString ssid, QString uuid, KyDetailInfo &connectSetting); + + //无线连接-->安全 + bool getNormalWifiConnectSecuInfo(QString &uuid, KyWpaPasswordInfo &info); + bool getEnterPriseInfoTls(QString &uuid, KyEapMethodTlsInfo &info); + bool getEnterPriseInfoPeap(QString &uuid, KyEapMethodPeapInfo &info); + bool getEnterPriseInfoTtls(QString &uuid, KyEapMethodTtlsInfo &info); + + //获取企业网类型 + bool getEnterpiseEapMethod(const QString &uuid, KyEapMethodType &type); + + bool wiredConnectIsActived(); + bool wirelessConnectIsActived(); + +public Q_SLOTS: + void kylinNetworkManagerInit(); + //general + void onSetWirelessNetworkEnabled(bool enabled); + void onSetNetworkingEnabled(bool enabled); + void onSetWiredEnabled(bool enabled); + + //有线无线公用 + void onDeleteConnect(const QString &connectUuid); + void onActivateConnection(const QString connectUuid, const QString deviceName); + void onDeactivateConnection(const QString &activeConnectUuid); + //wired 单设备启用禁用 + void onSetWiredDeviceEnable(const QString &interface, bool enable); + //wireless + //申请扫描 + void onRequestWirelessScan(); + + void onCreateWiredConnect(KyConnectSetting connectSettingsInfo); + + //详情页 + //=======================连接操作==================== + //连接无本地配置的非企业网热点 + void onAddAndActivateNormalWifi(KyWirelessConnectSetting connSettingInfo, KySecuType type); + //连接无本地配置的企业网热点 + void onAddAndActiveWirelessEnterPriseTlsConnect(KyEapMethodTlsInfo info, + KyWirelessConnectSetting connSettingInfo); + void onAddAndActiveWirelessEnterPrisePeapConnect(KyEapMethodPeapInfo info, + KyWirelessConnectSetting connSettingInfo); + void onAddAndActiveWirelessEnterPriseTtlsConnect(KyEapMethodTtlsInfo info, + KyWirelessConnectSetting connSettingInfo); + + //=====================新增配置操作==================== + //新增普通连接 + void onAddNormalConnect(const KyWirelessConnectSetting &connSettingInfo, KySecuType &type); + //新增TLS连接 + void onAddTlsConnect(const KyWirelessConnectSetting &connSettingInfo, const KyEapMethodTlsInfo &tlsinfo); + //新增PEAP连接 + void onAddPeapConnect(const KyWirelessConnectSetting &connSettingInfo, const KyEapMethodPeapInfo &peapInfo); + //新增TTLS连接 + void onAddTtlsConnect(const KyWirelessConnectSetting &connSettingInfo, const KyEapMethodTtlsInfo &ttlsInfo); + + //=====================更新配置操作==================== + void onUpdateIpv4AndIpv6SettingInfo(const QString &uuid, const KyConnectSetting &connectSettingsInfo); + //连接修改(安全改为个人/None) + void onUpdateWirelessPersonalConnect(const QString &uuid, const KyWirelessConnectSetting &connSettingInfo, bool bPwdChange); + //连接修改(安全改为改为企业) + void onUpdateWirelessEnterPriseTlsConnect(const QString &uuid, const KyEapMethodTlsInfo &tlsinfo); + void onUpdateWirelessEnterPrisePeapConnect(const QString &uuid, const KyEapMethodPeapInfo &peapInfo); + void onUpdateWirelessEnterPriseTtlsConnect(const QString &uuid, const KyEapMethodTtlsInfo &ttlsInfo); +}; + +#endif // KYLINNETWORKMANAGER_H diff --git a/libnm-kylin/libnm-base-kylin/kylinnetworkmanger.cpp b/libnm-kylin/libnm-base-kylin/kylinnetworkmanger.cpp new file mode 100644 index 00000000..0c646518 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/kylinnetworkmanger.cpp @@ -0,0 +1,339 @@ +#include "kylinnetworkmanager.h" + +#define WAIT_US 1000 + +KyNetworkManager::KyNetworkManager(QObject *parent) : QObject(parent) +{ +// kylinNetworkManagerInit(); + m_init = false; +} + +KyNetworkManager::~KyNetworkManager() +{ + m_networkResource = nullptr; +} + +void KyNetworkManager::kylinNetworkManagerInit() +{ + if (!m_init) { + qDebug() << "kylinNetworkManagerInit"; + m_networkResource = KyNetworkResourceManager::getInstance(); + if (!m_networkResource->NetworkManagerIsInited()) { + m_networkResource->onInitNetwork(); + } + m_activeConnectResource = new KyActiveConnectResourse(this); + m_deviceResource = new KyNetworkDeviceResourse(this); + m_general = new KylinGeneralOpration(this); + m_wiredConnectResourse = new KyWiredConnectResourse(this); + m_wirelessNetResource = new KyWirelessNetResource(this); + m_apNetResource = new KyApNetResource(this); + + initConnect(); + } + m_init = true; +} + +void KyNetworkManager::initConnect() +{ + connect(m_activeConnectResource, &KyActiveConnectResourse::wiredStateChange, + this, &KyNetworkManager::wiredStateChange); + connect(m_activeConnectResource, &KyActiveConnectResourse::wirelessStateChange, + this, &KyNetworkManager::wirelessStateChange); + + connect(m_deviceResource, &KyNetworkDeviceResourse::carrierChange, + this, &KyNetworkManager::carrierChange); + connect(m_deviceResource, &KyNetworkDeviceResourse::deviceStateChange, + this, &KyNetworkManager::deviceStateChange); + + connect(m_general, &KylinGeneralOpration::connectStatusChanged, + this, &KyNetworkManager::connectStatusChanged); + connect(m_general, &KylinGeneralOpration::networkingEnabledChanged, + this, &KyNetworkManager::networkingEnabledChanged); + connect(m_general, &KylinGeneralOpration::wifiEnabledChanged, + this, &KyNetworkManager::wifiEnabledChanged); + + connect(m_apNetResource, &KyApNetResource::wirelessApConnectStateChange, + this, &KyNetworkManager::wirelessApConnectStateChange); + + connect(m_wiredConnectResourse, &KyWiredConnectResourse::wiredConnectionAdd, + this, &KyNetworkManager::wiredConnectionAdd); + connect(m_wiredConnectResourse, &KyWiredConnectResourse::wiredConnectionUpdate, + this, &KyNetworkManager::wiredConnectionUpdate); + connect(m_wiredConnectResourse, &KyWiredConnectResourse::connectionRemove, + this, &KyNetworkManager::connectionRemove); + connect(m_wiredConnectResourse, &KyWiredConnectResourse::wiredDeviceAdd, + this, &KyNetworkManager::wiredDeviceAdd); + connect(m_wiredConnectResourse, &KyWiredConnectResourse::wiredDeviceUpdate, + this, &KyNetworkManager::wiredDeviceUpdate); + connect(m_wiredConnectResourse, &KyWiredConnectResourse::deviceRemove, + this, &KyNetworkManager::deviceRemove); + + + connect(m_wirelessNetResource, &KyWirelessNetResource::signalStrengthChange, + this, &KyNetworkManager::signalStrengthChange); + connect(m_wirelessNetResource, &KyWirelessNetResource::secuTypeChange, + this, &KyNetworkManager::secuTypeChange); + connect(m_wirelessNetResource, &KyWirelessNetResource::wirelessConnectionRemove, + this, &KyNetworkManager::wirelessConnectionRemove); + connect(m_wirelessNetResource, &KyWirelessNetResource::wirelessConnectionAdd, + this, &KyNetworkManager::wirelessConnectionAdd); + connect(m_wirelessNetResource, &KyWirelessNetResource::wirelessConnectionUpdate, + this, &KyNetworkManager::wirelessConnectionUpdate); + connect(m_wirelessNetResource, &KyWirelessNetResource::wifiNetworkUpdate, + this, &KyNetworkManager::wifiNetworkUpdate); + connect(m_wirelessNetResource, &KyWirelessNetResource::wifiNetworkAdd, + this, &KyNetworkManager::wifiNetworkAdd); + connect(m_wirelessNetResource, &KyWirelessNetResource::wifiNetworkRemove, + this, &KyNetworkManager::wifiNetworkRemove); + connect(m_wirelessNetResource, &KyWirelessNetResource::wirelessDeviceAdd, + this, &KyNetworkManager::wirelessDeviceAdd); + connect(m_wirelessNetResource, &KyWirelessNetResource::wirelessDeviceNameUpdate, + this, &KyNetworkManager::wirelessDeviceNameUpdate); + connect(m_wirelessNetResource, &KyWirelessNetResource::updateWifiList, + this, &KyNetworkManager::updateWifiList); +} + +//同步方法 +//有线 无线 移动热点界面 +void KyNetworkManager::getActiveConnectionList(QString deviceName, + KyConnectionType connectionType, QList &connectItemList) +{ + m_activeConnectResource->getActiveConnectionList(deviceName, connectionType, connectItemList); +} + +int KyNetworkManager::getAcivateWifiSignal() +{ + return m_activeConnectResource->getAcivateWifiSignal(); +} + +void KyNetworkManager::getNetworkDeviceList(KyDeviceType deviceType, QStringList &networkDeviceList) +{ + m_deviceResource->getNetworkDeviceList(deviceType, networkDeviceList); +} + +void KyNetworkManager::getConnectStatus(KyConnectStatus &connectType) +{ + m_general->getConnectStatus(connectType); +} + +bool KyNetworkManager::getWirelessEnabled() +{ + return m_general->getWirelessEnabled(); +} + +bool KyNetworkManager::getNetworkingEnabled() +{ + return m_general->getNetworkingEnabled(); +} + +void KyNetworkManager::getWiredList(QMap> &map) +{ + m_wiredConnectResourse->getWiredList(map); +} + +void KyNetworkManager::getWifiNetworkList(QString devName, QList &list) +{ + m_wirelessNetResource->getWifiNetworkList(devName, list); +} + +void KyNetworkManager::getApConnections(QList &apConnectItemList) +{ + m_apNetResource->getApConnections(apConnectItemList); +} +//详情页 +//共有ipv4 ipv6 包括autoconnect +void KyNetworkManager::getConnectIpInfo(QString uuid, KyConnectSetting &connectSetting) +{ + KyNetResource resource; + resource.getConnectionSetting(uuid, connectSetting); +} +//详情页-->有线连接detail +void KyNetworkManager::getWiredConnectDetail(QString interface, QString uuid, KyDetailInfo &connectSetting) +{ + KyWiredConnectResourse resource; + resource.getWiredConnectDetail(interface, uuid, connectSetting); +} + +//详情页-->无线连接detail +void KyNetworkManager::getWirelessConnectDetail(QString interface, QString ssid, QString uuid, KyDetailInfo &connectSetting) +{ + KyWirelessNetResource resource; + resource.getWirelessConnectDetail(interface, ssid, uuid, connectSetting); +} + +//无线连接-->安全 +bool KyNetworkManager::getNormalWifiConnectSecuInfo(QString &uuid, KyWpaPasswordInfo &info) +{ + KyWirelessNetResource resource; + return resource.getNormalWifiConnectSecuInfo(uuid, info); +} + +bool KyNetworkManager::getEnterPriseInfoTls(QString &uuid, KyEapMethodTlsInfo &info) +{ + KyWirelessNetResource resource; + return resource.getEnterPriseInfoTls(uuid, info); +} + +bool KyNetworkManager::getEnterPriseInfoPeap(QString &uuid, KyEapMethodPeapInfo &info) +{ + KyWirelessNetResource resource; + return resource.getEnterPriseInfoPeap(uuid, info); +} + +bool KyNetworkManager::getEnterPriseInfoTtls(QString &uuid, KyEapMethodTtlsInfo &info) +{ + KyWirelessNetResource resource; + return resource.getEnterPriseInfoTtls(uuid, info); +} + +//获取企业网类型 +bool KyNetworkManager::getEnterpiseEapMethod(const QString &uuid, KyEapMethodType &type) +{ + KyWirelessNetResource resource; + return resource.getEnterpiseEapMethod(uuid, type); +} + +bool KyNetworkManager::wiredConnectIsActived() +{ + return m_activeConnectResource->wiredConnectIsActived(); +} + +bool KyNetworkManager::wirelessConnectIsActived() +{ + return m_activeConnectResource->wirelessConnectIsActived(); +} + +//异步槽 +void KyNetworkManager::onSetWirelessNetworkEnabled(bool enabled) +{ + m_general->setWirelessNetworkEnabled(enabled); +} + +void KyNetworkManager::onSetNetworkingEnabled(bool enabled) +{ + m_general->setNetworkingEnabled(enabled); +} + +void KyNetworkManager::onSetWiredEnabled(bool enabled) +{ + m_general->setWiredEnabled(enabled); +} + +void KyNetworkManager::onDeleteConnect(const QString &connectUuid) +{ + KyConnectOperation operate; + operate.deleteConnect(connectUuid); +} + +void KyNetworkManager::onActivateConnection(const QString connectUuid, const QString deviceName) +{ + KyConnectOperation operate; + operate.activateConnection(connectUuid, deviceName); +} + +void KyNetworkManager::onDeactivateConnection(const QString &activeConnectUuid) +{ + KyConnectOperation operate; + operate.deactivateConnection(activeConnectUuid); +} + +void KyNetworkManager::onSetWiredDeviceEnable(const QString &interface, bool enable) +{ + m_deviceResource->setWiredDeviceEnable(interface, enable); +} + +void KyNetworkManager::onCreateWiredConnect(KyConnectSetting connectSettingsInfo) +{ + KyWiredConnectOperation operate; + operate.createWiredConnect(connectSettingsInfo); +} + +//=====================申请无线扫描=================== +void KyNetworkManager::onRequestWirelessScan() +{ + KyWirelessConnectOperation operate; + operate.requestWirelessScan(); +} + +//=======================连接操作==================== +//连接无本地配置的非企业网热点 +void KyNetworkManager::onAddAndActivateNormalWifi(KyWirelessConnectSetting connSettingInfo, KySecuType type) +{ + KyWirelessConnectOperation operate; + operate.addAndActiveWirelessConnect(connSettingInfo, type); +} +//连接无本地配置的企业网热点 +void KyNetworkManager::onAddAndActiveWirelessEnterPriseTlsConnect(KyEapMethodTlsInfo info, + KyWirelessConnectSetting connSettingInfo) +{ + KyWirelessConnectOperation operate; + operate.addAndActiveWirelessEnterPriseTlsConnect(info, connSettingInfo); +} +void KyNetworkManager::onAddAndActiveWirelessEnterPrisePeapConnect(KyEapMethodPeapInfo info, + KyWirelessConnectSetting connSettingInfo) +{ + KyWirelessConnectOperation operate; + operate.addAndActiveWirelessEnterPrisePeapConnect(info, connSettingInfo); +} +void KyNetworkManager::onAddAndActiveWirelessEnterPriseTtlsConnect(KyEapMethodTtlsInfo info, + KyWirelessConnectSetting connSettingInfo) +{ + KyWirelessConnectOperation operate; + operate.addAndActiveWirelessEnterPriseTtlsConnect(info, connSettingInfo); +} + +//=====================新增配置操作==================== +//新增普通连接 +void KyNetworkManager::onAddNormalConnect(const KyWirelessConnectSetting &connSettingInfo, KySecuType &type) +{ + KyWirelessConnectOperation operate; + operate.addConnect(connSettingInfo, type); +} +//新增TLS连接 +void KyNetworkManager::onAddTlsConnect(const KyWirelessConnectSetting &connSettingInfo, const KyEapMethodTlsInfo &tlsinfo) +{ + KyWirelessConnectOperation operate; + operate.addTlsConnect(connSettingInfo, tlsinfo); +} +//新增PEAP连接 +void KyNetworkManager::onAddPeapConnect(const KyWirelessConnectSetting &connSettingInfo, const KyEapMethodPeapInfo &peapInfo) +{ + KyWirelessConnectOperation operate; + operate.addPeapConnect(connSettingInfo, peapInfo); +} +//新增TTLS连接 +void KyNetworkManager::onAddTtlsConnect(const KyWirelessConnectSetting &connSettingInfo, const KyEapMethodTtlsInfo &ttlsInfo) +{ + KyWirelessConnectOperation operate; + operate.addTtlsConnect(connSettingInfo, ttlsInfo); +} + +//=====================更新配置操作==================== +void KyNetworkManager::onUpdateIpv4AndIpv6SettingInfo(const QString &uuid, const KyConnectSetting &connectSettingsInfo) +{ + KyWirelessConnectOperation operate; + operate.updateIpv4AndIpv6SettingInfo(uuid, connectSettingsInfo); +} +//连接修改(安全改为个人/None) +void KyNetworkManager::onUpdateWirelessPersonalConnect(const QString &uuid, + const KyWirelessConnectSetting &connSettingInfo, bool bPwdChange) +{ + KyWirelessConnectOperation operate; + operate.updateWirelessPersonalConnect(uuid, connSettingInfo, bPwdChange); +} +//连接修改(安全改为改为企业) +void KyNetworkManager::onUpdateWirelessEnterPriseTlsConnect(const QString &uuid, const KyEapMethodTlsInfo &tlsinfo) +{ + KyWirelessConnectOperation operate; + operate.updateWirelessEnterPriseTlsConnect(uuid, tlsinfo); +} +void KyNetworkManager::onUpdateWirelessEnterPrisePeapConnect(const QString &uuid, const KyEapMethodPeapInfo &peapInfo) +{ + KyWirelessConnectOperation operate; + operate.updateWirelessEnterPrisePeapConnect(uuid, peapInfo); +} +void KyNetworkManager::onUpdateWirelessEnterPriseTtlsConnect(const QString &uuid, const KyEapMethodTtlsInfo &ttlsInfo) +{ + KyWirelessConnectOperation operate; + operate.updateWirelessEnterPriseTtlsConnect(uuid, ttlsInfo); +} diff --git a/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro b/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro new file mode 100644 index 00000000..840233f9 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/libnm-base-kylin.pro @@ -0,0 +1,104 @@ +#QT -= gui +#QT += core gui x11extras dbus KWindowSystem svg concurrent network +QT += core dbus network + +TARGET = kylin-nm-base +TEMPLATE = lib +DEFINES += LIBNMBASEKYLIN_LIBRARY + +CONFIG += c++11 qt warn_on link_pkgconfig no_keywords +CONFIG += create_pc create_prl no_install_prl + +PKGCONFIG +=libnm gsettings-qt +INCLUDEPATH += /usr/include/KF5/NetworkManagerQt +LIBS += -L/usr/lib/ -lKF5NetworkManagerQt + +# 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 += \ + depend/kyapnetresource.cpp \ + depend/kyenterpricesettinginfo.cpp \ + depend/kylinactiveconnectresource.cpp \ + depend/kylinconnectoperation.cpp \ + depend/kylinconnectsetting.cpp \ + depend/kylingeneral.cpp \ + depend/kylinnetresource.cpp \ + depend/kylinnetworkdeviceresource.cpp \ + depend/kylinnetworkmanagerutil.cpp \ + kylinnetworkmanger.cpp \ + depend/kylinnetworkresourcemanager.cpp \ + depend/kylinwiredconnectoperation.cpp \ + depend/kylinwirednetresource.cpp \ + depend/kywirelessconnectoperation.cpp \ + depend/kywirelessnetresource.cpp + kylinnetworkmanger.cpp \ + +HEADERS += \ + libnm-base-kylin_global.h \ + kylin-nm-interface.h \ + kylinnetworkmanager.h \ + depend/kyapnetresource.h \ + depend/kyenterpricesettinginfo.h \ + depend/kylinactiveconnectresource.h \ + depend/kylinapconnectitem.h \ + depend/kylinconnectitem.h \ + depend/kylinconnectoperation.h \ + depend/kylinconnectsetting.h \ + depend/kylingeneral.h \ + depend/kylinnetresource.h \ + depend/kylinnetworkdeviceresource.h \ + depend/kylinnetworkmanagerutil.h \ + depend/kylinnetworkresourcemanager.h \ + depend/kylinnetworkresourcetype.h \ + depend/kylinwiredconnectoperation.h \ + depend/kylinwirednetresource.h \ + depend/kywirelessconnectoperation.h \ + depend/kywirelessnetitem.h \ + depend/kywirelessnetresource.h + +DESTDIR += $$PWD +# Default rules for deployment. +unix { + target.path = /usr/lib/ + + manager.path = /usr/include/kylin-nm + manager.files = kylinnetworkmanager.h \ + libnm-base-kylin_global.h \ + kylin-nm-interface.h + + depend.path = /usr/include/kylin-nm/depend + depend.files = depend/*.h + +# gschema.files = org.ukui.kylin-nm.switch.gschema.xml +# gschema.path = /usr/share/glib-2.0/schemas/ + + + INSTALLS += manager \ + depend \ + gschema + + QMAKE_PKGCONFIG_NAME = kylin-nm-base + QMAKE_PKGCONFIG_DESCRIPTION = kylin-nm Header files + QMAKE_PKGCONFIG_VERSION = $$VERSION + QMAKE_PKGCONFIG_LIBDIR = $$target.path + QMAKE_PKGCONFIG_DESTDIR = pkgconfig + QMAKE_PKGCONFIG_INCDIR = $$INCLUDEPATH +#/usr/include/kylin-nm /usr/include/KF5/NetworkManagerQt +# QMAKE_PKGCONFIG_INCDIR += /usr/include/KF5/NetworkManagerQt + QMAKE_PKGCONFIG_CFLAGS += -I/usr/include/kylin-nm + QMAKE_PKGCONFIG_REQUIRES = gio-2.0 glib-2.0 libnm + +} +!isEmpty(target.path): INSTALLS += target + +DISTFILES += \ + org.ukui.kylin-nm.switch.gschema.xml diff --git a/libnm-kylin/libnm-base-kylin/libnm-base-kylin_global.h b/libnm-kylin/libnm-base-kylin/libnm-base-kylin_global.h new file mode 100644 index 00000000..f04b51de --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/libnm-base-kylin_global.h @@ -0,0 +1,12 @@ +#ifndef LIBNMBASEKYLIN_GLOBAL_H +#define LIBNMBASEKYLIN_GLOBAL_H + +#include + +#if defined(LIBNMBASEKYLIN_LIBRARY) +# define LIBNMBASEKYLIN_EXPORT Q_DECL_EXPORT +#else +# define LIBNMBASEKYLIN_EXPORT Q_DECL_IMPORT +#endif + +#endif // LIBNMBASEKYLIN_GLOBAL_H diff --git a/libnm-kylin/libnm-base-kylin/pkgconfig/kylin-nm-base.pc b/libnm-kylin/libnm-base-kylin/pkgconfig/kylin-nm-base.pc new file mode 100644 index 00000000..f2fa6293 --- /dev/null +++ b/libnm-kylin/libnm-base-kylin/pkgconfig/kylin-nm-base.pc @@ -0,0 +1,13 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${prefix}/lib/ +includedir=${prefix}/include/KF5/NetworkManagerQt + + +Name: kylin-nm-base +Description: kylin-nm Header files +Version: 1.0.0 +Libs: -L${libdir} -lkylin-nm-base +Cflags: -I/usr/include/kylin-nm -I${includedir} +Requires: gio-2.0 glib-2.0 libnm + diff --git a/libnm-kylin/libnm-external-kylin/kylin-agent/kylin-agent.pri b/libnm-kylin/libnm-external-kylin/kylin-agent/kylin-agent.pri new file mode 100644 index 00000000..536b56b8 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-agent/kylin-agent.pri @@ -0,0 +1,14 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/kylinagent.h \ + $$PWD/kylinagentobject.h \ + $$PWD/kylinagentutils.h \ + $$PWD/kylinpassworddialog.h \ + $$PWD/kylinsecretagent.h + +SOURCES += \ + $$PWD/kylinagent.cpp \ + $$PWD/kylinagentobject.cpp \ + $$PWD/kylinpassworddialog.cpp \ + $$PWD/kylinsecretagent.cpp diff --git a/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagent.cpp b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagent.cpp new file mode 100644 index 00000000..4eac06ca --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagent.cpp @@ -0,0 +1,58 @@ +#include "kylinagent.h" + +KylinAgent* KylinAgent::m_pInstance = nullptr; + +KylinAgent* KylinAgent::getInstance() +{ + if (m_pInstance == NULL) { + m_pInstance = new KylinAgent(); + } + + return m_pInstance; +} + +void KylinAgent::Release() +{ + if (m_pInstance != NULL) { + delete m_pInstance; + m_pInstance = NULL; + } + + return; +} + +KylinAgent::KylinAgent(QObject *parent) : QObject(parent) +{ + m_agentThread =new QThread(this); +} + +KylinAgent::~KylinAgent() +{ + if (nullptr != m_kylinAgnetObject) { + delete m_kylinAgnetObject; + m_kylinAgnetObject = nullptr; + } +} + +void KylinAgent::startKylinAgent() +{ + m_kylinAgnetObject = new KylinAgentObject(); + m_kylinAgnetObject->moveToThread(m_agentThread); + QObject::connect(m_agentThread, SIGNAL(started()), m_kylinAgnetObject, SLOT(onInitAgent())); + m_agentThread->start(); + + return; +} + +void KylinAgent::stopKylinAgent() +{ + m_kylinAgnetObject->disconnect(); + + m_agentThread->quit(); + m_agentThread->wait(); + + delete m_kylinAgnetObject; + m_kylinAgnetObject = nullptr; + + return; +} diff --git a/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagent.h b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagent.h new file mode 100644 index 00000000..1c2063d1 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagent.h @@ -0,0 +1,38 @@ +#ifndef KYLINAGENT_H +#define KYLINAGENT_H + +#include "kylinagentobject.h" + +#include +#include + +#include "libnm-external-kylin_global.h" + +/* +* 该类为单例模式 +*/ +class LIBNMEXTERNALKYLIN_EXPORT KylinAgent : public QObject +{ + Q_OBJECT +public: + static KylinAgent* getInstance(); + static void Release(); + +public: + explicit KylinAgent(QObject *parent = nullptr); + ~KylinAgent(); + +public: + void startKylinAgent(); + void stopKylinAgent(); + +public: + static KylinAgent* m_pInstance; + +private: + KylinAgentObject *m_kylinAgnetObject; + QThread *m_agentThread; +}; + + +#endif // KYLINAGENT_H diff --git a/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagentobject.cpp b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagentobject.cpp new file mode 100644 index 00000000..6b8be4d0 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagentobject.cpp @@ -0,0 +1,21 @@ +#include "kylinagentobject.h" + +KylinAgentObject::KylinAgentObject(QObject *parent) : QObject(parent) +{ + +} + +KylinAgentObject::~KylinAgentObject() +{ + if (nullptr != m_secretAgnet) { + delete m_secretAgnet; + m_secretAgnet = nullptr; + } +} + +void KylinAgentObject::onIntKylinAgent() +{ + m_secretAgnet = new KylinSecretAgent("kylinagent"); + + return; +} diff --git a/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagentobject.h b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagentobject.h new file mode 100644 index 00000000..ec292e77 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagentobject.h @@ -0,0 +1,23 @@ +#ifndef KYLINAGENTOBJECT_H +#define KYLINAGENTOBJECT_H + +#include "kylinsecretagent.h" + +#include + +class KylinAgentObject : public QObject +{ + Q_OBJECT +public: + explicit KylinAgentObject(QObject *parent = nullptr); + ~KylinAgentObject(); + +public Q_SLOTS: + void onIntKylinAgent(); + +private: + KylinSecretAgent *m_secretAgnet; + +}; + +#endif // KYLINAGENTOBJECT_H diff --git a/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagentutils.h b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagentutils.h new file mode 100644 index 00000000..66e7547c --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinagentutils.h @@ -0,0 +1,95 @@ +#ifndef AGENTUTILS_H +#define AGENTUTILS_H + +#define VPN_TYPE "vpn" +#define VPN_NAME "vpn" +#define VPN_SERVICE "service-type" +#define VPN_DATA "data" +#define VPN_SECRET "secrets" +#define VPN_FLAG "password-flags" + +#define CONNECTION_KEY "connection" +#define UUID_KEY "uuid" +#define ID_KEY "id" +#define TYPE_KEY "type" + + +#define WIRELESS_SECURITY_NAME "802-11-wireless-security" +#define KEY_MGMT "key-mgmt" + +#define PSK_MGMT "wpa-psk" +#define SAE_MGMT "sae" +#define PSK_FLAG "psk-flags" +#define PSK_KEY "psk" + +#define WEP_MGMT "none" +#define WEP128_MGMT "passphrase" +#define WEP_FLAG_KEY "wep-key-flags" +#define WEP_ID_KEY "wep-tx-keyidx" +#define WEP_KEY0 "wep-key0" +#define WEP_KEY1 "wep-key1" +#define WEP_KEY2 "wep-key2" +#define WEP_KEY3 "wep-key3" + +#define LEAP_MGMT "ieee8021x" +#define LEAP_PASSWORD_FLAG "leap-password-flags" +#define LEAP_PASSWORD_KEY "leap-password" +#define LEAP_USER_KEY "leap-username" + +#define ENTERPRICE_NAME "802-1x" +#define EAP_KEY "eap" +#define PWD_EAP "pwd" +#define LEAP_EAP "leap" +#define FAST_EAP "fast" +#define PEAP_EAP "peap" +#define TTLS_EAP "ttls" +#define TLS_EAP "tls" + +#define IDENTITY_KEY "identity" + +#define PASSWORD_FLAG "password-flags" +#define PASSWORD_KEY "password" + +#define PIN_FLAG "pin-flags" +#define PIN_KEY "pin" + +#define PHASE2_PRIVATE_KEY_FLAG "phase2-private-key-password-flags" +#define PHASE2_PRIVATE_KEY "phase2-private-key-password" + +#define PRIVATE_KEY_FLAG "private-key-password-flags" +#define PRIVATE_KEY "private-key-password" +#define DOMAIN_KEY "domain-suffix-match" + +#define PHASE2_CLIENT_FLAG "phase2-client-cert-password-flags" +#define PHASE2_CLIENT "phase2-client-cert-password" + +#define PHASE2_CACERT_FLAG "phase2-ca-cert-password-flags" +#define PHASE2_CACERT "phase2-ca-cert-password" + +#define PHASE1_AUTH_FLAG "phase1-auth-flags" +#define PHASE1_AUTH "phase1-auth" + +#define CLIENT_CERT_FLAG "client-cert-password-flags" +#define CLIENT_CERT "client-cert-password" + +#define CACERT_FLAG "ca-cert-password-flags" +#define CACERT "ca-cert-password" + + + +enum SecretPolicyFlag{ + POLICY_NONE = 0, + POLICY_AGENT_OWNED = 0x01, + POLICY_NOT_SAVED = 0x02, + POLICY_NOT_REQUIRED = 0x04 +}; + +enum SecretWepKeyId{ + KEY_TYPE0 = 0, + KEY_TYPE1 = 1, + KEY_TYPE2 = 2, + KEY_TYPE3 = 3 +}; + + +#endif // AGENTUTILS_H diff --git a/libnm-kylin/libnm-external-kylin/kylin-agent/kylinpassworddialog.cpp b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinpassworddialog.cpp new file mode 100644 index 00000000..b6aa2c5a --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinpassworddialog.cpp @@ -0,0 +1,74 @@ +#include "kylinpassworddialog.h" +#include +#include +#include +#include + +KyPasswordDialog::KyPasswordDialog(QWidget *parent):QDialog(parent) +{ + usrLabel = new QLabel(this); + usrLabel->move(70,80); + usrLabel->setText("用户名"); + usrLineEdit = new QLineEdit(this); + usrLineEdit->move(140,80); + usrLineEdit->setPlaceholderText("请输入用户名"); + + pwdLabel = new QLabel(this); + pwdLabel->move(70,130); + pwdLabel->setText("密码"); + pwdLineEdit = new QLineEdit(this); + pwdLineEdit->move(140,130); + pwdLineEdit->setPlaceholderText("请输入密码"); + + LoginBtn = new QPushButton(this); + LoginBtn->move(70,200); + LoginBtn->setText("登录"); + exitBtn = new QPushButton(this); + exitBtn->move(220,200); + exitBtn->setText("退出"); + + connect(LoginBtn,SIGNAL(clicked(bool)),this,SLOT(login())); + connect(exitBtn,SIGNAL(clicked(bool)),this,SLOT(close())); +} + +KyPasswordDialog::~KyPasswordDialog(){ + +} + +QString KyPasswordDialog::getPassword() +{ + return pwdLineEdit->text(); +} + +void KyPasswordDialog::setPassword(QString password) +{ + pwdLineEdit->setText(password); + +} + +QString KyPasswordDialog::getUserName() +{ + return usrLineEdit->text(); +} + +void KyPasswordDialog::setUserName(QString name) +{ + usrLineEdit->setText(name); + + return; +} + +void KyPasswordDialog::login(){ + if(!pwdLineEdit->text().isEmpty()){ + accept(); + }else{ + QMessageBox::warning(this,"警告","密码或者用户名错误!",QMessageBox::Yes); + usrLineEdit->clear(); + pwdLineEdit->clear(); + usrLineEdit->setFocus(); + } +} + +void KyPasswordDialog::close(){ + this->close(); +} diff --git a/libnm-kylin/libnm-external-kylin/kylin-agent/kylinpassworddialog.h b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinpassworddialog.h new file mode 100644 index 00000000..15a8dd53 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinpassworddialog.h @@ -0,0 +1,36 @@ +#ifndef KYLINPASSWORDDIALOG_H +#define KYLINPASSWORDDIALOG_H + +#include +#include +#include +class KyPasswordDialog : public QDialog +{ + Q_OBJECT +public: + KyPasswordDialog(QWidget *parent = 0); + ~KyPasswordDialog(); +private: + QLabel *usrLabel; + QLabel *pwdLabel; + QLineEdit *usrLineEdit; + QLineEdit *pwdLineEdit; + QPushButton *LoginBtn; + QPushButton *exitBtn; + +public: + QString getPassword(); + void setPassword(QString password); + + QString getUserName(); + void setUserName(QString name); + +private Q_SLOTS: + void login(); + void close(); + +Q_SIGNALS: + void signal_username(QString); +}; + +#endif // KYLINPASSWORDDIALOG_H diff --git a/libnm-kylin/libnm-external-kylin/kylin-agent/kylinsecretagent.cpp b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinsecretagent.cpp new file mode 100644 index 00000000..0dcc65fd --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinsecretagent.cpp @@ -0,0 +1,1207 @@ + +#include + +#include "kylinsecretagent.h" +#include "kylinpassworddialog.h" + +#define LOG_FLAG "[KylinSecretAgent]" + +#define KEYRING_UUID_TAG "connection-uuid" +#define KEYRING_SN_TAG "setting-name" +#define KEYRING_SK_TAG "setting-key" + +static const SecretSchema network_manager_secret_schema = { + "org.freedesktop.NetworkManager.Connection", + SECRET_SCHEMA_DONT_MATCH_NAME, + { + { KEYRING_UUID_TAG, SECRET_SCHEMA_ATTRIBUTE_STRING }, + { KEYRING_SN_TAG, SECRET_SCHEMA_ATTRIBUTE_STRING }, + { KEYRING_SK_TAG, SECRET_SCHEMA_ATTRIBUTE_STRING }, + { NULL, 0 }, + } +}; + +/* +* 目前wpa3存在的问题(nm-applet 的agent也存在下面的问题): +* 1、所有用户可见的存储策略情况下,当密码错误的时候,networkmanager不会调用getSecret接口 +* 2、当选择仅用户可见时,存储错误密码,由于传递给getSecret的flag参数一直是13, +* 导致无法弹出修改密码的框, +* 正常情况下,flag第一次是5,从keyring获取密码 第二次是7,由于密码错误,弹框获取新密码 +* 3、每次询问密码正常。 +* +* wep的存在的问题: +* 1、所有用户可见时,当输入错误的密码的时候,networkmanager没有调用getSecret函数,弹出密码框 +* 2、仅用户可见的时候,正确的密码可以正常连接,当密码错误的时候,不调用getsecret,不会弹出密码框 +* 3、每次询问密码的时候,第一次可以弹出密码框,如果输入错误的密码,有时弹出密码框,有时不弹,取决于输入的密码位数 +* +* +* 企业wifi leap加密方式 +* 无法选择每次询问用户 +* +*/ + + +KylinSecretAgent::KylinSecretAgent(const QString &id, QObject *parent):SecretAgent(id, parent) +{ + enterpriceInfo[PASSWORD_FLAG] = PASSWORD_KEY; + enterpriceInfo[PIN_FLAG] = PIN_KEY; + enterpriceInfo[PHASE2_PRIVATE_KEY_FLAG] = PHASE2_PRIVATE_KEY; + enterpriceInfo[PRIVATE_KEY_FLAG] = PRIVATE_KEY; + enterpriceInfo[PHASE2_CLIENT_FLAG] = PHASE2_CLIENT; + enterpriceInfo[PHASE2_CACERT_FLAG] = PHASE2_CACERT; + enterpriceInfo[PHASE1_AUTH_FLAG] = PHASE1_AUTH; + enterpriceInfo[CLIENT_CERT_FLAG] = CLIENT_CERT; + enterpriceInfo[CACERT_FLAG] = CACERT; + + wirelessInfo[PSK_FLAG] = PSK_KEY; + wirelessInfo[LEAP_PASSWORD_FLAG] = LEAP_PASSWORD_KEY; +} + +KylinSecretAgent::~KylinSecretAgent() +{ + +} + +bool KylinSecretAgent::hintIsFind(GList *p_secretList, const QStringList &hints) +{ + GList *p_iter; + bool hintFind = false; + + if (hints.isEmpty()) { + return true; + } + + for (p_iter = p_secretList; p_iter != NULL; p_iter = g_list_next(p_iter)) { + SecretItem *p_item = (SecretItem *)p_iter->data; + SecretValue *p_secret; + const char *p_keyName; + GHashTable *p_attributes; + + p_secret = secret_item_get_secret(p_item); + if (p_secret) { + p_attributes = secret_item_get_attributes (p_item); + p_keyName = (char *)g_hash_table_lookup (p_attributes, KEYRING_SK_TAG); + if (!p_keyName) { + g_hash_table_unref (p_attributes); + secret_value_unref (p_secret); + continue; + } + + /* See if this property matches a given hint */ + for (int index = 0; index < hints.size(); ++index) { + QString hintValue = hints.at(index); + if (!g_strcmp0(hintValue.toUtf8().constData(), p_keyName)) { + hintFind = true; + } + } + + g_hash_table_unref (p_attributes); + secret_value_unref (p_secret); + break; + } + } + + return hintFind; +} + +void KylinSecretAgent::getSecretFromKeyring(GList *p_secretList, + const QString &settingName, + QString connectType, + NMVariantMapMap &secretMap) +{ + GList *p_iter = nullptr; + QVariantMap secretKeyMap; + + for (p_iter = p_secretList; p_iter != NULL; p_iter = g_list_next(p_iter)) { + SecretItem *p_item = (SecretItem *)p_iter->data; + SecretValue *p_secret; + const char *p_keyName; + GHashTable *p_attributes; + + p_secret = secret_item_get_secret(p_item); + if (p_secret) { + p_attributes = secret_item_get_attributes (p_item); + p_keyName = (char *)g_hash_table_lookup (p_attributes, KEYRING_SK_TAG); + if (!p_keyName) { + g_hash_table_unref (p_attributes); + secret_value_unref (p_secret); + continue; + } + + if (VPN_TYPE == connectType) { + /* + * 目前根据测试的情况vpn只会存储密码,涉及的字段 + * vpn.secrets: password = 123456 + * 注意的问题:不知道会不会出现多个密码的问题, + */ + QString vpnSecretValue = QString(p_keyName) + + "=" + QString(secret_value_get(p_secret, NULL)); + secretKeyMap[VPN_SECRET] = vpnSecretValue; + } else { + secretKeyMap[p_keyName] = QString(secret_value_get(p_secret, NULL)); + } + g_hash_table_unref (p_attributes); + secret_value_unref (p_secret); + break; + } + } + + secretMap[settingName] = secretKeyMap; + + return; +} + +/* +* 目前根据测试掌握的情况来看,该函数无用,原因: +* 当每次都是询问的时候,keyring上面并不会存储密码,那么从keyring上面获取的密码为空 +* 程序根本无法走到此处 +* +* 注意事项: +* 后期根据测试遇到的情况在调整该函数。 +*/ +bool KylinSecretAgent::connectionIsAlwaysAsk(const NMVariantMapMap &connection) +{ + return false; +} + +/* +* +* 802-11-wireless-security.key-mgmt: sae/wpa-psk +* wpa-psk 是WPA/WPA2个人加密方式 +* sae 是WPA3个人加密方式 +* 涉及的字段: +* 802-11-wireless-security.key-mgmt: sae +* 802-11-wireless-security.psk: asdasd +* 802-11-wireless-security.psk-flags: 0(无) +* +* 该函数通过弹出密码框获取密码,并构建相应类型的密码 +*/ +void KylinSecretAgent::askSecretForPassword(QVariantMap &securityMap, + QString passwordKey, + const QString &settingName, + NMVariantMapMap &secretMap) +{ + QString secretValue = ""; + + if (secretMap.contains(settingName)) { + QVariantMap secretKeyMap = secretMap.value(settingName); + if (!secretKeyMap.isEmpty()) { + secretValue = secretKeyMap.value(passwordKey).toString(); + } + } + + if (secretValue.isEmpty()) { + secretValue = securityMap.value(passwordKey).toString(); + } + + KyPasswordDialog pwdDialog; + pwdDialog.setPassword(secretValue); + + pwdDialog.exec(); + if(pwdDialog.exec()==QDialog::Accepted){ + QString password = pwdDialog.getPassword(); + QVariantMap newSecretKeyMap = securityMap; + newSecretKeyMap[passwordKey] = password; + secretMap[settingName] = newSecretKeyMap; + + qDebug() << LOG_FLAG << "password:" << password; + } else { + secretMap.clear(); + } + + return; +} + +/* +* 802-11-wireless-security.wep-key-type: passphrase or key +* passphrase 是 WEP128位密码句 +* key 是WEP40/128位秘钥(十六进制 或 ASCII) +* 两者对应的相同的mgmt类型:802-11-wireless-security.key-mgmt: none +* 共用该函数,保存密码到秘钥环 +* 涉及的字段 +* 802-11-wireless-security.key-mgmt: none +* 802-11-wireless-security.wep-tx-keyidx: 2 +* 802-11-wireless-security.wep-key0: -- +* 802-11-wireless-security.wep-key1: -- +* 802-11-wireless-security.wep-key2: -- +* 802-11-wireless-security.wep-key3: -- +* 802-11-wireless-security.wep-key-flags: 1 +* 802-11-wireless-security.wep-key-type: passphrase +*/ + +QString KylinSecretAgent::getWepKeyFromId(uint wepId) +{ + QString wepKey = ""; + + switch(wepId) { + case KEY_TYPE0: + wepKey = WEP_KEY0; + break; + case KEY_TYPE1: + wepKey = WEP_KEY1; + break; + case KEY_TYPE2: + wepKey = WEP_KEY2; + break; + case KEY_TYPE3: + wepKey = WEP_KEY3; + break; + default: + qWarning() << LOG_FLAG + << "the wep key id" << wepId << "is undefined."; + } + + return wepKey; +} + +void KylinSecretAgent::askSecretForWep(QVariantMap &wirelessSecurityMap, + const QString &settingName, + NMVariantMapMap &secretMap) +{ + QString wepKey = ""; + QString wepSecretValue = ""; + uint wepId = 0; + + if (wirelessSecurityMap.contains(WEP_ID_KEY)) { + wepId = wirelessSecurityMap.value(WEP_ID_KEY).toUInt(); + } + + wepKey = getWepKeyFromId(wepId); + if (wepKey.isEmpty()) { + QString errorMsg = "the wep key is invalide."; + qWarning() << LOG_FLAG << errorMsg; + //sendError(); + return; + } + + if (secretMap.contains(settingName)) { + QVariantMap secretKeyMap = secretMap.value(settingName); + if (!secretKeyMap.isEmpty()) { + wepSecretValue = secretKeyMap.value(wepKey).toString(); + } + } + + if (wepSecretValue.isEmpty()) { + wepSecretValue = wirelessSecurityMap.value(wepKey).toString(); + } + + KyPasswordDialog pwdDialog; + pwdDialog.setPassword(wepSecretValue); + + pwdDialog.exec(); + if(pwdDialog.exec()==QDialog::Accepted){ + QString password = pwdDialog.getPassword(); + QVariantMap newSecretKeyMap = wirelessSecurityMap; + newSecretKeyMap[wepKey] = password; + secretMap[settingName] = newSecretKeyMap; + qDebug() << LOG_FLAG << "password:" << password; + } else { + secretMap.clear(); + } + + return; +} + +/* +* leap加密类型对应的mgmt值: +* 802-11-wireless-security.key-mgmt: ieee8021x +* 涉及的字段 +* 802-11-wireless-security.leap-username: sadasd +* 802-11-wireless-security.leap-password: sadasd +* 802-11-wireless-security.leap-password-flags:0 +* +* 该函数通过弹窗获取正确的密码和用户名,需要构建相应的secretmap +*/ + +void KylinSecretAgent::askSecretForLeap(QVariantMap &wirelessSecurityMap, + const QString &settingName, + NMVariantMapMap &secretMap) +{ + uint leapPasswordFlag = 0; + QString leapPassword = ""; + QString leapUserName = ""; + + if (wirelessSecurityMap.contains(LEAP_USER_KEY)) { + leapUserName = wirelessSecurityMap.value(LEAP_USER_KEY).toString(); + } + + if (wirelessSecurityMap.contains(LEAP_PASSWORD_FLAG)) { + leapPasswordFlag = wirelessSecurityMap.value(LEAP_PASSWORD_FLAG).toUInt(); + } + + if (secretMap.contains(settingName)) { + QVariantMap secretKeyMap = secretMap.value(settingName); + if (!secretKeyMap.isEmpty()) { + leapPassword = secretKeyMap.value(LEAP_PASSWORD_KEY).toString(); + } + } + + if (leapPassword.isEmpty()) { + leapPassword = wirelessSecurityMap.value(LEAP_PASSWORD_KEY).toString(); + } + + KyPasswordDialog pwdDialog; + pwdDialog.setUserName(leapUserName); + pwdDialog.setPassword(leapPassword); + + pwdDialog.exec(); + if(pwdDialog.exec()==QDialog::Accepted){ + QString password = pwdDialog.getPassword(); + QString userName = pwdDialog.getUserName(); + QVariantMap securityMap; + securityMap[LEAP_PASSWORD_KEY] = password; + securityMap[LEAP_PASSWORD_FLAG] = leapPasswordFlag; + securityMap[LEAP_USER_KEY] = userName; + secretMap[settingName] = securityMap; + + qDebug() << LOG_FLAG << "password:" << password << userName; + } else { + secretMap.clear(); + } + + return; +} + +/* +* 功能:获取普通wifi的密码,分为三类 +* 1)wpa/wpa2/wpa3 +* 2) leap +* 3) wep +*/ +void KylinSecretAgent::askSecretForWireless(const NMVariantMapMap &connection, + const QString settingName, + NMVariantMapMap &secretMap) +{ + qDebug() << LOG_FLAG <<"askSecretForWireless connection" << connection; + QString secretType = ""; + + QVariantMap wirelessSecurityMap = connection.value(settingName); + if (wirelessSecurityMap.contains(KEY_MGMT)) { + secretType = wirelessSecurityMap.value(KEY_MGMT).toString(); + } else { + QString errorMsg = "can not get wireless secret type."; + sendError(InvalidConnection, errorMsg); + qWarning()<< LOG_FLAG << errorMsg; + return; + } + + if (PSK_MGMT == secretType || SAE_MGMT == secretType) { + askSecretForPassword(wirelessSecurityMap, PSK_KEY, settingName, secretMap); + } else if (WEP_MGMT == secretType || WEP128_MGMT == secretType) { + askSecretForWep(wirelessSecurityMap, settingName, secretMap); + } else if (LEAP_MGMT == secretType) { + askSecretForLeap(wirelessSecurityMap, settingName, secretMap); + } else { + QString errorMsg = "the secret type" + secretType + "is undefined"; + sendError(InvalidConnection, errorMsg); + qWarning()<< LOG_FLAG << errorMsg; + return; + } + + if (secretMap.isEmpty()) { + QString errorMsg = "user cancel get wireless secret"; + sendError(UserCanceled, errorMsg); + qWarning()<< LOG_FLAG << errorMsg; + return; + } + + QVariantMap newSecurityMap = secretMap.value(WIRELESS_SECURITY_NAME); + QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString connectUuid = connectMap.value(UUID_KEY).toString(); + QString connectId = connectMap.value(ID_KEY).toString(); + saveWirelessSecret(newSecurityMap, connectId, connectUuid); + + return; +} + +/* +功能:获取企业wifi类型为非tls的密码,涉及的字段 +802-11-wireless-security.key-mgmt: wpa-eap/ieee8021x +wpa-eap 是wpa/wpa2企业 +ieee8021x 是动态wep(802.1x)需要和普通wifi的leep作区分 +802-1x.eap: ttls/pwd/leap/fast/peap +802-1x.identity: steve +802-1x.password: 23445 +802-1x.password-flags: 1 +*/ +void KylinSecretAgent::askSecretWithIdentityAndPassword(QVariantMap securityMap, + QString userKey, + QString passwordKey, + const QString &settingName, + NMVariantMapMap &secretMap) +{ + QString password = ""; + QString userName = ""; + + if (securityMap.contains(userKey)) { + userName = securityMap.value(userKey).toString(); + } + + if (secretMap.contains(settingName)) { + QVariantMap secretKeyMap = secretMap.value(settingName); + if (!secretKeyMap.isEmpty()) { + password = secretKeyMap.value(passwordKey).toString(); + } + } + + if (password.isEmpty()) { + password = securityMap.value(passwordKey).toString(); + } + + KyPasswordDialog pwdDialog; + pwdDialog.setUserName(userName); + pwdDialog.setPassword(password); + + pwdDialog.exec(); + if(pwdDialog.exec()==QDialog::Accepted){ + QString newPassword = pwdDialog.getPassword(); + QString newUserName = pwdDialog.getUserName(); + QVariantMap newSecurityMap = securityMap; + newSecurityMap[userKey] = newUserName; + newSecurityMap[passwordKey] = newPassword; + secretMap[settingName] = newSecurityMap; + + qDebug() << LOG_FLAG << "password:" << newPassword << newUserName; + } else { + /* + * 如果用户关闭窗口,或者是取消等操作,清空secretmap,后面通过sendError返回结果 + */ + secretMap.clear(); + } + + return; +} + +/* +* 功能:获取tls类型的密码,涉及的字段 +802-1x.eap: tls +802-1x.domain-suffix-match: +802-1x.private-key-password: -- +802-1x.private-key-password-flags: 0(无) +802-1x.identity: steve +*/ +void KylinSecretAgent::askSecretForTls(QVariantMap securityMap, + const QString &settingName, + NMVariantMapMap &secretMap) +{ + QString password = ""; + QString identity = ""; + QString domain = ""; + + qDebug() << LOG_FLAG << "tls security map" << securityMap; + if (securityMap.contains(IDENTITY_KEY)) { + identity = securityMap.value(IDENTITY_KEY).toString(); + } + + if (securityMap.contains(DOMAIN_KEY)) { + domain = securityMap.value(DOMAIN_KEY).toString(); + qDebug() << LOG_FLAG << "domain match" << domain; + } + + if (secretMap.contains(settingName)) { + QVariantMap secretKeyMap = secretMap.value(settingName); + if (!secretKeyMap.isEmpty()) { + password = secretKeyMap.value(PRIVATE_KEY).toString(); + } + } + + if (password.isEmpty()) { + password = securityMap.value(PRIVATE_KEY).toString(); + } + + KyPasswordDialog pwdDialog; + pwdDialog.setUserName(identity); + pwdDialog.setPassword(password); + + pwdDialog.exec(); + if(pwdDialog.exec()==QDialog::Accepted){ + QString newPassword = pwdDialog.getPassword(); + QString newIdentity = pwdDialog.getUserName(); + QVariantMap newSecurityMap = securityMap; + newSecurityMap[IDENTITY_KEY] = newIdentity; + newSecurityMap[PRIVATE_KEY] = newPassword; + newSecurityMap[DOMAIN_KEY] = domain; + secretMap[settingName] = newSecurityMap; + + qDebug() << LOG_FLAG << "tls password:" << newPassword << newIdentity << domain; + } else { + secretMap.clear(); + } + + return; +} + +void KylinSecretAgent::askSecretForEnterpriceWireless(const NMVariantMapMap &connection, + const QString settingName, + NMVariantMapMap &secretMap) +{ + qDebug() << LOG_FLAG <<"askSecretForEnterpriceWireless connection" << connection; + QString secretType = ""; + + QVariantMap enterpriceSecurityMap = connection.value(settingName); + if (enterpriceSecurityMap.contains(EAP_KEY)) { + secretType = enterpriceSecurityMap.value(EAP_KEY).toString(); + } else { + QString errorStr = "can not get enterprice secret type."; + sendError(InvalidConnection, errorStr); + qWarning()<< LOG_FLAG << errorStr; + return; + } + + if (TLS_EAP == secretType) { + askSecretForTls(enterpriceSecurityMap, settingName, secretMap); + } else { + askSecretWithIdentityAndPassword(enterpriceSecurityMap, + IDENTITY_KEY, PASSWORD_KEY, settingName, secretMap); + } + + if (secretMap.isEmpty()) { + QString errorStr = "user cancel get enterprice wireless secret"; + sendError(UserCanceled, errorStr); + qWarning()<< LOG_FLAG << errorStr; + } + + QVariantMap newSecurityMap = secretMap.value(settingName); + QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString connectUuid = connectMap.value(UUID_KEY).toString(); + QString connectId = connectMap.value(ID_KEY).toString(); + saveEnterpriceSecret(newSecurityMap, connectId, connectUuid); + + return; +} + +void KylinSecretAgent::askSecretForVpn(const NMVariantMapMap &connection, + const QString settingName, + NMVariantMapMap &secretMap) +{ + QVariantMap newVpnSetingMap; + + QVariantMap vpnSetingMap = connection.value(VPN_NAME); + if (vpnSetingMap.isEmpty()) { + QString errorStr = "the VPN map of connection is invalide"; + sendError(InvalidConnection, errorStr); + qWarning() << LOG_FLAG << errorStr; + return; + } + + QVariantMap vpnSecretMap = secretMap.value(VPN_NAME); + QStringList vpnSecret = getVpnPassword(vpnSecretMap); + if (vpnSecret.isEmpty() || vpnSecret.size() < 2) { + vpnSecret = getVpnPassword(vpnSetingMap); + } + QString secretKey = vpnSecret.at(0); + QString secretValue= vpnSecret.at(1); + + KyPasswordDialog pwdDialog; + pwdDialog.setPassword(secretValue); + + pwdDialog.exec(); + if(pwdDialog.exec()==QDialog::Accepted){ + QString newPassword = pwdDialog.getPassword(); + newVpnSetingMap = vpnSetingMap; + newVpnSetingMap[VPN_SECRET] = secretKey + "=" + newPassword; + secretMap[VPN_NAME] = newVpnSetingMap; + + QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString connectUuid = connectMap.value(UUID_KEY).toString(); + QString connectId = connectMap.value(ID_KEY).toString(); + saveSecretForVpn(newVpnSetingMap, connectId, connectUuid); + + qDebug() << LOG_FLAG << "vpn password:" << newPassword ; + } else { + QString errorStr = "user canceled get vpn secret"; + sendError(UserCanceled, errorStr); + qWarning() << LOG_FLAG << errorStr; + } + + return; +} + +void KylinSecretAgent::askForSecret(const NMVariantMapMap &connection, + const QString &settingName, + QString connectType, + NMVariantMapMap &secretMap) +{ + if (VPN_TYPE == connectType) { + askSecretForVpn(connection, settingName, secretMap); + } else { + QVariantMap enterpriceSecurityMap = connection.value(ENTERPRICE_NAME); + if (!enterpriceSecurityMap.isEmpty()) { + askSecretForEnterpriceWireless(connection, settingName, secretMap); + } else { + QVariantMap wirelessSecurityMap = connection.value(WIRELESS_SECURITY_NAME); + if (!wirelessSecurityMap.isEmpty()) { + askSecretForWireless(connection, settingName, secretMap); + } else { + qWarning()<< LOG_FLAG << "can not ask secret for wireless"; + } + } + } + + return; +} + +NMVariantMapMap KylinSecretAgent::GetSecrets(const NMVariantMapMap &connection, + const QDBusObjectPath &connection_path, + const QString &settingName, + const QStringList &hints, + uint flags) +{ + //qDebug() << LOG_FLAG <<"GetSecrets connection" << connection; + + qDebug() << LOG_FLAG <<"GetSecrets setting name" << settingName; + qDebug() << LOG_FLAG <<"GetSecrets hints" << hints; + qDebug() << LOG_FLAG <<"GetSecrets flag" << flags; + + NMVariantMapMap secretMap; + + GHashTable *p_attributes = NULL; + GError *p_secretError = NULL; + GCancellable *p_cancellable = g_cancellable_new(); + + QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString connectUuid = connectMap.value(UUID_KEY).toString(); + QString connectType = connectMap.value(TYPE_KEY).toString(); + + p_attributes = secret_attributes_build (&network_manager_secret_schema, + KEYRING_UUID_TAG, connectUuid.toLocal8Bit().data(), + KEYRING_SN_TAG, settingName.toLocal8Bit().data(), + NULL); + if (NULL == p_attributes) { + qWarning() << LOG_FLAG << "create secret arributes for getting secret failed."; + //sendError(); + return secretMap; + } + + GList *p_secretList = secret_service_search_sync(NULL, &network_manager_secret_schema, p_attributes, + (SecretSearchFlags)(SECRET_SEARCH_ALL | SECRET_SEARCH_UNLOCK | SECRET_SEARCH_LOAD_SECRETS), + p_cancellable, &p_secretError); + if (p_secretError) { + if ((flags & AllowInteraction) + && g_error_matches (p_secretError, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN)) { + /* If the connection always asks for secrets, tolerate + * keyring service not being present. */ + qWarning() << LOG_FLAG << "secret dbus failed"; + g_clear_error (&p_secretError); + } else { + QString errorStr = "read secret from keyring error msg: (" + QString(p_secretError->message) + ")"; + qWarning() << LOG_FLAG << errorStr; + sendError(InternalError, errorStr); + g_hash_table_unref (p_attributes); + g_error_free (p_secretError); + g_object_unref(p_cancellable); + return secretMap; + } + } + + if ((flags & AllowInteraction) && g_list_length (p_secretList) == 0) { + qDebug() << LOG_FLAG << "get secret list is empty"; + askForSecret(connection, settingName, connectType, secretMap); + } else { + getSecretFromKeyring(p_secretList, settingName, connectType, secretMap); + bool hintFind = hintIsFind(p_secretList, hints); + if (flags) { + if (!hintFind) { + qDebug() << LOG_FLAG << "can not find hints int keyring"; + askForSecret(connection, settingName, connectType, secretMap); + } else if (flags & RequestNew) { + qDebug() << LOG_FLAG <<"request new secret"; + askForSecret(connection, settingName, connectType, secretMap); + } else if ((flags & AllowInteraction) + && connectionIsAlwaysAsk (connection)) { + qDebug() << LOG_FLAG << "secret is asked always"; + askForSecret(connection, settingName, connectType, secretMap); + } + } + } + + g_hash_table_unref (p_attributes); + g_object_unref(p_cancellable); + + return secretMap; +} + +void KylinSecretAgent::CancelGetSecrets(const QDBusObjectPath &connection_path, const QString &setting_name) +{ + //qDebug() << LOG_FLAG <<"CancelGetSecrets setting name" << setting_name; + //qDebug() << LOG_FLAG <<"CancelGetSecrets path" << connection_path; + + return; +} + +void KylinSecretAgent::saveOneSecret(QString &connectUuid, + QString settingName, + QString secretKey, + QString &secretValue, + QString &displayName) +{ + qDebug()<< LOG_FLAG << "save one secret" + << "display name" << displayName + << "uuid" << connectUuid + << "setting name" << settingName + << "psk key" << secretKey + << "psk secret" << secretValue; + + GHashTable *attrs = NULL; + GError *secretError = NULL; + GCancellable *cancellable = g_cancellable_new(); + + attrs = secret_attributes_build(&network_manager_secret_schema, + KEYRING_UUID_TAG, connectUuid.toLocal8Bit().data(), + KEYRING_SN_TAG, settingName.toLocal8Bit().data(), + KEYRING_SK_TAG, secretKey.toLocal8Bit().data(), + NULL); + if (!attrs) { + QString errorStr = "create secret attri failed"; + qWarning() << LOG_FLAG << errorStr; + g_object_unref (cancellable); + sendError(InternalError, errorStr); + return; + } + + gboolean ret = secret_password_storev_sync(&network_manager_secret_schema, attrs, NULL, + displayName.toLocal8Bit().data(), + secretValue.toLocal8Bit().data(), + cancellable, &secretError); + if (!ret) { + qWarning() << LOG_FLAG << "save secret failed"; + if (secretError) { + QString errorStr = "secret password storev error msg: (" + + QString(secretError->message) + ")"; + qWarning() << LOG_FLAG << errorStr; + sendError(InternalError, errorStr); + g_object_unref(secretError); + } + } + + g_object_unref (cancellable); + g_hash_table_unref (attrs); + + return; +} + +void KylinSecretAgent::saveConnectSecret(QVariantMap &securityMap, + QString secretSettingName, + QString &secretKey, + QString &connectId, + QString &connectUuid) +{ + //to do and test this case + QString secretValue = ""; + + if (!securityMap.contains(secretKey)) { + qWarning() << LOG_FLAG << "the secret key" << secretKey + << "is not contain in security map."; + return; + } + + secretValue = securityMap.value(secretKey).toString(); + if (secretValue.isEmpty()) { + qWarning() << LOG_FLAG << "the leap password is invalid."; + return; + } + + QString displayName = "Network secret for " + connectId + + "/" + secretSettingName + "/" + secretKey; + saveOneSecret(connectUuid, secretSettingName, + secretKey, secretValue, displayName); + + return; +} + +/* +* 802-11-wireless-security.wep-key-type: passphrase or key +* passphrase 是 WEP128位密码句 +* key 是WEP40/128位秘钥(十六进制 或 ASCII) +* 两者对应的相同的mgmt类型:802-11-wireless-security.key-mgmt: none +* 共用该函数,保存密码到秘钥环 +* 涉及的字段 +* 802-11-wireless-security.key-mgmt: none +* 802-11-wireless-security.wep-tx-keyidx: 2 +* 802-11-wireless-security.wep-key0: -- +* 802-11-wireless-security.wep-key1: -- +* 802-11-wireless-security.wep-key2: -- +* 802-11-wireless-security.wep-key3: -- +* 802-11-wireless-security.wep-key-flags: 1 +* 802-11-wireless-security.wep-key-type: passphrase +*/ +void KylinSecretAgent::saveWepSecret(QVariantMap &wirelessSecurityMap, + QString &connectId, + QString &connectUuid) +{ + QString wepSecret = ""; + QString wepKey = ""; + + uint wepKeyId = wirelessSecurityMap.value(WEP_ID_KEY).toUInt(); + + wepKey = getWepKeyFromId(wepKeyId); + if (wepKey.isEmpty()) { + QString errorMsg = "save wep secret, but wep key is invalide."; + qWarning() << LOG_FLAG << errorMsg; + //sendError(); + return; + } + + if (!wirelessSecurityMap.contains(wepKey)) { + qWarning()<::iterator iter; + + iter = wirelessInfo.begin(); + while (iter != wirelessInfo.end()) { + QString flagName = iter.key(); + QString secretName = iter.value(); + if (wirelessSecurityMap.contains(flagName)) { + uint secretFlag = wirelessSecurityMap.value(flagName).toUInt(); + if (POLICY_AGENT_OWNED == secretFlag) { + saveConnectSecret(wirelessSecurityMap, WIRELESS_SECURITY_NAME, + secretName, connectId, connectUuid); + } + + return; + } + + iter ++; + } + + if (wirelessSecurityMap.contains(WEP_FLAG_KEY)) { + uint wepFLags = wirelessSecurityMap.value(WEP_FLAG_KEY).toUInt(); + if (POLICY_AGENT_OWNED == wepFLags) { + saveWepSecret(wirelessSecurityMap, connectId, connectUuid); + } + } + + return; +} + +/* +* 功能:保存企业级的wifi密码到keyring,涉及的主要字段: +* 802-1x.optional: 否 +802-1x.eap: peap +802-1x.identity: steve + +802-1x.ca-cert-password: -- +802-1x.ca-cert-password-flags: 0(无) + +802-1x.client-cert-password: -- +802-1x.client-cert-password-flags: 0(无) + +802-1x.phase2-ca-cert-password: -- +802-1x.phase2-ca-cert-password-flags: 0(无) + +802-1x.phase2-client-cert-password: -- +802-1x.phase2-client-cert-password-flags:0(无) + +802-1x.password: testing +802-1x.password-flags: 0(无) + +802-1x.private-key-password: -- +802-1x.private-key-password-flags: 0(无) + +802-1x.phase2-private-key-password: -- +802-1x.phase2-private-key-password-flags:0(无) + +802-1x.pin: -- +802-1x.pin-flags: 0(无) + +目前根据测试情况,企业wifi密码类型主要分为两类: +1) +802-11-wireless-security.key-mgmt: wpa-eap/ieee8021x +wpa-eap 是wpa/wpa2企业 +ieee8021x 是动态wep(802.1x)需要和普通wifi的leep作区分 +802-1x.eap: ttls/pwd/leap/fast/peap +802-1x.identity: steve +802-1x.password: 23445 +802-1x.password-flags: 1 + +2) +802-1x.eap: tls +802-1x.domain-suffix-match: +802-1x.private-key-password: -- +802-1x.private-key-password-flags: 0(无) +802-1x.identity: steve + +对于下面这种密码类型nm-applet的agnet没有保存,不处理 +802-1x.password-raw: -- +802-1x.password-raw-flags: 0(无) + +通过如下命令可以查看信息: +nmcli connection show [connection uuid] --show-secrets + +通过打印日志,将SaveSecrets函数的入参connection打印出,也可以查看这些信息, +*/ + +void KylinSecretAgent::saveEnterpriceSecret(QVariantMap &enterpriceSecurityMap, + QString &connectId, + QString &connectUuid) +{ + QMap::iterator iter; + + iter = enterpriceInfo.begin(); + while (iter != enterpriceInfo.end()) { + QString flagName = iter.key(); + QString secretName = iter.value(); + if (enterpriceSecurityMap.contains(flagName)) { + uint secretFlags = enterpriceSecurityMap.value(flagName).toUInt(); + if (POLICY_AGENT_OWNED == secretFlags) { + saveConnectSecret(enterpriceSecurityMap, + ENTERPRICE_NAME, secretName, connectId, connectUuid); + } + } + + iter++; + } + + return; +} + +/* +* 功能:将wifi的密码保存到keyring上面 +* 先判断有没有企业级wifi的安全字段,有的话就从其获取要保存到keyring的密码 +* 如果没有那就从普通wifi的安全字段获取要保存到keyring的密码 +* +* 注意事项: +* 目前的测试情况:企业wifi和普通wifi的安全字段只有一个起作用,即互斥关系, +* 不能排除共存的情况,如果出现需要另做调整 +*/ + +void KylinSecretAgent::saveSecretForWireless(const NMVariantMapMap &connection, + QString &connectId, + QString &connectUuid) +{ + QVariantMap enterpriceSecurityMap = connection.value(ENTERPRICE_NAME); + if (!enterpriceSecurityMap.isEmpty()) { + saveEnterpriceSecret(enterpriceSecurityMap, connectId, connectUuid); + } else { + QVariantMap wirelessSecurityMap = connection.value(WIRELESS_SECURITY_NAME); + if (!wirelessSecurityMap.isEmpty()) { + saveWirelessSecret(wirelessSecurityMap, connectId, connectUuid); + } else { + QString errorStr = "wireless is invalid, save secret failed."; + sendError(InvalidConnection, errorStr); + qWarning() << LOG_FLAG << errorStr; + } + } + + return; +} + +QString KylinSecretAgent::getVpnDataItemByKey(QVariantMap &vpnMap, QString key) +{ + QString value = ""; + + QString vpnData = vpnMap.value(VPN_DATA).toString(); + if (vpnData.isEmpty()) { + qWarning() << LOG_FLAG << "vpn data is empty"; + return value; + } + + QStringList vpnDataList = vpnData.split(","); + int index = vpnDataList.indexOf(key); + if (index < 0) { + qWarning() << LOG_FLAG << "it can not find key" << key << "from vpn data"; + return value; + } + + QString vpnDataItem = vpnDataList.at(index); + QStringList keyList = vpnDataItem.split("="); + if (keyList.isEmpty() || keyList.size() < 2) { + return value; + } + + value = keyList.at(1); + + return value; +} + +QStringList KylinSecretAgent::getVpnPassword(QVariantMap &vpnMap) +{ + QStringList vpnPassword; + QString vpnSecret; + + vpnSecret.clear(); + vpnPassword.clear(); + + vpnSecret = vpnMap.value(VPN_SECRET).toString(); + if (vpnSecret.contains("=")) { + vpnPassword = vpnSecret.split("="); + } + + return vpnPassword; +} +/* +* 功能:将vpn的密码保存到keyring上面,vpn涉及的字段如下: + +vpn.service-type: org.freedesktop.NetworkManager.pptp +vpn.user-name: -- +vpn.data: gateway = 127.2.2.2, password-flags = 1, user = admin +vpn.secrets: password = 123456 +vpn.persistent: 否 +vpn.timeout: 0 + +其中主要的字段: +1)vpn.data中的password-flags,检查是否存于keyring +2)vpn.secrets中的password 是要存于keyring的密码,存密码时的key为password + +注意事项: +vpn.secrets可能会有多个密码,目前没有遇到,等遇到的时候在调试,目前先按一个处理 + +通过如下命令可以查看信息: +nmcli connection show [connection uuid] --show-secrets + +通过打印日志,将SaveSecrets函数的入参connection打印出,也可以查看这些信息, +***/ +void KylinSecretAgent::saveSecretForVpn(QVariantMap &vpnSetingMap, + QString &connectId, + QString &connectUuid) +{ + if (vpnSetingMap.isEmpty()) { + QString errorStr = "VPN map is empty"; + sendError(InvalidConnection, errorStr); + qWarning() << LOG_FLAG << errorStr; + return; + } + + QString vpnFlag = getVpnDataItemByKey(vpnSetingMap, VPN_FLAG); + if (vpnFlag.isEmpty() || POLICY_AGENT_OWNED != vpnFlag.toInt()){ + return; + } + + QStringList vpnSecret = getVpnPassword(vpnSetingMap); + if (vpnSecret.isEmpty() || vpnSecret.size() < 2) { + QString errorStr = "the vpn secret is invalid"; + sendError(NoSecrets, errorStr); + qWarning() << LOG_FLAG << errorStr; + return; + } + + QString secretKey = vpnSecret.at(0); + QString secretValue= vpnSecret.at(1); + + QString vpnService = vpnSetingMap.value(VPN_SERVICE).toString(); + QString displayName = "VPN" + vpnSecret.at(0) + "secret for" + + connectId + vpnService + "/vpn"; + + + saveOneSecret(connectUuid, VPN_NAME, secretKey, secretValue, displayName); + + return; + +} + +void KylinSecretAgent::SaveSecrets(const NMVariantMapMap &connection, + const QDBusObjectPath &connection_path) +{ + qDebug() << LOG_FLAG <<"SaveSecrets connection" << connection; + + //GError *secretError = NULL; + GCancellable *cancellable = g_cancellable_new(); + + QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString connectUuid = connectMap.value(UUID_KEY).toString(); + + secret_password_clear_sync(&network_manager_secret_schema, + cancellable, NULL, + KEYRING_UUID_TAG, + connectUuid.toLocal8Bit().data(), NULL); + if (g_cancellable_is_cancelled(cancellable)) { + qWarning() << LOG_FLAG << "save secret is canceled"; + g_object_unref(cancellable); + return; + } + + QString connectType = connectMap.value(TYPE_KEY).toString(); + QString connectId = connectMap.value(ID_KEY).toString(); + if (VPN_TYPE == connectType) { + QVariantMap vpnSetingMap = connection.value(VPN_NAME); + saveSecretForVpn(vpnSetingMap, connectId, connectUuid); + } else { + saveSecretForWireless(connection, connectId, connectUuid); + } + + return; +} + +void KylinSecretAgent::DeleteSecrets(const NMVariantMapMap &connection, + const QDBusObjectPath &connection_path) +{ + //qDebug() << LOG_FLAG <<"DeleteSecrets connection" << connection; + + GError *secretError = NULL; + GCancellable *cancellable = g_cancellable_new(); + + QVariantMap connectMap = connection.value(CONNECTION_KEY); + QString uuid = connectMap.value(UUID_KEY).toString(); + + secret_password_clear_sync(&network_manager_secret_schema, + cancellable, + &secretError, + KEYRING_UUID_TAG, + uuid.toLocal8Bit().data(), + NULL); + + if (g_cancellable_is_cancelled(cancellable)) { + qWarning() << LOG_FLAG << "delete secret is canceled"; + g_object_unref(cancellable); + return; + } + + if (secretError != NULL) { + QString errorStr = "The request could not be completed (" + + QString(secretError->message) + ")"; + sendError(InternalError, errorStr); + g_error_free(secretError); + } + + g_object_unref(cancellable); + return; +} diff --git a/libnm-kylin/libnm-external-kylin/kylin-agent/kylinsecretagent.h b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinsecretagent.h new file mode 100644 index 00000000..38707719 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-agent/kylinsecretagent.h @@ -0,0 +1,110 @@ +#ifndef KYLINSECRETAGENT_H +#define KYLINSECRETAGENT_H + +#include + +#include +#include + +#include "kylinagentutils.h" + +class KylinSecretAgent: public NetworkManager::SecretAgent +{ + Q_OBJECT + +public: + explicit KylinSecretAgent(const QString &id, QObject *parent = nullptr); + ~KylinSecretAgent(); + +private: + void saveOneSecret(QString &connectUuid, QString settingName, + QString secretKey, QString &secretValue, QString &displayNmae); + void saveConnectSecret(QVariantMap &securityMap, QString secretSettingName, + QString &secretKey, QString &connectId, QString &connectUuid); + + void saveWepSecret(QVariantMap &wirelessSecurityMap, + QString &connectId, QString &connectUuid); + void saveWirelessSecret(QVariantMap &wirelessSecurityMap, + QString &connectId, QString &connectUuid); + + void saveEnterpriceSecret(QVariantMap &enterpriceSecurityMap, + QString &connectId, QString &connectUuidd); + + void saveSecretForWireless(const NMVariantMapMap &connection, + QString &connectId, QString &connectUuid); + + QStringList getVpnPassword(QVariantMap &vpnSettingMap); + QString getVpnDataItemByKey(QVariantMap &vpnSettingMap, QString key); + void saveSecretForVpn(QVariantMap &vpnSetingMap, + QString &connectId, QString &connectUuid); + + void getSecretFromKeyring(GList *p_secretList, const QString &settingName, + QString connectType, NMVariantMapMap &secretMap); + bool hintIsFind(GList *p_secretList, const QStringList &hints); + bool connectionIsAlwaysAsk(const NMVariantMapMap &connection); + QString getWepKeyFromId(uint wepId); + + + void askSecretForLeap(QVariantMap &wirelessSecurityMap, + const QString &settingName, NMVariantMapMap &secretMap); + void askSecretForWep(QVariantMap &wirelessSecurityMap, + const QString &settingName, NMVariantMapMap &secretMap); + void askSecretForPassword(QVariantMap &securityMap, QString passwordKey, + const QString &settingName, NMVariantMapMap &secretMap); + void askSecretForWireless(const NMVariantMapMap &connection, + const QString settingName, NMVariantMapMap &secretMap); + + void askSecretForTls(QVariantMap securityMap, + const QString &settingName, NMVariantMapMap &secretMap); + void askSecretWithIdentityAndPassword(QVariantMap securityMap, QString userKey, + QString passwordKey, const QString &settingName, NMVariantMapMap &secretMap); + void askSecretForEnterpriceWireless(const NMVariantMapMap &connection, + const QString settingName, NMVariantMapMap &secretMap); + void askSecretForVpn(const NMVariantMapMap &connection, + const QString settingName, NMVariantMapMap &secretMap); + void askForSecret(const NMVariantMapMap &connection, const QString &settingName, + QString connectType, NMVariantMapMap &secretMap); + +public Q_SLOTS: + + /* + * kylin-nm的agent功能主要是实现如下四个函数,这四个函数继承自父类NetworkManager::SecretAgent + * 当发生错误的时候,调用父类的sendError函数,给networkmanager返回结果 + * 调试方式 + * 根据kylin-nm移植的nm-applet的agent功能代码添加日志,进行流程调试梳理,完成了该代码的开发, + * 后续出了问题可以通过这种方式理顺流程调试解决问题。 + * 注意事项: + * 1)所有的函数对keyring的操作都是同步的,需要其单独的agent线程,否则容易阻塞 + * 2)目前代码只是对能够测试到的情况做了代码实现,有可能会有遗漏的地方,后续出现新情况,在完善。 + */ + + /* + * 该函数从秘钥环上面获取密码,并将获取到的密码组成networkamanger需要的mapmap类型返回,失败后通过sendError返回错误, + * 函数的返回值将变得无效 + */ + NMVariantMapMap GetSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path, + const QString &setting_name, const QStringList &hints, uint flags); + + /* + * 该函数用于取消agent的操作,从测试的情况来看,目前没有发现在什么时候会出现这种情况 + * 暂时未实现,后期注意观察,出现问题后根据具体情况实现, + * 返回值为空,如果出现错误,通过sendError返回错误 + */ + void CancelGetSecrets(const QDBusObjectPath &connection_path, const QString &setting_name); + + /* + * 该函数将密码保存到keyring上面,要保存的密码可以在connection参数中查找到, + * 返回值为空,如果出现错误,通过sendError返回错误 + */ + void SaveSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path); + /* + * 该函数将密码从keyring上面删除,返回值为空,如果出现错误,通过sendError返回错误 + */ + void DeleteSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path); + +private: + QMap enterpriceInfo; + QMap wirelessInfo; +}; + +#endif // KYLINSECRETAGENT_H diff --git a/libnm-kylin/libnm-external-kylin/kylin-dbus/kylin-dbus.pri b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylin-dbus.pri new file mode 100644 index 00000000..0639cc7b --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylin-dbus.pri @@ -0,0 +1,12 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/kylindbusadapter.h \ + $$PWD/kylindbusinterfrace.h \ + $$PWD/kylinnetworkmanagerdbus.h + +SOURCES += \ + $$PWD/kylindbusadapter.cpp \ + $$PWD/kylindbusinterface.cpp \ + $$PWD/kylinnetworkmanagerdbus.cpp + diff --git a/libnm-kylin/libnm-external-kylin/kylin-dbus/kylindbusadapter.cpp b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylindbusadapter.cpp new file mode 100644 index 00000000..bb752fa4 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylindbusadapter.cpp @@ -0,0 +1,183 @@ +/* + * This file was generated by qdbusxml2cpp version 0.8 + * Command line was: qdbusxml2cpp com.kylin.weather.xml -a dbusadaptor -c DbusAdaptor -l MainWindow + * + * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd. + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#include "kylindbusadapter.h" +#include +#include +#include +#include +#include +#include +#include + +const QByteArray GSETTINGS_SCHEMA_KYLIN_NM = "org.ukui.kylin-nm.switch"; +const QString KEY_WIRELESS_SWITCH = "wirelessswitch"; +const QString KEY_WIRED_SWITCH = "wiredswitch"; + +/* + * Implementation of adaptor class DbusAdaptor + */ + +KylinDbusAdaptor::KylinDbusAdaptor(KylinDbusInterface *parent) + : QDBusAbstractAdaptor(parent) +{ + // constructor + qDBusRegisterMetaType >(); + qDBusRegisterMetaType >(); + qDBusRegisterMetaType >(); + qDBusRegisterMetaType >>(); + //setAutoRelaySignals(true)后会自动转发kylindbusinterface发出的同名信号,因此不必再额外写一个转发 + setAutoRelaySignals(true); +} + +KylinDbusAdaptor::~KylinDbusAdaptor() +{ + // destructor +} + +//无线列表 +QMap > KylinDbusAdaptor::getWirelessList() +{ + QMap > map; + parent()->getWirelessList(map); + return map; +} + +//有线列表 +QMap> KylinDbusAdaptor::getWiredList() +{ + QMap> map; + parent()->getWiredList(map); + return map; +} + +//有线开关 +void KylinDbusAdaptor::setWiredSwitchEnable(bool enable) +{ + +} + +//无线开关 +void KylinDbusAdaptor::setWirelessSwitchEnable(bool enable) +{ + parent()->setWirelessSwitchEnable(enable); +} + +//启用/禁用网卡 +void KylinDbusAdaptor::setDeviceEnable(QString devName, bool enable) +{ + parent()->setWiredDeviceEnable(devName, enable); +// saveDeviceEnableState(devName, enable); +} + +//连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid +void KylinDbusAdaptor::activateConnect(int type, QString devName, QString ssid) +{ +// if (type == WIRED) { +// parent()->activateWired(devName,ssid); +// } else if (type == WIRELESS) { +// parent()->activateWireless(devName,ssid); +// } else { +// qDebug() << "[DbusAdaptor] activateConnect type is invalid"; +// } +} + +//断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid +void KylinDbusAdaptor::deActivateConnect(int type, QString devName, QString ssid) +{ +// if (type == WIRED) { +// qDebug() << "deactivateWired"; +// parent()->deactivateWired(devName,ssid); +// } else if (type == WIRELESS) { +// parent()->deactivateWireless(devName,ssid); +// } else { +// qDebug() << "[DbusAdaptor] deactivateConnect type is invalid"; +// } +} + +//获取设备列表和启用/禁用状态 +/* +* 由于要读取配置文件的信息,配置文件的位置,可能在登录界面无法获取配置文件的内容 +*/ +QMap KylinDbusAdaptor::getDeviceListAndEnabled(int devType) +{ + QMap map; + map.clear(); +// getDeviceEnableState(devType, map); + return map; +} + +//获取无线设备能力 +QMap KylinDbusAdaptor::getWirelessDeviceCap() +{ + QMap map; + parent()->getWirelessDeviceCapability(map); + return map; +} + +////唤起属性页 根据网卡类型 参数2 为ssid/uuid +//void KylinDbusAdaptor::showPropertyWidget(QString devName, QString ssid) +//{ +// qDebug() << "showPropertyWidget"; +// parent()->showPropertyWidget(devName,ssid); +//} + +////唤起新建有线连接界面 +//void KylinDbusAdaptor::showCreateWiredConnectWidget(QString devName) +//{ +// qDebug() << "showCreateWiredConnectWidget"; +// parent()->showCreateWiredConnectWidget(devName); +//} + +//开启热点 +void KylinDbusAdaptor::activeWirelessAp(const QString apName, const QString apPassword, const QString band, const QString apDevice) +{ + parent()->activeWirelessAp(apName, apPassword, band, apDevice); +} + +//断开热点 +void KylinDbusAdaptor::deactiveWirelessAp(const QString apName, const QString uuid) +{ + parent()->deactiveWirelessAp(apName, uuid); +} + +//获取热点 +QStringList KylinDbusAdaptor::getStoredApInfo() +{ + QStringList list; + list.clear(); + parent()->getStoredApInfo(list); + return list; +} + +QStringList KylinDbusAdaptor::getApInfoBySsid(QString devName, QString ssid) +{ + QStringList list; + list.clear(); + parent()->getApInfoBySsid(devName, ssid, list); + return list; +} + + +//扫描 +void KylinDbusAdaptor::reScan() +{ + parent()->rescanWireless(); +} + +void KylinDbusAdaptor::startAgent() +{ + parent()->startAgent(); +} + +void KylinDbusAdaptor::stopAgent() +{ + parent()->stopAgent(); +} diff --git a/libnm-kylin/libnm-external-kylin/kylin-dbus/kylindbusadapter.h b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylindbusadapter.h new file mode 100644 index 00000000..baac4af0 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylindbusadapter.h @@ -0,0 +1,119 @@ +/* + * This file was generated by qdbusxml2cpp version 0.8 + * Command line was: qdbusxml2cpp com.kylin.weather.xml -a dbusadaptor -c DbusAdaptor -l MainWindow + * + * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd. + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#ifndef KYLINDBUSADAPTOR_H +#define KYLINDBUSADAPTOR_H + +#include +#include +#include +#include "kylindbusinterfrace.h" + +QT_BEGIN_NAMESPACE +class QByteArray; +template class QMap; +class QString; +class QStringList; +class QVariant; +template class QVector; +QT_END_NAMESPACE + +/* + * Adaptor class for interface com.kylin.weather + */ + +class KylinDbusAdaptor: public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "com.kylin.network") + +public: + KylinDbusAdaptor(KylinDbusInterface *parent); + virtual ~KylinDbusAdaptor(); + + /* + * 为了套用之前的dbus框架,这里构造KylinDbusInterface类,该类起到MainWindow的作用 + * 并需要实现该类 + */ + inline KylinDbusInterface *parent() const { + return static_cast(QObject::parent()); + } + +public Q_SLOTS: // METHODS + //无线列表 + QMap > getWirelessList(); + //有线列表 + QMap> getWiredList(); + //有线总开关 + Q_NOREPLY void setWiredSwitchEnable(bool enable); + //无线总开关 + Q_NOREPLY void setWirelessSwitchEnable(bool enable); + //有线网卡开关 + Q_NOREPLY void setDeviceEnable(QString devName, bool enable); + //连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid + Q_NOREPLY void activateConnect(int type, QString devName, QString ssid); + //断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid + Q_NOREPLY void deActivateConnect(int type, QString devName, QString ssid); + //获取设备列表和启用/禁用状态 + QMap getDeviceListAndEnabled(int devType); + //获取无线设备能力 + QMap getWirelessDeviceCap(); +// //唤起属性页 根据网卡类型 参数2 为ssid/uuid +// Q_NOREPLY void showPropertyWidget(QString devName, QString ssid); +// //唤起新建有线连接界面 +// Q_NOREPLY void showCreateWiredConnectWidget(QString devName); + //开启热点 + void activeWirelessAp(const QString apName, const QString apPassword, const QString band, const QString apDevice); + //断开热点 + void deactiveWirelessAp(const QString apName, const QString uuid); + //获取热点 + QStringList getStoredApInfo(); + QStringList getApInfoBySsid(QString devName, QString ssid); + //wifi扫描 + void reScan(); + //keyring + void startAgent(); + void stopAgent(); + +Q_SIGNALS: // SIGNALS + + void lanAdd(QString devName, QStringList info); + void lanRemove(QString dbusPath); + void lanUpdate(QString devName, QStringList info); + + void wlanAdd(QString devName, QStringList info); + void wlanRemove(QString devName,QString ssid); + + void wlanactiveConnectionStateChanged(QString devName, QString ssid, QString uuid, int status); + void lanActiveConnectionStateChanged(QString devName, QString uuid, int status); + + //仅失败,若成功直接发listUpdate + void activateFailed(QString errorMessage); + void deactivateFailed(QString errorMessage); + + //设备插拔 + void deviceStatusChanged(); + void deviceNameChanged(QString oldName, QString newName, int type); + + //热点断开 + void hotspotDeactivated(QString devName, QString ssid); + //热点连接 + void hotspotActivated(QString devName, QString ssid, QString uuid); + + //信号强度变化 + void signalStrengthChange(QString devName, QString ssid, int strength); + //安全性变化 + void secuTypeChange(QString devName, QString ssid, QString secuType); + //列表排序 + void timeToUpdate(); +}; + +#endif diff --git a/libnm-kylin/libnm-external-kylin/kylin-dbus/kylindbusinterface.cpp b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylindbusinterface.cpp new file mode 100644 index 00000000..14421f6f --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylindbusinterface.cpp @@ -0,0 +1,375 @@ +#include "kylindbusinterfrace.h" + +#define LOG_FLAG "[KylinDbusInterface]" + +KylinDbusInterface::KylinDbusInterface(QObject *parent) : QObject(parent) +{ + m_activeConnectResource = new KyActiveConnectResourse(this); + connect(m_activeConnectResource, &KyActiveConnectResourse::wiredStateChange, + this, &KylinDbusInterface::lanConnectionStateChanged); + connect(m_activeConnectResource, &KyActiveConnectResourse::wirelessStateChange, + this, &KylinDbusInterface::onWlanStateChange); + + m_connectResource = new KyConnectResourse(this); + connect(m_connectResource, &KyConnectResourse::wiredConnectionAdd, this, &KylinDbusInterface::onLanAdd); + connect(m_connectResource, &KyConnectResourse::wiredConnectionRemove, this, &KylinDbusInterface::lanRemoved); + connect(m_connectResource, &KyConnectResourse::wiredConnectionUpdate, this, &KylinDbusInterface::onLanUpdate); + + m_deviceResource = new KyNetworkDeviceResourse(this); + connect(m_deviceResource, &KyNetworkDeviceResourse::wiredDeviceAdd, this, &KylinDbusInterface::wiredDeviceAdd); + connect(m_deviceResource, &KyNetworkDeviceResourse::wiredDeviceRemove, this, &KylinDbusInterface::wiredDeviceRemove); + connect(m_deviceResource, &KyNetworkDeviceResourse::wiredDeviceNameUpdate, this, &KylinDbusInterface::wiredDeviceNameUPdate); + + m_wirelessResource = new KyWirelessNetResource(this); + connect(m_wirelessResource, &KyWirelessNetResource::secuTypeChange, this, &KylinDbusInterface::securityTypeChanged); + connect(m_wirelessResource, &KyWirelessNetResource::signalStrengthChange, this, &KylinDbusInterface::signalStrengthChanged); + + connect(m_wirelessResource, &KyWirelessNetResource::wifiNetworkAdd, this, &KylinDbusInterface::onWlanAdd); + connect(m_wirelessResource, &KyWirelessNetResource::wifiNetworkRemove, this, &KylinDbusInterface::wlanRemoved); + + connect(m_wirelessResource, &KyWirelessNetResource::wirelessDeviceAdd, this, &KylinDbusInterface::wirelessDeviceAdd); + connect(m_wirelessResource, &KyWirelessNetResource::wirelessDeviceRemove, this, &KylinDbusInterface::wirelessDeviceRemove); + connect(m_wirelessResource, &KyWirelessNetResource::wirelessDeviceNameUpdate, this, &KylinDbusInterface::wirelessDeviceNameUPdate); + + m_wirelessOperation = new KyWirelessConnectOperation(this); + m_wiredOperation = new KyWiredConnectOperation(this); + + m_secretAgent = KylinAgent::getInstance(); +} + +KylinDbusInterface::~KylinDbusInterface() +{ + +} + +void KylinDbusInterface::onLanAdd(QString connectUuid, QString connectName, QString connectPath) +{ + QStringList info; + info << connectName << connectUuid << connectPath; + + QString deviceName = ""; + m_connectResource->getInterfaceByUuid(deviceName, connectUuid); + + Q_EMIT lanAdded(deviceName, info); + + return; +} + +void KylinDbusInterface::onLanUpdate(QString connectUuid, QString connectName, QString connectPath) +{ + QStringList info; + info << connectName << connectUuid << connectPath; + + QString deviceName = ""; + if (m_connectResource->isActivatedConnection(connectUuid)) { + deviceName = m_activeConnectResource->getDeviceOfActivateConnect(connectUuid); + } else { + m_connectResource->getInterfaceByUuid(deviceName, connectUuid); + } + + Q_EMIT lanUpdated(deviceName, info); + + return; +} + +void KylinDbusInterface::onWlanAdd(QString deviceName, KyWirelessNetItem &item) +{ + QStringList info; + + info << item.m_NetSsid + << QString::number(item.m_signalStrength) + << item.m_secuType + << (m_connectResource->isApConnection(item.m_connectUuid) ? IsApConnection : NotApConnection); + + Q_EMIT wlanAdded(deviceName, info); + + return; +} + +void KylinDbusInterface::onWlanStateChange(QString deviceName, QString ssid, QString uuid, KyConnectState state) +{ + Q_EMIT wlanConnectionStateChanged(deviceName, ssid, uuid, state); + + if (m_connectResource->isApConnection(uuid)) { + if (CONNECT_STATE_DEACTIVATED == state) { + Q_EMIT hotspotDeactivated(deviceName, ssid); + } else if (CONNECT_STATE_ACTIVATED) { + Q_EMIT hotspotActivated(deviceName, ssid, uuid); + } + } + + return; +} + +void KylinDbusInterface::getWirelessList(QMap> &map) +{ + QMap actMap; + m_wirelessResource->getWirelessActiveConnection(CONNECT_STATE_ACTIVATED, actMap); + + QMap > wlanMap; + if (!m_wirelessResource->getWifiNetworkOfAllDevice(wlanMap)) { + return; + } + + QMap >::iterator iter = wlanMap.begin(); + while (iter != wlanMap.end()) { + QVector vector; + QString activeSsid ; + //先是已连接 + if (actMap.contains(iter.key())) { + KyWirelessNetItem data; + QString ssid =""; + m_wirelessResource->getSsidByUuid(actMap[iter.key()].at(0), ssid); + if (m_wirelessResource->getWifiNetwork(iter.key(), ssid, data)) { + vector.append(QStringList() << data.m_NetSsid + << QString::number(data.m_signalStrength) + << data.m_secuType + << data.m_connectUuid + << (m_connectResource->isApConnection(data.m_connectUuid) ? IsApConnection : NotApConnection)); + activeSsid = data.m_NetSsid; + } else { + vector.append(QStringList("--")); + } + } else { + vector.append(QStringList("--")); + } + //未连接 + Q_FOREACH (auto itemData, iter.value()) { + if (itemData.m_NetSsid == activeSsid) { + continue; + } + vector.append(QStringList()<isApConnection(itemData.m_connectUuid) ? IsApConnection : NotApConnection)); + } + + map.insert(iter.key(), vector); + iter++; + } + + return; +} + +void KylinDbusInterface::getWiredList(QMap> &map) +{ + QStringList devlist; + m_deviceResource->getNetworkDeviceList(DEVICE_TYPE_ETHERNET, devlist); + if (devlist.isEmpty()) { + return; + } + + Q_FOREACH (auto deviceName, devlist) { + QList activedList; + QList deactivedList; + QVector vector; + m_activeConnectResource->getActiveConnectionList(deviceName, CONNECT_TYPE_WIRED, activedList); + if (!activedList.isEmpty()) { + vector.append(QStringList() << activedList.at(0)->m_connectName + << activedList.at(0)->m_connectUuid + << activedList.at(0)->m_connectPath); + } else { + vector.append(QStringList()<<("--")); + } + + m_connectResource->getConnectionList(deviceName, CONNECT_TYPE_WIRED, deactivedList); //未激活列表的显示 + if (!deactivedList.isEmpty()) { + for (int i = 0; i < deactivedList.size(); i++) { + vector.append(QStringList()<m_connectName + <m_connectUuid + << deactivedList.at(i)->m_connectPath); + } + } + map.insert(deviceName, vector); + } + + return; +} + +//开启/断开热点 +void KylinDbusInterface::activeWirelessAp(const QString apName, const QString apPassword, + const QString wirelessBand, const QString apDevice) +{ + QString uuid(""); + QList apConnectItemList; + m_connectResource->getApConnections(apConnectItemList); + if (!apConnectItemList.isEmpty()) { + uuid = apConnectItemList.at(0)->m_connectUuid; + } + + m_wirelessOperation->activeWirelessAp(uuid, apName, apPassword, apDevice, wirelessBand); + + return; +} + +void KylinDbusInterface::deactiveWirelessAp(const QString apName, const QString uuid) +{ + if (!uuid.isEmpty()) { + m_wirelessOperation->deactiveWirelessAp(apName, uuid); + } + + return; +} + +//获取热点信息 +void KylinDbusInterface::getStoredApInfo(QStringList &list) +{ + list.clear(); + QList apConnectItemList; + m_connectResource->getApConnections(apConnectItemList); + if (!apConnectItemList.isEmpty()) { + list << apConnectItemList.at(0)->m_connectSsid; + list << apConnectItemList.at(0)->m_password; + list << apConnectItemList.at(0)->m_ifaceName; + list << (apConnectItemList.at(0)->m_isActivated? "true":"false"); + list << apConnectItemList.at(0)->m_connectUuid; + list << apConnectItemList.at(0)->m_band; + } + + return; +} + +void KylinDbusInterface::getApInfoBySsid(QString deviceName, QString ssid, QStringList &list) +{ + list.clear(); + QList apConnectItemList; + m_connectResource->getApConnections(apConnectItemList); + for (int i = 0; i < apConnectItemList.size(); i++) { + if (apConnectItemList.at(i)->m_connectSsid == ssid + && apConnectItemList.at(i)->m_ifaceName == deviceName) { + list << apConnectItemList.at(i)->m_password; + list << apConnectItemList.at(i)->m_band; + } + } + + return; +} + +//激活/断开有线连接 +void KylinDbusInterface::activateWiredConnection(const QString &deviceName, const QString &connUuid) +{ + if (!m_deviceResource->wiredDeviceIsCarriered(deviceName)) { + qDebug() << LOG_FLAG << deviceName << "is not carried, so can not activate connection"; + //showDesktopNotify(tr("Wired Device not carried")); + } else { + m_wiredOperation->activateConnection(connUuid, deviceName); + } + + return; +} + +void KylinDbusInterface::deactivateWiredConnection(const QString &deviceName, const QString &connUuid) +{ + qDebug()<< LOG_FLAG << "deactivateWired, device:" << deviceName <<"uuid:" << connUuid; + QString connecName = ""; + m_wiredOperation->deactivateWiredConnection(connecName, connUuid); + + return; +} + +/* +* 无线网络激活,需要密码,需要和kylin-nm进行交互,如果改成后台服务的话需要对下面的两个函数功能进行重新定义 +* 包括参数的内容 +*/ +void KylinDbusInterface::activateWirelessConnection(const QString &deviceName, const QString &ssid) +{ +// KyWirelessNetItem wirelessNetItem; +// if (!m_wirelessResource->getWifiNetwork(devName, ssid, wirelessNetItem)) { +// qDebug() << "[WlanPage] no such wifi " << ssid << " in " << devName; +// return; +// } + +// QListWidgetItem *p_listWidgetItem = nullptr; +// WlanListItem *p_wlanItem = nullptr; + +// if (m_wirelessNetItemMap.contains(ssid)) { +// p_listWidgetItem = m_wirelessNetItemMap.value(ssid); +// p_wlanItem = (WlanListItem*)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem); + +// m_inactivatedNetListWidget->scrollToItem(p_listWidgetItem, QAbstractItemView::EnsureVisible); + + +// QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, QPoint(0,0), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// QApplication::postEvent(p_wlanItem, event); +// Q_EMIT showMainWindow(); +// } else { +// qDebug() << "[WlanPage]activateWirelessConnection no such " << ssid << "in" << devName; +// } + +// return; +} + +void KylinDbusInterface::deactivateWirelessConnection(const QString &deviceName, const QString &ssid) +{ +// KyWirelessNetItem wirelessNetItem; +// if (!m_wirelessResource->getWifiNetwork(devName, ssid, wirelessNetItem)) { +// qDebug()<< LOG_FLAG << "no such wifi " << ssid << " in " << devName; +// return; +// } + +// if (!m_connectResource->isActivatedConnection(wirelessNetItem.m_connectUuid)) { +// qDebug()<deActivateWirelessConnection(wirelessNetItem.m_connName, wirelessNetItem.m_connectUuid); + +// return; +} + +//无线总开关 +void KylinDbusInterface::setWirelessSwitchEnable(bool enable) +{ + m_wirelessOperation->setWirelessEnabled(enable); + + return; +} + +void KylinDbusInterface::setWiredDeviceEnable(const QString &devName, bool enable) +{ + //3.1版本需要保存网卡的状态在、到配置文件,此处由于涉及到登录界面的问题,无法确定配置文件的位置,有待优化 + if (enable) { + m_wiredOperation->openWiredNetworkWithDevice(devName); + } else { + m_wiredOperation->closeWiredNetworkWithDevice(devName); + } + + return; +} + + +void KylinDbusInterface::getWirelessDeviceCapability(QMap &map) +{ + QStringList deviceList; + + deviceList.clear(); + m_deviceResource->getNetworkDeviceList(DEVICE_TYPE_WIFI, deviceList); + for (int i = 0; i < deviceList.size(); ++i) { + QString deviceName = deviceList.at(i); + int wirelessDeviceCapability = m_deviceResource->getWirelessDeviceCapability(deviceName); + map.insert(deviceName, wirelessDeviceCapability); + } + + return; +} + +void KylinDbusInterface::rescanWireless() +{ + m_wirelessOperation->requestWirelessScan(); + + return; +} + +void KylinDbusInterface::startAgent() +{ + m_secretAgent->startKylinAgent(); + + return; +} + +void KylinDbusInterface::stopAgent() +{ + m_secretAgent->stopKylinAgent(); + + return; +} diff --git a/libnm-kylin/libnm-external-kylin/kylin-dbus/kylindbusinterfrace.h b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylindbusinterfrace.h new file mode 100644 index 00000000..9617298f --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylindbusinterfrace.h @@ -0,0 +1,112 @@ +#ifndef KYLINDBUSINTERFRACE_H +#define KYLINDBUSINTERFRACE_H + +#include "kylinactiveconnectresource.h" +#include "kylinwirednetresource.h" +#include "kylinnetworkdeviceresource.h" +#include "kylinnetworkresourcemanager.h" +#include "kylinwiredconnectoperation.h" +#include "kywirelessconnectoperation.h" +#include "kywirelessnetresource.h" +#include "kylinagent.h" + +#include + +const QString NotApConnection = "0"; +const QString IsApConnection = "1"; + +class KylinDbusInterface : public QObject +{ + Q_OBJECT + +public: + explicit KylinDbusInterface(QObject *parent = nullptr); + ~KylinDbusInterface(); + +public: + void getWirelessList(QMap > &map); + void getWiredList(QMap> &map); + + //开启/断开热点 + void activeWirelessAp(const QString apName, const QString apPassword, + const QString wirelessBand, const QString apDevice); + void deactiveWirelessAp(const QString apName, const QString uuid); + + //获取热点信息 + void getStoredApInfo(QStringList &list); + void getApInfoBySsid(QString devName, QString ssid, QStringList &list); + + //激活/断开有线连接 + void activateWiredConnection(const QString &devName, const QString &connUuid); + void deactivateWiredConnection(const QString &devName, const QString &connUuid); + + //激活/断开无线连接 + void activateWirelessConnection(const QString &devName, const QString &ssid); + void deactivateWirelessConnection(const QString &devName, const QString &ssid); + + //无线总开关 + void setWirelessSwitchEnable(bool enable); + void setWiredDeviceEnable(const QString &devName, bool enable); + + void getWirelessDeviceCapability(QMap &map); + + void rescanWireless(); + + void startAgent(); + void stopAgent(); + +Q_SIGNALS: + void wiredDeviceAdd(QString deviceName); + void wiredDeviceRemove(QString deviceName); + void wiredDeviceNameUPdate(QString oldName, QString newName); + + void wirelessDeviceAdd(QString deviceName); + void wirelessDeviceRemove(QString deviceName); + void wirelessDeviceNameUPdate(QString oldName, QString newName); + + + //有线无线列表更新(有线增删、无线增加减少) + void lanAdded(QString devName, QStringList info); + void lanRemoved(QString dbusPath); + void lanUpdated(QString devName, QStringList info); + + void wlanAdded(QString devName, QStringList info); + void wlanRemoved(QString devName,QString ssid); + + void wlanConnectionStateChanged(QString devName, QString ssid, QString uuid, int status); + void lanConnectionStateChanged(QString devName, QString uuid, int status); + + void activateFailed(QString errorMessage); + void deactivateFailed(QString errorMessage); + + //激活/断开热点连接 + void hotspotActivated(QString deviceName, QString ssid, QString uuid); + void hotspotDeactivated(QString deviceName, QString ssid); + + //信号强度变化 + void signalStrengthChanged(QString deviceName, QString ssid, int strength); + + //安全性变化 + void securityTypeChanged(QString deviceName, QString ssid, QString securityType); + +private Q_SLOTS: + void onLanAdd(QString connectUuid, QString connectName, QString connectPath); + void onLanUpdate(QString connectUuid, QString connectName, QString connectPath); + + void onWlanAdd(QString deviceName, KyWirelessNetItem &item); + void onWlanStateChange(QString deviceName, QString ssid, QString uuid, KyConnectState state); + +private: + KyActiveConnectResourse *m_activeConnectResource; + KyConnectResourse *m_connectResource; + KyNetworkDeviceResourse *m_deviceResource; + KyWirelessNetResource *m_wirelessResource; + + KyWirelessConnectOperation *m_wirelessOperation; + KyWiredConnectOperation *m_wiredOperation; + + KylinAgent *m_secretAgent; +}; + + +#endif // KYLINDBUSINTERFRACE_H diff --git a/libnm-kylin/libnm-external-kylin/kylin-dbus/kylinnetworkmanagerdbus.cpp b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylinnetworkmanagerdbus.cpp new file mode 100644 index 00000000..de3a106f --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylinnetworkmanagerdbus.cpp @@ -0,0 +1,25 @@ +#include "kylinnetworkmanagerdbus.h" + +KyNetworkManagerDbus::KyNetworkManagerDbus(QObject *parent) : QObject(parent) +{ + +} + +KyNetworkManagerDbus::~KyNetworkManagerDbus() +{ + +} + +void KyNetworkManagerDbus::registerNetworkManagerDbus() +{ + KylinDbusInterface dbusInterface; + KylinDbusAdaptor dbusAdapter(&dbusInterface); + Q_UNUSED(dbusAdapter); + + auto connection = QDBusConnection::sessionBus(); + if (!connection.registerService("com.kylin.network") || !connection.registerObject("/com/kylin/network", &dbusInterface)) { + qCritical() << "QDbus register service failed reason:" << connection.lastError(); + } + + return; +} diff --git a/libnm-kylin/libnm-external-kylin/kylin-dbus/kylinnetworkmanagerdbus.h b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylinnetworkmanagerdbus.h new file mode 100644 index 00000000..44da43f9 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-dbus/kylinnetworkmanagerdbus.h @@ -0,0 +1,26 @@ +#ifndef KYLINNETWORKMANAGERDBUS_H +#define KYLINNETWORKMANAGERDBUS_H + +#include +#include + +#include "kylindbusinterfrace.h" +#include "kylindbusadapter.h" +#include "libnm-external-kylin_global.h" + +class LIBNMEXTERNALKYLIN_EXPORT KyNetworkManagerDbus : public QObject +{ + Q_OBJECT +public: + explicit KyNetworkManagerDbus(QObject *parent = nullptr); + ~KyNetworkManagerDbus(); + +public: + void registerNetworkManagerDbus(); + +private: + + +}; + +#endif // KYLINNETWORKMANAGERDBUS_H diff --git a/libnm-kylin/libnm-external-kylin/kylin-tool/kylin-tool.pri b/libnm-kylin/libnm-external-kylin/kylin-tool/kylin-tool.pri new file mode 100644 index 00000000..0d251fb1 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-tool/kylin-tool.pri @@ -0,0 +1,11 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/kylinarping.h \ + $$PWD/kylinipv4arping.h \ + $$PWD/kylinipv6arping.h + +SOURCES += \ + $$PWD/kylinipv4arping.cpp \ + $$PWD/kylinipv6arping.cpp + diff --git a/libnm-kylin/libnm-external-kylin/kylin-tool/kylinarping.h b/libnm-kylin/libnm-external-kylin/kylin-tool/kylinarping.h new file mode 100644 index 00000000..79346955 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-tool/kylinarping.h @@ -0,0 +1,101 @@ +#ifndef KYLINARPING_H +#define KYLINARPING_H + +#include +#include +#include + +static cap_flag_value_t cap_raw = CAP_CLEAR; +static const cap_value_t caps[] = { CAP_NET_RAW }; + +static void limit_capabilities() +{ + cap_t cap_p; + + cap_p = cap_get_proc(); + if (!cap_p) { + qWarning()<<"cap_get_proc failed."; + } + + cap_get_flag(cap_p, CAP_NET_RAW, CAP_PERMITTED, &cap_raw); + + if (cap_raw != CAP_CLEAR) { + if (cap_clear(cap_p) < 0) { + qWarning()<<"cap clear failed"< +#include +#include + +#define FINAL_PACKS 2 + +__attribute__((const)) static inline size_t sll_len(const size_t halen) +{ + struct sockaddr_ll unused; + const size_t len = offsetof(struct sockaddr_ll, sll_addr) + halen; + + if (len < sizeof(unused)) + return sizeof(unused); + + return len; +} + + +KyIpv4Arping::KyIpv4Arping(QString ifaceName, QString ipAddress, int retryCount, int timeout, QObject *parent) : QObject(parent) +{ + m_ifaceName = ifaceName; + m_ipv4Address = ipAddress; + m_retryCount = retryCount; + m_timeout = timeout; + + memset(&m_srcAddress, 0, sizeof(m_srcAddress)); +} + +KyIpv4Arping::~KyIpv4Arping() +{ + +} + +void KyIpv4Arping::monoGetTime (struct timespec *ts) +{ +#ifdef CLOCK_MONOTONIC + if (clock_gettime (CLOCK_MONOTONIC, ts)) +#endif + { + static long freq = 0; + if (freq == 0) + freq = sysconf (_SC_CLK_TCK); + + struct tms dummy; + clock_t t = times (&dummy); + ts->tv_sec = t / freq; + ts->tv_nsec = (t % freq) * (1000000000 / freq); + } +} + +void KyIpv4Arping::saveMacAddress(const uint8_t *ptr, size_t len) +{ + int index; + char macAddress[64] = {0}; + + for (index = 0; index < len; index++) { + snprintf(&macAddress[strlen(macAddress)], sizeof(macAddress) - strlen(macAddress), "%02X", ptr[index]); + if (index != len - 1) { + snprintf(&macAddress[strlen(macAddress)], sizeof(macAddress) - strlen(macAddress), "%s", ":"); + } + } + + m_conflictMac = QString(macAddress); + return ; +} + +void KyIpv4Arping::setConflictFlag(bool isConflict) +{ + m_ipConflict = isConflict; +} + +int KyIpv4Arping::sendIpv4Packet() +{ + int err; + unsigned char buf[256]; + struct arphdr *ah = (struct arphdr *)buf; + unsigned char *p = (unsigned char *)(ah + 1); + struct sockaddr_ll *p_me = (struct sockaddr_ll *)&(m_me); + struct sockaddr_ll *p_he = (struct sockaddr_ll *)&(m_he); + + ah->ar_hrd = htons(p_me->sll_hatype); + if (ah->ar_hrd == htons(ARPHRD_FDDI)) + ah->ar_hrd = htons(ARPHRD_ETHER); + ah->ar_pro = htons(ETH_P_IP); + ah->ar_hln = p_me->sll_halen; + ah->ar_pln = 4; + ah->ar_op = htons(ARPOP_REQUEST); + + memcpy(p, &p_me->sll_addr, ah->ar_hln); + p += p_me->sll_halen; + + qWarning()<<"[KyIpv4Arping]" <<"m_src address:" << inet_ntoa(m_srcAddress); + memcpy(p, &m_srcAddress, 4); + p += 4; + + memcpy(p, &p_he->sll_addr, ah->ar_hln); + p += ah->ar_hln; + + memcpy(p, &m_destAddress, 4); + p += 4; + + err = sendto(m_ipv4Socket, buf, p - buf, 0, (struct sockaddr *)p_he, sll_len(ah->ar_hln)); + + return err; +} + +int KyIpv4Arping::ipv4PacketProcess(unsigned char *buf, ssize_t len, struct sockaddr_ll *from) +{ + struct arphdr *ah = (struct arphdr *)buf; + unsigned char *p = (unsigned char *)(ah + 1); + struct in_addr src_ip, dst_ip; + + /* Filter out wild packets */ + if (from->sll_pkttype != PACKET_HOST && + from->sll_pkttype != PACKET_BROADCAST && + from->sll_pkttype != PACKET_MULTICAST) + return 0; + + /* Only these types are recognised */ + if (ah->ar_op != htons(ARPOP_REQUEST) && + ah->ar_op != htons(ARPOP_REPLY)) + return 0; + + /* ARPHRD check and this darned FDDI hack here :-( */ + if (ah->ar_hrd != htons(from->sll_hatype) && + (from->sll_hatype != ARPHRD_FDDI || ah->ar_hrd != htons(ARPHRD_ETHER))) + return 0; + + /* Protocol must be IP. */ + if (ah->ar_pro != htons(ETH_P_IP)) + return 0; + if (ah->ar_pln != 4) + return 0; + if (ah->ar_hln != ((struct sockaddr_ll *)&m_me)->sll_halen) + return 0; + + if (len < (ssize_t) sizeof(*ah) + 2 * (4 + ah->ar_hln)) + return 0; + + memcpy(&src_ip, p + ah->ar_hln, 4); + memcpy(&dst_ip, p + ah->ar_hln + 4 + ah->ar_hln, 4); + /* + * DAD packet was: + * src_ip = 0 (or some src) + * src_hw = ME + * dst_ip = tested address + * dst_hw = + * + * We fail, if receive request/reply with: + * src_ip = tested_address + * src_hw != ME + * if src_ip in request was not zero, check + * also that it matches to dst_ip, otherwise + * dst_ip/dst_hw do not matter. + */ + if (src_ip.s_addr != m_destAddress.s_addr) + return 0; + + if (memcmp(p, ((struct sockaddr_ll *)&m_me)->sll_addr, + ((struct sockaddr_ll *)&m_me)->sll_halen) == 0) + return 0; + + saveMacAddress(p, ah->ar_hln); + setConflictFlag(true); + + return FINAL_PACKS; +} + +int KyIpv4Arping::ipv4EventLoop() +{ + int rc = -1; + int ret; + int index; + int exit_loop = 0; + ssize_t bytes; + + int tfd; + struct pollfd pfds[POLLFD_COUNT]; + + struct itimerspec timerfd_vals; + timerfd_vals.it_interval.tv_sec = m_timeout, + timerfd_vals.it_interval.tv_nsec = 0, + timerfd_vals.it_value.tv_sec = m_timeout, + timerfd_vals.it_value.tv_nsec = 0; + + uint64_t exp; + uint64_t total_expires = 1; + + unsigned char packet[4096]; + struct sockaddr_storage from = { 0 }; + socklen_t addr_len = sizeof(from); + + /* timerfd */ + tfd = timerfd_create(CLOCK_MONOTONIC, 0); + if (tfd == -1) { + qWarning()<<"[KyIpv4Arping]" << "timerfd_create failed, errno" << errno; + return -1; + } + + if (timerfd_settime(tfd, 0, &timerfd_vals, NULL)) { + close(tfd); + qWarning()<<"[KyIpv4Arping]" << "timerfd_settime failed, errno" << errno; + return -1; + } + + pfds[POLLFD_TIMER].fd = tfd; + pfds[POLLFD_TIMER].events = POLLIN | POLLERR | POLLHUP; + + /* socket */ + pfds[POLLFD_SOCKET].fd = m_ipv4Socket; + pfds[POLLFD_SOCKET].events = POLLIN | POLLERR | POLLHUP; + sendIpv4Packet(); + + while (!exit_loop) { + ret = poll(pfds, POLLFD_COUNT, -1); + if (ret <= 0) { + if (errno == EAGAIN) { + continue; + } + + if (errno) { + qWarning()<<"[KyIpv4Arping]" <<"poll failed, errno" << errno; + } + + exit_loop = 1; + continue; + } + + for (index = 0; index < POLLFD_COUNT; index++) { + if (pfds[index].revents == 0) { + continue; + } + + switch (index) { + case POLLFD_TIMER: + bytes = read(tfd, &exp, sizeof(uint64_t)); + if (bytes != sizeof(uint64_t)) { + qWarning() <<"[KyIpv4Arping]" << "could not read timerfd"; + continue; + } + + total_expires += exp; + if (0 < m_retryCount && (uint64_t)m_retryCount < total_expires) { + exit_loop = 1; + rc = 0; + continue; + } + + sendIpv4Packet(); + break; + case POLLFD_SOCKET: + bytes = recvfrom(m_ipv4Socket, packet, sizeof(packet), 0, + (struct sockaddr *)&from, &addr_len); + if (bytes < 0) { + qWarning()<<"[KyIpv4Arping]" << "recvfrom function failed, errno" << errno; + continue; + } + if (ipv4PacketProcess(packet, bytes, (struct sockaddr_ll *)&from) == FINAL_PACKS) { + exit_loop = 1; + rc = 0; + } + break; + default: + qWarning()<<"[KyIpv4Arping]" <<"the fd index is undefine" << index; + break; + } + } + } + + close(tfd); + freeifaddrs(m_ifa0); + + return rc; +} + +int KyIpv4Arping::checkIfflags(unsigned int ifflags) +{ + if (!(ifflags & IFF_UP)) { + qWarning()<<"[KyIpv4Arping]" <<"the iface" << m_ifaceName <<" is down."; + return -1; + } + + if (ifflags & (IFF_NOARP | IFF_LOOPBACK)) { + qWarning()<<"[KyIpv4Arping]" << "Interface" << m_ifaceName << "is not ARPable."; + return -1; + } + + return 0; +} + + +int KyIpv4Arping::checkDevice() +{ + int rc; + struct ifaddrs *ifa; + int n = 0; + + rc = getifaddrs(&m_ifa0); + if (rc < 0) { + qWarning()<<"[KyIpv4Arping]" <<"get iface address failed, erron"<< errno; + return -errno; + } + + for (ifa = m_ifa0; ifa; ifa = ifa->ifa_next) { + if (!ifa->ifa_addr) { + continue; + } + + if (ifa->ifa_addr->sa_family != AF_PACKET) { + continue; + } + + if (!m_ifaceName.isEmpty() + && (NULL != ifa->ifa_name) + && strcmp(ifa->ifa_name, m_ifaceName.toUtf8())) { + continue; + } + + if (checkIfflags(ifa->ifa_flags) < 0) { + continue; + } + + if (!((struct sockaddr_ll *)ifa->ifa_addr)->sll_halen) { + continue; + } + + if (!ifa->ifa_broadaddr) { + continue; + } + + m_ifa = ifa; + + if (n++) + break; + } + + if (n == 1 && m_ifa) { + m_ifindex = if_nametoindex(m_ifa->ifa_name); + if (!m_ifindex) { + qWarning()<<"[KyIpv4Arping]" <<"if_nametoindex is invalid"; + freeifaddrs(m_ifa0); + return -1; + } + m_ifaceName = m_ifa->ifa_name; + + return 0; + } + + freeifaddrs(m_ifa0); + return -1; +} + +void KyIpv4Arping::findBroadcastAddress() +{ + struct sockaddr_ll *he = (struct sockaddr_ll *)&(m_he); + + if (m_ifa) { + struct sockaddr_ll *sll = + (struct sockaddr_ll *)m_ifa->ifa_broadaddr; + + if (sll->sll_halen == he->sll_halen) { + memcpy(he->sll_addr, sll->sll_addr, he->sll_halen); + return; + } + } + + qWarning()<<"[KyIpv4Arping]" <<"using default broadcast address."; + + memset(he->sll_addr, -1, he->sll_halen); + + return; +} + +int KyIpv4Arping::ipv4ConflictCheck() +{ + limit_capabilities(); + + int ret = checkDevice(); + if (ret < 0) { + qWarning()<<"[KyIpv4Arping]"<<"the device is invalid" << m_ifaceName; + return -1; + } + + enable_capability_raw(); + m_ipv4Socket = socket(PF_PACKET, SOCK_DGRAM, 0); + disable_capability_raw(); + if (m_ipv4Socket < 0) { + qWarning()<<"[KyIpv4Arping]" << "create ipv4 socket failed, errno" << errno; + return -1; + } + + inet_aton(m_ipv4Address.toUtf8(), &m_destAddress); + m_destAddressFamily = AF_INET; + + ((struct sockaddr_ll *)&m_me)->sll_family = AF_PACKET; + ((struct sockaddr_ll *)&m_me)->sll_ifindex = m_ifindex; + ((struct sockaddr_ll *)&m_me)->sll_protocol = htons(ETH_P_ARP); + + ret = bind(m_ipv4Socket, (struct sockaddr *)&m_me, sizeof(m_me)); + if (ret < 0) { + qWarning()<<"[KyIpv4Arping]" <<"ipv4 socket bind failed, errno"<< errno; + close(m_ipv4Socket); + return -1; + } + + socklen_t alen = sizeof(m_me); + ret = getsockname(m_ipv4Socket, (struct sockaddr *)&m_me, &alen); + if (ret < 0) { + qWarning()<<"[KyIpv4Arping]" <<"ipv4 get socket name failed, errno" << errno; + close(m_ipv4Socket); + return -1; + } + + if (((struct sockaddr_ll *)&m_me)->sll_halen == 0) { + qWarning()<<"[KyIpv4Arping]" <<"the iface"<< m_ifaceName <<" is not suitable for arp"; + close(m_ipv4Socket); + return -1; + } + + m_he = m_me; + + findBroadcastAddress(); + + drop_capabilities(); + + ret = ipv4EventLoop(); + close(m_ipv4Socket); + + return ret; +} diff --git a/libnm-kylin/libnm-external-kylin/kylin-tool/kylinipv4arping.h b/libnm-kylin/libnm-external-kylin/kylin-tool/kylinipv4arping.h new file mode 100644 index 00000000..c4431e02 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-tool/kylinipv4arping.h @@ -0,0 +1,90 @@ +#ifndef KYLIN_IPV4_ARPING +#define KYLIN_IPV4_ARPING + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "kylinarping.h" + +#include +#include +#include + +#include "libnm-external-kylin_global.h" + +enum { + POLLFD_TIMER = 0, + POLLFD_SOCKET, + POLLFD_COUNT +}; + +class LIBNMEXTERNALKYLIN_EXPORT KyIpv4Arping : public QObject +{ + Q_OBJECT +public: + explicit KyIpv4Arping(QString ifaceName, QString ipAddress, int retryCount=3, int timeout=1, QObject *parent = nullptr); + ~KyIpv4Arping(); + +public: + bool ipv4IsConflict() { + return m_ipConflict; + } + + QString getMacAddress() { + return m_conflictMac; + } + + int ipv4ConflictCheck(); + +private: + void monoGetTime(struct timespec *ts); + void saveMacAddress(const uint8_t *ptr, size_t len); + void findBroadcastAddress(); + int checkDevice(); + int checkIfflags(unsigned int ifflags); + + int sendIpv4Packet(); + int ipv4EventLoop(); + int ipv4PacketProcess(unsigned char *buf, ssize_t len, struct sockaddr_ll *from); + + void setConflictFlag(bool isConflict); + +private: + struct in_addr m_srcAddress; + struct in_addr m_destAddress; + int m_destAddressFamily; + + struct sockaddr_storage m_me; + struct sockaddr_storage m_he; + int m_ipv4Socket = 0; + + QString m_ifaceName; + int m_ifindex; + struct ifaddrs *m_ifa; + struct ifaddrs *m_ifa0; + + QString m_ipv4Address; + int m_retryCount; + int m_timeout; + + bool m_ipConflict = false; + QString m_conflictMac = nullptr; +}; + +#endif diff --git a/libnm-kylin/libnm-external-kylin/kylin-tool/kylinipv6arping.cpp b/libnm-kylin/libnm-external-kylin/kylin-tool/kylinipv6arping.cpp new file mode 100644 index 00000000..79d2ee12 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-tool/kylinipv6arping.cpp @@ -0,0 +1,405 @@ +#include "kylinipv6arping.h" + +#include +#include +#include +#include "kylinarping.h" + +KyIpv6Arping::KyIpv6Arping(QString ifaceName, QString ipAddress, int retryCount, int timeout, QObject *parent) : QObject(parent) +{ + m_ifaceName = ifaceName; + m_ipv6Address = ipAddress; + m_retryCount = retryCount; + m_timeoutMs = timeout; + + m_ipv6Conflict = false; +} + +KyIpv6Arping::~KyIpv6Arping() +{ + +} + +void KyIpv6Arping::monoGetTime (struct timespec *ts) +{ +#ifdef CLOCK_MONOTONIC + if (clock_gettime (CLOCK_MONOTONIC, ts)) +#endif + { + static long freq = 0; + if (freq == 0) + freq = sysconf (_SC_CLK_TCK); + + struct tms dummy; + clock_t t = times (&dummy); + ts->tv_sec = t / freq; + ts->tv_nsec = (t % freq) * (1000000000 / freq); + } +} + +int KyIpv6Arping::getLocalMacAddress(const char *ifname, unsigned char *addr) +{ +# ifdef SIOCGIFHWADDR + struct ifreq req; + memset (&req, 0, sizeof (req)); + + if (((unsigned)strlen (ifname)) >= (unsigned)IFNAMSIZ) { + return -1; /* buffer overflow = local root */ + } + + strcpy (req.ifr_name, ifname); + + int fd = socket (AF_INET6, SOCK_DGRAM, 0); + if (fd == -1) { + return -1; + } + + if (ioctl (fd, SIOCGIFHWADDR, &req)) { + qWarning()<<"[KyIpv6Arping]"<<"get local mac address failed, errno" << errno; + close (fd); + return -1; + } + close (fd); + + memcpy (addr, req.ifr_hwaddr.sa_data, 6); + return 0; +# else + /* No SIOCGIFHWADDR, which seems Linux specific. */ + struct ifaddrs *ifa = NULL; + struct ifaddrs *ifp = NULL; + getifaddrs(&ifa); + ifp = ifa; /* preserve the address of ifa to free memory later */ + while (ifp != NULL) { + if (ifp->ifa_addr->sa_family == AF_LINK && strcmp(ifp->ifa_name, ifname) == 0) { + const struct sockaddr_dl* sdl = (const struct sockaddr_dl*) ifp->ifa_addr; + memcpy(addr, sdl->sdl_data + sdl->sdl_nlen, 6); + freeifaddrs(ifa); + return 0; + } + ifp = ifp->ifa_next; + } + freeifaddrs(ifa); + return -1; +# endif +} + +int KyIpv6Arping::getIpv6ByName(struct sockaddr_in6 *addr) +{ + struct addrinfo hints, *res; + memset (&hints, 0, sizeof (hints)); + hints.ai_family = PF_INET6; + hints.ai_socktype = SOCK_DGRAM; /* dummy */ + hints.ai_flags = 0; + + int val = getaddrinfo (m_ipv6Address.toUtf8(), NULL, &hints, &res); + if (val) { + qWarning()<<"[KyIpv6Arping]" << m_ipv6Address <<"get addrinfo failed, errno" << val; + return -1; + } + + memcpy (addr, res->ai_addr, sizeof (struct sockaddr_in6)); + freeaddrinfo (res); + + val = if_nametoindex (m_ifaceName.toUtf8()); + if (val == 0) { + qWarning()<<"[KyIpv6Arping]" <<"if_nametoindex failed, errno" << errno; + return -1; + } + addr->sin6_scope_id = val; + + return 0; +} + +int KyIpv6Arping::buildSolicitationPacket(solicit_packet *ns, struct sockaddr_in6 *tgt, const char *ifname) +{ + /* builds ICMPv6 Neighbor Solicitation packet */ + ns->hdr.nd_ns_type = ND_NEIGHBOR_SOLICIT; + ns->hdr.nd_ns_code = 0; + ns->hdr.nd_ns_cksum = 0; /* computed by the kernel */ + ns->hdr.nd_ns_reserved = 0; + memcpy (&ns->hdr.nd_ns_target, &tgt->sin6_addr, 16); + + /* determines actual multicast destination address */ + memcpy (&tgt->sin6_addr.s6_addr, "\xff\x02\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x01\xff", 13); + + /* gets our own interface's link-layer address (MAC) */ + if (getLocalMacAddress (m_ifaceName.toUtf8().constData(), ns->hw_addr)) { + return sizeof (ns->hdr); + } + + ns->opt.nd_opt_type = ND_OPT_SOURCE_LINKADDR; + ns->opt.nd_opt_len = 1; /* 8 bytes */ + return sizeof (*ns); +} + +void KyIpv6Arping::saveMacAddress (const uint8_t *ptr, size_t len) +{ + int index; + char macAddress[64] = {0}; + + for (index = 0; index < len; index++) { + snprintf(&macAddress[strlen(macAddress)], sizeof(macAddress) - strlen(macAddress), "%02X", ptr[index]); + if (index != len - 1) { + snprintf(&macAddress[strlen(macAddress)], sizeof(macAddress) - strlen(macAddress), "%s", ":"); + } + } + + m_conflictMacAddress = QString(macAddress); + return ; +} + +int KyIpv6Arping::parseIpv6Packet(const uint8_t *buf, size_t len, const struct sockaddr_in6 *tgt) +{ + const struct nd_neighbor_advert *na = + (const struct nd_neighbor_advert *)buf; + const uint8_t *ptr; + + /* checks if the packet is a Neighbor Advertisement, and + * if the target IPv6 address is the right one */ + if ((len < sizeof (struct nd_neighbor_advert)) + || (na->nd_na_type != ND_NEIGHBOR_ADVERT) + || (na->nd_na_code != 0) + || memcmp (&na->nd_na_target, &tgt->sin6_addr, 16)) { + return -1; + } + len -= sizeof (struct nd_neighbor_advert); + + /* looks for Target Link-layer address option */ + ptr = buf + sizeof (struct nd_neighbor_advert); + + while (len >= 8) + { + uint16_t optlen; + + optlen = ((uint16_t)(ptr[1])) << 3; + if (optlen == 0) + break; /* invalid length */ + + if (len < optlen) /* length > remaining bytes */ + break; + len -= optlen; + + + /* skips unrecognized option */ + if (ptr[0] != ND_OPT_TARGET_LINKADDR) + { + ptr += optlen; + continue; + } + + /* Found! displays link-layer address */ + ptr += 2; + optlen -= 2; + + saveMacAddress (ptr, optlen); + setIpv6ConflictFlag(true); + return 0; + } + + return -1; +} + +int KyIpv6Arping::readIpv6Packet(void *buf, + size_t len, + int flags, + struct sockaddr_in6 *addr) +{ + char cbuf[CMSG_SPACE (sizeof (int))]; + + struct iovec iov = { + .iov_base = buf, + .iov_len = len + }; + + struct msghdr hdr = { + .msg_name = addr, + .msg_namelen = sizeof (*addr), + .msg_iov = &iov, + .msg_iovlen = 1, + .msg_control = cbuf, + .msg_controllen = sizeof (cbuf) + }; + + ssize_t val = recvmsg (m_ipv6Socket, &hdr, flags); + if (val == -1) { + return val; + } + + /* ensures the hop limit is 255 */ + for (struct cmsghdr *cmsg = CMSG_FIRSTHDR (&hdr); + cmsg != NULL; cmsg = CMSG_NXTHDR (&hdr, cmsg)) { + if ((cmsg->cmsg_level == IPPROTO_IPV6) + && (cmsg->cmsg_type == IPV6_HOPLIMIT)) { + if (255 != *(int *)CMSG_DATA (cmsg)) { + // pretend to be a spurious wake-up + errno = EAGAIN; + return -1; + } + } + } + + return val; +} + +int KyIpv6Arping::reciveAndProcessIpv6Packet(const struct sockaddr_in6 *tgt, unsigned wait_ms) +{ + struct timespec end; + struct pollfd fds; + + /* computes deadline time */ + monoGetTime (&end); + div_t d; + d = div (wait_ms, 1000); + end.tv_sec = end.tv_sec + d.quot; + end.tv_nsec = end.tv_nsec + (d.rem * 1000000); + + /* receive loop */ + for (;;) + { + /* waits for reply until deadline */ + struct timespec now; + int val = 0; + + monoGetTime (&now); + if (end.tv_sec >= now.tv_sec) { + val = (end.tv_sec - now.tv_sec) * 1000 + + (int)((end.tv_nsec - now.tv_nsec) / 1000000); + if (val < 0) { + val = 0; + } + } + + fds.fd = m_ipv6Socket; + fds.events = POLLIN; + val = poll (&fds, 1, val); + if (val < 0) + break; + + if (val == 0) + return 0; + + /* receives an ICMPv6 packet */ + // TODO: use interface MTU as buffer size + uint8_t buf[1460]; + struct sockaddr_in6 addr; + + val = readIpv6Packet(buf, sizeof (buf), MSG_DONTWAIT, &addr); + if (val < 0) { + if (errno != EAGAIN) + qWarning()<<"[KyIpv6Arping]"<<"Receiving ICMPv6 packet failed"; + continue; + } + + /* ensures the response came through the right interface */ + if (addr.sin6_scope_id + && (addr.sin6_scope_id != tgt->sin6_scope_id)) + continue; + + if (parseIpv6Packet(buf, val, tgt) == 0) { + return 1 /* = responses */; + } + } + + return -1; /* error */ +} + + +int KyIpv6Arping::ipv6ConflictCheck() +{ + struct sockaddr_in6 tgt; + struct icmp6_filter filter; + int retry = 0; + + limit_capabilities(); + + enable_capability_raw(); + m_ipv6Socket = socket (PF_INET6, SOCK_RAW, IPPROTO_ICMPV6); + disable_capability_raw(); + if (m_ipv6Socket < 0) { + qDebug()<<"[KyIpv6Arping]" <<"create ipv6 socket failed:"; + return -1; + } + + fcntl (m_ipv6Socket, F_SETFD, FD_CLOEXEC); + + /* set ICMPv6 filter */ + ICMP6_FILTER_SETBLOCKALL (&filter); + ICMP6_FILTER_SETPASS (ND_NEIGHBOR_ADVERT, &filter); + + enable_capability_raw(); + setsockopt (m_ipv6Socket, IPPROTO_ICMPV6, ICMP6_FILTER, &filter, sizeof (filter)); + + int soDontRoute = 1; + setsockopt (m_ipv6Socket, SOL_SOCKET, SO_DONTROUTE, &soDontRoute, sizeof(soDontRoute)); + + /* sets Hop-by-hop limit to 255 */ + int multicastHopLimit = 255; + setsockopt (m_ipv6Socket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, + &multicastHopLimit, sizeof (multicastHopLimit)); + + int unicastHops = 255; + setsockopt (m_ipv6Socket, IPPROTO_IPV6, IPV6_UNICAST_HOPS, + &unicastHops, sizeof (unicastHops)); + + int recvHopLimit = 1; + setsockopt(m_ipv6Socket, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, + &recvHopLimit, sizeof (recvHopLimit)); + + disable_capability_raw(); + + drop_capabilities(); + + /* resolves target's IPv6 address */ + int ret = getIpv6ByName(&tgt); + if (ret < 0) { + qWarning()<<"[KyIpv6Arping]"<<"get ipv6 by name failed."; + close (m_ipv6Socket); + return ret; + } + + solicit_packet packet; + struct sockaddr_in6 dst; + ssize_t plen; + + memcpy (&dst, &tgt, sizeof (dst)); + plen = buildSolicitationPacket(&packet, &dst, m_ifaceName.toUtf8().constData()); + if (plen == -1) { + qWarning()<<"[KyIpv6Arping]"<<"build solicit packet failed."; + close (m_ipv6Socket); + return -1; + } + + while (retry < m_retryCount) { + /* sends a Solitication */ + if (sendto (m_ipv6Socket, &packet, plen, MSG_DONTROUTE, + (const struct sockaddr *)&dst, + sizeof (dst)) != plen) { + qWarning()<<"[KyIpv6Arping]"<<"Sending ICMPv6 packet failed."; + close (m_ipv6Socket); + return -1; + } + + retry++; + + /* receives an Advertisement */ + ssize_t val = reciveAndProcessIpv6Packet(&tgt, m_timeoutMs); + if (val > 0) { + close (m_ipv6Socket); + return 0; + } else if (val == 0) { + continue; + } else { + close (m_ipv6Socket); + return -1; + } + } + + close(m_ipv6Socket); + + if (retry == m_retryCount) { + return 0; + } else { + return -2; + } +} diff --git a/libnm-kylin/libnm-external-kylin/kylin-tool/kylinipv6arping.h b/libnm-kylin/libnm-external-kylin/kylin-tool/kylinipv6arping.h new file mode 100644 index 00000000..72f6fae1 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/kylin-tool/kylinipv6arping.h @@ -0,0 +1,111 @@ +#ifndef KYLINIPV6ARPING_H +#define KYLINIPV6ARPING_H + +//#include + +#include +#include +#include /* div() */ +#include /* uint8_t */ +#include /* UINT_MAX */ +#include +#include + +#include /* EMFILE */ +#include +#include /* close() */ +#include /* clock_gettime() */ +#include /* poll() */ +#include +#include +#include + +//#include "gettime.h" + +#ifdef HAVE_GETOPT_H +# include +#endif + +#include /* getaddrinfo() */ +#include /* inet_ntop() */ +#include /* if_nametoindex() */ + +#include +#include + +#ifndef IPV6_RECVHOPLIMIT +/* Using obsolete RFC 2292 instead of RFC 3542 */ +# define IPV6_RECVHOPLIMIT IPV6_HOPLIMIT +#endif + +/* BSD-like systems define ND_RA_FLAG_HA instead of ND_RA_FLAG_HOME_AGENT */ +#ifndef ND_RA_FLAG_HOME_AGENT +# ifdef ND_RA_FLAG_HA +# define ND_RA_FLAG_HOME_AGENT ND_RA_FLAG_HA +# endif +#endif + +#ifndef AI_IDN +# define AI_IDN 0 +#endif + + +#include +#include +#include + +#include "libnm-external-kylin_global.h" + +typedef struct +{ + struct nd_neighbor_solicit hdr; + struct nd_opt_hdr opt; + uint8_t hw_addr[6]; +} solicit_packet; + +class LIBNMEXTERNALKYLIN_EXPORT KyIpv6Arping: public QObject +{ + Q_OBJECT +public: + explicit KyIpv6Arping(QString ifaceName, QString ipAddress, int retryCount=3, int timeout=1000, QObject *parent = nullptr); + ~KyIpv6Arping(); + +public: + bool ipv6IsConflict() { + return m_ipv6Conflict; + } + + void setIpv6ConflictFlag(bool conflict) { + m_ipv6Conflict = conflict; + } + + QString getConflictMacAddress() { + return m_conflictMacAddress; + } + + int ipv6ConflictCheck(); + +private: + void monoGetTime (struct timespec *ts); + void saveMacAddress (const uint8_t *ptr, size_t len); + int getLocalMacAddress(const char *ifname, unsigned char *addr); + + int getIpv6ByName(struct sockaddr_in6 *addr); + int buildSolicitationPacket(solicit_packet *ns, struct sockaddr_in6 *tgt, const char *ifname); + int parseIpv6Packet(const uint8_t *buf, size_t len, const struct sockaddr_in6 *tgt); + int readIpv6Packet(void *buf, size_t len, int flags, struct sockaddr_in6 *addr); + int reciveAndProcessIpv6Packet(const struct sockaddr_in6 *tgt, unsigned wait_ms); + +private: + int m_ipv6Socket = 0; + + QString m_ifaceName; + QString m_ipv6Address; + int m_retryCount; + int m_timeoutMs; + + bool m_ipv6Conflict = false; + QString m_conflictMacAddress = nullptr; +}; + +#endif // KYLINIPV6ARPING_H diff --git a/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro b/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro new file mode 100644 index 00000000..824eeece --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/libnm-external-kylin.pro @@ -0,0 +1,45 @@ +#QT -= gui +QT += core gui x11extras dbus KWindowSystem svg concurrent network + +TARGET = kylin-nm-external +TEMPLATE = lib +DEFINES += LIBNMEXTERNALKYLIN_LIBRARY + +CONFIG += c++11 qt warn_on link_pkgconfig no_keywords + +PKGCONFIG +=libnm libnma libsecret-1 gsettings-qt libcap + +INCLUDEPATH += /usr/include/KF5/NetworkManagerQt +INCLUDEPATH += $$PWD/../libnm-base-kylin/ + +LIBS += -L/usr/lib/ -lgsettings-qt -lX11 -lKF5NetworkManagerQt +LIBS += -L$$PWD/../libnm-base-kylin/ -l kylin-nm-base + +# 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(kylin-agent/kylin-agent.pri) +include(kylin-tool/kylin-tool.pri) +#include(kylin-dbus/kylin-dbus.pri) + +SOURCES += + +HEADERS += \ + libnm-external-kylin_global.h + +DESTDIR += $$PWD +# Default rules for deployment. +unix { + target.path = /usr/lib +} +!isEmpty(target.path): INSTALLS += target + +DISTFILES += diff --git a/libnm-kylin/libnm-external-kylin/libnm-external-kylin_global.h b/libnm-kylin/libnm-external-kylin/libnm-external-kylin_global.h new file mode 100644 index 00000000..73dbd095 --- /dev/null +++ b/libnm-kylin/libnm-external-kylin/libnm-external-kylin_global.h @@ -0,0 +1,15 @@ +#ifndef LIBNMEXTERNALKYLIN_GLOBAL_H +#define LIBNMEXTERNALKYLIN_GLOBAL_H + +#include + +/* +* 库中类对象如果要能够被其他的引用或者是库引用,需要通过如下的关键字导出 +*/ +#if defined(LIBNMEXTERNALKYLIN_LIBRARY) +# define LIBNMEXTERNALKYLIN_EXPORT Q_DECL_EXPORT +#else +# define LIBNMEXTERNALKYLIN_EXPORT Q_DECL_IMPORT +#endif + +#endif // LIBNMEXTERNALKYLIN_GLOBAL_H diff --git a/libnm-kylin/libnm-kylin.pro b/libnm-kylin/libnm-kylin.pro new file mode 100644 index 00000000..db0e7469 --- /dev/null +++ b/libnm-kylin/libnm-kylin.pro @@ -0,0 +1,9 @@ +TEMPLATE = subdirs + +SUBDIRS += \ + libnm-base-kylin \ +# libnm-external-kylin \ +# libnm-icon-kylin + +#libnm-external-kylin.depends = libnm-base-kylin +#libnm-icon-kylin.depends = libnm-base-kylin diff --git a/man/kylin-nm-dev.1 b/man/kylin-nm-dev.1 new file mode 100644 index 00000000..846cd7eb --- /dev/null +++ b/man/kylin-nm-dev.1 @@ -0,0 +1,20 @@ +.\" Man page for Kylin-nm +.TH KYLIN-NM 1 "20 September 2019" "UKUI Desktop Environment" +.\" Please adjust this date when revising the manpage. +.\" +.SH "NAME" +kylin-nm \- The tool for the UKUI Desktop Environment +.SH "SYNOPSIS" +.B kylin-nm +.SH "DESCRIPTION" +The \fBkylin-nm\fR program is a part of the ukui-indicators, It provides network manager for the the UKUI Desktop Environment. Detect the system disk automatically, Can pop up and open the device. +.PP +This manual page documents the \fBkylin-nm\fR command. +.P +.SH "BUGS" +.SS Should you encounter any bugs, they may be reported at: +https://github.com/ukui/kylin-nm/issues +.SH "AUTHORS" +.SS This Man Page has been written for the UKUI Desktop Environment by: +shine (2019) +.SH "SEE ALSO" \ No newline at end of file