kylin-nm/0000755000175000017500000000000014205345444011241 5ustar fengfengkylin-nm/AUTHORS0000644000175000017500000000004314205345374012310 0ustar fengfengshine kylin-nm/.gitignore0000755000175000017500000000117014205345374013235 0ustar fengfeng# C++ objects and libs *.slo *.lo *.o *.a *.la *.lai *.so *.so.* *.dll *.dylib # Qt-es object_script.*.Release object_script.*.Debug *_plugin_import.cpp /.qmake.cache /.qmake.stash *.pro.user *.pro.user.* *.qbs.user *.qbs.user.* *.moc moc_*.cpp moc_*.h qrc_*.cpp ui_*.h *.qmlc *.jsc Makefile* *build-* *.prl # Qt unit tests target_wrapper.* # QtCreator *.autosave # QtCreator Qml *.qmlproject.user *.qmlproject.user.* # QtCreator CMake CMakeLists.txt.user* # QtCreator 4.8< compilation database compile_commands.json # QtCreator local machine specific files for imported projects *creator.user* # OS X extra file .DS_Store kylin-nm/kylin-nm.desktop0000644000175000017500000000104414205345374014373 0ustar fengfeng[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 kylin-nm/kylin-nm.pro0000644000175000017500000001133114205345374013522 0ustar fengfeng#------------------------------------------------- # # 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 LANGUAGE = C++ CONFIG += c++14 CONFIG += qt warn_on #CONFIG += release #CONFIG += link_pkgconfig #PKGCONFIG += glib-2.0 gio-2.0 gsettings-qt LIBS += -L/usr/lib/ -lgsettings-qt -lX11 #LIBS += -lkysec target.path = /usr/bin target.source += $$TARGET desktop.path = /etc/xdg/autostart/ desktop.files = kylin-nm.desktop inst1.files += src/conf/com.kylin.NetworkManager.qt.systemdbus.service inst1.path = /usr/share/dbus-1/system-services/ inst2.files += src/conf/com.kylin.NetworkManager.qt.systemdbus.conf inst2.path = /etc/dbus-1/system.d/ INSTALLS += target \ desktop \ inst1 \ inst2 \ TRANSLATIONS += ./translations/kylin-nm_zh_CN.ts \ ./translations/kylin-nm_tr.ts \ ./translations/kylin-nm_bo.ts # 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(src/singleapplication/qt-single-application.pri) SOURCES += \ src/backthread.cpp \ src/wifi-auth-thread.cpp \ src/confform.cpp \ src/dbusadaptor.cpp \ src/ksimplenm.cpp \ src/kylin-dbus-interface.cpp \ src/kylin-network-interface.c \ src/loadingdiv.cpp \ src/main.cpp \ src/mainwindow.cpp \ src/oneconnform.cpp \ src/onelancform.cpp \ src/switchbutton.cpp \ src/sysdbusregister.cpp \ src/utils.cpp \ src/wpawifidialog.cpp \ src/wificonfigdialog.cpp \ wireless-security/dlghidewifi.cpp \ wireless-security/dlghidewifieapfast.cpp \ wireless-security/dlghidewifieapleap.cpp \ wireless-security/dlghidewifieappeap.cpp \ wireless-security/dlghidewifieappwd.cpp \ wireless-security/dlghidewifieaptls.cpp \ wireless-security/dlghidewifieapttls.cpp \ wireless-security/dlghidewifileap.cpp \ wireless-security/dlghidewifiwep.cpp \ wireless-security/dlghidewifiwpa.cpp \ wireless-security/kylinheadfile.cpp \ hot-spot/dlghotspotcreate.cpp HEADERS += \ src/backthread.h \ src/wifi-auth-thread.h \ src/confform.h \ src/dbusadaptor.h \ src/ksimplenm.h \ src/kylin-dbus-interface.h \ src/kylin-network-interface.h \ src/loadingdiv.h \ src/mainwindow.h \ src/oneconnform.h \ src/onelancform.h \ src/switchbutton.h \ src/sysdbusregister.h \ src/utils.h \ src/wpawifidialog.h \ src/wificonfigdialog.h \ wireless-security/dlghidewifi.h \ wireless-security/dlghidewifieapfast.h \ wireless-security/dlghidewifieapleap.h \ wireless-security/dlghidewifieappeap.h \ wireless-security/dlghidewifieappwd.h \ wireless-security/dlghidewifieaptls.h \ wireless-security/dlghidewifieapttls.h \ wireless-security/dlghidewifileap.h \ wireless-security/dlghidewifiwep.h \ wireless-security/dlghidewifiwpa.h \ wireless-security/kylinheadfile.h \ hot-spot/dlghotspotcreate.h FORMS += \ src/confform.ui \ src/mainwindow.ui \ src/oneconnform.ui \ src/onelancform.ui \ hot-spot/dlghotspotcreate.ui \ src/wpawifidialog.ui \ src/wificonfigdialog.ui \ wireless-security/dlghidewifi.ui \ wireless-security/dlghidewifieapfast.ui \ wireless-security/dlghidewifieapleap.ui \ wireless-security/dlghidewifieappeap.ui \ wireless-security/dlghidewifieappwd.ui \ wireless-security/dlghidewifieaptls.ui \ wireless-security/dlghidewifieapttls.ui \ wireless-security/dlghidewifileap.ui \ wireless-security/dlghidewifiwep.ui \ wireless-security/dlghidewifiwpa.ui RESOURCES += \ nmqrc.qrc unix { UI_DIR = .ui MOC_DIR = .moc OBJECTS_DIR = .obj } DISTFILES += \ src/conf/com.kylin.NetworkManager.qt.systemdbus.conf \ src/conf/com.kylin.NetworkManager.qt.systemdbus.service kylin-nm/COPYING0000644000175000017500000010451314205345374012302 0ustar fengfeng 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 . kylin-nm/nmqrc.qrc0000644000175000017500000001306614205345374013100 0ustar fengfeng 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 qss/style.qss 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 kylin-nm/qss/0000755000175000017500000000000014205345374012051 5ustar fengfengkylin-nm/qss/style.qss0000644000175000017500000000126614205345374013746 0ustar fengfengQScrollBar:vertical{margin:0px 2px 0px 2px;width:10px;background:rgba(48,48,51,0);border-radius:6px;} QScrollBar::up-arrow:vertical{height:0px;} QScrollBar::sub-line:vertical{border:0px solid;height:0px} QScrollBar::sub-page:vertical{background:transparent;} QScrollBar::handle:vertical{width:6px;background:rgba(72,72,76,1);border-radius:3px;} QScrollBar::handle:vertical:hover{width:6px;background:rgba(97,97,102,1);border-radius:3px;} QScrollBar::handle:vertical:pressed{width:6px;background:rgba(133,133,140,1);border-radius:3px;} QScrollBar::add-page:vertical{background:transparent;} QScrollBar::add-line:vertical{border:0px solid;height:0px} QScrollBar::down-arrow:vertical{height:0px;} kylin-nm/res.qrc0000644000175000017500000000000714205345374012540 0ustar fengfeng kylin-nm/translations/0000755000175000017500000000000014205345444013762 5ustar fengfengkylin-nm/translations/kylin-nm_bo.qm0000644000175000017500000000002014205345374016531 0ustar fengfeng&+/HRK-RK RKRKVRKRK$RK,3RK1RK6RK<RKHo7LD0B6-EY3f lI lIlI":ph9p eC)sAj6o~ <6o~6o~:6o~6o~"6o~*6o~5e)@'e>e>$e>+GdF^IuII I II}I#I+pI1zI6<I:I>:7 7%j7,      ^ %' , 2U 7 = PC+ZI+ZK8[|K%wEVe vBƽ8P55=` c{~ {~G{~&2L< W   ' .)D)D&)D-C>y6yy?y>y!y)xy0y4y:y=y?>o r'O3]=w?gI8 5*F 54 55 JɅ JɅH JɅ JɅ( JɅ3 JɅ8 XJA .   C C Cw C V C(6 C3 a4I9 a4K eK eK P eKQ eK eK eK$z eK+ eK1 eK6o eKEC T U  U U U U&k U-] U2 U7 U> z {$ {#9 {*R!(4A9HK^K^:^k^}k^0k^k^k^!k^)k^0k^5Xz;Kzz[K @A%27S|Dl4Di$Cl /iMKablolu A EkleAdd Wired NetworkConfFormAdres:  Address: ConfFormOto(DHCP) Auto(DHCP)ConfFormhKablolu kart olmadan yeni kablolu a olu_turulam1yor7Can not create new wired network for without wired cardConfForm 0ptalCancelConfFormDNS 1: DNS 1: ConfFormDNS 2: DNS 2: ConfFormBa. Dzenle Edit ConnConfFormA1 Dzenle Edit NetworkConfForm Gateway: ConfFormLAN ad1:  LAN name: ConfFormElleManualConfFormYntem: Method: ConfFormNetmask:  Netmask: ConfForm2Yeni a zaten olu_turulduNew network already createdConfFormBYeni a ayarlar1 zaten tamamland1%New network settings already finishedConfForm TamamOkConfForm KaydetSaveConfFormA1 dzenle edit networkConfFormGizli WLAN EkleAdd Hidden WLAN DlgHideWifiOlu_tur... C_reate… DlgHideWifi 0ptalCancel DlgHideWifiKablosuz _ifrenizi veya kablosuz kart kullan1labilirliini onaylay1n5Confirm your WLAN password or usable of wireless card DlgHideWifi0WLAN Balant1s1 Ba_ar1l1Conn WLAN Success DlgHideWifiBalant1Connect DlgHideWifi.Gizli WLAN A1na BalanConnect to Hidden WLAN Network DlgHideWifiBalant1 Connection DlgHideWifiYokNone DlgHideWifiWLAN ad1 WLAN name DlgHideWifiWLAN gvenlik WLAN security DlgHideWifiGizli WLAN EkleAdd hidden WLANDlgHideWifiEapFastJOtomatik PAC pro_visioning'e izin ver!Allow automatic PAC pro_visioningDlgHideWifiEapFast Anonim AnonymousDlgHideWifiEapFastAnonim kimlikAnonymous identityDlgHideWifiEapFastDorulanm1_ AuthenticatedDlgHideWifiEapFast Kimlik DorulamaAuthenticationDlgHideWifiEapFastHer ikisi deBothDlgHideWifiEapFastOlu_tur... C_reate…DlgHideWifiEapFast 0ptalCancelDlgHideWifiEapFast BalanConnectDlgHideWifiEapFast.Gizli WLAN A1na BalanConnect to Hidden WLAN NetworkDlgHideWifiEapFastBalant1: ConnectionDlgHideWifiEapFast(Dinamik WEP (802.1x)Dynamic WEP (802.1X)DlgHideWifiEapFast(0 kimlik dorulama:Inner authenticationDlgHideWifiEapFast A ad1 Network nameDlgHideWifiEapFastYokNoneDlgHideWifiEapFastPAC dosyas1PAC fileDlgHideWifiEapFast ParolaPasswordDlgHideWifiEapFast&Korumal1 EAP (PEAP)Protected EAP (PEAP)DlgHideWifiEapFastTnelli TLS Tunneled TLSDlgHideWifiEapFastKullan1c1 ad1UsernameDlgHideWifiEapFast,WEP 128-bit PassphraseWEP 128-bit PassphraseDlgHideWifiEapFastFWEP 40/128-bit Key (Hex veya ASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgHideWifiEapFastWLAN gvenlii WLAN securityDlgHideWifiEapFastGizli WLAN ekleAdd hidden WLANDlgHideWifiEapLeap"Kimlik Dorulama:AuthenticationDlgHideWifiEapLeapOlu_tur... C_reate…DlgHideWifiEapLeapSmCancelDlgHideWifiEapLeap BalanConnectDlgHideWifiEapLeap.Gizli WLAN a1na balanConnect to Hidden WLAN NetworkDlgHideWifiEapLeapBalant1: ConnectionDlgHideWifiEapLeap(Dinamik WEP (802.1x)Dynamic WEP (802.1X)DlgHideWifiEapLeapA ad1: Network nameDlgHideWifiEapLeapYokNoneDlgHideWifiEapLeapParola:PasswordDlgHideWifiEapLeap&Korumal1 EAP (PEAP)Protected EAP (PEAP)DlgHideWifiEapLeapTnelli TLS Tunneled TLSDlgHideWifiEapLeapKullan1c1 ad1:UsernameDlgHideWifiEapLeap,WEP 128-bit PassphraseWEP 128-bit PassphraseDlgHideWifiEapLeapFWEP 40/128-bit Key (Hex veya ASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgHideWifiEapLeapWLAN gvenlii: WLAN securityDlgHideWifiEapLeapGizli WLAN ekleAdd hidden WLANDlgHideWifiEapPeapAnonim kimlik:Anonymous identityDlgHideWifiEapPeap"Kimlik Dorulama:AuthenticationDlgHideWifiEapPeapOtomatik AutomaticDlgHideWifiEapPeapCA sertifikas1:CA certificateDlgHideWifiEapPeap*CA sertifika _ifresi:CA certificate passwordDlgHideWifiEapPeap 0ptalCancelDlgHideWifiEapPeap"Dosyadan sein...Choose from fileDlgHideWifiEapPeap BalanConnectDlgHideWifiEapPeap.Gizli WLAN A1na BalanConnect to Hidden WLAN NetworkDlgHideWifiEapPeapBalant1: ConnectionDlgHideWifiEapPeapDomain:DomainDlgHideWifiEapPeap(0 kimlik dorulama:Inner authenticationDlgHideWifiEapPeapA ad1: Network nameDlgHideWifiEapPeap.CA sertifikas1 gerekmezNo CA certificate is requiredDlgHideWifiEapPeapYokNoneDlgHideWifiEapPeapPEAP srm: PEAP versionDlgHideWifiEapPeapParola:PasswordDlgHideWifiEapPeap&Korumal1 EAP (PEAP)Protected EAP (PEAP)DlgHideWifiEapPeapKullan1c1 ad1:UsernameDlgHideWifiEapPeapSrm 0 Version 0DlgHideWifiEapPeapSrm 1 Version 1DlgHideWifiEapPeapWLAN gvenlii: WLAN securityDlgHideWifiEapPeapGizli WLAN ekleAdd hidden WLANDlgHideWifiEapPwd"Kimlik Dorulama:AuthenticationDlgHideWifiEapPwdOlu_tur... C_reate…DlgHideWifiEapPwd 0ptalCancelDlgHideWifiEapPwd BalanConnectDlgHideWifiEapPwd.Gizli WLAN A1na BalanConnect to Hidden WLAN NetworkDlgHideWifiEapPwdBalant1: ConnectionDlgHideWifiEapPwd(Dinamik WEP (802.1x)Dynamic WEP (802.1X)DlgHideWifiEapPwdA ad1: Network nameDlgHideWifiEapPwdYokNoneDlgHideWifiEapPwdParola:PasswordDlgHideWifiEapPwd&Korumal1 EAP (PEAP)Protected EAP (PEAP)DlgHideWifiEapPwdTnelli TLS Tunneled TLSDlgHideWifiEapPwdKullan1c1 ad1:UsernameDlgHideWifiEapPwd,WEP 128-bit PassphraseWEP 128-bit PassphraseDlgHideWifiEapPwdFWEP 40/128-bit Key (Hex veya ASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgHideWifiEapPwdWLAN gvenlii: WLAN securityDlgHideWifiEapPwdGizli WLAN ekleAdd hidden WLANDlgHideWifiEapTTLSAnonim kimlik:Anonymous identityDlgHideWifiEapTTLS"Kimlik Dorulama:AuthenticationDlgHideWifiEapTTLSCA Sertifikas1:CA certificateDlgHideWifiEapTTLS*CA sertifika _ifresi:CA certificate passwordDlgHideWifiEapTTLSOlu_tur... C_reate…DlgHideWifiEapTTLS 0ptalCancelDlgHideWifiEapTTLS&Dosyadan seiniz...Choose from fileDlgHideWifiEapTTLS BalanConnectDlgHideWifiEapTTLS.Gizli WLAN A1na BalanConnect to Hidden WLAN NetworkDlgHideWifiEapTTLSBalant1: ConnectionDlgHideWifiEapTTLSDomain:DomainDlgHideWifiEapTTLS(Dinamik WEP (802.1x)Dynamic WEP (802.1X)DlgHideWifiEapTTLS(0 kimlik dorulama:Inner authenticationDlgHideWifiEapTTLSA ad1: Network nameDlgHideWifiEapTTLS.CA sertifikas1 gerekmezNo CA certificate is requiredDlgHideWifiEapTTLSYokNoneDlgHideWifiEapTTLSParola:PasswordDlgHideWifiEapTTLS&Korumal1 EAP (PEAP)Protected EAP (PEAP)DlgHideWifiEapTTLSTnelli TLS Tunneled TLSDlgHideWifiEapTTLSKullan1c1 ad1:UsernameDlgHideWifiEapTTLS,WEP 128-bit PassphraseWEP 128-bit PassphraseDlgHideWifiEapTTLSFWEP 40/128-bit Key (Hex veya ASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgHideWifiEapTTLSWLAN Gvenlii: WLAN securityDlgHideWifiEapTTLSGizli WLAN ekleAdd hidden WLANDlgHideWifiEapTls"Kimlik Dorulama:AuthenticationDlgHideWifiEapTlsCA sertifikas1:CA certificateDlgHideWifiEapTls*CA sertifika _ifresi:CA certificate passwordDlgHideWifiEapTlsOlu_tur... C_reate…DlgHideWifiEapTls 0ptalCancelDlgHideWifiEapTlsDosyadan se...Choose from fileDlgHideWifiEapTls BalanConnectDlgHideWifiEapTls.Gizli WLAN A1na BalanConnect to Hidden WLAN NetworkDlgHideWifiEapTlsBalant1: ConnectionDlgHideWifiEapTlsDomain:DomainDlgHideWifiEapTlsKimlik:IdentityDlgHideWifiEapTlsA ad1: Network nameDlgHideWifiEapTls.CA sertifikas1 gerekmezNo CA certificate is requiredDlgHideWifiEapTlsYokNoneDlgHideWifiEapTls&Korumal1 EAP (PEAP)Protected EAP (PEAP)DlgHideWifiEapTlsTnelli TLS Tunneled TLSDlgHideWifiEapTls,Kullan1c1 sertifikas1:User certificateDlgHideWifiEapTls<Kullan1c1 sertifikas1 _ifresi:User certificate passwordDlgHideWifiEapTls6Kullan1c1 anahtar1 _ifresi:User key passwordDlgHideWifiEapTls0Kullan1c1 zel anahtar1:User private keyDlgHideWifiEapTlsWLAN gvenlii: WLAN securityDlgHideWifiEapTlsGizli WLAN EkleAdd hidden WLANDlgHideWifiLeapOlu_tur... C_reate…DlgHideWifiLeap 0ptalCancelDlgHideWifiLeap BalanConnectDlgHideWifiLeap.Gizli WLAN A1na BalanConnect to Hidden WLAN NetworkDlgHideWifiLeapBalant1 ConnectionDlgHideWifiLeap(Dinamik WEP (802.1X)Dynamic WEP (802.1X)DlgHideWifiLeap A ad1 Network nameDlgHideWifiLeapYokNoneDlgHideWifiLeap ParolaPasswordDlgHideWifiLeapKullan1c1 ad1UsernameDlgHideWifiLeap,WEP 128-bit PassphraseWEP 128-bit PassphraseDlgHideWifiLeapFWEP 40/128-bit Key (Hex veya ASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgHideWifiLeapWLAN Gvenlik WLAN securityDlgHideWifiLeap1(default) 1(default)DlgHideWifiWepGizli WLAN EkleAdd hidden WLANDlgHideWifiWep"Kimlik Dorulama:AuthenticationDlgHideWifiWepOlu_tur... C_reate…DlgHideWifiWep 0ptalCancelDlgHideWifiWep BalanConnectDlgHideWifiWep.Gizli WLAN A1na BalanConnect to Hidden WLAN NetworkDlgHideWifiWepBalant1: ConnectionDlgHideWifiWep(Dinamik WEP (802.1x)Dynamic WEP (802.1X)DlgHideWifiWepAnahtarKeyDlgHideWifiWepA ad1: Network nameDlgHideWifiWepYokNoneDlgHideWifiWepSistemi a Open SystemDlgHideWifiWep$Payla_1lan Anahtar Shared KeyDlgHideWifiWep,WEP 128-bit PassphraseWEP 128-bit PassphraseDlgHideWifiWepFWEP 40/128-bit Key (Hex veya ASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgHideWifiWepWEP index WEP indexDlgHideWifiWepWLAN Gvenlii: WLAN securityDlgHideWifiWepGizli WLAN EkleAdd Hidden WLANDlgHideWifiWpaOlu_tur... C_reate…DlgHideWifiWpa 0ptalCancelDlgHideWifiWpaKablosuz _ifrenizi veya kablosuz kart kullan1labilirliini onaylay1n5Confirm your WLAN password or usable of wireless cardDlgHideWifiWpa0WLAN Balant1s1 Ba_ar1l1Conn WLAN SuccessDlgHideWifiWpa BalanConnectDlgHideWifiWpa.Gizli WLAN A1na BalanConnect to Hidden WLAN NetworkDlgHideWifiWpaBalant1: ConnectionDlgHideWifiWpaYokNoneDlgHideWifiWpaParola:PasswordDlgHideWifiWpaWLAN ad1: WLAN nameDlgHideWifiWpaWLAN gvenlik: WLAN securityDlgHideWifiWpa 0ptalCancelDlgHotspotCreate&Etkin Nokta Olu_turCreate HotspotDlgHotspotCreateA ad1: Network nameDlgHotspotCreateYokNoneDlgHotspotCreate TamamOkDlgHotspotCreateParola:PasswordDlgHotspotCreateWLAN Gvenlik: WLAN securityDlgHotspotCreateGeli_mi_Advanced MainWindow.WLAN parolas1n1 dorulaConfirm your WLAN password MainWindowKablosuz _ifrenizi veya kablosuz kart kullan1labilirliini onaylay1n5Confirm your WLAN password or usable of wireless card MainWindow8Ethernet Balant1s1 Ba_ar1l1Conn Ethernet Success MainWindow0WLAN Balant1s1 Ba_ar1l1Conn WLAN Success MainWindow Balant1 Kesildi Disconnected MainWindowKablolu AEthernet MainWindowEthernet Alar1Ethernet Networks MainWindowFlyMode MainWindowGizli WLAN Hide WLAN MainWindowHotSpotHotSpot MainWindowNetOn MainWindowYeni LANNew LAN MainWindow6Ba_ka Kablolu A Dzeni YokNo Other Wired Network Scheme MainWindow8Ba_ka Kablosuz A Dzeni Yok No Other Wireless Network Scheme MainWindow:Listede kullan1labilir a yokNo usable network in the list MainWindowBalanamad1 Not connected MainWindow(Ana Pencereyi GsterShow MainWindow MainWindowWLANWLAN MainWindowWLAN Alar1 WLAN Networks MainWindow2Kablosuz balant1 kesildiWLAN is disconnected MainWindow:Kablolu a balant1s1 kesildiWired net is disconnected MainWindowkylin-nm MainWindowKablosuz _ifrenizi veya kablosuz kart kullan1labilirliini onaylay1n5Confirm your WLAN password or usable of wireless card OneConnForm0WLAN Balant1s1 Ba_ar1l1Conn WLAN Success OneConnForm BalanConnect OneConnForm.Gizli WLAN A1na BalanConnect to Hidden WLAN Network OneConnFormBalant1y1 Kes Disconnect OneConnForm--Form OneConnFormFiziksel adres:MAC: OneConnFormYokNone OneConnFormOranRate OneConnFormWLAN gvenlii:WLAN Security: OneConnFormBant geni_lii: BandWidth: OneLancForm BalanConnect OneLancFormBalant1y1 Kes Disconnect OneLancForm--Form OneLancFormIPv4 adresi:IPv4: OneLancFormIPv6 adresi:IPv6: OneLancFormFiziksel adres:MAC: OneLancForm Yap1land1rma YokNo Configuration OneLancFormFKylin a uygulamas1 masast mesaj1$kylin network applet desktop messageUtilskylin-nm/translations/kylin-nm_zh_CN.qm0000644000175000017500000006104314205345444017144 0ustar fengfengNˤHhڿEڿnڿ[ڿڿ%ڿ+L L;LVMT?B&+,RKRK ;RKRK!RKWRK#RK*LRK/XRK3RK9=\QSo7 &M8DDp0@-E<3f lI lI6lI!lIO=ph6plV eC)s>4B"6o~ /6o~ 6o~y6o~6o~!6o~(6o~3-e)=e>e>#e>)yOyGdF  s   ! (  .- 2c 7a : =F U_W^QrAZIII IIwII"I)I.I3I8*I;IH<IKVIQQ?77$7*7Rn    ; v  # * / 4G 9 U ;? UPC֍Is%L+ZI+ZLm8[|aK%wEVe gOQ}ALG Mƽ5_5A5:'R` ~{~ &{~{~$!G2L   # &( ,C)Df)D%))D+|C>0yxyyyMy fy'oy-y1y6y:Yy=P_<9&%09<SI5'D[ 5*G 54< 55n JɅ JɅ/ JɅ JɅ& JɅ1 JɅ5 XJ fJ[ .   C C C Ca C&g C0 CT D &T a4IE a4K eKl eK eK eK eK& eK#Y eK* eK/) eK3 eK9 eKI eKK eKR vA ֫ ŴI+ ŴIR @ @ bV; 34K$ 8 c3 dEV }"B T! mJ! `: &\ & &H & &" &)k &. &3d &7 1? , )S M= ˝2 ` CR NB@( ~* Uu Uu" Uu( UuQ R + 8 ? H H-S (T[ 8Bw & >" >EA T9 U k U U) U= U$ U+@ U08 U4 U<@  ԋF "5 {) {"X {)[&1T6:Ez?NAIJK^K^7k^ k^k^k^?k^!Uk^(ak^.k^2z;Lz[L8R8 v$N/4~|D4D @s0o.Ni$A*=*GP -iWI e^g ~Q~Add Wired NetworkConfFormIPV4W0W@:  Address: ConfFormR(DHCP) Auto(DHCP)ConfForm:\g ~QSa ele^Q~7Can not create new wired network for without wired cardConfFormSmCancelConfForm DNS: DNS 1: ConfFormY DNS: DNS 2: ConfFormQ~܋n Edit ConnConfForm Q~܋n Edit NetworkConfForm ؋QQs:  Gateway: ConfFormIPV4W0W@Qz fcbIP'IPV4 address conflict, Please change IPConfFormIPV6W0W@Qz fcbIP'IPV6 address conflict, Please change IPConfFormIPV6W0W@: Ipv6 Address: ConfForm Q~T y LAN name: ConfFormbKRManualConfFormIPn: Method: ConfForm [PQcx:  Netmask: ConfForm]R^evg ~Q~New network already createdConfFormevQ~ܑMn]~[b%New network settings already finishedConfFormxn[OkConfFormO[XSaveConfFormSs\hmKIPW0W@Qz"Will check the IP address conflictConfFormlb~R0e~QSaWireless card not existConfForm Q~܋n edit networkConfFormQ~]QwO`ocy:$kylin network applet desktop messageConfFormQ~]Qwkylin-nmConfFormRQee~QAdd Hidden WLAN DlgHideWifi e^... C_reate… DlgHideWifiSmCancel DlgHideWifixne~Q~[xbe~Y5Confirm your WLAN password or usable of wireless card DlgHideWifice~Q~bRConn WLAN Success DlgHideWificConnect DlgHideWificR0e~Q~Connect to Hidden WLAN Network DlgHideWifi cn: Connection DlgHideWifieNone DlgHideWifie~Q~T y: WLAN name DlgHideWifie~Q~[Qh`': WLAN security DlgHideWifiWPA S WPA2 ONWPA and WPA2 Enterprise DlgHideWifiWPA S WPA2 N*NWPA and WPA2 Personal DlgHideWifiWPA2 S WPA3 N*NWPA2 and WPA3 Personal DlgHideWifiWPA3 N*N WPA3 Personal DlgHideWifiRQee~QAdd hidden WLANDlgHideWifiEapFastRPACMn:!Allow automatic PAC pro_visioningDlgHideWifiEapFastS?T  AnonymousDlgHideWifiEapFast S?T N:Anonymous identityDlgHideWifiEapFast]򋤋 AuthenticatedDlgHideWifiEapFast:AuthenticationDlgHideWifiEapFastN$Q|u(BothDlgHideWifiEapFast e^... C_reate…DlgHideWifiEapFastSmCancelDlgHideWifiEapFastcConnectDlgHideWifiEapFastcR0e~Q~Connect to Hidden WLAN NetworkDlgHideWifiEapFast cn: ConnectionDlgHideWifiEapFastR` WEP (802.1x)Dynamic WEP (802.1X)DlgHideWifiEapFast Q苤:Inner authenticationDlgHideWifiEapFast Q~T y: Network nameDlgHideWifiEapFasteNoneDlgHideWifiEapFast PACeN:PAC fileDlgHideWifiEapFast[x:PasswordDlgHideWifiEapFastSObv EAPProtected EAP (PEAP)DlgHideWifiEapFast S TLS Tunneled TLSDlgHideWifiEapFastu(b7T :UsernameDlgHideWifiEapFastWEP 128 OM[xSWEP 128-bit PassphraseDlgHideWifiEapFast4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgHideWifiEapFaste~Q~[Qh`': WLAN securityDlgHideWifiEapFastWPA S WPA2 ONWPA and WPA2 EnterpriseDlgHideWifiEapFastWPA S WPA2 N*NWPA and WPA2 PersonalDlgHideWifiEapFastRQee~QAdd hidden WLANDlgHideWifiEapLeap:AuthenticationDlgHideWifiEapLeap e^... C_reate…DlgHideWifiEapLeapSmCancelDlgHideWifiEapLeapcConnectDlgHideWifiEapLeapcR0e~QConnect to Hidden WLAN NetworkDlgHideWifiEapLeap cn: ConnectionDlgHideWifiEapLeapR` WEP (802.1x)Dynamic WEP (802.1X)DlgHideWifiEapLeap Q~T y: Network nameDlgHideWifiEapLeapeNoneDlgHideWifiEapLeap[x:PasswordDlgHideWifiEapLeapSObv EAPProtected EAP (PEAP)DlgHideWifiEapLeap S TLS Tunneled TLSDlgHideWifiEapLeapu(b7T :UsernameDlgHideWifiEapLeapWEP 128 OM[xSWEP 128-bit PassphraseDlgHideWifiEapLeap4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgHideWifiEapLeape~Q~[Qh`': WLAN securityDlgHideWifiEapLeapWPA S WPA2 ONWPA and WPA2 EnterpriseDlgHideWifiEapLeapWPA S WPA2 N*NWPA and WPA2 PersonalDlgHideWifiEapLeapRQee~QAdd hidden WLANDlgHideWifiEapPeap S?T N:Anonymous identityDlgHideWifiEapPeap:AuthenticationDlgHideWifiEapPeapR AutomaticDlgHideWifiEapPeap CA Nf:CA certificateDlgHideWifiEapPeapCA Nf[x:CA certificate passwordDlgHideWifiEapPeapSmCancelDlgHideWifiEapPeapNeN b...Choose from fileDlgHideWifiEapPeapcConnectDlgHideWifiEapPeapcR0e~QConnect to Hidden WLAN NetworkDlgHideWifiEapPeap cn: ConnectionDlgHideWifiEapPeapWT :DomainDlgHideWifiEapPeap Q苤:Inner authenticationDlgHideWifiEapPeap Q~T y: Network nameDlgHideWifiEapPeapN CANfNo CA certificate is requiredDlgHideWifiEapPeapeNoneDlgHideWifiEapPeapPEAPrHg,: PEAP versionDlgHideWifiEapPeap[x:PasswordDlgHideWifiEapPeapSObv EAPProtected EAP (PEAP)DlgHideWifiEapPeapu(b7T :UsernameDlgHideWifiEapPeaprHg, 0 Version 0DlgHideWifiEapPeaprHg, 1 Version 1DlgHideWifiEapPeape~Q~[Qh`': WLAN securityDlgHideWifiEapPeapWPA S WPA2 ONWPA and WPA2 EnterpriseDlgHideWifiEapPeapWPA S WPA2 N*NWPA and WPA2 PersonalDlgHideWifiEapPeapRQee~QAdd hidden WLANDlgHideWifiEapPwd:AuthenticationDlgHideWifiEapPwd e^... C_reate…DlgHideWifiEapPwdSmCancelDlgHideWifiEapPwdcConnectDlgHideWifiEapPwdcR0e~QConnect to Hidden WLAN NetworkDlgHideWifiEapPwd cn: ConnectionDlgHideWifiEapPwdR` WEP (802.1x)Dynamic WEP (802.1X)DlgHideWifiEapPwd Q~T y: Network nameDlgHideWifiEapPwdeNoneDlgHideWifiEapPwd[x:PasswordDlgHideWifiEapPwdSObv EAPProtected EAP (PEAP)DlgHideWifiEapPwd S TLS Tunneled TLSDlgHideWifiEapPwdu(b7T :UsernameDlgHideWifiEapPwdWEP 128 OM[xSWEP 128-bit PassphraseDlgHideWifiEapPwd4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgHideWifiEapPwde~Q~[Qh`': WLAN securityDlgHideWifiEapPwdWPA S WPA2 ONWPA and WPA2 EnterpriseDlgHideWifiEapPwdWPA S WPA2 N*NWPA and WPA2 PersonalDlgHideWifiEapPwdRQee~QAdd hidden WLANDlgHideWifiEapTTLS S?T N:Anonymous identityDlgHideWifiEapTTLS:AuthenticationDlgHideWifiEapTTLS CA Nf:CA certificateDlgHideWifiEapTTLSCA Nf[x:CA certificate passwordDlgHideWifiEapTTLS e^... C_reate…DlgHideWifiEapTTLSSmCancelDlgHideWifiEapTTLSNeN b...Choose from fileDlgHideWifiEapTTLScConnectDlgHideWifiEapTTLScR0e~QConnect to Hidden WLAN NetworkDlgHideWifiEapTTLS cn: ConnectionDlgHideWifiEapTTLSWT :DomainDlgHideWifiEapTTLSR` WEP (802.1x)Dynamic WEP (802.1X)DlgHideWifiEapTTLS Q苤:Inner authenticationDlgHideWifiEapTTLS Q~T y: Network nameDlgHideWifiEapTTLSN CANfNo CA certificate is requiredDlgHideWifiEapTTLSeNoneDlgHideWifiEapTTLS[x:PasswordDlgHideWifiEapTTLSSObv EAPProtected EAP (PEAP)DlgHideWifiEapTTLS S TLS Tunneled TLSDlgHideWifiEapTTLSu(b7T :UsernameDlgHideWifiEapTTLSWEP 128 OM[xSWEP 128-bit PassphraseDlgHideWifiEapTTLS4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgHideWifiEapTTLSe~Q~[Qh`': WLAN securityDlgHideWifiEapTTLSWPA S WPA2 ONWPA and WPA2 EnterpriseDlgHideWifiEapTTLSWPA S WPA2 N*NWPA and WPA2 PersonalDlgHideWifiEapTTLSRQee~QAdd hidden WLANDlgHideWifiEapTls:AuthenticationDlgHideWifiEapTls CA Nf:CA certificateDlgHideWifiEapTlsCA Nf[x:CA certificate passwordDlgHideWifiEapTls e^... C_reate…DlgHideWifiEapTlsSmCancelDlgHideWifiEapTlsNeN b...Choose from fileDlgHideWifiEapTlscConnectDlgHideWifiEapTlscR0e~QConnect to Hidden WLAN NetworkDlgHideWifiEapTls cn: ConnectionDlgHideWifiEapTlsWT :DomainDlgHideWifiEapTlsN:IdentityDlgHideWifiEapTls Q~T y: Network nameDlgHideWifiEapTlsN CANfNo CA certificate is requiredDlgHideWifiEapTlseNoneDlgHideWifiEapTlsSObv EAPProtected EAP (PEAP)DlgHideWifiEapTls S TLS Tunneled TLSDlgHideWifiEapTls u(b7Nf:User certificateDlgHideWifiEapTlsu(b7Nf[x:User certificate passwordDlgHideWifiEapTlsu(b7[Ɣ[x:User key passwordDlgHideWifiEapTls u(b7y:User private keyDlgHideWifiEapTlse~Q~[Qh`': WLAN securityDlgHideWifiEapTlsWPA S WPA2 ONWPA and WPA2 EnterpriseDlgHideWifiEapTlsWPA S WPA2 N*NWPA and WPA2 PersonalDlgHideWifiEapTlsRQee~QAdd hidden WLANDlgHideWifiLeap e^... C_reate…DlgHideWifiLeapSmCancelDlgHideWifiLeapcConnectDlgHideWifiLeapcR0e~QConnect to Hidden WLAN NetworkDlgHideWifiLeap cn: ConnectionDlgHideWifiLeapR` WEP (802.1x)Dynamic WEP (802.1X)DlgHideWifiLeap Q~T y: Network nameDlgHideWifiLeapeNoneDlgHideWifiLeap[x:PasswordDlgHideWifiLeapu(b7T :UsernameDlgHideWifiLeapWEP 128 OM[xSWEP 128-bit PassphraseDlgHideWifiLeap4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgHideWifiLeape~Q~[Qh`': WLAN securityDlgHideWifiLeapWPA S WPA2 ONWPA and WPA2 EnterpriseDlgHideWifiLeapWPA S WPA2 N*NWPA and WPA2 PersonalDlgHideWifiLeap 1(؋) 1(default)DlgHideWifiWepRQee~QAdd hidden WLANDlgHideWifiWep:AuthenticationDlgHideWifiWep e^... C_reate…DlgHideWifiWepSmCancelDlgHideWifiWepcConnectDlgHideWifiWepcR0e~QConnect to Hidden WLAN NetworkDlgHideWifiWep cn: ConnectionDlgHideWifiWepR` WEP (802.1x)Dynamic WEP (802.1X)DlgHideWifiWep[ƔKeyDlgHideWifiWep Q~T y: Network nameDlgHideWifiWepeNoneDlgHideWifiWep _e>_|~ Open SystemDlgHideWifiWepQqN[Ɣ Shared KeyDlgHideWifiWepWEP 128 OM[xSWEP 128-bit PassphraseDlgHideWifiWep4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgHideWifiWep WEP h}" WEP indexDlgHideWifiWepe~Q~[Qh`': WLAN securityDlgHideWifiWepWPA S WPA2 ONWPA and WPA2 EnterpriseDlgHideWifiWepWPA S WPA2 N*NWPA and WPA2 PersonalDlgHideWifiWepRQee~QAdd Hidden WLANDlgHideWifiWpa e^... C_reate…DlgHideWifiWpaSmCancelDlgHideWifiWpaxne~Q~[xbe~Y5Confirm your WLAN password or usable of wireless cardDlgHideWifiWpace~Q~bRConn WLAN SuccessDlgHideWifiWpacConnectDlgHideWifiWpacR0e~QConnect to Hidden WLAN NetworkDlgHideWifiWpa cn: ConnectionDlgHideWifiWpaeNoneDlgHideWifiWpa[x:PasswordDlgHideWifiWpae~Q~T y: WLAN nameDlgHideWifiWpae~Q~[Qh`': WLAN securityDlgHideWifiWpaWPA S WPA2 ONWPA and WPA2 EnterpriseDlgHideWifiWpaWPA S WPA2 N*NWPA and WPA2 PersonalDlgHideWifiWpaWPA2 S WPA3 N*NWPA2 and WPA3 PersonalDlgHideWifiWpaWPA3 N*N WPA3 PersonalDlgHideWifiWpaSmCancelDlgHotspotCreate R^N*NppCreate HotspotDlgHotspotCreate Q~T y: Network nameDlgHotspotCreateeNoneDlgHotspotCreatexn[OkDlgHotspotCreate[x:PasswordDlgHotspotCreatee~Q~[Qh`': WLAN securityDlgHotspotCreateWPA S WPA2 N*NWPA and WPA2 PersonalDlgHotspotCreateg ~cWired connection KylinDBusnQ~Advanced MainWindowQk!xne~Q~[xConfirm your WLAN password MainWindowxne~Q~[xbe~Y5Confirm your WLAN password or usable of wireless card MainWindowcg ~Q~bRConn Ethernet Success MainWindowce~Q~bRConn WLAN Success MainWindowDŽrYcQ~Y1% Connect Bluetooth Network Failed MainWindowce~QbRConnect Hidden WLAN Success MainWindowcVPNY1%Connect VPN Network Failed MainWindowcg ~Q~Y1%Connect Wired Network Failed MainWindowcebcSmConnection Be Killed MainWindowg*c Disconnected MainWindowg ~Q~Ethernet MainWindowSu(g ~Q~RhEthernet Networks MainWindow NY*QcEthernet connection MainWindowވLj!_FlyMode MainWindowRQeQ~ Hide WLAN MainWindowN*NppHotSpot MainWindowIP g*RMbR&IP configuration could not be reserved MainWindowg ~QMACW0W@N S9MMAC Address Mismatch MainWindow]cNetOn MainWindow]c,QSa: NetOn,IfName: MainWindowQ~]cOFelՋNTQ-Network Connected But Can Not Access Internet MainWindowe^Q~New LAN MainWindowRhN-eQvNg ~Q~No Other Wired Network Scheme MainWindowg*hmKR0QvNe~Q~ No Other Wireless Network Scheme MainWindowg*hmKR0g ~YNo ethernet device available MainWindowRhfeScQ~No usable network in the list MainWindowg*hmKR0e~QSaNo wireless card detected MainWindow_SRMg*cNOUQ~ Not connected MainWindow_SRMS:Wg*bkcR0 N-ve~Q~#Selected WLAN has not been scanned. MainWindowf>y:Q~܏cuLbShow MainWindow MainWindow e~\@WQWLAN MainWindowSu(e~Q~Rh WLAN Networks MainWindow e_e~Q~WLAN is disconnected MainWindowWiFi]cWiFi already connected external MainWindowWiFi]e_WiFi already disconnect MainWindowg ~cWired connection MainWindow g ~Q~e_Wired net is disconnected MainWindowg*cQe[^QSaQ~Without Lan Cable MainWindowQ~]Qwkylin-nm MainWindowS mCancel OneConnFormxne~Q~[xbe~Y5Confirm your WLAN password or usable of wireless card OneConnFormce~Q~bRConn WLAN Success OneConnFormcConnect OneConnForme_ Disconnect OneConnForm _؋kdQ~Forget OneConnForm--Form OneConnForm ritW0W@MAC: OneConnFormeNone OneConnForm[xPassword Incorrect OneConnForm\^ `'Property OneConnFormsRate OneConnForm OS_:^ Signal: OneConnForme~Q~[Qh`'WLAN Security: OneConnForm^&[ BandWidth: OneLancFormS mCancel OneLancFormcConnect OneLancForme_ Disconnect OneLancForm--Form OneLancFormIPv4W0W@IPv4: OneLancFormIPv6W0W@IPv6: OneLancForm ritW0W@MAC: OneLancFormg*MnNo Configuration OneLancForm eQSaO`o No IfName OneLancFormQ~܋n]QwKylin NMUtilsQ~]QwO`ocy:$kylin network applet desktop messageUtilsSmCanclWiFiConfigDialog Qee~Q~T yT[xTpQxn[Input WLAN Information PleaseWiFiConfigDialogxn[OkWiFiConfigDialoge~Q~[x Password:WiFiConfigDialog e~Q~܋WLAN AuthenticationWiFiConfigDialoge~cT y WLAN ID:WiFiConfigDialoge~Q~T y WLAN Name:WiFiConfigDialogS?T NAnonymous Identity WpaWifiDialog kk![xAsk pwd each query WpaWifiDialogVCA eN (*.pem *.der *.p12 *.crt *.cer *.pfx).CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) WpaWifiDialogbCA eN (*.pem *.der *.p12 *.crt *.key *.cer *.pfx)4CA Files (*.pem *.der *.p12 *.crt *.key *.cer *.pfx) WpaWifiDialog CA NfCA certificate WpaWifiDialogSmCancel WpaWifiDialog bNN*CANfChoose a CA certificate WpaWifiDialogNeN b...Choose from file... WpaWifiDialogcConnect WpaWifiDialogcQ~ Connect WLAN WpaWifiDialogWDomain WpaWifiDialog EAPelEAP type WpaWifiDialogNIdentity WpaWifiDialog6k2N Inner auth WpaWifiDialogcT yName WpaWifiDialogeNone WpaWifiDialog[x:Password WpaWifiDialog[Qh`'Security WpaWifiDialogf>y:[x Show password WpaWifiDialogu(b7NfUser Certificate WpaWifiDialogu(b7yUser Private Key WpaWifiDialog u(b7y[xUser Private Key password WpaWifiDialogu(b7T :Username WpaWifiDialogWPA S WPA2ONWPA and WPA2 Enterprise WpaWifiDialogWPA S WPA2N*NWPA and WPA2 Personal WpaWifiDialogWPA2 S WPA3N*NWPA2 and WPA3 Personal WpaWifiDialog WPA3N*N WPA3 Personal WpaWifiDialog om;cbR!activeate connection successfully WpaWifiDialogN CANfno need for CA certificate WpaWifiDialogSf/[x[om;cY1%5password may be error, so activeate connection failed WpaWifiDialogkylin-nm/translations/kylin-nm_bo.ts0000644000175000017500000017737114205345374016572 0ustar fengfeng ConfForm edit network LAN name: Method: Address: Netmask: Gateway: DNS 1: DNS 2: Edit Conn Auto(DHCP) Manual Cancel Save Ok Can not create new wired network for without wired card New network already created New network settings already finished Will check the IP address conflict IP address conflict, Please change IP Edit Network Add Wired Network DlgHideWifi Connect to Hidden WLAN Network Add Hidden WLAN Connection WLAN name WLAN security Cancel Connect C_reate… None WPA and WPA2 Personal WPA and WPA2 Enterprise Conn WLAN Success Confirm your WLAN password or usable of wireless card DlgHideWifiEapFast Connect to Hidden WLAN Network Add hidden WLAN Connection Network name WLAN security Authentication Anonymous identity Allow automatic PAC pro_visioning PAC file Inner authentication Username Password Cancel Connect C_reate… None WPA and WPA2 Personal WPA and WPA2 Enterprise WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) Tunneled TLS Protected EAP (PEAP) Anonymous Authenticated Both DlgHideWifiEapLeap Connect to Hidden WLAN Network Add hidden WLAN Connection Network name WLAN security Authentication Username Password Cancel Connect C_reate… None WPA and WPA2 Personal WPA and WPA2 Enterprise WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) Tunneled TLS Protected EAP (PEAP) DlgHideWifiEapPeap Connect to Hidden WLAN Network Add hidden WLAN Connection Network name WLAN security Authentication Anonymous identity Domain CA certificate CA certificate password No CA certificate is required PEAP version Inner authentication Username Password Cancel Connect None WPA and WPA2 Personal WPA and WPA2 Enterprise Protected EAP (PEAP) Choose from file Automatic Version 0 Version 1 DlgHideWifiEapPwd Connect to Hidden WLAN Network Add hidden WLAN Connection Network name WLAN security Authentication Username Password Cancel Connect C_reate… None WPA and WPA2 Personal WPA and WPA2 Enterprise WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) Tunneled TLS Protected EAP (PEAP) DlgHideWifiEapTTLS Connect to Hidden WLAN Network Add hidden WLAN Connection Network name WLAN security Authentication Anonymous identity Domain CA certificate CA certificate password No CA certificate is required Inner authentication Username Password Cancel Connect C_reate… None WPA and WPA2 Personal WPA and WPA2 Enterprise WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) Tunneled TLS Protected EAP (PEAP) Choose from file DlgHideWifiEapTls Connect to Hidden WLAN Network Add hidden WLAN Connection Network name WLAN security Authentication Identity Domain CA certificate CA certificate password No CA certificate is required User certificate User certificate password User private key User key password Cancel Connect C_reate… None WPA and WPA2 Personal WPA and WPA2 Enterprise Tunneled TLS Protected EAP (PEAP) Choose from file DlgHideWifiLeap Connect to Hidden WLAN Network Add hidden WLAN Connection Network name WLAN security Username Password Cancel Connect C_reate… None WPA and WPA2 Personal WPA and WPA2 Enterprise WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) DlgHideWifiWep Connect to Hidden WLAN Network Add hidden WLAN Connection Network name WLAN security Key WEP index Authentication Cancel Connect C_reate… None WPA and WPA2 Personal WPA and WPA2 Enterprise WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) 1(default) Open System Shared Key DlgHideWifiWpa Connect to Hidden WLAN Network Add Hidden WLAN Connection WLAN name WLAN security Password Cancel Connect C_reate… None WPA and WPA2 Personal WPA and WPA2 Enterprise Conn WLAN Success Confirm your WLAN password or usable of wireless card Selected WLAN has not been scanned. DlgHotspotCreate Dialog Create Hotspot Network name WLAN security Password Cancel Ok None WPA and WPA2 Personal MainWindow kylin-nm Advanced Ethernet New LAN Hide WLAN WLAN HotSpot FlyMode No wireless card detected Not connected Disconnected Ethernet Networks WLAN Networks No usable network in the list Show MainWindow NetOn,IfName: No Other Wired Network Scheme No Other Wireless Network Scheme Wired connection Ethernet connection Without Lan Cable MAC Address Mismatch Connection Be Killed Connect Wired Network Failed Connect VPN Network Failed IP configuration could not be reserved Confirm your WLAN password or usable of wireless card Confirm your WLAN password NetOn Wired net is disconnected WLAN is disconnected Conn Ethernet Success Conn WLAN Success OneConnForm Form Connect Disconnect Cancel Connect to Hidden WLAN Network Rate None WLAN Security: Signal: MAC: Conn WLAN Success Confirm your WLAN password or usable of wireless card OneLancForm Form Connect Disconnect Cancel No Configuration No IfName IPv4: IPv6: MAC: BandWidth: Utils kylin-nm kylin network applet desktop message WpaWifiDialog Dialog Connect WLAN Connection name Security EAP type inner authentication Username Password Show password Ask pwd each query Cancel Connect WPA & WPA2 kylin-nm/translations/kylin-nm_zh_CN.ts0000644000175000017500000024471514205345444017166 0ustar fengfeng BackThread Confirm your WLAN password 请再次确认无线网络密码 ConfForm edit network 编辑网络设置 LAN name: 网络名称: Method: 编辑IP设置: Ipv6 Address: IPV6地址: Address: IPV4地址: Netmask: 子网掩码: Gateway: 默认网关: DNS 1: 首选DNS: DNS 2: 备选DNS: Edit Conn 网络设置 Auto(DHCP) 自动(DHCP) Manual 手动 Cancel 取消 Save 保存 Ok 确定 Can not create new wired network for without wired card 缺少有线网卡 无法新建网络 New network already created 已创建新的有线网络 Wireless card not exist 没找到无线网卡 Can not save wired network for without wired card New network settings already finished 新的网络配置已经完成 Will check the IP address conflict 即将检测IP地址冲突 IPV4 address conflict, Please change IP IPV4地址冲突,请更换IP IPV6 address conflict, Please change IP IPV6地址冲突,请更换IP Edit Network 编辑网络设置 Add Wired Network 新建有线网络 kylin-nm 网络工具 kylin network applet desktop message 网络工具信息提示 create wired network successfully 已创建新的有线网络 change configuration of wired network successfully 新的设置已经生效 New settings already effective 新的设置已经生效 DlgHideWifi Add Hidden WLAN 加入隐藏无线网 Connection 连接设置: WLAN name 无线网络名称: WLAN security 无线网络安全性: Cancel 取消 Connect 连接 C_reate… 新建... None WPA and WPA2 Personal WPA 及 WPA2 个人 WPA and WPA2 Enterprise WPA 及 WPA2 企业 WPA2 and WPA3 Personal WPA2 及 WPA3 个人 WPA3 Personal WPA3 个人 Conn WLAN Success 连接无线网络成功 Confirm your WLAN password or usable of wireless card 请确认无线网络密码或无线设备 WEP 40/128-bit Key (Hex or ASCII) WEP 40/128 位密钥(十六进制或ASCII) WEP 128-bit Passphrase WEP 128 位密码句 Dynamic WEP (802.1X) 动态 WEP (802.1x) Connect to Hidden WLAN Network 连接到隐藏无线网络 DlgHideWifiEapFast Connect to Hidden WLAN Network 连接到隐藏无线网络 Add hidden WLAN 加入隐藏无线网 Connection 连接设置: Network name 网络名称: WLAN security 无线网络安全性: Authentication 认证: Anonymous identity 匿名身份: Allow automatic PAC pro_visioning 自动PAC配置: PAC file PAC文件: Inner authentication 内部认证: Username 用户名: Password 密码: Cancel 取消 Connect 连接 C_reate… 新建... None WPA and WPA2 Personal WPA 及 WPA2 个人 WPA and WPA2 Enterprise WPA 及 WPA2 企业 WEP 40/128-bit Key (Hex or ASCII) WEP 40/128 位密钥(十六进制或ASCII) WEP 128-bit Passphrase WEP 128 位密码句 Dynamic WEP (802.1X) 动态 WEP (802.1x) WPA & WPA2 Enterprise WPA 及 WPA2 企业 Tunneled TLS 隧道 TLS Protected EAP (PEAP) 受保护的 EAP Anonymous 匿名 Authenticated 已认证 Both 两者兼用 DlgHideWifiEapLeap Connect to Hidden WLAN Network 连接到隐藏无线网 Add hidden WLAN 加入隐藏无线网 Connection 连接设置: Network name 网络名称: WLAN security 无线网络安全性: Authentication 认证: Username 用户名: Password 密码: Cancel 取消 Connect 连接 C_reate… 新建... None WPA and WPA2 Personal WPA 及 WPA2 个人 WPA and WPA2 Enterprise WPA 及 WPA2 企业 WEP 40/128-bit Key (Hex or ASCII) WEP 40/128 位密钥(十六进制或ASCII) WEP 128-bit Passphrase WEP 128 位密码句 Dynamic WEP (802.1X) 动态 WEP (802.1x) WPA & WPA2 Enterprise WPA 及 WPA2 企业 Tunneled TLS 隧道 TLS Protected EAP (PEAP) 受保护的 EAP DlgHideWifiEapPeap Connect to Hidden WLAN Network 连接到隐藏无线网 Add hidden WLAN 加入隐藏无线网 Connection 连接设置: Network name 网络名称: WLAN security 无线网络安全性: Authentication 认证: Anonymous identity 匿名身份: Domain 域名: CA certificate CA 证书: CA certificate password CA 证书密码: No CA certificate is required 不需要CA证书 PEAP version PEAP版本: Inner authentication 内部认证: Username 用户名: Password 密码: Cancel 取消 Connect 连接 None WPA and WPA2 Personal WPA 及 WPA2 个人 WPA and WPA2 Enterprise WPA 及 WPA2 企业 WEP 40/128-bit Key (Hex or ASCII) WEP 40/128 位密钥(十六进制或ASCII) WEP 128-bit Passphrase WEP 128 位密码句 Dynamic WEP (802.1X) 动态 WEP (802.1x) WPA & WPA2 Enterprise WPA 及 WPA2 企业 Tunneled TLS 隧道 TLS Protected EAP (PEAP) 受保护的 EAP Choose from file 从文件选择... Automatic 自动 Version 0 版本 0 Version 1 版本 1 DlgHideWifiEapPwd Connect to Hidden WLAN Network 连接到隐藏无线网 Add hidden WLAN 加入隐藏无线网 Connection 连接设置: Network name 网络名称: WLAN security 无线网络安全性: Authentication 认证: Username 用户名: Password 密码: Cancel 取消 Connect 连接 C_reate… 新建... None WPA and WPA2 Personal WPA 及 WPA2 个人 WPA and WPA2 Enterprise WPA 及 WPA2 企业 WEP 40/128-bit Key (Hex or ASCII) WEP 40/128 位密钥(十六进制或ASCII) WEP 128-bit Passphrase WEP 128 位密码句 Dynamic WEP (802.1X) 动态 WEP (802.1x) WPA & WPA2 Enterprise WPA 及 WPA2 企业 Tunneled TLS 隧道 TLS Protected EAP (PEAP) 受保护的 EAP DlgHideWifiEapTTLS Connect to Hidden WLAN Network 连接到隐藏无线网 Add hidden WLAN 加入隐藏无线网 Connection 连接设置: Network name 网络名称: WLAN security 无线网络安全性: Authentication 认证: Anonymous identity 匿名身份: Domain 域名: CA certificate CA 证书: CA certificate password CA 证书密码: No CA certificate is required 不需要CA证书 Inner authentication 内部认证: Username 用户名: Password 密码: Cancel 取消 Connect 连接 C_reate… 新建... None WPA and WPA2 Personal WPA 及 WPA2 个人 WPA and WPA2 Enterprise WPA 及 WPA2 企业 WEP 40/128-bit Key (Hex or ASCII) WEP 40/128 位密钥(十六进制或ASCII) WEP 128-bit Passphrase WEP 128 位密码句 Dynamic WEP (802.1X) 动态 WEP (802.1x) WPA & WPA2 Enterprise WPA 及 WPA2 企业 Tunneled TLS 隧道 TLS Protected EAP (PEAP) 受保护的 EAP Choose from file 从文件选择... DlgHideWifiEapTls Connect to Hidden WLAN Network 连接到隐藏无线网 Add hidden WLAN 加入隐藏无线网 Connection 连接设置: Network name 网络名称: WLAN security 无线网络安全性: Authentication 认证: Identity 身份: Domain 域名: CA certificate CA 证书: CA certificate password CA 证书密码: No CA certificate is required 不需要CA证书 User certificate 用户证书: User certificate password 用户证书密码: User private key 用户私钥: User key password 用户密钥密码: Cancel 取消 Connect 连接 C_reate… 新建... None WPA and WPA2 Personal WPA 及 WPA2 个人 WPA and WPA2 Enterprise WPA 及 WPA2 企业 WEP 40/128-bit Key (Hex or ASCII) WEP 40/128 位密钥(十六进制或ASCII) WEP 128-bit Passphrase WEP 128 位密码句 Dynamic WEP (802.1X) 动态 WEP (802.1x) WPA & WPA2 Enterprise WPA 及 WPA2 企业 Tunneled TLS 隧道 TLS Protected EAP (PEAP) 受保护的 EAP Choose from file 从文件选择... DlgHideWifiLeap Connect to Hidden WLAN Network 连接到隐藏无线网 Add hidden WLAN 加入隐藏无线网 Connection 连接设置: Network name 网络名称: WLAN security 无线网络安全性: Username 用户名: Password 密码: Cancel 取消 Connect 连接 C_reate… 新建... None WPA and WPA2 Personal WPA 及 WPA2 个人 WPA and WPA2 Enterprise WPA 及 WPA2 企业 WEP 40/128-bit Key (Hex or ASCII) WEP 40/128 位密钥(十六进制或ASCII) WEP 128-bit Passphrase WEP 128 位密码句 Dynamic WEP (802.1X) 动态 WEP (802.1x) WPA & WPA2 Enterprise WPA 及 WPA2 企业 DlgHideWifiWep Connect to Hidden WLAN Network 连接到隐藏无线网 Add hidden WLAN 加入隐藏无线网 Connection 连接设置: Network name 网络名称: WLAN security 无线网络安全性: Key 密钥 WEP index WEP 检索 Authentication 认证: Cancel 取消 Connect 连接 C_reate… 新建... None WPA and WPA2 Personal WPA 及 WPA2 个人 WPA and WPA2 Enterprise WPA 及 WPA2 企业 WEP 40/128-bit Key (Hex or ASCII) WEP 40/128 位密钥(十六进制或ASCII) WEP 128-bit Passphrase WEP 128 位密码句 Dynamic WEP (802.1X) 动态 WEP (802.1x) WPA & WPA2 Enterprise WPA 及 WPA2 企业 1(default) 1(默认) Open System 开放式系统 Shared Key 共享密钥 DlgHideWifiWpa Connect to Hidden WLAN Network 连接到隐藏无线网 Add Hidden WLAN 加入隐藏无线网 Connection 连接设置: WLAN name 无线网络名称: WLAN security 无线网络安全性: Password 密码: Cancel 取消 Connect 连接 C_reate… 新建... None WPA and WPA2 Personal WPA 及 WPA2 个人 WPA and WPA2 Enterprise WPA 及 WPA2 企业 WPA2 and WPA3 Personal WPA2 及 WPA3 个人 WPA3 Personal WPA3 个人 Conn WLAN Success 连接无线网络成功 Confirm your WLAN password or usable of wireless card 请确认无线网络密码或无线设备 WEP 40/128-bit Key (Hex or ASCII) WEP 40/128 位密钥(十六进制或ASCII) WEP 128-bit Passphrase WEP 128 位密码句 Dynamic WEP (802.1X) 动态 WEP (802.1x) WPA & WPA2 Enterprise WPA 及 WPA2 企业 DlgHotspotCreate Dialog Create Hotspot 创建个人热点 Network name 网络名称: WLAN security 无线网络安全性: Password 密码: Cancel 取消 Ok 确定 None WPA and WPA2 Personal WPA 及 WPA2 个人 WPA and WPA2 Enterprise WPA 及 WPA2 企业 KylinDBus Wired connection 有线连接 MainWindow kylin-nm 网络工具 Network 网络 Advanced 设置网络 Ethernet 有线网络 WLAN 无线局域网 Connect Hide Network 加入网络 HotSpot 个人热点 FlyMode 飞行模式 Show MainWindow 显示网络连接界面 No wireless card detected 未检测到无线网卡 No ethernet device available 未检测到有线设备 Not connected 当前未连接任何网络 Disconnected 未连接 NetOn,IfName: 已连接,网卡: No Other Wired Network Scheme 列表中无其他有线网络 No Other Wireless Network Scheme 未检测到其他无线网络 Wired connection 有线连接 Ethernet connection 以太网连接 Wired net is disconnected 有线网络断开 WLAN is disconnected 断开无线网络 Without Lan Cable 未插入对应网卡网线 MAC Address Mismatch 有线网MAC地址不匹配 Connection Be Killed 连接超时或连接被取消 Carrier/link changed Connect Wired Network Failed 连接有线网络失败 Connect VPN Network Failed 连接VPN失败 IP configuration could not be reserved IP 未分配成功 Connect Bluetooth Network Failed 通过蓝牙连接网络失败 Connection timed out 连接超时 Confirm your WLAN password or usable of wireless card 请确认无线网络密码或无线设备 Confirm your WLAN password 请再次确认无线网络密码 Selected WLAN has not been scanned. 当前区域未扫描到选中的无线网络 Connect Hidden WLAN Success 连接隐藏无线网成功 Ethernet Networks 可用有线网络列表 New LAN 新建网络 Hide WLAN 加入网络 No usable network in the list 列表暂无可连接网络 NetOn 已连接 WLAN Networks 可用无线网络列表 Conn Ethernet Success 连接有线网络成功 Conn Ethernet Fail 连接有线网络失败 Conn WLAN Success 连接无线网络成功 Network Connected But Can Not Access Internet 网络已连接但无法访问互联网 WiFi already disconnect WiFi已断开 WiFi already connected external WiFi已连接 NotifySend Form -- OneConnForm Form -- Input password 输入密码 Config 设置 Connect 连接 Disconnect 断开 Forget 忘记此网络 Password Incorrect 密码错误 Property 属 性 Signal: 信号强度: Public 开放 Safe 安全 Cancel 取 消 Rate 速率 None WLAN Security: 无线网络安全性: MAC: 物理地址: Conn WLAN Success 连接无线网络成功 Confirm your WLAN password or usable of wireless card 请确认无线网络密码或无线设备 OneLancForm Form -- Config 设置 Connect 连接 Disconnect 断开 Cancel 取 消 No Configuration 未配置 No IfName 无网卡信息 IPv4: IPv4地址: IPv6: IPv6地址: BandWidth: 带宽: MAC: 物理地址: Auto 自动 Utils Kylin NM 麒麟网络设置工具 kylin network applet desktop message 网络工具信息提示 WiFiConfigDialog WLAN Authentication 无线网络认证 Input WLAN Information Please 输入无线网络名称和密码后点击确定 WLAN ID: 无线连接名称: WLAN Name: 无线网络名称: Password: 无线网络密码: Cancl 取消 Ok 确定 Dialog WpaWifiDialog Dialog Connect WLAN 连接网络 Name 连接名称 Security 安全性 EAP type EAP方法 Inner auth 阶段2身份验证 Username 用户名: Password 密码: Show password 显示密码 Ask pwd each query 每次询问密码 Cancel 取消 Connect 连接 None WPA and WPA2 Personal WPA 及 WPA2个人 WPA and WPA2 Enterprise WPA 及 WPA2企业 WPA2 and WPA3 Personal WPA2 及 WPA3个人 WPA3 Personal WPA3个人 Wireless card not exist 没找到无线网卡 Choose from file... 从文件选择... CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) CA 文件 (*.pem *.der *.p12 *.crt *.cer *.pfx) CA Files (*.pem *.der *.p12 *.crt *.key *.cer *.pfx) CA 文件 (*.pem *.der *.p12 *.crt *.key *.cer *.pfx) Identity 身份 Anonymous Identity 匿名身份 Domain CA certificate CA 证书 no need for CA certificate 不需要CA证书 User Certificate 用户证书 User Private Key 用户私钥 User Private Key password 用户私钥密码 password may be error, so activeate connection failed 可能是密码错误导致激活连接失败 activeate connection successfully 激活连接成功 Choose a CA certificate 选择一个CA证书 kylin-nm/translations/kylin-nm_tr.ts0000644000175000017500000022636214205345374016612 0ustar fengfeng 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: Gateway: 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ı Will check the IP address conflict IP address conflict, Please change IP 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 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 WPA and WPA2 Personal WPA and WPA2 Enterprise 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 and WPA2 Personal WPA and WPA2 Enterprise 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 and WPA2 Personal WPA and WPA2 Enterprise 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 and WPA2 Personal WPA and WPA2 Enterprise 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 and WPA2 Personal WPA and WPA2 Enterprise 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 and WPA2 Personal WPA and WPA2 Enterprise 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 and WPA2 Personal WPA and WPA2 Enterprise 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 and WPA2 Personal WPA and WPA2 Enterprise 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 and WPA2 Personal WPA and WPA2 Enterprise 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 WPA and WPA2 Personal WPA and WPA2 Enterprise 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 Selected WLAN has not been scanned. 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 Dialog Create Hotspot Etkin Nokta Oluştur Network name Ağ adı: WLAN security WLAN Güvenlik: Password Parola: Cancel İptal Ok Tamam None Yok WPA and WPA2 Personal WPA & WPA2 Personal WPA & WPA2 Kişisel KylinDBus 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 WLAN WLAN Enabled Aktif Disabled Pasif HotSpot HotSpot FlyMode Show MainWindow Ana Pencereyi Göster No wireless card detected Not connected Bağlanamadı Disconnected Bağlantı Kesildi NetOn,IfName: 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 connection Ethernet connection Wired net is disconnected Kablolu ağ bağlantısı kesildi WLAN is disconnected Kablosuz bağlantı kesildi Without Lan Cable MAC Address Mismatch Connection Be Killed Connect Wired Network Failed Connect VPN Network Failed IP configuration could not be reserved 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 NetOn 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ı NotifySend Form -- 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 Signal: Public Halka açık Safe Güvenli Cancel 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 Cancel No Configuration Yapılandırma Yok No IfName IPv4: IPv4 adresi: IPv6: IPv6 adresi: BandWidth: Bant genişliği: MAC: Fiziksel adres: Auto Oto Utils kylin-nm kylin network applet desktop message Kylin ağ uygulaması masaüstü mesajı WpaWifiDialog Dialog Connect WLAN Connection name Security EAP type inner authentication Username Password Show password Ask pwd each query Cancel Connect WPA & WPA2 None Yok kylin-nm/man/0000755000175000017500000000000014205345374012016 5ustar fengfengkylin-nm/man/kylin-nm.10000644000175000017500000000140214205345374013633 0ustar fengfeng.\" 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"kylin-nm/res/0000755000175000017500000000000014205345374012034 5ustar fengfengkylin-nm/res/h/0000755000175000017500000000000014205345374012263 5ustar fengfengkylin-nm/res/h/no-pwd-wifi.png0000644000175000017500000000315314205345374015133 0ustar fengfengPNG  IHDRagzTXtRaw profile type exifxڽa =q13A߇Mɦdfb%>AB˟ߍ~lj|s>K zv~win1.c~=\_0?ӽl~pĻHr8R<)JY<goS!Yխw")Ьv8{|ԏܭA?wLrl.ˊ{ˈe,e_k5l+>cQ#L E4'`lkh7ZR'r2 or<#E/zYt%52P|od&ANa=^"WLa8FGûQk̙]ڵB^ itrYmhV}VA02',is1֖TVHɰ#;1f sQ/p YW;\ q6`G췄*C1XH!5b9UL[hfɲɧbRN%KVcr̖Sι-W$N~ SlJSʌ8ۜ<*U+ZM5ײRZؒZk| -6kVvj=#xPTgWj0]\p?NBgbĭ@AKg{/\g(Aé܉_XBݕܗ&QG䨣! ZVW@}BS K*J]zw_6JHj4}*Etfe];eMa?׎~ľ$?7w]^}]G-E>7.Vz_^{]O_*Obz:}}iW{5g1'2ô7g6m>qex̤ ?r]qs i*y^xwwgoisrbKGD pHYs.#.#x?vtIME 7:IDAT8˥m0 O~S47G(#d# @_B"B@Ё?Ǔ(I/Z@/)I%"&+pk2 8sbx;F`/d>]ncb04 G'[XtZ^v}f4R+ZFW L55uZ]XR%}H: R`vmLng :@~u+ g#<IuTP+<IENDB`kylin-nm/res/h/show-pwd.png0000644000175000017500000000241114205345374014537 0ustar fengfengPNG  IHDR FtEXtSoftwareAdobe ImageReadyqe<iTXtXML:com.adobe.xmp sIDATxbgL P@@ }.@ @y @14q,H) T:07d%@<b5 UU$3n): `&| @٧ ]@\;A ?1/bv  @ ԁ t^J ^@ $ Ӂ;x ?b)  >ę@`]hx8q@# ٠t0T$U5. ?] rZ 6h-O@OqT=:騏IENDB`kylin-nm/res/h/right-pwd.png0000644000175000017500000000256614205345374014707 0ustar fengfengPNG  IHDRhOGtEXtSoftwareAdobe ImageReadyqe<iTXtXML:com.adobe.xmp ԟIDATxb9h@#P Ȩ@D:gr&d b2 ^qK @<a@ VfƁ$q́:9 ևJ$B%@1@}@]0ǃ {@d4 cAZ#IA,G`b(d(~;u Inb1 n@x;'*0Wˡ T\Aa @MQ nP (΅+a b?hb@Á"T@|(((RX B@^PdFOTp"?3I "l3hI14^`)RP@2/Po4Cda SC4IENDB`kylin-nm/res/h/hide-pwd.png0000644000175000017500000000265414205345374014501 0ustar fengfengPNG  IHDR HLtEXtSoftwareAdobe ImageReadyqe<iTXtXML:com.adobe.xmp Za`IDATxb+' UUUfPNx_[T$d^ZHTցL dt dGyxx=XO*Zijoowx>@  @3ֻ@[KT :5cp'A} q)<|WfGp ^@|awpb_`H#p*`0E0, fwYT EO'^|IENDB`kylin-nm/res/l/0000755000175000017500000000000014205345374012267 5ustar fengfengkylin-nm/res/l/network-online.svg0000644000175000017500000000142114205345374015761 0ustar fengfenggnome-dev-ethernet32kylin-nm/res/l/network-offline.png0000644000175000017500000000077214205345374016114 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxb`  t_$Hi;i[x]`(uF0Q:`Pkn' CK z.1 1\ k ir,P7ܸX.*UKoTHjͥz?zhs0PdqIx⻤@4v2;ߑ L6 Y aH K[Gr0aA |zZ, f, /fk$ jYƨ F he߿@>___O?j@,o^EqiFZI^i&rshRx4-XHbh@zfW[IENDB`kylin-nm/res/l/network-offline.svg0000644000175000017500000000234114205345374016121 0ustar fengfeng kylin-nm/res/l/network-online.png0000644000175000017500000000062614205345374015754 0ustar fengfengPNG  IHDR szz pHYs  ~HIDATXc?@}08?#!FFFXr^AO`^`4 :`uF0P'VeIn0"U/O<0\`]R`Q/ܟBf@Q<T@D9C!~D1yx b@-OХ9XPb޽xp>3> Û?vE>!QE ݀K߿$z߿:^SCl```( v g@Hht`xm,IENDB`kylin-nm/res/g/0000755000175000017500000000000014205345374012262 5ustar fengfengkylin-nm/res/g/close_black.png0000644000175000017500000000031514205345374015230 0ustar fengfengPNG  IHDR;0IDATH E-a'{n &%zg8V__5Ir1/RʵQ"h 8t[LީVl㭘lb0yiPqRzZUɶt,>s~8_ k^WJIENDB`kylin-nm/res/g/close_white.png0000644000175000017500000000023014205345374015270 0ustar fengfengPNG  IHDR;0_IDATHA 0 DzKT!EBJX/BDd_|${w"ͷ?.RgWL=;EQOR*2OIENDB`kylin-nm/res/g/up_arrow.png0000644000175000017500000000020414205345374014622 0ustar fengfengPNG  IHDR pHYs+6IDATe10=߭N6er>>$L 2&"IF6iPIENDB`kylin-nm/res/g/down_arrow.png0000644000175000017500000000016114205345374015147 0ustar fengfengPNG  IHDR8IDAT]I g>ha)`'Q)5as,ӽwIENDB`kylin-nm/res/hw/0000755000175000017500000000000014205345374012452 5ustar fengfengkylin-nm/res/hw/wifi-none-pwd.png0000644000175000017500000000117214205345374015644 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxV1O@vM`\BbI$F\ upСt tF||MǵK]q؏U7uѥC8&C-dA$L Ų1o0ȨgSPe.MD8>7 3 2iC)u"4'6@ABƙͲ)_*+3)+Xs`Dy)7KR{ʝx0/Q85$J S0L DB/9#33İU{#xP"f8&Rө f<,/jP۷BDs^ӭ2n dmHc$yW@ 8@/:a̅VdN-6u(^X;} xw8N`%M]/[1X5%'aZr)BRmdHlB.8'Y$I49;0qB= e{}ƻv+= }Uu!o$A2fzhLfh9;{E`\7['IENDB`kylin-nm/res/hw/wifi-low-pwd.png0000644000175000017500000000121314205345374015502 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<-IDATxVNP# ԁ:0؅01: |##.ƄAt@. ^sG5,䤴s;َPY W]J=KB&08&B@-"FRp@r'e(΅ g02)B)u"/4o$$5Ա#)_ *+Ӎ+\Xs`gyܜ /I5(Ń|C2 ViP4 P+%'z`fC5x4Ԩ/d$= Gڄ$CJc:)ĖXmjK̰>TҌ'2x>rf%Їs ׷:ả: 2[hUzv҉kHū؊x灾Xުܮŗ-,\0Z,t9JK2Cq6!~֓$!#=$ڳ.^.ﹻs 5/\X *4[B]tTN4af(8[E5K(- IENDB`kylin-nm/res/hw/wifi-low.png0000644000175000017500000000111514205345374014713 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxV;N@uP\$EFP"ihrJG8 PIIAr")Hx#=G:ݙ7ogvzG#ƝS@|K`5>(MN} 4R[Reqs3 8>8՚rod֮Id33+9H-28*6ub`,IO8|VHb;Jieᖨ(KUBziS g=*vC4H}˽%Pzֈ8+Obn W O*l2S.t,=aj-G10K hsRѝd[^*ԊyѫAk>26b덍i'w^e3<07;^!L Oʵe!&zeS8+!-O99$'A}A%_3p4TEd8>t7 r_4{)@.0%VHH=Ƿ7(_IENDB`kylin-nm/res/hw/wifi-medium.png0000644000175000017500000000113614205345374015375 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxV=OP-2I0: .Ln'O` :8PHtDX4sSҼ5~ I`ܻIENDB`kylin-nm/res/hw/wifi6-none-pwd.png0000644000175000017500000000142514205345374015733 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxW=kAStਐ(AH\DM R?!eʔ.]:eʔjr)r bg+,p Qވa}8 ۝y;fvy,Z:vOj?@η0ʘй ƕp^E /sÿ  Hiprvu-/%t{Ų6SOxg)B@&©M`8ȁ {UB`g287brp_p`hBq[WҌyXsz[4 L=s-3i7o*a< BNDV#X%GRjW*i|!% O@$-/G݊co?*Y";<ƺȕn@"03!ddl%7#˱LN!P 3C⚦N~vz ˈ8uS)b~]:y`>H h3>HC&Vj:ƔItc崴\R쎗y#psBKRENM2"-hFI$Ǽ5w!mH$S/`#! R.,jbi5uo=THh(cK pAe8{c[vzA^3KmtHG 34$PzaNq2F:HԘ.#*5juV nkƹOl6nC/؉$N#y75wFyGEi5xU3](X+ uX ,<]If2q !Â'*Լ-Wk b5ϻfY'H;9m.4g{˔+0v@2,%|$e%+H':]n--,DW5Re%SucEVxϳf+ṖQY ak^6ը/I_{@aDaSHe@r Ew'4h[${r N<Ω]yɁm e pⅢYA[xmya{aF%?H41;*؄R7G2x4HQoN CexUc^!E6{vS; Fx)X/Vտ{Vs4D)s.j0HD-4'- ^؊ QsF-~hIT>۶>p\!X3D{LR@ ky%3d g_i1ˤa8K8?.RX .Y@?s*%i&IENDB`kylin-nm/res/hw/wifi6-low.png0000644000175000017500000000136314205345374015006 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxW1o`Q#A$D@: ebؑ6FF6dؑ)]*RC" %z_t9>qХtr}.Iܮu+\;p## o1ٯBQF"#?F Mt9'<_) w=vBLJ_?#XXVJy# ;IENDB`kylin-nm/res/hw/wifi6+-low-pwd.png0000644000175000017500000000141414205345374015646 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxW=kPBN``:8P<^ ֵ[ƌ1clu@ x!\K+7OTY !{ uɩ, ~ ^CӅJ\x6J @+E^C#D~& SHG@v;K45r/mv?Wy"ubqhEbc4#?Y7 h^T_eK339H`,x/' n5MXc7j #sͲ.J@%h1U`hia^3j v]m"^{Xp"$rW U!15II#HP~'I}iR?g憉1Mt"=E]wȘ!(Kn/la&T<МHm dmxOJ:,n=wް42Qf= d ,޹ c9`' -J@Ӱ9}OWRk9=s O}!αL?,]\b}_hRZ@UQ 0en*\`IENDB`kylin-nm/res/hw/wifi6+-high-pwd.png0000644000175000017500000000141514205345374015765 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxW1o@Q2!KY E a@BPl'knMnmXTu# HEJT^ƱXO;} |oih? 0hlSPf qZ+S+6#Q7GjG{)Hukj@ۊF! 9wO7eH[1V- KH4vCќQSydּ`ci`H%&[3) 9)pӵLFy}[g pQ3]"iv;"> Dm){isiuDO%4hݛшf& ޚQ/N2zxH8;!廚* Vlc,63wG 35(q,ZHDthb,qU$41h: Wi ,9Ԗ:cցUE(>(H!RAm*5 yG+D_F J}-d{ =_v-}(T~jKW3֖l'psb =eȝ7*cKJlǎ9^v r>U PdJtu DR2pg=2Ͻ~s}/t L5p-8K,(juK*c槏IENDB`kylin-nm/res/hw/wifi6+-medium.png0000644000175000017500000000131014205345374015530 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<jIDATxVK[Q}(A!t J, ϭknM4EKq3B`.o0:@zn}1y&/]9^g `0,Ԡ%-'a6$0'L MNBUNl+.(]OHT]/1)`H~0l`/+B .I#QZrc4! !uے_iJv¤< Ce*1ߩ!E1{)d> <DQ/`=p-wMKkLtj}\6=%i Cw@eT3 }@X3@⑗t%$5gM7qF0ki=ʣ% x>!IENDB`kylin-nm/res/hw/wifi6-full-pwd.png0000644000175000017500000000137214205345374015737 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxVr@չfUY¬B5, R 첲:, 3VACyy\OYMHwfGt۽W6c_6.}xCk5I`m<\\o F >`?UDDi{|sc$Mkݮ$M Z7#<22rV"Y(R&7?ȴ3=+}Ա> SI|s ߇w3#wE7®>o r)ת4OHf&)BpW+unL>NJ:D˨DJ[ x#`ѮDc*%v%1䕈'"_o[qlOś.)ts] !đ4LMEf%7;$R͞FL:+Ѕ/ qH%\;dIXBf^H߿jDƺ~(8+@"dʳ.I#w;Q`-~u,$]ASWᶁu<ļ9/;$1{Khr@8`ރv@j3b1[|I6E5g}ة D]\g (V-]2TY숮kxeVzŸ]}tkyiV; V@SB^$V IENDB`kylin-nm/res/hw/wifi6+-low.png0000644000175000017500000000130014205345374015050 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<bIDATxV=KcA}OE"faILOnKK;)-mlYºEVyM!,=ul̇^y9gνwE+[^o /h?tfA؄3&'*~D > '"24UqI׀#R P50wQ~oMCU*z.$r^,X 5?2+ :5R3r.Ȱ3qO>`ѯR @s<Sϲ1ٝc$ni?,pGy9Ӷ , 搲uOT H""'9uF-iv@DR@>H g'(Ψݙ oTlbn)zw ^ vz!`'ш$BJwކ4{MR;cQ~ CmXrƜD@s2缊nIĞxjx*ZoXxKƫbٽ'بmҐE 2},_)o.$^X;HQ^H<݆MG@[}=ۻ]'w 0vIENDB`kylin-nm/res/hw/wifi-full-pwd.png0000644000175000017500000000341614205345374015652 0ustar fengfengPNG  IHDR }JbtEXtSoftwareAdobe ImageReadyqe<iTXtXML:com.adobe.xmp D IDATxb?2`̝h&D"LhbD7Hbz XmA@c{|FN;DgE n`b X!@~P*=T$ K@ X4%݇@*ـqy @T0 PN> @|(FZ u5DPr%da 4M@k8f1G u@SFYhlGn4b@& E(@iB`TN ҼYZ:r|?(C?H '>+5= aXeE UX~ Fa%A N-if82?H P~B15@hLl (&Bt6d?ʄ~t62V*As)FJnl43}&`^P8!`ldp@:b#W~)GhYQ T6.j>@ЦhR*bF+;>BK X uFR) ~hXG!IS4 ^ ȅ 4`ĕ@>G B Z -Ā\.| ,i 4 -@ EhM\1 ?`iAM~"!VaQL7S b? > gnaK|KXGoC{a+mLeD+QGNx &fIENDB`kylin-nm/res/hw/wifi6-none.png0000644000175000017500000000131614205345374015142 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<pIDATxV=kA&:UXk *\t韐2K)2e4 ٠ A$7mlt9=iwgμJ?岁͡}c2T|K1 }_* :?*"Ds|;7q\6,97v /ZWwl}@"mbrx`+:0NSu~9pᐠTBH]@+X -_5-hM9q5%Xw=ÿ1=8LJ3εL2%̿ W D818hKIS=bqBk{HZv݊7xbi/?*i"'Fȕ=@"02)kTP0 ?r@?.#DZ,j'(!sϖO~j=LjrksTs i$+U:Y`>H h3=ICFNjƘucԵLX nK}8oy.I)&7IpLxQ_pθy//Z!IvWqN.!,8t܅Y lֲ[IENDB`kylin-nm/res/hw/wifi6+-full-pwd.png0000644000175000017500000000134114205345374016006 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxWr@2* tXYTV0V֚aa *+̬.3ܜ%9oI޻Q-vWq%c l' ASO&")#5jg۽%H]#ծ F8>c ٪qtlJڢlvo>§Ud):M~DZGO|k <o c_W ITa@bk >hצ4EflV)Qp < K>P[M߈})VAF щ7$M@о2:.a>+NiRep ̈́`+c >! IE:"zHd>;Zp9q T+^< i{#fMĘI}BzxEһ0p|„kE@տ7FTn^VSpwuB}닍*HDڒye-g5DA`J)b$$ڔ[C'hm]pl_j/~x (1nmyH{%3dŻ559q&{3:C`('ѼMQ4ЧxaXIENDB`kylin-nm/res/hw/wifi6+-none.png0000644000175000017500000000126214205345374015215 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<TIDATxVJAI " L#H IF,KK?#`cB+!12{&yq`ؽe7ylL& U*FkIXd4 ~u`; ~`CxIHNj~5`i -4pr[G[(Ė&KԀ7D M}fz>C&5aZ*3VF>= 0&ܚT6=v^y.1 _rD*MOܞ&Hq.B%k n.zsڪf*9&NpٷN-`eyX5)Iuc<;#=;EM&u+NS','+XHJD/&~qI D߱@|bb0Y땀'ކi&6& Dʰh*Mr ghY@w<[<nTte"v/)%c)|y̙iQ -va%TE+/_ۂLw,eLk^^Mfߒ73GIENDB`kylin-nm/res/hw/wifi6+-high.png0000644000175000017500000000130114205345374015167 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<cIDATxVKBaES*Ư4 JJL1 >0-,f.CaCreQMb<TV4^q?!rXC3>F~ִB}`7VB 7(; /x_v&JOxL`[fY 1./.Ns@'<\xJ&A* yw%8ȅxtYgJ&=:؈7C Ĺsd--8sոB~ JWw*qKhp@<9r6" |){+)R!z pX=F"|= vubMxJq |p )e^甹mY͘}Zq-K,ƓdL""'ߘ'JB!^%g㵁m95c~W1NQe-S*e8dL㉒EU)k1/!ȏ8vI%jbg=SQF,U,%)xn%MD2TԐ؃)C#,>aѷ+QJ@p$|=o EN 2|?k3YX# DGIWtV$"c( [DR:cS{x 9xBc/1:)&۠c_Ũek#VS*I{髓n܏Qs$H5D&{'|z 1kϵB HtHҝ8W BsWoFCDqF :g:g&kl-˾PQphIENDB`kylin-nm/res/hw/wifi6-medium.png0000644000175000017500000000134614205345374015466 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxVkSQJ&%`Ct qsԭ[uS/hFǺ"FAi Kj61#ۗ~qߏ{sL?ѨaZէ;H@VsP= @*Ȋ3hH#ƹH4O='Z7"s+~@AOߛIP EK5@& p̩IdZʁ J!0D?Ća}  a7y ÌyXstB )Myt#҇~%x+֕@$D-蹠F%ivuOI gieYkV<@_~ʕM\ڶ\Y聮}eM($P/rqAku{cFh(*^ӜJ!.\ |<0Tdklf ;vS`"A;2I^0Vr1il+|fj1RptWs1]ɺ>ыН3F[qB0!^b[S/IW J2]XcS쾑4nVҒ? AziIENDB`kylin-nm/res/hw/wifi-full.png0000644000175000017500000000105514205345374015057 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxVQ@ L8$Tܸܸ%  b* ``f3;Besf4Ļ'=o /^mۑg<* iL>A.@:0~MGeN Hs%q@u<|֌$=3+TJژu)`phx+ΰ0wb0:lpe%Or]QU AUl \cF`.V8qID9:%Kk 0k[1⿕C'PR6\Th C0*3a̓*"HJ‹ P5[׶@٣9f^6]eT~f+$~)a*x(%kV, û(]¬T /c``B')+dN ncFml RU ȞwG@hINt[ $X#Qb%0]I%Pᾁu"Ģ9_wWYY%H]6'rÁ EKId*8drnWM@tG'2lWV`֔`&>IENDB`kylin-nm/res/hw/wifi6+-none-pwd.png0000644000175000017500000000137514205345374016012 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxWjA3*@I!@PT''tP2FAi( N\aGޚze|qavWw;og̞%vr Ӆji=xP&M9BiS9'TWr ><&Sb$ഭhd BA/ER1Լ-Dk@4=)̄z̦7gCq@ L$+)] @ENMʹ7z$vM?;jU;*sS=?vPRia|wf6]:.dwM N# :iD>F%iNq "Ej!^*NNl+'*+/X뙍 lY:( C66,hb-sQR 5T'^ S ?` ]1(.MS:OV 9@<{>x+,u*B}7UB˴ޱzK {KoRp<[jn}wߨ-", ۶>pZyS !1gFQ4!)rH#]+!" Gddf-gF@Y`4*1/IENDB`kylin-nm/res/hw/wifi6-low-pwd.png0000644000175000017500000000144614205345374015600 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxW=kAS$pTXj .rM R?R&KN)] M0.5WXb oxp7nwyoE _CeR1 .bX* *eG^CDr+; R<!́5,Y?鯽g<by,Od5w`KNSP6bc&"$F@V03@l3k# ju-aƺ39@+g4f?P&S)3L5ě7<8 u"91طQ/II*5%. x"ay=>VFMO{o+Xxt0W6ix`째EP3# DS0ˢ]nܳn퓵\|"N\5otTsjRQV]{,D0MO(3>CVhZ䦕'r2HHȍpjwQ3);ɉx4\EWi x{K!9EB,/(>ΰn;`y-~AxpwG }؊~knИ5>T5ݘW [\>.T/]XS֛=-s` ׳c_R?d`8,v%IENDB`kylin-nm/res/hw/wifi6+-full.png0000644000175000017500000000123114205345374015214 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<;IDATxW=S@M QN,cG?!tvJGG_@쌝;;))cGe|1M0vfrݻݽ0LՉ㸎yh_)иpj Ne`W  IJTM٘$c@F@F8͹?4?_D mr"qO=<"sǩ/T 9۹&k o #.|_)g+HxiGpGވ3Oay#epC;.R3xnlQd?N42;RU:O))b#E"ARV֐TMXsFZsR< \3o-$i 4H8 ~]F%Ih; p=xWb @Y,q끥'.+ ͷ(JyF" f3OlI=ԋ g@#ۅ s /#Z$niAgk)Yc4v[I84ʆIENDB`kylin-nm/res/hw/wifi6-high.png0000644000175000017500000000133514205345374015123 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxVnAB"4HEH@BTKG\:J%tr4 ! 'qR,ż'}>BF{;f*lO*MxC=\LK_9NBM<DT7&#3Q6u.k$ekiO FFn|}Xg?<h5ߑ4P HeĪ  55R4`"P D~M%$Tk> naXW pUˌu߱=*G5wEf ~ "CKz6 wT Kjh%,.61^Beyx{oe |sh\ӳ-}?SCfHOZ,b ÀDeXFަ{Fk\fcm;tunN̞}IO͈qd/q^pr;*CsztXAi':]-a&#' Arv˕r9UPnKQ% ռ[9WEKId  2QvUx-]uф>/[W'kN_IENDB`kylin-nm/res/hw/wifi6-medium-pwd.png0000644000175000017500000000145414205345374016256 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxWkSQ~7&P24D0:XAN?nvf$ft[!.p0 uHYB"w^}t:;?]3cX40l[\Ƙ^Ta,cH@ z@_cp (݋DډxJz#2Jy:6Y ŀ99 nȪ}=0JSvP6`0lTJ# @~$of84}ϭ@(`XW*^SŒsǸsW' Ti~VLQ)#L5ě񷕰<@j*BDhFp7:Rʪtw,a"a;VBmO?+o.#<\٤ⁱYAUrF`: KXݍI0tqwV{rCT?( tZ`UsS滴t.LC@d2"ФZl}uE馸3rAMI (~>Xj^&rYL^0FBn^Y''"xwSm]zgh| kg AbBb.!څՇJZKRN}'ZNI>ߖz cbGse}ޗQ\1.΍}F(yL oG5,hjIENDB`kylin-nm/res/x/0000755000175000017500000000000014205345374012303 5ustar fengfengkylin-nm/res/x/fly-mode-on.svg0000644000175000017500000000175514205345374015162 0ustar fengfeng 画板 1 kylin-nm/res/x/net-list-bg.svg0000644000175000017500000000154314205345374015154 0ustar fengfeng kylin-nm/res/x/control.svg0000644000175000017500000000203314205345374014502 0ustar fengfeng 画板 1 kylin-nm/res/x/load-down.png0000644000175000017500000000030014205345374014666 0ustar fengfengPNG  IHDRatEXtSoftwareAdobe ImageReadyqe<bIDATxb`hK"BdBX2QQ`#; pNCB.X?@{hl AbP9aTxH" BH &q_1DIENDB`kylin-nm/res/x/fly-mode-off.svg0000644000175000017500000000225714205345374015316 0ustar fengfeng 画板 1 kylin-nm/res/x/hot-spot-on.svg0000644000175000017500000000175314205345374015221 0ustar fengfeng kylin-nm/res/x/wifi-list-bg.svg0000644000175000017500000000163714205345374015330 0ustar fengfeng 画板 1 kylin-nm/res/x/load-up.png0000644000175000017500000000030214205345374014345 0ustar fengfengPNG  IHDRatEXtSoftwareAdobe ImageReadyqe<dIDATxb`WB|Ƨ  P6VC:&lȶ`5 @,&| X43@K#63ĂQ`~F0>IENDB`kylin-nm/res/x/hot-spot-off.svg0000644000175000017500000000225514205345374015355 0ustar fengfeng kylin-nm/res/x/setup.png0000644000175000017500000000415014205345374014151 0ustar fengfengPNG  IHDRrP6 zTXtRaw profile type exifxW[( g$`fiَOܓ1E[ /\K YJ-%5WnXܯ=)IGPyߠ.crv4]GvzCu+^qs.Q(P0iinœ:% )]]d݀|{}òiɝv8m *99͹krD6]̠ZAQ܂nXl{\P:Ub2ehҺN.f^Y!;q%=9O MTH:ħ/[:FL0Fxk|9CDN{\ gΟBhǫAA`6Le7}VxN'00J` JB2+p49  psJw,\؛@`5)CMd)bAJ.RJ\ӤYEVm,X15jrMjqhVCKZ"KYt.#|zKn6xmbFmbX*kYum"fy,S:Cy5:X)'kՋ D30ƙ:hv΢Q9g20& r@a^esOĞb.8u`.G>amxc*tLcCpLj./fiU},Sg e +ӣ2\*|NW_xq0rjl^|Ww/j^dNJ} A_PQmur'/ Ѝ^#V.FGZ 0"cCuVUg73t !*O  -U8@6@g_,m+7kMsxnZpŷ"H`W2-8Dz٬VmoZ5|4ȳ7=qRHߺ,_Z 7 g 6=h(w? $3yxz̰TBKM N-`;%j6iCCPICC profilex}=H@_SE* VqP,8jP! :\!4iHR\ׂUg]\AIEJ_Rhq?{ܽziV鶙N&lnE "~ы,cVR_.γ9ռŀH< &^'ڴ QVUsQ.Hu7E539(XlcYԈ'cSXY+WYuCHb BA(FV iO]D.\`Gd ^R$t805>v |R?Iг \\4e ٔ])HS(3w tz5qd pp){=\rr*bKGD pHYs  tIMED$9IDAT8u]hq?Ye[Jhj^ʝxJF;.\jhqCSre)/yŤp0aiS{?s~tPiڥ*5_,:V/oWjZPuL` 'kAR﩯՛j][l $IHǁ@p1OکTY^mW?cTGejj uO=DO-04G7xT;I`pXF+SECVF_CZ@=89Vnȇj:. etqlW]Wƒ@wchˁV!ڠ dO[N2߭a_i>vS2=k^6dԇjjkLxuo|Dt[0߁z`?PF>CYXt-9uzA=>So Rd wRRuOA ۳+W,r92 8~ 6$ s"  |ARt˹xI ыMg [-Q=Q1GIENDB`kylin-nm/res/w/0000755000175000017500000000000014205345374012302 5ustar fengfengkylin-nm/res/w/wifi-none-pwd.png0000644000175000017500000000117214205345374015474 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxV1O@vM`\BbI$F\ upСt tF||MǵK]q؏U7uѥC8&C-dA$L Ų1o0ȨgSPe.MD8>7 3 2iC)u"4'6@ABƙͲ)_*+3)+Xs`Dy)7KR{ʝx0/Q85$J S0L DB/9#33İU{#xP"f8&Rө f<,/jP۷BDs^ӭ2n dmHc$yW@ 8@/:a̅VdN-6u(^X;} xw8N`%M]/[1X5%'aZr)BRmdHlB.8'Y$I49;0qB= e{}ƻv+= }Uu!o$A2fzhLfh9;{E`\7['IENDB`kylin-nm/res/w/wifi-low-pwd.png0000644000175000017500000000121314205345374015332 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<-IDATxVNP# ԁ:0؅01: |##.ƄAt@. ^sG5,䤴s;َPY W]J=KB&08&B@-"FRp@r'e(΅ g02)B)u"/4o$$5Ա#)_ *+Ӎ+\Xs`gyܜ /I5(Ń|C2 ViP4 P+%'z`fC5x4Ԩ/d$= Gڄ$CJc:)ĖXmjK̰>TҌ'2x>rf%Їs ׷:ả: 2[hUzv҉kHū؊x灾Xުܮŗ-,\0Z,t9JK2Cq6!~֓$!#=$ڳ.^.ﹻs 5/\X *4[B]tTN4af(8[E5K(- IENDB`kylin-nm/res/w/wifi-low.png0000644000175000017500000000111514205345374014543 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxV;N@uP\$EFP"ihrJG8 PIIAr")Hx#=G:ݙ7ogvzG#ƝS@|K`5>(MN} 4R[Reqs3 8>8՚rod֮Id33+9H-28*6ub`,IO8|VHb;Jieᖨ(KUBziS g=*vC4H}˽%Pzֈ8+Obn W O*l2S.t,=aj-G10K hsRѝd[^*ԊyѫAk>26b덍i'w^e3<07;^!L Oʵe!&zeS8+!-O99$'A}A%_3p4TEd8>t7 r_4{)@.0%VHH=Ƿ7(_IENDB`kylin-nm/res/w/wifi-medium.png0000644000175000017500000000113614205345374015225 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxV=OP-2I0: .Ln'O` :8PHtDX4sSҼ5~ I`ܻIENDB`kylin-nm/res/w/wifi6-none-pwd.png0000644000175000017500000000141714205345374015564 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxWjA >HTHK@N"jFK. )S )&\D) A(*(o[1"4^xHy͜E~W} >c`hG0ϵ 0ii&pedρg@ʒ 2_I%@bhF2iP 9 `WE16NꔍxM5/7[}S$dIAEF ];9`LI( 7B^ph֓DCJ.#V1$~ٮN%j3]۔hJ$]1]ÎkهXu'oy3K쭳T; l/0̀c($`k;搌IτLl3.I=Y,`9y{[!)`Z!<lBz`* -5t]ע[rMD$Z@9̓Hz)L5e^eeUJaTI~ [?XL}f1VDv 6QUM&!ZJ'?#P|K=te5Gf2c܉$IENDB`kylin-nm/res/w/wifi-medium-pwd.png0000644000175000017500000000122714205345374016016 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<9IDATxVNP]H~nn 1bLM0@ ,\s\^rRz߽{^K&É|Rրjw?v :P܄ Qx )U=Fıۖ`@L̪=*IkVLRH8Hm+RŲH<\5XK`4#ܡw=qb_I>e%SucEVxϳf+ṖQY ak^6ը/I_{@aDaqХtr}.Iܮu+\;p## o1ٯBQF"#?F Mt9'<_) w=vBLJ_?#XXVJy# ;IENDB`kylin-nm/res/w/wifi6+-low-pwd.png0000644000175000017500000000144614205345374015503 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxVkSQ~O@3$8<:@)cƎ;'t1.` k! 1# 'ǛT\z9Qt^qك~J-a|~7')c%~< YD"\?{Ijro`sLN^0T)de^IoLj xb"522lo/kzDB:J&ldX' uc8py»2eXk@mb R&l$pw\fRܠM=0NC`kM]D\u 2&:I'eH}DAfUxg2]^aVi8ݠFsʪl:ޙF~RVS.k;&V]Q}R{EB W8+OW>0{Jx~́#8jl-}R6ga]y8'y,h߱, cdvS^G Tmn1w! KcjĈfǵ<]bv)wdסub>`{_~;`"E8$pXvXQ66Hs9XC<E"|+g6dyn bNM?#~K`ld4UIENDB`kylin-nm/res/w/wifi6+-high-pwd.png0000644000175000017500000000147614205345374015624 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxVkaI C !Ktl9A:-qskحqsٺcn-8b b ( o~\҈K?x/w 76{` mD~q׵2PJ+&7@Lpؾ&<"Ksq|9ͪV dV b;u4s cMy$M<%2|ĸdo9p9Ʀa`{@mG$3f/aQPZSx:ux>"Tl\# 3Ir6u?刬z2XW1hع)fW4,Iyɉu5y&A_C8o5gKfBWrA0VfaC"ȐAKH`3PH58>Zּw`A1i0Xg^1Jw2El2~dYN1,GfCU܄F=@}^]=Et]ע[L{qy Hx?FTP9Dvk@)8ͻJc(lJ#1([iw1YQFj)]pVwwLl"'){x6RNBDL='v/ lIENDB`kylin-nm/res/w/wifi6+-medium.png0000644000175000017500000000142314205345374015365 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxVjA3R(9cpaU.EeJܥܥ ٥Jsccp)5WXp QyZNw7^}3o qI`))X~r~Tw3,k5~{ dYg+88#;Uzb ;3uPyc_B\zo̩s.c2znYC/T" p-Mɰ>@-4cyIxsLW}P/Rk`B[п ?ڣ'd*qz©|3Nr$o)%esu/|٥ e<3 VLat5e{ֻ1xUe4.T•xކ>eNC07vv{!'Q xs;dN[\c'NT.!vځ1}Șhf̃c6s^8;?1sV\FeAyrTP!^x8&E%i;b C#ضk_r-|!i5=_4/m kK*%ϳt*T7a]wbS9e#NNGヂ8PM*ajJX( K` fHRR.IENDB`kylin-nm/res/w/wifi6+-low.png0000644000175000017500000000140714205345374014710 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxV1K#A9`؃ ,Nl#e vڙ2eJmb!*€B=F&l65|dg}xxynyZ£|fxn4j@3>42~y+P*8K$ñ14ܯ2[3G+p"cy† U%  ^ psCE-.r5؎ 5˹,ag]""-7.p6v a H'F_xW@dWm5(гs@ʭ$V*P"Ye@KfJ\噊'l2".*kd hh\QI7skWj<`Q鲍zTT]Uc2q*RwB_C8_`3n,#902p--CjB::^K8_ό1sgjɝLp.Qoaɴ Alκ~+;pvX-g@3)E>c8];=>u?!q`dOrB}Dd]pƫA`/!́Wdl+z4ό& %qjJDnػ3-Ǭu D IDATxb?2`̝h&D"LhbD7Hbz XmA@c{|FN;DgE n`b X!@~P*=T$ K@ X4%݇@*ـqy @T0 PN> @|(FZ u5DPr%da 4M@k8f1G u@SFYhlGn4b@& E(@iB`TN ҼYZ:r|?(C?H '>+5= aXeE UX~ Fa%A N-if82?H P~B15@hLl (&Bt6d?ʄ~t62V*As)FJnl43}&`^P8!`ldp@:b#W~)GhYQ T6.j>@ЦhR*bF+;>BK X uFR) ~hXG!IS4 ^ ȅ 4`ĕ@>G B Z -Ā\.| ,i 4 -@ EhM\1 ?`iAM~"!VaQL7S b? > gnaK|KXGoC{a+mLeD+QGNx &fIENDB`kylin-nm/res/w/wifi6-none.png0000644000175000017500000000134214205345374014771 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxWNA8)qa#] GHI)rʔ|eʔ|%%e$D(H@q Kƅc( zkώt3o޾ xZO?p֍Ͼ/fg4dq]dydœį ZPeI 2($xӓSz*T*\x 0{"ceF*UlWR psT- >JPцQCbg@3L_O-.vc <]jQ= 5$-ԐE6ܞb'3%L3N}`e ".:)ldV)hȴ$F1h*۶GtNUe?FuV3K'\ډɷ8L]Q}R{ 申a!אR?)5@"'H|V#@u>l V!l׬,I.wC҄mv<`WdLWw\;>gτ*殝gڳy@W$*S0\a#s5gΝx\ĄLnp8U|PfRI+h&*}'q '΅D ײT # 0IENDB`kylin-nm/res/w/wifi6+-full-pwd.png0000644000175000017500000000142014205345374015634 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxWr@3a5 TUVVUaeI  BC̨ۙ$KU:%ݽwQ8{oH`SX~ >W `v]53hH6쉲$`(d$5-l'$Zq` kk@Em#^BO\yxmtq.?bDġ!3-I.?yͮciߤZX;!vϴG6o `E[rϮz("/\ ?:3!NT G~PWwNěxVQ"|kb\ W9|ݭČLk~y^r^F)yF |3 WƁ‚ge\#>{r0T2fϣza\Ci@>k $'H|-w1s"&9rl ;R,7MI\x?uPHH|_QI )2āydCGطkYXY IU/}wEzOZJ%P.6+/$CIdkYi(_Yr(?"$^:W$Jp,iN7(*!ɉh?%`^,ltw*IENDB`kylin-nm/res/w/wifi6+-none.png0000644000175000017500000000136714205345374015053 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxVjA3>PTHKqE*.]gtOpR4 Q lP ŐMxkF;O!μy;3(?xу+&:#`#O zGct= L\9 H,p"Jp._{C}+z6J/p,HF^G86ublI_`orK&jq8 VHby[ʹl`sTcʝR髐ZRa'O@ؽ$c/I'w-K @[} tHͅĒ ٟ_U B2S.t=8V 1pVV $**E >bBut'̭ >a^rAQٲulSS9PUefJ8Llr} &\f3yu\Jq4!/o ǜIZN%8ɴ NA`Pt; 9JOY9;8T;tk;]Ɂ }2 \oсe$\DK۳|eN8 Ix*()^0_βa){ߩrڇJ<F^x`%9IIENDB`kylin-nm/res/w/wifi6+-high.png0000644000175000017500000000142314205345374015024 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxV=oADRKHc@l $*t0]ttK.Mt(rH! \%"¼Fއχhywg޼sr7Aލ}Ycx,͖o0kat4 R? ,cD.3 8~q M)*=+Tι=gy S" {Ta$3؛^ 8|Id6b;vsYőX 6j Cn pv9[:ȏg'. 9>lML7X/H׀\2M=bE8 D]O=1K'3lRm>/Y}0A2oMMڛ`@py^2dti6[1رI FW3*Iz8347Yyn[λ̩C̛s;l6ց*KD5Ăɐ$;i9OT۞sD̚h^Zj'Kԯǯ3z ZtVp>5# >u%g yYvLхE۵KAU3r(5#yO8bjb8, 귪-oo"pEx.(#Ք\/co, mt幣( w{\=zt8:kcIENDB`kylin-nm/res/w/wifi-high-pwd.png0000644000175000017500000000125214205345374015453 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<LIDATxVN*Qe 4M!AX;; ?x٩_v 0$6 /l2w᮫aػs=3s!~_ǩû>fY 1./.Ns@'<\xJ&A* yw%8ȅxtYgJ&=:؈7C Ĺsd--8sոB~ JWw*qKhp@<9r6" |){+)R!z pX=F"|= vubMxJq |p )e^甹mY͘}Zq-K,ƓdL""'ߘ'JB!^%g㵁m95c~W1NQe-S*e8dL㉒EU)k1/!ȏ8vI%jbg=SQF,U,%)xn%MD2TԐ؃)C#,>aѷ+QJ@p$|=o EN 2|?k3YX# DGIWtV$"c( [DR:cS{x 9xBc/1:)&۠c_Ũek#VS*I{髓n܏Qs$H5D&{'|z 1kϵB HtHҝ8W BsWoFCDqF :g:g&kl-˾PQphIENDB`kylin-nm/res/w/wifi6-medium.png0000644000175000017500000000137514205345374015320 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxWjP %mPjP; IBQ[3fL>![&[_ЌK]J!CݡtP ^4xH -u-G,qA=wywnxͷ2.`(U5 \?~-ud3. y\ '4АvOl6gNןc͙U言1?zN1Y[(bܫ 6 -Ωںe$o}쵺=V"LY^+; QWY-Ȑ"y뽓 4 /#"H5渵9(,!Kև$(g3/"آmpe$oمVXTF5j@*P{` 2Stϳxl E9wQpms[,ZƑ{cISv\BG*[:q"J&xdJ_?#Ñ"mYk#"IENDB`kylin-nm/res/w/wifi-full.png0000644000175000017500000000105514205345374014707 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxVQ@ L8$Tܸܸ%  b* ``f3;Besf4Ļ'=o /^mۑg<* iL>A.@:0~MGeN Hs%q@u<|֌$=3+TJژu)`phx+ΰ0wb0:lpe%Or]QU AUl \cF`.V8qID9:%Kk 0k[1⿕C'PR6\Th C0*3a̓*"HJ‹ NSzD+t7K-TN! ڀd{bQqYwvW Sf $ +ȟ׆)d5T35Rwqp &Ifꨀ>)ǂN2Y[¸(gw5Cf6QSsuUs=65D]]8ɨ>VR.W}߿|,HċOt1|F({Vᙵ0HXU>QkU;٣O (ԁ[!p4~F ;Zey%Xz 4ؼFC+PD'h0Z߇&8W~W7Kz/1ֻ\k'\G B+./ol&,"WQJ Yp}E-$"P;ǙCWEµ(E QZ'P2`MV7J1;aOjFn mb3fF.KGl wIENDB`kylin-nm/res/w/wifi-none.png0000644000175000017500000000106514205345374014705 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxVn@4.pa pHPP$M OOIC)R@qn\@ 7JctZ~@4|sk{^ϫWw?!p z65&R +#+I| ~K%y@$$Α8gU;ʽٺ1k"kY: 0ȣCj1m/ڒ户U$\dkH$RCbg'+l~`3=Pe*Ho\jlD"_ <+Qvkր;&,@Hmq@Lb~E"p|@KfJ<1fy?|HeY'pO`HfduTĘӺ hHDwyƼBhgw5cV6UŝyŬN'k6DvxѮ1ӪUtL<O%gd"0dv:L;{mu{%|j`l,raa,Kv i)'F`tѬ¶VhL@' B%&U҆ Z97|epcZdž*x9Y(́[8!:5@Ѝh rϨk^@3QNȨ#y&ͤ8"S1vy$a&ɜPxm7>1T"*m({ԙe}b Af턣7:'eԣ.Sպ Ϛ w̚_f:>~I44&ް3g*w@*avJ xH%w . . EHd*V^%%LٮqUNU*: .\t\;`9yNJW_y7pD}+mCu)V]8y^.u9,ŦUq jI'txg1U5 ʲT/ k#:B_؋IENDB`kylin-nm/res/w/wifi6-low-pwd.png0000644000175000017500000000144414205345374015426 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxW1o`Q#A$RD@+u RGFƲ12? ?cvA:J)F2%]p=>1Qa'=9ݽ{߻K7f.7kԁ0|~W&m*7&@RD&,HxVTY')\@rIȓQx֩T39`'E 6Nxu1O7[}S$dHdv;q"\${FHG|S}jao "?8®HGNcs-2`> &nSMb:@- r d {f‘o0 नL̆c,K  Wѝd>[[<¸(@wmVe60uU6YN[78L]Q}P&.۔saPhHċOC^~V !'H|\;1$B@†.x4gz3zrhHe4'zO%jcb'>lRv5]r.v7!\s?W<@IRK<0{~}lkFavj d'9E vNd'gӥ%sS=Q)H\خklwvx@׎k-Jj=5f\u--@_.QOPY,s`]n 'AkiI7^+<1 <3>2+Lx:-*2IENDB`kylin-nm/res/w/wifi6-high.png0000644000175000017500000000137514205345374014757 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxWnA!GB)%St@l $*ta:8@::LGIt4HGD@ 4E,.%7m4Lwg;&+=ٷ;͛={ef܌<o:pw̔9p.^4~-,@͘<1A=`X]e! g } 4ݗ6ѩX+AzX8%m[uH8AѥN6Y amF!ktnܐ' R =PUH9cmY[:N'g s`K&@2Sm8= m l铓ww}wzպZycpus 8?l|_6,q?'mP]Re  K;)>YgJ5ڟIN;0IjTm^IozN&k 8tV*m5wUpy /YݠUB&"}R M*|v@=L1 yQ׼;"=eXHHGDS/]2S:mj;uT2wqp7 |'H殚&}[@D=6dTFwyZg RW1== k <2olFfrꮩ*c$_ǟ!_5Dpql'2J8ɘ+}v} 42RKC2 njS=o jt̀} 7x@>|٧b3!`x 4Ü`A{w^Gm R\VEߥDȺk(l-}0MX/%I.QF_#~WDZ2TS&l_U|RIx1R)ݦfTu$ ;R/M`?eɝaIENDB`kylin-nm/res/s/0000755000175000017500000000000014205345374012276 5ustar fengfengkylin-nm/res/s/conning-a/0000755000175000017500000000000014205345374014147 5ustar fengfengkylin-nm/res/s/conning-a/8.png0000644000175000017500000000620114205345374015023 0ustar fengfengPNG  IHDR pHYs   MiCCPPhotoshop ICC profilexڝSwX>eVBl"#Ya@Ņ VHUĂ H(gAZU\8ܧ}zy&j9R<:OHɽH gyx~t?op.$P&W " R.TSd ly|B" I>ةآ(G$@`UR,@".Y2GvX@`B, 8C L0ҿ_pH˕͗K3w!lBa)f "#HL 8?flŢko">!N_puk[Vh]3 Z zy8@P< %b0>3o~@zq@qanvRB1n#Dž)4\,XP"MyRD!ɕ2 w ONl~Xv@~- g42y@+͗\LD*A aD@ $<B AT:18 \p` Aa!:b""aH4 Q"rBj]H#-r9\@ 2G1Qu@Ơst4]k=Kut}c1fa\E`X&cX5V5cX7va$^lGXLXC%#W 1'"O%zxb:XF&!!%^'_H$ɒN !%2I IkHH-S>iL&m O:ňL $RJ5e?2BQͩ:ZImvP/S4u%͛Cˤ-Кigih/t ݃EЗkw Hb(k{/LӗT02goUX**|:V~TUsU?y TU^V}FUP թU6RwRPQ__c FHTc!2eXBrV,kMb[Lvv/{LSCsfffqƱ9ٜJ! {--?-jf~7zھbrup@,:m:u 6Qu>cy Gm7046l18c̐ckihhI'&g5x>fob4ekVyVV׬I\,mWlPW :˶vm))Sn1 9a%m;t;|rtuvlp4éĩWggs5KvSmnz˕ҵܭm=}M.]=AXq㝧/^v^Y^O&0m[{`:>=e>>z"=#~~~;yN`k5/ >B Yroc3g,Z0&L~oL̶Gli})*2.QStqt,֬Yg񏩌;jrvgjlRlc웸xEt$ =sl3Ttcܢ˞w|/%ҟ3 cHRMz%u0`:o_FIDATxڌ=kTQnb/P"`V!(6vFE{ha0DXPcl<=g=w{sfۨKk` t_"uu:kި#(JNWq5`&m$;YRcQuwRՁTgA';tD:z{juk,?;dlR6+GiR6O9<֨ Bѷ_X&Lt﨧vioI6]6p.n"ODOsiu #u_p&~ /SVV OG_dY,<))fO̅pr x8l֫9#\ riUfz)*=!ޟ嚽; eVBl"#Ya@Ņ VHUĂ H(gAZU\8ܧ}zy&j9R<:OHɽH gyx~t?op.$P&W " R.TSd ly|B" I>ةآ(G$@`UR,@".Y2GvX@`B, 8C L0ҿ_pH˕͗K3w!lBa)f "#HL 8?flŢko">!N_puk[Vh]3 Z zy8@P< %b0>3o~@zq@qanvRB1n#Dž)4\,XP"MyRD!ɕ2 w ONl~Xv@~- g42y@+͗\LD*A aD@ $<B AT:18 \p` Aa!:b""aH4 Q"rBj]H#-r9\@ 2G1Qu@Ơst4]k=Kut}c1fa\E`X&cX5V5cX7va$^lGXLXC%#W 1'"O%zxb:XF&!!%^'_H$ɒN !%2I IkHH-S>iL&m O:ňL $RJ5e?2BQͩ:ZImvP/S4u%͛Cˤ-Кigih/t ݃EЗkw Hb(k{/LӗT02goUX**|:V~TUsU?y TU^V}FUP թU6RwRPQ__c FHTc!2eXBrV,kMb[Lvv/{LSCsfffqƱ9ٜJ! {--?-jf~7zھbrup@,:m:u 6Qu>cy Gm7046l18c̐ckihhI'&g5x>fob4ekVyVV׬I\,mWlPW :˶vm))Sn1 9a%m;t;|rtuvlp4éĩWggs5KvSmnz˕ҵܭm=}M.]=AXq㝧/^v^Y^O&0m[{`:>=e>>z"=#~~~;yN`k5/ >B Yroc3g,Z0&L~oL̶Gli})*2.QStqt,֬Yg񏩌;jrvgjlRlc웸xEt$ =sl3Ttcܢ˞w|/%ҟ3 cHRMz%u0`:o_FIDATxڬԻjQo&1XB "X j%/tJ, IB,#1$ʸlvwgƘ}:k_[IA>a|ChȻLt+xX-5<sX$^XIC𩩰EԶ|UN]~?Шr pJ}'*ǫ-jHc:ד1{U.m][6>U8QLicIn'Hs ^IENDB`kylin-nm/res/s/conning-a/4.png0000644000175000017500000000615414205345374015026 0ustar fengfengPNG  IHDR pHYs   MiCCPPhotoshop ICC profilexڝSwX>eVBl"#Ya@Ņ VHUĂ H(gAZU\8ܧ}zy&j9R<:OHɽH gyx~t?op.$P&W " R.TSd ly|B" I>ةآ(G$@`UR,@".Y2GvX@`B, 8C L0ҿ_pH˕͗K3w!lBa)f "#HL 8?flŢko">!N_puk[Vh]3 Z zy8@P< %b0>3o~@zq@qanvRB1n#Dž)4\,XP"MyRD!ɕ2 w ONl~Xv@~- g42y@+͗\LD*A aD@ $<B AT:18 \p` Aa!:b""aH4 Q"rBj]H#-r9\@ 2G1Qu@Ơst4]k=Kut}c1fa\E`X&cX5V5cX7va$^lGXLXC%#W 1'"O%zxb:XF&!!%^'_H$ɒN !%2I IkHH-S>iL&m O:ňL $RJ5e?2BQͩ:ZImvP/S4u%͛Cˤ-Кigih/t ݃EЗkw Hb(k{/LӗT02goUX**|:V~TUsU?y TU^V}FUP թU6RwRPQ__c FHTc!2eXBrV,kMb[Lvv/{LSCsfffqƱ9ٜJ! {--?-jf~7zھbrup@,:m:u 6Qu>cy Gm7046l18c̐ckihhI'&g5x>fob4ekVyVV׬I\,mWlPW :˶vm))Sn1 9a%m;t;|rtuvlp4éĩWggs5KvSmnz˕ҵܭm=}M.]=AXq㝧/^v^Y^O&0m[{`:>=e>>z"=#~~~;yN`k5/ >B Yroc3g,Z0&L~oL̶Gli})*2.QStqt,֬Yg񏩌;jrvgjlRlc웸xEt$ =sl3Ttcܢ˞w|/%ҟ3 cHRMz%u0`:o_FIDATxڌ=/DQAP[hUJQ QV4[눂% CNsdrs=3sf:IUn3̑RڑIY' T㧱OXVPJ\HBv0 xv.B~ZT`nku6`= eIENDB`kylin-nm/res/s/conning-a/2.png0000644000175000017500000000614214205345374015021 0ustar fengfengPNG  IHDR pHYs   MiCCPPhotoshop ICC profilexڝSwX>eVBl"#Ya@Ņ VHUĂ H(gAZU\8ܧ}zy&j9R<:OHɽH gyx~t?op.$P&W " R.TSd ly|B" I>ةآ(G$@`UR,@".Y2GvX@`B, 8C L0ҿ_pH˕͗K3w!lBa)f "#HL 8?flŢko">!N_puk[Vh]3 Z zy8@P< %b0>3o~@zq@qanvRB1n#Dž)4\,XP"MyRD!ɕ2 w ONl~Xv@~- g42y@+͗\LD*A aD@ $<B AT:18 \p` Aa!:b""aH4 Q"rBj]H#-r9\@ 2G1Qu@Ơst4]k=Kut}c1fa\E`X&cX5V5cX7va$^lGXLXC%#W 1'"O%zxb:XF&!!%^'_H$ɒN !%2I IkHH-S>iL&m O:ňL $RJ5e?2BQͩ:ZImvP/S4u%͛Cˤ-Кigih/t ݃EЗkw Hb(k{/LӗT02goUX**|:V~TUsU?y TU^V}FUP թU6RwRPQ__c FHTc!2eXBrV,kMb[Lvv/{LSCsfffqƱ9ٜJ! {--?-jf~7zھbrup@,:m:u 6Qu>cy Gm7046l18c̐ckihhI'&g5x>fob4ekVyVV׬I\,mWlPW :˶vm))Sn1 9a%m;t;|rtuvlp4éĩWggs5KvSmnz˕ҵܭm=}M.]=AXq㝧/^v^Y^O&0m[{`:>=e>>z"=#~~~;yN`k5/ >B Yroc3g,Z0&L~oL̶Gli})*2.QStqt,֬Yg񏩌;jrvgjlRlc웸xEt$ =sl3Ttcܢ˞w|/%ҟ3 cHRMz%u0`:o_FIDATxڬ=kQgw&"n v`6Vb'ZX*#V ~Tb PlF`=6yY.Ł[;s9gHbd9ɓ$Θ` 1Ln,暀VU2.7?p7/_Zn+v\O($wlPxļT濋-S xeSYY]YwLouy/;w{bn8_\§ t߶'%)qUY|ZRUdf8]X8X>b Po'{oB؟UݲUk≝Rr8m~E(yIENDB`kylin-nm/res/s/conning-a/5.png0000644000175000017500000000054314205345374015023 0ustar fengfengPNG  IHDR *IDAT8JAK L,$`! y{%J!l|k A+;k  -h!/ sy{!? w3fHоו.Ѐ:Z} ĩ l[o 8.'Vc`j}%# x agM97k&_cЃ:`$rI#IHnYXR/֛:  ݵ*UOǡXf+_L$=J4R^Z8]mpfQ<aaWsWSuKv4]C tK<{gwp|R^( 020%7q $g&LDpe#OUC0✣LHA5`/Pa( 7(]_Dp `׏1L=ngfЭlwJ9K+6,X Xè[/PaN߷R]wR -lxޒ6 "zV~є"*""" CK*;p6?r#IENDB`kylin-nm/res/s/conning-s/0000755000175000017500000000000014205345374014171 5ustar fengfengkylin-nm/res/s/conning-s/8.png0000644000175000017500000000123014205345374015042 0ustar fengfengPNG  IHDR szz pHYs%%IR$JIDATXW-S@}dd2PBP(TU Uiw2`ޖKKMZL\.ٷ{q{'D'gz2%ȗrO^$pjʟ(7l-6Ųwr_ʼ | 6V?,jF.,|ڨ*!EU<1[7>?ȗ`or܏QW~|4C$c29U[}^uAX?efTXJ_?i ϬX1:t_]+0uށKDsKm ʇ7/ l?Pqu]vhrwޞ Pl]:{/XpKQb X ظ X:$2'GT@>E)AAu"`J1䲣EqRk"Zn|+͂}6wW' PvV}½ϸIͷJ'YNum ycqMt-`AҶA1=l-t=մ>6C-v0*|iރ8d iUzN{nq4XdlLMSZî /}Kqt@bBY=ZȪv =O㿠IENDB`kylin-nm/res/s/conning-s/9.png0000644000175000017500000000114514205345374015050 0ustar fengfengPNG  IHDR szz pHYs%%IR$IDATX͗S@GeO=xP(TU / S|dLYmgI?HCÛdoovoFq @? 8y5 b]j,5g鬖q^8ۙΒߊ w,leg4YZl/:\ۭ @5oa@ >*m:40??^3m]y~CNW96$f=•p8sc! 8Z6xMvU0T-TdE24;gpYz 3ncޱt4 PV3eJ=eF# P[cmKg_ \ooICO;Sq-7[Xvk.cֹ+xAY:qݗ%PufC빸|vl=RIENDB`kylin-nm/res/s/conning-s/6.png0000644000175000017500000000124114205345374015042 0ustar fengfengPNG  IHDR szz pHYs%%IR$SIDATXW-P` }ps03BPSSSS)ۨm-|}ۇGr@Ǐ:I0스!Y{l!e7aZd1CH m/k?Y^AafbCb3Aݩj+&ic$k4 ߣ Q,atk8!`Rou7GL<5+723FIENDB`kylin-nm/res/s/conning-s/11.png0000644000175000017500000000120614205345374015117 0ustar fengfengPNG  IHDR szz pHYs%%IR$8IDATXWnA}GUU!_*> BꋧWU AU5Cޒz) Y\nw罝ݝM|Pp G#30Ϧ!pg+gI8X~Y-DӣX ଟ\35^5x4MÃHs`{>mclGZx !XmDYx\^- ;P'AwiT;,\VN7M.#";YR8/4l+x ``I\1 I&lRI z4v^3iu:".2m:ő rCf-2J11>C Υ>%ԒwB/9=R*|Og6S %͹F{@j9EжIg@krgUKǥUkv5!k7 D5U M-ӺzQ zSf"娫فBf}%\"G=WIENDB`kylin-nm/res/s/conning-s/12.png0000644000175000017500000000115714205345374015125 0ustar fengfengPNG  IHDR szz pHYs%%IR$!IDATXW-oA$BBP5)(?'avAW-R1A/p0[?^X;sR=8(D ~BK/X iDQu:Tf:)ݴ ( )|{S '|hR nioGn>\$kJv,IknLRkG4Re{qe?nri*6?WSe?s*^wI>s._Zr1J,B$i }=煨"R_|KaZMIENDB`kylin-nm/res/s/conning-s/3.png0000644000175000017500000000125614205345374015045 0ustar fengfengPNG  IHDR szz pHYs%%IR$`IDATX͗!p0_i(,\PHJT2򢡱񡡢$($!|6 S׳%}{$mbdIOGT?0p`Th0K!Vn?p` KN~/+T{K΀ϾsՈ\4Jh]VRP6/Yzg7i?C,}ȳtn[qTΙnQQ BsB li8(ȳ[(Mĩ@OHBAv @vo1HͮNKi9?gM8ZrYn< װ_._(xLp{7ucýڒ:1j\:8ȯ2:h؊Q1h @Zf80ɴ%2j04*z). @\0F*Gfk@"I忑N, ,]5}p?Tb4Zԣ%K cӳ!$tư BI(T,e9J[!IŪO)BZ){Fٳu7c. >W%f{9-9Y *svRIENDB`kylin-nm/res/s/conning-s/4.png0000644000175000017500000000140114205345374015036 0ustar fengfengPNG  IHDR szz pHYs%%IR$IDATXW!o@ICg ,,Qd4 ,h#CCEAAAA#  iHJYPJj[ jIq'E}{ޡ$v9i2+boGaʀl'T yF UDT87c4 ( 9=cKc\?Mg_~V`~o#MeƸs"}1}Hdh}6է }Ea Ú3"Ƕx>'aȈߒsK= k^S.y$K澿Ck(̰>\s)]_}[ }F̘Gڡ?t-(Džp;Nىhnޭrii[^#~6,$w^KJq7ruz7iI\'H R>Ig _ٻAńRReݜlqۺM;^||]c܎1Gcծs2%MRޫY5 Q\UbeRGiĨlf %Q IENDB`kylin-nm/res/s/conning-s/2.png0000644000175000017500000000130514205345374015037 0ustar fengfengPNG  IHDR szz pHYs%%IR$wIDATXW!oPJE(**ȆJ  E% *iPIglKEEE'Ǫ_l/'YMwww~^>wqg`GᓋJ@}0t%K\8*>*Vs9WɵyVDJ3RJOt7Qc٫"v8 + 0> O(u \+pL!ID`0btO\7 $| +#)V1L(H}>wlY<+5}ELsE&"!}firF$41 fA ,Md$~pcPF2xB7!1] SQsJxD݇=v"fiCe4"FK+?=ـ϶0g*wy 䅭䱂U!jZ6X %wرZ GkoT OtqgFxdHCOe)>PI-xq6![Lz#)YAK:I0cM̛_\Oz˕Oefb[-GVHco;+>Ay~vTsG'~_{`C9%gRã5?ݵ.meCE~ ҷh <~}aaHRƎ8jXj@MC%~!>+^SȇtWS&.9Lb/aDQːI5F7 AEC{ N~dVO t8F#ub. Qopo+w1QJNj6#yYH^5˹!ޑz 31~VpIENDB`kylin-nm/res/s/conning-s/5.png0000644000175000017500000000142314205345374015043 0ustar fengfengPNG  IHDR szz pHYs%%IR$IDATXWr@}UfZbp3{ݾۻWx!z 8eB jΔGw-T]'8 RJ {=c. t&P7d@koEރ(Q8TJH%ɶRzGuXb@@M<`yZkFoܞī4p1GW%6H$ h6w'+egX+8'$Dfe슓EHbʸhqOsEsx>tL(1+{"1 ~E]Y BE>v%!Zq¾׏Vn.y]ܥ̣Z$nsDr~d[ |,hLTJO*#]Tq.yRhXEK3/z,#vE'VRJUJK$AKuysˤ9hѳ ̐m٫˵g`/\8>U(AlVIENDB`kylin-nm/res/s/conning-s/1x/9.png0000644000175000017500000000054214205345374015400 0ustar fengfengPNG  IHDRa pHYs  ~IDAT8/nAƿʊ7`AHՠ8@ UBz*|sf2 h>&I_ɼ - Gc kiM ~wI| GlcKyz|Ts/r EWr7-:Uk] Jn:9?@YSwJ@RaDL9f6sa1d Ex'3ckri8p˔S`;)<+ߖas0u[g%j.x.GPIENDB`kylin-nm/res/s/conning-s/1x/6.png0000644000175000017500000000062614205345374015400 0ustar fengfengPNG  IHDRa pHYs  ~HIDAT8SN@}$ĬMs~)0*ԩ\GqsiZTQm0Kgms&iҝy䍏IQ[sԵ\&bf"ke۟0O<H<\"bUY|9䕂x̱ǕrT^Lԯ&n]lw tmq"f ^ļuUo`VĜ8th '@PforΣ@FDԞx0 .hdIkDa&#AY },D2MvWmģZv4;c]ãnU>IENDB`kylin-nm/res/s/conning-s/1x/11.png0000644000175000017500000000053114205345374015447 0ustar fengfengPNG  IHDRa pHYs  ~ IDAT81N@EźnWK@E WJ*U*NOBHH+X"FZg猽!w=5ڦH>]<)7F]쒀ȏXg C9D:""W@^mC- U_*p mtˮm|c`h<`dy()7yqUjk"dUm/˹jnU3MnfY* |4]h8IENDB`kylin-nm/res/s/conning-s/1x/12.png0000644000175000017500000000055414205345374015455 0ustar fengfengPNG  IHDRa pHYs  ~IDAT8SnA=,qf2/ Uz0(5UU*Qͮ 5I.f&C7ι2~z"#"u~]l"=G%ZE~LLu$-sADie*bG틘9mYߩM];$xD̋94uK!1^Pg~CfU )QSW":f'"I2RLM?bIJוlLE̘gY]1?gytSINIENDB`kylin-nm/res/s/conning-s/1x/3.png0000644000175000017500000000055714205345374015400 0ustar fengfengPNG  IHDRa pHYs  ~!IDAT8SN@= Sqd ~P(ZUYuU s{fvIENDB`kylin-nm/res/s/conning-s/1x/4.png0000644000175000017500000000062514205345374015375 0ustar fengfengPNG  IHDRa pHYs  ~GIDAT8NP?%ĭkӠfSS5@f,7)&U(rҕflI|==td@[ VټM Tk` $w@ $ N]Y1{$J@y_{gu34y͑R؁1}?*/cK&_O[&v{L v%[ϒ2@6b&M0NN 4r;6QI{:gns @~4k^BbLXWeYEmL8FUYiZu5ڷ};u/vwcIENDB`kylin-nm/res/s/conning-s/1x/2.png0000644000175000017500000000057014205345374015372 0ustar fengfengPNG  IHDRa pHYs  ~*IDAT8S-OA}YlUU`P SPrsݤy܅\^yf=XnkPXUYg5 O]pB*WufZ n][[&U9BBG'Ű1F)b!bܓ?1O\Lt,KhN><hN9M&bq}D;܉g瞪dZ$㏈qTS /D 'q*bD+ My)I@\ysz>~7mOIENDB`kylin-nm/res/s/conning-s/1x/10.png0000644000175000017500000000054314205345374015451 0ustar fengfengPNG  IHDRa pHYs  ~IDAT8=NP? s.Qt4TTTt4TT8@@OG \#heLd'[^μF1glb L ù9p ܸK]m_Ww[PWe>L\U  aidƙIM E28IyY+00Gށ?-7^Ȯ <.NK+<>U' Vn]ĽO;w-~qkfkN_96:oIV3вg{wdZee E۪aLu}%0q뜯qc>Vc>Y ui1RIENDB`kylin-nm/res/s/conning-s/1x/7.png0000644000175000017500000000057514205345374015404 0ustar fengfengPNG  IHDRa pHYs  ~/IDAT8N@E__@ZZg_W$(K)ͦr;w^:ѓ+p]#?{'1. M،nl]uvjtr_nMZ5v"u`puq,|zIDATXW!SA8InEEEI`2L&:$$ $ vdf!|ofcwݷmU1563~</lfHV9-Y@'G+L5/W8JIT@Yy#nr$oTqij|#@d<12(rCGD$Bb6>ʹ9ki$)w2.ϦAPSz]T+vx˸f`EқxDܨ+|̺,I Q0*x\{.]WZۅJXĈkA%3*i.0 Eu6tD‰  O1[ݻ$aN40C%ԟMwN u"ewywϴ;rbFu'iTXtXML:com.adobe.xmp nbbKGD pHYs  tIME 2dD mIDATx{\U?sg:nkE(Q V Q)>i">A%>(&FW$L1 J]S,Vlk-.}M{w&'fڝ;=(O;H´x xSAH^\^%%:=}#"Ol3`< zF؀yj`TКX ]N7C[(QNٜ1e)K"wXn cRh,_ _%uGw#-ڗ\"|UʄfA>Gj lNl> 'u?9qOi䫤pc\;a |ݚU;ǀ d|` ꕾM>%ݽS#5~߰ xla3~H'WEXj|T~VࠇqTπTvh !W1ȿVLxtV_6\+OB xH;ܨ)?* 6*I獇H, 1+sql|BuFc pq[!>}GNݿ&"\"ƌ\7mEWz3W.1t!CA3tG[Lmu:A.g=~Y>ZH)RAdFUyÊ0+ pU5r=Gb4᷺n$ 0"`$/3EߓRg`=NZ08'KqI m $.[qO­޶L5JH|ZqG$/ԓ"N NU10H [V"wp6_ L n<> H?䵸F!k}Xo[EWzԊG2߯[;܎ۇyjۘ;Z!;!W^[]]a#q8՟".Ь%ϑefD WQ[!| ?bSanCz~`} YV@() l f|rd7zm)G"zf]4uN,u$8U- hb~?VqoĸEB+nmѨwSP3m،{9)zL*6j}Ϝj]w5V!/rkW6'U' ہ.D3l;L@.vbZT9%-#=ҫE& ._%z7m" 4"#?ʋ`|7$g>" ?X=? :C7wԣ7PSE }V-$PHpF 'NIENDB`kylin-nm/res/s/conning-b/9.png0000644000175000017500000001727314205345374015040 0ustar fengfengPNG  IHDR``w8zTXtRaw profile type exifx[& YE$r0 v{\rN%/jS,dI'0s?pQsĕJ*\1x^e%<ý F9^rz჎Wyk2D}9HS q\ܞC=.CRܡ\w:^,u#aBwgnQѓ(HHV$c zIc޳ޒ[./Z.vώ厈_LJ=svs_WSFFUQ;0)ZF3܊V<؀FTfD*M{lbԒn8hI.GXh-_#NPe1+?lgœm߹B\a,rмN]STAPwXq8jK6gb<@)!@$>@T#HN"8ocuY9ln2)R+%EXrPJԃYrʚsjbԲ.\={Z@-XRJ*UتЯ|ȑ=a RӖ5o]:uAaiÆ2DMiӦ2MM jtQMjM `0A8 8",:ċb cS(#H]lBE  I7/r-7'ra/w;6sFNecDoǏ!Ć8L4oviCCPICC profilex}=H@_[KT:A!C "Z"TB&~A$Qp-8XupqU?@ܜ]%1ݽ;߬2T22˯ WEJD1 u_<ܟO) ijL7, MKOceI!>'3ď\]~\r3cF63O#J],w1+*q\Q5\V8oqVu־'a,sRXDQGUXHЪb"CI%FԠBr[89&E@Ŷ?.jmN3pu&0Izŏ6pq=rx%CrM7[w K]oC`Dwv?r'iTXtXML:com.adobe.xmp z 7"bKGD pHYs  tIME9`5 IDATxilW3ٮ$4@hY(ЅPQR"D)BE EM -BU KղTCw _ZhC4,]>M/,K؊g=s9aHF: @c Q ,z"u$^">N$9FP9 :Zp7㲒( P;<)Pk;xzWIoΑ]ݠ/9 >"S=pˍ3DZ/n'F[LzgW3O\K%䭸&BQwp pFLucv |x& p uڧ|՘f'/Ҩxd~ &N*I{^ [|Z I)..M~JDI}-M̏f4 zS K9.^P46Z|8<۔Go7+л x=r~ajX!p9Gx\n ?@܌M/7|@n( ]BO'(?ЋNߞYC-M'`?P,d4N qC%dk  8ة}Fؐ@o΁Qz>dhJ <.ܪ!yFح5/?/AϾC,ZP­^\GP p 5K궎-ng?Sq\3,#',GԉVߙ:I>QpcZ|ngFߊ"{hP&"`}#<cbXcɳ"`D z'e!6a`YMy>9tdM%>G{xo#ESB+Sv5cu2`fڌͣZm25n{a ޼K=}yTysCV̧ 'INef. ]ԁ펴$N&ݠ\`XҞx#tnpV$fH OU:TJ`0+fe#ކ۔U5bc7j2ނPZ4\,I;mk!)/S и^le7 "mwM!`;n+ָWl #*3ᗤY^en* W6[∬X/WW+^pZ'ʥvOoczDņ<8 k/a+|<Ш}opEzi%#lƕFXيKYQFMhdǺZe9y\ہ"M$כb3Z,/*QYpBSf ˕)IͪǕݏ27dnlU \,q=ΑPh򻨕Aݚu)hUA (`l\i#Ӹ1~~^v"%Sv{[n!v5qk #]ɏjߧ1jߊ+ۦ;CJNiECv5Q$MŗӳliQ!5rB4eiM(P)БY[ЙU4G$lO1jn,Ͱ9:lYd_^hLSt^kQn]dzj V8}YvlմL~?c!.a~~f>exoM rgcq?g2{;Fz^cN\|йK#{A;A 흵& 0n/֛!)I"2YU&I' [żxcC.[:OKi9E1Jf*tdbm#K4#躠k?vxsPZKb)IENDB`kylin-nm/res/s/conning-b/6.png0000644000175000017500000001725214205345374015032 0ustar fengfengPNG  IHDR``w8zTXtRaw profile type exifx[& YE$r0 v{\rN%/jS,dI'0s?pQsĕJ*\1x^e%<ý F9^rz჎Wyk2D}9HS q\ܞC=.CRܡ\w:^,u#aBwgnQѓ(HPa ys^߳sˋV orc#RyOՔ|UN6=@@e bn456 Q!(QJ5xadnd.ƅ8h4٤H#@w,s'2iaζRD\!.^u0C @h^t'.~P ;͎8MJ_%@O1[Rߊ`H@ fوGY @$'G71ںyq6b7~,9jhRլh͒S֜uUK̭Xu݋EpjŊRjPV~Ct;(Gm(ܬy+vqLܭ{/ 'HCG6|Q'jmLSg6}YojooPoRKnj Zlj.f Ɖ@4/f)%^XBAb:-b@N}%nA? A.ݷܾC߹p4 vt*{#;~ } } } } } } '6 `DbFiCCPICC profilex}=HPOSKT:ءCdATQP VhФ%Iqq\ ,V\uup77'E)" q=Vif8閑I%\~U "B!&3>'Iix=Q%xwߟ5LDYV7, My8ʲJ|N `vbKGD pHYs  tIME)OdG" |IDATx{e3{ݶE\mjmc"j6`!PFhh41ĀFDER $4p1JQjk+ݕn]v=?gifO2ӝy7ARS@.cG;J,0 <" :rx'Q)f^ =IL:OgP&tE楓fj\2d!Ld3E% ࠅ 2pӎD@pBm}+auϙ&].yi~ 0ڎ_h^9Uq*ykf}JN64cj[[~ݑ"C[HF]& >'L)fQ'cAm)p?{62Th{gQa*|&wbobGI6z$d\/[/ep.4\pxg$L*Qk<Ɠ/ޢ֋DZvq\:Fj5[ri~U[cvSZ\=]ɑe<> FcS4HpVf/MRsV `;#LNnV{wIUE@ $1H[wBmqR(HGm xm'pK RJ= qLɘB˭uz=?6B:z e_iZ Le29gH/hB?\ KK SM@Ai5^|F#N ^S){'4&2^!'S1>&ǿW$5nQ$ w%Ο|ZR~d=HV% qUAeہ/5!E%|k">h 9fHxrMr҉b۟lTa0~ܠ$n3pBq[Ө;WW.ޥ2~:/L+3?TԳ p*;sP{2ݝRql*urU^ xqW|e2hMkcη!JiyX`Uv^[%Bx7װ#g:Jο$x7MOTw]z'}V̔42J:2a{Xʓ"&,}EmmiO lA#r^*4" 4@r8%Y^aqMF&bEqS}bWvQ1!br^xUX F|يn&jeeR^atο"94nE/UbEl0&f;p3`5fmE*Y0cep!n~5!~nx p^g);@p5eCⲤ+qK_wX ?pS:<:5I\'ΉQ)l{u~[<~/n ܪ_^k*)fUS9 \\¶0fh7 uKbx(~&@t^&t7l^cU16ϕX#&\Sգ)Gݰ-jr:ic2;1J7[31c >zg+or~i\'+غ %)gG܈'vЄgLtW@q ? P( vb< fpU:E@/NĿWt ̲=5#̒"z=}~E2jiOIhrfs2EVbN5K|Rm~j"vbW{*xb70 =bKGD pHYs  tIME7* IDATxylW?;^ql'4i !jiK"R@H@ʥRR*D*RZqU(BZ0PIl'N^`-kޛ{8}{oraR]y+ U\`Xҕ/KЫ(lj ,v 0#>몮5J@Y?ӀS~Zr8I͊p5Pre`V"Ae2Yp\"SzՀ9`킀0$VL܁:NrX8wKvTMQ= ܧ}oerMCz*ppkTV-5 W/hq?3)WR d?\.*O<0SOG@N6 Z_ޯ\GxDa#|!hzw:{ ~,7}#LvyG_ǁ$ VP>I8 ]A'W+@NY)q?%b;/$`|)/|n{EQ3 <xŇTD%ݩ ]15e _HG^G{(@̀p"^^M-6n>^; /"d^R P&aKİ0r2hDPӖ V֝nV]w  Kj'\`g;⏸ oH o]#ȅBWU!V ؅i "K\i36lXp}u:\JJkgI&2Wp=猀<3CJM2߀~8f\MK^^bdF%u>iVS qӷz?>L؂QgA5|#ܡl.L{2(O|HE~AL(>g,+1;SΕA,TYOh/ϐk -~gMfH&݊ OìFd\dJh6*nVjlڗ e\Iө< "(f!9=A#l6JzZB6+6l7آj%\O]l2LAShk˶*ކgx,".BLIkۦ4Mv\Nǰkiojv%aRNzT/MoyU]ި'+:@QyœԿʍʇyF}mvd81/i!t^% Z֍]`Oma% XvS"(x?ʋa|2Ps^u38%{?N-)CIƍES$xQ̜zu+ki"!\Ӽ^+GM uU#'ZT.&ѿOI(IENDB`kylin-nm/res/s/conning-b/12.png0000644000175000017500000001724714205345374015113 0ustar fengfengPNG  IHDR``w8zTXtRaw profile type exifx[& YE$r0 =}.9T)$L8s?pQsĕJ*\1x]eו_^`\V~\^xU|oCt^Lsޟ/9m; Bwú^,u#a>$ޯd$'Q%!IƐ{1>'%ɏYx={K>-\nZ.vώ厈_LJ=ct㼾]Q+0)ZF3܊V<؀FTFD* :ب!'FPSb\f&E8X6>|BoY92q(}Ֆ,=xm! ַ@)!@$>@T#HN"8octY9ln2)R+%EXrPUѤYM=hњ%9g&L-[ճ Ԓ/ʡQ #vQP>-5mYVZܥ[^z=)8)tO;,g!# yQFmߴߠF/RSnj ljNf Ɖ@&4Of)%&XBAd:Mb@Nbt"K܂/q"&\o}Zsmvi>T;Ftv?Oa!T_H6iCCPICC profilex}=H@_SKT:A!Cu *U(BP+`r41$).kŪ "%/)=B4g țSb"_B eJR%y?GZgaSy8*J|N.j8N3pwM`FGKm⺣){0dȦJAB7[w뭽 G]enC`Lk>tv?:rm X$'iTXtXML:com.adobe.xmp ZNUbKGD pHYs  tIME25 {IDATxy]e̝;KPZhԺ@Ȣ-h-UX*ĸbp#-`\ .HĸFQZ*@Q) `Sia{=sn;y/Ns=}}>)E _eiF )"4Jx(F5'fv?0 ljY`Z` (h@D&*D T*' OhUd0$O&^dxfB c킀~`X$,$TQ( (HƤ샟&z Nl ]*t[-}'|` 2UaL(xkF~È&bہ1tjR.+䊀"7BEjvڪ@PKY$ pjqbP Ze2&aܕZSp(*Ѥ\l ͦX.^_o_S`ڎOR?,`= `3Xd9|RiY~ ly*A8~XNAš,O,/U4  ۀہ|k$R /ޥc%{5!O=O? xÒfn~K6pQ8  ~Eu?o.o>/*Z~3aĻk5K]xٔ>IFĥj C[V X|H$n /:Wt@J{ }+6\Y*7GBqP,x@}xk#Y!J.Ū\&<7`,`<^K+|%QQaC߱I,4"5~8*㶑.Gr)c9Mwc}7Ey@y(9 / 2$-R# CO~ճ{]PuH Zz^,`x)%ʀo& Ҏ r`Wazɔ  K*֨^k&.vif,ݼ=@B@ձzN ഔ ~^YhW phM^#pX5Gd& Te^oplJ,v;nQ@CXc5J gɮ_iDpX5k ˳7IKj Jmkq+cwz6UrbTa`RI%<$ئ4n-Ӫ;T%}TX*j87k#gbt.Quk%FQq0aɯuVDfvNz/˰1_ˇum y=h}}ƾ;~q yV'b;Xu*͸>=i)"se&LPX Sn߂mޕсM` $`]jg+*iz%{ookAe4Y IydƱVgTSTF rYv6MpZ-i@+"mIO1ײHs7-kvٜn[Nj_r~UNS Ԅߑ?ƪ{cr ;S(#߅?,paa䏳M"(0B&\% #q k,WY٦Tw~{\FzPdS'%ɏUxzK>-\nZnvώ厈_7LJ=ctޮ]Q+ُ M)XF7\^=؀FTFD* :ܨ!'fSb\f&E8`5>|BoY9@T#HN"8oʨ7MhSEjM `0A8 8$,:ēd PF:لNXKȅ [nߡ\[Įp4 >T+F v?OlǝOiCCPICC profilex}=H@_SKE* ␡:Y*"NZ"TB&~A$Qp-8XupqU?@ܜ]51ݽ;@hTfndBV+#efsw1}ѯ-DYf6Ԧmp'tAG+.q.X3'.VLx8j: YU[J_+\9$ "PF6bXH~?KRU# [0wB 8#@phq';j$ѢG@xhp >)$?MPr-зR7!0Zuwvv?ri3'iTXtXML:com.adobe.xmp ApbKGD pHYs  tIME;[ `IDATxk\esfvg.mR.T!jV[ A1Q?I41$^"Ab%oUJ"qmg\vaNs''3{?s{=0 ( "PUjƮ ue2D@uJDU]!Nǀq 'jF#` k,uPOAz"`V&`Q$GԁEgHE gmApHXOhI@Av~a(sl{ r֩0lY&'IZAK@Y_`c"!`\v ?cJ޺F鄄?&)b׉[Їq:΢Vq&ZP7i..j^Ax 5{AЍ&h ji`D2㬟OLHv}$efz|e/ֿ1f:ɸ q`+VeϧxLJJQ`60+M(Q:.j>:pHxKlO`"N3U)@؉_? ^ |Fjwo^[l9p-?"VҌ3kgoYx"o7,-9TvAyrWuN|^ mπ+gi4.I+g":-I_n(x5)쉅?2vg" jċ)\d a6~4擐Ęrf{)ZhoH' SmQךƃ~@1Asi1_"an 89"+[} cEQS"X e: x졦1r=ddkPP;aA%|дFgF 9\Ig,r3vK%P =)\q|EJV %KʸsfSӸahIUyVP~,a^ XG=w!߸VKwA:(nE+Bzg8/1+6-9$`WB9SUT2\OLj+g|~YB`dWb srL@6Њt (jŊэG sscGءVwM+JVU(琀U=n "p4Gb3Ɂ:(]9`/8p94C,8];{#Pj;5îĮh_?4TF #qTj9"bZ2k.PS(z^2Tb񅘼$.&qjĴj?J.w`WM=/U%&&j[2'dW"_nl~i}/5>!_qJ |W>oxac M.\:*|]5;m Xs̪~a .Vhݏk <#JN6ߨRܡ膏HPiq&l-vJ gm='>t2S[w/Կ?(!IO[;ϽÁq| 7>=iF&AέaqLޝ|lxJ7nphKN4 ppȌ-Y0ޞ,YQ/겘WrkTf A)4eXJ&5-;!'5I ̆ܓc$\ƹ6DB8qGEMl-njC:f]Nz /9(ﺮk!h{ {3(çH6΅ɇy1|mD 镲er@(il&+Za`R̉WeϹE@'DF)JI$QO`^uRH[#S# ?^ MDYԦs'#>'5ď\W\~\tX#'V: x8S52.8oqV+5ֺ'a(,s X$PPCXѪb"Eqȥ FTBv[01&@Ŷ?.Ьm7O3p0IzE6pq֔=reCv$?MP蛲@-г7!0RuwwwV?^rT'iTXtXML:com.adobe.xmp ,bKGD pHYs  tIME;0v IDATx{\gsf^D&l5qS-IXD ൂ"J QRҨdƘjd7lv73>sv;;3;l9KȜs\\&m:@GN@YG)qyࢎTh.ED@v (sRٝ@sKN[4`yHuP/TSSD@7'&'E\&d/2E@l_yk:"a=mn&9^7di"  fX7bdל6`hZTj j qi ..KUI+xF~  ĺh#Hz ho řE@7BԑKlQ=Vf9h̚B@L]vKv" Igzux^n7+ozj%V B8 KЏcɿa]y8'QIEm4=WVw$ܡQǰ>,߲+"4|ڀ#{cQ ։Q X s5nO \Q{V#yT/)5pfE!wMf֡gN5 Kp9n^vZ.h6$7N;5{w"0G`/xRqjj4C Q|Fgj$kx%p#pF-. R=C&li&1^Pl H@^^P%4O7>7`œ:&D@'a,_^ٵAzF$?d< Ŀ]tQfxzH8@o[#4/Z"+pt&-OP jt9pa M@o^z(5,`;㜼w̶Dzy/ w8 pw-he~5A'>mqˤN7 S <(,1EzƲD޻4b^#nF-潚ΏIExSe.TYBX_BX9Jei0C>)vcKnU~|U 8ӫn]Xfʘ{oyS܏?^':ԙ4,5>PEu9Ofæ:4֝ܣ;gn(=x <V/)XK".{[:$Tl߇Y%-:!+ck]X6d<I}׏R|φZQWj4hzTnɲwjU-f.RGP!+d[n=Ƶ(-8Pkz7s-zS&dwّކTC|G|*oSl}j:>c!U)|_=\gٮ1{ۏ*;.(:/ eL%x71#t{ e(b#MZs# IbCMzgBxH2֡WQɸc>#`ԡAM%Ymj]u%TYG)qWT$ŤTtIENDB`kylin-nm/res/s/conning-b/2.png0000644000175000017500000001724414205345374015027 0ustar fengfengPNG  IHDR``w8zTXtRaw profile type exifx[& YE$r0 v{\rN%/jS,dI'0s?pQsĕJ*\1x^e%<ý F9^rz჎Wyk2D}9HS q\ܞC=.CRܡ\w:^,u#aBwgnQѓ(hU<``yD|c9A/I~{[^ryE+`7nٱW'ysjh*j'fx _h[1 ֨ SIcBL<027Z2MM6)" mek L0Fx-lwZQ;WW]#En7 ~ |*Nki*yE^xwwgoi0rDxe'iTXtXML:com.adobe.xmp ;bKGD pHYs  tIME:^Sߋ wIDATx{\u?sg;hAE)X0D!A$b4F ѨQ D#Q|DMU jꣲӖy7v3{;w z,UJ@ UjL>h!C! [ 1󒤙:YQ'FE29y@ xR" A" N,k OI/IPqXC=Ke9ݬ XN>49혤.н0,/0?Q* 0v ?mD:*Tq%tꔀ[΄!+J|m7ZF9/^:]nt 4 4@2K']Onh.ɺI\y>_ 3ri\j ` {*2Bn#o\^LJ)pHxI˝{)Z`8V-5+Ԥfv!`g f#`{E" /drr mxlԌmڠTm;Pyy;pf.~NYmUEr `_ÞI8,Uь4\Y!Mci"ܦʧ/z$YPoE//$MwŦ,"d6p+?Y͂fgk>~qǀ?Oȋpi*"*)NN?Kg#pL%q aO^E ŰMG3~Ex%f?BiLA)e&>[~ b *!Yx%V\ C#/hD w >c?<.wRR1pXILE3`_ M2Kd?f eĦUN}~A ڶPD@0]LmfG[p UCOJV-"'a.sj#*YpY,<BNXjp!A8(hL@զɚ]ePZhIyXNCvߨMFcV':(7/oW2 V(HcjO2]ɢ`Er+~\'aG]ӚPϡ̝Cd/Y +WGWOdHԭ53G7KE掳I|Nn~[,0;KF)^%c 6!vɬ&m-M|" qX@x)햙(g_?iiM0R\!9!`n7± &$,%lӬNGZz-I/ɠ U3C,h>xBc?j.Wf8Ӗeʆ^ȸ,k2&K*x}<0a3rWT\>%l>{MplB/ɕ M帖kpu7Yr\K{z0K6w: Nˀ_w龬ѴE}ĄlNe*Sjϙ0Nx~j6 WJ qyiJ(u[#3ms9X ygWxejҋq+5]&a\&^pH"ط>D' Gk^#u;dP*|I,2| EmU{4MRIX>Bi Gn5m{-kzW׌܃W8]B1ߌ篈}o}j \yH+,El\ZuXpRmu:>ҳtu`zIL)KpY\R͌Em$q=i{HStydY'B5`nQ岱d "!gMWSA*0 cWU=3?*K$ޯd$'Q%ahCB^>1$?f=-\\riL@& ?;;"~]0*$}22wEd?24\kp+ZAXc[<bPu4\cl@Mq&S` " -ek L0Fx-lwZQ;Wg]#In? ġU[8 㵅(X"VJO3elDȣPE, U#c-]V<8B lTJIQ?5TU4jVSZf)k<䪉%SfVxrk"8bK)rpTaBBr!G:ȇ~6OKM[nּV;w8&zֽ^O 'N3zN?YjmHCG6|Qoj77ѦƋԳaqq"I͓YtJ',ƦPF:لNXKȅ [nߡ\[Į]8s:=ݿ?>>>>>>d;ȝG >iCCPICC profilex}=H@ߦT:A!Cu *U(BP+`r4iHR\ׂ?Ug]\AIEJ.)ޗYe3hmfRI1_{_Ba2$) u<˿ѯ,DYf6mp'tAG+q.,̘LjR+]ʦF)RP,gMy`[>^oC`D>wߚv~rnYD'iTXtXML:com.adobe.xmp (NX3bKGD pHYs  tIME K! IDATxkUW̝;ށN(,4Hh5T44ն(1]751Fc_Lm||0#vHPmР6"jی- ̝}a0:gd\nYkNP_aluZlT*0y1T)Z'('IFmPJ@@YE @ I_f^.hU%`TN G"!y2YE$\.Հs6 _ uVfX׷cX@?p"T9ͨN,M؅N(.UiT[nDZ{h-@{4.V{_p%-ql,r^a 7^]v(lEPehjiPxT}5Ļ"lxppZ`'. -\7Hv^ݨFp3} S>M r tm1{u +\0)"X Hψ9Ql2H7w{|.)(u30 l%|x7YFI"WO~NqVہхUPHOK҇2Q7: DgV#އ1m6-:X0/O UǍsa >#uG:|S[d$<_Ƽ,wF+|oGe=72Sr^*y >ť-(9ciܯ'q/wǺ~Z<:.7ghr!vizQ .ݜz\3Jؙ`w'Hఛ2[-tIףx& c|Bg u>F6)9  s,c0ahdufժ(9 e1Y(?՘eU (%F|[PS-Z눕 iVTt$EY 5+UΒ2Og?;Ql!vHOz~X2GpaW^ p{d7}qFH{U(n#\nQAkT4MyiQ\RG ]ЋԌ@Jm𙢝k;{NJ%"ib zĂUKOs'DKxQT4|,. Z4~'!M1Wt@6kWH6M}hTu[`vr ܡ-` fJ3E%733p/'kfK LҿFpH3.b=aewޑ< fWn[02}HހЧ _<c}Jp f뒄;p $ȧ5bYZfqiQ3ގ? %V;+5_&K$AsU~#oe/h~A 5λWhxw(|ؑQcjUA'ը)(N>ۍ:$$iyn3sC7V~YdL:"J]M ^f^Ҏz*Ƥ6 }#} EܙEIDJ C46qRMB4)xgeesWu4Q[ U4SQҍZ;.sj9ݯSti6[Enjg9&40_Wo ZYI6=^LeЬj9.E[czmJ7]ۊqz jڢUf‚nK)v)MԣKrvS D4ߖ{U:?XE{[{a~72x/\e"g/Su)C6M(:YoV;k @Dľ0*]?n=QRDF$0rK8-?ڣɤ'N xP'<$)vtIӀF@MU) /6|`>@Q)JT]Q}r3鿺#0/IENDB`kylin-nm/res/s/conning-b/5.png0000644000175000017500000001736714205345374015040 0ustar fengfengPNG  IHDR``w8zTXtRaw profile type exifx[& YE$r0 =}.9T)$L8s?pQsĕJ*\1x]eו_^`\V~\^xU|oCt^Lsޟ/9m; Bwú^,u#a>$ޯd$'Q%D!!/c|NK{|[.oܴ&] }톟.|{>y}]MͻVR.뵌fs[yy-h 1@:UtQCO6 Ÿp|$FMtql|߲5rxU&#~;-f(+ų$7{hMWmORA]iv|`eP-YzBoH|+A'{2Ec6""r*wI瑱w.+gbMM6E*`K*T5-Z5lyrĒe3s+V]ʨ7MhSEjM `0A8 8$,:ēd cS(#HlBI Inv_~[P%nOD_ @-Pw-b.9pLjߎCCCCCCCC2 BiCCPICC profilex}=H@ߦT:A!Cu *U(BP+`r4iHR\ׂ?Ug]\AIEJ.)ง}Ye3hmfRI1_{_Ba29IJw|#׻?W ",3Lx߻ic,c&Hu7%3yXbYԈ㪦SXYYNHA_Y:a%H U'B>!/K!W Awo䄗IzwVqu+5O-~D뎦;!+i "~Fߔn5o}>YU88FKpw=9RrJ'iTXtXML:com.adobe.xmp ?$bKGD pHYs  tIME `e IDATxi]e;wlvMp ( Jq MըQKD%QJ[4**შqbD@h- uڱ]szsg''L;sνy}d* Eӑr@92::*E:x7QJ`@B"0rPuNYW-iy香:QQ]M #29i@8Qj"4bHF0 Y[P֊Մ pێddY8"PMY`,Ŷ0%g;}Vi$Mu;%_D8؉_脀9cUQT2H%I[N܂46j[ H[;n-Լn.Ef$EmVi+em'uWT+[ˁ%e8E :5w[obs 9^?eG} "SJ3DLW~i l|Q6vFStCG#ex/0o.Ί|lƁK5H10 LB ~''ddǁہݓr)}86+gu{Ɓd: Ċplii^~:}qSM)b7#鶨|ƀWvˁXFPު ]!Q{>=P(7|M)xI mo>#Ƿyu?Xc\& nOH> Q#< Z4mx3=Zl8 KhN˄D4HZsx5ppIYs!*?,qv%w_L5nN/<#`CҮS"ԘlQ"畀W*Lڊ_ߕ%7+Ce{AB _U0rl6^2?'*&(m7+ -xj3wT8KZӫ 29 \tK 9ZVR9KiJDSPHjJU<>܄J5elWe.v;Y2TQv\^9Dz+YE7 |gdC7)RI!Yg=#"`@JG@:)nc79m'I#JZcpLΈ*K򏤘Ee F|Pz<ltaEr <(:aS/Z/\fPZQfU4ϑ2*T"q,p7T,G}5%4]vr`e"i )$`mń*M?(G ?ps- X4yH#•ӳ ?{tdܢi\%C?{SDE~ч,taŵ''7Tblfpȸd\_4_[|C |/.ۉ`۵0|T17$Pq +&Z-Gہ(/xq86\Em% q D2n5_~|=,;\qBt>Ԯ+xR&pͺf-Y5 &ZF@ȎeCoy{iu!!?I5hkjLC'b8 W5-).U65\OUw?KӸ5G_Bf; Tcmf.BI[ rE:=wb܋U0}e+"N5 OG;*vqFE ycW\J_ͦ. 1n,[?c _NzPd3J'zż}[͸vy.ʹcR4FN:f$/H.^I"!9eY]#R 9JE]'r۴F{!$dIENDB`kylin-nm/res/s/conning-b/1.png0000644000175000017500000001611214205345374015017 0ustar fengfengPNG  IHDR``w8zTXtRaw profile type exifx[& YE$r0 v{\rN%/j($0s?ШdIs9 W,xv/CtMABΧe+qj9"0d+ G?#uT̊DG{bao<^ yys^X߫sˋVorc# RyOՔ|UN6=@@e? bmt56 Q!(QJƞ5xafnd.ƅ,NiulReD ;~T`{0g[)wF 4/nT?(Uԝf x&ڒYORߊ`H@ fT?elDȣPE, U#cm]Vμ8B%M X))ǒ&UjA,9e9[^\5dj܊UOܽx-\g\x)V*lUWH>HÏrԆii͚j.Dݺ0pR4taGu֦4uigvQ5&i0{ubbm@AbREn1Q(#H]lBE  I7/r-7'ra/w;6+\9:=ÿ?>>>>>>dMDiCCPICC profilex}=H@_SKE* ␡:Y-QP Vh/hҒ8 ?.κ: "ƃ~{*̾I@-#J|Ea@\ff}N_.Ƴ9ՂHZ'ͮ=uWS`.#i "~Fߔn5>N,ue{trF'iTXtXML:com.adobe.xmp JbKGD pHYs  tIME9xIDATxϏE?3LFn&`9IoBxf^\R bWd!4pTD'tgYOY ?xaK Od]C;cr⸤'NУ 0%1 0#oo6"+D8&8pG o()r[IhT ->ƍ 'cL?% >p, ~\px v\cvDp|s]dD+9m6nXv>gEؒvA3Q^EdZe) nfj޷>hxnR\ܴe徦\ `PK+ +6'4X~z}P35*]y~G|tz[V,,2r[+z^k `lKBueD&b"'Sj#]c >/]H{aj恿JD \Ѷަ{ZU VjB|٦|ҫAq,axRQ-d4I.HS%&hZN U[K૒ p`%iF%J# Kswer0NkeM1öM|@2ɠ%zg~.Fou$Lf.+U bX':!ӝ J0 }b']?XT/rի ӯ *ןE><e6,Y.PTv&FbHثYvvV[D/zLҳ"FR*'ĸM8w\wv0-uq{2MR пrPpS+{E` uko5^ʔZ-ޗ +OJJ*IENDB`kylin-nm/res/s/conning-b/7.png0000644000175000017500000001625414205345374015034 0ustar fengfengPNG  IHDR``w8zTXtRaw profile type exifx[& YE$r0 =}.9T)$L8s?pQsĕJ*\1x]eו_^`\V~\^xU|oCt^Lsޟ/9m; Bwú^,u#a>$ޯd$'Q%A$ocH=,g%[.7wHrgrGį &_1q^_WSFF󮨕lz⁔z-nV+hkl@cZB *#PNklb #s)s1.drJ`"],̒ -ek L0Fx-lwZQ;Wg]#In? ġU[8 㵅(X"VC1cPhF<:UDΒR 9akp0veS HcQCUEf5Ek-CX2lfnŪ'Wn^.3PK.VR+ G*+$rC|G9jCԴf[iscn{p8өg>uֆ4taG~~mjHM=A&h':'qP'5ď\W<~\vYq3#.VULx8j: yU[Z_-K\94 "QE 6X~?%r)䪂c ~?ݭU) 8@xh5qZ'@;&0Iz%6pqє=rx2dSv MT @-л27!0R5wG{LNrcORc'iTXtXML:com.adobe.xmp H^bKGD pHYs  tIME%mXIDATxKoUyQJĚuĮ4+ ٰ -bIJ(bȆUKkR>@-Q!hӱYf:g9wKWv{=9Nl( iC0 )a:JsF FDi=mbؔ7ƀ|-`C>{c %M5BVE(r=`]VE &œ#vU"J2{ ` 8.$ uDBC%9؆b3'Z8*i[FeO4g؅ncۯ7L4"-qB&bbp ۮ-ƍN %>t5;dh E3R!`jWrI("ˤG9<0N^P0"6+L;d&;Gsϰ6ø Hs?cʚhe>C򋇡{Q!S\M--%m i0C+`J&E^m'zHM(]I1  Cx8zQI gkhV|rL@0v,nCrigW*QMJyZQd/h139ZS$5ܖ 9J2fh(~|ZT?Aұ_r>;ôA ~vT@&/vJ2֪z5m/:nAcvjh [\ 26d1vpwKUj9yZV?z* 4W9 eL56"(Y aMn0_3KV喙}?۰p+;R[ =Iq@^;uK$c[]үD.^>R簷Mu0 ]oIuudA+"x$*ukd5e!@':9)8v$> ڝ}IVFNs|'+PZali:!U (# Q= @bcYMI돓Ee7yC< /`s (ۛ 56q j5v>-w3 mb'vҧON 8nZgu ;y%2|l3& po'q'-6XsK$9^vVG_<WE@`Bư3UVc.b8o8+aLwĸnSyžӨ5UoKsنKD2,|V`?Ք0Z]f|waAOT.IENDB`kylin-nm/res/s/rescan/0000755000175000017500000000000014205345374013551 5ustar fengfengkylin-nm/res/s/rescan/8.png0000644000175000017500000003571514205345374014441 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:eaa61c88-d2e6-7f41-bbed-73d1b7cbab27 xmp.did:3D325C9A0A8311E98914C2F2D3A308B3 xmp.iid:95bb0191-f431-ce46-9ca4-78bb214398a0 xmp.iid:d96babfe-a040-214a-bc06-feb643c37b81 adobe:docid:photoshop:9673d7dd-fc51-11e8-a001-be3e9f4db054 saved xmp.iid:95bb0191-f431-ce46-9ca4-78bb214398a0 2018-12-29T09:52:26+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-10T16:04:16+08:00 2018-12-29T09:52:26+08:00 2018-12-29T09:52:26+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 cHRMz%u0`:o_FIDATxb?` `1xQ{AֻY @R!3B?;/@Vn[ ?3VB`dtСPDG4h@Pĉϼ0;/]`=J1F!*̹Sv2{ZԧX%/+!YDۏS:!(0I(%*F@*T DӋ[Hl@OsA̙?Z*$ Ƹ_2VҔ 68J \x5c^ S xmp.did:eaa61c88-d2e6-7f41-bbed-73d1b7cbab27 xmp.did:40FFD2E90A8311E984D788ADC169D7FF xmp.iid:13deafe3-547e-5e42-8f4c-8f2b3d3fd3d7 xmp.iid:d96babfe-a040-214a-bc06-feb643c37b81 adobe:docid:photoshop:9673d7dd-fc51-11e8-a001-be3e9f4db054 saved xmp.iid:13deafe3-547e-5e42-8f4c-8f2b3d3fd3d7 2018-12-29T09:52:17+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-10T16:04:25+08:00 2018-12-29T09:52:17+08:00 2018-12-29T09:52:17+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 cHRMz%u0`:o_FIDATxb?#`1100 $200f``<105.b%3HITR9ԏz*ɍ ;J20_*\Ρ 0EaxS.Pmc ' &X0ذ7[2rWNn<lѱ P/ V: Z`a!2k<p8(rԙ0`! (ΈS*;xZܓO:xt`akidEh x,Yh[em`RP>O<}<~1OOWޖ(cJ{E5$^E GL )dpKN2q$Fb3'яu &-6b}7vYG|wIENDB`kylin-nm/res/s/rescan/6.png0000644000175000017500000003604114205345374014430 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:eaa61c88-d2e6-7f41-bbed-73d1b7cbab27 xmp.did:36C792430A8311E9BE9BD3B013D354F4 xmp.iid:f80865c5-d93d-9449-8407-5ded44ab354f xmp.iid:d96babfe-a040-214a-bc06-feb643c37b81 adobe:docid:photoshop:9673d7dd-fc51-11e8-a001-be3e9f4db054 saved xmp.iid:f80865c5-d93d-9449-8407-5ded44ab354f 2018-12-29T09:52:48+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-10T16:04:05+08:00 2018-12-29T09:52:48+08:00 2018-12-29T09:52:48+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 Y cHRMz%u0`:o_FIDATxb?F(d1200300H300DwA;W8Mָ74I/tȚ`a0XX0%a f*fq}`2Ł Z ij0 "X>tNr{?>#WXhߘOX ȣ-|e裊:UMx|K ELN';x[#7SbsʸA#l>^HIENDB`kylin-nm/res/s/rescan/11.png0000644000175000017500000003602714205345374014510 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:eaa61c88-d2e6-7f41-bbed-73d1b7cbab27 xmp.did:47D532CA0A8311E98A19C7A1ED55446A xmp.iid:900bf612-18ac-1142-9674-2b49a131bec2 xmp.iid:d96babfe-a040-214a-bc06-feb643c37b81 adobe:docid:photoshop:9673d7dd-fc51-11e8-a001-be3e9f4db054 saved xmp.iid:900bf612-18ac-1142-9674-2b49a131bec2 2018-12-29T09:51:54+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-10T16:04:39+08:00 2018-12-29T09:51:54+08:00 2018-12-29T09:51:54+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16  cHRMz%u0`:o_FIDATxb?;#`d1X~3000200,```4˱ 0% t), pа{DSI^*Ia\α wpf!afeC* %.\رֽ(CHh?FPd!Aa pdflA̰%h.H6S7'yy$0G'@[G|JDRW4%"\jV" b}lQlԚS%/gt`aۄ`E&ALa`xb XEt1.XNwfY?`>ްE(Ztb)b8e0:ا>m_(b)FQ a˿~&xG*h83 /mvIENDB`kylin-nm/res/s/rescan/12.png0000644000175000017500000003572414205345374014514 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:eaa61c88-d2e6-7f41-bbed-73d1b7cbab27 xmp.did:4B40959B0A8311E99E4DE2469BAC3BCF xmp.iid:f211972f-f026-104f-9f04-42d7b1b1a617 xmp.iid:d96babfe-a040-214a-bc06-feb643c37b81 adobe:docid:photoshop:9673d7dd-fc51-11e8-a001-be3e9f4db054 saved xmp.iid:f211972f-f026-104f-9f04-42d7b1b1a617 2018-12-29T09:51:30+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-10T16:04:44+08:00 2018-12-29T09:51:30+08:00 2018-12-29T09:51:30+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 e cHRMz%u0`:o_FIDATxb? `193 AֻQ lGR1J3\α !$2 !=]ʎ{$,h7+>T=l @X@CZB[cJ+H IDz7 &U<C W8ݹGl8ýNbOtW{ט眎Q( +Z"6<`% x O#7S<vJpae1?ehUSCܰ `ajɰE-9J &Ec_/x]=N8@,~wC׸8Jz(} IENDB`kylin-nm/res/s/rescan/3.png0000644000175000017500000003603714205345374014432 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:eaa61c88-d2e6-7f41-bbed-73d1b7cbab27 xmp.did:2B06AA9A0A8311E9BD01B7EB82C639A0 xmp.iid:a3333cfd-5484-4246-804e-5c88ce396322 xmp.iid:d96babfe-a040-214a-bc06-feb643c37b81 adobe:docid:photoshop:9673d7dd-fc51-11e8-a001-be3e9f4db054 saved xmp.iid:a3333cfd-5484-4246-804e-5c88ce396322 2018-12-29T09:53:18+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-10T16:03:48+08:00 2018-12-29T09:53:18+08:00 2018-12-29T09:53:18+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 f cHRMz%u0`:o_FIDATxb?"#`1200, f``Hg`` 000|d`` P0- \Ρ 0ׄ@u hJ<&n8qaƎ /KVgFLH=:(P\б awE&f\f vrV!bhhk?7,3%0L2?0*eι XţYs<*gu:jp/4h=Lq/PE0m6A"l5 O hX&e.( ̙36tPEF0WC=/s|`T1o]n$yA0wlu'K"+EVq98\Ųx3"P6d%<$x;v IENDB`kylin-nm/res/s/rescan/4.png0000644000175000017500000003604514205345374014432 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:eaa61c88-d2e6-7f41-bbed-73d1b7cbab27 xmp.did:2F8F03970A8311E98631AE1FB8E699EE xmp.iid:eacc68bb-2ba3-e046-a59f-50d8648b0e28 xmp.iid:d96babfe-a040-214a-bc06-feb643c37b81 adobe:docid:photoshop:9673d7dd-fc51-11e8-a001-be3e9f4db054 saved xmp.iid:eacc68bb-2ba3-e046-a59f-50d8648b0e28 2018-12-29T09:53:08+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-10T16:03:54+08:00 2018-12-29T09:53:08+08:00 2018-12-29T09:53:08+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 J cHRMz%u0`:o_FIDATxb?#b:M KAAL1C6f 100p000b%C;T000@`Z200200dϱ 7j6U%XQ+K~n~I8pFGB>4,(xTϿ Qϑɨ(?)N$waccʨlb4sx}jWwsg,7ZxGdqp"x8P8 0>aov πGL53_xO)WxBe|$=aD[4Q PGv3pR0MIENDB`kylin-nm/res/s/rescan/2.png0000644000175000017500000003603214205345374014424 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:eaa61c88-d2e6-7f41-bbed-73d1b7cbab27 xmp.did:2787D4220A8311E99F59FE76C5C2B30E xmp.iid:0be02822-72a7-ba42-8d47-a648423add3e xmp.iid:d96babfe-a040-214a-bc06-feb643c37b81 adobe:docid:photoshop:9673d7dd-fc51-11e8-a001-be3e9f4db054 saved xmp.iid:0be02822-72a7-ba42-8d47-a648423add3e 2018-12-29T09:53:27+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-10T16:00:30+08:00 2018-12-29T09:53:27+08:00 2018-12-29T09:53:27+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 G>R cHRMz%u0`:o_FIDATxb?$#d1300x200l a``X 000iy ,P` T;0DSE<PX xI<>۝;;Q$}`Ê3 7C;?Ì+Blϡ Aз9Cr ( :  `4ZA6?s\ N8-f BUIQwnXᎶXV7\( c5X{s|9C(: '@  IhTa@x0(,#I ,[ӑ7LoѢ*4|U2bF9stȿGݠ <ްnHI4&=+gPK9B:Fo;{]DuПIENDB`kylin-nm/res/s/rescan/10.png0000644000175000017500000003603614205345374014507 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:eaa61c88-d2e6-7f41-bbed-73d1b7cbab27 xmp.did:445012F60A8311E983D7BF86387D11C7 xmp.iid:cd8966a6-8e66-7347-989e-5d8c83ed07b4 xmp.iid:d96babfe-a040-214a-bc06-feb643c37b81 adobe:docid:photoshop:9673d7dd-fc51-11e8-a001-be3e9f4db054 saved xmp.iid:cd8966a6-8e66-7347-989e-5d8c83ed07b4 2018-12-29T09:52:04+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-10T16:04:31+08:00 2018-12-29T09:52:04+08:00 2018-12-29T09:52:04+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 cE_ cHRMz%u0`:o_FIDATxb?#`1100, 100c``(41 04p1= . 'W"b5DǸ\1 0D $ 6S8hؙZKK?^%w=phgKAZcČ Tl- QgE$ DIč,d1'ksfWl "|{"xx9?gid`n6l`QE%~IJ]V`z"!?<Xmys9xdK9&Q1.w^. K}"XW bW`76E r8# e3u:?|G^c;O`F&15AIqޅGìj %LF;l0O<<2rIENDB`kylin-nm/res/s/rescan/5.png0000644000175000017500000003602514205345374014431 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:eaa61c88-d2e6-7f41-bbed-73d1b7cbab27 xmp.did:334B640A0A8311E9B7FA8CF95C228968 xmp.iid:01f85d47-7c05-e346-9f5d-e1b8e47a5e3e xmp.iid:d96babfe-a040-214a-bc06-feb643c37b81 adobe:docid:photoshop:9673d7dd-fc51-11e8-a001-be3e9f4db054 saved xmp.iid:01f85d47-7c05-e346-9f5d-e1b8e47a5e3e 2018-12-29T09:52:59+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-10T16:03:59+08:00 2018-12-29T09:52:59+08:00 2018-12-29T09:52:59+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 4 cHRMz%u0`:o_FIDATxb?/#d1100V100x100 a``Hic``hba```p ôc``8T͡ 0 f`l 1AavXČ#D\X xQ\! BQ«vE\.@M6݂ M-h˻˝63?@EUts{41V&>PNf', YsJ8)vآ|<:8M?5+c}Q %IENDB`kylin-nm/res/s/rescan/1.png0000644000175000017500000003566114205345374014432 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:eaa61c88-d2e6-7f41-bbed-73d1b7cbab27 xmp.did:2403A0260A8311E99104E9BF0F8265BA xmp.iid:f30d9ed6-62c1-ab49-a509-e1f5d31aec3e xmp.iid:d96babfe-a040-214a-bc06-feb643c37b81 adobe:docid:photoshop:9673d7dd-fc51-11e8-a001-be3e9f4db054 saved xmp.iid:f30d9ed6-62c1-ab49-a509-e1f5d31aec3e 2018-12-29T09:53:37+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-10T16:00:25+08:00 2018-12-29T09:53:37+08:00 2018-12-29T09:53:37+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 3u cHRMz%u0`:o_FsIDATxb? b@9@_A6mc$&k~2€/h _ ÙA @`E2A1 R%RO 9.Ê ;`?Fw9җa C(@)y;GcH}NШC%A$D).2 ^i]Š 8beqNKA/^pQA&!7{Obi\?<AOz0IENDB`kylin-nm/res/s/rescan/7.png0000644000175000017500000003564714205345374014444 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:eaa61c88-d2e6-7f41-bbed-73d1b7cbab27 xmp.did:3A055C320A8311E9A5B6FBCD249A229B xmp.iid:b7833fd5-5af2-8e48-85ea-930ecc35c4eb xmp.iid:d96babfe-a040-214a-bc06-feb643c37b81 adobe:docid:photoshop:9673d7dd-fc51-11e8-a001-be3e9f4db054 saved xmp.iid:b7833fd5-5af2-8e48-85ea-930ecc35c4eb 2018-12-29T09:52:37+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-10T16:04:10+08:00 2018-12-29T09:52:37+08:00 2018-12-29T09:52:37+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 Nk cHRMz%u0`:o_FiIDATxb?` `15 _A{a 蠫_?B5{-X\GB t 0 %QDa2A$hƑ^g+P, )V̀2Xwo6]#+1 ` a(S8z <*1ݔ%Oi;%yt?_Xe`o6>d #include #include #include #define MAX_LEN 2048 #define MAX_PATH 1024 KSimpleNM::KSimpleNM(QObject *parent) : QObject(parent) { // runProcessLan = new QProcess(this); // connect(runProcessLan, &QProcess::readyRead, this, &KSimpleNM::readProcessLan); // connect(runProcessLan, SIGNAL(finished(int)), this, SLOT(finishedProcessLan(int))); // connect(runProcessLan, static_cast(&QProcess::finished), this, &KSimpleNM::finishedProcessLan); // runProcessWifi = new QProcess(this); // connect(runProcessWifi, &QProcess::readyRead, this, &KSimpleNM::readProcessWifi); // connect(runProcessWifi, SIGNAL(finished(int)), this, SLOT(finishedProcessWifi(int))); // connect(runProcessWifi, static_cast(&QProcess::finished), this, &KSimpleNM::finishedProcessWifi); // runProcessConn = new QProcess(this); // connect(runProcessConn, &QProcess::readyRead, this, &KSimpleNM::readProcessConn); // connect(runProcessConn, SIGNAL(finished(int)), this, SLOT(finishedProcessConn(int))); // connect(runProcessConn, static_cast(&QProcess::finished), this, &KSimpleNM::finishedProcessConn); } KSimpleNM::~KSimpleNM() { // delete runProcessLan; // delete runProcessWifi; } //获取有线网络列表数据 void KSimpleNM::execGetLanList() { if (isExecutingGetLanList) { qDebug()<<"debug: it is running getting lan list when getting lan list"; isUseOldLanSlist = true; QStringList slistmEmpty; slistmEmpty.append("Empty"); emit getLanListFinished(slistmEmpty); return; } isExecutingGetLanList = true; QtConcurrent::run([=]() { QProcess *runProcessLan = new QProcess(); // connect(runProcessLan, &QProcess::readyRead, this, &KSimpleNM::readProcessLan); // connect(runProcessLan, SIGNAL(finished(int)), this, SLOT(finishedProcessLan(int))); shellOutputLan = ""; QString getCmd = "export LANG='zh_CN.UTF-8';export LANGUAGE='zh_CN:zh';nmcli -f type,uuid,device,name connection show"; qDebug() << "Will get lan list, cmd = " << getCmd; QStringList options; options << "-c" << getCmd; runProcessLan->start("/bin/bash",options); // runProcessLan->start(getCmd); runProcessLan->waitForFinished(); shellOutputLan = runProcessLan->readAll(); QStringList slist = shellOutputLan.split("\n"); //qDebug()<<"Get Lan list Finished! slist.size() = " << slist.size() << ":" << slist;; emit this->getLanListFinished(slist); isExecutingGetLanList = false; delete runProcessLan; runProcessLan = NULL; }); //runProcessLan->start("nmcli -f type,uuid,name connection show"); } //获取无线网络列表数据 void KSimpleNM::execGetWifiList(const QString& wname) { if (isExecutingGetWifiList) { qDebug() << "It is running getting wifi list when getting wifi list"; isUseOldWifiSlist = true; QStringList slistmEmpty; slistmEmpty.append("Empty"); emit requestRevalueUpdateWifi(); emit getWifiListFinished(slistmEmpty); return; } isExecutingGetWifiList = true; shellOutputWifi = ""; QString cmd; //将ssid放置在最后一列以防ssid存在中文或特殊字符导致其后面的列不对齐 // if (wname.isEmpty() || wname == "") { //由于网卡拔插时有的设备获取网卡名错误会导致列表刷新失败,暂时取消网卡选择,在结果中筛选网卡扫描结果 cmd = "nmcli -f in-use,signal,security,freq,bssid,dbus-path,ssid device wifi"; // } else { // cmd = "nmcli -f in-use,signal,security,freq,bssid,dbus-path,ssid device wifi list ifname " + wname; // } qDebug() << "Will get wifi list, cmd = " << cmd; QtConcurrent::run([=]() { QProcess *runProcessWifi = new QProcess(); QStringList options; options << "-c" << cmd; runProcessWifi->start("/bin/bash",options); // runProcessWifi->start(cmd); runProcessWifi->waitForFinished(); shellOutputWifi = runProcessWifi->readAll(); QStringList slist = shellOutputWifi.split("\n"); QStringList out_slist; //qDebug() << "Get Wifi list Finished! slist.size() = " << slist.size() << ":" << slist; if (slist.size() >= 1) { QString headLine = slist.at(0); out_slist.append(headLine); int indexSignal = headLine.indexOf("SIGNAL"); for (int i = 1; i < slist.size(); i++) { //从第二行开始,跳过第一个表头 if (slist.at(i).mid(indexSignal, 6).trimmed().contains("SIGNAL")) { //又读到了表头,表示是其他网卡扫描到的列表,停止 break; } out_slist.append(slist.at(i)); } } emit this->getWifiListFinished(out_slist); isExecutingGetWifiList = false; delete runProcessWifi; runProcessWifi = NULL; }); // runProcessWifi->start(cmd); } //获取保存的网络列表数据 void KSimpleNM::execGetConnList() { shellOutputConn = ""; // runProcessConn->start("nmcli -f name connection show"); QtConcurrent::run([=]() { QProcess *runProcessConn = new QProcess(); runProcessConn->start("nmcli -f name connection show"); runProcessConn->waitForFinished(); shellOutputConn = runProcessConn->readAll(); QStringList slist = shellOutputConn.split("\n"); qDebug()<<"Get Connection list Finished!"; emit this->getConnListFinished(slist); delete runProcessConn; runProcessConn = NULL; }); } ////读取获取到的结果 //void KSimpleNM::readProcessLan() //{ // QString output = runProcessLan->readAll(); // shellOutputLan += output; //} //void KSimpleNM::readProcessWifi() //{ // QString output = runProcessWifi->readAll(); // shellOutputWifi += output; //} //void KSimpleNM::readProcessConn() //{ // QString output = runProcessConn->readAll(); // shellOutputConn += output; //} ////读取完所有列表数据后发信号,将数据发往mainwindow用于显示网络列表 //void KSimpleNM::finishedProcessLan(int msg) //{ // QStringList slist = shellOutputLan.split("\n"); // emit getLanListFinished(slist); // isExecutingGetLanList = false; //} //void KSimpleNM::finishedProcessWifi(int msg) //{ // QStringList slist = shellOutputWifi.split("\n"); // emit getWifiListFinished(slist); // isExecutingGetWifiList = false; //} //void KSimpleNM::finishedProcessConn(int msg) //{ // QStringList slist = shellOutputConn.split("\n"); // emit getConnListFinished(slist); //} kylin-nm/src/oneconnform.cpp0000644000175000017500000015006714205345444015070 0ustar fengfeng/* * 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 #include OneConnForm::OneConnForm(QWidget *parent, MainWindow *mainWindow, ConfForm *confForm, KSimpleNM *ksnm) : QWidget(parent), ui(new Ui::OneConnForm) { ui->setupUi(this); ui->btnConnSub->setText(tr("Connect"));//"设置" ui->btnConn->setText(tr("Connect"));//"连接" ui->btnConnPWD->setText(tr("Connect"));//"连接" ui->btnDisConn->setText(tr("Disconnect"));//"断开连接" ui->btnHideConn->setText(tr("Connect"));//"连接" ui->btnCancel->setText(tr("Cancel"));//取消连接 ui->lbConned->setAlignment(Qt::AlignLeft); ui->lePassword->setEchoMode(QLineEdit::Password); ui->checkBoxPwd->setChecked(false); ui->lePassword->setContextMenuPolicy(Qt::NoContextMenu); ui->lePassword->setTextMargins(0,0,24,0); ui->btnConnPWD->setEnabled(false); leQssLow = "QLineEdit{border:none;background:transparent;font-size:14px;}"; leQssHigh = "QLineEdit{border:none;background:transparent;font-size:14px;}"; funcBtnQss = "QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0);color:rgba(107,142,235,0.97);font-size:14px;}" "QPushButton:Hover{border:0px;border-radius:4px;background-color:rgba(255,255,255,0);color:rgba(151,175,241,0.97);font-size:14px;}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0);color:rgba(61,107,229,0.97);font-size:14px;}"; ui->leInfo_1->setStyleSheet(leQssLow); ui->leInfo_2->setStyleSheet(leQssLow); ui->leInfo_3->setStyleSheet(leQssLow); ui->leInfo_1->setEnabled(false); ui->leInfo_2->setEnabled(false); ui->leInfo_3->setEnabled(false); ui->btnInfo->setStyleSheet("QPushButton{border:none;background:transparent;}"); ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(156,156,156,0);}"); ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(156,156,156,0.1);}"); ui->wbg_3->setStyleSheet("#wbg_3{border-radius:4px;background-color:rgba(156,156,156,0.1);}"); ui->lbName->setStyleSheet("QLabel{font-size:14px;}"); ui->lbConned->setStyleSheet("QLabel{font-size:14px;}"); ui->lePassword->setStyleSheet("QLineEdit{border:1px solid rgba(61,107,229,1);font-size:14px;}"); ui->checkBoxPwd->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);}"); ui->btnConnSub->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);color:white;font-size:14px;}" "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}"); ui->btnConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);color:white;font-size:14px;}" "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}"); ui->btnConnPWD->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);color:white;font-size:14px;}" "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(255,255,255,0.2);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0.08);}"); ui->btnDisConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);color:white;font-size:14px;}" "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}"); ui->btnCancel->setStyleSheet("QPushButton{border:none;background:transparent;color:white;font-size:14px;}"); ui->btnHideConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);color:white;font-size:14px;}" "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}"); ui->lbWaiting->setStyleSheet("QLabel{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);}"); ui->lbWaitingIcon->setStyleSheet("QLabel{border:0px;background-color:transparent;}"); ui->btnInfo->setCursor(QCursor(Qt::PointingHandCursor)); ui->btnInfo->setFocusPolicy(Qt::NoFocus); ui->checkBoxPwd->setFocusPolicy(Qt::NoFocus); ui->btnConnSub->setFocusPolicy(Qt::NoFocus); ui->btnConn->setFocusPolicy(Qt::NoFocus); ui->btnConnPWD->setFocusPolicy(Qt::NoFocus); ui->btnDisConn->setFocusPolicy(Qt::NoFocus); ui->btnHideConn->setFocusPolicy(Qt::NoFocus); ui->wbg->show(); ui->wbg_2->hide(); ui->wbg_3->hide(); ui->lbName->show(); ui->leInfo_1->hide(); ui->leInfo_2->hide(); ui->leInfo_3->hide(); ui->lePassword->hide(); ui->checkBoxPwd->hide(); ui->btnConnSub->hide(); ui->btnConn->hide(); ui->btnDisConn->hide(); ui->btnConnPWD->hide(); ui->btnCancel->hide(); ui->btnHideConn->hide(); ui->line->show(); ui->lbWaiting->hide(); ui->lbWaitingIcon->hide(); ui->btnInfo->hide(); btnProperty = new QPushButton(ui->wbg_3); btnProperty->resize(60, 20); btnProperty->move(335, 108); btnProperty->setText(tr("Property"));//"属性" btnProperty->setStyleSheet(funcBtnQss); btnProperty->setFocusPolicy(Qt::NoFocus); btnProperty->hide(); connect(btnProperty,SIGNAL(clicked()),this,SLOT(onBtnPropertyClicked())); this->mw = mainWindow; this->cf = confForm; this->ks = ksnm; this->isSelected = false; this->isActive = false; this->setAttribute(Qt::WA_Hover,true); this->installEventFilter(this); ui->lePassword->setAttribute(Qt::WA_Hover,true); ui->lePassword->installEventFilter(this); ui->btnInfo->setAttribute(Qt::WA_Hover,true); ui->btnInfo->installEventFilter(this); // connect(ui->lePassword, SIGNAL(returnPressed()), this, SLOT(on_btnConnPWD_clicked())); ui->btnConn->setShortcut(Qt::Key_Return);//将字母区回车键与连接按钮绑定在一起 ui->btnConnSub->setShortcut(Qt::Key_Return);//点击连接按钮触发回车键 this->waitTimer = new QTimer(this); connect(waitTimer, SIGNAL(timeout()), this, SLOT(waitAnimStep())); connect(mw, &MainWindow::reConnectWifi, this, [ = ](const QString& uuid) { if (isActive) { QThread *t = new QThread(); BackThread *bt = new BackThread(); bt->moveToThread(t); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, &QThread::started, bt, [ = ]() { mw->is_wifi_reconnected = 1; bt->execReconnWIfi(uuid); }); t->start(); } }); connect(mw, &MainWindow::startReconnectWifi, this, [ = ](const QString &ssid) { if (ssid == this->wifiName && !this->isWaiting) { this->startWifiWaiting(true); } }); connect(mw, &MainWindow::stopReconnectWifi, this, [ = ](const QString &ssid, const int &result) { if (ssid == this->wifiName) { qDebug()<<"Reconnect "<lbName); lbFreq = new QLabel(ui->lbName); lbFreq->setAlignment(Qt::AlignCenter); lbFreq->setEnabled(false); lbFreq->setFixedHeight(14); lbFreq->setStyleSheet("QLabel{border: 1px solid rgba(165, 165, 165, 1);" "background: transparent; color: rgba(0, 0, 0, 0.5);" "border-radius: 3px; font-size: 10px;" "color: rgba(165, 165, 165, 1)}"); lbFreq->setContentsMargins(2, 0, 2, 0); lbFreq->hide(); lbPwdTip = new QLabel(ui->lbName); lbPwdTip->setAlignment(Qt::AlignCenter); lbPwdTip->setEnabled(false); lbPwdTip->setFixedHeight(14); lbPwdTip->setStyleSheet("QLabel{border: 1px solid rgba(165, 165, 165, 1);" "background: transparent; color: rgba(0, 0, 0, 0.5);" "border-radius: 3px; font-size: 10px;" "color: rgba(165, 165, 165, 1)}"); lbPwdTip->setContentsMargins(2, 0, 2, 0); lbPwdTip->hide(); lbPwdTip->setText(tr("Password Incorrect")); lbNameText = new QLabel(ui->lbName); lbNameLyt->setContentsMargins(0, 0, 0, 0); lbNameLyt->setSpacing(8); lbNameLyt->addWidget(lbNameText); lbNameLyt->addWidget(lbFreq); lbNameLyt->addWidget(lbPwdTip); lbNameLyt->addStretch(); ui->lbName->setLayout(lbNameLyt); connect(this, SIGNAL(requestRefreshWifiList()), mw, SLOT(onRequestRefreshWifiList())); m_menu = new QMenu();//右键菜单 connect(m_menu, &QMenu::triggered, this, &OneConnForm::onMenuTriggered); } OneConnForm::~OneConnForm() { delete ui; if (m_menu) { delete m_menu; m_menu = nullptr; } } void OneConnForm::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::RightButton && this->wifiBSsid != "--") { m_menu->clear(); if (this->isTopItem) { m_menu->addAction(new QAction(tr("Disconnect"), this)); } else { m_menu->addAction(new QAction(tr("Connect"), this)); } if (checkIsSaved()) m_menu->addAction(new QAction(tr("Forget"), this)); m_menu->move(cursor().pos()); m_menu->show(); } emit selectedOneWifiForm(wifiBSsid, H_WIFI_ITEM_BIG_EXTEND); } bool OneConnForm::checkIsSaved() { QString name = this->wifiName; QString currStr = "nmcli -f connection.type connection show \"" + name.replace("\"","\\\"") + "\""; int status = system(currStr.toUtf8().data()); if (status != 0){ qDebug()<<"There is no configuration for wifi "<wifiName; return false; } else { return true; } } /** * @brief OneConnForm::onMenuTriggered 点击右键菜单选项的槽函数 * @param action */ bool OneConnForm::onMenuTriggered(QAction *action) { if (action->text() == tr("Disconnect")) { this->on_btnDisConn_clicked(); return true; } else if (action->text() == tr("Connect")) { if (ui->lePassword->isVisible()) { if (ui->btnConnPWD->isEnabled()) { this->on_btnConnPWD_clicked(); } else { ui->lePassword->selectAll(); } } else { this->on_btnConn_clicked(); } return true; } else if (action->text() == tr("Forget")) { QString name = this->wifiName; QString currStr = "nmcli connection delete \"" + name.replace("\"","\\\"") + "\""; int status = system(currStr.toUtf8().data()); if (status != 0){ qDebug()<<"Delete wifi failed. wifi="<wifiName; return false; } return true; } } void OneConnForm::onBtnPropertyClicked() { //WORKAROUND::ukui-control-center启动会出现rfkill僵尸进程 //添加sleep后可以正常打开 //此处sleep了10毫秒 QProcess::startDetached(QString("bash -c \"sleep 0.01; ukui-control-center --netconnect;\"")); } //事件过滤器 bool OneConnForm::eventFilter(QObject *obj, QEvent *event) { if (obj == ui->btnInfo) { if (event->type() == QEvent::HoverEnter) { ui->leInfo_1->setStyleSheet(leQssHigh); ui->leInfo_2->setStyleSheet(leQssHigh); ui->leInfo_3->setStyleSheet(leQssHigh); return true; } else if(event->type() == QEvent::HoverLeave) { ui->leInfo_1->setStyleSheet(leQssLow); ui->leInfo_2->setStyleSheet(leQssLow); ui->leInfo_3->setStyleSheet(leQssLow); return true; } } else if (obj == this) { if(event->type() == QEvent::HoverEnter) { if (!this->isTopItem) { if (!this->isSelected) { ui->btnConn->show(); ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(156,156,156,0.1);}"); ui->wbg->show(); } } return true; } else if (event->type() == QEvent::HoverLeave) { ui->btnConn->hide(); ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(156,156,156,0);}"); ui->wbg->hide(); return true; } } if (obj == ui->lePassword) { if (event->type() == QEvent::MouseButtonPress) { this->setLePassword(); } else { return false; } } return QWidget::eventFilter(obj,event); } // 是否当前连接的网络,字体设置不同 void OneConnForm::setAct(bool isAct) { if (isAct) { ui->lbConned->show(); btnProperty->show(); } else { ui->lbConned->hide(); btnProperty->hide(); } isActive = isAct; } void OneConnForm::setLePassword() { if (ui->lePassword->text() == "Input Password..." || ui->lePassword->text() == "输入密码...") { ui->lePassword->setText(tr("")); ui->lePassword->setEchoMode(QLineEdit::Password); ui->checkBoxPwd->setChecked(false); } } //点击窗口最上面的item时 void OneConnForm::setTopItem(bool isSelected) { if (isSelected) { resize(W_ITEM, H_ITEM_BIG); ui->wbg_3->show(); ui->leInfo_1->show(); ui->leInfo_2->show(); ui->leInfo_3->show(); this->isSelected = true; } else { resize(W_ITEM, H_ITEM); ui->lePassword->setText(""); ui->wbg_3->hide(); ui->leInfo_1->hide(); ui->leInfo_2->hide(); ui->leInfo_3->hide(); this->isSelected = false; } ui->wbg->hide(); ui->wbg_2->hide(); ui->lbSignal->show(); ui->lePassword->hide(); ui->checkBoxPwd->hide(); ui->line->hide(); ui->btnConn->hide(); ui->btnConnPWD->hide(); ui->btnHideConn->hide(); ui->btnInfo->show(); if (isConnected) { if (this->isWaiting) { ui->btnDisConn->hide(); } else { ui->btnDisConn->show(); } } else { ui->btnDisConn->hide(); } this->isTopItem = true; } // 点击窗口下面的item时 void OneConnForm::setSelected(bool isSelected, bool isCurrName) { if (isSelected) { resize(W_ITEM, H_ITEM_BIG); ui->line->move(X_LINE_BIG_EXTEND, Y_LINE_BIG_EXTEND); ui->wbg->hide(); ui->wbg_2->hide(); ui->wbg_3->show(); ui->leInfo_1->show(); ui->leInfo_2->show(); ui->leInfo_3->show(); ui->btnConn->hide(); ui->btnConnSub->show(); this->isSelected = true; } else { resize(W_ITEM, H_ITEM); ui->lePassword->setText(""); ui->lePassword->setStyleSheet("QLineEdit{border:1px solid rgba(61,107,229,1);border-radius:4px;background:rgba(0,0,0,0.2);}"); ui->lePassword->setEchoMode(QLineEdit::Password); ui->checkBoxPwd->setChecked(false); ui->line->move(X_LINE, Y_LINE); ui->wbg->show(); ui->wbg_2->hide(); ui->wbg_3->hide(); ui->leInfo_1->hide(); ui->leInfo_2->hide(); ui->leInfo_3->hide(); if (isCurrName) { ui->btnConn->show(); } else { ui->btnConn->hide(); } ui->btnConnSub->hide(); this->isSelected = false; } ui->lePassword->hide(); ui->checkBoxPwd->hide(); ui->btnConnPWD->hide(); ui->lbSignal->show(); ui->btnDisConn->hide(); ui->btnHideConn->hide(); ui->btnInfo->hide(); this->isTopItem = false; } // 点击连接隐藏wifi的item时 void OneConnForm::setHideItem(bool isHideItem, bool isShowHideBtn) { if (isHideItem) { ui->lbName->move(14, 20); ui->wbg->hide(); ui->btnConn->hide(); } else { ui->lbName->move(62, 8); ui->wbg->show(); ui->btnConn->show(); } if (isShowHideBtn) { ui->btnHideConn->show(); } else{ ui->btnHideConn->hide(); } } void OneConnForm::setConnedString(bool showLable, QString str, QString str1) { if (!showLable) { ui->lbConned->setText(str1); ui->lbConned->hide(); ui->lbName->move(63, 18); } else { ui->lbConned->setText(str); } } void OneConnForm::setWifiName(QString name, QString bssid, QString uuid, QString ifname, bool isHW, bool is9006C) { QFontMetrics fontMetrics(lbNameText->font()); QString showname = fontMetrics.elidedText(name, Qt::ElideRight, 200); lbNameText->setText(showname); wifiName = name; wifiBSsid = bssid; wifiUuid = uuid; wifiIfName = ifname; isHuaweiPC = isHW; isHuaWei9006C = is9006C; } QString OneConnForm::getName() { return wifiName; } void OneConnForm::setRate(QString rate) { QString txt(tr("Rate"));//"速率" this->setToolTip("  " + txt + ": " + rate + "  "); this->setToolTip(txt + ":" + rate); } void OneConnForm::setLine(bool isShow) { if (isShow) { ui->line->show(); } else { ui->line->hide(); } } void OneConnForm::setSignal(QString lv, QString secu, QString category, bool hasSignalStrength) { this->m_signal = lv.toInt(); int signal = lv.toInt(); if (secu == "--" || secu == "") { hasPwd = false; } else { hasPwd = true; } QString signalIcon; if (isHuaweiPC) { signalIcon = "QLabel{border-radius:0px;background:url(:/res/hw/wifi"; } else { signalIcon = "network-wireless-signal-"; } if (isHuaWei9006C) { if ("1" == category) { signalIcon += "6"; } else if ("2" == category) { signalIcon += "6+"; } } if (signal > 75) { signalIcon += isHuaweiPC ? (hasPwd ? "-full-pwd.png);}" : "-full.png);}") : (hasPwd ? "excellent-secure-symbolic" : "excellent-symbolic"); } if (signal > 55 && signal <= 75) { signalIcon += isHuaweiPC ? (hasPwd ? "-high-pwd.png);}" : "-high.png);}") : (hasPwd ? "good-secure-symbolic" : "good-symbolic"); } if (signal > 35 && signal <= 55) { signalIcon += isHuaweiPC ? (hasPwd ? "-medium-pwd.png);}" : "-medium.png);}") : (hasPwd ? "ok-secure-symbolic" : "ok-symbolic"); } if (signal <= 35) { if (hasSignalStrength) { signalIcon += isHuaweiPC ? (hasPwd ? "-low-pwd.png);}" : "-low.png);}") : (hasPwd ? "weak-secure-symbolic" : "weak-symbolic"); } else { signalIcon += isHuaweiPC ? "-none.png);}" : (hasPwd ? "none-secure-symbolic" : "none-symbolic"); } } if (!isHuaweiPC) { ui->lbSignal->setPixmap(QIcon::fromTheme(signalIcon).pixmap(32, 32)); ui->lbSignal->setProperty("useIconHighlightEffect", 0x10); } else { ui->lbSignal->setStyleSheet(signalIcon); } } int OneConnForm::getSignal() { return this->m_signal; } void OneConnForm::setWifiInfo(QString str1, QString str2, QString str3, int freq) { //freq 0:含2.4G和5G, 1:只有2.4G, 2:只有5G lbFreq->show(); if (freq == 1) { //freq ~ 2.4G lbFreq->setText("2.4G"); } else if (freq == 2) { //freq ~ 5G lbFreq->setText("5G"); } else { //freq ~ 5G&2.4G lbFreq->setText("2.4/5G"); } if (str1 == "--" || str1 == ""){ str1 = tr("None"); }; QString strSecurity = QString(tr("WLAN Security:")); QString strSignal = QString(tr("Signal:")); QString strMAC = QString(tr("MAC:")); wifiSecu = str1; ui->leInfo_1->setText(strSecurity + str1); ui->leInfo_2->setText(strSignal + str2); ui->leInfo_3->setText(strMAC + str3); } void OneConnForm::slotConnWifi() { this->startWifiWaiting(true); emit sigConnWifi(wifiName, wifiIfName); } void OneConnForm::slotConnWifiPWD() { this->startWifiWaiting(true); emit sigConnWifiPWD(wifiName, ui->lePassword->text(), connType, wifiSecu, wifiIfName); } //点击后断开wifi网络 void OneConnForm::on_btnDisConn_clicked() { if (mw->is_stop_check_net_state == 1) { return; } qDebug()<<"DisConnect button about wifi net is clicked, current wifi name is "<canReconnectWifiList.contains(wifiName)) { mw->canReconnectWifiList.removeOne(wifiName); } this->startWifiWaiting(false); mw->is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; //mw->on_btnHotspotState(); //kylin_network_set_con_down(wifiName.toUtf8().data()); kylin_network_set_con_down(wifiUuid.toUtf8().data()); disconnect(this, SIGNAL(selectedOneWifiForm(QString,int)), mw, SLOT(oneTopWifiFormSelected(QString,int))); emit requestHandleWifiDisconn(); } //点击列表item扩展时会出现该按钮 用于连接网络 void OneConnForm::on_btnConnSub_clicked() { on_btnConn_clicked(); } //无需密码的wifi连接 void OneConnForm::on_btnConn_clicked() { BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); //当有其他wifi正在连接时,禁止点击连接按钮 if (mw->is_stop_check_net_state == 1 || iface->wstate == DEVICE_CONNECTING) { delete iface; delete bt; return; } delete iface; delete bt; if (lbPwdTip->isVisible() && this->hasPwd) { this->slotConnWifiResult(2); return; } qDebug()<<"A button named btnConn about wifi net is clicked."; toConnectWirelessNetwork(); } void OneConnForm::toConnectWirelessNetwork() { if (wifiSecu.contains("802.1x", Qt::CaseInsensitive)) { //企业wifi WifiConfig wc; bool isConfiged = getWifiConfig(wc, this->wifiName); if (isConfiged && wc.eap != "peap") { mw->is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; QThread *t = new QThread(); BackThread *bt = new BackThread(); bt->moveToThread(t); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, SIGNAL(started()), this, SLOT(slotConnWifi())); connect(this, SIGNAL(sigConnWifi(QString, QString)), bt, SLOT(execConnWifi(QString, QString))); connect(bt, SIGNAL(connDone(int)), mw, SLOT(connWifiDone(int))); connect(bt, SIGNAL(connDone(int)), this, SLOT(slotConnWifiResult(int))); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); return; } WpaWifiDialog * wpadlg = new WpaWifiDialog(mw, mw, this->wifiName); QPoint pos = QCursor::pos(); QRect primaryGeometry; for (QScreen *screen : qApp->screens()) { if (screen->geometry().contains(pos)) { primaryGeometry = screen->geometry(); } } if (primaryGeometry.isEmpty()) { primaryGeometry = qApp->primaryScreen()->geometry(); } wpadlg->move(primaryGeometry.width() / 2 - wpadlg->width() / 2, primaryGeometry.height() / 2 - wpadlg->height() / 2); wpadlg->show(); #if 0 connect(wpadlg, &WpaWifiDialog::conn_done, this, [ = ]() { QString txt(tr("Conn WLAN Success")); mw->objKyDBus->showDesktopNotify(txt); mw->on_btnWifiList_clicked(); }); connect(wpadlg, &WpaWifiDialog::conn_failed, this, [ = ]() { QString txt(tr("Confirm your WLAN password or usable of wireless card")); mw->objKyDBus->showDesktopNotify(txt); mw->on_btnWifiList_clicked(); }); #endif return; } if (ui->lbConned->text() == "--" || ui->lbConned->text() == " ") { if (!isWifiConfExist(wifiName)) { //没有配置文件,使用有密码的wifi连接 psk_flag = 0; on_btnConnPWD_clicked(); return; } } //有配置文件,需要判断一下当前配置文件wifi安全性是不是wpa-eap,若是,需要把原配置文件删除,重新配置 QProcess * process = new QProcess(this); connect(process, static_cast(&QProcess::finished), this, [ = ]() { process->deleteLater(); }); connect(process, &QProcess::readyReadStandardOutput, this, [ = ]() { QString str = process->readAllStandardOutput(); key_mgmt = str.mid(str.lastIndexOf(":") + 1).trimmed(); }); process->start(QString("nmcli -f 802-11-wireless-security.key-mgmt connection show \"%1\"").arg(wifiName)); process->waitForFinished(); QString cur_secu; if (wifiSecu.contains("WPA2") && wifiSecu.contains("WPA3")) cur_secu = "wpa-psk"; else if (wifiSecu.contains("WPA3")) cur_secu = "sae"; else if (wifiSecu.contains("--")) cur_secu = "--"; else cur_secu = "wpa-psk"; if (!hasPwd && !key_mgmt.isEmpty()) { QString cmdStr = "nmcli connection delete \"" + wifiName + "\""; Utils::m_system(cmdStr.toUtf8().data()); psk_flag = 0; if (lbPwdTip->isVisible()) { lbPwdTip->hide(); mw->m_wifi_list_pwd_changed.removeOne(wifiName); } toConnectWirelessNetwork(); return; } else if (!key_mgmt.isEmpty() && QString::compare(key_mgmt, cur_secu) != 0) { //原配置文件与当前加密方式不一致,删掉,请求输入新的密码 QString cmdStr = "nmcli connection delete \"" + wifiName + "\""; Utils::m_system(cmdStr.toUtf8().data()); psk_flag = 0; slotConnWifiResult(2); //现在已无配置文件,申请输入密码 return; } if (isWifiConfExist(wifiName)) { //有配置文件,获取密码存储策略 QProcess * process = new QProcess(this); process->start(QString("nmcli -f 802-11-wireless-security.psk-flags connection show \"%1\"").arg(wifiName)); connect(process, static_cast(&QProcess::finished), this, [ = ]() { process->deleteLater(); }); connect(process, &QProcess::readyReadStandardOutput, this, [ = ]() { //QString str = process->readAllStandardOutput(); //psk_flag = str.mid(str.lastIndexOf(" ") - 1, 1).toInt(); QString str = process->readAllStandardOutput(); QString regExpPattern("[ ][0-9][ ((]"); QRegExp regExpTest(regExpPattern); int pos = str.indexOf(regExpTest); psk_flag = str.mid(pos,2).trimmed().toInt(); }); process->waitForFinished(); } if (key_mgmt == "wpa-psk" && this->getPskFlag() == 2) { // //当设置为每次询问密码时执行 // QPoint pos = QCursor::pos(); // QRect primaryGeometry; // for (QScreen *screen : qApp->screens()) { // if (screen->geometry().contains(pos)) { // primaryGeometry = screen->geometry(); // } // } // if (primaryGeometry.isEmpty()) { // primaryGeometry = qApp->primaryScreen()->geometry(); // } // QApplication::setQuitOnLastWindowClosed(false); // WiFiConfigDialog *wifiConfigDialog = new WiFiConfigDialog(); // wifiConfigDialog->move(primaryGeometry.width() / 2 - wifiConfigDialog->width() / 2, primaryGeometry.height() / 2 - wifiConfigDialog->height() / 2); // wifiConfigDialog->show(); // wifiConfigDialog->raise(); // return; } if (psk_flag != 0) { //未为所有用户存储密码 QString homePath = getenv("HOME"); if (QFile(QString("%1/.config/%2.psk").arg(homePath).arg(wifiName)).exists()) { //已为该用户存储密码 mw->is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; QThread *t = new QThread(); BackThread *bt = new BackThread(); bt->moveToThread(t); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, &QThread::started, this, [ = ]() { this->startWifiWaiting(true); QString cmdStr = "nmcli connection up '" + wifiName + "' passwd-file " + homePath +"/.config/" + wifiName + ".psk"; qDebug()<<"Trying to connect wifi. ssid="<sigConnWifiPsk(cmdStr); }); connect(this, SIGNAL(sigConnWifiPsk(QString)), bt, SLOT(execConnWifiPsk(QString))); connect(bt, &BackThread::connDone, this, [ = ](int res) { this->stopWifiWaiting(true); mw->is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; if (res) { QFile::remove(QString("%1/.config/%2.psk").arg(homePath).arg(wifiName).toUtf8()); } mw->connWifiDone(res); }); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); } else { //没有为该用户存储密码 slotConnWifiResult(2); } return; } else { //为所有用户存储密码 QString homePath = getenv("HOME"); QFile::remove(QString("%1/.config/%2.psk").arg(homePath).arg(wifiName).toUtf8()); //删除密码文件 } mw->is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; m_connWithPwd = false; QThread *t = new QThread(); BackThread *bt = new BackThread(); bt->moveToThread(t); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, SIGNAL(started()), this, SLOT(slotConnWifi())); connect(this, SIGNAL(sigConnWifi(QString, QString)), bt, SLOT(execConnWifi(QString, QString))); connect(bt, SIGNAL(connDone(int)), mw, SLOT(connWifiDone(int))); // connect(bt, SIGNAL(connDone(int)), this, SLOT(slotConnWifiResult(int))); connect(bt,&BackThread::connDone,this,[=](int res){ this->stopWifiWaiting(true); slotConnWifiResult(res); }); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); } //需要密码的wifi连接 void OneConnForm::on_btnConnPWD_clicked() { BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); //当有其他wifi正在连接时,禁止点击连接按钮 if (iface->wstate == DEVICE_CONNECTING) { delete iface; delete bt; return; } mw->m_is_inputting_wifi_password = false; //点击连接表示密码输入已完成 m_connWithPwd = true; qDebug()<<"A button named btnConnPWD about wifi net is clicked."; if (lbPwdTip->isVisible()) { QString modifyCmd = "nmcli connection modify \""+ wifiName + "\" " + "802-11-wireless-security.psk " + ui->lePassword->text(); int mdf_res = system(modifyCmd.toUtf8().data()); qDebug()<<"Modified wifi password, cmd="<hide(); mw->m_wifi_list_pwd_changed.removeOne(wifiName); } if (this->getPskFlag() != 0) { // QString cmdStr = 0; QString homePath = getenv("HOME"); QFile *passwdFile = new QFile(QString("%1/.config/%2.psk").arg(homePath).arg(wifiName)); if (passwdFile->open(QIODevice::ReadWrite)) { passwdFile->write(QString("802-11-wireless-security.psk:%1").arg(ui->lePassword->text()).toUtf8()); passwdFile->close(); // cmdStr = "nmcli connection up " + wifiName + " passwd-file " + homePath +"/.config/" + wifiName + ".psk"; } mw->is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; QThread *t = new QThread(); BackThread *bt = new BackThread(); bt->moveToThread(t); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, &QThread::started, this, [ = ]() { this->startWifiWaiting(true); QString cmdStr = "nmcli connection up '" + wifiName + "' passwd-file " + homePath +"/.config/" + wifiName + ".psk"; qDebug()<<"Trying to connect wifi. ssid="<sigConnWifiPsk(cmdStr); }); connect(this, SIGNAL(sigConnWifiPsk(QString)), bt, SLOT(execConnWifiPsk(QString))); connect(bt, &BackThread::connDone, this, [ = ](int res) { this->stopWifiWaiting(true); mw->is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; if (res) { QFile::remove(QString("%1/.config/%2.psk").arg(homePath).arg(wifiName).toUtf8()); } mw->connWifiDone(res); }); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); } if (! mw->is_stop_check_net_state) { mw->is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; QThread *t = new QThread(); BackThread *bt = new BackThread(); bt->moveToThread(t); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, SIGNAL(started()), this, SLOT(slotConnWifiPWD())); connect(this, SIGNAL(sigConnWifiPWD(QString, QString, QString, QString, QString)), bt, SLOT(execConnWifiPWD(QString, QString, QString, QString, QString))); connect(bt, SIGNAL(connDone(int)), mw, SLOT(connWifiDone(int))); connect(bt, SIGNAL(connDone(int)), this, SLOT(slotConnWifiResult(int))); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); } } //点击后弹出连接隐藏wifi网络窗口 void OneConnForm::on_btnHideConn_clicked() { QApplication::setQuitOnLastWindowClosed(false); DlgHideWifi *connHidWifi = new DlgHideWifi(0, mw); connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); connHidWifi->show(); } bool OneConnForm::isWifiConfExist(QString netName) { //dbusWifiMac = ""; //这个函数之前是用来获取已经连接的wifi的MAC地址 QDBusInterface m_interface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings", "org.freedesktop.NetworkManager.Settings", QDBusConnection::systemBus() ); QDBusReply> m_reply = m_interface.call("ListConnections"); QList m_objNets = m_reply.value(); foreach (QDBusObjectPath objNet, m_objNets){ QDBusInterface m_interface("org.freedesktop.NetworkManager", objNet.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage reply = m_interface.call("GetSettings"); const QDBusArgument &dbusArg = reply.arguments().at( 0 ).value(); QMap> map; dbusArg >> map; for(QString key : map.keys() ){ QMap innerMap = map.value(key); if (key == "connection") { for (QString inner_key : innerMap.keys()) { if (inner_key == "id"){ if (netName == innerMap.value(inner_key).toString()) { return true; } } } } } } // end foreach (QDBusObjectPath objNet, m_objNets) return false; } bool OneConnForm::isInputtingPwd() { return ui->lePassword->isVisible(); } void OneConnForm::setlbPwdTipVisble(const bool &visible) { lbPwdTip->setVisible(visible); } //设置密码隐藏或可见 void OneConnForm::on_checkBoxPwd_clicked() { if (ui->lePassword->echoMode() == QLineEdit::Password) { ui->checkBoxPwd->setChecked(true); ui->lePassword->setEchoMode(QLineEdit::Normal); } else { ui->checkBoxPwd->setChecked(false); ui->lePassword->setEchoMode(QLineEdit::Password); } } //void OneConnForm::on_checkBoxPwd_released() //{ // ui->checkBoxPwd->setChecked(false); // ui->lePassword->setEchoMode(QLineEdit::Password); //} void OneConnForm::on_lePassword_textEdited(const QString &arg1) { ui->lePassword->setStyleSheet("QLineEdit{border:2px solid rgba(28, 47, 146, 1);border-radius:4px;background:rgba(0,0,0,0.2);}"); if (ui->lePassword->text().size() < 6) { ui->btnConnPWD->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);color:white;font-size:14px;}" "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(255,255,255,0.2);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0.08);}"); ui->btnConnPWD->setEnabled(false); disconnect(ui->lePassword, SIGNAL(returnPressed()), this, SLOT(on_btnConnPWD_clicked())); if (ui->lePassword->text().size() == 0) { ui->lePassword->setStyleSheet("QLineEdit{border:1px solid rgba(61,107,229,1);border-radius:4px;background:rgba(0,0,0,0.2);}"); } } else { ui->btnConnPWD->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);color:white;font-size:14px;}" "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}"); connect(ui->lePassword, SIGNAL(returnPressed()), this, SLOT(on_btnConnPWD_clicked())); ui->btnConnPWD->setEnabled(true); } } void OneConnForm::on_btnInfo_clicked() { QPoint pos = QCursor::pos(); QRect primaryGeometry; for (QScreen *screen : qApp->screens()) { if (screen->geometry().contains(pos)) { primaryGeometry = screen->geometry(); } } if (primaryGeometry.isEmpty()) { primaryGeometry = qApp->primaryScreen()->geometry(); } BackThread *bt = new BackThread(); QString connProp = bt->getConnProp(wifiUuid); QStringList propList = connProp.split("|"); ConnProperties connection; // QString v4method, addr, mask, gateway, dns, v6method, v6addr; foreach (QString line, propList) { if (line.startsWith("method:")) { connection.v4method = line.split(":").at(1); } if (line.startsWith("v4addr:")) { connection.v4addr = line.split(":").at(1); } if (line.startsWith("mask:")) { connection.mask = line.split(":").at(1); } if (line.startsWith("v6method:")) { connection.v6method = line.split(":").at(1); } if (line.startsWith("v6addr:")) { connection.v6addr = line.right(line.length() - line.indexOf(":") - 1); } if (line.startsWith("gateway:")) { connection.gateway= line.split(":").at(1); } if (line.startsWith("dns:")) { connection.dns = line.split(":").at(1); } if (line.startsWith("type:")) { connection.type = line.split(":").at(1); } } connection.connName = wifiName; connection.uuidName = wifiUuid; connection.isActConf = this->isActive; // qDebug()<<"v4method:"<setProp(connection); qDebug() << Q_FUNC_INFO << __LINE__ << wifiName << wifiUuid; cf->move(primaryGeometry.width() / 2 - cf->width() / 2, primaryGeometry.height() / 2 - cf->height() / 2); cf->show(); cf->raise(); bt->deleteLater(); } // Wifi连接结果,0成功 1失败 2没有配置文件 void OneConnForm::slotConnWifiResult(int connFlag) { qDebug()<<"Function slotConnWifiResult receives a number: "<isHuaWeiPC) { //network-manager可能会连接到其他bssid对应的网络,改成我们想要连接的那个网络 QtConcurrent::run([=]() { QString currConnWifiBssid; KylinDBus myKylinDbus; QStringList wifiListInfo; QList wifiSsidAndUuid = myKylinDbus.getAtiveWifiBSsidUuid(wifiListInfo); if (wifiSsidAndUuid.size() > 1 && wifiSsidAndUuid.at(1).length() == 17) { qDebug() << "想要连接的wifi的bssid是 " << wifiSsidAndUuid.at(1); currConnWifiBssid = wifiSsidAndUuid.at(1); } qDebug() << "实际连接的wifi的bssid是 " << wifiBSsid; if (currConnWifiBssid != wifiBSsid && !currConnWifiBssid.isEmpty()) { QString modityCmd = "nmcli connection modify \""+ wifiName + "\" " + "802-11-wireless.bssid " + wifiBSsid; int res = system(modityCmd.toUtf8().data()); qDebug()<<"Modified bssid for wifi. ssid="<currSelNetName = ""; emit selectedOneWifiForm(wifiBSsid, H_WIFI_ITEM_SMALL_EXTEND); resize(W_ITEM, H_ITEM_MIDDLE); ui->wbg->hide(); ui->wbg_2->show(); ui->wbg_3->hide(); ui->leInfo_1->hide(); ui->leInfo_2->hide(); ui->leInfo_3->hide(); ui->btnHideConn->hide(); ui->btnDisConn->hide(); ui->btnConn->hide(); ui->btnConnSub->hide(); ui->line->move(X_LINE_SMALL_EXTEND, Y_LINE_SMALL_EXTEND); ui->lePassword->show(); ui->checkBoxPwd->show(); ui->btnConnPWD->show(); this->isSelected = true; //if (connFlag == 2) { // mw->is_stop_check_net_state = 0; //} else { // mw->is_stop_check_net_state = 0; // //connType = "RequestPassword"; //} //设置输入密码框被选中 ui->lePassword->setFocus(); // ui->lePassword->setEchoMode(QLineEdit::Password); ui->lePassword->selectAll(); // ui->checkBoxPwd->setChecked(false); } this->stopWifiWaiting(true); mw->is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; } void OneConnForm::waitAnimStep() { QString qpmQss = "QLabel{background-image:url(':/res/s/conning-a/"; qpmQss.append(QString::number(this->waitPage)); qpmQss.append(".png');}"); ui->lbWaitingIcon->setStyleSheet(qpmQss); this->waitPage ++; if (this->waitPage > TOTAL_PAGE) { this->waitPage = 1; //循环播放8张图片 } this->countCurrentTime += FRAME_SPEED; if (this->countCurrentTime >= LIMIT_TIME) { QString cmd = "kill -9 $(pidof nmcli)"; //杀掉当前正在进行的有关nmcli命令的进程 int status = system(cmd.toUtf8().data()); if (status != 0) { qDebug()<<"execute 'kill -9 $(pidof nmcli)' in function 'waitAnimStep' failed"; } this->stopWifiWaiting(true); //动画超出时间限制,强制停止动画 mw->is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; } } void OneConnForm::startWifiWaiting(bool isToConnect) { this->isWaiting = true; if (isToConnect) { ui->btnCancel->show(); ui->lbWaiting->setStyleSheet("QLabel{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);}"); } else { ui->lbWaitingIcon->move(ui->lbWaitingIcon->x() - 24, ui->lbWaitingIcon->y()); ui->btnDisConn->hide(); ui->lbWaiting->setStyleSheet("QLabel{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);}"); } this->countCurrentTime = 0; this->waitPage = 1; //总共有8张图片 this->waitTimer->start(FRAME_SPEED); ui->lbWaiting->show(); ui->lbWaitingIcon->show(); mw->setTrayLoading(true); } void OneConnForm::stopWifiWaiting(bool isUpdateTrayIcon) { ui->lbWaitingIcon->move(380, 20); ui->btnCancel->hide(); this->isWaiting = false; this->waitTimer->stop(); ui->lbWaiting->hide(); ui->lbWaitingIcon->hide(); if (isUpdateTrayIcon) { mw->setTrayLoading(false); mw->getActiveInfoAndSetTrayIcon(); } } void OneConnForm::on_btnCancel_clicked() { // QString cmd = "kill -9 $(pidof nmcli)"; //杀掉当前正在进行的有关nmcli命令的进程 // int status = system(cmd.toUtf8().data()); // if (status != 0) { // qDebug()<<"execute 'kill -9 $(pidof nmcli)' in function 'on_btnCancel_clicked' failed"; // } KylinDBus myKylinDbus; QStringList wifiListInfo; QList wifiSsidAndUuid = myKylinDbus.getAtiveWifiBSsidUuid(wifiListInfo); if (wifiSsidAndUuid.size() >= 1 && wifiSsidAndUuid.at(0).length() != 17) { QString currentConnectWifiUuid = wifiSsidAndUuid.at(0); kylin_network_set_con_down(currentConnectWifiUuid.toUtf8().data()); } this->stopWifiWaiting(true); } int OneConnForm::getPskFlag() { QProcess * process = new QProcess(this); process->start(QString("nmcli -f 802-11-wireless-security.psk-flags connection show \"%1\"").arg(wifiName)); connect(process, static_cast(&QProcess::finished), this, [ = ]() { process->deleteLater(); }); connect(process, &QProcess::readyReadStandardOutput, this, [ = ]() { QString str = process->readAllStandardOutput(); QString regExpPattern("[ ][0-9][ ((]"); QRegExp regExpTest(regExpPattern); int pos = str.indexOf(regExpTest); psk_flag = str.mid(pos,2).trimmed().toInt(); }); process->waitForFinished(); return psk_flag; } /** * @brief OneConnForm::getWifiConfig * @param wc * @return */ bool OneConnForm::getWifiConfig(WifiConfig &wc, QString netName) { bool isConfiged = false; QDBusInterface m_interface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings", "org.freedesktop.NetworkManager.Settings", QDBusConnection::systemBus() ); QDBusReply> m_reply = m_interface.call("ListConnections"); QList m_objNets = m_reply.value(); foreach (QDBusObjectPath objNet, m_objNets){ QDBusInterface m_interface("org.freedesktop.NetworkManager", objNet.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage reply = m_interface.call("GetSettings"); const QDBusArgument &dbusArg = reply.arguments().at( 0 ).value(); QMap> map; dbusArg >> map; for(QString key : map.keys() ){ QMap innerMap = map.value(key); if (key == "connection") { for (QString inner_key : innerMap.keys()) { if (inner_key == "id"){ if (netName == innerMap.value(inner_key).toString()) { isConfiged = true; break; } } } } } if (isConfiged) { for(QString key : map.keys()) { QMap eapMap = map.value(key); if (key == "802-1x") { wc.connectName = netName; for (QString eap_key : eapMap.keys()) { if (eap_key == "ca-cert"){ qDebug() << "OneConnForm::getWifiConfig client-cert path = " << eapMap.value(eap_key).toString(); wc.caCert = eapMap.value(eap_key).toString(); } else if (eap_key == "client-cert"){ qDebug() << "OneConnForm::getWifiConfig client-cert path = " << eapMap.value(eap_key).toString(); wc.clientCert = eapMap.value(eap_key).toString(); } else if (eap_key == "eap") { wc.eap = eapMap.value(eap_key).toStringList().at(0); qDebug() << "OneConnForm::getWifiConfig eap = " << eapMap.value(eap_key).toStringList().at(0); } else if (eap_key == "identity") { wc.identity = eapMap.value(eap_key).toString(); } else if (eap_key == "private-key") { wc.privateKey = eapMap.value(eap_key).toString(); } else if (eap_key == "anonymous-identity") { wc.anonymousIdentity = eapMap.value(eap_key).toString(); } } } } return true; } } // end foreach (QDBusObjectPath objNet, m_objNets) return false; } kylin-nm/src/confform.cpp0000644000175000017500000010275414205345374014360 0ustar fengfeng/* * 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 //extern QString llname, lwname; ConfForm::ConfForm(QWidget *parent) : QDialog(parent), ui(new Ui::ConfForm) { ui->setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); //Qt::WindowStaysOnTopHint this->setWindowTitle(tr("edit network"));//"网络设置" this->setAttribute(Qt::WA_TranslucentBackground); this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); //需要添加 void paintEvent(QPaintEvent *event) 函数 //this->setWindowIcon(QIcon::fromTheme("indicator-china-weather", QIcon(":/res/x/setup.png")) ); QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); MyQss objQss; //use uniform ui style instead // labelQss = "QLabel{border:0px;color:rgba(255,255,255,0.97);background-color:transparent;}"; // cbxQss = "QComboBox{padding-left:20px;font-size:13px;color:rgba(255,255,255,0.91);" // "border:1px solid rgba(255, 255, 255, 0.05);border-radius:4px;background:rgba(255,255,255,0.08);}" // "QComboBox::drop-down{border:0px;width:30px;}" // "QComboBox::down-arrow{image:url(:/res/g/down_arrow.png);}" // "QComboBox QAbstractItemView {margin:0px 0px 0px 0px;padding: 0px 0px;border-radius:0px;background-color:#48484C;outline:0px;}" // "QComboBox QAbstractItemView::item{padding-left:17px;border-radius:0px;font-size:13px;color:rgba(255,255,255,0.91);height: 32px;background-color:#48484C;outline:0px;}" // "QComboBox QAbstractItemView::item:hover{padding-left:17px;border-radius:0px;font-size:13px;color:rgba(255,255,255,0.91);background-color:#3D6BE5;outline:0px;}"; // leQss = "QLineEdit{padding-left:20px;color:rgba(255,255,255,0.97);background:rgba(255,255,255,0.08);}"; // btnOffQss = "QPushButton[on=false]{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.08);color:white;font-size:14px;}" // "QPushButton[on=false]:Hover{border:0px solid rgba(255,255,255,0.1);border-radius:4px;background-color:rgba(255,255,255,0.1);}" // "QPushButton[on=false]:Pressed{border-radius:4px;background-color:rgba(255,255,255,0.08);}" // "QPushButton[on=true]{border:0px;border-radius:4px;background-color:rgba(244,244,244,0.12);color:white;font-size:14px;}" // "QPushButton[on=true]:Hover{border:0px solid rgba(244,244,244,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}" // "QPushButton[on=true]:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}"; // btnOnQss = "QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);color:white;font-size:14px;}" // "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}" // "QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);"; // lineQss = "background:rgba(156,156,156,0.1);"; ui->wdHead->setStyleSheet("#wdHead{border:none}"); ui->wgManual->setStyleSheet("#wgManual{border:none}"); ui->wdBottom->setStyleSheet("#wdBottom{border:none}"); ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:20px;}"); ui->leAddr->setContextMenuPolicy(Qt::NoContextMenu); ui->leName->setContextMenuPolicy(Qt::NoContextMenu); ui->leDns->setContextMenuPolicy(Qt::NoContextMenu); ui->leDns2->setContextMenuPolicy(Qt::NoContextMenu); ui->leGateway->setContextMenuPolicy(Qt::NoContextMenu); ui->leAddr_ipv6->setContextMenuPolicy(Qt::NoContextMenu); //设置网络名称的正则表达式 // ui->leName->setValidator(new QRegExpValidator(QRegExp("[^ \s]*"), ui->leName)); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->lineUp->hide(); ui->lineDown->hide(); ui->lbName->setText(tr("LAN name: "));//"网络名称:" ui->lbTxt1->setText(tr("Method: "));//"编辑IP设置:" ui->lbTxt2->setText(tr("Address: "));//"IP地址:" ui->lbTxt3->setText(tr("Netmask: "));//"子网掩码:" ui->lbTxt4->setText(tr("Gateway: "));//"默认网关:" ui->lbTxt5->setText(tr("DNS 1: "));//"首选DNS:" ui->lbTxt6->setText(tr("DNS 2: "));//"备选DNS:" ui->lbTxt_ipv6->setText(tr("Ipv6 Address: ")); ui->lbLeftupTitle->setText(tr("Edit Conn"));//"网络设置" ui->cbType->addItem(tr("Auto(DHCP)"));//"自动(DHCP)" ui->cbType->addItem(tr("Manual"));//"手动" connect(ui->cbType, SIGNAL(currentIndexChanged(int)), this, SLOT(cbTypeChanged(int))); ui->cbMask->addItem("255.255.255.0"); //24 ui->cbMask->addItem("255.255.254.0"); //23 ui->cbMask->addItem("255.255.252.0"); //22 ui->cbMask->addItem("255.255.0.0"); //16 ui->cbMask->addItem("255.0.0.0"); //8 connect(ui->cbMask, SIGNAL(currentIndexChanged(int)), this, SLOT(cbMaskChanged(int))); ui->btnCancel->setText(tr("Cancel"));//"取消" ui->btnSave->setText(tr("Save"));//"保存" ui->btnCreate->setText(tr("Ok"));//"确定" ui->btnCancel->setProperty("on",true); ui->btnSave->setProperty("on",false); ui->btnCreate->setProperty("on",false); ui->btnCancel->setStyleSheet(objQss.btnOffQss); ui->btnSave->setStyleSheet(objQss.btnOffQss); ui->btnCreate->setStyleSheet(objQss.btnOffQss); ui->btnCancel->setFocusPolicy(Qt::NoFocus); ui->btnSave->setFocusPolicy(Qt::NoFocus); ui->btnCreate->setFocusPolicy(Qt::NoFocus); // 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"); 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*$"); ui->leAddr->setValidator(new QRegExpValidator(rx, this)); ui->leGateway->setValidator(new QRegExpValidator(rx, this)); ui->leDns->setValidator(new QRegExpValidator(rx, this)); ui->leDns2->setValidator(new QRegExpValidator(rx, this)); ui->leAddr_ipv6->setValidator(new QRegExpValidator(ipv6_rx, this)); setModal(false); setEnableOfBtn(); } ConfForm::~ConfForm() { delete ui; } //void ConfForm::mousePressEvent(QMouseEvent *event) //{ // if (event->button() == Qt::LeftButton) { // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } // return QDialog::mousePressEvent(event); //} //void ConfForm::mouseReleaseEvent(QMouseEvent *event) //{ // this->isPress = false; //} //void ConfForm::mouseMoveEvent(QMouseEvent *event) //{ // if (this->isPress) { // this->move(this->winPos - (this->dragPos - event->globalPos())); // event->accept(); // } // return QDialog::mouseMoveEvent(event); //} //网络配置参数设置界面的显示内容 void ConfForm::setProp(ConnProperties connection) { isActWifi = false; ui->cbType->removeItem(1); if (connection.type != "vpn") { ui->cbType->addItem(tr("Manual")); if (connection.type == "wifi") { ui->leName->setEnabled(false); isActWifi = true; } } this->isActConf = connection.isActConf; ui->leName->setText(connection.connName); lastConnName = connection.connName; lastIpv4 = connection.v4addr; lastIpv6 = connection.v6addr; lastTypeIndex = ui->cbType->currentIndex(); netUuid = connection.uuidName; //qDebug() << Q_FUNC_INFO << __LINE__ << connName << uuidName; if ((connection.v4method == "auto" || connection.v4method == "") && (connection.v6method == "auto" || connection.v6method == "")) { ui->cbType->setCurrentIndex(0); cbTypeChanged(0); } else { ui->cbType->setCurrentIndex(1); cbTypeChanged(1); } if (connection.v6method == "manual") { ui->leAddr_ipv6->setText(connection.v6addr); } ui->leAddr->setText(connection.v4addr); ui->leGateway->setText(connection.gateway); // 配置中有多个DNS,只处理前两个 if (connection.dns.indexOf(",") != -1) { QStringList dnss = connection.dns.split(","); ui->leDns->setText(dnss.at(0)); ui->leDns2->setText(dnss.at(1)); } else { ui->leDns->setText(connection.dns); ui->leDns2->setText(""); } if (connection.mask == "24") { ui->cbMask->setCurrentIndex(0); } else if(connection.mask == "23") { ui->cbMask->setCurrentIndex(1); } else if(connection.mask == "22") { ui->cbMask->setCurrentIndex(2); } else if(connection.mask == "16") { ui->cbMask->setCurrentIndex(3); } else if(connection.mask == "8") { ui->cbMask->setCurrentIndex(4); } else { ui->cbMask->setCurrentIndex(0); } ui->btnSave->setEnabled(false); } //点击了创建新的网络的按钮 void ConfForm::on_btnCreate_clicked() { KylinDBus kylindbus; kylindbus.getWiredCardName(); QString mIfname; QString mask = ""; if (ui->cbMask->currentIndex() == 0) { mask = "24"; } else if(ui->cbMask->currentIndex() == 1) { mask = "23"; } else if(ui->cbMask->currentIndex() == 2) { mask = "22"; } else if(ui->cbMask->currentIndex() == 3) { mask = "16"; } else if(ui->cbMask->currentIndex() == 4) { mask = "8"; } else { mask = "24"; } if (kylindbus.multiWiredIfName.size() == 0) { QString tip(tr("Can not create new wired network for without wired card")); kylindbus.showDesktopNotify(tip); onConfformHide(); return; } else { mIfname = kylindbus.multiWiredIfName.at(0); } if (ui->cbType->currentIndex() == 1) { //在手动配置网络的情况下以及当前的IP参数有更改的情况下,检测IP冲突 if (!ui->leAddr->text().isEmpty()|| !ui->leAddr_ipv6->text().isEmpty()) { if (check_ip_conflict(mIfname)) { return; } } } QString name = ui->leName->text(); QString cmdStr; if(ui->cbType->currentIndex() == 0){ cmdStr = "nmcli connection add con-name '" + name + "' ifname '" + mIfname + "' type ethernet"; }else{ if (ui->leAddr->text().isEmpty()) { //只配置了ipv6地址 cmdStr = "nmcli connection add con-name '" + name + "' ifname '" + mIfname + "' type ethernet ipv4.method auto ipv6.method manual ipv6.address " + ui->leAddr_ipv6->text(); } else if (ui->leAddr_ipv6->text().isEmpty()) { //只配置了ipv4地址 cmdStr = "nmcli connection add con-name '" + name + "' ifname '" + mIfname + "' type ethernet ipv6.method auto ipv4.method manual ipv4.address " + ui->leAddr->text() + "/" + mask.toUtf8().data(); } else { cmdStr = "nmcli connection add con-name '" + name + "' ifname '" + mIfname + "' type ethernet ipv6.method manual ipv6.address " + ui->leAddr_ipv6->text() + " ipv4.method manual ipv4.address " + ui->leAddr->text() + "/" + mask.toUtf8().data(); } if(!ui->leGateway->text().isEmpty()){ cmdStr += " ipv4.gateway " + ui->leGateway->text(); } if(!ui->leDns->text().isEmpty()){ cmdStr += " ipv4.dns " + ui->leDns->text(); if(!ui->leDns2->text().isEmpty()){ cmdStr += "," + ui->leDns2->text(); } } } cmdStr += " connection.autoconnect yes connection.autoconnect-priority 0"; Utils::m_system(cmdStr.toUtf8().data()); if (ui->cbType->currentIndex() == 1) { //选择手动,配置Ipv4、掩码、网关 this->isCreateNewNet = true; newUuid = "--"; // this->saveNetworkConfiguration(); } else { //选择自动,则配置完成并发出桌面通知 QString txt(tr("New network already created")); kylindbus.showDesktopNotify(txt); } // if (!ui->leAddr_ipv6->text().isEmpty()) { // QString cmdStr = "nmcli connection modify '" + name + "' ipv6.method manual ipv6.addresses " + ui->leAddr_ipv6->text(); // Utils::m_system(cmdStr.toUtf8().data()); // } else { // QString cmdStr = "nmcli connection modify '" + name + "' ipv6.method auto"; // Utils::m_system(cmdStr.toUtf8().data()); // } onConfformHide(); qDebug() << '[confform]:Create' << cmdStr; } //点击了保存更改网络设置的按钮 void ConfForm::on_btnSave_clicked() { KylinDBus kylindbus; if (isActWifi) { kylindbus.getWirelessCardName(); QString mWifiIfname = kylindbus.dbusWiFiCardName; this->isCreateNewNet = false; if (mWifiIfname.isEmpty()) { QString notifyTxt(tr("Wireless card not exist")); kylindbus.showDesktopNotify(notifyTxt); return; } if (ui->cbType->currentIndex() == 1) { //在手动配置网络的情况下以及当前的IP参数有更改的情况下,检测IP冲突 if ((!ui->leAddr->text().isEmpty() && (ui->leAddr->text() != lastIpv4)) || (!ui->leAddr_ipv6->text().isEmpty() && (ui->leAddr_ipv6->text() != lastIpv6))) { if (check_ip_conflict(mWifiIfname)) { return; } } } this->saveNetworkConfiguration(); } else { kylindbus.getWiredCardName(); QString mIfname; if (kylindbus.multiWiredIfName.size() == 0) { QString tip(tr("Can not save wired network for without wired card")); kylindbus.showDesktopNotify(tip); //this->close(); onConfformHide(); return; } else { mIfname = kylindbus.multiWiredIfName.at(0); } //如果网络的名称已经修改,则删掉当前网络,新建一个网络 //修改为 直接modify 不删除不新建 QString name = ui->leName->text(); if (name != lastConnName) { // QString cmd = "nmcli connection delete '" + netUuid + "'"; // QString cmd = "nmcli connection modify '" + lastConnName + "' con-name '"+name+"'"; // int status = system(cmd.toUtf8().data()); // qDebug()<<"[confform]ooooooooooo: executed 'nmcli connection modify'. cmd="<start("/bin/bash",options); // connect(processAdd, static_cast(&QProcess::finished), this, [ = ]() { // processAdd->deleteLater(); // }); // connect(processAdd, &QProcess::channelReadyRead, this, [ = ]() { // QString str = processAdd->readAll(); // QString regExpPattern("[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}"); // QRegExp regExpTest(regExpPattern); // int pos = str.indexOf(regExpTest); // newUuid = str.mid(pos,36); //36是uuid的长度 if (ui->cbType->currentIndex() == 1) { //在手动配置网络的情况下以及当前的IP参数有更改的情况下,检测IP冲突 if ((!ui->leAddr->text().isEmpty() && (ui->leAddr->text() != lastIpv4)) || (!ui->leAddr_ipv6->text().isEmpty() && (ui->leAddr_ipv6->text() != lastIpv6))) { if (check_ip_conflict(mIfname)) { return; } } } this->saveNetworkConfiguration(); return; // }); // processAdd->waitForFinished(); } else { this->isCreateNewNet = false; newUuid = "--"; if (ui->cbType->currentIndex() == 1) { //在手动配置网络的情况下以及当前的IP参数有更改的情况下,检测IP冲突 if ((!ui->leAddr->text().isEmpty() && (ui->leAddr->text() != lastIpv4)) || (!ui->leAddr_ipv6->text().isEmpty() && (ui->leAddr_ipv6->text() != lastIpv6))) { if (check_ip_conflict(mIfname)) { return; } } } this->saveNetworkConfiguration(); } } QString txt(tr("New network settings already finished")); kylindbus.showDesktopNotify(txt); qDebug() << "[confform]Save!"; } void ConfForm::saveNetworkConfiguration() { //获取对应掩码的参数 QString mask = ""; if (ui->cbMask->currentIndex() == 0) { mask = "24"; } else if(ui->cbMask->currentIndex() == 1) { mask = "23"; } else if(ui->cbMask->currentIndex() == 2) { mask = "22"; } else if(ui->cbMask->currentIndex() == 3) { mask = "16"; } else if(ui->cbMask->currentIndex() == 4) { mask = "8"; } else { mask = "24"; } QString name = ui->leName->text(); QString dnss = ui->leDns->text(); if (ui->leDns2->text() != "") { dnss.append(","); dnss.append(ui->leDns2->text()); } //是选择的自动还是手动配置网络 if (ui->cbType->currentIndex() == 0) { qDebug() << Q_FUNC_INFO << __LINE__ << name << newUuid << ui->leAddr->text() << mask << ui->leGateway->text(); //kylin_network_set_automethod(name.toUtf8().data()); kylin_network_set_automethod(netUuid.toUtf8().data(), ui->leName->text().toUtf8().data()); if (this->isActConf && lastTypeIndex == 1 && ui->cbType->currentIndex() == 0) { //对于已经连接的网络,若由手动改为自动,则进行重连以保证配置生效 KylinDBus kylindbus; kylindbus.reConnectWiredNet(netUuid.toUtf8().data()); } } else { if (newUuid != "--" && newUuid != "" && !newUuid.isEmpty()) { qDebug() << Q_FUNC_INFO << __LINE__ << name << newUuid << ui->leAddr->text() << mask << ui->leGateway->text() << dnss; char *uuid = newUuid.toUtf8().data(); kylin_network_set(uuid,ui->leName->text().toUtf8().data(),ui->leAddr->text().toUtf8().data(),mask.toUtf8().data(), ui->leGateway->text().toUtf8().data(), dnss.toUtf8().data(), ui->leAddr_ipv6->text().toUtf8().data()); } else { qDebug() << "[confform]new:" << newUuid << "net:" << netUuid; qDebug() << Q_FUNC_INFO << __LINE__ << name << netUuid << ui->leAddr->text() << mask << ui->leGateway->text() << dnss; char *uuid = netUuid.toUtf8().data(); kylin_network_set(netUuid.toUtf8().data(), ui->leName->text().toUtf8().data(),ui->leAddr->text().toUtf8().data(), mask.toUtf8().data(), ui->leGateway->text().toUtf8().data(), dnss.toUtf8().data(), ui->leAddr_ipv6->text().toUtf8().data()); } } onConfformHide(); qDebug() << "[Confform] saveNetworkConfiguration Done!!"; } void ConfForm::showNotify(QString message) { QDBusInterface iface("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", QDBusConnection::sessionBus()); QList args; args<<(tr("kylin-nm")) <<((unsigned int) 0) <leAddr_ipv6->text().isEmpty() && ui->leAddr_ipv6->text() != "") { if (!ui->leAddr->text().isEmpty() && ui->leAddr->text() != "") { //ipv4地址不为空,需要验证是否冲突 QString arp_all_cmd = "arping -c 3 -f -I " + ifname + " -D " + ui->leAddr->text(); fp = popen(arp_all_cmd.toUtf8().data(),"r"); if(!fp) return false; fread(arp_all, 1, sizeof(arp_all), fp); pclose(fp); if (strstr(arp_all, "Received") && strstr(arp_all, " response(s)")) { QString arp_result = "arping -c 1 -f -I " + ifname + " -D " + ui->leAddr->text() + " | awk '{print $2}' | sed -n '3p'"; fp = popen(arp_result.toUtf8().data(),"r"); if(!fp) return false; fgets(ret,sizeof(ret),fp); pclose(fp); ret[strlen(ret)-1]=0; if ( ret != NULL ) { // if (!strcmp(ret,"0")) { // //printf("正常连接"); // return false; // } else { if (strcmp(ret,"0")) { //printf("ipv4地址冲突"); QString strInfo = tr("IPV4 address conflict, Please change IP"); // QString buffer = "notify-send -i network-offline " + strInfo; showNotify(strInfo); return true; } } } } if (ui->leAddr_ipv6->text().isEmpty() || ui->leAddr_ipv6->text() == "") { //未配置ipv6地址,跳过ipv6地址冲突检测 return false; } isIpv6Conflict = false; QProcess * process = new QProcess; if (this->isActWifi) { //指定无线网卡检测 process->start(QString("ping6 %1%%2").arg(ui->leAddr_ipv6->text()).arg(wcard)); } else { //指定有线网卡检测 process->start(QString("ping6 %1%%2").arg(ui->leAddr_ipv6->text()).arg(lcard)); } connect(process, static_cast(&QProcess::finished), this, [ = ]() { process->deleteLater(); }); connect(process, &QProcess::readyReadStandardOutput, this, [ = ]() { QString str = process->readAllStandardOutput(); if (!str.contains("PING")) { if (str.contains("unreachable")) { isIpv6Conflict = false; } else { //如果能ping通,需要看是不是当前本机连接的ipv6地址,如果是本机连接的,也不算冲突 if (this->isActWifi) { if (ui->leAddr_ipv6->text() == actWifiIpv6Addr) { //新地址与当前本机连接的wifi的ipv6地址一直,不算冲突 isIpv6Conflict = false; } else { isIpv6Conflict = true; } } else { if (ui->leAddr_ipv6->text() == actLanIpv6Addr) { //新地址与当前本机连接的有线的ipv6地址一直,不算冲突 isIpv6Conflict = false; } else { isIpv6Conflict = true; } } } process->close(); } }); connect(process, &QProcess::readyReadStandardError, this, [ = ]() { isIpv6Conflict = false; process->close(); }); process->waitForFinished(); if (isIpv6Conflict) { //printf("ipv6地址冲突"); QString strInfo = tr("IPV6 address conflict, Please change IP"); showNotify(strInfo); return true; } //printf("正常连接"); return false; } void ConfForm::changeEnableCheckIp() { canCheckIpConflict = true; } //点击取消按钮 void ConfForm::on_btnCancel_clicked() { onConfformHide(); } //根据需要设置的种类(自动或手动等)显示界面内容 void ConfForm::cbTypeChanged(int index) { if (isShowSaveBtn) { if (!isActWifi) { ui->leName->setEnabled(true); } ui->btnSave->show(); //显示保存按钮 ui->btnCreate->hide(); //隐藏创建按钮 ui->lbLeftupTitle->setText(tr("Edit Network")); } if (index == 0) { ui->lineUp->hide(); ui->lineDown->hide(); ui->wgManual->hide(); //ui->centralWidget->resize(432, 230); ui->centralWidget->setFixedSize(432, 230); ui->wdBottom->move(1, 170); this->setEnableOfBtn(); //this->resize(432, 230); this->setFixedSize(432, 230); } if (index == 1) { ui->lineUp->show(); ui->lineDown->show(); ui->wgManual->show(); //ui->centralWidget->resize(432, 510); ui->centralWidget->setFixedSize(432, 510); ui->wdBottom->move(1, 440); this->setEnableOfBtn(); //this->resize(432, 510); this->setFixedSize(432, 510); } if (index == 3) { setBtnEnableFalse(); if (!isActWifi) { ui->leName->setEnabled(true); } ui->btnSave->hide(); ui->btnCreate->show(); ui->lbLeftupTitle->setText(tr("Add Wired Network")); isShowSaveBtn = false; ui->lineUp->hide(); ui->lineDown->hide(); ui->wgManual->hide(); //ui->centralWidget->resize(432, 230); ui->centralWidget->setFixedSize(432, 230); ui->wdBottom->move(1, 170); //this->resize(432, 230); this->setFixedSize(432, 230); } } void ConfForm::cbMaskChanged(int index) { this->setEnableOfBtn(); } //编辑网络名称 void ConfForm::on_leName_textEdited(const QString &arg1) { this->setEnableOfBtn(); } //编辑网络ip void ConfForm::on_leAddr_textEdited(const QString &arg1) { this->setEnableOfBtn(); } //编辑ipv6地址 void ConfForm::on_leAddr_ipv6_textChanged(const QString &arg1) { this->setEnableOfBtn(); } //编辑网络网关 void ConfForm::on_leGateway_textEdited(const QString &arg1) { this->setEnableOfBtn(); } //编辑网络DNS void ConfForm::on_leDns_textEdited(const QString &arg1) { this->setEnableOfBtn(); } //编辑网络备用DNS void ConfForm::on_leDns2_textEdited(const QString &arg1) { this->setEnableOfBtn(); } //设置界面按钮是否可点击 void ConfForm::setEnableOfBtn() { // if(!isEditingAlready()){ // this->setBtnEnableFalse(); // return; // } if (ui->leName->text().size() == 0 ) { this->setBtnEnableFalse(); return; } if (ui->cbType->currentIndex() == 1) { if(ui->leAddr->text().isEmpty() || !this->getTextEditState(ui->leAddr->text())){ this->setBtnEnableFalse(); return; } if (!ui->leGateway->text().isEmpty() && !this->getTextEditState(ui->leGateway->text()) ) { this->setBtnEnableFalse(); return; } if (!ui->leDns->text().isEmpty() && !this->getTextEditState(ui->leDns->text()) ) { this->setBtnEnableFalse(); return; } if (!ui->leAddr_ipv6->text().isEmpty() && ! this->getIpv6EditState(ui->leAddr_ipv6->text())) { this->setBtnEnableFalse(); return; } if(ui->leDns2->text().isEmpty()){ }else{ if(!this->getTextEditState(ui->leDns2->text())){ this->setBtnEnableFalse(); return ; } } } ui->btnSave->setEnabled(true); ui->btnCreate->setEnabled(true); ui->btnSave->setProperty("on",true); ui->btnSave->style()->unpolish(ui->btnSave); ui->btnSave->style()->polish(ui->btnSave); ui->btnCreate->setProperty("on",true); ui->btnCreate->style()->unpolish(ui->btnCreate); ui->btnCreate->style()->polish(ui->btnCreate); } bool ConfForm::isEditingAlready(){ if (ui->leName->text().size() == 0) return false; if(ui->cbType->currentIndex() == 1){ //手动新建网络 //仅填写连接名和ipv4地址时可被按下 if(getTextEditState(ui->leAddr->text()) && ui->leAddr_ipv6->text().isEmpty() && ui->leGateway->text().isEmpty() && ui->leDns->text().isEmpty() && ui->leDns2->text().isEmpty()){ return true; } //全部填写完成时可被按下 if(getTextEditState(ui->leAddr->text()) && ui->leAddr_ipv6->text().isEmpty() && getTextEditState(ui->leGateway->text()) && getTextEditState(ui->leDns->text())){ if(getTextEditState(ui->leDns2->text()) || ui->leDns2->text().isEmpty()){ return true; } } } return false; } //文本的输入要符合ip的格式要求 bool ConfForm::getTextEditState(QString text) { 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 ConfForm::getIpv6EditState(QString text) { 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; } void ConfForm::onConfformHide() { clearFocus(); ui->leAddr->clearFocus(); ui->leAddr_ipv6->clearFocus(); ui->leGateway->clearFocus(); ui->leDns->clearFocus(); ui->leDns2->clearFocus(); this->hide(); } //设置创建或保存按钮不可点击 void ConfForm::setBtnEnableFalse() { ui->btnSave->setEnabled(false); ui->btnCreate->setEnabled(false); ui->btnSave->setProperty("on",false); ui->btnSave->style()->unpolish(ui->btnSave); ui->btnSave->style()->polish(ui->btnSave); ui->btnCreate->setProperty("on",false); ui->btnCreate->style()->unpolish(ui->btnCreate); ui->btnCreate->style()->polish(ui->btnCreate); } void ConfForm::paintEvent(QPaintEvent *event) { KylinDBus mkylindbus; double trans = mkylindbus.getTransparentData(); QString name = tr("Method: "); ui->lbTxt1->setText(ui->lbTxt1->fontMetrics().elidedText(name, Qt::ElideRight, 95)); if (name != ui->lbTxt1->text()) { ui->lbTxt1->setToolTip(tr("Method: ")); } else { ui->lbTxt1->setToolTip(""); } QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } kylin-nm/src/switchbutton.cpp0000644000175000017500000000667514205345374015311 0ustar fengfeng/* * 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; } 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; } /* 播放按钮开启关闭动画 */ 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) return QWidget::mousePressEvent(event); m_bIsOn = !m_bIsOn; Q_EMIT clicked(m_bIsOn); return QWidget::mousePressEvent(event); } /* 绘制滑动按钮主体 */ void SwitchButton::paintEvent(QPaintEvent *event) { Q_UNUSED(event); QPainter painter(this); painter.setRenderHint(QPainter::SmoothPixmapTransform); painter.setRenderHint(QPainter::Antialiasing); //抗锯齿效果 painter.setPen(Qt::NoPen); QColor colorActive(61,107,229); QColor colorInactive(190,190,190); colorInactive.setAlphaF(0.12); if(m_bIsOn) { painter.save(); painter.setBrush(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(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(); painter.setBrush(Qt::white); painter.drawEllipse(m_fCurrentValue,4, 16, 16); painter.restore(); } kylin-nm/src/wpawifidialog.h0000644000175000017500000002131514205345444015031 0ustar fengfeng/* * 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #define WINDOW_WIDTH 360 #define WINDOW_HEIGHT_PEAP 540 #define WINDOW_HEIGHT_TLP 670 #define WINDOW_HEIGHT_ELSE 360 class MainWindow; typedef QList QObjectList; namespace Ui { class WpaWifiDialog; } class UpConnThread : public QThread { Q_OBJECT public: explicit UpConnThread(const QString &, const QString &); ~UpConnThread(); public: void run(); QString conn_name = 0; QString m_user = 0; QString m_pwd = 0; Q_SIGNALS: void connRes(int respond); }; /** * @brief The wifiProperty struct * 目前只写了802-1x,企业wifi的配置,可增加通用属性配置 */ struct WifiConfig { QString connectName; /*802-1x属性*/ QString eap; QString identity; QString anonymousIdentity; QString caCert;//ca证书配置路径 QString clientCert;//用户证书配置路径 QString privateKey;//用户私钥配置路径 }; class WpaWifiDialog : public QDialog { Q_OBJECT public: explicit WpaWifiDialog(QWidget *parent = nullptr, MainWindow *mw = 0, QString conname = 0); explicit WpaWifiDialog(QWidget *parent = nullptr, MainWindow *mw = 0, WifiConfig *wifiConfig = nullptr); ~WpaWifiDialog(); private: Ui::WpaWifiDialog *ui; void initUI(); //初始化UI界面 void initCombox(); //初始化所有下拉框 void initConnect(); //初始化连接 void getPwdFlag(); //获取是否每次询问密码 bool setPwdFlag(const int&); //设置是否每次询问密码 /*初始化CA证书的配置界面*/ void initCAConfigUI(); /*初始化用户证书、私钥和密码的配置界面*/ void initUserConfig4TLSUI(); /*清空布局 delete all item of layout*/ void deleteAllItemOfLayout(QLayout *layout); protected: void paintEvent(QPaintEvent *event); private: int pwd_flag = 2; //是否每次询问密码,0保存密码,2询问,默认不保存密码 QString connectionName; // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); // void keyPressEvent(QKeyEvent *event); bool isPress; QPoint winPos; QPoint dragPos; QStringList wifi_info; bool has_config; QStringList user_list; QString key_mgmt = "wpa-eap"; MainWindow *mw; QObjectList m_frameList; void setEditorEnable(bool is_checking); //设置是否禁用输入 void activateConnection(); QStringList getWifiInfo(QString wifiName); bool appendWifiInfo(QString name, QString eap, QString inner, QString user, bool ask); bool appendWifiUser(QString name, QString user); private: QWidget * mainWidget = nullptr; QVBoxLayout * mainLyt = nullptr; //弹窗整体布局 QFrame * titleFrame = nullptr; //标题栏 QHBoxLayout * titleLyt = nullptr; QLabel * titleLabel = nullptr; QFrame * nameFrame = nullptr; //网络名称 QHBoxLayout * nameLyt = nullptr; QLabel * nameLabel = nullptr; QLineEdit * nameEditor = nullptr; QFrame * securityFrame = nullptr; //网络安全性 QHBoxLayout * securityLyt = nullptr; QLabel * securityLabel = nullptr; QComboBox * securityCombox = nullptr; QFrame * hLine = nullptr; //分割线 QFrame * eapFrame = nullptr; //EAP方法 QHBoxLayout * eapLyt = nullptr; QLabel * eapLabel = nullptr; QComboBox * eapCombox = nullptr; QFrame * innerFrame = nullptr; //阶段2身份认证 QHBoxLayout * innerLyt = nullptr; QLabel * innerLabel = nullptr; QComboBox * innerCombox = nullptr; QFrame * userFrame = nullptr; //用户名 QHBoxLayout * userLyt = nullptr; QLabel * userLabel = nullptr; QLineEdit * userEditor = nullptr; QFrame * pwdFrame = nullptr; //密码 QVBoxLayout * pwdLyt = nullptr; QFrame * pwdEditFrame = nullptr; //输入密码 QHBoxLayout * pwdEditLyt = nullptr; QLabel * pwdLabel = nullptr; QLineEdit * pwdEditor = nullptr; QFrame * pwdShowFrame = nullptr; //显示密码 QHBoxLayout * pwdShowLyt = nullptr; QCheckBox * pwdShowBtn = nullptr; QLabel * pwdShowLabel = nullptr; QFrame * askPwdFrame = nullptr; //每次询问密码 QHBoxLayout * askPwdLyt = nullptr; QCheckBox * askPwdBtn = nullptr; QLabel * askPwdlabel = nullptr; QFrame * buttonFrame = nullptr; //按钮 QHBoxLayout * buttonLyt = nullptr; QPushButton * cancelBtn = nullptr; //取消 QPushButton * connectBtn = nullptr; //连接 /**************** 802-1x layout ***************** 认证 EAP方法 TTS QLabel QComboBox 身份 QLabel QLineEdit 域 QLabel QLineEdit CA证书 QLabel QComboBox V 无 请选择文件路径 显示密码 QCheckBox 不需要CA证书 QCheckBox 用户证书 QComboBox 用户私钥 QComboBox 用户私钥密码 QLineEdit 显示密码 QCheckBox **/ enum EapType { TLS = 0, PEAP, PWD, FAST, TTLS, LEAP }; WifiConfig *m_wifiConfig = nullptr; /*身份 identity*/ QFrame *m_identityFrame = nullptr; QHBoxLayout *m_identityLyt = nullptr; QLabel *m_identityLabel = nullptr; QLineEdit *m_identityEditor = nullptr; /*匿名身份 anonymous identity*/ QFrame *m_anonymousIdentityFrame = nullptr; QHBoxLayout *m_anonymousIdentityLyt = nullptr; QLabel *m_anonymousIdentityLabel = nullptr; QLineEdit *m_anonymousIdentityEditor = nullptr; /*域 domain*/ QFrame *m_domainFrame = nullptr; QHBoxLayout *m_domainLyt = nullptr; QLabel *m_domainLabel = nullptr; QLineEdit *m_domainEditor = nullptr; /*CA证书 certificate*/ QFrame *m_CAFrame = nullptr; QHBoxLayout *m_CALyt = nullptr; QLabel *m_CALabel = nullptr; QComboBox *m_CAComboBox = nullptr;// 默认为(无)、QFileDialog /*不需要CA证书 no need for CA certificate*/ QFrame *m_isCANeededFrame = nullptr; QHBoxLayout *m_isCANeededShowLyt = nullptr; QCheckBox *m_isCANeededShowBtn = nullptr; QLabel *m_isCANeededShowLabel = nullptr; /*用户证书 user certificate*/ QFrame *m_UserCertificateFrame = nullptr; QHBoxLayout *m_UserCertificateLyt = nullptr; QLabel *m_UserCertificateLabel = nullptr; QComboBox *m_UserCertificateComboBox = nullptr;// 默认为(无)、QFileDialog /*用户私钥 user private key*/ QFrame *m_UserPrivateKeyFrame = nullptr; QHBoxLayout *m_UserPrivateKeyLyt = nullptr; QLabel *m_UserPrivateKeyLabel = nullptr; QComboBox *m_UserPrivateKeyComboBox = nullptr;// 默认为(无)、QFileDialog /*私钥密码 password for private key*/ QFrame *m_pwd4PrivateKeyPWDFrame = nullptr; QHBoxLayout *m_pwd4PrivateKeyPWDLyt = nullptr; QLabel *m_pwd4PrivateKeyPWDLabel = nullptr; QLineEdit *m_pwd4PrivateKeyPWDEditor = nullptr;// 未添加用户私钥时,该编辑栏不可用 Q_SIGNALS: void conn_done(); void conn_failed(); private slots: void slot_on_connectBtn_clicked(); void slot_line_edit_changed(); void changeDialog(); void eapTypeChange();// void checkConnectBtnIsEnabled(); }; #endif // WPAWIFIDIALOG_H kylin-nm/src/mainwindow.h0000644000175000017500000004052314205345444014361 0ustar fengfeng/* * 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include //#include //#include #define W_LEFT_AREA 41 #define W_VERTICAL_LINE 1 //左边竖线宽度 #define W_RIGHT_AREA 438 //41 + 1 + 438 = 480 #define L_VERTICAL_LINE_TO_ITEM 4 //竖线到item左侧的距离 #define X_LEFT_WIFI_BALL 416 //白色小球在左边 #define X_RIGHT_WIFI_BALL 440 //白色小球在右边 #define Y_WIFI_BALL 23 //白色小球y坐标 #define X_ITEM 46 //item到窗口左侧的距离 41 + 1 + 4 = 46 #define W_ITEM 424 #define Y_TOP_ITEM 57 //顶部item、topLanListWidget、topWifiListWidget的y坐标 #define H_NORMAL_ITEM 60 //一个没有扩展的,普通item的高度 #define H_GAP_UP 10 //H_NORMAL_ITEM 与 H_MIDDLE_WORD之间的间距 #define H_MIDDLE_WORD 46 //"显示‘可用网络列表’的label" #define H_GAP_DOWN 5 //57 + 60 + 10 + 46 + 5 = 178 #define X_MIDDLE_WORD 19 #define W_MIDDLE_WORD 260 #define H_LAN_ITEM_EXTEND 102 //162 - 60 #define H_WIFI_ITEM_BIG_EXTEND 78 //138 - 60 #define H_WIFI_ITEM_SMALL_EXTEND 46 //106 - 60 #define Y_SCROLL_AREA 178 #define W_SCROLL_AREA 450 #define H_SCROLL_AREA 360 #define W_TOP_LIST_WIDGET 435 #define W_LIST_WIDGET 440 #define W_BTN_FUN 59 #define H_BTN_FUN 14 #define X_BTN_FUN 360 #define Y_BTN_FUN 87 //新建网络,加入网络按钮的宽高、x坐标、y坐标 #define W_NO_ITEM_TIP 240 #define H_NO_ITEM_TIP 24 #define DBUS_NAME "org.ukui.SettingsDaemon" #define DBUS_PATH "/org/ukui/SettingsDaemon/wayland" #define DBUS_INTERFACE "org.ukui.SettingsDaemon.wayland" #define LOAD_WIFI_LIST 0 #define UPDATE_WIFI_LIST 1 #define RECONNECT_WIFI 2 #define REFRESH_WIFI 3 #define UnknownConnectivity 0 // Network connectivity is unknown. #define NoConnectivity 1 // The host is not connected to any network. #define Portal 2 // The host is behind a captive portal and cannot reach the full Internet. #define Limited 3 // The host is connected to a network, but does not appear to be able to reach the full Internet. #define Full 4 // The host is connected to a network, and appears to be able to reach the full Internet. class OneConnForm; class ConfForm; namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); void justShowTrayIcon(); void editQssString(); void createTopLanUI(); void createTopWifiUI(); void createOtherUI(); void createListAreaUI(); void createLeftAreaUI(); void startLoading(); void stopLoading(); void setTrayIcon(QIcon icon); void setTrayIconOfWifi(int); void setTrayLoading(bool isLoading); void getActiveInfoAndSetTrayIcon(); void initTimer(); void checkIsWirelessDevicePluggedIn(); void initActNetDNS(); void PrimaryManager(); void toStart(); int getScreenGeometry(QString methodName); void showPb(QString type, QString name); QIcon iconLanOnline, iconLanOffline, iconLanOnlineNoInternet; QIcon iconWifiFull, iconWifiHigh, iconWifiMedium, iconWifiLow; QIcon iconConnecting; QList loadIcons; // QString mwBandWidth; KylinDBus *objKyDBus = nullptr; NetworkSpeed *objNetSpeed = nullptr; SwitchButton *btnWireless = nullptr; SwitchButton *btnWired = nullptr; //状态设置,0为假,1为真 int current_wifi_list_state = LOAD_WIFI_LIST; int is_init_wifi_list = 0; //是否在启动软件时正在获取wifi的列表 int is_btnLanList_clicked = 1; //是否处于有线网界面 int is_btnWifiList_clicked = 0; //是否处于无线网界面 int is_wireless_adapter_ready = 1; //主机是否插入无线网卡 int is_keep_wifi_turn_on_state = 1; //是否要执行wifi开关变为打开样式 int is_stop_check_net_state = 0; //是否要在进行其他操作时停止检查网络状态 int is_connect_net_failed = 0; //刚才是否连接网络失败 int is_wifi_reconnected = 0;//刚才是否主动重连wifi导致wifi断开 int is_fly_mode_on = 0; //是否已经打开飞行模式 int is_hot_sopt_on = 0; //是否已经打开热点 int is_connect_hide_wifi = 0; //是否正在连接隐藏wifi int currSelNetNum = 0; //当前选中的item序号 bool isLanBeConnUp = false; //lan是否连接上 bool isWifiBeConnUp = false; //wifi是否是连接上 bool isToSetLanValue = true; //本次执行是否进行赋值 bool isToSetWifiValue = true; //本次执行是否进行赋值 bool isReconnectingWifi = false; //是否正在执行wifi的回连 bool isReconnectingLan = false; //是否正在执行lan的回连 bool m_is_inputting_wifi_password = false; //是否正在输入密码 int addNumberForWifi = 0; //短时间内收到关于wifi连接信号的次数 bool isHuaWeiPC; bool isHuaWei9006C; bool isHandlingWiredCableOn = false; bool ifCanReconnectWifiNow = true; bool isReConnAfterTurnOnWifi = false;//是否是在打开wifi的开关后回连wifi bool isRadioWifiTurningOn = false; //是否正在打开wifi开关 bool bShowPb = false; //是否可以showPb bool canExecHandleWifiSwitchChange = true; QVector dbus_wifiList; //其他组件通过dbus接口获取到的wifi列表,第一个元素一定为已连接wifi,若没有已连接wifi则显示为-- void requestRefreshWifiList(); //申请刷新wifi列表 QString currSelNetName = ""; //当前ScrollArea中选中的网络名称 QStringList canReconnectWifiList; //当前可以回连的wifi列表 QString currConnIfname = ""; //当前连接的有线网对应网卡名称,只有一个有线网连接的情况 QString oldWifiIpv4Method = ""; //原来的wifi的ipv4地址获取方式,自动还是手动 int numberForWifiScan; //该值控制wifi的扫描 int m_priX; int m_priY; int m_priWid; int m_priHei; QStringList m_wifi_list_pwd_changed; //WiFi密码以改变的WiFi列表(990/9a0自动回连失败) public slots: void onPhysicalCarrierChanged(bool isCarrierLineOn); void onCarrierUpHandle(); void onCarrierDownHandle(); void onDeleteLan(); void onNetworkDeviceAdded(QDBusObjectPath objPath); void onNetworkDeviceRemoved(QDBusObjectPath objPath); void getLanBandWidth(); void checkIfWiredNetExist(); void onBtnNetListClicked(int flag=0); void onNewConnAdded(int type); void onExternalConnectionChange(QString type, bool isConnUp); void onExternalLanChange(); void onExternalWifiChange(); void onToSetTrayIcon(); void onToResetValue(); void onWifiSwitchChange(); void onExternalWifiSwitchChange(bool wifiEnabled); void oneLanFormSelected(QString lanName, QString uniqueName); void oneTopLanFormSelected(QString lanName, QString uniqueName); void oneWifiFormSelected(QString wifibssid, int extendLength); void oneTopWifiFormSelected(QString wifibssid, int extendLength); void on_btnHotspot_clicked(); void on_btnHotspotState(); void on_btnWifiList_clicked(); void on_wifi_changed(); void connWifiDone(int connFlag); void onRequestRefreshWifiList(); void onRefreshWifiListAfterScan(); void onLoadWifiListAfterScan(); void onRequestReconnecWifi(); //flag =0或1为普通点击、2为收到打开信息、3为收到关闭信息、4为无线网卡插入、5为无线网卡拔出 void onBtnWifiClicked(int flag = 0); //falg=0 UI点击,1收到打开信息,2收到关闭信息,3有线设备插入,4有线设备拔出 void onBtnLanClicked(int flag = 0); void setLanSwitchStatus(bool is_opened); void on_showWindowAction(); void checkIfConnectedWifiExist(); void toReconnectWifi(); void rfkillDisableWifiDone(); void rfkillEnableWifiDone(); void setTrayIconAfterGetConnectivity(); protected: bool eventFilter(QObject *obj, QEvent *event); void paintEvent(QPaintEvent *event); bool event(QEvent *event); private: void firstlyStart(); //一级启动 void secondaryStart(); //二级启动 bool m_load_finished = false; //是否二级启动已执行完 QTimer * m_secondary_start_timer = nullptr; //执行二级启动的倒计时 void checkSingleAndShowTrayicon(); void initNetwork(); void createTrayIcon(); void handleIconClicked(); void showTrayIconMenu(); bool checkLanOn(); bool checkWlOn(); void getLanList(); void getWifiList(); void setBtnWirelessStatus(); void initLanSlistAndGetReconnectNetList(); QPixmap drawSymbolicColoredPixmap(const QPixmap &source); QPixmap drawSymbolicBlackColoredPixmap(const QPixmap &source); const QPixmap loadSvg(const QString &fileName, const int size); void getSystemFontFamily(); Ui::MainWindow *ui; LoadingDiv *loading = nullptr; QDesktopWidget desktop; KSimpleNM *ksnm = nullptr; ConfForm *confForm = nullptr; QWidget *topLanListWidget = nullptr; QWidget *topWifiListWidget = nullptr; QWidget *lanListWidget = nullptr; QWidget *wifiListWidget = nullptr; QWidget *optWifiWidget = nullptr; QLabel *lbLoadDown = nullptr; QLabel *lbLoadDownImg = nullptr; QLabel *lbLoadUp = nullptr; QLabel *lbLoadUpImg = nullptr; QLabel *lbNoItemTip = nullptr; bool ifLanConnected; bool ifWLanConnected; QScrollArea *scrollAreal = nullptr; QScrollArea *scrollAreaw = nullptr; QLabel *lbTopLanList = nullptr; QLabel *lbTopWifiList = nullptr; QLabel *lbLanList = nullptr; QLabel *lbWifiList = nullptr; QPushButton *btnAddNet = nullptr; QPushButton *btnCreateNet = nullptr; QSystemTrayIcon *trayIcon = nullptr; QMenu *trayIconMenu = nullptr; QAction *mShowWindow = nullptr; QAction *mAdvConf = nullptr; QWidget *widShowWindow = nullptr; QWidget *widAdvConf = nullptr; QString lcardname, wcardname; // 以太网卡和无线网卡名称 QString btnOffQss, btnOnQss, btnBgOffQss, btnBgOnQss, btnBgHoverQss, btnBgLeaveQss; // 主界面按钮底色 QString scrollBarQss, leftBtnQss, funcBtnQss; QStringList oldLanSlist; //上一次获取Lan列表 QStringList oldWifiSlist; //上一次获取wifi列表 QStringList oldConnSlist; //上一次获取的以保存网络列表 bool isInitConnList = true; bool isAddedWifi = false; bool m_isWifiConnected = false; //专用于处理dbus获取的WiFi状态,用于对比每次刷新后的WiFi连接状态变化 QString lastAddedConn = ""; QString oldActLanName = ""; //上一次获取的已连接有线网名称 QString actLanUuid = ""; //当前连接的有线网uuid QString actLanIpv4Method = ""; //当前连接的有线网的ip获取方式 int oldDbusActLanDNS = 0; //上一次获取的已连接有线网的DNS代号 void wifiListOptimize(QStringList& slist); //只保留同名同频信号最优AP QVector repetitionFilter(QVector); QStringList priorityList(QStringList); QStringList sortApByCategory(QStringList,int); QStringList sortApByFreq(QStringList,int, int); void getFinalWifiList(QStringList& slist); //获取应该显示在wifi列表中的最优列表参数 QVector connectableWifiPriorityList(const QStringList slist); //可连接wifi优先级列表 void devListSort(QVector *list); static bool subDevListSort(const structWifiProperty&info1,const structWifiProperty&info2); //循环检测网络连接状态 QTimer *iconTimer = nullptr; QTimer *wiredCableUpTimer = nullptr; QTimer *wiredCableDownTimer = nullptr; QTimer *deleteLanTimer = nullptr; QTimer *checkWifiListChanged = nullptr; QTimer *checkIfLanConnect = nullptr; QTimer *checkIfWifiConnect = nullptr; QTimer *checkIfNetworkOn = nullptr; QTimer *setNetSpeed = nullptr; int currentIconIndex; int activeWifiSignalLv; int disconnect_time = 0; int currTopLanItem = 1; //当前连接的有线网个数 long int start_rcv_rates = 0; //保存开始时的流量计数 long int end_rcv_rates = 0; //保存结束时的流量计数 long int start_tx_rates = 0; //保存开始时的流量计数 long int end_tx_rates = 0; //保存结束时的流量计数 QString actWifiSsid = "--"; //当前连接wifi的ssid QStringList actWifiBssidList; //当前连接wifi的bssid QString actWifiUuid = "--"; //当前连接wifi的uuid // QString hasStarWifiInfo; //nmcli命令获取的wifi列表中已经连接的wifi in-use熟悉会有一个* // QString hasStarWifiName; bool hasWifiConnected;//当前是否有wifi连接 bool m_connected_by_self = false; //是否在本进程执行的连接操作 bool isLanSwitchOpend = true; QDBusInterface *mDbusXrandInter; QDBusInterface *kdsDbus; QString currActWifiBssid; private slots: void iconActivated(QSystemTrayIcon::ActivationReason reason); void onBtnNetClicked(); // void on_btnWifiList_clicked(); void onRequestRevalueUpdateWifi(); void getLanListDone(QStringList slist); void getWifiListDone(QStringList slist); void getConnListDone(QStringList slist); void loadWifiListDone(QStringList slist); void updateWifiListDone(QStringList slist); void onlyRefreshWifiList(QStringList slist); QString TranslateLanName(QString lanName); QString getMacByUuid(QString uuidName); void on_btnAdvConf_clicked(); void handleLanDisconn(); void handleWifiDisconn(); void handleWifiDisconnLoading(); void onRequestScanAccesspoint(); void toScanWifi(bool isShow); void on_setNetSpeed(); void on_checkOverTime(); // 后台回调 void enNetDone(); void disNetDone(); void enWifiDone(); void disWifiDone(); void disWifiStateKeep(); void disWifiDoneChangeUI(); void connLanDone(int connFlag); // void connWifiDone(int connFlag); void iconStep(); void on_btnFlyMode_clicked(); void onBtnAddNetClicked(); void onBtnCreateNetClicked(); void actionTriggerSlots(); void priScreenChanged(int x, int y, int width, int height); void onRfkillStatusChanged(); signals: void showPbSignal(QSystemTrayIcon::ActivationReason act); void disConnSparedNet(QString type); void refreshWifiListAfterScan(); void loadWifiListAfterScan(); void carrierDownHandle(); void waitLanStop(); void configurationChanged(); //通知控制面板更新IP的信号 void reConnectWifi(const QString& uuid); void actWifiSignalLvChanaged(const int& currentLevel); void getWifiListFinished(); void startReconnectWifi(const QString& ssid); void stopReconnectWifi(const QString& ssid, const int& result); void wiredConnectionAdded(); void wiredConnectionRemoved(); void actWiredConnectionChanged(); void requestReconnecWifi(); void wifiClicked(QString); void lanClicked(QString); void onWiredDeviceChanged(const bool&); }; #endif // MAINWINDOW_H kylin-nm/src/wifi-auth-thread.cpp0000644000175000017500000000451114205345444015677 0ustar fengfeng/* * 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 WifiAuthThread::WifiAuthThread() { //检查连接状态 naManager = new QNetworkAccessManager(this); // QString url=QString("http://nmcheck.gnome.org/check_network_status.txt"); QString url=QString("http://connectivity-check.ubuntu.com/"); request.setUrl(QUrl(url)); naManager->get(request); //qDebug()<<"-------------------Network state check!----------------------"; connect(naManager,&QNetworkAccessManager::finished,this,[=](QNetworkReply* reply){ _isReply=true; QNetworkReply::NetworkError err = reply->error(); //qDebug()<<"----------------NetworkReply error:----------------------"<readAll().isEmpty()) _isConnect=false; } else _isConnect=false; }); } WifiAuthThread::~WifiAuthThread() { delete naManager; } void WifiAuthThread::run() { sleep(3); QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.NetworkManager", QDBusConnection::systemBus() ); QDBusReply reply= interface.call("CheckConnectivity"); if (reply.isValid()) { //qDebug()<<"---------------------wifi type:----------------------"< #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); private: int m_bIsOn = 1; QTimer *m_cTimer; float m_fWidth; float m_fHeight; float m_fCurrentValue; void paintEvent(QPaintEvent *event); void mousePressEvent(QMouseEvent *event); bool m_enabled = true; Q_SIGNALS: void clicked(int check); void switchStatusChanged(); private Q_SLOTS: void startAnimation(); }; #endif // SWITCHBUTTON_H kylin-nm/src/wificonfigdialog.h0000644000175000017500000000375714205345444015521 0ustar fengfeng/* * 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 namespace Ui { class WiFiConfigDialog; } class WiFiConfigDialog : public QDialog { Q_OBJECT public: explicit WiFiConfigDialog(QWidget *parent = nullptr); ~WiFiConfigDialog(); void initTransparentState(); double getTransparentData(); void toConfigWifi(); void setEnableOfBtn(); protected: void paintEvent(QPaintEvent *event); private slots: void on_btnCancel_clicked(); void on_btnOk_clicked(); void on_leWifiId_textEdited(const QString &arg1); void on_leWiFiName_textEdited(const QString &arg1); void on_leWifiPassword_textEdited(const QString &arg1); void on_checkBoxPwd_clicked(); // void on_checkBoxPwd_released(); private: Ui::WiFiConfigDialog *ui; QGSettings *m_transparency_gsettings = nullptr; QString checkBoxQss = "QCheckBox {border:none;background:transparent;}" "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);}"; }; #endif // WIFICONFIGDIALOG_H kylin-nm/src/wpawifidialog.cpp0000644000175000017500000014274114205345444015373 0ustar fengfeng/* * 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 #include const QString CONFIG_FILE = "/tmp/wpaconf.ini"; const int ITEAM_FIXED_HEIGHT = 42; UpConnThread::UpConnThread(const QString& user, const QString& pwd) { m_user = user; m_pwd = pwd; } UpConnThread::~UpConnThread() { } void UpConnThread::run() { QString cmdStr = 0; QFile::remove(QString("/tmp/%1.txt").arg(conn_name).toUtf8()); QFile *passwdFile = new QFile(QString("/tmp/%1.txt").arg(conn_name)); if (passwdFile->open(QIODevice::ReadWrite)) { passwdFile->write(QString("802-1x.identity:%1\n802-1x.password:%2").arg(m_user).arg(m_pwd).toUtf8()); passwdFile->close(); cmdStr = "nmcli connection up '" + this->conn_name + "' passwd-file /tmp/" + conn_name + ".txt"; } else { cmdStr = "nmcli connection up '" + this->conn_name + "'"; } qDebug()<<"Trying to connect wifi. ssid="<conn_name; qDebug()<<"qDebug: 激活连接: \n"<< "qDebug: " + cmdStr; int res = Utils::m_system(cmdStr.toUtf8().data()); emit connRes(res); } WpaWifiDialog::WpaWifiDialog(QWidget *parent, MainWindow *mainWindow, QString conname) : QDialog(parent), ui(new Ui::WpaWifiDialog) { ui->setupUi(this); this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint); this->setAttribute(Qt::WA_TranslucentBackground); this->setAttribute(Qt::WA_DeleteOnClose); this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png"))); // this->setAttribute(Qt::WA_DeleteOnClose); connectionName = conname; m_wifiConfig = new WifiConfig; m_wifiConfig->connectName = conname; // configPath = getenv("HOME") + CONFIG_FILE; QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); initUI(); initCAConfigUI(); initUserConfig4TLSUI(); mainLyt->setSpacing(8); mainLyt->setContentsMargins(8, 16, 8, 16); mainWidget->setLayout(mainLyt); initCombox(); initConnect(); eapTypeChange(); this->mw = mainWindow; checkConnectBtnIsEnabled(); } WpaWifiDialog::WpaWifiDialog(QWidget *parent, MainWindow *mw, WifiConfig *wifiConfig) { if (wifiConfig) { m_wifiConfig = wifiConfig; } else { m_wifiConfig = new WifiConfig; } connectionName = wifiConfig->connectName; WpaWifiDialog(parent, mw, connectionName); } WpaWifiDialog::~WpaWifiDialog() { if (m_wifiConfig != nullptr) { delete m_wifiConfig; } /*清理父类为空的QFrame对象*/ for(QObject *obj : m_frameList) { if (obj != nullptr && obj->parent() == nullptr) { obj->deleteLater(); } } delete ui; } void WpaWifiDialog::initUI() { mainWidget = new QWidget(this); mainLyt = new QVBoxLayout(mainWidget); mainWidget->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_PEAP); this->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_PEAP); titleFrame = new QFrame(mainWidget); //标题栏 titleFrame->setFixedHeight(48); titleLyt = new QHBoxLayout(titleFrame); titleLabel = new QLabel(titleFrame); titleLabel->setText(tr("Connect WLAN")); titleLyt->addWidget(titleLabel); titleLyt->addStretch(); titleFrame->setLayout(titleLyt); nameFrame = new QFrame(mainWidget); //网络名称 nameFrame->setFixedHeight(48); nameLyt = new QHBoxLayout(nameFrame); nameLyt->setContentsMargins(24, 0, 24, 0); nameLabel = new QLabel(nameFrame); nameEditor = new QLineEdit(nameFrame); nameEditor->setFixedHeight(48); nameLabel->setFixedWidth(100); nameLabel->setText(tr("Name")); nameEditor->setText(connectionName); if (connectionName == "") { //添加隐藏wifi时 nameEditor->setEnabled(true);//允许编辑wifi名 } else { //连接现有wifi时 nameEditor->setEnabled(false);//暂时不允许编辑wifi名 } nameLyt->addWidget(nameLabel); nameLyt->addWidget(nameEditor); nameFrame->setLayout(nameLyt); securityFrame = new QFrame(mainWidget); //网络安全性 securityFrame->setFixedHeight(48); securityLyt = new QHBoxLayout(securityFrame); securityLyt->setContentsMargins(24, 0, 24, 0); securityLabel = new QLabel(securityFrame); securityCombox = new QComboBox(securityFrame); securityCombox->setFixedHeight(48); securityLabel->setFixedWidth(100); securityLabel->setText(tr("Security")); securityLyt->addWidget(securityLabel); securityLyt->addWidget(securityCombox); securityFrame->setLayout(securityLyt); hLine = new QFrame(mainWidget); //分割线 hLine->setFrameShape(QFrame::Shape::HLine); hLine->setLineWidth(0); hLine->setFixedHeight(1); hLine->setStyleSheet("QFrame{background-color: palette(base);}"); eapFrame = new QFrame(mainWidget); //EAP方法 eapFrame->setFixedHeight(48); eapLyt = new QHBoxLayout(eapFrame); eapLyt->setContentsMargins(24, 0, 24, 0); eapLabel = new QLabel(eapFrame); eapCombox = new QComboBox(eapFrame); eapCombox->setFixedHeight(48); eapLabel->setFixedWidth(100); eapLabel->setText(tr("EAP type")); eapLyt->addWidget(eapLabel); eapLyt->addWidget(eapCombox); eapFrame->setLayout(eapLyt); /*以下为动态变更的地方*/ innerFrame = new QFrame(); //阶段2身份认证 innerFrame->setFixedHeight(48); innerLyt = new QHBoxLayout(innerFrame); innerLyt->setContentsMargins(24, 0, 24, 0); innerLabel = new QLabel(innerFrame); innerCombox = new QComboBox(innerFrame); innerCombox->setFixedHeight(ITEAM_FIXED_HEIGHT); innerLabel->setFixedWidth(100); innerLabel->setText(tr("Inner auth")); innerLyt->addWidget(innerLabel); innerLyt->addWidget(innerCombox); innerFrame->setLayout(innerLyt); userFrame = new QFrame(); //用户名 userFrame->setFixedHeight(48); userLyt = new QHBoxLayout(userFrame); userLyt->setContentsMargins(24, 0, 24, 0); userLabel = new QLabel(userFrame); userEditor = new QLineEdit(userFrame); userEditor->setFixedHeight(ITEAM_FIXED_HEIGHT); userLabel->setFixedWidth(100); userLabel->setText(tr("Username")); userLyt->addWidget(userLabel); userLyt->addWidget(userEditor); userFrame->setLayout(userLyt); pwdFrame = new QFrame(); //密码 pwdFrame->setFixedHeight(72); pwdLyt = new QVBoxLayout(pwdFrame); pwdLyt->setContentsMargins(0, 0, 0, 0); pwdLyt->setSpacing(0); pwdEditFrame = new QFrame(); //输入密码 pwdEditFrame->setFixedHeight(48); pwdEditLyt = new QHBoxLayout(pwdEditFrame); pwdEditLyt->setContentsMargins(24, 0, 24, 0); pwdLabel = new QLabel(pwdEditFrame); pwdEditor = new QLineEdit(pwdEditFrame); pwdEditor->setEchoMode(QLineEdit::Password); pwdLabel->setText(tr("Password")); pwdLabel->setFixedWidth(100); pwdEditor->setFixedHeight(ITEAM_FIXED_HEIGHT); pwdEditLyt->addWidget(pwdLabel); pwdEditLyt->addWidget(pwdEditor); pwdEditFrame->setLayout(pwdEditLyt); pwdShowFrame = new QFrame(); //显示密码 pwdShowFrame->setFixedHeight(24); pwdShowLyt = new QHBoxLayout(pwdShowFrame); pwdShowLyt->setContentsMargins(130, 0, 0, 0); pwdShowBtn = new QCheckBox(pwdShowFrame); pwdShowLabel = new QLabel(pwdShowFrame); pwdShowLabel->setFixedWidth(120); pwdShowBtn->setFixedSize(16, 16); pwdShowBtn->setStyleSheet("background-color:rgb(61,61,65);"); pwdShowLabel->setText(tr("Show password")); pwdShowLyt->addWidget(pwdShowBtn); pwdShowLyt->addWidget(pwdShowLabel); pwdShowLyt->addStretch(); pwdShowFrame->setLayout(pwdShowLyt); askPwdFrame = new QFrame(pwdFrame); //每次询问密码 askPwdFrame->setFixedHeight(24); askPwdLyt = new QHBoxLayout(askPwdFrame); askPwdLyt->setContentsMargins(130, 0, 0, 0); askPwdBtn = new QCheckBox(askPwdFrame); askPwdBtn->setStyleSheet("background-color:rgb(61,61,65);"); askPwdlabel = new QLabel(askPwdFrame); // askPwdlabel->setFixedWidth(120); askPwdBtn->setFixedSize(16, 16); askPwdlabel->setText(tr("Ask pwd each query")); askPwdLyt->addWidget(askPwdBtn); askPwdLyt->addWidget(askPwdlabel); askPwdLyt->addStretch(); askPwdFrame->setLayout(askPwdLyt); pwdLyt->addWidget(pwdEditFrame); pwdLyt->addWidget(pwdShowFrame); pwdLyt->addWidget(askPwdFrame); pwdFrame->setLayout(pwdLyt); buttonFrame = new QFrame(); //按钮 buttonLyt = new QHBoxLayout(buttonFrame); cancelBtn = new QPushButton(buttonFrame); //取消 connectBtn = new QPushButton(buttonFrame); //连接 connectBtn->setEnabled(false); cancelBtn->setFixedSize(72, 36); connectBtn->setFixedSize(72, 36); cancelBtn->setText(tr("Cancel")); connectBtn->setText(tr("Connect")); buttonLyt->addStretch(); buttonLyt->addWidget(cancelBtn); buttonLyt->addWidget(connectBtn); buttonFrame->setLayout(buttonLyt); QString btnOffQss = "QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);color:white;font-size:14px;}" "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);"; cancelBtn->setStyleSheet(btnOffQss); connectBtn->setStyleSheet(btnOffQss); nameEditor->setContextMenuPolicy(Qt::NoContextMenu); //禁止LineEdit的右键菜单 userEditor->setContextMenuPolicy(Qt::NoContextMenu); pwdEditor->setContextMenuPolicy(Qt::NoContextMenu); m_frameList.append(titleFrame); m_frameList.append(nameFrame); m_frameList.append(securityFrame); m_frameList.append(eapFrame); m_frameList.append(innerFrame); m_frameList.append(userFrame); m_frameList.append(pwdFrame); m_frameList.append(buttonFrame); } void WpaWifiDialog::initCombox() { //wifi安全性 //securityCombox->addItem(tr("WPA & WPA2")); securityCombox->addItem(tr("None")); //无 securityCombox->addItem(tr("WPA and WPA2 Personal")); //WPA 及 WPA2 个人 securityCombox->addItem(tr("WPA and WPA2 Enterprise")); //WPA 及 WPA2 企业 securityCombox->addItem(tr("WPA2 and WPA3 Personal")); //WPA2 及 WPA3 个人 securityCombox->addItem(tr("WPA3 Personal")); //WPA3 个人 //ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) //ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 //ui->cbxSecurity->addItem("LEAP"); //ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) securityCombox->setCurrentIndex(2); connect(securityCombox,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog())); // securityCombox->setEnabled(false); //EAP方法 QStringList eapStringList; /*eapStringList<< "PEAP" << "FAST" << "MD5" << "PWD" << "SIM" << "TLS" << "TTLS";*/ /*eapStringList<< "PEAP";*/ // eapStringList << "TLS" << "PEAP" << "PWD" << "FAST" << "TTLS" << "LEAP"; //暂时隐藏尚未完成的功能 eapStringList << "TLS" << "PEAP"; for (int i = 0; i < eapStringList.length(); i++) { eapCombox->addItem(eapStringList.at(i), QString(eapStringList.at(i)).toLower()); } connect(eapCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(eapTypeChange())); //阶段2认证方式 QStringList innerStringList; //innerStringList<< "MSCHAPv2" << "MSCHAP" << "MD5" << "CHAP" << "OTP" << "GTC" << "PAP" << "TLS"; innerStringList<< "MSCHAPv2"; for (int i = 0; i < innerStringList.length(); i++) { innerCombox->addItem(innerStringList.at(i), QString(innerStringList.at(i)).toLower()); } if (connectionName == "") { askPwdBtn->setChecked(true); return; } // //读配置文件 wifi_info = getWifiInfo(connectionName); // qDebug() << wifi_info << wifi_info.length(); if (wifi_info.length() < 4) { askPwdBtn->setChecked(true); has_config = false; } else { has_config = true; //读配置信息 eapCombox->setCurrentIndex(eapCombox->findData(wifi_info.at(0))); innerCombox->setCurrentIndex(innerCombox->findData(wifi_info.at(1))); getPwdFlag(); if (pwd_flag == 2) { askPwdBtn->setChecked(true); for (int i = 2; i < wifi_info.length() - 1; i++) { user_list << wifi_info.at(i); } } else { askPwdBtn->setChecked(false); pwdEditor->setText(wifi_info.at(wifi_info.length() - 1)); this->connectBtn->setEnabled(true); for (int i = 2; i < wifi_info.length() - 1; i++) { user_list << wifi_info.at(i); } } // askPwdBtn->setChecked(wifi_info.at(wifi_info.length() - 1) == "true"); userEditor->setText(user_list.at(user_list.length() - 1)); QCompleter *completer = new QCompleter(userEditor); QStringListModel * listModel = new QStringListModel(user_list, userEditor); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setModel(listModel); userEditor->setCompleter(completer); } /*选择CA证书路径*/ m_CAComboBox->addItem(tr("None"), QString(tr("None"))); //无 m_CAComboBox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... m_CAComboBox->setCurrentIndex(0); connect(m_CAComboBox, static_cast(&QComboBox::currentIndexChanged), this, [=] (const 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()) { m_wifiConfig->caCert = fileName; QStringList nameList = fileName.split("/"); m_CAComboBox->setItemText(0, nameList.back()); m_CAComboBox->setCurrentIndex(0); } else { m_CAComboBox->setItemText(0, tr("None")); m_CAComboBox->setCurrentIndex(0); } } else { qWarning() << "Choose file is null or unvalible"; } checkConnectBtnIsEnabled(); }); m_UserCertificateComboBox->addItem(tr("None"), QString(tr("None"))); //无 m_UserCertificateComboBox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... m_UserCertificateComboBox->setCurrentIndex(0); connect(m_UserCertificateComboBox, static_cast(&QComboBox::currentIndexChanged), this, [=] (const 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()) { m_wifiConfig->clientCert = fileName; QStringList nameList = fileName.split("/"); m_UserCertificateComboBox->setItemText(0, nameList.back()); m_UserCertificateComboBox->setCurrentIndex(0); } else { m_UserCertificateComboBox->setItemText(0, tr("None")); m_UserCertificateComboBox->setCurrentIndex(0); } } else { qWarning() << "Choose file is null or unvalible"; } checkConnectBtnIsEnabled(); }); m_UserPrivateKeyComboBox->addItem(tr("None"), QString(tr("None"))); //无 m_UserPrivateKeyComboBox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... m_UserPrivateKeyComboBox->setCurrentIndex(0); connect(m_UserPrivateKeyComboBox, static_cast(&QComboBox::currentIndexChanged), this, [=] (const 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 *.key *.cer *.pfx)")); if (!fileName.isNull()) { m_wifiConfig->privateKey = fileName; QStringList nameList = fileName.split("/"); m_UserPrivateKeyComboBox->setItemText(0, nameList.back()); m_UserPrivateKeyComboBox->setCurrentIndex(0); } else { m_UserPrivateKeyComboBox->setItemText(0, tr("None")); m_UserPrivateKeyComboBox->setCurrentIndex(0); } } else { qWarning() << "Choose file is null or unvalible"; } checkConnectBtnIsEnabled(); }); } void WpaWifiDialog::changeDialog() { if (securityCombox->currentIndex() == 0) { //无安全性 QApplication::setQuitOnLastWindowClosed(false); this->close(); DlgHideWifi *connHidWifi = new DlgHideWifi(0,mw); connHidWifi->show(); connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } if (securityCombox->currentIndex() == 1) { //WPA 及 WPA2 个人 QApplication::setQuitOnLastWindowClosed(false); this->close(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(1, 0, mw); connHidWifiWpa->show(); connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } if (securityCombox->currentIndex() == 3) { // WPA2 及 WPA3 个人 QApplication::setQuitOnLastWindowClosed(false); this->close(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(3, 0, mw); connHidWifiWpa->show(); connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } if (securityCombox->currentIndex() == 4) { //WPA3 个人 QApplication::setQuitOnLastWindowClosed(false); this->close(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(4, 0, mw); connHidWifiWpa->show(); connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } } /** * @brief WpaWifiDialog::getPwdFlag 获取是否每次询问密码 * @return */ void WpaWifiDialog::getPwdFlag() { QProcess * process = new QProcess(this); QString ssid = nameEditor->text(); process->start(QString("nmcli -f 802-1x.password-flags connection show '%1'").arg(ssid)); connect(process, static_cast(&QProcess::finished), this, [ = ]() { process->deleteLater(); }); connect(process, &QProcess::readyReadStandardOutput, this, [ = ]() { QString str = process->readAllStandardOutput(); pwd_flag = str.mid(str.lastIndexOf(" ") - 1, 1).toInt(); }); process->waitForFinished(); } /** * @brief WpaWifiDialog::setPwdFlag 设置是否每次询问密码 * @param flag 0不询问, 2询问 * @return */ bool WpaWifiDialog::setPwdFlag(const int & flag) { QProcess * process = new QProcess; QString ssid = nameEditor->text(); process->start(QString("nmcli connection modify '%1' 802-1x.password-flags %2").arg(ssid).arg(QString::number(flag))); connect(process, static_cast(&QProcess::finished), this, [ = ]() { process->deleteLater(); }); process->waitForFinished(); return true; } void WpaWifiDialog::initConnect() { //取消按钮 connect(cancelBtn, &QPushButton::clicked, this, [ = ]() { this->close(); }); //连接按钮 connect(connectBtn, &QPushButton::clicked, this, &WpaWifiDialog::slot_on_connectBtn_clicked); //显示密码 connect(pwdShowBtn, &QCheckBox::clicked, this, [ = ]() { if (pwdEditor->echoMode() == QLineEdit::Password) { pwdShowBtn->setChecked(true); pwdEditor->setEchoMode(QLineEdit::Normal); m_pwd4PrivateKeyPWDEditor->setEchoMode(QLineEdit::Normal); } else { pwdShowBtn->setChecked(false); pwdEditor->setEchoMode(QLineEdit::Password); m_pwd4PrivateKeyPWDEditor->setEchoMode(QLineEdit::Password); } }); // connect(pwdShowBtn, &QCheckBox::released, this, [ = ]() { // pwdShowBtn->setChecked(false); // pwdEditor->setEchoMode(QLineEdit::Password); // m_pwd4PrivateKeyPWDEditor->setEchoMode(QLineEdit::Password); // }); connect(pwdEditor, &QLineEdit::textChanged, this, &WpaWifiDialog::slot_line_edit_changed); connect(userEditor, &QLineEdit::textChanged, this, &WpaWifiDialog::slot_line_edit_changed); connect(nameEditor, &QLineEdit::textChanged, this, &WpaWifiDialog::slot_line_edit_changed); connect(m_isCANeededShowBtn, &QCheckBox::clicked, this, [=]() { if (m_isCANeededShowBtn->isChecked()) { m_CAComboBox->setDisabled(true); if (m_wifiConfig) { m_wifiConfig->caCert = nullptr; } } else { m_CAComboBox->setDisabled(false); } checkConnectBtnIsEnabled(); }); connect(m_identityEditor, &QLineEdit::textChanged, this, [=]() { m_wifiConfig->identity = m_identityEditor->text(); checkConnectBtnIsEnabled(); }); connect(m_pwd4PrivateKeyPWDEditor, &QLineEdit::textChanged, this, [=]() { checkConnectBtnIsEnabled(); }); } void WpaWifiDialog::slot_line_edit_changed() { if (pwdEditor->text().length() >= 1 && userEditor->text().length() >= 1) { connectBtn->setEnabled(true); } else { connectBtn->setEnabled(false); } if (nameEditor->text().size() > 32) { QString cutStr = nameEditor->text().mid(0,32); nameEditor->setText(cutStr); } } void WpaWifiDialog::slot_on_connectBtn_clicked() { qDebug()<<"Clicked on connect Btn!"; //this->mw->is_stop_check_net_state = 1; //this->mw->setTrayLoading(true); //写/tmp/wpaconfig.ini配置文件 QProcess shellProcess; shellProcess.start("nmcli -f ssid device wifi"); shellProcess.waitForFinished(3000); // 等待最多3s bool is_hidden = true; if (shellProcess.exitCode() == 0) { QString shellOutput = shellProcess.readAllStandardOutput(); QStringList wlist = shellOutput.split("\n"); foreach (QString wifi, wlist) { if (wifi.trimmed() == nameEditor->text()) { is_hidden = false; } } } if (eapCombox->currentIndex() == EapType::TTLS) { //Todo } if (has_config) { appendWifiUser(nameEditor->text(), userEditor->text()); } else { appendWifiInfo(nameEditor->text(), eapCombox->currentData().toString(), innerCombox->currentData().toString(), userEditor->text(), askPwdBtn->isChecked()); has_config = true; } // QString cmdStr = "nmcli connection modify " + nameEditor->text() + " 802-1x.password " + pwdEditor->text(); QString cmdStr = "nmcli connection modify '" + nameEditor->text() + "' ipv4.method auto"; int res = Utils::m_system(cmdStr.toUtf8().data()); if (res == 0) { //有配置文件,需要判断一下当前配置文件wifi安全性是不是wpa-eap,若不是,需要把原配置文件删除,重新配置 QProcess * process = new QProcess(this); process->start(QString("nmcli -f 802-11-wireless-security.key-mgmt connection show %1").arg(nameEditor->text())); connect(process, static_cast(&QProcess::finished), this, [ = ]() { process->deleteLater(); }); connect(process, &QProcess::readyReadStandardOutput, this, [ = ]() { QString str = process->readAllStandardOutput(); key_mgmt = str.mid(str.lastIndexOf(" ") + 1, str.length() - str.lastIndexOf(" ") - 2); }); process->waitForFinished(); if (QString::compare(key_mgmt, "wpa-eap")) { //原配置文件不是企业wifi,删掉重新创建 QString cmdStr = "nmcli connection delete " + nameEditor->text(); Utils::m_system(cmdStr.toUtf8().data()); goto next; } process->waitForFinished(); //有网络配置文件,接下来修改网络配置,然后激活连接 QString cmdStr_1; if (eapCombox->currentIndex() == EapType::TLS) { qDebug() << "nmcli connection modify '" + m_wifiConfig->connectName + "' 802-1x.eap " + eapCombox->currentData().toString()+ " 802-1x.ca-cert " + (m_wifiConfig->caCert.isEmpty() ? "''" : m_wifiConfig->caCert) + " 802-1x.identity " + m_wifiConfig->identity + " 802-1x.client-cert " + m_wifiConfig->clientCert + " 802-1x.private-key " + m_wifiConfig->privateKey + " 802-1x.private-key-password " + m_pwd4PrivateKeyPWDEditor->text(); cmdStr_1 = "nmcli connection modify '" + m_wifiConfig->connectName + "' 802-1x.eap " + eapCombox->currentData().toString()+ " 802-1x.ca-cert " + m_wifiConfig->caCert + " 802-1x.identity " + m_wifiConfig->identity + " 802-1x.client-cert " + m_wifiConfig->clientCert + " 802-1x.private-key " + m_wifiConfig->privateKey + " 802-1x.private-key-password " + m_pwd4PrivateKeyPWDEditor->text(); } if (eapCombox->currentIndex() == EapType::PEAP) { qDebug()<<"qDebug: 有配置文件,修改配置后激活:"<<"\n"<< "qDebug: nmcli connection modify '" + nameEditor->text() + "' 802-1x.eap " + eapCombox->currentData().toString() + " 802-1x.phase2-auth " + innerCombox->currentData().toString() + " 802-1x.identity " + userEditor->text() + " 802-1x.password " + pwdEditor->text(); cmdStr_1 = "nmcli connection modify '" + nameEditor->text() + "' 802-1x.eap " + eapCombox->currentData().toString()+ " 802-1x.phase2-auth " + innerCombox->currentData().toString() + " 802-1x.identity " + userEditor->text() + " 802-1x.password " + pwdEditor->text(); } if (is_hidden) { cmdStr_1 += " 802-11-wireless.hidden yes"; } else { cmdStr_1 += " 802-11-wireless.hidden no"; } Utils::m_system(cmdStr_1.toUtf8().data()); if (askPwdBtn->isChecked() && eapCombox->currentIndex() == EapType::PEAP) setPwdFlag(2); else setPwdFlag(0); //激活连接 activateConnection(); } else { next: //无网络配置文件,需要新创建 //获取网卡名称 KylinDBus mkylindbus; QString wifi_card_name= mkylindbus.dbusWiFiCardName; qDebug()<<"qDebug: 无配置文件,使用如下配置新建配置文件:"<<"\n"<< "qDebug: con-name & ssid: "<text()<<"\n"<< "qDebug: wifi card name(ifname): "<currentData().toString()<<"\n"<< "qDebug: 802-1x.phase2-auth: "<currentData().toString()<<"\n"<< "qDebug: 802-1x.identity: "<text()<<"\n"<< "qDebug: 802-1x.password: "<text(); QString create_cmd; if (eapCombox->currentIndex() == EapType::TLS) { create_cmd = "nmcli connection add con-name '" + nameEditor->text() + "' ifname " + wifi_card_name + " ipv4.method auto type wifi ssid " + nameEditor->text() + " 802-1x.eap " + eapCombox->currentData().toString()+ " 802-1x.ca-cert " + (m_wifiConfig->caCert.isEmpty() ? "''" : m_wifiConfig->caCert) + " 802-1x.identity " + m_wifiConfig->identity + " 802-1x.client-cert " + m_wifiConfig->clientCert + " 802-1x.private-key " + m_wifiConfig->privateKey + " 802-1x.private-key-password " + m_pwd4PrivateKeyPWDEditor->text() + " wifi-sec.key-mgmt wpa-eap autoconnect yes"; qDebug() << create_cmd; } if (eapCombox->currentIndex() == EapType::PEAP) { create_cmd = "nmcli connection add con-name '" + nameEditor->text() + "' ifname " + wifi_card_name + " ipv4.method auto type wifi ssid " + nameEditor->text() + " 802-1x.eap " + eapCombox->currentData().toString() + " 802-1x.phase2-auth " + innerCombox->currentData().toString() + " 802-1x.identity " + userEditor->text() + " 802-1x.password " + pwdEditor->text() + " wifi-sec.key-mgmt wpa-eap autoconnect no"; } // qDebug() << create_cmd; if (is_hidden) { create_cmd += " 802-11-wireless.hidden yes"; } int res = Utils::m_system(create_cmd.toUtf8().data()); if (res == 0) { qDebug() << "qDebug: created a wifi config successfully in function slot_on_connectBtn_clicked"; if (askPwdBtn->isChecked() && eapCombox->currentIndex() == EapType::PEAP) setPwdFlag(2); else setPwdFlag(0); //创建成功,激活连接 activateConnection(); } else { qDebug() << "qDebug: create wpa wifi config file failed in function slot_on_connectBtn_clicked"; } } } void WpaWifiDialog::setEditorEnable(bool is_checking) { securityCombox->setEnabled(is_checking); eapCombox->setEnabled(is_checking); innerCombox->setEnabled(is_checking); userEditor->setEnabled(is_checking); pwdEditor->setEnabled(is_checking); pwdShowBtn->setEnabled(is_checking); pwdShowLabel->setEnabled(is_checking); askPwdBtn->setEnabled(is_checking); askPwdlabel->setEnabled(is_checking); cancelBtn->setEnabled(is_checking); connectBtn->setEnabled(is_checking); m_identityEditor->setEnabled(is_checking); m_anonymousIdentityEditor->setEnabled(is_checking); m_domainEditor->setEnabled(is_checking); m_CAComboBox->setEnabled(is_checking); m_isCANeededShowBtn->setEnabled(is_checking); m_UserCertificateComboBox->setEnabled(is_checking); m_UserPrivateKeyComboBox->setEnabled(is_checking); m_pwd4PrivateKeyPWDEditor->setEnabled(is_checking); } void WpaWifiDialog::activateConnection() { if (this->mw->is_stop_check_net_state == 1) { // conn_failed(); return; } UpConnThread * upThread = new UpConnThread(userEditor->text(), pwdEditor->text()); upThread->conn_name = nameEditor->text(); //超时计时器 QTimer * timeout = new QTimer(this); connect(upThread, &UpConnThread::started, this, [ = ]() { //线程开始,开始校验密码,此时弹窗的连接按钮被禁用,所有输入框禁用 setEditorEnable(false); QObject::connect(timeout, &QTimer::timeout, this, [ = ](){ //连接超时 timeout->stop(); timeout->deleteLater(); QString cmdStr_2 = "nmcli connection down '" + nameEditor->text() + "'"; Utils::m_system(cmdStr_2.toUtf8().data()); this->mw->is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; this->mw->setTrayLoading(false); mw->getActiveInfoAndSetTrayIcon(); qDebug() << "qDebug: activate time out in function activateConnection"; qDebug() << "qDebug: 连接超时(30秒超时时间)"; }); //设置超时时间 timeout->start(30 * 1000); }); connect(upThread, &UpConnThread::connRes, this, [ = ](int res) { //qDebug()<<"qDebug: Connect result is: "<on_btnWifiList_clicked(); //emit conn_failed(); this->mw->is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; this->mw->setTrayLoading(false); mw->getActiveInfoAndSetTrayIcon(); QString notifyMsg(tr("password may be error, so activeate connection failed")); mw->objKyDBus->showDesktopNotify(notifyMsg); } else { //连接成功 timeout->stop(); timeout->deleteLater(); upThread->quit(); upThread->wait(); upThread->deleteLater(); mw->on_btnWifiList_clicked(); //emit conn_done(); this->mw->is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; this->mw->setTrayLoading(false); mw->getActiveInfoAndSetTrayIcon(); QString notifyMsg(tr("activeate connection successfully")); mw->objKyDBus->showDesktopNotify(notifyMsg); qDebug() << "qDebug: activated wpa security wifi successfully"; this->close(); } }); upThread->start(); this->mw->is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; this->mw->setTrayLoading(true); } QStringList WpaWifiDialog::getWifiInfo(QString wifiName) { //返回名为wifiName的企业wifi的配置信息,包括eap,inner和用户列表 QStringList wlist; QFile file(CONFIG_FILE); if(!file.exists()) { return wlist; } QSharedPointer autoSettings = QSharedPointer(new QSettings(CONFIG_FILE, QSettings::IniFormat)); autoSettings.get()->beginGroup(wifiName); wlist << autoSettings.get()->value("eap").toString(); wlist << autoSettings.get()->value("inner").toString(); autoSettings.get()->beginReadArray(wifiName); for (int i = 0; ; i++) { autoSettings.get()->setArrayIndex(i); if (autoSettings.get()->value("user").toString().isEmpty()) { break; } wlist << autoSettings.get()->value("user").toString(); } autoSettings.get()->endArray(); wlist << autoSettings.get()->value("pwd").toString(); autoSettings.get()->endGroup(); return wlist; } bool WpaWifiDialog::appendWifiInfo(QString name, QString eap, QString inner, QString user, bool ask) { //向配置文件添加名为name的wifi配置,包括eap,inner和它的第一个用户 QSharedPointer autoSettings = QSharedPointer(new QSettings(CONFIG_FILE, QSettings::IniFormat)); autoSettings.get()->beginGroup(name); autoSettings.get()->setValue("eap", eap); autoSettings.get()->setValue("inner", inner); //以数组形式写入用户名 autoSettings.get()->beginWriteArray(name); autoSettings.get()->setArrayIndex(0); autoSettings.get()->setValue("user", user); user_list << user; autoSettings.get()->endArray(); // autoSettings.get()->setValue("askpwd", ask); autoSettings.get()->setValue("pwd", this->pwdEditor->text()); return true; } bool WpaWifiDialog::appendWifiUser(QString name, QString user) { //向名为name的wifi用户列表添加名为user的用户名 QSharedPointer autoSettings = QSharedPointer(new QSettings(CONFIG_FILE, QSettings::IniFormat)); // autoSettings.get()->beginWriteArray(name); // autoSettings.get()->setArrayIndex(0); //读到用户名列表长度并在队尾添加一个用户名 autoSettings.get()->beginGroup(name); autoSettings.get()->setValue("eap", eapCombox->currentData().toString()); autoSettings.get()->setValue("inner", innerCombox->currentData().toString()); // autoSettings.get()->setValue("askpwd", askPwdBtn->isChecked()); autoSettings.get()->setValue("pwd", this->pwdEditor->text()); if (user_list.contains(user)) { autoSettings.get()->endGroup(); return true; } autoSettings.get()->beginReadArray(name); int size = 1; while (size) { autoSettings.get()->setArrayIndex(size); if (autoSettings.get()->value("user").toString().isEmpty()) { autoSettings.get()->setValue("user", user); user_list << user; break; } size ++; } // autoSettings.get()->beginWriteArray(name); // autoSettings.get()->setArrayIndex(size + 1); // autoSettings.get()->setValue("user", user); autoSettings.get()->endArray(); autoSettings.get()->endGroup(); return true; } //void WpaWifiDialog::mousePressEvent(QMouseEvent *event) //{ // if (event->button() == Qt::LeftButton) { // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } // return QDialog::mousePressEvent(event); //} //void WpaWifiDialog::mouseReleaseEvent(QMouseEvent *event) //{ // this->isPress = false; //} //void WpaWifiDialog::mouseMoveEvent(QMouseEvent *event) //{ // if (this->isPress) { // this->move(this->winPos - (this->dragPos - event->globalPos())); // event->accept(); // } // return QDialog::mouseMoveEvent(event); //} //void WpaWifiDialog::keyPressEvent(QKeyEvent *event) //{ // //return QDialog::keyPressEvent(event); //} void WpaWifiDialog::paintEvent(QPaintEvent *event) { KylinDBus mkylindbus; double trans = mkylindbus.getTransparentData(); QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } void WpaWifiDialog::eapTypeChange() { deleteAllItemOfLayout(mainLyt); mainLyt->addWidget(titleFrame); mainLyt->addWidget(nameFrame); mainLyt->addWidget(securityFrame); mainLyt->addWidget(hLine); mainLyt->addWidget(eapFrame); // << "TLS" << "LEAP" << "PWD" << "FAST" << "TTLS" << "PEAP"; switch (eapCombox->currentIndex()) { case EapType::TLS: mainLyt->addWidget(m_identityFrame); mainLyt->addWidget(m_domainFrame); mainLyt->addWidget(m_CAFrame); mainLyt->addWidget(m_isCANeededFrame); mainLyt->addWidget(m_UserCertificateFrame); mainLyt->addWidget(m_UserPrivateKeyFrame); mainLyt->addWidget(m_pwd4PrivateKeyPWDFrame); mainWidget->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_TLP); this->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_TLP); break; case EapType::LEAP: // Todo mainWidget->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_ELSE); this->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_ELSE); break; case EapType::PWD: // Todo mainWidget->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_ELSE); this->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_ELSE); break; case EapType::FAST: // Todo mainWidget->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_ELSE); this->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_ELSE); break; case EapType::TTLS: // Todo /* mainLyt->addWidget(m_anonymousIdentityFrame); mainLyt->addWidget(m_domainFrame); mainLyt->addWidget(m_CAFrame); mainLyt->addWidget(m_isCANeededFrame); mainLyt->addWidget(innerFrame); mainLyt->addWidget(userFrame); mainLyt->addWidget(pwdFrame); */ mainWidget->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_ELSE); this->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_ELSE); break; case EapType::PEAP: // 需要抽离的 mainLyt->addWidget(innerFrame); mainLyt->addWidget(userFrame); mainLyt->addWidget(pwdFrame); mainWidget->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_PEAP); this->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_PEAP); break; default: // TLS mainLyt->addWidget(m_identityFrame); mainLyt->addWidget(m_domainFrame); mainLyt->addWidget(m_CAFrame); mainLyt->addWidget(m_UserCertificateFrame); mainLyt->addWidget(m_UserPrivateKeyFrame); mainLyt->addWidget(m_pwd4PrivateKeyPWDFrame); mainWidget->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_TLP); this->setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT_TLP); break; } mainLyt->addWidget(pwdShowFrame); mainLyt->addWidget(buttonFrame); repaint(); } void WpaWifiDialog::initCAConfigUI() { /*身份 identity*/ m_identityFrame = new QFrame(nullptr); m_identityLyt = new QHBoxLayout(m_identityFrame); m_identityLabel = new QLabel(m_identityFrame); m_identityEditor = new QLineEdit(m_identityFrame); m_identityLabel->setText(tr("Identity")); m_identityLyt->addWidget(m_identityLabel); m_identityLyt->setContentsMargins(24, 0, 24, 0); m_identityLyt->addWidget(m_identityEditor); m_identityFrame->setFixedHeight(48); m_identityLabel->setFixedWidth(100); m_identityEditor->setFixedHeight(ITEAM_FIXED_HEIGHT); m_identityFrame->setLayout(m_identityLyt); m_frameList.append(m_identityFrame); /*匿名身份 anonymous identity*/ m_anonymousIdentityFrame = new QFrame(nullptr); m_anonymousIdentityLyt = new QHBoxLayout(m_anonymousIdentityFrame); m_anonymousIdentityLabel = new QLabel(m_anonymousIdentityFrame); m_anonymousIdentityEditor = new QLineEdit(m_anonymousIdentityFrame); m_anonymousIdentityLabel->setText(tr("Anonymous Identity")); m_anonymousIdentityLabel->setFixedWidth(100); m_anonymousIdentityLyt->setContentsMargins(24, 0, 24, 0); m_anonymousIdentityLyt->addWidget(m_anonymousIdentityLabel); m_anonymousIdentityLyt->addWidget(m_anonymousIdentityEditor); m_anonymousIdentityFrame->setFixedHeight(48); m_anonymousIdentityEditor->setFixedHeight(ITEAM_FIXED_HEIGHT); m_anonymousIdentityFrame->setLayout(m_anonymousIdentityLyt); m_frameList.append(m_anonymousIdentityFrame); /*域 domain*/ m_domainFrame = new QFrame(nullptr); m_domainLyt = new QHBoxLayout(m_domainFrame); m_domainLabel = new QLabel(m_domainFrame); m_domainEditor = new QLineEdit(m_domainFrame); m_domainLabel->setText(tr("Domain")); m_domainLabel->setFixedWidth(100); m_domainLyt->setContentsMargins(24, 0, 24, 0); m_domainLyt->addWidget(m_domainLabel); m_domainLyt->addWidget(m_domainEditor); m_domainFrame->setFixedHeight(48); m_domainEditor->setFixedHeight(ITEAM_FIXED_HEIGHT); m_domainFrame->setLayout(m_anonymousIdentityLyt); m_frameList.append(m_domainFrame); /*CA证书 certificate*/ m_CAFrame = new QFrame(nullptr); m_CALyt = new QHBoxLayout(m_CAFrame); m_CALabel = new QLabel(m_CAFrame); m_CAComboBox = new QComboBox(m_CAFrame); m_CALabel->setText(tr("CA certificate")); m_CALabel->setFixedWidth(100); m_CALyt->setContentsMargins(24, 0, 24, 0); m_CALyt->addWidget(m_CALabel); m_CALyt->addWidget(m_CAComboBox);// 默认为(无)、QFileDialog m_CAFrame->setFixedHeight(48); m_CAComboBox->setFixedHeight(ITEAM_FIXED_HEIGHT); m_CAFrame->setLayout(m_CALyt); m_frameList.append(m_CAFrame); /*不需要CA证书? no need for CA certificate*/ m_isCANeededFrame = new QFrame(nullptr); m_isCANeededShowLyt = new QHBoxLayout(m_isCANeededFrame); m_isCANeededShowBtn = new QCheckBox(m_isCANeededFrame); m_isCANeededShowLabel = new QLabel(m_isCANeededFrame); m_isCANeededShowLabel->setText(tr("no need for CA certificate")); m_isCANeededShowLabel->setFixedWidth(200); m_isCANeededShowLyt->setContentsMargins(24, 0, 24, 0); m_isCANeededShowLyt->addWidget(m_isCANeededShowBtn); m_isCANeededShowLyt->addWidget(m_isCANeededShowLabel);// tr("no need for CA certificate") m_isCANeededShowBtn->setFixedSize(16, 16); m_isCANeededShowBtn->setStyleSheet("background-color:rgb(61,61,65);"); m_isCANeededFrame->setFixedHeight(24); m_isCANeededFrame->setLayout(m_isCANeededShowLyt); m_frameList.append(m_isCANeededFrame); } void WpaWifiDialog::initUserConfig4TLSUI() { /*用户证书 user certificate*/ m_UserCertificateFrame = new QFrame(nullptr); m_UserCertificateLyt = new QHBoxLayout(m_UserCertificateFrame); m_UserCertificateLabel = new QLabel(m_UserCertificateFrame); m_UserCertificateComboBox = new QComboBox(m_UserCertificateFrame);// 默认为(无)、QFileDialog m_UserCertificateLabel->setText(tr("User Certificate")); m_UserCertificateLabel->setFixedWidth(100); m_UserCertificateLyt->addWidget(m_UserCertificateLabel); m_UserCertificateLyt->addWidget(m_UserCertificateComboBox);// 默认为(无)、QFileDialog m_UserCertificateLyt->setContentsMargins(24, 0, 24, 0); m_UserCertificateFrame->setFixedHeight(48); m_UserCertificateFrame->setLayout(m_UserCertificateLyt); m_UserCertificateComboBox->setFixedHeight(ITEAM_FIXED_HEIGHT); /*用户私钥 user private key*/ m_UserPrivateKeyFrame = new QFrame(nullptr); m_UserPrivateKeyLyt = new QHBoxLayout(m_UserPrivateKeyFrame); m_UserPrivateKeyLabel = new QLabel(m_UserPrivateKeyFrame); m_UserPrivateKeyComboBox = new QComboBox(m_UserPrivateKeyFrame);// 默认为(无)、QFileDialog m_UserPrivateKeyLabel->setText(tr("User Private Key")); m_UserPrivateKeyLabel->setFixedWidth(100); m_UserPrivateKeyComboBox->setFixedHeight(ITEAM_FIXED_HEIGHT); m_UserPrivateKeyLyt->addWidget(m_UserPrivateKeyLabel); m_UserPrivateKeyLyt->addWidget(m_UserPrivateKeyComboBox);// 默认为(无)、QFileDialog m_UserPrivateKeyLyt->setContentsMargins(24, 0, 24, 0); m_UserPrivateKeyFrame->setFixedHeight(48); m_UserPrivateKeyFrame->setLayout(m_UserPrivateKeyLyt); /*私钥密码 password for private key*/ m_pwd4PrivateKeyPWDFrame = new QFrame(nullptr); m_pwd4PrivateKeyPWDLyt = new QHBoxLayout(m_pwd4PrivateKeyPWDFrame); m_pwd4PrivateKeyPWDLabel = new QLabel(m_pwd4PrivateKeyPWDFrame); m_pwd4PrivateKeyPWDEditor = new QLineEdit(m_pwd4PrivateKeyPWDFrame); m_pwd4PrivateKeyPWDLabel->setText(tr("User Private Key password")); m_pwd4PrivateKeyPWDLabel->setFixedWidth(100); m_pwd4PrivateKeyPWDEditor->setEchoMode(QLineEdit::Password); m_pwd4PrivateKeyPWDEditor->setFixedHeight(ITEAM_FIXED_HEIGHT); m_pwd4PrivateKeyPWDLyt->addWidget(m_pwd4PrivateKeyPWDLabel); m_pwd4PrivateKeyPWDLyt->addWidget(m_pwd4PrivateKeyPWDEditor); m_pwd4PrivateKeyPWDLyt->setContentsMargins(24, 0, 24, 0); m_pwd4PrivateKeyPWDFrame->setFixedHeight(48); m_pwd4PrivateKeyPWDFrame->setLayout(m_pwd4PrivateKeyPWDLyt); } /** * @brief WpaWifiDialog::deleteAllItemOfLayout * @param layout * 清空布局中的所有控件 */ void WpaWifiDialog::deleteAllItemOfLayout(QLayout *layout) { qDebug() << "WpaWifiDialog::deleteAllItemOfLayout"; QLayoutItem *child; while ((child = layout->takeAt(0)) != nullptr) { if (child->widget()) { child->widget()->setParent(nullptr); } else if (child->layout()) { deleteAllItemOfLayout(child->layout()); } delete child; } } void WpaWifiDialog::checkConnectBtnIsEnabled() { // << "TLS" << "LEAP" << "PWD" << "FAST" << "TTLS" << "PEAP"; if(m_wifiConfig == nullptr || m_wifiConfig->connectName.isEmpty()) { qWarning() << "WpaWifiDialog::checkConnectBtnIsEnabled no wifi config"; return; } switch (eapCombox->currentIndex()) { case EapType::TLS: if (m_wifiConfig->identity.isEmpty() || (m_wifiConfig->caCert.isEmpty() && !m_isCANeededShowBtn->isChecked()) || m_wifiConfig->clientCert.isEmpty() || m_wifiConfig->privateKey.isEmpty() || (m_pwd4PrivateKeyPWDEditor->text().length() <= 0)) { connectBtn->setEnabled(false); } else { connectBtn->setEnabled(true); } break; case EapType::LEAP: // Todo break; case EapType::PWD: // Todo break; case EapType::FAST: // Todo break; case EapType::TTLS: if (m_wifiConfig->anonymousIdentity.isEmpty() || (m_wifiConfig->caCert.isEmpty() && !m_isCANeededShowBtn->isChecked()) || pwdEditor->text().length() <= 0 || userEditor->text().length() <= 0) { connectBtn->setEnabled(false); } else { connectBtn->setEnabled(true); } break; case EapType::PEAP: if (pwdEditor->text().length() >= 1 && userEditor->text().length() >= 1) { connectBtn->setEnabled(true); } else { connectBtn->setEnabled(false); } break; default: connectBtn->setEnabled(false); break; } return; } kylin-nm/src/kylin-network-interface.h0000644000175000017500000001504514205345374016763 0ustar fengfeng/* * 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 #include #ifdef __cplusplus extern "C"{ #endif typedef struct { char *if_name; }ifname; typedef struct { char *ssid;//wifi名称 int signal;//信号强度 char *safety;//安全性 }wifilist;//存放wifi信息的结构体 typedef struct { char *con_name;//网络连接名称 char *type;//网络连接类型 }conlist;//存放所有网络连接 typedef struct { char *con_name;//活动网络连接名称 char *type;//活动网络连接类型 char *dev;//活动网络所属设备 }activecon;//存放当前活动网络连接 /* * Get the network interface name. * return the struct pointer. */ ifname *kylin_network_get_ifacename(); /* * Get the all network connection. * return the struct pointer. */ conlist *kylin_network_get_conlist_info(); /* * Get the active network connection. * return the struct pointer. */ activecon *kylin_network_get_activecon_info(); /* * Create a new Ethernet connection. * @con_name is the connection name. * @if_name is the interface name. */ void kylin_network_create_new_ethernet(char *con_name,char *if_name); /* * Create a new Wifi connection. * @con_name is the connection name. * @if_name is the interface name. */ void kylin_network_create_new_wifi(char *con_name, char *if_name); /* * Delete ethernet connection. * @con_name is the connection name. */ void kylin_network_del_ethernet_con(char *con_name); /* * Set up dynamic IP allocation. * @con_name is the connection name. */ void kylin_network_set_automethod(char *con_uuid,char *con_name); void kylin_network_set_ipv6_automethod(char *con_name); /* * Set up manual IP assignment. * @con_name is the connection name. * @ip is the ip address(for example,"192.168.68.160/16") */ void kylin_network_set_manualmethod(char *con_name,char *ip); void kylin_network_set_ipv6_manualmethod(char *con_name,char *ip); /* * Set up manual all prop. */ void kylin_network_set_manualall(char *con_name, char *addr, char *mask, char *gateway, char *dns); /* * ksn. */ void kylin_network_set(char *con_uuid, char *con_name, char *ipv4_addr, char *mask, char *gateway, char *dns,char *ipv6_ip); /* * Sets whether the connection is automatic. * @con_name is the connection name. * @autocon is the automatic connection option. */ void kylin_network_set_autoconnect(char *con_name,bool autocon); /* * Modify the ip address. * @con_name is the connection name. * @ip is the ip address(for example,"192.168.68.160/16") */ void kylin_network_mod_ip(char *con_name,char *ip); /* * Modify the gateway. * @con_name is the connection name. * @gw is the gateway address. */ void kylin_network_mod_gateway(char *con_name,char *gw); /* * Modify the dns address. * @con_name is the connection name. * @dns is the dns address. */ void kylin_network_mod_dns(char *con_name,char *dns); /* * Connect the ethernet. * @con_name is the connection name. */ void kylin_network_set_con_up(char *con_name); /* * Disconnect the ethernet. * @con_name is the connection name. */ void kylin_network_set_con_down(char *con_name); /* * Connect the wifi. * @con_name is the wifi name. * @passwd is the wifi password. */ void kylin_network_set_wifi_up(char *con_name,char *passwd); /* * Disconnect the wifi. * @if_name is the network interface name. */ void kylin_network_set_wifi_down(char *if_name); /* * Get wifi list information. * Return the struct pointer. */ wifilist *kylin_network_get_wifilist_info(); /* * Enable networking. */ void kylin_network_enable_networking(); /* * Disable networking. */ void kylin_network_disable_networking(); /* * Enable wifi. */ void kylin_network_enable_wifi(); /* * Disable wifi. */ void kylin_network_disable_wifi(); /* Get the ip address. * @if_name is the interface name. * @ipaddr is used to save the ip address. */ int kylin_network_get_ipaddr(char *if_name,char *ipaddr); /* * Get the broadcast address. * @if_name is the interface name. * @brdaddr is used to save the broadcast address. */ int kylin_network_get_brdaddr(char *if_name,char *brdaddr); /* * Get the subnet mask. * @if_name is the interface name. * @netmask is used to save the subnet mask. */ int kylin_network_get_netmask(char *if_name,char *netmask); /* * Get MAC address. * @if_name is the interface name. * @macaddr is used to save the MAC address. */ int kylin_network_get_mac(char *if_name,char *macaddr); /* Get the MTU. * @if_name is the interface name. * return the MTU value. */ int kylin_network_get_mtu(char *if_name); /* * Total upload and download data volume. * @if_name is the network interface name. * return the address of the first element of a one-dimensional long integer array. */ long *kylin_network_get_bytes(char *if_name); /* * Total upload and download data packets. * @if_name is the network interface name. * return the address of the first element of a one-dimensional long integer array. */ long *kylin_network_get_packets(char *if_name); /* * Total wrong data packets number of uploading and downloading. * @if_name is the network interface name. * return the address of the first element of a one-dimensional long integer array. */ long *kylin_network_get_errs(char *if_name); /* * Total discarded data packets number of uploading and downloading. * @if_name is the network interface name. * return the address of the first element of a one-dimensional long integer array. */ long *kylin_network_get_drop(char *if_name); /* * Total overloaded data packets number of uploading and downloading. * @if_name is the network interface name. * return the address of the first element of a one-dimensional long integer array. */ long *kylin_network_get_fifo(char *if_name); #ifdef __cplusplus } #endif #endif kylin-nm/src/backthread.cpp0000644000175000017500000010174614205345374014637 0ustar fengfeng/* * 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 #include #include #include #include #include #include #include #include BackThread::BackThread(QObject *parent) : QObject(parent) { cmdProcessWifi = new QProcess(); connect(cmdProcessWifi , SIGNAL(readyReadStandardOutput()) , this , SLOT(onReadOutputWifi())); connect(cmdProcessWifi , SIGNAL(readyReadStandardError()) , this , SLOT(onReadErrorWifi())); cmdProcessLan = new QProcess(); connect(cmdProcessLan , SIGNAL(readyReadStandardOutput()) , this , SLOT(onReadOutputLan())); connect(cmdProcessLan , SIGNAL(readyReadStandardError()) , this , SLOT(onReadErrorLan())); } BackThread::~BackThread() { cmdProcessWifi->close(); cmdProcessLan->close(); } //get the connection state of wired and wireles network IFace* BackThread::execGetIface() { IFace *iface = new IFace(); QString tmpPath = "/tmp/kylin-nm-iface-" + QDir::home().dirName(); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli -f TYPE,DEVICE,STATE device > " + tmpPath; Utils::m_system(cmd.toUtf8().data()); QFile file(tmpPath); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug()<<"Can't open the file ~/.config/kylin-nm-iface!"; } QString txt = file.readAll(); QStringList txtList = txt.split("\n"); file.close(); iface->lstate = DEVICE_UNMANAGED; iface->wstate = DEVICE_UNMANAGED; iface->lmanaged = false; for (int i = 1; i < txtList.size(); i ++) { QString line = txtList.at(i); if (line != "") { int index1 = line.indexOf(" "); QString type = line.left(index1); QString lastStr = line.mid(index1).trimmed(); int index2 = lastStr.indexOf(" "); QString iname = lastStr.left(index2); QString istateStr = lastStr.mid(index2).trimmed(); if (type == "ethernet") { iface->lcards.append(iname); } else if (type == "wifi") { iface->wcards.append(iname); } //只要存在一个有线设备已连接,就不再扫描其他有线设备状态,避免有线被误断开 if (type == "ethernet" && iface->lstate != DEVICE_CONNECTED) { // if type is wired network iface->lname = iname; if (istateStr == "unmanaged") { iface->lstate = DEVICE_UNMANAGED; //switch of wired device is off } else if (istateStr == "unavailable") { iface->lstate = DEVICE_UNAVALIABLE; } else if (istateStr == "disconnected") { iface->lstate = DEVICE_DISCONNECTED; //wired network is disconnected iface->lmanaged = true; } else if (istateStr == "connected" || istateStr == "connecting (getting IP configuration)") { iface->lstate = DEVICE_CONNECTED; //wired network is connected iface->lmanaged = true; } else { //连接中,正在配置 iface->lstate = DEVICE_CONNECTING; iface->lmanaged = true; } } if (type == "wifi" && iface->wname.isEmpty()) { //仅统计第一个无线网卡,后续无线网卡状态必然等于或差与第一个获取到的无线网卡 // if type is wireless network iface->wname = iname; if (istateStr == "unmanaged" || istateStr == "unavailable") { iface->wstate = 2; //switch of wireless device is off } else if (istateStr == "disconnected") { iface->wstate = 1; //wireless network is disconnected } else if (istateStr == "connected") { iface->wstate = 0; //wireless network is connected } else { //连接中,正在配置 iface->wstate = 3; } } } } return iface; } void BackThread::getInitStatus() { QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); // 获取当前wifi是否打开 QDBusReply m_result = interface.call("Get", "org.freedesktop.NetworkManager", "WirelessEnabled"); if (m_result.isValid()) { bool status = m_result.value().toBool(); emit wifiStatus(status); emit getWifiStatusComplete(); } else { qDebug()<<"org.freedesktop.NetworkManager get invalid"<setValue(key, value); m_settings->sync(); delete m_settings; return; } QVariant BackThread::getSwitchState(const QString &key) { QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat); QVariant value = m_settings->value(key); delete m_settings; if (!value.isValid()) return QVariant(); return value; } void BackThread::saveWiredConnectUuid(const QString &key, const QVariant &value) { QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat); m_settings->beginGroup("WIREDRECONNECT"); m_settings->setValue(key, value); m_settings->endGroup(); m_settings->sync(); delete m_settings; return; } QVariant BackThread::getWiredConnectUuid(const QString &key) { QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat); m_settings->beginGroup("WIREDRECONNECT"); QVariant value = m_settings->value(key); m_settings->endGroup(); delete m_settings; if (!value.isValid()) return QVariant(); return value; } void BackThread::clearWiredConnectUuid() { QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat); m_settings->beginGroup("WIREDRECONNECT"); m_settings->remove(""); m_settings->endGroup(); delete m_settings; } //turn on the switch of network void BackThread::execEnNet() { char *chr = "nmcli networking on"; Utils::m_system(chr); while (1) { if (execGetIface()->lstate != DEVICE_UNMANAGED) { sleep(3); emit enNetDone(); emit btFinish(); break; } sleep(1); } } //turn off the switch of wireless network first, then turn off the switch of network void BackThread::execDisNet() { if (execGetIface()->wstate != 2) { char *chr = "nmcli radio wifi off"; Utils::m_system(chr); while (1) { if (execGetIface()->wstate == 2) { emit disWifiDone(); emit btFinish(); break; } sleep(1); } } char *chr1 = "nmcli networking off"; Utils::m_system(chr1); while (1) { if (execGetIface()->lstate == DEVICE_UNMANAGED) { emit disNetDone(); emit btFinish(); break; } sleep(1); } } //turn on the switch of wireless network void BackThread::execEnWifi() { char *chr1 = "nmcli radio wifi on"; Utils::m_system(chr1); // emit btFinish(); KylinDBus objBackThreadDBus; while (1) { if (execGetIface()->wstate != 2) { while (1) { if (objBackThreadDBus.getAccessPointsNumber() > 0) { // objBackThreadDBus.getAccessPointsNumber()>0 standard can get wireless accesspoints now emit enWifiDone(); emit btFinish(); break; } sleep(2); } break; } sleep(1); } } void BackThread::rfKillexecEnWifi() { char *chr1 = "nmcli radio wifi on"; Utils::m_system(chr1); if (execGetIface()->wstate != 2) { emit enWifiDoneByRfkill(); emit btFinishByRfkill(); } else { usleep(500*1000); emit enWifiDoneByRfkill(); emit btFinishByRfkill(); } } //turn off the switch of wireless network void BackThread::execDisWifi() { char *chr = "nmcli radio wifi off"; Utils::m_system(chr); while (1) { if (execGetIface()->wstate == 2) { emit disWifiDone(); emit btFinish(); break; } sleep(1); } } void BackThread::rfkillExecDisWifi() { char *chr = "nmcli radio wifi off"; Utils::m_system(chr); while (1) { if (execGetIface()->wstate == 2) { emit disWifiDoneByRfkill(); emit btFinishByRfkill(); break; } sleep(1); } } //to connect wired network void BackThread::execConnLan(QString connName, QString ifname, QString connectType) { currConnLanUuid = connName; currConnLanType = connectType; QString mycmd; //连接命令 KylinDBus objBackThreadDBus; bool isWiredCableAlready = objBackThreadDBus.getWiredCableStateByIfname(ifname); if (connectType == "bluetooth" || connectType == "vpn"|| ifname == "" || ifname == "--") { isWiredCableAlready = true; //对于蓝牙类型的网络不需要接入网线就可以连接 mycmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "'"; } else { mycmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "' ifname '" + ifname + "'"; } qDebug()<<"Trying to connect lan. uuid="<start("/bin/bash",options); cmdProcessLan->waitForStarted(); cmdProcessLan->waitForFinished(); } else { qDebug()<<"connect wired network failed for without wired cable plug in."; emit connDone(1); } emit btFinish(); } void BackThread::onReadOutputLan() { QByteArray cmdout = cmdProcessLan->readAllStandardOutput(); QString strResult = QString::fromLocal8Bit(cmdout); qDebug()<<"on_readoutput_lan: "<< strResult; dellConnectLanResult(strResult); } void BackThread::onReadErrorLan() { QByteArray cmdout = cmdProcessLan->readAllStandardError(); QString strResult = QString::fromLocal8Bit(cmdout); qDebug()<<"on_readerror_lan: "<< strResult; dellConnectLanResult(strResult); } void BackThread::dellConnectLanResult(QString info) { if (info.indexOf("successfully") != -1) { qDebug()<<"debug: in function execConnLan, wired net state is: "<lstate); if (currConnLanType == "bluetooth") { emit connDone(2); } else { emit connDone(0); } } else { QString cmd = "nmcli connection down '" + currConnLanUuid + "'"; Utils::m_system(cmd.toUtf8().data()); if (info.indexOf("IP configuration could not be reserved") != -1) { emit connDone(4); } else if(info.indexOf("MACs") != -1 || info.indexOf("Mac") != -1 || info.indexOf("MAC") != -1) { emit connDone(5); } else if(info.indexOf("Killed") != -1 || info.indexOf("killed") != -1) { emit connDone(6); } else if(info.indexOf("The Bluetooth connection failed") != -1) { emit connDone(7); } else if(info.indexOf("Carrier/link changed") != -1) { emit connDone(8); } else { if (currConnLanType == "vpn"){ emit connDone(10); } else{ emit connDone(9); } } } } //to connected wireless network need a password void BackThread::execConnWifiPWD(QString connName, QString password, QString connType, QString security, QString ifname) { //disConnLanOrWifi("wifi"); if (!connType.isEmpty()) { QString strConntype = "nmcli connection modify '" + connName + "' wifi-sec.psk-flags 0"; Utils::m_system(strConntype.toUtf8().data()); } QString tmpPath = "/tmp/kylin-nm-btoutput-" + QDir::home().dirName(); // if (security.contains("WPA3")) { // QString create_cmd = QString("nmcli connection add con-name \"1\" type wifi 802-11-wireless-security.key-mgmt sae ssid \"%2\" 802-11-wireless-security.psk %3").arg(connName).arg(connName).arg(password); // Utils::m_system(create_cmd.toUtf8().data()); // QString connect_cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "' ifname " + ifname +" > " + tmpPath; // Utils::m_system(connect_cmdStr.toUtf8().data()); // } else { // QString cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli device wifi connect '" + connName + "' password '" + password + "' > " + tmpPath; // Utils::m_system(cmdStr.toUtf8().data()); // } if (security.contains("WPA3")) { QString create_cmd; if (security.contains("WPA2")) { qDebug() << "连接wpa2 和 wpa3混合模式的wifi"; create_cmd = QString("nmcli connection add con-name \"%1\" " "type wifi 802-11-wireless-security.psk-flags %2 " " 802-11-wireless-security.key-mgmt wpa-psk ssid \"%3\" " "802-11-wireless-security.psk %4") .arg(connName).arg(PSKFLAG).arg(connName).arg(password); } else { qDebug() << "连接 wpa3个人模式的wifi"; create_cmd = QString("nmcli connection add con-name \"%1\"" " type wifi 802-11-wireless-security.psk-flags %2 " "802-11-wireless-security.key-mgmt sae ssid \"%3\" " "802-11-wireless-security.psk %4") .arg(connName).arg(PSKFLAG).arg(connName).arg(password); } Utils::m_system(create_cmd.toUtf8().data()); qDebug()<<"create connection by shell cmd:"< " + tmpPath; Utils::m_system(connect_cmdStr.toUtf8().data()); } else { QString connect_cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';" "nmcli connection up '" + connName + "' ifname " + ifname +" > " + tmpPath; Utils::m_system(connect_cmdStr.toUtf8().data()); } } else { qDebug() << "连接普通安全性类型的wifi"; QString cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli device wifi connect '" + connName + "' password '" + password + "' > " + tmpPath; Utils::m_system(cmdStr.toUtf8().data()); } QFile file(tmpPath); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug()<<"Can't open the file /tmp/kylin-nm-btoutput !"<wstate); } else if(line.indexOf("Secrets were required") != -1){ //emit connDone(4);//发出信号4是之前添加每次连接输入密码的功能时需要的 emit connDone(1); } else { emit connDone(1); } emit btFinish(); } void BackThread::execConnHiddenWifiWPA(int secuType, QString wifiName, QString wifiPassword) { //this->getTheWifiCardName(); QProcess shellProcess; shellProcess.start("nmcli -f ssid device wifi"); shellProcess.waitForFinished(3000); // 等待最多3s bool is_hidden = true; if (shellProcess.exitCode() == 0) { QString shellOutput = shellProcess.readAllStandardOutput(); QStringList wlist = shellOutput.split("\n"); foreach (QString wifi, wlist) { if (wifi.trimmed() == wifiName) { is_hidden = false; } } } int x(1), n(0); do { n += 1; if (n >= 4) { qDebug()<<"connection attempt of hidden wifi"< " + tmpPath; Utils::m_system(connect_cmdStr.toUtf8().data()); } else { QString connect_cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';" "nmcli connection up '" + wifiName + "' > " + tmpPath; Utils::m_system(connect_cmdStr.toUtf8().data()); } } else { QString cmd; if (is_hidden) { cmd = "nmcli device wifi connect '" + wifiName + "' password '" + wifiPassword + "' hidden yes > " + tmpPath + " 2>&1"; } else { cmd = "nmcli device wifi connect '" + wifiName + "' password '" + wifiPassword + "' > " + tmpPath + " 2>&1"; } int status = Utils::m_system(cmd.toUtf8().data()); qDebug() << Q_FUNC_INFO << cmd << tmpPath << "res=" << status; } QFile file(tmpPath); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug()<<"Can't open the file!"; } QString text = file.readAll(); qDebug() << text; file.close(); if (text.indexOf("Scanning not allowed") != -1 || text.isEmpty() || text.indexOf("No network with SSID") != -1) { x = 1; sleep(10);//nm扫描冷却为10s } else if (text.indexOf("Secrets were required, but not provided.") != -1) { emit connDone(7); QString delete_cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection delete '" + wifiName + "'"; Utils::m_system(delete_cmd.toUtf8().data()); x = 0; } else if (text.indexOf("Error: 802-11-wireless-security.psk: ????.") != -1) { emit connDone(8); x = 0; } else if (text.indexOf("Passwords or encryption keys are required") != -1) { emit connDone(9); QString delete_cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection delete '" + wifiName + "'"; Utils::m_system(delete_cmd.toUtf8().data()); x = 0; } else { emit connDone(6); x = 0; } } while (x); emit btFinish(); } void BackThread::execConnRememberedHiddenWifi(QString wifiName) { QProcess shellProcess; shellProcess.start("nmcli -f ssid device wifi"); shellProcess.waitForFinished(3000); // 等待最多3s if (shellProcess.exitCode() == 0) { QString shellOutput = shellProcess.readAllStandardOutput(); QStringList wlist = shellOutput.split("\n"); bool is_hidden = true; foreach (QString wifi, wlist) { if (wifi.trimmed() == wifiName) { is_hidden = false; } } if (! is_hidden) { QString cmd = "nmcli connection up '" + wifiName + "'"; qDebug()<<"Trying to connect wifi. ssid="<> obj_reply = m_interface.call("GetAllDevices"); if (!obj_reply.isValid()) { qDebug()<<"execute dbus method 'GetAllDevices' is invalid in func getObjectPath()"; } QList obj_paths = obj_reply.value(); //再判断有无有线设备和无线设备的路径 foreach (QDBusObjectPath obj_path, obj_paths) { QDBusInterface interface( "org.freedesktop.NetworkManager", obj_path.path(), "org.freedesktop.DBus.Introspectable", QDBusConnection::systemBus() ); QDBusReply reply = interface.call("Introspect"); if (!reply.isValid()) { qDebug()< lanReply = lanInterface.call("Get", "org.freedesktop.NetworkManager.Device", "Interface"); if (!lanReply.isValid()) { qDebug()<<"can not get the attribute 'Interface' in func getWirelessCardName()"; } else { wifiIfnameInUse = lanReply.value().toString(); } } //to connected wireless network driectly do not need a password void BackThread::execConnWifi(QString connName, QString connIfName) { qDebug() << "Will to connect wifi " << connName << " with wifi card named " << connIfName; QString cmdStr; KylinDBus objBackThreadDBus; QString wifiUuid = objBackThreadDBus.checkHasWifiConfigFile(connName); if (!wifiUuid.isEmpty()) { //有配置文件 cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + wifiUuid + "' ifname '" + connIfName + "'"; } else { //没有配置文件 cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "' ifname '" + connIfName + "'"; } // QStringList options; // options << "-c" << cmdStr; // cmdProcessWifi->start("/bin/bash",options); // cmdProcessWifi->waitForStarted(); // cmdProcessWifi->waitForFinished(); QString tmpPath = "/tmp/kylin-nm-connwifi-result-" + QDir::home().dirName(); QString cmd = cmdStr + " > " + tmpPath + " 2>&1"; Utils::m_system(cmd.toUtf8().data()); qDebug() << "Execute wifi connecting, cmd = " << cmd; QFile file(tmpPath); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug()<<"Can't open the file /tmp/kylin-nm-connwifi-result!"; emit btFinish(); file.close(); file.remove(); return; } QString result_info = file.readAll(); qDebug()<<"Connect wifi done, result = "<readAllStandardError(); qDebug()<<"on_readerror_wifi: "<< str; dellConnectWifiResult(str); } void BackThread::dellConnectWifiResult(QString info) { if (info.indexOf("successfully") != -1) { emit connDone(0); } else if(info.indexOf("unknown") != -1 || info.indexOf("not exist") != -1) { //qDebug() << "send this signal if the network we want to connect has not a configuration file"; emit connDone(2); } else if (info.indexOf("The connection was not a Wi-Fi connection..") != -1) { emit connDone(2); } else if(info.indexOf("not given") != -1 || info.indexOf("Secrets were required") != -1) { //nothing to do } else if(info.indexOf("Passwords or encryption keys are required") != -1){ //qDebug() << "password for '802-11-wireless-security.psk' not given in 'passwd-file'"; emit connDone(4); } else if(info.indexOf("No network with SSID") != -1){ //nothing to do } else { //qDebug() << "send this signal if connect net failed"; emit connDone(1); } emit btFinish(); } //get property of connected network QString BackThread::getConnProp(QString connName) { QString tmpPath = "/tmp/kylin-nm-connprop-" + QDir::home().dirName(); QString cmd = "nmcli connection show '" + connName + "' > " + tmpPath; Utils::m_system(cmd.toUtf8().data()); QFile file(tmpPath); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "Can't open the file /tmp/kylin-nm-connprop!"; } QString txt = file.readAll(); QStringList txtLine = txt.split("\n"); file.close(); QString rtn = ""; foreach (QString line, txtLine) { if (line.startsWith("ipv4.method:")) { QString v4method = line.mid(12).trimmed(); rtn += "method:" + v4method + "|"; } if (line.startsWith("ipv4.addresses:")) { QString value = line.mid(15).trimmed(); if (value == "--" || value == "") { rtn += "v4addr:|mask:|"; } else { QString addr = value.split("/").at(0); QString mask = value.trimmed().split("/").at(1); rtn += "v4addr:" + addr + "|"; rtn += "mask:" + mask + "|"; } } if (line.startsWith("ipv6.method:")) { QString value = line.mid(12).trimmed(); if (value == "auto") { rtn += "v6method:auto|v6addr:|"; } else { rtn += "v6method:manual|"; } } if (line.startsWith("ipv6.addresses:")) { QString value = line.mid(15).trimmed(); if (value == "--" || value == "") { rtn += "v6addr:|"; } else { QString addr = value.split("/").at(0); rtn += "v6addr:" + addr + "|"; } } if (line.startsWith("ipv4.gateway:")) { QString value = line.mid(13).trimmed(); if (value == "--" || value == "") { rtn += "gateway:|"; } else { rtn += "gateway:" + value + "|"; } } if (line.startsWith("ipv4.dns:")) { QString value = line.mid(9).trimmed(); if (value == "--" || value == "") { rtn += "dns:|"; } else { rtn += "dns:" + value + "|"; } } if (line.startsWith("connection.type:")) { QString value = line.mid(16).trimmed(); if (value == "--" || value == "") { rtn += "type:|"; } else { rtn += "type:" + value + "|"; } } } return rtn.left(rtn.length() - 1); } //get band width of wired network QString BackThread::execChkLanWidth(QString ethName) { QString tmpPath = "/tmp/kylin-nm-bandwidth-" + QDir::home().dirName(); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';ethtool '" + ethName + "' | grep Speed > " + tmpPath; int res = Utils::m_system(cmd.toUtf8().data()); qDebug() << "executed cmd=" << cmd << ".res="< ConfForm 0 0 432 510 0 0 432 510 1 169 430 271 175 10 182 32 10 175 95 182 32 10 175 140 182 32 10 175 185 182 32 10 76 13 95 24 Noto Sans CJK SC 11 76 98 95 24 Noto Sans CJK SC 11 76 143 95 24 Noto Sans CJK SC 11 76 188 95 24 Noto Sans CJK SC 11 175 230 182 32 10 76 233 95 24 Noto Sans CJK SC 11 76 55 95 24 Noto Sans CJK SC 11 175 52 182 32 10 1 1 430 180 175 120 182 32 10 76 123 95 24 Noto Sans CJK SC 11 76 78 95 24 Noto Sans CJK SC 11 175 75 182 32 10 20 1 440 430 70 315 20 90 30 10 215 20 90 30 10 315 20 90 30 30 30 240 22 10 170 412 1 Qt::Horizontal 10 440 412 1 Qt::Horizontal kylin-nm/src/conf/0000755000175000017500000000000014205345374012757 5ustar fengfengkylin-nm/src/conf/com.kylin.NetworkManager.qt.systemdbus.conf0000644000175000017500000000171414205345374023303 0ustar fengfeng kylin-nm/src/conf/com.kylin.NetworkManager.qt.systemdbus.service0000644000175000017500000000013514205345374024012 0ustar fengfeng[D-BUS Service] Name=com.kylin.NetworkManager.qt.systemdbus Exec=/usr/bin/kylin-nm User=root kylin-nm/src/loadingdiv.h0000644000175000017500000000252214205345374014324 0ustar fengfeng/* * 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 #include class LoadingDiv : public QWidget { Q_OBJECT public: explicit LoadingDiv(QWidget *parent = nullptr); signals: void toStopLoading(); public slots: void switchAnimStep(const QVariant& value); void startLoading(); void stopLoading(); private: QLabel *loadingGif = nullptr; QVariantAnimation * m_animation = nullptr; // QTimer *switchTimer = nullptr; // int currentPage; // int countCurrentTime; }; #endif // LOADINGDIV_H kylin-nm/src/mainwindow.cpp0000644000175000017500000061456614205345444014732 0ustar fengfeng/* * 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 //sort函数包含的头文件 #include #include #include #include #include #include QString hideWiFiConn; //QStringList lcards,wcards; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //QIcon::setThemeName("ukui-icon-theme-default"); // 如果使用Qt::Popup 任务栏不显示且保留X事件如XCB_FOCUS_OUT, 但如果indicator点击鼠标右键触发,XCB_FOCUS_OUT事件依然会失效 // 如果使用Qt::ToolTip, Qt::Tool + Qt::WindowStaysOnTopHint, Qt::X11BypassWindowManagerHint等flag则会导致X事件失效 // this->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool | Qt::WindowStaysOnTopHint); //this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);//QTool this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);//QTool this->setAttribute(Qt::WA_TranslucentBackground);//设置窗口背景透明 firstlyStart(); //先执行一些不耗时的一级启动项 } MainWindow::~MainWindow() { trayIcon->deleteLater(); trayIconMenu->deleteLater(); delete ui; } /** * @brief MainWindow::firstlyStart 一级启动 */ void MainWindow::firstlyStart() { // qDebug()<<"Loading qss..."; // UseQssFile::setStyle("style.qss"); qDebug()<<"Painting blurRegion..."; QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); editQssString(); //编辑部分控件QSS createTopLanUI(); //创建顶部有线网item createTopWifiUI(); //创建顶部无线网item createOtherUI(); //创建上传下载控件,列表区无item时的说明控件 createListAreaUI(); //创建列表区域的控件 createLeftAreaUI(); //创建左侧区域控件 lcardname = "-1"; wcardname = "-1"; hideWiFiConn = "Connect to Hidden WLAN Network"; createTrayIcon(); connect(trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::iconActivated); connect(mShowWindow, &QAction::triggered, this, &MainWindow::on_showWindowAction); connect(mAdvConf, &QAction::triggered, this, &MainWindow::actionTriggerSlots); connect(this,&MainWindow::showPbSignal,trayIcon,&QSystemTrayIcon::activated); //checkSingleAndShowTrayicon(); //trayIcon->setVisible(true); // 连接kds的dbus接收rfkill变化的信号&获取当前WIFI状态 qDebug()<<"Initing kdsDbus..."; kdsDbus = new QDBusInterface("org.ukui.kds", \ "/", \ "org.ukui.kds.interface", \ QDBusConnection::systemBus()); QDBusConnection::systemBus().connect(kdsDbus->service(), kdsDbus->path(), kdsDbus->interface(), "signalRfkillStatusChanged", this, SLOT(onRfkillStatusChanged())); PrimaryManager(); qDebug()<<"Init objKyDbus..."; objKyDBus = new KylinDBus(this); objKyDBus->initConnectionInfo(); connect(objKyDBus, SIGNAL(toGetWifiListFinished(QStringList)), this, SLOT(loadWifiListDone(QStringList))); objNetSpeed = new NetworkSpeed(); qDebug()<<"Init confForm..."; QApplication::setQuitOnLastWindowClosed(false); this->confForm = new ConfForm(); qDebug()<<"Init ksnm..."; this->ksnm = new KSimpleNM(); connect(ksnm, SIGNAL(getLanListFinished(QStringList)), this, SLOT(getLanListDone(QStringList))); connect(ksnm, SIGNAL(getWifiListFinished(QStringList)), this, SLOT(getWifiListDone(QStringList))); connect(ksnm, SIGNAL(getConnListFinished(QStringList)), this, SLOT(getConnListDone(QStringList))); connect(ksnm, SIGNAL(requestRevalueUpdateWifi()), this, SLOT(onRequestRevalueUpdateWifi())); qDebug()<<"Init LoadingDiv..."; loading = new LoadingDiv(this); loading->move(40,0); connect(loading, SIGNAL(toStopLoading() ), this, SLOT(on_checkOverTime() )); checkIsWirelessDevicePluggedIn(); //检测无线网卡是否插入 initLanSlistAndGetReconnectNetList(); //初始化有线网列表 initNetwork(); //初始化网络 initTimer(); //初始化定时器 initActNetDNS();//初始化已连接网络的DNS getSystemFontFamily();//建立GSetting监听系统字体 qDebug()<<"Init button connections..."; connect(ui->btnNetList, &QPushButton::clicked, this, &MainWindow::onBtnNetListClicked); connect(btnWireless, &SwitchButton::clicked,this, &MainWindow::onBtnWifiClicked); connect(btnWired, &SwitchButton::clicked, this, &MainWindow::onBtnLanClicked); connect(this, &MainWindow::onWiredDeviceChanged, this, &MainWindow::setLanSwitchStatus); QVariant wifi_state = BackThread::getSwitchState(WIFI_SWITCH_OPENED); QVariant lan_state = BackThread::getSwitchState(LAN_SWITCH_OPENED); if (!wifi_state.isNull() && wifi_state.isValid() && is_wireless_adapter_ready == 1) { //设置WiFi开关状态 if (wifi_state.toBool() && !btnWireless->getSwitchStatus()) onBtnWifiClicked(1); else if (!wifi_state.toBool() && btnWireless->getSwitchStatus()) onBtnWifiClicked(0); } if (!lan_state.isNull() && lan_state.isValid()) { //设置lan开关状态 objKyDBus->getPhysicalCarrierState(); if (lan_state.toBool() && objKyDBus->isWiredCableOn) onBtnLanClicked(1); else if(!lan_state.toBool()) onBtnLanClicked(0); } connect(btnWired, &SwitchButton::switchStatusChanged, this, [ = ]() { BackThread::saveSwitchButtonState(LAN_SWITCH_OPENED, btnWired->getSwitchStatus()); }); connect(btnWireless, &SwitchButton::switchStatusChanged, this, [ = ]() { BackThread::saveSwitchButtonState(WIFI_SWITCH_OPENED, btnWireless->getSwitchStatus()); }); //检查有线网络的个数是否为0,如果是0,则新建一个有线网络 checkIfWiredNetExist(); m_secondary_start_timer = new QTimer(this); connect(m_secondary_start_timer, &QTimer::timeout, this, [ = ]() { m_secondary_start_timer->stop(); secondaryStart();//满足条件后执行比较耗时的二级启动 }); m_secondary_start_timer->start(5 * 1000); } /** * @brief MainWindow::secondaryStart 二级启动 */ void MainWindow::secondaryStart() { if (m_load_finished) return; toStart(); ui->btnNetList->setAttribute(Qt::WA_Hover,true); ui->btnNetList->installEventFilter(this); ui->btnWifiList->setAttribute(Qt::WA_Hover,true); ui->btnWifiList->installEventFilter(this); hasWifiConnected = false; m_load_finished = true; } void MainWindow::checkSingleAndShowTrayicon() { int fd = 0; try { QStringList homePath = QStandardPaths::standardLocations(QStandardPaths::HomeLocation); QString lockPath = QString(homePath.at(0) + "/.config/kylin-nm-lock-%1.lock").arg(getenv("DISPLAY")).toUtf8().data(); fd = open(lockPath.toUtf8().data(), O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); if (fd < 0) { throw -1; } } catch(...) { fd = open("/tmp/kylin-nm-lock", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); if (fd < 0) { exit(0); } } if (lockf(fd, F_TLOCK, 0)) { //syslog(LOG_ERR, "Can't lock single file, kylin-network-manager is already running!"); //qDebug()<<"Can't lock single file, kylin-network-manager is already running!"; //exit(0); } else { trayIcon->setVisible(true); } } void MainWindow::justShowTrayIcon() { trayIcon->setVisible(true); } bool MainWindow::eventFilter(QObject *obj, QEvent *event) { if (obj == ui->btnNetList) { if (event->type() == QEvent::HoverEnter) { if (!is_btnLanList_clicked) { ui->lbNetListBG->setStyleSheet(btnBgHoverQss); } return true; } else if(event->type() == QEvent::HoverLeave) { if (!is_btnLanList_clicked) { ui->lbNetListBG->setStyleSheet(btnBgLeaveQss); } return true; } } if (obj == ui->btnWifiList) { if (event->type() == QEvent::HoverEnter) { if (!is_btnWifiList_clicked) { ui->lbWifiListBG->setStyleSheet(btnBgHoverQss); } return true; } else if(event->type() == QEvent::HoverLeave) { if (!is_btnWifiList_clicked) { ui->lbWifiListBG->setStyleSheet(btnBgLeaveQss); } return true; } } return QWidget::eventFilter(obj,event); } /////////////////////////////////////////////////////////////////////////////// // 初始化控件、网络、定时器 // 初始化界面各控件 void MainWindow::editQssString() { btnOffQss = "QLabel{min-width: 37px; min-height: 37px;max-width:37px; max-height: 37px;border-radius: 4px; background-color:rgba(255,255,255,0)}"; btnOnQss = "QLabel{min-width: 37px; min-height: 37px;max-width:37px; max-height: 37px;border-radius: 4px; background-color:rgba(61,107,229,1)}"; btnBgOffQss = "QLabel{min-width: 48px; min-height: 22px;max-width:48px; max-height: 22px;border-radius: 10px; background-color:rgba(255,255,255,0.2)}"; btnBgOnQss = "QLabel{min-width: 48px; min-height: 22px;max-width:48px; max-height: 22px;border-radius: 10px; background-color:rgba(61,107,229,1);}"; btnBgHoverQss = "QLabel{border-radius: 4px; background-color:rgba(156,156,156,0.3)}"; btnBgLeaveQss = "QLabel{border-radius: 4px; background-color:rgba(255,255,255,0)}"; leftBtnQss = "QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0);}" "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(156,156,156,0.3);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(156,156,156,0.3);}"; funcBtnQss = "QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0);color:rgba(107,142,235,0.97);font-size:14px;}" "QPushButton:Hover{border:0px;border-radius:4px;background-color:rgba(255,255,255,0);color:rgba(151,175,241,0.97);font-size:14px;}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0);color:rgba(61,107,229,0.97);font-size:14px;}"; } void MainWindow::createTopLanUI() { qDebug()<<"Creating Top Lan UI..."; topLanListWidget = new QWidget(ui->centralWidget); topLanListWidget->move(W_LEFT_AREA, Y_TOP_ITEM); topLanListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM + H_GAP_UP + X_ITEM); /*顶部的一个item*/ lbTopLanList = new QLabel(topLanListWidget); lbTopLanList->setText(tr("Ethernet Networks"));//"可用网络列表" lbTopLanList->resize(W_MIDDLE_WORD, H_MIDDLE_WORD); lbTopLanList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_GAP_UP); QFont fontTopLanList( "Noto Sans CJK SC", 14); lbTopLanList->setFont(fontTopLanList); lbTopLanList->show(); /*新建有线网按钮*/ btnCreateNet = new QPushButton(topLanListWidget); btnCreateNet->resize(W_BTN_FUN, H_BTN_FUN); btnCreateNet->move(X_BTN_FUN, Y_BTN_FUN); btnCreateNet->setText(tr("New LAN"));//"新建网络" btnCreateNet->setStyleSheet(funcBtnQss); btnCreateNet->setFocusPolicy(Qt::NoFocus); btnCreateNet->show(); connect(btnCreateNet,SIGNAL(clicked()),this,SLOT(onBtnCreateNetClicked())); } void MainWindow::createTopWifiUI() { qDebug()<<"Creating Top Wifi UI..."; topWifiListWidget = new QWidget(ui->centralWidget); topWifiListWidget->move(W_LEFT_AREA, Y_TOP_ITEM); topWifiListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM + H_GAP_UP + X_ITEM); /*顶部的一个item*/ lbTopWifiList = new QLabel(topWifiListWidget); lbTopWifiList->setText(tr("WLAN Networks"));//"可用网络列表" lbTopWifiList->resize(W_MIDDLE_WORD, H_MIDDLE_WORD); lbTopWifiList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_GAP_UP); QFont fontTopWifiList( "Noto Sans CJK SC", 14); lbTopWifiList->setFont(fontTopWifiList); lbTopWifiList->show(); /*新建有线网按钮*/ btnAddNet = new QPushButton(topWifiListWidget); btnAddNet->move(X_BTN_FUN, Y_BTN_FUN); btnAddNet->setText(tr("Hide WLAN"));//"加入网络" btnAddNet->setStyleSheet(funcBtnQss); int textWidth = QFontMetrics(btnAddNet->font()).width(btnAddNet->text()); btnAddNet->resize(textWidth > W_BTN_FUN ? textWidth : W_BTN_FUN, H_BTN_FUN); btnAddNet->setFocusPolicy(Qt::NoFocus); btnAddNet->show(); connect(btnAddNet,SIGNAL(clicked()),this,SLOT(onBtnAddNetClicked())); } void MainWindow::createOtherUI() { qDebug()<<"Creating Other Ui..."; lbLoadDown = new QLabel(ui->centralWidget); lbLoadDown->move(X_ITEM + 129, Y_TOP_ITEM + 32); lbLoadDown->resize(65, 20); lbLoadDownImg = new QLabel(ui->centralWidget); lbLoadDownImg->move(X_ITEM + 112, Y_TOP_ITEM + 35); lbLoadDownImg->resize(16, 16); lbLoadUp = new QLabel(ui->centralWidget); lbLoadUp->move(X_ITEM + 187, Y_TOP_ITEM + 32); lbLoadUp->resize(65, 20); lbLoadUpImg = new QLabel(ui->centralWidget); lbLoadUpImg->move(X_ITEM + 170, Y_TOP_ITEM + 35); lbLoadUpImg->resize(16, 16); lbLoadDownImg->setStyleSheet("QLabel{background-image:url(:/res/x/load-down.png);}"); lbLoadUpImg->setStyleSheet("QLabel{background-image:url(:/res/x/load-up.png);}"); lbNoItemTip = new QLabel(ui->centralWidget); lbNoItemTip->resize(W_NO_ITEM_TIP, H_NO_ITEM_TIP); lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2); lbNoItemTip->setStyleSheet("QLabel{border:none;background:transparent;}"); lbNoItemTip->setText(tr("No usable network in the list"));//列表暂无可连接网络 lbNoItemTip->setAlignment(Qt::AlignCenter); lbNoItemTip->hide(); } void MainWindow::createListAreaUI() { qDebug()<<"Creating List Area Ui..."; scrollAreal = new QScrollArea(ui->centralWidget); scrollAreal->move(W_LEFT_AREA, Y_TOP_ITEM + H_NORMAL_ITEM + H_GAP_UP + X_ITEM + H_GAP_DOWN); scrollAreal->resize(W_SCROLL_AREA, H_SCROLL_AREA); scrollAreal->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scrollAreal->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); scrollAreaw = new QScrollArea(ui->centralWidget); scrollAreaw->move(W_LEFT_AREA, Y_TOP_ITEM + H_NORMAL_ITEM + H_GAP_UP + X_ITEM + H_GAP_DOWN); scrollAreaw->resize(W_SCROLL_AREA, H_SCROLL_AREA); scrollAreaw->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scrollAreaw->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); lanListWidget = new QWidget(scrollAreal); wifiListWidget = new QWidget(scrollAreaw); lbLanList = new QLabel(lanListWidget); lbWifiList = new QLabel(wifiListWidget); ui->lbNetwork->setStyleSheet("QLabel{font-size:20px;}"); ui->lbNetwork->show(); topLanListWidget->setStyleSheet("QWidget{border:none;}"); topLanListWidget->setStyleSheet("background-color:transparent;"); topWifiListWidget->setStyleSheet("QWidget{border:none;}"); topWifiListWidget->setStyleSheet("background-color:transparent;"); lbLoadUp->setStyleSheet("QLabel{font-size:14px;}"); lbLoadDown->setStyleSheet("QLabel{font-size:14px;}"); lbLoadUp->setText("0KB/s"); lbLoadDown->setText("0KB/s."); lbLoadUp->hide(); lbLoadDown->hide(); lbLoadUpImg->hide(); lbLoadDownImg->hide(); this->on_setNetSpeed(); // scrollAreal->setStyleSheet("QScrollArea{border:none;}"); // scrollAreal->viewport()->setStyleSheet("background-color:transparent;"); //scrollAreal->verticalScrollBar()->setStyleSheet(scrollBarQss);//// QPalette scrollAreaPalette = scrollAreaw->palette(); scrollAreaPalette.setBrush(QPalette::Window, QColor(0,0,0,0)); scrollAreal->setFrameShape(QFrame::NoFrame); scrollAreal->setPalette(scrollAreaPalette); scrollAreal->verticalScrollBar()->setAttribute((Qt::WA_TranslucentBackground),true); scrollAreal->verticalScrollBar()->setProperty("drawScrollBarGroove",false); //!!!??不绘制滚动条的槽 scrollAreaw->setFrameShape(QFrame::NoFrame); scrollAreaw->setPalette(scrollAreaPalette); scrollAreaw->verticalScrollBar()->setAttribute((Qt::WA_TranslucentBackground),true); scrollAreaw->verticalScrollBar()->setProperty("drawScrollBarGroove",false); //!!!??不绘制滚动条的槽 QPalette palette = scrollAreaw->verticalScrollBar()->palette(); QColor color(255,255,255); color.setAlphaF(0.25); palette.setColor(QPalette::Active, QPalette::Button, color); scrollAreaw->verticalScrollBar()->setPalette(palette); scrollAreal->verticalScrollBar()->setPalette(palette); } void MainWindow::createLeftAreaUI() { qDebug()<<"Creating Left Area Ui..."; btnWireless = new SwitchButton(this); btnWireless->setStyleSheet("SwitchButton{border:none;background-color:rgba(255,255,255,0.12);}"); btnWired = new SwitchButton(this); btnWired->setStyleSheet("SwitchButton{border:none;background-color:rgba(255,255,255,0.12);}"); ui->btnNetList->setFocusPolicy(Qt::NoFocus); QString txtEthernet(tr("Ethernet")); ui->btnNetList->setToolTip(txtEthernet); ui->lbNetListBG->setStyleSheet(btnOffQss); //设置PushButton背景透明 QPalette paletteLan = ui->btnNetListImg->palette(); paletteLan.setColor(QPalette::Highlight, Qt::transparent); paletteLan.setBrush(QPalette::Button, QBrush(QColor(1,1,1,0))); ui->btnNetListImg->setPalette(paletteLan); //添加PushButton的svg图片 if (!QIcon::fromTheme("network-wired-connected-symbolic").isNull()) { ui->btnNetListImg->setIcon(QIcon::fromTheme("network-wired-connected-symbolic")); } else if (!QIcon::fromTheme("network-wired-symbolic").isNull()) { ui->btnNetListImg->setIcon(QIcon::fromTheme("network-wired-symbolic")); } else { ui->btnNetListImg->setIcon(QIcon(":/res/x/net-list-bg.svg")); } ui->btnNetListImg->setProperty("useIconHighlightEffect", true); ui->btnNetListImg->setProperty("iconHighlightEffectMode", true); ui->btnWifiList->setFocusPolicy(Qt::NoFocus); QString txtWifi(tr("WLAN")); ui->btnWifiList->setToolTip(txtWifi); ui->lbWifiListBG->setStyleSheet(btnOffQss); //设置PushButton背景透明 QPalette paletteWifi = ui->btnWifiListImg->palette(); paletteWifi.setColor(QPalette::Highlight, Qt::transparent); paletteWifi.setBrush(QPalette::Button, QBrush(QColor(1,1,1,0))); ui->btnWifiListImg->setPalette(paletteWifi); //添加PushButton的svg图片 if (!QIcon::fromTheme("network-wireless-signal-excellent-symbolic").isNull()) ui->btnWifiListImg->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-symbolic")); else ui->btnWifiListImg->setIcon(QIcon(":/res/x/wifi-list-bg.svg")); ui->btnWifiListImg->setProperty("useIconHighlightEffect", true); ui->btnWifiListImg->setProperty("iconHighlightEffectMode", true); ui->btnNet->hide(); btnWireless->setGeometry(412,20,50,24); btnWired->setGeometry(412,20,50,24); ui->btnHotspot->setStyleSheet(leftBtnQss); ui->btnHotspot->setFocusPolicy(Qt::NoFocus); QString txtHotSpot(tr("HotSpot")); ui->btnHotspot->setToolTip(txtHotSpot); ui->btnHotspot->hide(); ui->lbHotImg->hide(); ui->lbHotImg->setStyleSheet("QLabel{background-image:url(:/res/x/hot-spot-off.svg);}"); ui->lbHotBG->hide(); ui->lbHotBG->setStyleSheet(btnOffQss); ui->btnFlyMode->setStyleSheet(leftBtnQss); ui->btnFlyMode->setFocusPolicy(Qt::NoFocus); QString txtFlyMode(tr("FlyMode")); ui->btnFlyMode->setToolTip(txtFlyMode); ui->btnFlyMode->hide(); ui->lbFlyImg->hide(); ui->lbFlyImg->setStyleSheet("QLabel{background-image:url(:/res/x/fly-mode-off.svg);}"); ui->lbFlyBG->hide(); ui->lbFlyBG->setStyleSheet(btnOffQss); ui->btnAdvConf->setStyleSheet(leftBtnQss); ui->btnAdvConf->setFocusPolicy(Qt::NoFocus); QString txtAdvanced(tr("Advanced")); ui->btnAdvConf->setToolTip(txtAdvanced); //设置PushButton背景透明 QPalette paletteConf = ui->btnConfImg->palette(); paletteConf.setColor(QPalette::Highlight, Qt::transparent); paletteConf.setBrush(QPalette::Button, QBrush(QColor(1,1,1,0))); ui->btnConfImg->setPalette(paletteConf); //添加PushButton的svg图片 ui->btnConfImg->setIcon(QIcon(":/res/x/control.svg")); ui->btnConfImg->setProperty("useIconHighlightEffect", true); ui->btnConfImg->setProperty("iconHighlightEffectMode", true); } // 初始化有线网列表,初始化可回连wifi列表 void MainWindow::initLanSlistAndGetReconnectNetList() { qDebug()<<"Init Net List..."; canReconnectWifiList.clear(); const int BUF_SIZE = 1024; char buf[BUF_SIZE]; FILE * p_file = NULL; //p_file = popen("export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli -f type,device,name connection show", "r"); //nmcli -f type,uuid,name connection show p_file = popen("export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli -f type,uuid,name connection show", "r"); if (!p_file) { //syslog(LOG_ERR, "Error occurred when popen cmd 'nmcli connection show'"); qDebug()<<"Error occurred when popen cmd 'nmcli connection show"; } int trimNamePos = 0; while (fgets(buf, BUF_SIZE, p_file) != NULL) { QString strSlist = ""; QString line(buf); strSlist = line.trimmed(); if (strSlist.indexOf("UUID") != -1 || strSlist.indexOf("NAME") != -1) { trimNamePos = strSlist.indexOf("NAME"); oldLanSlist.append(strSlist); } if (strSlist.indexOf("802-3-ethernet") != -1 || strSlist.indexOf("ethernet") != -1) { oldLanSlist.append(strSlist); } if (strSlist.indexOf("802-11-wireless") != -1 || strSlist.indexOf("wifi") != -1) { if (trimNamePos != 0) { QString mywifiname = strSlist.mid(trimNamePos).trimmed();//这里没有考虑wifi为空格的情况 if (!canReconnectWifiList.contains(mywifiname)) { canReconnectWifiList.append(mywifiname); } } } } pclose(p_file); } // 初始化网络 void MainWindow::initNetwork() { qDebug()<<"Init Net interface & list..."; IFace *iface = BackThread::execGetIface(); wcardname = iface->wname; lcardname = iface->lname; confForm->lcard = lcardname; confForm->wcard = wcardname; // mwBandWidth = bt->execChkLanWidth(lcardname); // 开关状态 qDebug()<<"==="; qDebug()<<"state of network: '0' is connected, '1' is disconnected, '2' is net device switch off"; //syslog(LOG_DEBUG, "state of network: '0' is connected, '1' is disconnected, '2' is net device switch off"); qDebug()<<"current network state: lan state ="<lstate<<", wifi state ="<wstate ; //syslog(LOG_DEBUG, "current network state: wired state =%d, wifi state =%d", iface->lstate, iface->wstate); qDebug()<<"==="; if (iface->wstate == 0 || iface->wstate == 1) { objKyDBus->oldWifiSwitchState = true; btnWireless->setSwitchStatus(true); } else { objKyDBus->oldWifiSwitchState = false; btnWireless->setSwitchStatus(false); } // 初始化网络列表 if (iface->wstate != 2) { if (iface->wstate == 0) { connWifiDone(3); } else { if (iface->lstate == DEVICE_CONNECTED) { connLanDone(3); } } is_init_wifi_list = 1; on_btnWifiList_clicked(); ui->btnNetList->setStyleSheet("QPushButton{border:0px solid rgba(255,255,255,0);background-color:rgba(255,255,255,0);}"); ui->btnWifiList->setStyleSheet("QPushButton{border:none;}"); } else { objKyDBus->setWifiSwitchState(false); //通知控制面板wifi未开启 if (iface->lstate != DEVICE_UNMANAGED) { if (iface->lstate == DEVICE_CONNECTED) { connLanDone(3); } onBtnNetListClicked(); ui->btnNetList->setStyleSheet("QPushButton{border:0px solid rgba(255,255,255,0);background-color:rgba(255,255,255,0);}"); ui->btnWifiList->setStyleSheet("QPushButton{border:none;}"); } else { BackThread *m_bt = new BackThread(); IFace *m_iface = m_bt->execGetIface(); //写成信号监听自动执行,避免阻塞主线程 disconnect_time = 1; connect (m_bt, &BackThread::btFinish, this, [ = ](){ disconnect_time ++; if (disconnect_time <= 3) { m_bt->disConnLanOrWifi("ethernet"); } else { m_bt->disconnect(); } }); m_bt->disConnLanOrWifi("ethernet"); delete m_iface; m_bt->deleteLater(); char *chr = "nmcli networking on"; Utils::m_system(chr); onBtnNetListClicked(); ui->btnNetList->setStyleSheet("QPushButton{border:0px solid rgba(255,255,255,0);background-color:rgba(255,255,255,0);}"); ui->btnWifiList->setStyleSheet("QPushButton{border:none;}"); } } ksnm->execGetConnList(); QString actWifiUuid = objKyDBus->getActiveWifiUuid(); objKyDBus->getConnectNetIp(actWifiUuid); objKyDBus->getWifiIp(actWifiUuid); confForm->actWifiIpv6Addr = objKyDBus->dbusActiveWifiIpv6; delete iface; iface = nullptr; } // 初始化定时器 void MainWindow::initTimer() { qDebug()<<"Init Timer..."; //应用启动后,需要连接可连接的网络 QTimer::singleShot(1*1000, this, SLOT(toReconnectWifi() )); //循环检测wifi列表的变化,可用于更新wifi列表 numberForWifiScan = 0; QObject::connect(this, SIGNAL(loadWifiListAfterScan()), this, SLOT(onLoadWifiListAfterScan())); QObject::connect(this, SIGNAL(refreshWifiListAfterScan()), this, SLOT(onRefreshWifiListAfterScan())); QObject::connect(this, SIGNAL(requestReconnecWifi()), this, SLOT(onRequestReconnecWifi())); checkWifiListChanged = new QTimer(this); checkWifiListChanged->setTimerType(Qt::PreciseTimer); QObject::connect(checkWifiListChanged, SIGNAL(timeout()), this, SLOT(onRequestScanAccesspoint())); checkWifiListChanged->start(10*1000); //网线插入时定时执行 wiredCableUpTimer = new QTimer(this); wiredCableUpTimer->setTimerType(Qt::PreciseTimer); QObject::connect(wiredCableUpTimer, SIGNAL(timeout()), this, SLOT(onCarrierUpHandle())); //网线拔出时定时执行 // wiredCableDownTimer = new QTimer(this); // wiredCableDownTimer->setTimerType(Qt::PreciseTimer); // QObject::connect(wiredCableDownTimer, SIGNAL(timeout()), this, SLOT(onCarrierDownHandle())); connect(this, SIGNAL(carrierDownHandle()), this, SLOT(onCarrierDownHandle())); //定时处理异常网络,即当点击Lan列表按钮时,若lstate=2,但任然有有线网连接的情况 deleteLanTimer = new QTimer(this); deleteLanTimer->setTimerType(Qt::PreciseTimer); QObject::connect(deleteLanTimer, SIGNAL(timeout()), this, SLOT(onDeleteLan())); //定时获取网速 setNetSpeed = new QTimer(this); setNetSpeed->setTimerType(Qt::PreciseTimer); QObject::connect(setNetSpeed, SIGNAL(timeout()), this, SLOT(on_setNetSpeed())); setNetSpeed->start(1000); } //初始化已经连接网络的DNS void MainWindow::initActNetDNS() { qDebug()<<"Init Active Net Dns..."; QList currConnLanSsidUuidState =objKyDBus->getAtiveLanSsidUuidState(); if (currConnLanSsidUuidState.size() > 0) { oldActLanName = currConnLanSsidUuidState.at(0); objKyDBus->getLanIpDNS(currConnLanSsidUuidState.at(1), true); oldDbusActLanDNS = objKyDBus->dbusActLanDNS; } } /////////////////////////////////////////////////////////////////////////////// // 任务栏托盘管理、托盘图标处理 void MainWindow::createTrayIcon() { qDebug()<<"Creating Tray Icon..."; trayIcon = new QSystemTrayIcon(); trayIcon->setToolTip(QString(tr("kylin-nm"))); trayIconMenu = new QMenu(); mShowWindow = new QAction(tr("Show MainWindow"),this); mAdvConf = new QAction(tr("Advanced"),this); mAdvConf->setIcon(QIcon::fromTheme("document-page-setup-symbolic", QIcon(":/res/x/setup.png")) ); trayIconMenu->addAction(mShowWindow); trayIconMenu->addAction(mAdvConf); trayIcon->setContextMenu(trayIconMenu); // 初始化托盘所有Icon if (!QIcon::fromTheme("network-wired-connected-symbolic").isNull()) { iconLanOnline = QIcon::fromTheme("network-wired-connected-symbolic"); } else if (!QIcon::fromTheme("network-wired-symbolic").isNull()) { iconLanOnline = QIcon::fromTheme("network-wired-symbolic"); } else { iconLanOnline = QIcon(":/res/x/net-list-bg.svg"); } if (!QIcon::fromTheme("network-wired-disconnected-symbolic").isNull()) { iconLanOffline = QIcon::fromTheme("network-wired-disconnected-symbolic"); } else { iconLanOffline = QIcon::fromTheme("network-wired-offline-symbolic"); } iconLanOnlineNoInternet = QIcon::fromTheme("network-error-symbolic"); iconWifiFull = QIcon::fromTheme("network-wireless-signal-excellent-symbolic"); iconWifiHigh = QIcon::fromTheme("network-wireless-signal-good-symbolic"); iconWifiMedium = QIcon::fromTheme("network-wireless-signal-ok-symbolic").isNull() ? QIcon::fromTheme("network-wireless-signal-ok") : QIcon::fromTheme("network-wireless-signal-ok-symbolic"); iconWifiLow = QIcon::fromTheme("network-wireless-signal-weak-symbolic").isNull() ? QIcon::fromTheme("network-wireless-signal-low") : QIcon::fromTheme("network-wireless-signal-weak-symbolic"); 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, SIGNAL(timeout()), this, SLOT(iconStep())); setTrayIcon(iconLanOnline); } void MainWindow::iconStep() { if (currentIconIndex > 11) { currentIconIndex = 0; } setTrayIcon(loadIcons.at(currentIconIndex)); currentIconIndex ++; } void MainWindow::setTrayIcon(QIcon icon) { trayIcon->setIcon(icon); } void MainWindow::setTrayIconOfWifi(int signal){ if (signal > 75) { setTrayIcon(iconWifiFull); } else if(signal > 55 && signal <= 75) { setTrayIcon(iconWifiHigh); } else if(signal > 35 && signal <= 55) { setTrayIcon(iconWifiMedium); } else if( signal <= 35) { setTrayIcon(iconWifiLow); } } void MainWindow::setTrayLoading(bool isLoading) { if (isLoading) { currentIconIndex = 0; iconTimer->start(60); } else { iconTimer->stop(); } } void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason) { if (!m_load_finished) { m_secondary_start_timer->stop(); secondaryStart(); } switch (reason) { case QSystemTrayIcon::Trigger: // case QSystemTrayIcon::MiddleClick: handleIconClicked(); if (this->isHidden()) { this->showNormal(); this->raise(); this->activateWindow(); if (is_btnLanList_clicked == 1&& is_stop_check_net_state==0) { onBtnNetListClicked(0); } if (!is_init_wifi_list && !is_connect_hide_wifi && is_stop_check_net_state==0) { is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<execGetIface(); if (loop_iface->wstate != DEVICE_UNMANAGED) { //current_wifi_list_state = UPDATE_WIFI_LIST; //checkIfConnectedWifiExist(); //this->ksnm->execGetWifiList(); //更新wifi列表 this->on_btnWifiList_clicked(); //加载wifi列表 } delete loop_iface; loop_bt->deleteLater(); } is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<m_is_inputting_wifi_password = false; this->hide(); numberForWifiScan = 0; } break; case QSystemTrayIcon::DoubleClick: //this->hide(); break; case QSystemTrayIcon::Context: //右键点击托盘图标弹出菜单 // showTrayIconMenu(); break; default: break; } } void MainWindow::handleIconClicked() { #define MARGIN 4 QDBusInterface iface("org.ukui.panel", "/panel/position", "org.ukui.panel", QDBusConnection::sessionBus()); QDBusReply reply=iface.call("GetPrimaryScreenGeometry"); //reply获取的参数共5个,分别是 主屏可用区域的起点x坐标,主屏可用区域的起点y坐标,主屏可用区域的宽度,主屏可用区域高度,任务栏位置 // reply.value(); if (!iface.isValid() || !reply.isValid() || reply.value().size()<5) { qCritical() << QDBusConnection::sessionBus().lastError().message(); this->setGeometry(0,0,this->width(),this->height()); return; } qDebug()<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 2: 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 3: 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; } } void MainWindow::showTrayIconMenu() { QRect availableGeometry = qApp->primaryScreen()->availableGeometry(); QRect screenGeometry = qApp->primaryScreen()->geometry(); QDesktopWidget* desktopWidget = QApplication::desktop(); QRect screenMainRect = desktopWidget->screenGeometry(0);//获取设备屏幕大小 QRect screenDupRect = desktopWidget->screenGeometry(1);//获取设备屏幕大小 QPoint cursorPoint = QCursor::pos();//返回相对显示器的全局坐标 int cursor_x = cursorPoint.x(); int cursor_y = cursorPoint.y(); int n = objKyDBus->getTaskBarPos("position"); int m = objKyDBus->getTaskBarHeight("height"); int d = 0; //窗口边沿到任务栏距离 int s = 80; //窗口边沿到屏幕边沿距离 if (screenGeometry.width() == availableGeometry.width() && screenGeometry.height() == availableGeometry.height()) { if (n == 0) { //任务栏在下侧 trayIconMenu->move(availableGeometry.x() + cursor_x - trayIconMenu->width()/2, screenMainRect.y() + availableGeometry.height() - trayIconMenu->height() - m - d); } else if(n == 1) { //任务栏在上侧 trayIconMenu->move(availableGeometry.x() + cursor_x - trayIconMenu->width()/2, screenMainRect.y() + screenGeometry.height() - availableGeometry.height() + m + d); } else if (n == 2) { //任务栏在左侧 trayIconMenu->move(m + d, cursor_y - trayIconMenu->height()/2); } else if (n == 3) { //任务栏在右侧 trayIconMenu->move(screenMainRect.width() - trayIconMenu->width() - m - d, cursor_y - trayIconMenu->height()/2); } } else if(screenGeometry.width() == availableGeometry.width() ) { if (trayIcon->geometry().y() > availableGeometry.height()/2) { //任务栏在下侧 trayIconMenu->move(availableGeometry.x() + cursor_x - trayIconMenu->width()/2, screenMainRect.y() + availableGeometry.height() - trayIconMenu->height() - d); } else { //任务栏在上侧 trayIconMenu->move(availableGeometry.x() + cursor_x - trayIconMenu->width()/2, screenMainRect.y() + screenGeometry.height() - availableGeometry.height() + d); } } else if (screenGeometry.height() == availableGeometry.height()) { if (trayIcon->geometry().x() > availableGeometry.width()/2) { //任务栏在右侧 trayIconMenu->move(availableGeometry.x() + availableGeometry.width() - trayIconMenu->width() - d, cursor_y - trayIconMenu->height()/2); } else { //任务栏在左侧 trayIconMenu->move(screenGeometry.width() - availableGeometry.width() + d, cursor_y - trayIconMenu->height()/2); } } } void MainWindow::on_showWindowAction() { if (!m_load_finished) { m_secondary_start_timer->stop(); secondaryStart(); } handleIconClicked(); this->showNormal(); this->raise(); this->activateWindow(); } /////////////////////////////////////////////////////////////////////////////// //加载动画,获取当前连接的网络和状态并设置图标 void MainWindow::startLoading() { qDebug()<<"Start loading..."; loading->startLoading(); setTrayLoading(true); } void MainWindow::stopLoading() { qDebug()<<"Stop loading!"; loading->stopLoading(); setTrayLoading(false); getActiveInfoAndSetTrayIcon(); } void MainWindow::on_checkOverTime() { QString cmd = "kill -9 $(pidof nmcli)"; //杀掉当前正在进行的有关nmcli命令的进程 int status = system(cmd.toUtf8().data()); if (status != 0) { qDebug()<<"execute 'kill -9 $(pidof nmcli)' in function 'on_checkOverTime' failed"; //syslog(LOG_ERR, "execute 'kill -9 $(pidof nmcli)' in function 'on_checkOverTime' failed"); } this->stopLoading(); //超时停止等待动画 is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<getActiveWifiSignal(); if (activeWifiSignalLv == 0) { if (connInfo.size() == 2) { if (connInfo.at(1).toInt() != 0) { activeWifiSignalLv = connInfo.at(1).toInt(); } } else if (connInfo.size() == 3) { if (connInfo.at(2) != 0) { activeWifiSignalLv = connInfo.at(2).toInt(); } } } // 设置图标 if (connInfo.contains("802-3-ethernet")) { QList lanstate = objKyDBus->getAtiveLanSsidUuidState(); //qDebug() << Q_FUNC_INFO << lanstate; if (lanstate.length() > 2 && lanstate[2] == "connected") { setTrayIconAfterGetConnectivity(); } else if (lanstate.length() > 2 && lanstate[2] != "connected") { setTrayLoading(true); } else { qDebug()<<"lanstate length <= 2"; } } else if (connInfo.contains("802-11-wireless") && currActWifiBssid != " ") { //currActWifiBssid是通过nmcli 命令行获取到连接wifi的bssid,如果为空格,则没有连接的wifi setTrayIconOfWifi(activeWifiSignalLv); emit this->actWifiSignalLvChanaged(activeWifiSignalLv); trayIcon->setToolTip(QString(tr("kylin-nm"))); } else if (connInfo.contains("802-11-wireless") && currActWifiBssid == " ") { this->setTrayLoading(true); this->ksnm->execGetWifiList(this->wcardname); } else { setTrayIcon(iconLanOffline); trayIcon->setToolTip(QString(tr("kylin-nm"))); } } void MainWindow::setTrayIconAfterGetConnectivity() { 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; } } /////////////////////////////////////////////////////////////////////////////// //网络设备管理 //网线插拔处理,由kylin-dbus-interface.cpp调用 void MainWindow::onPhysicalCarrierChanged(bool isCarrierLineOn) { this->startLoading(); if (isCarrierLineOn) { isHandlingWiredCableOn = true; is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<start(4000); //emit this signal to use function onCarrierUpHandle //onBtnLanClicked(4); } else { qDebug()<<"wired physical cable is already plug out"; syslog(LOG_DEBUG,"wired physical cable is already plug out"); QtConcurrent::run([=](){ int count = 0; while (1) { if (count >= 3) { onCarrierDownHandle(); break; } BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); if (iface->lstate != DEVICE_CONNECTED) { is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<start(2000); emit carrierDownHandle(); emit btnWired->clicked(5); delete iface; bt->deleteLater(); break; } delete iface; bt->deleteLater(); sleep(2); count += 1; } }); } } void MainWindow::onCarrierUpHandle() { wiredCableUpTimer->stop(); //检查有线网络的个数是否为0,如果是0,则新建一个有线网络 checkIfWiredNetExist(); this->stopLoading(); onBtnNetListClicked(1); is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<clicked(4); } void MainWindow::onCarrierDownHandle() { //syslog(LOG_DEBUG, "Wired net is disconnected"); QString txt(tr("Wired net is disconnected")); objKyDBus->showDesktopNotify(txt); currSelNetName = ""; oldActLanName = ""; oldDbusActLanDNS = 0; //emit this->waitLanStop(); //this->ksnm->execGetLanList(); //wiredCableDownTimer->stop(); this->stopLoading(); onBtnNetListClicked(0); is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<stop(); BackThread *btn_bt = new BackThread(); //写成信号监听自动执行,避免阻塞主线程 disconnect_time = 1; connect (btn_bt, &BackThread::btFinish, this, [ = ](){ disconnect_time ++; if (disconnect_time <= 3) { btn_bt->disConnLanOrWifi("ethernet"); } else { btn_bt->disconnect(); } }); btn_bt->disConnLanOrWifi("ethernet"); btn_bt->deleteLater(); this->stopLoading(); onBtnNetListClicked(0); is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<getWiredNetworkNumber() == 0) { objKyDBus->toCreateNewLan(); } } //无线网卡插拔处理 void MainWindow::onNetworkDeviceAdded(QDBusObjectPath objPath) { qDebug() <<"Network device added, path is: "<< objPath.path(); IFace *iface = BackThread::execGetIface(); wcardname = iface->wname; lcardname = iface->lname; confForm->lcard = lcardname; confForm->wcard = wcardname; delete iface; iface = nullptr; //仅处理无线网卡插入情况 objKyDBus->isWirelessCardOn = false; objKyDBus->getObjectPath(); //更新网络设备路径 if (objKyDBus->multiWirelessPaths.isEmpty()) { qDebug() << "No wifi card exist, return."; return; } if (objKyDBus->multiWirelessPaths.at(objKyDBus->multiWirelessPaths.size()-1).path() == objPath.path()) { //证明添加的是无线网卡 is_wireless_adapter_ready = 0; if (objKyDBus->isWirelessCardOn) { syslog(LOG_DEBUG,"wireless device is already plug in"); qDebug()<<"wireless device is already plug in"; is_wireless_adapter_ready = 1; onBtnWifiClicked(4); objKyDBus->getWirelessCardName(); } } } void MainWindow::onNetworkDeviceRemoved(QDBusObjectPath objPath) { qDebug() <<"Network device removed, path is: "<< objPath.path(); IFace *iface = BackThread::execGetIface(); wcardname = iface->wname; lcardname = iface->lname; confForm->lcard = lcardname; confForm->wcard = wcardname; delete iface; iface = nullptr; #if 0 objKyDBus->getObjectPath(); //更新网络设备路径 //仅处理无线网卡拔出情况 if (objKyDBus->multiWirelessPaths.isEmpty()) { qDebug() << "No wifi card exist, return."; dbus_wifiList.clear(); dbus_wifiList.append(QStringList("--")); is_wireless_adapter_ready = 0; onBtnWifiClicked(5); emit this->getWifiListFinished(); return; } #endif for (int i = 0; i < objKyDBus->multiWirelessPaths.size(); ++i) { if (objKyDBus->multiWirelessPaths.at(i).path() == objPath.path()) { objKyDBus->isWirelessCardOn = false; objKyDBus->getObjectPath(); //检查是不是还有无线网卡 if (!objKyDBus->isWirelessCardOn) { syslog(LOG_DEBUG,"wireless device is already plug out"); qDebug()<<"wireless device is already plug out"; dbus_wifiList.clear(); dbus_wifiList.append(QStringList("--")); is_wireless_adapter_ready = 0; onBtnWifiClicked(5); emit this->getWifiListFinished(); } else { objKyDBus->getWirelessCardName(); syslog(LOG_DEBUG,"wireless device is already plug out, but one more wireless exist"); qDebug()<<"wireless device is already plug out, but one more wireless exist"; } } } } void MainWindow::checkIsWirelessDevicePluggedIn() { qDebug()<<"Checking wireless device..."; //启动时判断是否有无线网卡 //KylinDBus kDBus3; if (objKyDBus->isWirelessCardOn) { is_wireless_adapter_ready = 1; } else { is_wireless_adapter_ready = 0; } } void MainWindow::getLanBandWidth() { BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); lcardname = iface->lname; // mwBandWidth = bt->execChkLanWidth(lcardname); } //检测网络设备状态 bool MainWindow::checkLanOn() { BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); bt->deleteLater(); int state = iface->lstate; if (state == 2) { return false; } else { return true; } } bool MainWindow::checkWlOn() { BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); bt->deleteLater(); int state = iface->wstate; if (state == 2) { return false; } else { return true; } } /////////////////////////////////////////////////////////////////////////////// //有线网与无线网按钮响应 void MainWindow::onBtnNetClicked() { if (checkLanOn()) { QThread *t = new QThread(); BackThread *bt = new BackThread(); bt->moveToThread(t); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, SIGNAL(started()), bt, SLOT(execDisNet())); connect(bt, SIGNAL(disNetDone()), this, SLOT(disNetDone())); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); } else { is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<moveToThread(t); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, SIGNAL(started()), bt, SLOT(execEnNet())); connect(bt, SIGNAL(enNetDone()), this, SLOT(enNetDone())); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); } this->startLoading(); } void MainWindow::onBtnWifiClicked(int flag) { qDebug()<<"Value of flag passed into function 'onBtnWifiClicked' is: "<m_is_inputting_wifi_password = false; //wifi密码输入框一定会被收起 if (is_wireless_adapter_ready == 1) { // flag: 0->UI点击关闭 1->UI点击打开 2->gsetting打开 3->gsetting关闭 4->网卡热插 5->网卡热拔 // 当连接上无线网卡时才能打开wifi开关 // 网络开关关闭时,点击Wifi开关时,程序先打开有线开关 if (flag == 0 || flag == 1 || flag == 4 || flag == 5) { if (checkWlOn()) { if (flag != 4) { //以防第二张无线网卡插入时断网 is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<setWifiSwitchState(false); lbTopWifiList->hide(); btnAddNet->hide(); QThread *t = new QThread(); BackThread *bt = new BackThread(); bt->moveToThread(t); objKyDBus->oldWifiSwitchState = true; btnWireless->setSwitchStatus(true); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, SIGNAL(started()), bt, SLOT(execDisWifi())); connect(bt, SIGNAL(disWifiDone()), this, SLOT(disWifiDone())); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); this->startLoading(); } } else { if (is_fly_mode_on == 0) { //on_btnWifiList_clicked(); is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<setWifiCardState(true); objKyDBus->setWifiSwitchState(true); QThread *t = new QThread(); BackThread *bt = new BackThread(); bt->moveToThread(t); objKyDBus->oldWifiSwitchState = true; btnWireless->setSwitchStatus(true); connect(t, &QThread::finished, t, &QThread::deleteLater); connect(t, &QThread::started, bt, &BackThread::execEnWifi); connect(bt, &BackThread::enWifiDone, this, &MainWindow::enWifiDone); connect(bt, &BackThread::btFinish, t, &QThread::quit); t->start(); this->startLoading(); } } } else if(flag == 2) { if (is_fly_mode_on == 0) { //on_btnWifiList_clicked(); is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<show(); btnAddNet->show(); QThread *t = new QThread(); BackThread *bt = new BackThread(); objKyDBus->oldWifiSwitchState = true; btnWireless->setSwitchStatus(true); bt->moveToThread(t); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, SIGNAL(started()), bt, SLOT(execEnWifi())); connect(bt, SIGNAL(enWifiDone()), this, SLOT(enWifiDone())); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); this->startLoading(); } } else if(flag == 3) { is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<hide(); btnAddNet->hide(); QThread *t = new QThread(); BackThread *bt = new BackThread(); objKyDBus->oldWifiSwitchState = true; btnWireless->setSwitchStatus(true); bt->moveToThread(t); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, SIGNAL(started()), bt, SLOT(execDisWifi())); connect(bt, SIGNAL(disWifiDone()), this, SLOT(disWifiDone())); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); this->startLoading(); } else { qDebug()<<"receive an invalid value in function onBtnWifiClicked"; //syslog(LOG_DEBUG, "receive an invalid value in function onBtnWifiClicked"); } } else { lbTopWifiList->hide(); btnAddNet->hide(); if (flag == 0) { objKyDBus->setWifiSwitchState(false); objKyDBus->setWifiCardState(false); } QString txt(tr("No wireless card detected")); //未检测到无线网卡 objKyDBus->showDesktopNotify(txt); qDebug()<<"No wireless card detected"; //syslog(LOG_DEBUG, "No wireless card detected"); disWifiStateKeep(); } } /** * @brief MainWindow::onBtnLanClicked 有线网按钮状态更改 * @param flag falg=0 0 UI关闭, 1 UI打开 ,2收到打开信息,3收到关闭信息,4有线设备插入,5有线设备拔出 */ void MainWindow::onBtnLanClicked(int flag) { switch (flag) { case 0: { qDebug()<<"On btnWired clicked! will close switch button"; emit this->onWiredDeviceChanged(false); BackThread::saveSwitchButtonState(LAN_SWITCH_OPENED, false); this->startLoading(); //记录已连接的lan BackThread::clearWiredConnectUuid(); foreach (QString ifaceName, objKyDBus->multiWiredIfName) { QString uuid = objKyDBus->getConnLanNameByIfname(ifaceName); if(uuid != "--") { qDebug() << "save iface " << ifaceName << " uuid " << uuid; BackThread::saveWiredConnectUuid(ifaceName, uuid); } } objKyDBus->disConnectWiredConnect(); QtConcurrent::run([=]() { foreach (QString lcard, BackThread::execGetIface()->lcards) { QString close_device_cmd = "nmcli device set " + lcard + " managed false"; int res = system(close_device_cmd.toUtf8().data()); qDebug()<<"Trying to close ethernet device : "<showDesktopNotify(txt); return; } qDebug()<<"On btnWired clicked! will open switch button"; emit this->onWiredDeviceChanged(true); BackThread::saveSwitchButtonState(LAN_SWITCH_OPENED, true); this->startLoading(); QtConcurrent::run([=]() { foreach (QString lcard, BackThread::execGetIface()->lcards) { QString open_device_cmd = "nmcli device set " + lcard + " managed true"; int res = system(open_device_cmd.toUtf8().data()); qDebug()<<"Trying to open ethernet device : "<toConnectWiredNet(uuid.toString(), ifaceName); } } BackThread::clearWiredConnectUuid(); QTimer::singleShot(0.5 * 1000, this, [ = ]() { //防止卡顿,延时一小段时间后再获取列表 this->ksnm->execGetLanList(); }); }); break; } case 2: { emit this->onWiredDeviceChanged(true); break; } case 3: { emit this->onWiredDeviceChanged(false); break; } case 4: { qDebug()<<"Wired device plug in!"; // btnWired->setEnabled(true); // qDebug()<<"Set btnwired enabled=true!"; //获取上次设备拔出前的有线开关状态,以判断是否需要打开开关 // if (BackThread::execGetIface()->lstate != 2) { // emit this->onWiredDeviceChanged(true); // } objKyDBus->getPhysicalCarrierState(); if (objKyDBus->isWiredCableOn) { QVariant lan_state = BackThread::getSwitchState(LAN_SWITCH_OPENED); if (!lan_state.isNull() && lan_state.isValid() && lan_state.toBool() && !btnWired->getSwitchStatus()) { QString open_device_cmd = "nmcli device set " + lcardname + " managed true"; int res = system(open_device_cmd.toUtf8().data()); qDebug()<<"Trying to open ethernet device : "<lmanaged) { emit this->onWiredDeviceChanged(false); } break; } default: break; } } void MainWindow::setLanSwitchStatus(bool is_opened) { isLanSwitchOpend = is_opened; btnWired->blockSignals(true); btnWired->setSwitchStatus(is_opened); btnWired->blockSignals(false); if (is_opened) { currSelNetName = ""; } // QTimer::singleShot(100, this, [=](){ // //加一点点延时再刷新列表,避免刚刚触发设备开关时刷新列表调用的dbus卡住 // ksnm->execGetLanList(); // }); } void MainWindow::onBtnNetListClicked(int flag) { this->is_btnLanList_clicked = 1; this->is_btnWifiList_clicked = 0; end_rcv_rates = 0; end_tx_rates = 0; ui->lbNetListBG->setStyleSheet(btnOnQss); ui->lbWifiListBG->setStyleSheet(btnOffQss); BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); lbLoadDown->hide(); lbLoadUp->hide(); lbLoadDownImg->hide(); lbLoadUpImg->hide(); lbNoItemTip->hide(); ui->lbNetwork->setText(tr("Ethernet")); btnWireless->hide(); btnWired->show(); // 强行设置为打开 if (flag == 1) { this->startLoading(); this->ksnm->execGetLanList(); this->scrollAreal->show(); this->topLanListWidget->show(); this->scrollAreaw->hide(); this->topWifiListWidget->hide(); return; } // if (iface->lstate == DEVICE_CONNECTED || iface->lstate == DEVICE_DISCONNECTED || iface->lstate == DEVICE_CONNECTING) { // this->startLoading(); // this->ksnm->execGetLanList(); // } else { // this->ksnm->isUseOldLanSlist = true; // QStringList slistLan; // slistLan.append("empty"); // getLanListDone(slistLan); // } //不管有没有打开有线设备,有线列表都应该刷新 this->startLoading(); this->ksnm->execGetLanList(); this->scrollAreal->show(); this->topLanListWidget->show(); this->scrollAreaw->hide(); this->topWifiListWidget->hide(); delete iface; bt->deleteLater(); } void MainWindow::on_btnWifiList_clicked() { m_is_inputting_wifi_password = false; is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_btnWifiList_clicked = 1; this->is_btnLanList_clicked = 0; end_rcv_rates = 0; end_tx_rates = 0; if (this->is_btnLanList_clicked == 1) { return; } BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); if (iface->wstate == DEVICE_CONNECTED) { hasWifiConnected = true; } else { lbLoadDown->hide(); lbLoadUp->hide(); lbLoadDownImg->hide(); lbLoadUpImg->hide(); hasWifiConnected = false; } ui->lbNetListBG->setStyleSheet(btnOffQss); ui->lbWifiListBG->setStyleSheet(btnOnQss); lbNoItemTip->hide(); ui->lbNetwork->setText(tr("WLAN")); btnWireless->show(); btnWired->hide(); if (iface->wstate == DEVICE_CONNECTED || iface->wstate == DEVICE_DISCONNECTED) { qDebug()<<"现在的WiFi的开关是已经打开状态"; objKyDBus->oldWifiSwitchState = true; btnWireless->setSwitchStatus(true); lbTopWifiList->show(); btnAddNet->show(); this->startLoading(); if (isHuaWeiPC) { QtConcurrent::run([=]() { if (m_connected_by_self) { m_connected_by_self = false; } else { if (this->isRadioWifiTurningOn) { qDebug() << "Turning wifi switch on now, stop to load wifi list"; } else { bShowPb = false; //不可以showpb objKyDBus->requestScanWifi(); //要求后台扫描AP sleep(2); qDebug() << "scan finished, will load wifi list"; emit loadWifiListAfterScan(); } } }); } else { //this->objKyDBus->toGetWifiList(); //这一句是使用dbus的方法获取wifilist this->ksnm->execGetWifiList(this->wcardname); } } else if (iface->wstate == DEVICE_CONNECTING) { qDebug()<<"现在的WiFi的开关是正在配置状态"; this->ksnm->isUseOldWifiSlist = true; QStringList slistWifi; slistWifi.append("empty"); getWifiListDone(slistWifi); objKyDBus->oldWifiSwitchState = true; btnWireless->setSwitchStatus(true); lbTopWifiList->show(); btnAddNet->show(); is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<oldWifiSwitchState = false; btnWireless->setSwitchStatus(false); if (topWifiListWidget) { delete topWifiListWidget; }//清空top列表 createTopWifiUI(); //创建顶部无线网item lbTopWifiList->hide(); btnAddNet->hide(); // 清空wifi列表 wifiListWidget = new QWidget(scrollAreaw); wifiListWidget->resize(W_LIST_WIDGET, H_WIFI_ITEM_BIG_EXTEND); scrollAreaw->setWidget(wifiListWidget); scrollAreaw->move(W_LEFT_AREA, Y_SCROLL_AREA); // 当前连接的wifi OneConnForm *ccf = new OneConnForm(topWifiListWidget, this, confForm, ksnm); ccf->setWifiName(tr("Not connected"), "--", "--", "--", isHuaWeiPC, isHuaWei9006C);//"当前未连接任何 Wifi" ccf->setSignal("0", "--", "0", false); // ccf->setRate("0"); ccf->setConnedString(1, tr("Disconnected"), "");//"未连接" ccf->isConnected = false; ccf->setTopItem(false); ccf->setAct(true); ccf->move(L_VERTICAL_LINE_TO_ITEM, 0); ccf->show(); ccf->lbFreq->hide(); this->lanListWidget->hide(); this->wifiListWidget->show(); getActiveInfoAndSetTrayIcon(); is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<scrollAreal->hide(); this->topLanListWidget->hide(); this->scrollAreaw->show(); this->topWifiListWidget->show(); delete iface; bt->deleteLater(); } void MainWindow::onLoadWifiListAfterScan() { current_wifi_list_state = LOAD_WIFI_LIST; this->ksnm->execGetWifiList(this->wcardname); //加载wifi列表 objKyDBus->getWirelessCardName(); } void MainWindow::on_wifi_changed() { QString actWifiUuid = objKyDBus->getActiveWifiUuid(); objKyDBus->getConnectNetIp(actWifiUuid); objKyDBus->getWifiIp(actWifiUuid); confForm->actWifiIpv6Addr = objKyDBus->dbusActiveWifiIpv6; if (oldWifiIpv4Method == "") { oldWifiIpv4Method = objKyDBus-> dbusWifiIpv4Method; } if (objKyDBus->dbusWifiIpv4 != "" && objKyDBus->dbusActiveWifiIpv4 != "" && objKyDBus->dbusWifiIpv4 != objKyDBus->dbusActiveWifiIpv4 &&objKyDBus-> dbusWifiIpv4Method == "manual") { //在第三方nm-connection-editor进行新的IP配置后,重新连接网络 oldWifiIpv4Method = "manual"; qDebug()<<"Ipv4.address of current activated wifi is:"<dbusActiveWifiIpv4 << ". Real ipv4.address is:" << objKyDBus->dbusWifiIpv4; emit this->reConnectWifi(actWifiUuid); emit this->configurationChanged(); } else if (objKyDBus-> dbusWifiIpv4Method == "auto" && oldWifiIpv4Method == "manual") { oldWifiIpv4Method = "auto"; qDebug()<<"Ipv4.method is set to auto."; emit this->reConnectWifi(actWifiUuid); emit this->configurationChanged(); } else if (!objKyDBus->dbusActiveWifiIpv6.isEmpty() && objKyDBus->dbusActiveWifiIpv6 != objKyDBus->dbusWifiIpv6 && objKyDBus->dbusWifiIpv6Method == "manual") { //在第三方nm-connection-editor或kylin-nm配置页进行新的IPV6配置后,重新连接网络 emit this->reConnectWifi(actWifiUuid); emit this->configurationChanged(); } } /** * @brief MainWindow::onNewConnAdded 获取新的连接列表 * @param type 0为有线,1为无线 */ void MainWindow::onNewConnAdded(int type) { if (type == 1) { isAddedWifi = true; } this->ksnm->execGetConnList(); } /////////////////////////////////////////////////////////////////////////////// //网络列表加载与更新 // 获取lan列表回调 void MainWindow::getLanListDone(QStringList slist) { if (this->is_btnWifiList_clicked == 1) { return; } //要求使用上一次获取到的列表 if (this->ksnm->isUseOldLanSlist) { slist = oldLanSlist; this->ksnm->isUseOldLanSlist = false; } //若slist为空,则也使用上一次获取到的列表 if (slist.size() == 1 && slist.at(0) == "") { if (oldLanSlist.size() == 1 && oldLanSlist.at(0) == "") { return; } else { slist = oldLanSlist; } } delete topLanListWidget; // 清空top列表 createTopLanUI(); //创建顶部有线网item // 清空lan列表 lanListWidget = new QWidget(scrollAreal); lanListWidget->resize(W_LIST_WIDGET, H_NORMAL_ITEM + H_LAN_ITEM_EXTEND); scrollAreal->setWidget(lanListWidget); scrollAreal->move(W_LEFT_AREA, Y_SCROLL_AREA); // 获取当前连接有线网的SSID和UUID QList actLanSsidName; QList actLanUuidName; QList actLanStateName; QList connectingLanSsidName; QList connectingLanUuidName; QList connectingLanStateName; QList currConnLanSsidUuidState =objKyDBus->getAtiveLanSsidUuidState(); bool hasCurrentLanConnected = false; if (currConnLanSsidUuidState.contains("connected")) { hasCurrentLanConnected = true; } // 若当前没有任何一个有线网连接,设置有线列表顶部的item状态为未连接 if (!hasCurrentLanConnected) { OneLancForm *ccf = new OneLancForm(topLanListWidget, this, confForm, ksnm); ccf->setLanName(tr("Not connected"), tr("Not connected"), "--", "--");//"当前未连接任何 以太网" ccf->setIcon(false); ccf->setConnedString(1, tr("Disconnected"), "");//"未连接" ccf->isConnected = false; ifLanConnected = false; lbLoadDown->hide(); lbLoadUp->hide(); lbLoadDownImg->hide(); lbLoadUpImg->hide(); ccf->setTopItem(false);//"当前未连接任何 以太网" ccf->setAct(true); ccf->move(L_VERTICAL_LINE_TO_ITEM, 0); ccf->show(); ccf->setLine(false); currTopLanItem = 1; } if (currConnLanSsidUuidState.size() != 0) { int i = 0; while((i + 2) < currConnLanSsidUuidState.size()) { if (currConnLanSsidUuidState.at(i+2) == "connecting") { connectingLanSsidName.append(currConnLanSsidUuidState.at(i)); //有线网络名称 connectingLanUuidName.append(currConnLanSsidUuidState.at(i+1)); //有线网络唯一ID connectingLanStateName.append(currConnLanSsidUuidState.at(i+2)); //有线网络连接状态 } else { actLanSsidName.append(currConnLanSsidUuidState.at(i)); //有线网络名称 actLanUuidName.append(currConnLanSsidUuidState.at(i+1)); //有线网络唯一ID actLanStateName.append(currConnLanSsidUuidState.at(i+2)); //有线网络连接状态 } i += 3; } currTopLanItem = actLanSsidName.size(); } // 填充可用网络列表 QString headLine = slist.at(0); int indexUuid, indexName, indexDevice; headLine = headLine.trimmed(); bool isChineseExist = headLine.contains(QRegExp("[\\x4e00-\\x9fa5]+")); if (isChineseExist) { indexUuid = headLine.indexOf("UUID") + 2; indexDevice = headLine.indexOf("设备") + 2; indexName = headLine.indexOf("名称") + 2; } else { indexUuid = headLine.indexOf("UUID"); indexDevice = headLine.indexOf("DEVICE"); indexName = headLine.indexOf("NAME"); } for(int i = 1, j = 0; i < slist.size(); i ++) { QString line = slist.at(i); if(!line.size()){ continue; } QString ltype = line.mid(0, indexUuid).trimmed(); QString nuuid = line.mid(indexUuid, indexDevice - indexUuid).trimmed(); QString ndevice = line.mid(indexDevice,indexName-indexDevice).trimmed(); QString nname = line.mid(indexName); while(nname.endsWith(' ')) { nname.chop(1); } if (nname=="") { nname = " "; //防止有线网络的名称为空 } bool isActiveNet = false; //isActiveNet用来表明nname是否是活动的连接 //仅仅对有线网络进行添加列表处理 // if (ltype != "802-11-wireless" && ltype != "wifi" && ltype != "bridge" && ltype != "bluetooth" && ltype != "" && ltype != "--") { if (ltype == "802-3-ethernet" || ltype == "ethernet" || ltype == "vpn") { objKyDBus->getLanIpDNS(nuuid, true); //使用UUID获取有线网的ip和dns信息 QString macLan = getMacByUuid(nuuid); //有线网对应的mac地址 QString macInterface = "--"; QString mIfName = ndevice; macInterface = objKyDBus->getLanMAC(mIfName); if (macLan!="" && macLan!="--" && macLan != macInterface) { //continue; //有线网的permenant mac地址与网卡的地址不同,则不在列表中显示 macInterface = macLan; } //**********************创建已经连接的有线网item********************// if (currConnLanSsidUuidState.size() != 0) {//证明有已经连接的有线网络 for (int kk=0; kkresize(topLanListWidget->width(), topLanListWidget->height() + H_NORMAL_ITEM*kk); isActiveNet = true; //名为nname的网络是已经连接的有线网络 ifLanConnected = true; objKyDBus->getConnectNetIp(nuuid); confForm->actLanIpv6Addr = objKyDBus->dbusActiveLanIpv6; getLanBandWidth(); //QString strLanName = TranslateLanName(nname); //进行中英文系统环境下有线网络名称的汉化 OneLancForm *ccfAct = new OneLancForm(topLanListWidget, this, confForm, ksnm); connect(ccfAct, SIGNAL(selectedOneLanForm(QString, QString)), this, SLOT(oneTopLanFormSelected(QString, QString))); connect(ccfAct, SIGNAL(requestHandleLanDisconn()), this, SLOT(handleLanDisconn())); ccfAct->setLanName(nname, ltype, nuuid, mIfName);//第二个参数本来是strLanName,但目前不需要翻译 ccfAct->setIcon(true); // BackThread *bt = new BackThread(); // mwBandWidth = bt->execChkLanWidth(mIfName); // delete bt; QString bandWidth = BackThread::execChkLanWidth(mIfName); ccfAct->setLanInfo(objKyDBus->dbusActiveLanIpv4, objKyDBus->dbusActiveLanIpv6, bandWidth, macInterface); ccfAct->isConnected = true; ccfAct->setTopItem(false); ccfAct->setAct(true); ccfAct->move(L_VERTICAL_LINE_TO_ITEM, kk*H_NORMAL_ITEM); ccfAct->show(); if (actLanSsidName.size() == 1) { lbLoadDown->show(); lbLoadUp->show(); lbLoadDownImg->show(); lbLoadUpImg->show(); currConnIfname = mIfName; ccfAct->setConnedString(1, tr("NetOn"), "");//"已连接" } else { lbLoadDown->hide(); lbLoadUp->hide(); lbLoadDownImg->hide(); lbLoadUpImg->hide(); ccfAct->setConnedString(1, tr("NetOn,IfName:"), mIfName);//"已连接" } if (kk != actLanSsidName.size() - 1) { ccfAct->setLine(true); } else { ccfAct->setLine(false); //最后一个item不显示下划线 } if (!objKyDBus->dbusLanIpv4.isEmpty()) { if (!objKyDBus->dbusActiveLanIpv4.isEmpty() && objKyDBus->dbusActiveLanIpv4 != objKyDBus->dbusLanIpv4) { // qDebug() << Q_FUNC_INFO << __LINE__ << objKyDBus->dbusActiveLanIpv4 << objKyDBus->dbusLanIpv4; //在第三方nm-connection-editor进行新的IP配置后,重新连接网络 objKyDBus->reConnectWiredNet(nuuid); emit this->configurationChanged(); } else if ((oldActLanName == actLanSsidName.at(kk)) && (oldDbusActLanDNS != objKyDBus->dbusActLanDNS)) { //在第三方nm-connection-editor进行新的DNS配置后,重新连接网络 objKyDBus->reConnectWiredNet(nuuid); emit this->configurationChanged(); } else if (!objKyDBus->dbusActiveLanIpv6.isEmpty() && objKyDBus->dbusActiveLanIpv6 != objKyDBus->dbusLanIpv6 && objKyDBus->dbusLanIpv6Method == "manual") { // qDebug() << Q_FUNC_INFO << __LINE__ << objKyDBus->dbusActiveLanIpv6 << objKyDBus->dbusLanIpv6 << objKyDBus->dbusLanIpv6Method; //在第三方nm-connection-editor或kylin-nm配置页进行新的IPV6配置后,重新连接网络 objKyDBus->reConnectWiredNet(nuuid); emit this->configurationChanged(); } actLanUuid = nuuid; actLanIpv4Method = "manual"; } else { //已连接WiFi未改变但IP获取方式改变,重连之 if (actLanUuid == nuuid && actLanIpv4Method == "manual") { objKyDBus->reConnectWiredNet(nuuid); emit this->configurationChanged(); } actLanUuid = nuuid; actLanIpv4Method = "auto"; } currSelNetName = ""; objKyDBus->dbusActiveLanIpv4 = ""; objKyDBus->dbusActiveLanIpv6 = ""; oldActLanName = actLanSsidName.at(kk); oldDbusActLanDNS = objKyDBus->dbusActLanDNS; int topLanNum = (currTopLanItem >= 1) ? currTopLanItem : 1; lbTopLanList->move(X_MIDDLE_WORD, H_NORMAL_ITEM * topLanNum + H_GAP_UP); btnCreateNet->move(X_BTN_FUN, Y_BTN_FUN + H_NORMAL_ITEM * (topLanNum-1)); scrollAreal->move(W_LEFT_AREA, Y_SCROLL_AREA + H_NORMAL_ITEM * (topLanNum-1)); qDebug()<<"already insert an active lan network item in the top of lan list"; //syslog(LOG_DEBUG, "already insert an active lan network item in the top of lan list"); } } } lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2 + H_NORMAL_ITEM*(currTopLanItem-1)/2); //**********************创建未连接的有线网item********************// if (!isActiveNet && btnWired->getSwitchStatus()) { lanListWidget->resize(W_LIST_WIDGET, lanListWidget->height() + H_NORMAL_ITEM); //QString strLanName = TranslateLanName(nname); OneLancForm *ocf = new OneLancForm(lanListWidget, this, confForm, ksnm); connect(ocf, SIGNAL(selectedOneLanForm(QString, QString)), this, SLOT(oneLanFormSelected(QString, QString))); ocf->setLanName(nname, ltype, nuuid, mIfName); ocf->setIcon(true); ocf->setLine(true); ocf->setLanInfo(objKyDBus->dbusLanIpv4, objKyDBus->dbusLanIpv6, tr("Disconnected"), macInterface); ocf->setConnedString(0, tr("Disconnected"), "");//"未连接" ocf->move(L_VERTICAL_LINE_TO_ITEM, j * H_NORMAL_ITEM); ocf->setSelected(false, false); ocf->show(); // for (int kk=0; kkstartWaiting(true); // } // } if (connectingLanSsidName.contains(nname) && connectingLanUuidName.contains(nuuid)) { ocf->startWaiting(true); } j ++; } } } QList itemList = lanListWidget->findChildren(); int n = itemList.size(); if (n >= 1) { OneLancForm *lastItem = itemList.at(n-1); lastItem->setLine(false); //最后一个item不显示下划线 lbNoItemTip->hide(); } else { if (btnWired->getSwitchStatus()) { lbTopLanList->show(); btnCreateNet->show(); lbNoItemTip->show(); lbNoItemTip->setText(tr("No Other Wired Network Scheme")); } else { lbTopLanList->hide(); btnCreateNet->hide(); lbNoItemTip->hide(); } } currSelNetName = ""; this->lanListWidget->show(); this->topLanListWidget->show(); this->wifiListWidget->hide(); this->topWifiListWidget->hide(); this->stopLoading(); oldLanSlist = slist; is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<lmanaged) { btnWired->blockSignals(true); btnWired->setSwitchStatus(false); btnWired->blockSignals(false); } else { btnWired->blockSignals(true); btnWired->setSwitchStatus(true); btnWired->blockSignals(false); } if (iface) delete iface; } // 获取wifi列表回调 void MainWindow::onRequestRevalueUpdateWifi() { if (!isReConnAfterTurnOnWifi) { isReConnAfterTurnOnWifi = false; is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<moveToThread(btnStatus); connect(btnStatus, &QThread::started, backThread, &BackThread::getInitStatus); connect(backThread, &BackThread::wifiStatus, this, [=] (bool status) { objKyDBus->oldWifiSwitchState = status; btnWireless->setSwitchStatus(status); btnStatus->quit(); //退出事件循环 btnStatus->wait(); //释放资源 }); connect(btnStatus, SIGNAL(finished()), btnStatus, SLOT(deleteLater())); connect(backThread, SIGNAL(getWifiStatusComplete()), btnStatus, SLOT(quit())); btnStatus->start(); } // 获取wifi列表回调 void MainWindow::getWifiListDone(QStringList slist) { qDebug() << "Get wifi list done, current_wifi_list_state = " << current_wifi_list_state << ". m_is_inputting_pwd = " << m_is_inputting_wifi_password; setBtnWirelessStatus(); //要求使用上一次获取到的列表 if (this->ksnm->isUseOldWifiSlist) { slist = oldWifiSlist; this->ksnm->isUseOldWifiSlist = false; } if (slist.isEmpty() || slist.size() == 1) { if (oldWifiSlist.isEmpty() || oldWifiSlist.size() == 1) { this->stopLoading(); return; } else { slist = oldWifiSlist; } } slist = priorityList(slist); // if (this->is_btnLanList_clicked == 1 && current_wifi_list_state != REFRESH_WIFI) { // oldWifiSlist = slist; // return; // } if ((current_wifi_list_state == LOAD_WIFI_LIST || current_wifi_list_state == REFRESH_WIFI) && !this->m_is_inputting_wifi_password) { if (!isReconnectingWifi) { loadWifiListDone(slist); is_init_wifi_list = 0; } else { qDebug() << "正在进行wifi的回连操作,现在停止加载wifi界面"; oldWifiSlist = slist; return; } } if (current_wifi_list_state == UPDATE_WIFI_LIST || this->m_is_inputting_wifi_password) { //如果WiFi连接状态发生了改变,需要刷新整个列表,否则只需要比对新旧列表更新即可 if (m_isWifiConnected && objKyDBus->checkWifiConnectivity() != WIFI_CONNECTED) { //qDebug() << "loadwifi的列表"; loadWifiListDone(slist); } else if (!m_isWifiConnected && objKyDBus->checkWifiConnectivity() == WIFI_CONNECTED) { loadWifiListDone(slist); } else { //qDebug() << "updatewifi的列表"; updateWifiListDone(slist); current_wifi_list_state = LOAD_WIFI_LIST; } } oldWifiSlist = slist; } // 获取已保存的连接列表回调 void MainWindow::getConnListDone(QStringList slist) { if (isInitConnList) { for (int i = 1; i < slist.length() - 1; i++) { oldConnSlist << slist.at(i).trimmed(); } isInitConnList = false; return; } else { QStringList newConnSlist; for (int i = 1; i < slist.length() - 1; i++) { newConnSlist << slist.at(i).trimmed(); } for (auto s : newConnSlist) { if (!oldConnSlist.contains(s)) { lastAddedConn = s; break; } } if (isAddedWifi) { isAddedWifi = false; //如果是新添加的wifi,尝试激活这个wifi if (! is_stop_check_net_state) { this->is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<moveToThread(t); connect(t, &QThread::finished, t, &QThread::deleteLater); connect(t, &QThread::started, this, [ = ]() { bt->execConnWifi(lastAddedConn, objKyDBus->dbusWiFiCardName); }); connect(bt, &BackThread::connDone, this, [ = ](int res) { connWifiDone(res); bt->deleteLater(); }); t->start(); } } oldConnSlist.clear(); oldConnSlist = newConnSlist; return; } } //QStringList MainWindow::priorityList(QStringList slist){ // QStringList ret; // ret.append(slist[0]); // QString headLine = slist.at(0); // int indexSignal,indexSecu, indexFreq, indexBSsid, indexName,indexPath,indexCate; // headLine = headLine.trimmed(); // bool isChineseExist = headLine.contains(QRegExp("[\\x4e00-\\x9fa5]+")); // if (isChineseExist) { // indexSignal = headLine.indexOf("SIGNAL"); // indexSecu = headLine.indexOf("安全性"); // indexFreq = headLine.indexOf("频率") + 4; // indexBSsid = headLine.indexOf("BSSID") + 6; // indexName = indexBSsid + 19; // indexPath = headLine.indexOf("DBUS-PATH"); // indexCate = headLine.indexOf("CATEGORY"); // } else { // indexSignal = headLine.indexOf("SIGNAL"); // indexSecu = headLine.indexOf("SECURITY"); // indexFreq = headLine.indexOf("FREQ"); // indexBSsid = headLine.indexOf("BSSID"); // indexName = indexBSsid + 19; // indexPath = headLine.indexOf("DBUS-PATH"); // indexCate = headLine.indexOf("CATEGORY"); // } // QStringList p1,p2,p3,p4,p5,p6,p7;//按照信号与频段划分为6个列表 // for(int i=1;i 75 && conFreq >= 5000){ // p1.append(line); // continue; // }else if(conSignal > 55 && conFreq >= 5000){ // p2.append(line); // continue; // }else if(conSignal > 75){ // p3.append(line); // continue; // }else if(conSignal > 55){ // p4.append(line); // continue; // }else if(conSignal > 35){ // p5.append(line); // continue; // }else if(conSignal > 15){ // p6.append(line); // continue; // }else{ // p7.append(line); // } // } // QVector listVec; // listVec< 55 && conCate == 2){ p1.append(line); continue; }else if(conSignal > 55 && conCate == 1){ p2.append(line); continue; }else{ p3.append(line); continue; } } QVector listVec; listVec< 75 && conFreq >= 5000){ p1.append(line); continue; }else if(conSignal > 55 && conFreq >= 5000){ p2.append(line); continue; }else if(conSignal > 75){ p3.append(line); continue; }else if(conSignal > 55){ p4.append(line); continue; }else if(conSignal > 35){ p5.append(line); continue; }else if(conSignal > 15){ p6.append(line); continue; }else{ p7.append(line); } } ret< MainWindow::repetitionFilter(QVector){ QVector ret; return ret; } QStringList MainWindow::sortApByCategory(QStringList list,int cateIndex){ QStringList ret; for(auto line:list){ int conCate = line.mid(cateIndex).trimmed().toInt(); if(conCate == 2){ ret.append(line); } } for(auto line:list){ int conCate = line.mid(cateIndex).trimmed().toInt(); if(conCate == 1){ ret.append(line); } } for(auto line:list){ int conCate = line.mid(cateIndex).trimmed().toInt(); if(conCate == 0){ ret.append(line); } } return ret; } //进行wifi列表优化选择,分为2.4G和5G进行选择,先每种频率形成一个列表 //同一个列表中同名wifi只有一个,再按信号强度由大到小合并列表 void MainWindow::wifiListOptimize(QStringList& slist) { if (slist.size() < 2) return ; QString headLine = slist.at(0); int indexSignal, indexSecu, indexFreq, indexBSsid, indexName, indexPath, indexCate; headLine = headLine.trimmed(); bool isChineseExist = headLine.contains(QRegExp("[\\x4e00-\\x9fa5]+")); if (isChineseExist) { indexSignal = headLine.indexOf("SIGNAL"); indexSecu = headLine.indexOf("安全性"); indexFreq = headLine.indexOf("频率") + 4; indexBSsid = headLine.indexOf("BSSID") + 6; indexPath = headLine.indexOf("DBUS-PATH"); indexCate = headLine.indexOf("CATEGORY"); indexName = headLine.lastIndexOf("SSID"); } else { indexSignal = headLine.indexOf("SIGNAL"); indexSecu = headLine.indexOf("SECURITY"); indexFreq = headLine.indexOf("FREQ"); indexBSsid = headLine.indexOf("BSSID"); indexPath = headLine.indexOf("DBUS-PATH"); indexCate = headLine.indexOf("CATEGORY"); indexName = headLine.lastIndexOf("SSID"); } QStringList targetList; //slist优化,同名同频同类别(category)AP中只留信号最强 targetList<= 5000 && freq >= 5000 && conCate == category) { ifContinue = true; break; } } } if (ifContinue && !isConnected) continue; targetList << currentWifiInfo; } // //上面的选网方法容易把存在同名wifi的情况下把已经连接的那个wifi给去掉 // //在这种情况下,把连接的wifi信息加回去 // int changePosition = 100000; // for (int kk=1;kk= 5000) { //排在前面的一个是5Gwifi,并且信号也强一些 deleteWifiStr.append(wifiStr); } else { //排在前面的一个是2.4G if (freq >= 5000) { //排在后面的一个是5G if (signal >= 55) { //排在后面的一个是5Gwifi信号强度 >= 3格,选5G deleteWifiStr.append(wifiInfo); } else { deleteWifiStr.append(wifiStr); } } else { //排在后面的一个是2.4G deleteWifiStr.append(wifiStr); } } break; } } } foreach (QString deleteStr, deleteWifiStr) { slist.removeOne(deleteStr); } } //从有配置文件的wifi选出最优wifi进行连接,同时考虑用户手动设置的优先级,这个函数在回连中用到 QVector MainWindow::connectableWifiPriorityList(const QStringList slist){ QVector selectedWifiListStruct; if(slist.size()<2) return selectedWifiListStruct; OneConnForm *ocf = new OneConnForm(); QString headLine = slist.at(0); int indexSignal,indexSecu, indexFreq, indexBSsid, indexName, indexPath,indexCate; headLine = headLine.trimmed(); bool isChineseExist = headLine.contains(QRegExp("[\\x4e00-\\x9fa5]+")); if (isChineseExist) { indexSignal = headLine.indexOf("SIGNAL"); indexSecu = headLine.indexOf("安全性"); indexFreq = headLine.indexOf("频率") + 4; indexBSsid = headLine.indexOf("BSSID") + 6; indexPath = headLine.indexOf("DBUS-PATH"); indexCate = headLine.indexOf("CATEGORY"); indexName = headLine.lastIndexOf("SSID"); } else { indexSignal = headLine.indexOf("SIGNAL"); indexSecu = headLine.indexOf("SECURITY"); indexFreq = headLine.indexOf("FREQ"); indexBSsid = headLine.indexOf("BSSID"); indexPath = headLine.indexOf("DBUS-PATH"); indexCate = headLine.indexOf("CATEGORY"); indexName = headLine.lastIndexOf("SSID"); } QStringList tmp = slist; for (int iter=1; iter= 0) { wifiObjectPath = line.mid(indexPath,indexCate-indexPath).trimmed(); } else { wifiObjectPath = line.mid(indexPath,indexName-indexPath).trimmed(); } QString wifiAutoConnection = "no"; QString wifiPriority; if (ocf->isWifiConfExist(wifiname) && canReconnectWifiList.contains(wifiname)) { QString tmpPath = "/tmp/kylin-nm-lanprop-" + QDir::home().dirName(); QString getInfoCmd = "nmcli -f connection.autoconnect,connection.autoconnect-priority connection show '" + wifiname + "' > " + tmpPath; Utils::m_system(getInfoCmd.toUtf8().data()); QFile file(tmpPath); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //syslog(LOG_ERR, "Can't open the file /tmp/kylin-nm-lanprop in function connectableWifiPriorityList!"); qDebug()<<"Can't open the file /tmp/kylin-nm-lanprop in function connectableWifiPriorityList!"; } QString txt = file.readAll(); QStringList txtLine = txt.split("\n"); file.close(); foreach (QString line, txtLine) { if (line.startsWith("connection.autoconnect:")) { wifiAutoConnection = line.mid(25).trimmed(); //connection.autoconnect:有23个字符 } if (line.startsWith("connection.autoconnect-priority:")) { wifiPriority = line.mid(34).trimmed(); //connection.autoconnect-priority:有32个字符 } } //可以自动回连,则加入列表 if (wifiAutoConnection == "是" || wifiAutoConnection == "yes") { qDebug("Connectable wifi SSID:%s , category:%s ,frequence:%s",wifibssid.toUtf8().data(),wificate.toUtf8().data(),wififreq.toUtf8().data()); structWifiProperty myWifiProStruct; myWifiProStruct.objectPath = wifiObjectPath; myWifiProStruct.bssid = wifibssid; myWifiProStruct.priority = wifiPriority.toInt(); selectedWifiListStruct.append(myWifiProStruct); } } } //再按照wifiPriority进行排序,先简单的选出最高优先级的wifi进行连接 if (selectedWifiListStruct.size() > 1) { devListSort(&selectedWifiListStruct); //foreach (structWifiProperty wifiPriorityAfterSort, selectedWifiListStruct) { // qDebug() << wifiPriorityAfterSort.bssid << " 的自动连接优先级是 : " << wifiPriorityAfterSort.priority; //} } ocf->deleteLater(); return selectedWifiListStruct; } //排序 void MainWindow::devListSort(QVector *list) { // qSort(list->begin(), list->end(), subDevListSort); std::sort(list->begin(), list->end(), subDevListSort); } bool MainWindow::subDevListSort(const structWifiProperty &info1, const structWifiProperty &info2) { return info1.priority > info2.priority; } // 加载wifi列表 void MainWindow::loadWifiListDone(QStringList slist) { if (this->is_btnLanList_clicked == 1) { onlyRefreshWifiList(slist); return; } // qDebug() << "kkkkkkkkkkkkkkkkkkkkkkkk"; // foreach (QString kkkkk, slist) { // qDebug() << kkkkk; // } // qDebug() << "kkkkkkkkkkkkkkkkkkkkkkkk"; // qDebug() << " "; delete topWifiListWidget; //清空top列表 createTopWifiUI(); //创建topWifiListWidget // 清空wifi列表 wifiListWidget = new QWidget(scrollAreaw); wifiListWidget->resize(W_LIST_WIDGET, H_WIFI_ITEM_BIG_EXTEND); scrollAreaw->setWidget(wifiListWidget); scrollAreaw->move(W_LEFT_AREA, Y_SCROLL_AREA); dbus_wifiList.clear(); // 获取当前无线网的连接状态,正在连接wifiActState==1,已经连接wifiActState==2, 未连接wifiActState==3 int wifiActState = objKyDBus->checkWifiConnectivity(); //检查wifi的连接状态 if (wifiActState == WIFI_CONNECTED) { m_isWifiConnected = true; } else { m_isWifiConnected = false; } // if (isWifiBeConnUp && wifiActState == 1) { // wifiActState = 2; // } QList currConnWifiBSsidUuid; currConnWifiBSsidUuid = objKyDBus->getAtiveWifiBSsidUuid(slist); // bool isLoop = true; // do { // currConnWifiBSsidUuid = objKyDBus->getAtiveWifiBSsidUuid(slist); // if (currConnWifiBSsidUuid.size() == 1 && currConnWifiBSsidUuid.at(0).length() != 17) { // sleep(1); //等于1说明只获取到uuid,1秒后再获取一次 // } else { // isLoop = false; // } // } while (isLoop); // 获取当前连接的wifi name QString actWifiName = "--"; QString actWifiId = "--"; actWifiSsid = "--"; actWifiUuid = "--"; if (currConnWifiBSsidUuid.size() > 1) { actWifiUuid = currConnWifiBSsidUuid.at(0); for (int i=1; i= 0) { wDbusPath = line.mid(Path,indexCate-Path).trimmed(); } else { wDbusPath = line.mid(Path,indexName-Path).trimmed(); } QDBusInterface interface("org.freedesktop.NetworkManager", wDbusPath, "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interface.call("Get","org.freedesktop.NetworkManager.AccessPoint","Ssid"); QString wname = reply.value().toString(); if (actWifiBssidList.contains(wbssid)) { actWifiName = wname; } if ("*" == line.mid(0,indexSignal).trimmed()) { //在华为的电脑中,因为前面的优选工作,即使有已经连接的wifi,也可能会被筛选出去 actWifiBssid = wbssid; currActWifiBssid = wbssid; } } // 根据当前连接的wifi 设置OneConnForm OneConnForm *ccf = new OneConnForm(topWifiListWidget, this, confForm, ksnm); if (actWifiName == "--" || wifiActState == WIFI_CONNECTING || actWifiBssidList.at(0) == "--" || actWifiBssid == " ") { ccf->setWifiName(tr("Not connected"), "--", "--", "--", isHuaWeiPC, isHuaWei9006C);//"当前未连接任何 Wifi" ccf->setSignal("0", "--" , "0", false); activeWifiSignalLv = 0; ccf->setConnedString(1, tr("Disconnected"), "");//"未连接" ccf->isConnected = false; ccf->lbFreq->hide(); ifWLanConnected = false; lbLoadDown->hide(); lbLoadUp->hide(); lbLoadDownImg->hide(); lbLoadUpImg->hide(); ccf->setTopItem(false); dbus_wifiList.append(QStringList("--")); //没有已连接wifi时,第一个元素为-- } else { QProcess * process = new QProcess; QString name = actWifiName; process->start(QString("nmcli -f 802-11-wireless.ssid connection show \"%1\"").arg(name)); connect(process, static_cast(&QProcess::finished), this, [ = ]() { process->deleteLater(); }); connect(process, &QProcess::readyReadStandardOutput, this, [ = ]() { QString str = process->readAllStandardOutput(); actWifiSsid = str.mid(str.lastIndexOf(" ") + 1, str.length() - str.lastIndexOf(" ") - 2); //获取到ssid时,以ssid为准 }); connect(process, &QProcess::readyReadStandardError, this, [ = ]() { actWifiSsid = actWifiName; //没有获取到ssid时,以wifi名为准 }); process->waitForFinished(); } ccf->setAct(true); ccf->move(L_VERTICAL_LINE_TO_ITEM, 0); ccf->show(); if (actWifiBssidList.size()==1 && actWifiBssidList.at(0)=="--") { actWifiId = actWifiName; actWifiName = "--"; } for (int i = 1, j = 0; i < slist.size(); i ++) { QString line = slist.at(i); QString wsignal = line.mid(indexSignal, 3).trimmed(); QString wsecu = line.mid(indexSecu, indexFreq - indexSecu).trimmed(); QString wbssid = line.mid(indexBSsid, 17).trimmed(); QString wfreq = line.mid(indexFreq, 4).trimmed(); QString wcate; if (indexCate >= 0) wcate = line.mid(indexCate, 1).trimmed(); else wcate = QString::number(0); QString wDbusPath; if (indexCate >= 0) { wDbusPath = line.mid(indexPath,indexCate-indexPath).trimmed(); } else { wDbusPath = line.mid(indexPath,indexName-indexPath).trimmed(); } QDBusInterface interface("org.freedesktop.NetworkManager", wDbusPath, "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interface.call("Get","org.freedesktop.NetworkManager.AccessPoint","Ssid"); QString wname = reply.value().toString(); if (!isHuaWeiPC) { //如果不是华为的电脑,选择wifi在这里执行 if (actWifiName != "--" && actWifiName == wname) { // if (!actWifiBssidList.contains(wbssid)) { if(actWifiBssid != wbssid) { continue; //若当前热点ssid名称和已经连接的wifi的ssid名称相同,但bssid不同,则跳过 } } if ((wnames.contains(wname) && wbssid != actWifiBssid)) { continue; //过滤相同名称的wifi } } else { // if ((actWifiName == wname) && actWifiBssidList.size()>=1) { // //防止列表中没有已经连接的那个wifi // wbssid = actWifiBssidList.at(0); // actWifiBssid = actWifiBssidList.at(0); // } if ((wnames.contains(wname) && wbssid != actWifiBssid)) { continue; //过滤相同名称的wifi } } int max_freq = wfreq.toInt(); int min_freq = wfreq.toInt(); for (int k = i; k < slist.size(); k ++) { QString m_DbusPath; if (indexCate >= 0) { m_DbusPath = slist.at(k).mid(indexPath,indexCate-indexPath).trimmed(); } else { m_DbusPath = slist.at(k).mid(indexPath,indexName-indexPath).trimmed(); } QDBusInterface m_interface("org.freedesktop.NetworkManager", m_DbusPath, "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply m_reply = m_interface.call("Get","org.freedesktop.NetworkManager.AccessPoint","Ssid"); QString m_name = m_reply.value().toString(); if (wname == m_name) { if (slist.at(k).mid(indexFreq, 4).trimmed().toInt() > max_freq) { max_freq = slist.at(k).mid(indexFreq, 4).trimmed().toInt(); } else if (slist.at(k).mid(indexFreq, 4).trimmed().toInt() < min_freq) { min_freq = slist.at(k).mid(indexFreq, 4).trimmed().toInt(); } } } //qDebug()<<"Wifi ssid="<setSignal(QString::number(signalLv), wsecu, wcate, true); }); connect(ccf, SIGNAL(selectedOneWifiForm(QString,int)), this, SLOT(oneTopWifiFormSelected(QString,int))); connect(ccf, SIGNAL(requestHandleWifiDisconn()), this, SLOT(handleWifiDisconn())); QString path; if (indexCate >= 0) { path = line.mid(indexPath, indexCate - indexPath).trimmed(); } else { path = line.mid(indexPath, indexName - indexPath).trimmed(); } QString m_name; if (path != "" && !path.isEmpty()) m_name= this->objKyDBus->getWifiSsid(path); if (m_name.isEmpty() || m_name == "") { ccf->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C); if (!canReconnectWifiList.contains(wname)) { canReconnectWifiList.append(wname); } else { canReconnectWifiList.removeOne(wname); canReconnectWifiList.append(wname); } } else { ccf->setWifiName(m_name, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C); if (!canReconnectWifiList.contains(m_name)) { canReconnectWifiList.append(m_name); } else { canReconnectWifiList.removeOne(m_name); canReconnectWifiList.append(m_name); } } //ccf->setRate(wrate); int signal; if (wsignal.toInt() == 0) signal = ccf->getSignal(); else signal = wsignal.toInt(); ccf->setSignal(QString::number(signal), wsecu, wcate, true); setTrayIconOfWifi(wsignal.toInt()); activeWifiSignalLv = wsignal.toInt(); //objKyDBus->getWifiMac(wname); if (freqState == 0) { //该WiFi含2.4G和5G的AP,需要判断当前连接的是那种类型 if (wfreq.toInt() >= 5000) ccf->setWifiInfo(wsecu, wsignal, wbssid, 2); else ccf->setWifiInfo(wsecu, wsignal, wbssid, 1); } else { ccf->setWifiInfo(wsecu, wsignal, wbssid, freqState); } ccf->setConnedString(1, tr("NetOn"), wsecu);//"已连接" ccf->isConnected = true; ifWLanConnected = true; lbLoadDown->show(); lbLoadUp->show(); lbLoadDownImg->show(); lbLoadUpImg->show(); ccf->setTopItem(false); currSelNetName = ""; qDebug()<<"already insert an active wifi item in the top of wifi list"; //syslog(LOG_DEBUG, "already insert an active wifi item in the top of wifi list"); if (m_name.isEmpty() || m_name == "") { dbus_wifiList.insert(0, QStringList()<resize(W_LIST_WIDGET, wifiListWidget->height() + H_NORMAL_ITEM); OneConnForm *ocf = new OneConnForm(wifiListWidget, this, confForm, ksnm); connect(ocf, SIGNAL(selectedOneWifiForm(QString,int)), this, SLOT(oneWifiFormSelected(QString,int))); QString path; if (indexCate >= 0) { path = line.mid(indexPath, indexCate - indexPath).trimmed(); } else { path = line.mid(indexPath, indexName - indexPath).trimmed(); } QString m_name; if (path != "" && !path.isEmpty()) m_name= this->objKyDBus->getWifiSsid(path); if (m_name.isEmpty() || m_name == "") { ocf->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C); } else { ocf->setWifiName(m_name, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C); } if (m_wifi_list_pwd_changed.contains(ocf->getName())) { ocf->setlbPwdTipVisble(true); } else { ocf->setlbPwdTipVisble(false); } //ocf->setRate(wrate); ocf->setLine(true); ocf->setSignal(wsignal, wsecu, wcate, true); //objKyDBus->getWifiMac(wname); ocf->setWifiInfo(wsecu, wsignal, wbssid, freqState); ocf->setConnedString(0, tr("Disconnected"), wsecu); ocf->move(L_VERTICAL_LINE_TO_ITEM, j * H_NORMAL_ITEM); ocf->setSelected(false, false); ocf->show(); if ((actWifiBssidList.contains(wbssid) && wifiActState == WIFI_CONNECTING) || (actWifiId == wname && wifiActState == WIFI_CONNECTING)) { ocf->startWifiWaiting(true); } j ++; count ++; if (m_name.isEmpty() || m_name == "") { dbus_wifiList.append(QStringList()< itemList = wifiListWidget->findChildren(); int n = itemList.size(); if (n >= 1) { OneConnForm *lastItem = itemList.at(n-1); lastItem->setLine(false); //最后一个item不需要下划线 lbNoItemTip->hide(); lbTopWifiList->show(); btnAddNet->show(); } else { if (ifWLanConnected) { lbNoItemTip->show(); lbNoItemTip->setText(tr("No Other Wireless Network Scheme")); } else { lbNoItemTip->hide(); lbTopWifiList->hide(); btnAddNet->hide(); } } this->lanListWidget->hide(); this->topLanListWidget->hide(); this->wifiListWidget->show(); this->topWifiListWidget->show(); if (!this->isReconnectingWifi) this->stopLoading(); is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<getWifiListFinished(); bShowPb = true; //可以showpb } // 更新wifi列表 void MainWindow::updateWifiListDone(QStringList slist) { if (this->is_btnLanList_clicked == 1) { onlyRefreshWifiList(slist); return; } qDebug()<<"Refreshed wifi list."; if (this->ksnm->isExecutingGetLanList){ return;} //获取表头信息 QString lastHeadLine = oldWifiSlist.at(0); int lastIndexName; lastHeadLine = lastHeadLine.trimmed(); // bool isChineseInIt = lastHeadLine.contains(QRegExp("[\\x4e00-\\x9fa5]+")); lastIndexName = lastHeadLine.lastIndexOf("SSID"); QString headLine = slist.at(0); int indexSecu, indexFreq, indexBSsid, indexName, indexPath, indexCate; headLine = headLine.trimmed(); bool isChineseExist = headLine.contains(QRegExp("[\\x4e00-\\x9fa5]+")); if (isChineseExist) { indexSecu = headLine.indexOf("安全性"); indexFreq = headLine.indexOf("频率") + 4; indexBSsid = headLine.indexOf("BSSID") + 6; indexPath = headLine.indexOf("DBUS-PATH"); indexCate = headLine.indexOf("CATEGORY"); indexName = headLine.lastIndexOf("SSID"); } else { indexSecu = headLine.indexOf("SECURITY"); indexFreq = headLine.indexOf("FREQ"); indexBSsid = headLine.indexOf("BSSID"); indexPath = headLine.indexOf("DBUS-PATH"); indexCate = headLine.indexOf("CATEGORY"); indexName = headLine.lastIndexOf("SSID"); } //列表中去除已经减少的wifi for (int i=1; i wifiList = wifiListWidget->findChildren(); for (int pos = 0; pos < wifiList.size(); pos ++) { OneConnForm *ocf = wifiList.at(pos); if (ocf->getName() == lastWname) { if (ocf->isActive == true){break; } else { bool is_inputting = ocf->isInputtingPwd(); delete ocf; //删除元素下面的的所有元素上移 for (int after_pos = pos+1; after_pos < wifiList.size(); after_pos ++) { OneConnForm *after_ocf = wifiList.at(after_pos); if (lastWname == currSelNetName) {after_ocf->move(L_VERTICAL_LINE_TO_ITEM, after_ocf->y() - H_NORMAL_ITEM - H_WIFI_ITEM_BIG_EXTEND);} else if (is_inputting) { after_ocf->move(L_VERTICAL_LINE_TO_ITEM, after_ocf->y() - H_NORMAL_ITEM - H_WIFI_ITEM_SMALL_EXTEND); this->m_is_inputting_wifi_password = false; //正在输入密码的wifi消失了 } else {after_ocf->move(L_VERTICAL_LINE_TO_ITEM, after_ocf->y() - H_NORMAL_ITEM);} } wifiListWidget->resize(W_LIST_WIDGET, wifiListWidget->height() - H_NORMAL_ITEM); //从向外提供的wifi列表中找到并删除这一行 QStringList list_to_remove; foreach (QStringList list, dbus_wifiList) { if (list.at(0).trimmed() == lastWname) { list_to_remove = list; break; } } if (!list_to_remove.isEmpty()) { dbus_wifiList.removeOne(list_to_remove); } // qDebug()<<"移除了一个WiFi,将会向控制面板发送信号。ssid="<getWifiListFinished(); break; } } } } //end if (j == slist.size()-1) } //end (int j=1; j= 0) { wpath = line.mid(indexPath, indexCate - indexPath).trimmed(); } else { wpath = line.mid(indexPath, indexName - indexPath).trimmed(); } QString wcate = line.mid(indexCate, 1).trimmed(); if(wname == "" || wname == "--"){continue;} bool isContinue = false; foreach (QString addName, wnames) { // 重复的网络名称,跳过不处理 if(addName == wname){isContinue = true;} } if(isContinue){continue;} int max_freq = wfreq.toInt(); int min_freq = wfreq.toInt(); for (int k = 0; k < slist.size(); k ++) { QString m_name = slist.at(k).mid(indexName).trimmed(); // QString m_name = this->objKyDBus->getWifiSsid(QString("/org/freedesktop/NetworkManager/AccessPoint/%1").arg(slist.at(k).mid(slist.at(k).lastIndexOf("/") + 1).trimmed())); if (wname == m_name) { if (slist.at(k).mid(indexFreq, 4).trimmed().toInt() > max_freq) { max_freq = slist.at(k).mid(indexFreq, 4).trimmed().toInt(); } else if (slist.at(k).mid(indexFreq, 4).trimmed().toInt() < min_freq) { min_freq = slist.at(k).mid(indexFreq, 4).trimmed().toInt(); } } } //qDebug()<<"Wifi ssid="<objKyDBus->getWifiSsid(wpath); if (m_name.isEmpty() || m_name == "") { addItem->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C); } else { addItem->setWifiName(m_name, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C); } if (m_wifi_list_pwd_changed.contains(addItem->getName())) { addItem->setlbPwdTipVisble(true); } else { addItem->setlbPwdTipVisble(false); } //addItem->setRate(wrate); addItem->setLine(false); addItem->setSignal(wsignal, wsecu, wcate, true); //objKyDBus->getWifiMac(wname); addItem->setWifiInfo(wsecu, wsignal, wbssid, freqState); addItem->setConnedString(0, tr("Disconnected"), wsecu);//"未连接" addItem->move(L_VERTICAL_LINE_TO_ITEM, posY); addItem->setSelected(false, false); addItem->show(); if (m_name.isEmpty() || m_name == "") { dbus_wifiList.append(QStringList()< 1) { actWifiUuid = currConnWifiBSsidUuid.at(0); for (int i=1; i= 0) { wDbusPath = line.mid(Path,indexCate-Path).trimmed(); } else { wDbusPath = line.mid(Path,indexName-Path).trimmed(); } QDBusInterface interface("org.freedesktop.NetworkManager", wDbusPath, "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interface.call("Get","org.freedesktop.NetworkManager.AccessPoint","Ssid"); QString wname = reply.value().toString(); if (actWifiBssidList.contains(wbssid)) { actWifiName = wname; } if ("*" == line.mid(0,indexSignal).trimmed()) { //在华为的电脑中,因为前面的优选工作,即使有已经连接的wifi,也可能会被筛选出去 actWifiBssid = wbssid; } } if (actWifiName == "--" || wifiActState == WIFI_CONNECTING || actWifiBssidList.at(0) == "--" || actWifiBssid == " ") { dbus_wifiList.append(QStringList("--")); //没有已连接wifi时,第一个元素为-- } else { QProcess * process = new QProcess; QString name = actWifiName; process->start(QString("nmcli -f 802-11-wireless.ssid connection show \"%1\"").arg(name)); connect(process, static_cast(&QProcess::finished), this, [ = ]() { process->deleteLater(); }); connect(process, &QProcess::readyReadStandardOutput, this, [ = ]() { QString str = process->readAllStandardOutput(); actWifiSsid = str.mid(str.lastIndexOf(" ") + 1, str.length() - str.lastIndexOf(" ") - 2); //获取到ssid时,以ssid为准 }); connect(process, &QProcess::readyReadStandardError, this, [ = ]() { actWifiSsid = actWifiName; //没有获取到ssid时,以wifi名为准 }); process->waitForFinished(); process->deleteLater(); } if (actWifiBssidList.size()==1 && actWifiBssidList.at(0)=="--") { actWifiId = actWifiName; actWifiName = "--"; } for (int i = 1, j = 0; i < slist.size(); i ++) { QString line = slist.at(i); QString wsignal = line.mid(indexSignal, 3).trimmed(); QString wsecu = line.mid(indexSecu, indexFreq - indexSecu).trimmed(); QString wbssid = line.mid(indexBSsid, 17).trimmed(); QString wfreq = line.mid(indexFreq, 4).trimmed(); QString wcate; if (indexCate >= 0) wcate = line.mid(indexCate, 1).trimmed(); else wcate = QString::number(0); QString wDbusPath; if (indexCate >= 0) { wDbusPath = line.mid(indexPath,indexCate-indexPath).trimmed(); } else { wDbusPath = line.mid(indexPath,indexName-indexPath).trimmed(); } QDBusInterface interface("org.freedesktop.NetworkManager", wDbusPath, "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interface.call("Get","org.freedesktop.NetworkManager.AccessPoint","Ssid"); QString wname = reply.value().toString(); if (!isHuaWeiPC) { //如果不是华为的电脑,选择wifi在这里执行 if (actWifiName != "--" && actWifiName == wname) { if (!actWifiBssidList.contains(wbssid)) { continue; //若当前热点ssid名称和已经连接的wifi的ssid名称相同,但bssid不同,则跳过 } } if ((wnames.contains(wname) && wbssid != actWifiBssid)) { continue; //过滤相同名称的wifi } } else { if ((wnames.contains(wname) && wbssid != actWifiBssid)) { continue; //过滤相同名称的wifi } } int max_freq = wfreq.toInt(); int min_freq = wfreq.toInt(); for (int k = i; k < slist.size(); k ++) { QString m_DbusPath; if (indexCate >= 0) { m_DbusPath = slist.at(k).mid(indexPath,indexCate-indexPath).trimmed(); } else { m_DbusPath = slist.at(k).mid(indexPath,indexName-indexPath).trimmed(); } QDBusInterface m_interface("org.freedesktop.NetworkManager", m_DbusPath, "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply m_reply = m_interface.call("Get","org.freedesktop.NetworkManager.AccessPoint","Ssid"); QString m_name = m_reply.value().toString(); if (wname == m_name) { if (slist.at(k).mid(indexFreq, 4).trimmed().toInt() > max_freq) { max_freq = slist.at(k).mid(indexFreq, 4).trimmed().toInt(); } else if (slist.at(k).mid(indexFreq, 4).trimmed().toInt() < min_freq) { min_freq = slist.at(k).mid(indexFreq, 4).trimmed().toInt(); } } } if (wname != "" && wname != "--") { QString path; if (indexCate >= 0) { path = line.mid(indexPath, indexCate - indexPath).trimmed(); } else { path = line.mid(indexPath, indexName - indexPath).trimmed(); } QString m_name; if (path != "" && !path.isEmpty()) m_name= this->objKyDBus->getWifiSsid(path); if (actWifiBssid == wbssid && wifiActState == WIFI_CONNECTED) { //对于已经连接的wifi if (m_name.isEmpty() || m_name == "") { dbus_wifiList.insert(0, QStringList()<isReconnectingWifi) this->stopLoading(); is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<getWifiListFinished(); } //用于中英文系统有线网络名称国际话 QString MainWindow::TranslateLanName(QString lanName) { QString returnLanName = lanName; if (lanName == "有线连接") { returnLanName = tr("Wired connection"); } else if (lanName.indexOf("有线连接") != -1) { QStringList strList = lanName.split(" "); if (strList.size() >= 2 && strList.at(1) != "") { returnLanName = tr("Wired connection") + " " + strList.at(1); } } if (lanName == "Wired connection") { returnLanName = tr("Wired connection"); } else if (lanName.indexOf("Wired connection") != -1) { QStringList strList = lanName.split(" "); if (strList.size() >= 3 && strList.at(2) != "") { returnLanName = tr("Wired connection") + " " + strList.at(2); } } if (lanName == "以太网连接") { returnLanName = tr("Ethernet connection"); } else if (lanName.indexOf("以太网连接") != -1) { QStringList strList = lanName.split(" "); if (strList.size() >= 2 && strList.at(1) != "") { returnLanName = tr("Ethernet connection") + " " + strList.at(1); } } if (lanName == "Ethernet connection") { returnLanName = tr("Ethernet connection"); } else if (lanName.indexOf("Ethernet connection") != -1) { QStringList strList = lanName.split(" "); if (strList.size() >= 3 && strList.at(2) != "") { returnLanName = tr("Ethernet connection") + " " + strList.at(2); } } return returnLanName; } //使用uuid获取对应的mac地址 QString MainWindow::getMacByUuid(QString uuidName) { QString resultMac = ""; QString tmpPath = "/tmp/kylin-nm-lanprop-" + QDir::home().dirName(); QString cmd = "nmcli connection show '" + uuidName + "' > " + tmpPath; Utils::m_system(cmd.toUtf8().data()); QFile file(tmpPath); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //syslog(LOG_ERR, "Can't open the file /tmp/kylin-nm-lanprop!"); qDebug()<<"Can't open the file /tmp/kylin-nm-lanprop!"<execGetIface(); if (iface->wstate != 0) { QString toDisConnWifi = "nmcli connection down '" + actWifiUuid + "'"; system(toDisConnWifi.toUtf8().data()); } } /////////////////////////////////////////////////////////////////////////////// //主窗口其他按钮点击响应 void MainWindow::on_btnAdvConf_clicked() { // if (!kysec_is_disabled() && kysec_get_3adm_status()) { // //三权分立启用的操作 // qDebug() << "三权分立启用的操作------>"; // QMessageBox msgBox; // msgBox.setWindowTitle(QObject::tr("kylin-nm")); // msgBox.setIcon(QMessageBox::Warning); // msgBox.setText(QObject::tr("Insufficient permissions")); // msgBox.addButton(QMessageBox::Ok); // msgBox.button(QMessageBox::Ok)->setText(QObject::tr("OK")); // msgBox.exec(); // } else { // //三权分立未启用的操作 // qDebug() << "三权分立未启用的操作"; // QProcess *qprocess = new QProcess(this); // qprocess->start("nm-connection-editor &"); // } QProcess p(0); p.startDetached("nm-connection-editor &"); p.waitForStarted(); return; } void MainWindow::on_btnFlyMode_clicked() { if (is_fly_mode_on == 0) { is_fly_mode_on = 1; onBtnWifiClicked(0); on_btnWifiList_clicked(); } else { is_fly_mode_on = 0; } } void MainWindow::on_btnHotspot_clicked() { if (is_wireless_adapter_ready == 1) { if (is_hot_sopt_on == 0) { ui->lbHotImg->setStyleSheet("QLabel{background-image:url(:/res/x/hot-spot-on.svg);}"); ui->lbHotBG->setStyleSheet(btnOnQss); is_hot_sopt_on = 1; QApplication::setQuitOnLastWindowClosed(false); DlgHotspotCreate *hotCreate = new DlgHotspotCreate(objKyDBus->dbusWiFiCardName); connect(hotCreate,SIGNAL(updateHotspotList()),this,SLOT(on_btnWifiList_clicked() )); connect(hotCreate,SIGNAL(btnHotspotState()),this,SLOT(on_btnHotspotState() )); hotCreate->show(); } else { on_btnHotspotState(); BackThread objBT; objBT.disConnLanOrWifi("wifi"); sleep(2); on_btnWifiList_clicked(); } } } void MainWindow::onBtnAddNetClicked() { QApplication::setQuitOnLastWindowClosed(false); DlgHideWifi *connHidWifi = new DlgHideWifi(0, this); connect(connHidWifi, SIGNAL(reSetWifiList() ), this, SLOT(on_btnWifiList_clicked()) ); connHidWifi->show(); } void MainWindow::onBtnCreateNetClicked() { QPoint pos = QCursor::pos(); QRect primaryGeometry; for (QScreen *screen : qApp->screens()) { if (screen->geometry().contains(pos)) { primaryGeometry = screen->geometry(); } } if (primaryGeometry.isEmpty()) { primaryGeometry = qApp->primaryScreen()->geometry(); } QApplication::setQuitOnLastWindowClosed(false); ConfForm *m_cf = new ConfForm(); m_cf->cbTypeChanged(3); m_cf->move(primaryGeometry.width() / 2 - m_cf->width() / 2, primaryGeometry.height() / 2 - m_cf->height() / 2); m_cf->show(); } /* 右键菜单打开网络设置界面 */ void MainWindow::actionTriggerSlots() { if (!m_load_finished) { m_secondary_start_timer->stop(); secondaryStart(); } this->move(-500, -500); this->showNormal(); this->raise(); this->activateWindow(); QProcess p(0); p.startDetached("nm-connection-editor &"); p.waitForStarted(); return; } /////////////////////////////////////////////////////////////////////////////// //处理窗口变化、网络状态变化 //列表中item的扩展与收缩 void MainWindow::oneLanFormSelected(QString lanName, QString uniqueName) { if (currSelNetName == uniqueName) { return; } QList topLanList = topLanListWidget->findChildren(); QList lanList = lanListWidget->findChildren(); //**********************先处理下方列表********************// // 下方所有元素回到原位 for (int i = 0, j = 0;i < lanList.size(); i ++) { OneLancForm *ocf = lanList.at(i); if (ocf->isActive == true) { ocf->move(L_VERTICAL_LINE_TO_ITEM, 0); } if (ocf->isActive == false) { ocf->move(L_VERTICAL_LINE_TO_ITEM, j * H_NORMAL_ITEM); j ++; } } //是否与上一次选中同一个网络框 if (currSelNetName == uniqueName) { // 缩小所有选项卡 // for (int i = 0;i < lanList.size(); i ++) { // OneLancForm *ocf = lanList.at(i); // if (ocf->uuidName == uniqueName) { // ocf->setSelected(false, true); // } else { // ocf->setSelected(false, false); // } // } // currSelNetName = ""; } else { int selectY = 0; for (int i = 0;i < lanList.size(); i ++) { OneLancForm *ocf = lanList.at(i); if (ocf->uuidName == uniqueName) { selectY = ocf->y(); //获取选中item的y坐标 break; } } // 选中元素下面的所有元素下移 H_LAN_ITEM_EXTEND for (int i = 0;i < lanList.size(); i ++) { OneLancForm *ocf = lanList.at(i); if (ocf->y() > selectY) { ocf->move(L_VERTICAL_LINE_TO_ITEM, ocf->y() + H_LAN_ITEM_EXTEND); } } for (int i = 0;i < lanList.size(); i ++) { OneLancForm *ocf = lanList.at(i); if (ocf->uuidName == uniqueName) { ocf->setSelected(true, false); selectY = ocf->y(); } else { ocf->setSelected(false, false); } } currSelNetName = uniqueName; } QList itemList = lanListWidget->findChildren(); int n = itemList.size(); if (n >= 1) { OneLancForm *lastItem = itemList.at(n-1); lastItem->setLine(false); } //**********************处理上方列表-界面所有控件回原位********************// int topLanNum = (currTopLanItem >= 1) ? currTopLanItem : 1; topLanListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM*topLanNum + H_GAP_UP + X_ITEM); // 顶部的item缩小 lbTopLanList->move(X_MIDDLE_WORD, H_NORMAL_ITEM*topLanNum + H_GAP_UP); btnCreateNet->move(X_BTN_FUN, Y_BTN_FUN + H_NORMAL_ITEM*(topLanNum-1)); scrollAreal->move(W_LEFT_AREA, Y_SCROLL_AREA + H_NORMAL_ITEM*(topLanNum-1)); lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2 + H_NORMAL_ITEM*(topLanNum-1)/2); for (int i = topLanList.size() - 1;i >= 0; i --) { OneLancForm *ocf = topLanList.at(i); ocf->setTopItem(false); ocf->move(L_VERTICAL_LINE_TO_ITEM, (topLanList.size() - 1 - i) * H_NORMAL_ITEM); } } void MainWindow::oneTopLanFormSelected(QString lanName, QString uniqueName) { //应设计要求,选中同一选项卡不再缩小 if (currSelNetName == uniqueName) return; QList topLanList = topLanListWidget->findChildren(); QList lanList = lanListWidget->findChildren(); // 顶部所有元素回到原位 for (int i = topLanList.size() - 1;i >= 0; i --) { OneLancForm *ocf = topLanList.at(i); ocf->move(L_VERTICAL_LINE_TO_ITEM, (topLanList.size() - 1 - i) * H_NORMAL_ITEM); } if (currSelNetName == uniqueName) { // 与上一次选中同一个网络框,缩小当前选项卡 // topLanListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM*currTopLanItem + H_GAP_UP + X_ITEM); // lbTopLanList->move(X_MIDDLE_WORD, H_NORMAL_ITEM*currTopLanItem + H_GAP_UP); // btnCreateNet->move(X_BTN_FUN, Y_BTN_FUN + H_NORMAL_ITEM*(currTopLanItem-1)); // scrollAreal->move(W_LEFT_AREA, Y_SCROLL_AREA + H_NORMAL_ITEM*(currTopLanItem-1)); // lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2 + H_NORMAL_ITEM*(currTopLanItem-1)/2); // foreach (OneLancForm *ocf, topLanList) { // ocf->setTopItem(false); // } // currSelNetName = ""; } else { // 没有与上一次选中同一个网络框,放大当前选项卡 //下方列表所有元素缩小并回到原位 for (int i = 0; i < lanList.size(); i ++) { OneLancForm *ocf = lanList.at(i); ocf->setSelected(false, false); ocf->move(L_VERTICAL_LINE_TO_ITEM, i*H_NORMAL_ITEM); } int topLanNum = (currTopLanItem >= 1) ? currTopLanItem : 1; topLanListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM*topLanNum + H_LAN_ITEM_EXTEND + H_GAP_UP + X_ITEM); lbTopLanList->move(X_MIDDLE_WORD, H_NORMAL_ITEM*topLanNum + H_LAN_ITEM_EXTEND + H_GAP_UP); btnCreateNet->move(X_BTN_FUN, Y_BTN_FUN + H_LAN_ITEM_EXTEND + H_NORMAL_ITEM*(topLanNum-1)); scrollAreal->move(W_LEFT_AREA, Y_SCROLL_AREA + H_LAN_ITEM_EXTEND + H_NORMAL_ITEM*(topLanNum-1)); lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2 + 80 + + H_NORMAL_ITEM*(topLanNum-1)/2); int selectY = 0; for (int i = 0;i < topLanList.size(); i ++) { OneLancForm *ocf = topLanList.at(i); if (ocf->uuidName == uniqueName) { selectY = ocf->y(); //获取选中item的y坐标 break; } } // 选中元素下面的所有元素下移 H_LAN_ITEM_EXTEND for (int i = 0;i < topLanList.size(); i ++) { OneLancForm *ocf = topLanList.at(i); if (ocf->y() > selectY) { ocf->move(L_VERTICAL_LINE_TO_ITEM, ocf->y() + H_LAN_ITEM_EXTEND); } } //选中的元素进行扩展 for (int i = 0;i < topLanList.size(); i ++) { OneLancForm *ocf = topLanList.at(i); if (ocf->uuidName == uniqueName) { ocf->setTopItem(true); selectY = ocf->y(); } else { ocf->setTopItem(false); } } currSelNetName = uniqueName; } } void MainWindow::oneWifiFormSelected(QString wifibssid, int extendLength) { if (currSelNetName == wifibssid) { //与win逻辑一致,点击同一选项不再缩小选项卡 return; } if (extendLength == H_WIFI_ITEM_SMALL_EXTEND) { this->m_is_inputting_wifi_password = true; } else { this->m_is_inputting_wifi_password = false; } QListtopWifiList = topWifiListWidget->findChildren(); QList wifiList = wifiListWidget->findChildren(); //******************先处理下方列表****************// // 下方所有元素回到原位 for (int i = 0, j = 0;i < wifiList.size(); i ++) { OneConnForm *ocf = wifiList.at(i); if (ocf->isActive == true) { ocf->move(L_VERTICAL_LINE_TO_ITEM, 0); } if (ocf->isActive == false) { ocf->move(L_VERTICAL_LINE_TO_ITEM, j * H_NORMAL_ITEM); j ++; } } //是否与上一次选中同一个网络框 if (currSelNetName == wifibssid) { // // 缩小所有选项卡 // for (int i = 0;i < wifiList.size(); i ++) { // OneConnForm *ocf = wifiList.at(i); // if (ocf->wifiBSsid == wifibssid) { // if (ocf->wifiBSsid == hideWiFiConn) { // ocf->setHideItem(true, true); // } else { // ocf->setSelected(false, true); // } // } else { // if (ocf->wifiBSsid == hideWiFiConn) { // ocf->setHideItem(true, true); // } else { // ocf->setSelected(false, false); // } // } // } // currSelNetName = ""; } else { int selectY = 0; for (int i = 0;i < wifiList.size(); i ++) { OneConnForm *ocf = wifiList.at(i); if (ocf->wifiBSsid == wifibssid) { selectY = ocf->y(); //获取选中item的y坐标 // scrollAreaw->verticalScrollBar()->setValue(selectY); scrollAreaw->ensureVisible(ocf->x(), ocf->y() + extendLength); break; } } // 选中元素下面的所有元素下移 H_WIFI_ITEM_BIG_EXTEND for (int i = 0;i < wifiList.size(); i ++) { OneConnForm *ocf = wifiList.at(i); if (ocf->y() > selectY) { ocf->move(L_VERTICAL_LINE_TO_ITEM, ocf->y() + extendLength); } } for (int i = 0;i < wifiList.size(); i ++) { OneConnForm *ocf = wifiList.at(i); if (ocf->wifiBSsid == wifibssid) { if (ocf->wifiBSsid == hideWiFiConn) { ocf->setHideItem(true, true); } else { ocf->setSelected(true, false); } } else { if (ocf->wifiBSsid == hideWiFiConn) { ocf->setHideItem(true, true); } else { ocf->setSelected(false, false); } } } currSelNetName = wifibssid; } //最后一个item没有下划线 QList itemList = wifiListWidget->findChildren(); int n = itemList.size(); if (n >= 1) { OneConnForm *lastItem = itemList.at(n-1); lastItem->setLine(false); } //********************处理上方列表-界面所有控件回原位******************// // 顶部的item缩小 topWifiListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM + H_GAP_UP + X_ITEM); lbTopWifiList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_GAP_UP); btnAddNet->move(X_BTN_FUN, Y_BTN_FUN); scrollAreaw->move(W_LEFT_AREA, Y_SCROLL_AREA); lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2); OneConnForm *ocf = topWifiList.at(0); ocf->setTopItem(false); } void MainWindow::oneTopWifiFormSelected(QString wifibssid, int extendLength) { //应设计师要求,此处展开后点击不再收起 if (currSelNetName == wifibssid) return; QListtopWifiList = topWifiListWidget->findChildren(); QList wifiList = wifiListWidget->findChildren(); if (currSelNetName == wifibssid) { // 与上一次选中同一个网络框,缩小当前选项卡 // topWifiListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM + H_GAP_UP + X_ITEM); // lbTopWifiList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_GAP_UP); // btnAddNet->move(X_BTN_FUN, Y_BTN_FUN); // scrollAreaw->move(W_LEFT_AREA, Y_SCROLL_AREA); // lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2); // OneConnForm *ocf = topWifiList.at(0); // ocf->setTopItem(false); // currSelNetName = ""; } else { // 没有与上一次选中同一个网络框,放大当前选项卡 for(int i = 0;i < wifiList.size(); i ++) { // 所有元素回到原位 OneConnForm *ocf = wifiList.at(i); ocf->setSelected(false, false); ocf->move(L_VERTICAL_LINE_TO_ITEM, i * H_NORMAL_ITEM); } topWifiListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM + H_WIFI_ITEM_BIG_EXTEND + H_GAP_UP + X_ITEM); lbTopWifiList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_WIFI_ITEM_BIG_EXTEND + H_GAP_UP); btnAddNet->move(X_BTN_FUN, Y_BTN_FUN + H_WIFI_ITEM_BIG_EXTEND); scrollAreaw->move(W_LEFT_AREA, Y_SCROLL_AREA + H_WIFI_ITEM_BIG_EXTEND); lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2 + 65); OneConnForm *ocf = topWifiList.at(0); ocf->setTopItem(true); currSelNetName = wifibssid; } } //断开网络处理 void MainWindow::handleLanDisconn() { //syslog(LOG_DEBUG, "Wired net is disconnected"); qDebug()<<"Wired net is disconnected!"; QString txt(tr("Wired net is disconnected")); emit this->actWiredConnectionChanged(); objKyDBus->showDesktopNotify(txt); currSelNetName = ""; oldActLanName = ""; oldDbusActLanDNS = 0; emit this->waitLanStop(); this->ksnm->execGetLanList(); } void MainWindow::handleWifiDisconn() { hasWifiConnected = false; currSelNetName = ""; this->ksnm->execGetWifiList(this->wcardname); QtConcurrent::run([=]() { handleWifiDisconnLoading(); }); } void MainWindow::handleWifiDisconnLoading() { //syslog(LOG_DEBUG, "WLAN is disconnected"); qDebug()<<"WLAN is disconnected!"; QString txt(tr("WLAN is disconnected")); objKyDBus->showDesktopNotify(txt); //setTrayLoading(false); //getActiveInfoAndSetTrayIcon(); } //网络开关处理,打开与关闭网络 void MainWindow::enNetDone() { // BackThread *bt = new BackThread(); // mwBandWidth = bt->execChkLanWidth(lcardname); // 打开网络开关时如果Wifi开关是打开的,设置其样式 if (checkWlOn()) { objKyDBus->oldWifiSwitchState = true; btnWireless->setSwitchStatus(true); } onBtnNetListClicked(1); is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_btnLanList_clicked = 1; this->is_btnWifiList_clicked = 0; ui->lbNetListBG->setStyleSheet(btnOnQss); ui->lbWifiListBG->setStyleSheet(btnOffQss); ui->lbNetwork->setText(tr("Ethernet")); btnWireless->hide(); btnWired->show(); delete topLanListWidget; // 清空top列表 createTopLanUI(); //创建顶部有线网item // 清空lan列表 lanListWidget = new QWidget(scrollAreal); lanListWidget->resize(W_LIST_WIDGET, H_NORMAL_ITEM + H_LAN_ITEM_EXTEND); scrollAreal->setWidget(lanListWidget); scrollAreal->move(W_LEFT_AREA, Y_SCROLL_AREA); // 当前连接的lan OneLancForm *ccf = new OneLancForm(topLanListWidget, this, confForm, ksnm); ccf->setLanName(tr("Not connected"), tr("Not connected"), "--", "--");//"当前未连接任何 以太网" ccf->setIcon(false); ccf->setConnedString(1, tr("Disconnected"), "");//"未连接" ccf->isConnected = false; ccf->setTopItem(false); ccf->setAct(true); ccf->move(L_VERTICAL_LINE_TO_ITEM, 0); ccf->show(); objKyDBus->oldWifiSwitchState = false; btnWireless->setSwitchStatus(false); this->lanListWidget->show(); this->wifiListWidget->hide(); this->scrollAreal->show(); this->topLanListWidget->show(); this->scrollAreaw->hide(); this->topWifiListWidget->hide(); qDebug()<<"debug: already turn off the switch of lan network"; //syslog(LOG_DEBUG, "Already turn off the switch of lan network"); this->stopLoading(); } void MainWindow::enWifiDone() { if (isHuaWeiPC) { //这里先不做什么,因为onRfkillStatusChanged这个函数也在处理wifi开关 qDebug()<<"enWifiDone is hua wei pc, no thing to do!"; } else { //on_btnWifiList_clicked(); current_wifi_list_state = LOAD_WIFI_LIST; if (is_btnWifiList_clicked) { this->ksnm->execGetWifiList(this->wcardname); } else { stopLoading(); } objKyDBus->getWirelessCardName(); qDebug()<<"debug: already turn on the switch of wifi network"; syslog(LOG_DEBUG, "Already turn on the switch of wifi network"); } } void MainWindow::disWifiDone() { if (isHuaWeiPC) { //这里先不做什么,因为onRfkillStatusChanged这个函数也在处理wifi开关 qDebug()<<"disWifiDone is hua wei pc, no thing to do!"; } else { disWifiDoneChangeUI(); this->stopLoading(); is_stop_check_net_state = 0; qDebug()<<"debug: already turn off the switch of wifi network"; syslog(LOG_DEBUG, "Already turn off the switch of wifi network"); } } void MainWindow::disWifiStateKeep() { if (this->is_btnLanList_clicked == 1) { objKyDBus->oldWifiSwitchState = false; btnWireless->setSwitchStatus(false); } if (this->is_btnWifiList_clicked== 1) { disWifiDoneChangeUI(); getActiveInfoAndSetTrayIcon(); } } void MainWindow::disWifiDoneChangeUI() { wifiListWidget = new QWidget(scrollAreaw); wifiListWidget->resize(W_LIST_WIDGET, H_WIFI_ITEM_BIG_EXTEND); scrollAreaw->setWidget(wifiListWidget); scrollAreaw->move(W_LEFT_AREA, Y_SCROLL_AREA); lbTopWifiList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_GAP_UP); btnAddNet->move(X_BTN_FUN, Y_BTN_FUN); topWifiListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM + H_GAP_UP + X_ITEM); QList wifiList = topWifiListWidget->findChildren(); for (int i = 0; i < wifiList.size(); i ++) { OneConnForm *ocf = wifiList.at(i); if (ocf->isActive == true) { ocf->setSelected(false, false); ocf->setWifiName(tr("Not connected"), "--", "--", "--", isHuaWeiPC, isHuaWei9006C);//"当前未连接任何 Wifi" ocf->setSignal("0", "--", "0", false); ocf->setConnedString(1, tr("Disconnected"), "");//"未连接" ocf->lbFreq->hide(); lbLoadDown->hide(); lbLoadUp->hide(); lbLoadDownImg->hide(); lbLoadUpImg->hide(); ocf->isConnected = false; ocf->setTopItem(false); disconnect(ocf, SIGNAL(selectedOneWifiForm(QString,int)), this, SLOT(oneTopWifiFormSelected(QString,int))); } else { ocf->deleteLater(); } } objKyDBus->oldWifiSwitchState = false; btnWireless->setSwitchStatus(false); this->lanListWidget->hide(); this->topLanListWidget->hide(); this->wifiListWidget->show(); this->topWifiListWidget->show(); this->scrollAreal->hide(); this->scrollAreaw->show(); } void MainWindow::on_btnHotspotState() { ui->lbHotImg->setStyleSheet("QLabel{background-image:url(:/res/x/hot-spot-off.svg);}"); ui->lbHotBG->setStyleSheet(btnOffQss); is_hot_sopt_on = 0; } //执行wifi的重新连接 void MainWindow::toReconnectWifi() { if (ifCanReconnectWifiNow) { if (isHuaWeiPC) { qDebug() << "Execute reconnect wifi now, first get wifi list then reconnect"; current_wifi_list_state = RECONNECT_WIFI; this->ksnm->execGetWifiList(this->wcardname); } } else { qDebug() << "Execute reconnect wifi now or wlan already connected, stop to exec if another request launched"; } } //处理外界对网络的连接与断开 void MainWindow::onExternalConnectionChange(QString type, bool isConnUp) { isReconnectingWifi = false; if ( (type == "802-11-wireless" || type == "wifi") && !isConnUp ){ QTimer::singleShot(2*1000, this, SLOT(onToResetValue() )); } if (type == "802-11-wireless" || type == "wifi") { addNumberForWifi += 1; } if (addNumberForWifi == 2) { //断开一个wifi的时候,如果存在回连,可能接连发出两个信号 //当连续发出wifi断开与连接的信号时,短时间内addNumberForWifi值为2 is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<actWiredConnectionChanged(); if (is_btnLanList_clicked) { onBtnNetListClicked(0); } else { is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<showDesktopNotify(txt); } if (isWifiBeConnUp) { QString txt(tr("WiFi already connected external")); objKyDBus->showDesktopNotify(txt); } if (m_connected_by_self) { is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<ksnm->execGetWifiList(); on_btnWifiList_clicked(); } } //处理外界对wifi开关的打开与关闭 void MainWindow::onExternalWifiSwitchChange(bool wifiEnabled) { if (!is_stop_check_net_state) { is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<setWifiSwitchState(true); } else { qDebug()<<"debug: external wifi switch turn off"; syslog(LOG_DEBUG, "debug: external wifi switch turn off"); QTimer::singleShot(3*1000, this, SLOT(onWifiSwitchChange() )); objKyDBus->setWifiSwitchState(false);//通知控制面板wifi开关已经关闭 } } } /////////////////////////////////////////////////////////////////////////////// //循环处理部分,目前仅on_checkWifiListChanged 与on_setNetSpeed两个函数在运行 void MainWindow::onRequestScanAccesspoint() { if (isHuaWeiPC) { numberForWifiScan += 1; int numScanPerSecond0 = 0; int numScanPerSecond1 = 0; if (numberForWifiScan > 12) { numScanPerSecond0 = (numberForWifiScan-12)/6; //获取除数 numScanPerSecond1 = (numberForWifiScan-12)%6; //获取余数 } if (is_init_wifi_list || is_connect_hide_wifi) { return; //遇到启动软件第一次加载wifi列表的时候,或正在连接隐藏wifi,停止更新 } if (is_stop_check_net_state==0 && this->is_btnWifiList_clicked==1) { if (this->isVisible()) { this->toScanWifi(1); } else { switch (numberForWifiScan) { case 1 : this->toScanWifi(0); break; case 2: this->toScanWifi(0); break; case 3: this->toScanWifi(0); break; case 6: this->toScanWifi(0); break; case 9: this->toScanWifi(0); break; case 12: this->toScanWifi(0); break; } if ((numScanPerSecond0 != 0) && (numScanPerSecond1 == 0)) { this->toScanWifi(0); } } // end if(this->isVisible()) } if (numberForWifiScan > 500) numberForWifiScan = 0; } else { if (is_init_wifi_list || is_connect_hide_wifi) { return; //遇到启动软件第一次加载wifi列表的时候,或正在连接隐藏wifi,停止更新 } if (is_stop_check_net_state==0 && this->is_btnWifiList_clicked==1 && this->isVisible()) { BackThread *loop_bt = new BackThread(); IFace *loop_iface = loop_bt->execGetIface(); if (loop_iface->wstate != 2) { current_wifi_list_state = UPDATE_WIFI_LIST; this->ksnm->execGetWifiList(this->wcardname); //更新wifi列表 } delete loop_iface; loop_bt->deleteLater(); } } } void MainWindow::toScanWifi(bool isShow) { QtConcurrent::run([=](){ BackThread *loop_bt = new BackThread(); IFace *loop_iface = loop_bt->execGetIface(); if (loop_iface->wstate != 2) { if (loop_iface->wstate == 0) { if (isShow) { objKyDBus->requestScanWifi(); //要求后台扫描AP } } if (loop_iface->wstate == 1) { objKyDBus->requestScanWifi(); //要求后台扫描AP } sleep(2); if (isShow) { //只有在显示窗口时更新wifi列表 emit this->refreshWifiListAfterScan(); } } delete loop_iface; loop_bt->deleteLater(); }); } void MainWindow::onRefreshWifiListAfterScan() { current_wifi_list_state = REFRESH_WIFI; this->ksnm->execGetWifiList(this->wcardname); //更新wifi列表 } void MainWindow::onRequestReconnecWifi() { qDebug() << "Receive request reconnect wifi signal, then to reconnect wifi"; toReconnectWifi(); } void MainWindow::on_setNetSpeed() { if (this->isVisible() && is_stop_check_net_state==0) { if (is_btnWifiList_clicked == 1) { if ( objNetSpeed->getCurrentDownloadRates(objKyDBus->dbusWiFiCardName.toUtf8().data(), &start_rcv_rates, &start_tx_rates) == -1) { start_rcv_rates = end_rcv_rates; } } else if(is_btnLanList_clicked == 1) { if ( objNetSpeed->getCurrentDownloadRates(currConnIfname.toUtf8().data(), &start_rcv_rates, &start_tx_rates) == -1) { start_tx_rates = end_tx_rates; } } long int delta_rcv = (start_rcv_rates - end_rcv_rates)/1024; long int delta_tx = (start_tx_rates - end_tx_rates)/1024; //简易滤波 if (delta_rcv < 0 || delta_tx < 0) { delta_rcv = 0; delta_tx = 0; } else if (end_rcv_rates == 0 || end_tx_rates == 0){ delta_rcv = 0; delta_tx = 0; } end_rcv_rates = start_rcv_rates; end_tx_rates = start_tx_rates; int rcv_num = delta_rcv; int tx_num = delta_tx; QString str_rcv; QString str_tx; if (rcv_num < 1024) { str_rcv = QString::number(rcv_num) + "KB/s."; } else { int remainder; if (rcv_num%1024 < 100) { remainder = 0; } else { remainder = (rcv_num%1024)/100; } str_rcv = QString::number(rcv_num/1024) + "." + QString::number(remainder) + "MB/s."; } if (tx_num < 1024) { str_tx = QString::number(tx_num) + "KB/s"; } else { int remainder; if (tx_num%1024 < 100) { remainder = 0; } else { remainder = (tx_num%1024)/100; } str_tx = QString::number(tx_num/1024) + "." + QString::number(remainder) + "MB/s"; } lbLoadDown->setText(str_rcv); lbLoadUp->setText(str_tx); int offset = str_rcv.length() * 7; lbLoadUp->move(X_ITEM + offset + 145, Y_TOP_ITEM + 32); lbLoadUpImg->move(X_ITEM + offset + 128, Y_TOP_ITEM + 35); } else { end_rcv_rates = 0; end_tx_rates = 0; } } void MainWindow::connLanDone(int connFlag) { emit this->waitLanStop(); //停止加载动画 // Lan连接结果,0点击连接成功 1因网线未插入失败 2因mac地址匹配不上失败 3开机启动网络工具时已经连接 if (connFlag == 0) { //syslog(LOG_DEBUG, "Wired net already connected by clicking button"); qDebug()<<"Wired net already connected by clicking button!"; //this->ksnm->execGetLanList(); QString txt(tr("Conn Ethernet Success")); emit this->actWiredConnectionChanged(); objKyDBus->showDesktopNotify(txt); } if (connFlag == 1) { //syslog(LOG_DEBUG, "without network line connect to computer."); qDebug()<<"without network line connect to computer.!"; QString txt(tr("Without Lan Cable")); objKyDBus->showDesktopNotify(txt); } if (connFlag == 2) { qDebug()<<"Conn Ethernet Success"; //syslog(LOG_DEBUG, "Conn Ethernet Success"); this->ksnm->execGetLanList(); QString txt(tr("Conn Ethernet Success")); objKyDBus->showDesktopNotify(txt); } if (connFlag == 3) { qDebug()<<"Launch kylin-nm, wired network already connected"; //syslog(LOG_DEBUG, "Launch kylin-nm, wired network already connected"); } if (connFlag == 4) { qDebug()<<"IP configuration could not be reserved"; //syslog(LOG_DEBUG, "IP configuration could not be reserved"); is_connect_net_failed = 1; QString txt(tr("IP configuration could not be reserved")); objKyDBus->showDesktopNotify(txt); } if (connFlag == 5) { //syslog(LOG_DEBUG, "The MACs of the device and the connection do not match."); qDebug()<<"The MACs of the device and the connection do not match."; is_connect_net_failed = 1; QString txt(tr("MAC Address Mismatch")); objKyDBus->showDesktopNotify(txt); } if (connFlag == 6) { //syslog(LOG_DEBUG, "Connection Be Killed"); qDebug()<<"Connection Be Killed"; is_connect_net_failed = 1; QString txt(tr("Connection Be Killed")); objKyDBus->showDesktopNotify(txt); } if (connFlag == 7) { qDebug()<<"Connect Bluetooth Network Failed"; //syslog(LOG_DEBUG, "Connect Bluetooth Network Failed"); is_connect_net_failed = 1; QString txt(tr("Connect Bluetooth Network Failed")); objKyDBus->showDesktopNotify(txt); } if (connFlag == 8) { qDebug()<<"Carrier/link changed"; //syslog(LOG_DEBUG, "Carrier/link changed"); is_connect_net_failed = 1; QString txt(tr("Carrier/link changed")); objKyDBus->showDesktopNotify(txt); } if (connFlag == 9) { qDebug()<<"Connect Wired Network Failed"; //syslog(LOG_DEBUG, "Connect Wired Network Failed"); is_connect_net_failed = 1; QString txt(tr("Connect Wired Network Failed")); objKyDBus->showDesktopNotify(txt); } if (connFlag == 10) { qDebug()<<"Connect VPN Network Failed"; is_connect_net_failed = 1; QString txt(tr("Connect VPN Network Failed")); objKyDBus->showDesktopNotify(txt); } this->stopLoading(); this->is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<ksnm->execGetWifiList(this->wcardname); } else { //如果是华为电脑,连接wifi后判断到portal网络弹出认证框 WifiAuthThread *wifi_auth_thread=new WifiAuthThread(); wifi_auth_thread->start(); } QString txt(tr("Conn WLAN Success")); objKyDBus->showDesktopNotify(txt); } else if (connFlag == 1) { //syslog(LOG_DEBUG, "Confirm your WLAN password or usable of wireless card"); qWarning()<<"Wi-Fi connected failed. res=1"; //is_stop_check_net_state = 0; is_connect_net_failed = 1; is_connect_hide_wifi = 0; QString txt(tr("Confirm your WLAN password or usable of wireless card")); objKyDBus->showDesktopNotify(txt); } else if (connFlag == 3) { //syslog(LOG_DEBUG, "Launch kylin-nm, Wi-Fi already connected"); qWarning()<<"Wi-Fi connected failed. res=3"; } else if (connFlag == 4) { //syslog(LOG_DEBUG, "Confirm your WLAN password"); is_connect_net_failed = 1; QString txt(tr("Confirm your WLAN password")); qWarning()<<"Wi-Fi connected failed. res=4"; objKyDBus->showDesktopNotify(txt); } else if (connFlag == 5) { //syslog(LOG_DEBUG, "Selected WLAN has not been scanned."); is_connect_net_failed = 1; QString txt(tr("Selected WLAN has not been scanned.")); qWarning()<<"Wi-Fi connected failed. res=5"; objKyDBus->showDesktopNotify(txt); } else if (connFlag == 6) { //syslog(LOG_DEBUG, "Connect Hidden WLAN Success."); this->ksnm->execGetWifiList(this->wcardname); QString txt(tr("Connect Hidden WLAN Success")); qWarning()<<"Connect Hidden WLAN Success. res=6"; objKyDBus->showDesktopNotify(txt); } else if (connFlag == 7) { //syslog(LOG_DEBUG, "Secrets were required, but not provided. res=7"); qWarning()<<"Secrets were required, but not provided. res=7"; is_connect_net_failed = 1; QString txt(tr("Confirm your WLAN password")); objKyDBus->showDesktopNotify(txt); } else if (connFlag == 8) { //syslog(LOG_DEBUG, "Error: 802-11-wireless-security.psk: ????. res=8"); qWarning()<<"Error: 802-11-wireless-security.psk: ????. res=8"; is_connect_net_failed = 1; QString txt(tr("Confirm your WLAN password")); objKyDBus->showDesktopNotify(txt); } else if (connFlag == 9) { //syslog(LOG_DEBUG, "Passwords or encryption keys are required to access the wireless network. res=9"); qWarning()<<"Passwords or encryption keys are required to access the wireless network. res=9"; is_connect_net_failed = 1; QString txt(tr("Confirm your WLAN password")); objKyDBus->showDesktopNotify(txt); } this->stopLoading(); is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<ksnm->execGetWifiList(this->wcardname); } //重新绘制背景色 void MainWindow::paintEvent(QPaintEvent *event) { double trans = objKyDBus->getTransparentData(); QStyleOption opt; opt.init(this); QPainter p(this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } bool MainWindow::event(QEvent *event) { if (event->type() == QEvent::ActivationChange) { if (QApplication::activeWindow() != this) { this->m_is_inputting_wifi_password = false; this->hide(); numberForWifiScan = 0; } } return QMainWindow::event(event); } /////////////////////////////////////////////////////////////////////////////// QPixmap MainWindow::drawSymbolicColoredPixmap(const QPixmap &source) { QColor gray(128,128,128); QColor standard (31,32,34); 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) { if (qAbs(color.red()-gray.red())<20 && qAbs(color.green()-gray.green())<20 && qAbs(color.blue()-gray.blue())<20) { color.setRed(255); color.setGreen(255); color.setBlue(255); img.setPixelColor(x, y, color); } else if(qAbs(color.red()-standard.red())<20 && qAbs(color.green()-standard.green())<20 && qAbs(color.blue()-standard.blue())<20) { color.setRed(255); color.setGreen(255); color.setBlue(255); img.setPixelColor(x, y, color); } else { img.setPixelColor(x, y, color); } } } } return QPixmap::fromImage(img); } QPixmap MainWindow::drawSymbolicBlackColoredPixmap(const QPixmap &source) { 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) { if (qAbs(color.red())>=200 && qAbs(color.green())>=200 && qAbs(color.blue())>=200) { color.setRed(56); color.setGreen(56); color.setBlue(56); img.setPixelColor(x, y, color); } } } } return QPixmap::fromImage(img); } const QPixmap MainWindow::loadSvg(const QString &fileName, const int size) { QPixmap pixmap(size, size); QSvgRenderer renderer(fileName); pixmap.fill(Qt::transparent); QPainter painter; painter.begin(&pixmap); renderer.render(&painter); painter.end(); return pixmap; } void MainWindow::getSystemFontFamily() { qDebug()<<"Init Font Gsettings..."; const QByteArray id("org.ukui.style"); QGSettings * fontSetting = new QGSettings(id, QByteArray(), this); connect(fontSetting, &QGSettings::changed,[=](QString key) { if ("systemFont" == key || "systemFontSize" ==key) { QFont font = this->font(); int width = font.pointSize(); for (auto widget : qApp->allWidgets()) { widget->setFont(font); } } }); } /////////////////////////////////////////////////////////////////////////////// //解决双屏幕问题用到的dbus方法 void MainWindow::PrimaryManager() { qDebug()<<"Init primary settings..."; isHuaWeiPC = false; isHuaWei9006C = false; #if 0 //QDBusConnection conn = QDBusConnection::sessionBus(); mDbusXrandInter = new QDBusInterface(DBUS_NAME, DBUS_PATH, DBUS_INTERFACE, QDBusConnection::sessionBus()); isHuaWeiPC = false; isHuaWei9006C = false; QDBusMessage message = QDBusMessage::createMethodCall(DBUS_NAME, DBUS_PATH, DBUS_INTERFACE, "height"); QDBusMessage response = QDBusConnection::sessionBus().call(message); if (response.type() == QDBusMessage::ReplyMessage) { isHuaWeiPC = true; //继续判断是990或者9006c QProcess * processCpuinfo = new QProcess(this); processCpuinfo->start(QString("cat /proc/cpuinfo")); connect(processCpuinfo, static_cast(&QProcess::finished), this, [ = ]() { processCpuinfo->deleteLater(); }); connect(processCpuinfo, &QProcess::readyReadStandardOutput, this, [ = ]() { QString ctrCpuinfo = processCpuinfo->readAllStandardOutput(); if (ctrCpuinfo.indexOf("HUAWEI Kirin 9006C") != -1) { isHuaWei9006C = true; } }); processCpuinfo->waitForFinished(); } connect(mDbusXrandInter, SIGNAL(screenPrimaryChanged(int,int,int,int)), this, SLOT(priScreenChanged(int,int,int,int))); #endif } void MainWindow::toStart() { qDebug()<<"Init geometry..."; m_priX = getScreenGeometry("x"); m_priY = getScreenGeometry("y"); m_priWid = getScreenGeometry("width"); m_priHei = getScreenGeometry("height"); if (m_priWid == 0 || m_priHei == 0) { QRect rect = QApplication::desktop()->screenGeometry(0); m_priX=rect.x(); m_priY=rect.y(); m_priWid=rect.width(); m_priHei=rect.height(); } //qDebug("Start: Primary screen geometry is x=%d, y=%d, windth=%d, height=%d", m_priX, m_priY, m_priWid, m_priHei); } int MainWindow::getScreenGeometry(QString methodName) { int res = 0; QDBusMessage message = QDBusMessage::createMethodCall(DBUS_NAME, DBUS_PATH, DBUS_INTERFACE, methodName); QDBusMessage response = QDBusConnection::sessionBus().call(message); if (response.type() == QDBusMessage::ReplyMessage) { if(!response.arguments().isEmpty()) { int value = response.arguments().takeFirst().toInt(); res = value; qDebug() << value; } } else { qDebug()<< "to get message about "<< methodName<<" of screen failed"; //syslog(LOG_DEBUG, "to get message about %s of screen failed", methodName.toUtf8().data()); } return res; } void MainWindow::requestRefreshWifiList() { if (isHuaWeiPC) { QtConcurrent::run([=](){ qDebug()<<"Received signal to refresh wifi from ukcc, current_wifi_list_state="<requestScanWifi(); //要求后台扫描AP sleep(2); emit refreshWifiListAfterScan(); }); } else { current_wifi_list_state = REFRESH_WIFI; qDebug()<<"Received signal to refresh wifi from ukcc, current_wifi_list_state="<ksnm->execGetWifiList(this->wcardname); } } /* get primary screen changed */ void MainWindow::priScreenChanged(int x, int y, int width, int height) { m_priX = x; m_priY = y; m_priWid = width; m_priHei = height; qDebug("primary screen changed, geometry is x=%d, y=%d, windth=%d, height=%d", x, y, width, height); //syslog(LOG_DEBUG, "primary screen changed, geometry is x=%d, y=%d, windth=%d, height=%d", x, y, width, height); } // 通过kds的dbus发现rfkill状态变化 void MainWindow::onRfkillStatusChanged() { qDebug() << "收到信号了,开始执行函数onRfkillStatusChanged()"; if (canExecHandleWifiSwitchChange) { canExecHandleWifiSwitchChange = false; qDebug() << "收到信号了,开始处理wifi开关的处理问题"; if (isHuaWeiPC) { QDBusReply reply = kdsDbus->call("getCurrentWlanMode"); if (reply.isValid()){ int current = reply.value(); if (current == -1){ qWarning("Error Occur When Get Current WlanMode"); //syslog(LOG_DEBUG, "Error Occur When Get Current WlanMode"); return; } if (!current) { is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<hide(); btnAddNet->hide(); objKyDBus->setWifiSwitchState(false); QThread *rfkill_t = new QThread(); BackThread *rfkill_bt = new BackThread(); rfkill_bt->moveToThread(rfkill_t); objKyDBus->oldWifiSwitchState = false; btnWireless->setSwitchStatus(false); connect(rfkill_t, SIGNAL(finished()), rfkill_t, SLOT(deleteLater())); connect(rfkill_t, SIGNAL(started()), rfkill_bt, SLOT(rfkillExecDisWifi())); connect(rfkill_bt, SIGNAL(disWifiDoneByRfkill()), this, SLOT(rfkillDisableWifiDone())); connect(rfkill_bt, SIGNAL(btFinishByRfkill()), rfkill_t, SLOT(quit())); rfkill_t->start(); this->startLoading(); } else { if (is_fly_mode_on == 0) { on_btnWifiList_clicked(); is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<setWifiCardState(true); objKyDBus->setWifiSwitchState(true); QThread *rfkill_t = new QThread(); BackThread *rfkill_bt = new BackThread(); rfkill_bt->moveToThread(rfkill_t); objKyDBus->oldWifiSwitchState = true; btnWireless->setSwitchStatus(true); connect(rfkill_t, SIGNAL(finished()), rfkill_t, SLOT(deleteLater())); connect(rfkill_t, SIGNAL(started()), rfkill_bt, SLOT(rfKillexecEnWifi())); connect(rfkill_bt, SIGNAL(enWifiDoneByRfkill()), this, SLOT(rfkillEnableWifiDone())); connect(rfkill_bt, SIGNAL(btFinishByRfkill()), rfkill_t, SLOT(quit())); rfkill_t->start(); this->startLoading(); } } } } } else { qDebug() << "但是函数onRfkillStatusChanged()正在执行,停止执行这个函数"; } } //wifi开关关闭 void MainWindow::rfkillDisableWifiDone() { canExecHandleWifiSwitchChange = true; if (is_btnWifiList_clicked) disWifiDoneChangeUI(); qDebug()<<"debug: already turn off the switch of wifi network detected by kds policy"; //syslog(LOG_DEBUG, "Already turn off the switch of wifi network detected by kds policy"); this->stopLoading(); is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<requestScanWifi(); //要求后台扫描AP isReConnAfterTurnOnWifi = true; qDebug() << "Scan finished after truning wifi switch on, ready to reconnect wifi"; usleep(1600*1000); emit this->requestReconnecWifi(); //emit loadWifiListAfterScan(); isRadioWifiTurningOn = false; }); } else { current_wifi_list_state = LOAD_WIFI_LIST; //on_btnWifiList_clicked(); isRadioWifiTurningOn = false; } } void MainWindow::showPb(QString type, QString name) { bShowPb = false; if (type != "wifi") { onBtnNetListClicked(1); } else { on_btnWifiList_clicked(); } emit showPbSignal(QSystemTrayIcon::Trigger); if (name.isEmpty() || name == "") return; qDebug()<<"A "< 10) break; } qDebug()<<__FUNCTION__<<__LINE__<wifiClicked(name); }); } else { emit this->lanClicked(name); } } kylin-nm/src/wifi-auth-thread.h0000644000175000017500000000240314205345444015342 0ustar fengfeng/* * 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 #include class WifiAuthThread:public QThread { protected: virtual void run(); QNetworkRequest request; QNetworkAccessManager* naManager=nullptr; bool _isConnect=true;//是否已联网 bool _isReply=false;//联网状态检查是否收到回复 public: WifiAuthThread(); ~WifiAuthThread(); }; #endif //WIFI_AUTH_THREAD_H kylin-nm/src/onelancform.ui0000644000175000017500000001236114205345374014677 0ustar fengfeng 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 kylin-nm/src/wpawifidialog.ui0000644000175000017500000000115514205345444015217 0ustar fengfeng WpaWifiDialog 0 0 360 660 360 0 360 680 Dialog kylin-nm/src/confform.h0000644000175000017500000000636614205345374014027 0ustar fengfeng/* * 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 #include #include #include "kylin-dbus-interface.h" namespace Ui { class ConfForm; } struct ConnProperties { QString connName; QString uuidName; QString v4method; QString v4addr; QString v6method; QString v6addr; QString mask; QString gateway; QString dns; bool isActConf; QString type; }; class ConfForm : public QDialog { Q_OBJECT public: explicit ConfForm(QWidget *parent = 0); ~ConfForm(); void setProp(ConnProperties connection); QString actLanIpv6Addr; QString actWifiIpv6Addr; QString lcard, wcard; public slots: void cbTypeChanged(int index); void cbMaskChanged(int index); void changeEnableCheckIp(); protected: void paintEvent(QPaintEvent *event); private slots: void on_btnSave_clicked(); void on_btnCancel_clicked(); void on_btnCreate_clicked(); void on_leName_textEdited(const QString &arg1); void on_leAddr_textEdited(const QString &arg1); void on_leGateway_textEdited(const QString &arg1); void on_leDns_textEdited(const QString &arg1); void on_leDns2_textEdited(const QString &arg1); void setEnableOfBtn(); bool getTextEditState(QString text); bool getIpv6EditState(QString text); void setBtnEnableFalse(); void saveNetworkConfiguration(); void on_leAddr_ipv6_textChanged(const QString &arg1); private: Ui::ConfForm *ui; // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); void showNotify(QString message); bool check_ip_conflict(QString ifname); void onConfformHide(); bool isEditingAlready(); //连接按钮是否可被按 bool isPress; QPoint winPos; QPoint dragPos; bool isActConf; //是否对已经连接的网络进行的更改 bool isCreateNewNet = false; //是否是创建的新网络 bool isShowSaveBtn = true; //是否显示保存按钮,即是否是编辑网络界面 QString lastConnName, lastIpv4, netUuid, newUuid, lastIpv6; int lastTypeIndex; bool isActWifi; //是否是wifi网络 bool canCheckIpConflict = true; //当前是否可以执行IP冲突的检测 bool isIpv6Conflict = false; //ipv6地址是否冲突 QString labelQss, cbxQss, leQss, lineQss, btnOnQss, btnOffQss; signals: void requestRefreshLanList(int updateType); }; #endif // CONFFORM_H kylin-nm/src/wificonfigdialog.cpp0000644000175000017500000001524014205345444016042 0ustar fengfeng/* * 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 WiFiConfigDialog::WiFiConfigDialog(QWidget *parent) : QDialog(parent), ui(new Ui::WiFiConfigDialog) { ui->setupUi(this); initTransparentState(); //初始化窗口透明度的GSetting方法 this->setWindowFlags(Qt::FramelessWindowHint); //Qt::WindowStaysOnTopHint this->setWindowTitle(tr("WLAN Authentication"));//"Wifi 认证" this->setAttribute(Qt::WA_TranslucentBackground); this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); ui->lbTitle->setText(tr("Input WLAN Information Please")); //输入Wi-Fi名称和密码后点击确定 ui->lbWifiId->setText(tr("WLAN ID:")); //Wi-Fi连接名称: ui->lbWifiName->setText(tr("WLAN Name:")); //Wi-Fi名称: ui->lbWifiPassord->setText(tr("Password:")); //Wi-Fi密码: ui->btnCancel->setText(tr("Cancl")); ui->btnOk->setText(tr("Ok")); ui->leWifiId->setContextMenuPolicy(Qt::NoContextMenu); ui->leWiFiName->setContextMenuPolicy(Qt::NoContextMenu); ui->leWifiPassword->setContextMenuPolicy(Qt::NoContextMenu); ui->leWifiPassword ->setEchoMode(QLineEdit::Password); ui->checkBoxPwd->setStyleSheet(checkBoxQss); ui->checkBoxPwd->setFocusPolicy(Qt::NoFocus); ui->leWifiId->setContextMenuPolicy(Qt::NoContextMenu); //禁止LineEdit的右键菜单 ui->leWiFiName->setContextMenuPolicy(Qt::NoContextMenu); ui->leWifiPassword->setContextMenuPolicy(Qt::NoContextMenu); this->setEnableOfBtn(); this->setFixedSize(474, 320); } WiFiConfigDialog::~WiFiConfigDialog() { delete ui; } void WiFiConfigDialog::paintEvent(QPaintEvent *event) { double trans = this->getTransparentData(); QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } //创建获取窗口透明度信息的GSetting的对象 void WiFiConfigDialog::initTransparentState() { if (QGSettings::isSchemaInstalled("org.ukui.control-center.personalise")) { m_transparency_gsettings = new QGSettings("org.ukui.control-center.personalise"); } } //使用GSetting获取当前窗口应该使用的透明度 double WiFiConfigDialog::getTransparentData() { if (!m_transparency_gsettings) { return 0.7; } QStringList keys = m_transparency_gsettings->keys(); if (keys.contains("transparency")) { double tp = m_transparency_gsettings->get("transparency").toDouble(); return tp; } else { return 0.7; } } void WiFiConfigDialog::on_btnCancel_clicked() { ui->leWiFiName->setText(""); ui->leWifiPassword->setText(""); hide(); } void WiFiConfigDialog::on_btnOk_clicked() { QFuture < void > future1 = QtConcurrent::run([=](){ this->toConfigWifi(); }); hide(); } void WiFiConfigDialog::toConfigWifi() { QString connName = ui->leWiFiName->text(); QString password = ui->leWifiPassword->text(); QString strConntype = "nmcli connection modify '" + connName + "' wifi-sec.psk-flags 0"; Utils::m_system(strConntype.toUtf8().data()); QString tmpPath = "/tmp/kylin-nm-btoutput-" + QDir::home().dirName(); QString cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli device wifi connect '" + connName + "' password '" + password + "' > " + tmpPath; Utils::m_system(cmdStr.toUtf8().data()); QFile file(tmpPath); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug()<<"Can't open the file /tmp/kylin-nm-btoutput in function toConfigWifi !"; } QString line = file.readLine(); file.close(); qDebug()<<"connect_wifi_result: "<< line; if (line.indexOf("successfully") != -1) { QString strConntype = "nmcli connection modify '" + connName + "' wifi-sec.psk-flags 2"; system(strConntype.toUtf8().data()); } else { QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection delete '" + ui->leWifiId->text() + "'"; int status = system(cmd.toUtf8().data()); qDebug()<<"executed cmd="< #include #include #include #include #include #include /* * Implementation of adaptor class DbusAdaptor */ DbusAdaptor::DbusAdaptor(MainWindow *parent) : QDBusAbstractAdaptor(parent) { // constructor qDBusRegisterMetaType>(); setAutoRelaySignals(true); //setAutoRelaySignals(true)后会自动转发同名信号,因此不必再额外像如下代码一样写一个转发 // connect(parent, &MainWindow::getWifiListFinished, this, [ = ]() { // QDBusMessage msg = QDBusMessage::createSignal("/com/kylin/network", "com.kylin.network", "getWifiListFinished"); // QDBusConnection::sessionBus().send(msg); // }); } DbusAdaptor::~DbusAdaptor() { // destructor } void DbusAdaptor::showMainWindow() { // handle method call com.kylin.weather.showMainWindow //edited the code manually by lixiang //parent()->handleIconClicked(); parent()->on_showWindowAction(); } void DbusAdaptor::showPb(QString type, QString name) { parent()->showPb(type, name); } void DbusAdaptor::requestRefreshWifiList() { parent()->requestRefreshWifiList(); } QVector DbusAdaptor::getWifiList() { return parent()->dbus_wifiList; } kylin-nm/src/utils.cpp0000644000175000017500000001163114205345374013700 0ustar fengfeng/* * 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 #include #include #include /////////////////////////////////////////////////////////////////////////////// // The Utils class Utils::Utils(){} int Utils::m_system(char *cmd) { int status = 0; pid_t pid; clock_t start,finish; if ((pid = vfork()) <0) { qDebug()<<"failed to create a subprocess by using vfork"; status = -1; } else if (pid==0) { const char *new_argv[4]; struct sigaction sa_cld; sa_cld.sa_handler = SIG_DFL; sa_cld.sa_flags = 0; // 在子进程中放开SIGINT信号 sigemptyset(&sa_cld.sa_mask); sigaction (SIGINT, &sa_cld, NULL); sigaction (SIGQUIT, &sa_cld, NULL); new_argv[0] = "sh"; new_argv[1] = "-c"; new_argv[2] = cmd; new_argv[3] = NULL; // execl("/bin/sh","sh","-c" ,cmd,(char *)0); start = clock(); if (execve("/bin/sh",(char *const *) new_argv, NULL) <0) { qDebug()<<"failed to execve a shell command in function m_system"; exit(1); } else { exit(0); } } else { waitpid(pid,&status,0); finish = clock(); } //double duration = (double)(finish-start)/CLOCKS_PER_SEC; //qDebug()<<"It takes "< args; args<<(tr("Kylin NM")) <<((unsigned int) 0) < //#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->loadingGif->setAlignment(Qt::AlignCenter); // this->switchTimer = new QTimer(this); //QTimer对象,控制等待动画播放 // connect(switchTimer, SIGNAL(timeout()), this, SLOT(switchAnimStep())); this->raise(); this->hide(); } //加载动画控件'loadingGif' void LoadingDiv::switchAnimStep(const QVariant& value) { // //另外一种加载方法 // 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) { // emit this->toStopLoading(); //发出信号停止主界面和托盘区的等待动画 // } if (!loadingGif) { return; } QTransform t; t.rotate(value.toReal()); loadingGif->setPixmap(QPixmap(":/res/s/conning-b/1.png").transformed(t)); loadingGif->setProperty("useIconHighlightEffect", true); loadingGif->setProperty("iconHighlightEffectMode", true); } //开始播放动画 void LoadingDiv::startLoading() { // this->currentPage = 12; // this->countCurrentTime = 0; // this->switchTimer->start(FRAMESPEED); // this->show();' #define ANIMATION_SPEED 0.8*1000 #define START_ROTATION 0 #define END_ROTATION 360 #define ANIMATION_LOOP -1 //无限旋转 if (!loadingGif) { qWarning() << "Start loading failed, iconLabel is null pointer!" << Q_FUNC_INFO << __LINE__; } if (!m_animation) { m_animation = new QVariantAnimation(loadingGif); connect(m_animation, &QVariantAnimation::valueChanged, this, &LoadingDiv::switchAnimStep); } m_animation->setDuration(ANIMATION_SPEED); m_animation->setStartValue(START_ROTATION); m_animation->setEndValue(END_ROTATION); m_animation->setLoopCount(ANIMATION_LOOP); m_animation->start(); this->show(); } //结束播放动画 void LoadingDiv::stopLoading() { // this->switchTimer->stop(); // this->hide(); if (!m_animation) { qWarning() << "Stop loading failed, m_animation is null pointer!" << Q_FUNC_INFO << __LINE__; return; } else { m_animation->stop(); } this->hide(); } kylin-nm/src/kylin-dbus-interface.cpp0000644000175000017500000031702414205345444016562 0ustar fengfeng/* * 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 namespace { void quitThread(QThread *thread) { Q_ASSERT(thread); if (thread) { thread->quit(); if (!thread->wait(2000)) { thread->terminate(); thread->wait(); } } } } // namespace KylinDBus::KylinDBus(MainWindow *mainWindow, QObject *parent) :QObject(parent) { this->mw = mainWindow; getObjectPath(); //获取dbus中 lan 与 WiFi 的device路径 getPhysicalCarrierState(); //初始化获取网线插入状态 getLanHwAddressState(); //获取有线网Mac地址 getWiredCardName(); //获取有线网卡名称 //initTaskbarGsetting(); //初始化taskbar的GSetting方法 getWifiSwitchState(); //初始化wifi开关GSetting通信方法 initTransparentState(); //初始化窗口透明度的GSetting方法 getLanIpChanged(); QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), QString("/org/freedesktop/NetworkManager"), QString("org.freedesktop.NetworkManager"), QString("PropertiesChanged"), this, SLOT(onPropertiesChanged(QVariantMap) ) ); QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), QString("/org/freedesktop/NetworkManager"), QString("org.freedesktop.NetworkManager"), QString("AutoConnect"), this, SLOT(onAutoConnect() ) ); QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), QString("/org/freedesktop/NetworkManager"), QString("org.freedesktop.NetworkManager"), QString("DeviceAdded"), mw, SLOT(onNetworkDeviceAdded(QDBusObjectPath) ) ); QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), QString("/org/freedesktop/NetworkManager"), QString("org.freedesktop.NetworkManager"), QString("DeviceRemoved"), mw, SLOT(onNetworkDeviceRemoved(QDBusObjectPath) ) ); QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), QString("/org/freedesktop/NetworkManager/Settings"), QString("org.freedesktop.NetworkManager.Settings"), QString("NewConnection"), this, SLOT(onNewConnection(QDBusObjectPath) ) ); QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), QString("/org/freedesktop/NetworkManager/Settings"), QString("org.freedesktop.NetworkManager.Settings"), QString("ConnectionRemoved"), this, SLOT(onConnectionRemoved(QDBusObjectPath) ) ); if (multiWiredPaths.size() > 0) { foreach (QDBusObjectPath mWiredPath, multiWiredPaths) { QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), QString(mWiredPath.path()), QString("org.freedesktop.NetworkManager.Device.Wired"), QString("PropertiesChanged"), this, SLOT(onLanPropertyChanged(QVariantMap) ) ); } } else { qDebug()<<"Can not find wired device object path when using dbus."; } if (!multiWirelessPaths.isEmpty()) { getWirelessCardName();//获取无线网卡名称 } else { qDebug()<<"Can not find wireless device object path when using dbus."; } if (mw) { // QObject::connect(this, SIGNAL(updateWiredList(int)), mw, SLOT(onBtnNetListClicked(int))); // QObject::connect(this, SIGNAL(newConnAdded(int)), mw, SLOT(onNewConnAdded(int))); // QObject::connect(this, SIGNAL(updateWirelessList()), mw, SLOT(on_wifi_changed())); connect(this, &KylinDBus::updateWiredList, mw, &MainWindow::onBtnNetListClicked); connect(this, &KylinDBus::newConnAdded, mw, &MainWindow::onNewConnAdded); connect(this, &KylinDBus::updateWirelessList, mw, &MainWindow::on_wifi_changed); } mUtils = new Utils(); mUtilsThread = new QThread(this); mUtils->moveToThread(mUtilsThread); connect(mUtilsThread, &QThread::finished, mUtils, &Utils::deleteLater); connect(this, SIGNAL(requestSendDesktopNotify(QString)), mUtils, SLOT(onRequestSendDesktopNotify(QString)), Qt::QueuedConnection); QTimer::singleShot(1, this, [=] { mUtilsThread->start(); }); } KylinDBus::~KylinDBus() { quitThread(mUtilsThread); } /////////////////////////////////////////////////////////////////////////////// //下方使用Dbus 进程通信方法 //获取dbus中 lan 与 WiFi 的device路径 void KylinDBus::getObjectPath() { foreach (QDBusObjectPath mPath, multiWiredPaths) { qDebug()<<"[PropertiesChanged] PropertiesChanged is disconnected "<> obj_reply = m_interface.call("GetAllDevices"); if (!obj_reply.isValid()) { qDebug()<<"execute dbus method 'GetAllDevices' is invalid in func getObjectPath()"; } QList obj_paths = obj_reply.value(); //再判断有无有线设备和无线设备的路径 foreach (QDBusObjectPath obj_path, obj_paths) { QDBusInterface interface( "org.freedesktop.NetworkManager", obj_path.path(), "org.freedesktop.DBus.Introspectable", QDBusConnection::systemBus() ); QDBusReply reply = interface.call("Introspect"); if (!reply.isValid()) { qDebug()<<"execute dbus method 'Introspect' is invalid in func getObjectPath()"; } if(reply.value().indexOf("org.freedesktop.NetworkManager.Device.Wired") != -1) { //表明有有线网设备 multiWiredPaths.append(obj_path); } else if (reply.value().indexOf("org.freedesktop.NetworkManager.Device.Wireless") != -1) { //表明有wifi设备 multiWirelessPaths.append(obj_path); wirelessPath = obj_path; isWirelessCardOn = true; } } if (multiWiredPaths.size() > 0) { foreach (QDBusObjectPath mWiredPath, multiWiredPaths) { qDebug()<<"[PropertiesChanged] PropertiesChanged is reconnected "< lanReply = lanInterface.call("Get", "org.freedesktop.NetworkManager.Device.Wired", "HwAddress"); if (!lanReply.isValid()) { qDebug()<<"can not get the attribute 'HwAddress' in func getLanHwAddressState()"; } else { QString dbusLanMac = lanReply.value().toString(); multiWiredMac.append(dbusLanMac); } } if (multiWiredMac.size() > 0) { dbusMacDefault = multiWiredMac.at(0); } else { dbusMacDefault = "--"; } } //获取有线网卡名称 void KylinDBus::getWiredCardName() { foreach (QString mStr, multiWiredIfName) { multiWiredIfName.removeOne(mStr); } foreach (QDBusObjectPath mPath, multiWiredPaths) { QDBusInterface lanInterface( "org.freedesktop.NetworkManager", mPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply lanReply = lanInterface.call("Get", "org.freedesktop.NetworkManager.Device", "Interface"); if (!lanReply.isValid()) { qDebug()<<"can not get the attribute 'Interface' in func getWiredCardName()"; } else { QString dbusLanCardName = lanReply.value().toString(); multiWiredIfName.append(dbusLanCardName); } } } //获取无线网卡名称 void KylinDBus::getWirelessCardName() { if (multiWirelessPaths.size() == 0) { dbusWiFiCardName = ""; return; } QDBusInterface lanInterface( "org.freedesktop.NetworkManager", multiWirelessPaths.at(0).path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply lanReply = lanInterface.call("Get", "org.freedesktop.NetworkManager.Device", "Interface"); if (!lanReply.isValid()) { qDebug()<<"can not get the attribute 'Interface' in func getWirelessCardName()"; } else { dbusWiFiCardName = lanReply.value().toString(); } } //获取普通的有线网ip、DNS、ifname void KylinDBus::getLanIpDNS(QString uuidName, bool isActNet) { dbusIfName = "--"; QDBusInterface m_interface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings", "org.freedesktop.NetworkManager.Settings", QDBusConnection::systemBus() ); QDBusReply> m_reply = m_interface.call("ListConnections"); QList m_objNets = m_reply.value(); foreach (QDBusObjectPath objNet, m_objNets) { QDBusInterface m_interface("org.freedesktop.NetworkManager", objNet.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage result = m_interface.call("GetSettings"); //get information of this network if (result.arguments().isEmpty()) { continue; } const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); QMap> map; dbusArg1st >> map; for (QString outside_key : map.keys() ) { QMap outsideMap = map.value(outside_key); if (outside_key == "connection") { for (QString search_key : outsideMap.keys()) { if (search_key == "uuid") { if (uuidName == outsideMap.value(search_key).toString()) { for (QString search_key : outsideMap.keys()) { if (search_key == "interface-name") { dbusIfName = outsideMap.value("interface-name").toString(); } } for (QString key : map.keys() ) { QMap innerMap = map.value(key); if (key == "ipv4") { for (QString inner_key : innerMap.keys()) { //获取ipv4 if (inner_key == "address-data") { const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value(); QMap m_map; dbusArg2nd.beginArray(); while (!dbusArg2nd.atEnd()) { dbusArg2nd >> m_map;// append map to a vector here if you want to keep it break; } dbusArg2nd.endArray(); dbusLanIpv4 = m_map.value("address").toString(); } if (isActNet && inner_key == "dns") { const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value(); int strDns = 0; dbusArg2nd.beginArray(); while (!dbusArg2nd.atEnd()) { dbusArg2nd >> strDns;// append map to a vector here if you want to keep it if (strDns == 0) { //dbusArg2nd为空时,strDns没有从dbusArg2nd获取到结果 dbusArg2nd.endArray(); } } dbusArg2nd.endArray(); dbusActLanDNS = strDns; } } } if (key == "ipv6") { for (QString inner_key : innerMap.keys()) { if (inner_key == "address-data"){ const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value(); QMap m_map; dbusArg2nd.beginArray(); while (!dbusArg2nd.atEnd()) { dbusArg2nd >> m_map;// append map to a vector here if you want to keep it break; } dbusArg2nd.endArray(); dbusLanIpv6 = m_map.value("address").toString(); } else if (inner_key == "method") { dbusLanIpv6Method = innerMap.value(inner_key).toString(); } } } } //end for(QString key : map.keys() ) } } } //end for (QString search_key : outsideMap.keys()) } } // end for(QString outside_key : map.keys() ) } //end foreach (QDBusObjectPath objNet, m_objNets) } void KylinDBus::getWifiIp(QString uuid) { QDBusInterface m_interface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings", "org.freedesktop.NetworkManager.Settings", QDBusConnection::systemBus() ); QDBusReply> m_reply = m_interface.call("ListConnections"); QList m_objNets = m_reply.value(); foreach (QDBusObjectPath objNet, m_objNets) { QDBusInterface m_interface("org.freedesktop.NetworkManager", objNet.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage result = m_interface.call("GetSettings"); if (result.arguments().isEmpty()) { continue; } const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); QMap> map; dbusArg1st >> map; for (QString outside_key : map.keys() ) { QMap outsideMap = map.value(outside_key); if (outside_key == "connection") { for (QString search_key : outsideMap.keys()) { if (search_key == "uuid") { if (uuid == outsideMap.value(search_key).toString()) { for (QString key : map.keys() ) { QMap innerMap = map.value(key); if (key == "ipv4") { for (QString inner_key : innerMap.keys()) { if (inner_key == "address-data") { const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value(); QMap m_map; dbusArg2nd.beginArray(); while (!dbusArg2nd.atEnd()) { dbusArg2nd >> m_map; } dbusArg2nd.endArray(); dbusWifiIpv4 = m_map.value("address").toString(); } else if (inner_key == "method") { dbusWifiIpv4Method = innerMap.value(inner_key).toString(); } } } if (key == "ipv6") { for (QString inner_key : innerMap.keys()) { if (inner_key == "address-data"){ const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value(); QMap m_map; dbusArg2nd.beginArray(); while (!dbusArg2nd.atEnd()) { dbusArg2nd >> m_map;// append map to a vector here if you want to keep it } dbusArg2nd.endArray(); dbusWifiIpv6 = m_map.value("address").toString(); } else if (inner_key == "method") { dbusWifiIpv6Method = innerMap.value(inner_key).toString(); } } } } } } else { continue; } } } } } } //获取有线网络的MAC QString KylinDBus::getLanMAC(QString ifname) { QString macAddress = "--"; QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "AllDevices"); if (result.arguments().isEmpty()) { return macAddress; } QList outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath objPath; //保存设备的路径 dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; QDBusInterface interfacePro( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interfacePro.call("Get", "org.freedesktop.NetworkManager.Device", "Interface"); if (ifname == reply.value().toString()) { //先获取已连接有线网络对应的设备路径 QDBusInterface interfaceMac( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interfaceMac.call("Get", "org.freedesktop.NetworkManager.Device.Wired", "HwAddress"); macAddress = reply.value().toString(); } } dbusArgs.endArray(); return macAddress; } //获取已经连接的有线网ip void KylinDBus::getConnectNetIp(QString netUuid) { dbusWifiIpv4 = ""; dbusActiveWifiIpv4 = ""; dbusWifiIpv4Method = ""; QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); //获取已经连接了那些网络,及这些网络对应的网络类型(ethernet or wifi) QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "ActiveConnections"); if (result.arguments().isEmpty()) { return; } QList outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath objPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; QDBusInterface interfacePro( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyType = interfacePro.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Type"); QDBusReply replyUuid = interfacePro.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Uuid"); if (replyType.value().toString() == "ethernet" || replyType.value().toString() == "802-3-ethernet" || replyType.value().toString() == "bluetooth") { //有线网或蓝牙共享网络 if (replyUuid.value().toString() == netUuid) { //ipv4的路径信息和ip信息 QDBusInterface interfaceIp4( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage replyIp4 = interfaceIp4.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Ip4Config"); QList outArgsIp4 = replyIp4.arguments(); if(!outArgsIp4.isEmpty()) { QVariant firstIp4 = outArgsIp4.at(0); QDBusVariant dbvFirstIp4 = firstIp4.value(); QVariant vFirstIp4 = dbvFirstIp4.variant(); QDBusObjectPath dbusPathIp4 = vFirstIp4.value(); QDBusInterface interfaceIpv4( "org.freedesktop.NetworkManager", dbusPathIp4.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage replyIpv4 = interfaceIpv4.call("Get", "org.freedesktop.NetworkManager.IP4Config", "AddressData"); QList outArgsIpv4 = replyIpv4.arguments(); if(!outArgsIpv4.isEmpty()) { QVariant firstIpv4 = outArgsIpv4.at(0); QDBusVariant dbvFirstIpv4 = firstIpv4.value(); QVariant vFirstIpv4 = dbvFirstIpv4.variant(); const QDBusArgument &dbusArgIpv4 = vFirstIpv4.value(); QList mDatasIpv4; dbusArgIpv4 >> mDatasIpv4; if(false == mDatasIpv4.isEmpty()) { foreach (QVariantMap mDataIpv4, mDatasIpv4) { dbusActiveLanIpv4 = mDataIpv4.value("address").toString(); break; } } } } //ipv6的路径信息和ip信息 QDBusInterface interfaceIp6( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage replyIp6 = interfaceIp6.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Ip6Config"); QList outArgsIp6 = replyIp6.arguments(); if(outArgsIp6.isEmpty()) continue; QVariant firstIp6 = outArgsIp6.at(0); QDBusVariant dbvFirstIp6 = firstIp6.value(); QVariant vFirstIp6 = dbvFirstIp6.variant(); QDBusObjectPath dbusPathIp6 = vFirstIp6.value(); QDBusInterface interfaceIpv6( "org.freedesktop.NetworkManager", dbusPathIp6.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage replyIpv6 = interfaceIpv6.call("Get", "org.freedesktop.NetworkManager.IP6Config", "AddressData"); QList outArgsIpv6 = replyIpv6.arguments(); if(outArgsIpv6.isEmpty()) continue; QVariant firstIpv6 = outArgsIpv6.at(0); QDBusVariant dbvFirstIpv6 = firstIpv6.value(); QVariant vFirstIpv6 = dbvFirstIpv6.variant(); const QDBusArgument &dbusArgIpv6 = vFirstIpv6.value(); QList mDatasIpv6; dbusArgIpv6 >> mDatasIpv6; if(mDatasIpv6.isEmpty()) continue; foreach (QVariantMap mDataIpv6, mDatasIpv6) { dbusActiveLanIpv6 = mDataIpv6.value("address").toString(); break; } } } else { //无线网 if (replyUuid.value().toString() == netUuid) { //ipv4的路径信息和ip信息 QDBusInterface interfaceIp4( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage replyIp4 = interfaceIp4.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Ip4Config"); QList outArgsIp4 = replyIp4.arguments(); if(!outArgsIp4.isEmpty()) { QVariant firstIp4 = outArgsIp4.at(0); QDBusVariant dbvFirstIp4 = firstIp4.value(); QVariant vFirstIp4 = dbvFirstIp4.variant(); QDBusObjectPath dbusPathIp4 = vFirstIp4.value(); QDBusInterface interfaceIpv4( "org.freedesktop.NetworkManager", dbusPathIp4.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage replyIpv4 = interfaceIpv4.call("Get", "org.freedesktop.NetworkManager.IP4Config", "AddressData"); QList outArgsIpv4 = replyIpv4.arguments(); if(!outArgsIpv4.isEmpty()) { QVariant firstIpv4 = outArgsIpv4.at(0); QDBusVariant dbvFirstIpv4 = firstIpv4.value(); QVariant vFirstIpv4 = dbvFirstIpv4.variant(); const QDBusArgument &dbusArgIpv4 = vFirstIpv4.value(); QList mDatasIpv4; dbusArgIpv4 >> mDatasIpv4; if(false == mDatasIpv4.isEmpty()) { foreach (QVariantMap mDataIpv4, mDatasIpv4) { dbusActiveWifiIpv4 = mDataIpv4.value("address").toString(); } } } } //ipv6的路径信息和ip信息 QDBusInterface interfaceIp6( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage replyIp6 = interfaceIp6.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Ip6Config"); QList outArgsIp6 = replyIp6.arguments(); if(outArgsIp6.isEmpty()) continue; QVariant firstIp6 = outArgsIp6.at(0); QDBusVariant dbvFirstIp6 = firstIp6.value(); QVariant vFirstIp6 = dbvFirstIp6.variant(); QDBusObjectPath dbusPathIp6 = vFirstIp6.value(); QDBusInterface interfaceIpv6( "org.freedesktop.NetworkManager", dbusPathIp6.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage replyIpv6 = interfaceIpv6.call("Get", "org.freedesktop.NetworkManager.IP6Config", "AddressData"); QList outArgsIpv6 = replyIpv6.arguments(); if(outArgsIpv6.isEmpty()) continue; QVariant firstIpv6 = outArgsIpv6.at(0); QDBusVariant dbvFirstIpv6 = firstIpv6.value(); QVariant vFirstIpv6 = dbvFirstIpv6.variant(); const QDBusArgument &dbusArgIpv6 = vFirstIpv6.value(); QList mDatasIpv6; dbusArgIpv6 >> mDatasIpv6; if(mDatasIpv6.isEmpty()) continue; foreach (QVariantMap mDataIpv6, mDatasIpv6) { dbusActiveWifiIpv6 = mDataIpv6.value("address").toString(); } } } } dbusArgs.endArray(); } //监听有线网络ip变化 void KylinDBus::getLanIpChanged() { m_lanPathList.clear(); QDBusInterface m_interface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings", "org.freedesktop.NetworkManager.Settings", QDBusConnection::systemBus() ); QDBusReply> m_reply = m_interface.call("ListConnections"); QList m_objNets = m_reply.value(); foreach (QDBusObjectPath objNet, m_objNets) { QDBusInterface m_interface("org.freedesktop.NetworkManager", objNet.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage result = m_interface.call("GetSettings"); if (result.arguments().isEmpty()) { continue; } const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); QMap> map; dbusArg1st >> map; for(QString key : map.keys() ) { if (key == "802-3-ethernet") { oldSettingPaths.append(objNet); QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), objNet.path(), QString("org.freedesktop.NetworkManager.Settings.Connection"), QString("Updated"), this, SLOT(onLanIpPropertiesChanged() ) ); m_lanPathList.append(objNet.path()); } else if (key == "802-11-wireless") { QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), objNet.path(), QString("org.freedesktop.NetworkManager.Settings.Connection"), QString("Updated"), this, SLOT(onWifiIpPropertiesChanged() ) ); } } } } //获取wifi的mac地址 void KylinDBus::getWifiMac(QString netName) { dbusWifiMac = ""; if (multiWirelessPaths.isEmpty()) { return; } QDBusInterface interface( "org.freedesktop.NetworkManager", multiWirelessPaths.at(0).path(), "org.freedesktop.NetworkManager.Device.Wireless", QDBusConnection::systemBus() ); QDBusReply> reply = interface.call("GetAllAccessPoints"); //get accesspoint for each wifi QList objPaths = reply.value(); foreach (QDBusObjectPath objPath, objPaths) { QDBusInterface ssid_interface( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply ssid_replys = ssid_interface.call("Get", "org.freedesktop.NetworkManager.AccessPoint", "Ssid"); QString str_name = ssid_replys.value().toString(); if (str_name == netName) { //if the ssid of the accesspoint is just the netName, we can get this hardware address QDBusInterface path_interface( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply path_reply = path_interface.call("Get", "org.freedesktop.NetworkManager.AccessPoint", "HwAddress"); dbusWifiMac = path_reply.value().toString(); } } } //获取当前能获取到的wifi的数量, 每个accesspoint 代表一个wifi int KylinDBus::getAccessPointsNumber() { if (multiWirelessPaths.isEmpty()) { return 0; } QDBusInterface interface( "org.freedesktop.NetworkManager", multiWirelessPaths.at(0).path(), "org.freedesktop.NetworkManager.Device.Wireless", QDBusConnection::systemBus() ); QDBusReply> reply = interface.call("GetAllAccessPoints"); QList objPaths = reply.value(); return objPaths.size(); } //返回当前已创建有线的个数 int KylinDBus::getWiredNetworkNumber() { QDBusInterface interface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings", "org.freedesktop.NetworkManager.Settings", QDBusConnection::systemBus() ); QDBusReply> reply = interface.call("ListConnections"); QList objNetPaths = reply.value(); int wiredNetworkNumber = 0; foreach (QDBusObjectPath objNetPath, objNetPaths) { QDBusInterface m_interface("org.freedesktop.NetworkManager", objNetPath.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage result = m_interface.call("GetSettings"); if (result.arguments().isEmpty()) { continue; } const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); QMap> map; dbusArg1st >> map; for(QString key : map.keys() ) { if (key == "802-3-ethernet") { wiredNetworkNumber += 1; } } } return wiredNetworkNumber; } QStringList KylinDBus::getWifiSsidList() { QStringList wifiSsidList; QDBusInterface m_interface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings", "org.freedesktop.NetworkManager.Settings", QDBusConnection::systemBus() ); QDBusReply> m_reply = m_interface.call("ListConnections"); QDBusObjectPath specific_connection; specific_connection.setPath("/"); QList m_objSettingPaths = m_reply.value(); foreach (QDBusObjectPath objSettingPath, m_objSettingPaths) { QDBusInterface m_interface("org.freedesktop.NetworkManager", objSettingPath.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage result = m_interface.call("GetSettings"); if (result.arguments().isEmpty()) { continue; } const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); QMap> map; dbusArg1st >> map; if (map.value("802-11-wireless").value("mode").toString() == "infrastructure") { wifiSsidList.append(map.value("connection").value("id").toString()); } } return wifiSsidList; } QString KylinDBus::checkHasWifiConfigFile(QString wifiName) { QString wifiUuid = ""; QDBusInterface m_interface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings", "org.freedesktop.NetworkManager.Settings", QDBusConnection::systemBus() ); QDBusReply> m_reply = m_interface.call("ListConnections"); QDBusObjectPath specific_connection; specific_connection.setPath("/"); QList m_objSettingPaths = m_reply.value(); foreach (QDBusObjectPath objSettingPath, m_objSettingPaths) { QDBusInterface m_interface("org.freedesktop.NetworkManager", objSettingPath.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage result = m_interface.call("GetSettings"); if (result.arguments().isEmpty()) { continue; } const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); QMap> map; dbusArg1st >> map; if (map.value("connection").value("type").toString() == "802-11-wireless") { if (map.value("802-11-wireless").value("ssid").toString() == wifiName) { //qDebug() << "-------------------------> wifi ssid : " < wifi id : " < outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath objPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; QDBusInterface interfaceInterface( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyInterface = interfaceInterface.call("Get", "org.freedesktop.NetworkManager.Device", "Interface"); if (replyInterface.value().toString() == ifname) { QDBusInterface interfaceCarrier( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyCarrier = interfaceCarrier.call("Get", "org.freedesktop.NetworkManager.Device.Wired", "Carrier"); if (replyCarrier.value().toBool()) { return true; } } } dbusArgs.endArray(); return false; } //根据网卡接口的名称获取uuid QString KylinDBus::getConnLanNameByIfname(QString ifname) { QString uuidName = "--"; QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "ActiveConnections"); if (result.arguments().isEmpty()) { return uuidName; } QList outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath objPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; QDBusInterface interfaceDevice( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage replyDevices = interfaceDevice.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Devices"); if (replyDevices.arguments().isEmpty()) { continue; } QList outArgsDevices = replyDevices.arguments(); QVariant firstDevices = outArgsDevices.at(0); QDBusVariant dbvFirstDevices = firstDevices.value(); QVariant vFirstDevices = dbvFirstDevices.variant(); QDBusArgument dbusArgsDevices = vFirstDevices.value(); QDBusObjectPath objPathDevices; dbusArgsDevices.beginArray(); while (!dbusArgsDevices.atEnd()) { dbusArgsDevices >> objPathDevices; QDBusInterface interfaceInterface( "org.freedesktop.NetworkManager", objPathDevices.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyInterface = interfaceInterface.call("Get", "org.freedesktop.NetworkManager.Device", "Interface"); if (replyInterface.value().toString() == ifname) { QDBusInterface interfaceUuid( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyDevices = interfaceUuid.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Uuid"); uuidName = replyDevices.value().toString(); } } dbusArgsDevices.endArray(); } dbusArgs.endArray(); return uuidName; } //新增了一个网络,伴随着多了一个网络配置文件 void KylinDBus::onNewConnection(QDBusObjectPath objPath) { QDBusInterface m_interface("org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage result = m_interface.call("GetSettings"); if (result.arguments().isEmpty()) { onWiredSettingNumChanged(); return; } const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); QMap> map; dbusArg1st >> map; for(QString key : map.keys() ) { if (key == "802-3-ethernet") { emit this->updateWiredList(1); //send this signal to update wired network list emit this->newConnAdded(0); m_lanPathList.append(objPath.path()); emit mw->wiredConnectionAdded(); qDebug()<<"A new wired network was created."; break; } else if (key == "802-11-wireless") { qDebug()<<"A new wireless network was created."; sleep(1); bool has_wpa_psk = false; bool has_psk_flags = false; QDBusInterface interfaceSet("org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage resultSet = interfaceSet.call("GetSettings"); if (resultSet.arguments().isEmpty()) { continue; } const QDBusArgument &dbusArg1stSet = resultSet.arguments().at( 0 ).value(); QMap> mapSet; dbusArg1stSet >> mapSet; for (QString setKey : mapSet.keys() ) { QMap subSetMap = mapSet.value(setKey); if (setKey == "802-11-wireless-security") { for (QString searchKey : subSetMap.keys()) { if (searchKey == "key-mgmt") { qDebug() << "key-mgmt : "<screens()) { if (screen->geometry().contains(pos)) { primaryGeometry = screen->geometry(); } } if (primaryGeometry.isEmpty()) { primaryGeometry = qApp->primaryScreen()->geometry(); } QApplication::setQuitOnLastWindowClosed(false); WiFiConfigDialog *wifiConfigDialog = new WiFiConfigDialog(); wifiConfigDialog->move(primaryGeometry.width() / 2 - wifiConfigDialog->width() / 2, primaryGeometry.height() / 2 - wifiConfigDialog->height() / 2); wifiConfigDialog->show(); wifiConfigDialog->raise(); } else { emit this->newConnAdded(1); } break; } } onWiredSettingNumChanged(); } //减少了一个网络,伴随着减少了一个网络配置文件 void KylinDBus::onConnectionRemoved(QDBusObjectPath objPath) { if (m_lanPathList.contains(objPath.path())) { m_lanPathList.removeOne(objPath.path()); qDebug()<<"An old network was removed from configure directory."; if (mw->is_btnLanList_clicked == 1) { emit this->updateWiredList(1); //send this signal to update wired network list } emit mw->wiredConnectionRemoved(); } onWiredSettingNumChanged(); } //有线网的个数,也即有线网配置的个数变化 void KylinDBus::onWiredSettingNumChanged() { //先取消之前建立的信号槽连接 foreach (QDBusObjectPath objSettingPath, oldSettingPaths) { QDBusConnection::systemBus().disconnect(QString("org.freedesktop.NetworkManager"), objSettingPath.path(), QString("org.freedesktop.NetworkManager.Settings.Connection"), QString("Updated"), this, SLOT(onLanIpPropertiesChanged() ) ); } //再建立新的信号槽连接 getLanIpChanged(); } //应用启动时,获取已经连接的网络信息,包括该网络的路径和类型 void KylinDBus::initConnectionInfo() { QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); //获取已经连接了那些网络,及这些网络对应的网络类型(ethernet or wifi) QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "ActiveConnections"); if (result.arguments().isEmpty()) { //获取当前wifi的开关状态 QDBusReply m_result = interface.call("Get", "org.freedesktop.NetworkManager", "WirelessEnabled"); qDebug()<<"debug: *****初始的无线网络开关状态是: "< outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath objPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; oldPaths.append(objPath); QDBusInterface interface( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interface.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Type"); oldPathInfo.append(reply.value().toString()); } dbusArgs.endArray(); //获取当前wifi的开关状态 QDBusReply m_result = interface.call("Get", "org.freedesktop.NetworkManager", "WirelessEnabled"); qDebug()<<"debug: *****初始的无线网络开关状态是: "< KylinDBus::getAtiveLanSsidUuidState() { QList strSsidUuidState; QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); //获取已经连接了那些网络,及这些网络对应的网络类型(ethernet or wifi) QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "ActiveConnections"); if (result.arguments().isEmpty()) { return strSsidUuidState; } QList outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath objPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; QDBusInterface interfaceType( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interfaceType.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Type"); if (reply.value().toString() == "ethernet" || reply.value().toString() == "802-3-ethernet" || reply.value().toString() == "bluetooth" || reply.value().toString() == "vpn") { QDBusInterface interfaceInfo( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyId = interfaceInfo.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Id"); QDBusReply replyUuid = interfaceInfo.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Uuid"); QDBusReply replyState = interfaceInfo.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "State"); strSsidUuidState.append(replyId.value().toString()); strSsidUuidState.append(replyUuid.value().toString()); if (replyState.value().toUInt() == 1) { strSsidUuidState.append("connecting"); } if (replyState.value().toUInt() == 2) { strSsidUuidState.append("connected"); } } } dbusArgs.endArray(); return strSsidUuidState; } //断开所有有线连接 void KylinDBus::disConnectWiredConnect() { QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); //获取已经连接了那些网络,及这些网络对应的网络类型(ethernet or wifi) QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "ActiveConnections"); QList outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath objPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; QDBusInterface interfaceType( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interfaceType.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Type"); if (reply.value().toString() == "ethernet" || reply.value().toString() == "802-3-ethernet") { QDBusInterface connInterface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.NetworkManager", QDBusConnection::systemBus() ); connInterface.call("DeactivateConnection", QVariant::fromValue(objPath)); } } dbusArgs.endArray(); } //获取已连接wifi的uuid QString KylinDBus::getActiveWifiUuid() { QString ssid; QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); //获取已经连接了那些网络,及这些网络对应的网络类型(ethernet or wifi) QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "ActiveConnections"); if (result.arguments().isEmpty()) { return ssid; } QList outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath objPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; QDBusInterface interfaceType( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interfaceType.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Type"); if (reply.value().toString() == "wifi" || reply.value().toString() == "802-11-wireless") { QDBusInterface interfaceInfo( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyUuid = interfaceInfo.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Uuid"); ssid = replyUuid.value().toString(); } } dbusArgs.endArray(); return ssid; } //获取已连接wifi的信息 QStringList KylinDBus::getActiveWifiSignal() { QStringList connNetworkInfo; //int wifistrength = 0; QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); //获取已经连接了那些网络,及这些网络对应的网络类型(ethernet or wifi) QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "ActiveConnections"); if (result.arguments().isEmpty()) { return connNetworkInfo; } QList outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath objPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; QDBusInterface interfaceType( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interfaceType.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Type"); if (reply.value().toString() == "ethernet" || reply.value().toString() == "802-3-ethernet") { connNetworkInfo.append("802-3-ethernet"); } if (reply.value().toString() == "wifi" || reply.value().toString() == "802-11-wireless") { connNetworkInfo.append("802-11-wireless"); QDBusInterface interfaceSpecificObject( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage resultSpecificObject = interfaceSpecificObject.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "SpecificObject"); if (resultSpecificObject.arguments().isEmpty()) { continue; } QList outArgsSpecificObject = resultSpecificObject.arguments(); QVariant firstSpecificObject = outArgsSpecificObject.at(0); QDBusVariant dbvFirstSpecificObject = firstSpecificObject.value(); QVariant vFirstSpecificObject = dbvFirstSpecificObject.variant(); QDBusObjectPath objPathSpecificObject = vFirstSpecificObject.value(); QDBusInterface interfaceAP( "org.freedesktop.NetworkManager", objPathSpecificObject.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyStrength = interfaceAP.call("Get", "org.freedesktop.NetworkManager.AccessPoint", "Strength"); //signal QString strStrength; QByteArray sesultStrength = replyStrength.value().toByteArray(); int wifiSignal = sesultStrength[0] & 0x000000FF; wifiSignal |= ((sesultStrength[1] << 8) & 0x0000FF00); wifiSignal |= ((sesultStrength[2] << 16) & 0x00FF0000); wifiSignal |= ((sesultStrength[3] << 24) & 0xFF000000); strStrength = QString::number(wifiSignal); connNetworkInfo.append(strStrength); //wifistrength = wifiSignal; } } dbusArgs.endArray(); //return wifistrength; return connNetworkInfo; } //根据Dbus路径获取wifi的ssid(排除空格干扰) QString KylinDBus::getWifiSsid(QString accessPointPath) { QDBusInterface interface( "org.freedesktop.NetworkManager", accessPointPath, "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager.AccessPoint", "Ssid"); if (result.arguments().isEmpty()) return ""; return result.arguments().at(0).value().variant().toString(); } //检查wifi连接状态 int KylinDBus::checkWifiConnectivity() { int wifiState = WIFI_DISCONNECTED; QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "ActiveConnections"); if (result.arguments().isEmpty()) { return wifiState; } QList outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath objPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; QDBusInterface interfaceType( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyType = interfaceType.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Type"); if (replyType.value().toString() == "wifi" || replyType.value().toString() == "802-11-wireless") { QDBusReply replyState = interfaceType.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "State"); wifiState = replyState.value().toUInt(); //正在连接的状态是1,连接上的状态是2 } } dbusArgs.endArray(); return wifiState; } bool KylinDBus::checkNetworkConnectivity() { bool hasNetworkConnecting = false; QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "ActiveConnections"); if (result.arguments().isEmpty()) { return hasNetworkConnecting; } QList outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath objPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; QDBusInterface interfaceType( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyType = interfaceType.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Type"); if (replyType.value().toString() == "802-3-ethernet" || replyType.value().toString() == "802-11-wireless") { QDBusReply replyState = interfaceType.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "State"); if (replyState.value().toUInt() == 1) { hasNetworkConnecting = true; } } } dbusArgs.endArray(); return hasNetworkConnecting; } //获取已经连接无线网络的ssid和uuid QList KylinDBus::getAtiveWifiBSsidUuid(QStringList wifilist) { QList strBSsidUuid; QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); //获取已经连接了那些网络,及这些网络对应的网络类型(ethernet or wifi) QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "ActiveConnections"); if (result.arguments().isEmpty()) { return strBSsidUuid; } QList outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath objPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; QDBusInterface interfaceType( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interfaceType.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Type"); if (reply.value().toString() == "wifi" || reply.value().toString() == "802-11-wireless") { QDBusInterface interfaceInfo( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); //获取已经连接wifi的uuid QDBusReply replyUuid = interfaceInfo.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Uuid"); //qDebug() << "wifi uuid : "<< replyUuid.value().toString(); strBSsidUuid.append(replyUuid.value().toString()); //再获取bssid QDBusMessage resultConnection = interfaceInfo.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Connection"); QList outArgsConnection = resultConnection.arguments(); if(outArgsConnection.isEmpty()) continue; QVariant firstConnection = outArgsConnection.at(0); QDBusVariant dbvFirstConnection = firstConnection.value(); QVariant vFirstConnection = dbvFirstConnection.variant(); QDBusObjectPath dbusArgsConnection = vFirstConnection.value(); QDBusInterface interfaceSet("org.freedesktop.NetworkManager", dbusArgsConnection.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage resultSet = interfaceSet.call("GetSettings"); if(resultSet.arguments().isEmpty()) continue; const QDBusArgument &dbusArg1stSet = resultSet.arguments().at( 0 ).value(); QMap> mapSet; dbusArg1stSet >> mapSet; for (QString setKey : mapSet.keys() ) { QMap subSetMap = mapSet.value(setKey); if (setKey == "802-11-wireless") { for (QString searchKey : subSetMap.keys()) { if (searchKey == "seen-bssids") { //qDebug() << "wifi bssid : "< outArgsAllDevices = resultAllDevices.arguments(); QVariant firstAllDevices = outArgsAllDevices.at(0); QDBusVariant dbvFirstAllDevices = firstAllDevices.value(); QVariant vFirstAllDevices = dbvFirstAllDevices.variant(); QDBusArgument dbusArgsAllDevices = vFirstAllDevices.value(); QDBusObjectPath objPathDevice; dbusArgsAllDevices.beginArray(); while (!dbusArgsAllDevices.atEnd()) { dbusArgsAllDevices >> objPathDevice; QDBusInterface interfacePro( "org.freedesktop.NetworkManager", objPathDevice.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage resultAccessPoints = interfacePro.call("Get", "org.freedesktop.NetworkManager.Device.Wireless", "AccessPoints"); if (resultAccessPoints.arguments().isEmpty()) { continue; } QList outArgsAccessPoints = resultAccessPoints.arguments(); QVariant firstAccessPoints = outArgsAccessPoints.at(0); QDBusVariant dbvFirstAccessPoints = firstAccessPoints.value(); QVariant vFirstAccessPoints = dbvFirstAccessPoints.variant(); QDBusArgument dbusArgsAccessPoints = vFirstAccessPoints.value(); QDBusObjectPath objPathAccessPoint; dbusArgsAccessPoints.beginArray(); while (!dbusArgsAccessPoints.atEnd()) { dbusArgsAccessPoints >> objPathAccessPoint; QDBusInterface interfaceAP( "org.freedesktop.NetworkManager", objPathAccessPoint.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyFlags = interfaceAP.call("Get", "org.freedesktop.NetworkManager.AccessPoint", "Flags"); //in-use QDBusReply replyStrength = interfaceAP.call("Get", "org.freedesktop.NetworkManager.AccessPoint", "Strength"); //signal QDBusReply replyWpaFlags = interfaceAP.call("Get", "org.freedesktop.NetworkManager.AccessPoint", "WpaFlags"); //security QDBusReply replyFrequency = interfaceAP.call("Get", "org.freedesktop.NetworkManager.AccessPoint", "Frequency"); //freq QDBusReply replyHwAddress = interfaceAP.call("Get", "org.freedesktop.NetworkManager.AccessPoint", "HwAddress"); //bssid QDBusReply replySsid = interfaceAP.call("Get", "org.freedesktop.NetworkManager.AccessPoint", "Ssid"); //ssid QString strFlags = replyFlags.value().toString(); QString strStrength; QByteArray sesultStrength = replyStrength.value().toByteArray(); int addr = sesultStrength[0] & 0x000000FF; addr |= ((sesultStrength[1] << 8) & 0x0000FF00); addr |= ((sesultStrength[2] << 16) & 0x00FF0000); addr |= ((sesultStrength[3] << 24) & 0xFF000000); strStrength = QString::number(addr); QString strWpaFlags = replyWpaFlags.value().toString(); QString strFrequency = replyFrequency.value().toString(); QString strHwAddress = replyHwAddress.value().toString(); QString strSsid = replySsid.value().toString(); slist.append(strFlags); slist.append(strStrength); slist.append(strWpaFlags); slist.append(strFrequency); slist.append(strHwAddress); slist.append(strSsid); } dbusArgsAccessPoints.endArray(); } dbusArgsAllDevices.endArray(); emit toGetWifiListFinished(slist); } //网络连接变化时,如有新增或减少的网络,发信号通知更新主界面 void KylinDBus::onPropertiesChanged(QVariantMap qvm) { if (mw->is_stop_check_net_state) { return; } for(QString keyStr : qvm.keys()) { //有关已连接网络变化的信号 if (keyStr == "ActiveConnections") { // 第一步 获取当前已连接网络的对象路径和对应的网络类型(ethernet or wifi) const QDBusArgument &dbusArg = qvm.value(keyStr).value(); QList newPaths; newPaths.clear(); dbusArg >> newPaths; QStringList newPathInfo; qDebug()<<" "; foreach (QDBusObjectPath objPath, newPaths) { QDBusInterface interface( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interface.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Type"); newPathInfo.append(reply.value().toString()); } // 第二步 同上一次获取的已连接网络相比较,处理相比于上次减少的网络连接 for (int i=0; ionExternalConnectionChange(oldPathInfo.at(i), false); } } else { for (int j=0; jonExternalConnectionChange(oldPathInfo.at(i), false); } } } } } // 第三步 同上一次获取的已连接网络相比较,处理相比于上次增加的网络连接 for (int i=0; ionExternalConnectionChange(newPathInfo.at(i), true); } else { for (int j=0; jonExternalConnectionChange(newPathInfo.at(i), true); } } } } bool isChangeOldPathInfo = true; for (int k=0; kgetActiveInfoAndSetTrayIcon(); } //收到wifi开关打开或关闭的信号后,进行处理 if (keyStr == "WirelessEnabled") { qDebug() << "WirelessEnabled property changed"; bool newWifiSwitchState = qvm.value("WirelessEnabled").toBool(); if (oldWifiSwitchState == false && newWifiSwitchState == true) { qDebug()<<"wifi开关已经打开"; mw->onExternalWifiSwitchChange(true); } if (oldWifiSwitchState == true && newWifiSwitchState == false) { qDebug()<<"wifi开关已经关闭"; mw->onExternalWifiSwitchChange(false); } //oldWifiSwitchState = newWifiSwitchState; //更新状态用于下一次 } } } //检查网络状态获取Connectivity的值 int KylinDBus::getNetworkConectivity() { int connectivityState = 0; QDBusInterface interfacePro( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interfacePro.call("Get", "org.freedesktop.NetworkManager", "Connectivity"); if (!reply.isValid()) { qDebug() << Q_FUNC_INFO<<" can not get the attribute 'Connectivity' "; } else { connectivityState = reply.value().toInt(); } return connectivityState; } //接收到自动连接的信号过后执行自动连接wifi void KylinDBus::onAutoConnect() { //syslog(LOG_DEBUG, "Receive a auto-connect signal to reconnect wifi"); qDebug() << "Receive a auto-connect signal to reconnect wifi"; if (mw->isRadioWifiTurningOn) { qDebug() << "But it is turning wifi switch on now, stop to reconnect wifi"; } else { mw->toReconnectWifi(); } } //获取是否连接有线网网线 void KylinDBus::getPhysicalCarrierState() { qDebug()<<"Enter function to get physical carrier state."; multiWiredCableState.clear(); foreach (QDBusObjectPath localPath, multiWiredPaths) { QDBusInterface interface( "org.freedesktop.NetworkManager", localPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); //Carrier值为true,插了网线;为false,未插网线 QDBusReply reply = interface.call("Get", "org.freedesktop.NetworkManager.Device.Wired", "Carrier"); try { if (reply.value().toString() == "true") { qDebug()<<"multiWiredCableState.append(true)"; multiWiredCableState.append("true"); } else if (reply.value().toString() == "false") { qDebug()<<"multiWiredCableState.append(false)"; multiWiredCableState.append("false"); } else { throw -1; //出现异常 } } catch(...) { qDebug()<<"Error occurred when get the property 'Carrier' of Wired"; } } isWiredCableOn = false; foreach (QString state, multiWiredCableState) { if (state == "true") { isWiredCableOn = true; } } } //有线网属性变化时,执行该函数。由于可能在短时间收到几条相同属性变化信息,所以在短时间内,执行一次 void KylinDBus::onLanPropertyChanged(QVariantMap qvm) { for(QString keyStr : qvm.keys()) { if (keyStr == "Carrier") { qDebug()<<"[PropertiesChanged] kylin-nm receive a signal PropertiesChanged about Carrier state."; QString carrierStateString = qvm.value("Carrier").toString(); if (carrierStateString == "true") { this->mw->onPhysicalCarrierChanged(true); } else if(carrierStateString == "false") { this->mw->onPhysicalCarrierChanged(false); } } } } //有线网的Ip属性变化时的响应函数 void KylinDBus::onLanIpPropertiesChanged() { if (!mw->isHandlingWiredCableOn) { QTimer::singleShot(0.5 * 1000, this, [ = ]() { //防止卡顿,延时一小段时间后再发信号 emit this->updateWiredList(0); }); // emit this->updateWiredList(0); } } //无线网的Ip属性变化时的响应函数 void KylinDBus::onWifiIpPropertiesChanged() { if (mw->is_stop_check_net_state) { return; } emit this->updateWirelessList(); } //利用dbus的方法对已经连接的有线网进行再次连接 void KylinDBus::reConnectWiredNet(QString netUuid) { QDBusInterface m_interface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings", "org.freedesktop.NetworkManager.Settings", QDBusConnection::systemBus() ); QDBusReply> m_reply = m_interface.call("ListConnections"); QDBusObjectPath specific_connection; specific_connection.setPath("/"); QList m_objSettingPaths = m_reply.value(); foreach (QDBusObjectPath objSettingPath, m_objSettingPaths) { QDBusInterface m_interface("org.freedesktop.NetworkManager", objSettingPath.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage result = m_interface.call("GetSettings"); if (result.arguments().isEmpty()) { continue; } const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); QMap> map; dbusArg1st >> map; for (QString outside_key : map.keys() ) { QMap outsideMap = map.value(outside_key); if (outside_key == "connection") { for (QString search_key : outsideMap.keys()) { if (search_key == "uuid") { if (netUuid == outsideMap.value(search_key).toString()) { QDBusInterface conn_interface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.NetworkManager", QDBusConnection::systemBus() ); QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); //获取已经连接了那些网络,及这些网络对应的网络类型(ethernet or wifi) QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "ActiveConnections"); if (result.arguments().isEmpty()) { continue; } QList outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath connWiredDivicePath; //已经连接的有线网对应的device路径 QDBusObjectPath objPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> objPath; QDBusInterface interfacePro( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interfacePro.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Type"); if (reply.value().toString() == "ethernet" || reply.value().toString() == "802-3-ethernet") { //先获取已连接有线网络对应的设备路径 QDBusInterface interfaceConn( "org.freedesktop.NetworkManager", objPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage replyConn = interfaceConn.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Devices"); if (replyConn.arguments().isEmpty()) { continue; } QList outArgsIp4 = replyConn.arguments(); QVariant firstIp4 = outArgsIp4.at(0); QDBusVariant dbvFirstIp4 = firstIp4.value(); QVariant vFirstIp4 = dbvFirstIp4.variant(); const QDBusArgument &dbusArgIpv4 = vFirstIp4.value(); QList mDatasIpv4; dbusArgIpv4 >> mDatasIpv4; connWiredDivicePath = mDatasIpv4.at(0); //qDebug() << "xxxxxxxxxxxxxxxxxxxxxxxxxx" << mDatasIpv4.at(0).path(); } } dbusArgs.endArray(); /* * 获取到所需的信息后,接下来进行连接 * conn_interface.call("ActivateConnection" 用到的参数 * 1. QVariant::fromValue(objSettingPath) 有线网络对应的Setting Path * 2. QVariant::fromValue(connWiredDivicePath) 有线网络对应的Devices Path * 3. QVariant::fromValue(specific_connection) 其他选项路径,可设置为"/" */ QDBusReply connectionReply = conn_interface.call("ActivateConnection", QVariant::fromValue(objSettingPath), QVariant::fromValue(connWiredDivicePath), QVariant::fromValue(specific_connection)); } } } } } // end for(QString outside_key : map.keys() ) } //end foreach (QDBusObjectPath objSettingPath, m_objSettingPaths) } //利用dbus的方法连接有线网 bool KylinDBus::toConnectWiredNet(QString netUuid, QString netIfName) { bool isConnectUp = false; //是否连接上 QDBusInterface m_interface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings", "org.freedesktop.NetworkManager.Settings", QDBusConnection::systemBus() ); QDBusReply> m_reply = m_interface.call("ListConnections"); QDBusObjectPath specific_connection; specific_connection.setPath("/"); QList m_objSettingPaths = m_reply.value(); foreach (QDBusObjectPath objSettingPath, m_objSettingPaths) { QDBusInterface m_interface("org.freedesktop.NetworkManager", objSettingPath.path(), "org.freedesktop.NetworkManager.Settings.Connection", QDBusConnection::systemBus()); QDBusMessage result = m_interface.call("GetSettings"); if (result.arguments().isEmpty()) { continue; } const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); QMap> map; dbusArg1st >> map; for (QString outside_key : map.keys() ) { QMap outsideMap = map.value(outside_key); if (outside_key == "connection") { for (QString search_key : outsideMap.keys()) { if (search_key == "uuid") { if (netUuid == outsideMap.value(search_key).toString()) { QDBusInterface connInterface("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.NetworkManager", QDBusConnection::systemBus() ); //获取对应的设备路径 QDBusObjectPath connWiredDivicePath; connWiredDivicePath.setPath("/"); QDBusInterface interfaceDevice( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusMessage resultDevice = interfaceDevice.call("Get", "org.freedesktop.NetworkManager", "AllDevices"); if (resultDevice.arguments().isEmpty()) { continue; } QList outArgsDevice = resultDevice.arguments(); QVariant firstDevice = outArgsDevice.at(0); QDBusVariant dbvFirstDevice = firstDevice.value(); QVariant vFirstDevice = dbvFirstDevice.variant(); QDBusArgument dbusArgsDevice = vFirstDevice.value(); QDBusObjectPath objPathDevice; dbusArgsDevice.beginArray(); while (!dbusArgsDevice.atEnd()) { dbusArgsDevice >> objPathDevice; QDBusInterface interfaceInterfaceDevice( "org.freedesktop.NetworkManager", objPathDevice.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyInterfaceDevice = interfaceInterfaceDevice.call("Get", "org.freedesktop.NetworkManager.Device", "Interface"); if (replyInterfaceDevice.value().toString() == netIfName) { connWiredDivicePath = objPathDevice; } } dbusArgsDevice.endArray(); //下面执行连接网络 QDBusReply connectionReply = connInterface.call("ActivateConnection", QVariant::fromValue(objSettingPath), QVariant::fromValue(connWiredDivicePath), QVariant::fromValue(specific_connection)); if (!connectionReply.value().path().isEmpty()) { isConnectUp = true; } } } } } } // end for(QString outside_key : map.keys() ) } //end foreach (QDBusObjectPath objSettingPath, m_objSettingPaths) return isConnectUp; } //要求底层的驱动进行扫描AP void KylinDBus::requestScanWifi() { if (multiWirelessPaths.size() == 0) return; qRegisterMetaType>("QMap"); qDBusRegisterMetaType>(); QDBusInterface interface( "org.freedesktop.NetworkManager", multiWirelessPaths.at(0).path(), "org.freedesktop.NetworkManager.Device.Wireless", QDBusConnection::systemBus() ); QMap my_map; my_map = {}; interface.call("RequestScan", my_map); } //显示桌面通知 void KylinDBus::showDesktopNotify(QString message) { emit requestSendDesktopNotify(message); } //获取任务栏位置,上下左右 int KylinDBus::getTaskBarPos(QString str) { QDBusInterface interface( "com.ukui.panel.desktop", "/", "com.ukui.panel.desktop", QDBusConnection::sessionBus() ); QDBusReply reply = interface.call("GetPanelPosition", str); if (reply.isValid()) { return reply; } else { return 0; //如果没有成功获取,返回一个默认值 } } //获取任务栏高度 int KylinDBus::getTaskBarHeight(QString str) { QDBusInterface interface( "com.ukui.panel.desktop", "/", "com.ukui.panel.desktop", QDBusConnection::sessionBus() ); QDBusReply reply = interface.call("GetPanelSize", str); if (reply.isValid()) { return reply; } else { return 46; //如果没有成功获取,返回一个默认值 } } /////////////////////////////////////////////////////////////////////////////// //下方使用Gsetting 进程通信方法 //创建获取任务栏信息的GSetting对象 void KylinDBus::initTaskbarGsetting() { if (QGSettings::isSchemaInstalled("org.ukui.panel.settings")) { m_tastbar_gsettings = new QGSettings("org.ukui.panel.settings"); } } //使用GSetting方法获取任务栏高度 int KylinDBus::getTaskbarHeight() { if (!m_tastbar_gsettings) { return 46; } QStringList keys = m_tastbar_gsettings->keys(); if (keys.contains("panelsize")) { int hh = m_tastbar_gsettings->get("panelsize").toInt(); return hh; } else { return 46; } } //使用GSetting方法获取任务栏位置,上下左右 int KylinDBus::getTaskbarPos() { if (!m_tastbar_gsettings) { return 0; } QStringList keys = m_tastbar_gsettings->keys(); if (keys.contains("panelposition")) { int pp = m_tastbar_gsettings->get("panelposition").toInt(); return pp; } else { return 0; } } //创建监听wifi打开或关闭信息的GSetting对象 void KylinDBus::getWifiSwitchState() { if (QGSettings::isSchemaInstalled("org.ukui.control-center.wifi.switch")) { m_gsettings = new QGSettings("org.ukui.control-center.wifi.switch"); // 监听key的value是否发生了变化 connect(m_gsettings, &QGSettings::changed, this, [=] (const QString &key) { if (key == "switch") { if (isWirelessCardOn) { bool judge = getSwitchStatus(key); if (judge) { mw->onBtnWifiClicked(2); //打开wifi开关 qDebug()<<"receive a signal to turn on wifi switch from control-center"; } else { mw->onBtnWifiClicked(3); //关闭wifi开关 qDebug()<<"receive a signal to turn off wifi switch from control-center"; } } } }); } } //收到控制面板发来的消息后,获取wifi开关信息 bool KylinDBus::getSwitchStatus(QString key) { if (!m_gsettings) { return true; } const QStringList list = m_gsettings->keys(); if (!list.contains(key)) { return true; } bool res = m_gsettings->get(key).toBool(); return res; } //通知控制面板wifi开关的信息 void KylinDBus::setWifiSwitchState(bool signal) { if (!m_gsettings) { return ; } const QStringList list = m_gsettings->keys(); if (!list.contains("switchor")) { return ; } m_gsettings->set("switchor",signal); } //通知控制面板无线网卡的状态信息 void KylinDBus::setWifiCardState(bool signal) { if (!m_gsettings) { return ; } const QStringList list = m_gsettings->keys(); if (!list.contains("wificard")) { return ; } m_gsettings->set("wificard",signal); } //创建获取窗口透明度信息的GSetting的对象 void KylinDBus::initTransparentState() { if (QGSettings::isSchemaInstalled("org.ukui.control-center.personalise")) { m_transparency_gsettings = new QGSettings("org.ukui.control-center.personalise"); } } //使用GSetting获取当前窗口应该使用的透明度 double KylinDBus::getTransparentData() { if (!m_transparency_gsettings) { return 0.7; } QStringList keys = m_transparency_gsettings->keys(); if (keys.contains("transparency")) { double tp = m_transparency_gsettings->get("transparency").toDouble(); return tp; } else { return 0.7; } } kylin-nm/src/utils.h0000644000175000017500000000521214205345374013343 0ustar fengfeng/* * 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 #include #include #include #include #include #include #include #include #include #include /* qt会将glib里的signals成员识别为宏,所以取消该宏 * 后面如果用到signals时,使用Q_SIGNALS代替即可 * #ifdef signals #undef signals #endif extern "C" { #include #include } */ /////////////////////////////////////////////////////////////////////////////// // wifi property struct typedef struct structWifiProperty{ QString objectPath; QString bssid; int priority; }structWifiProperty; /////////////////////////////////////////////////////////////////////////////// // The Utils class, used to do some assist function class Utils : public QObject { Q_OBJECT public: Utils(); static int m_system(char *cmd); public slots: void onRequestSendDesktopNotify(QString message); }; /////////////////////////////////////////////////////////////////////////////// // The UseQssFile class, set control style by using .qss file class UseQssFile { public: static void setStyle(const QString &style) { QString styleName = ":/qss/" + style; QFile qss(styleName); qss.open(QFile::ReadOnly); qApp->setStyleSheet(qss.readAll()); qss.close(); } }; /////////////////////////////////////////////////////////////////////////////// // The NetworkSpeed class, get the network upload and download speed class NetworkSpeed : public QObject { Q_OBJECT public: explicit NetworkSpeed(QObject *parent = nullptr); int getCurrentDownloadRates(char *netname,long int * save_rate,long int * tx_rate); //获取当前的流量,参数为将获取到的流量保 }; #endif // UTILS_H kylin-nm/src/wificonfigdialog.ui0000644000175000017500000000542614205345374015704 0ustar fengfeng 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 kylin-nm/src/backthread.h0000644000175000017500000000713014205345374014274 0ustar fengfeng/* * 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 #include #include #define CONFIG_FILE_PATH QDir::homePath() + "/.config/ukui/kylin-nm.conf" #define WIFI_SWITCH_OPENED "wifi_switch_opened" #define LAN_SWITCH_OPENED "lan_switch_opened" #define DEVICE_CONNECTED 0 #define DEVICE_DISCONNECTED 1 #define DEVICE_UNMANAGED 2 #define DEVICE_CONNECTING 3 #define DEVICE_UNAVALIABLE 4 #define PSKFLAG 0 class IFace{ public: QString lname; QString wname; QStringList lcards; QStringList wcards; int lstate; // 0已连接 1未连接 2已关闭 int wstate; // 0已连接 1未连接 2已关闭 bool lmanaged; }; class BackThread : public QObject { Q_OBJECT public: explicit BackThread(QObject *parent = nullptr); ~BackThread(); static IFace* execGetIface(); static void saveSwitchButtonState(const QString &key, const QVariant &value); static QVariant getSwitchState(const QString &key); static void saveWiredConnectUuid(const QString &key, const QVariant &value); static QVariant getWiredConnectUuid(const QString &key); static void clearWiredConnectUuid(); QString getConnProp(QString connName); static QString execChkLanWidth(QString ethName); void getTheWifiCardName(); QProcess *cmdProcessWifi = nullptr; QProcess *cmdProcessLan; QString currConnLanUuid; QString currConnLanType; QList wifiCardPaths; QString wifiIfnameInUse; public slots: void execEnNet(); void execDisNet(); void execEnWifi(); void rfKillexecEnWifi(); void execDisWifi(); void rfkillExecDisWifi(); void execConnLan(QString connName, QString ifname, QString connectType); void execConnWifi(QString connName, QString connIfName); void execReconnWIfi(QString uuid); void execConnWifiPWD(QString connName, QString password, QString connType, QString security, QString ifname); void execConnWifiPsk(QString cmd); void execConnHiddenWifiWPA(int secuType, QString connName, QString password); void execConnRememberedHiddenWifi(QString connName); void disConnSparedNetSlot(QString type); void disConnLanOrWifi(QString type); void onReadOutputWifi(); void onReadErrorWifi(); void dellConnectWifiResult(QString info); void onReadOutputLan(); void onReadErrorLan(); void dellConnectLanResult(QString info); void getInitStatus(); signals: void enNetDone(); void disNetDone(); void enWifiDone(); void enWifiDoneByRfkill(); void disWifiDone(); void disWifiDoneByRfkill(); void wifiStatus(bool status); void getWifiStatusComplete(); void connDone(int connFlag); void btFinish(); void btFinishByRfkill(); }; #endif // BACKTHREAD_H kylin-nm/src/ksimplenm.h0000644000175000017500000000373214205345374014207 0ustar fengfeng/* * 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 class KSimpleNM : public QObject { Q_OBJECT public: explicit KSimpleNM(QObject *parent = nullptr); ~KSimpleNM(); // QProcess *runProcessLan; // QProcess *runProcessWifi; // QProcess *runProcessConn; QString shellOutputLan; QString shellOutputWifi; QString shellOutputConn; bool isExecutingGetLanList = false; //是否正在执行获取有线网列表 bool isExecutingGetWifiList = false; //是否正在执行获取无线网列表 bool isUseOldLanSlist = false; //是否应该要用上一次获取的有线列表 bool isUseOldWifiSlist = false; //是否应该要用上一次获取的有线列表 void execGetLanList(); void execGetWifiList(const QString& wname); void execGetConnList(); signals: void getLanListFinished(QStringList slist); void getWifiListFinished(QStringList slist); void getConnListFinished(QStringList slist); void requestRevalueUpdateWifi(); public slots: // void readProcessLan(); // void readProcessWifi(); // void readProcessConn(); // void finishedProcessLan(int msg); // void finishedProcessWifi(int msg); // void finishedProcessConn(int msg); }; #endif // KSIMPLENM_H kylin-nm/src/kylin-dbus-interface.h0000644000175000017500000001237014205345444016223 0ustar fengfeng/* * 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 #include #include #include #include #include #include #include #define WIFI_CONNECTING 1 #define WIFI_CONNECTED 2 #define WIFI_DISCONNECTED 3 class MainWindow; class Utils; class KylinDBus : public QObject { Q_OBJECT public: explicit KylinDBus(MainWindow *mw = 0, QObject *parent = nullptr); ~KylinDBus(); void getObjectPath(); int getAccessPointsNumber(); int getWiredNetworkNumber(); QStringList getWifiSsidList(); QString checkHasWifiConfigFile(QString wifiName); void showDesktopNotify(QString message); void initConnectionInfo(); QList getAtiveLanSsidUuidState(); void disConnectWiredConnect(); QString getActiveWifiUuid(); QList getAtiveWifiBSsidUuid(QStringList wifilist); void reConnectWiredNet(QString netUuid); bool toConnectWiredNet(QString netUuid, QString netIfName); void getConnectNetIp(QString netUuid); void getLanIpChanged(); void onWiredSettingNumChanged(); int getTaskBarPos(QString str); int getTaskBarHeight(QString str); void initTaskbarGsetting(); int getTaskbarHeight(); int getTaskbarPos(); void getWifiSwitchState(); bool getSwitchStatus(QString key); void setWifiSwitchState(bool signal); void setWifiCardState(bool signal); void initTransparentState(); double getTransparentData(); int checkWifiConnectivity(); bool checkNetworkConnectivity(); QStringList getActiveWifiSignal(); QString getWifiSsid(QString accessPointPath); void toGetWifiList(); int getNetworkConectivity(); QDBusObjectPath wirelessPath; //无线设备的路径 QList multiWirelessPaths; //Wireless Device的对象路径列表 QList multiWiredPaths; //Wired Device的对象路径列表 QList multiWiredCableState;//多有线网卡的情况,判断有线网卡对应网线是否插入 QList multiWiredMac; //对应有线网卡的Mac地址 QList multiWiredIfName; //对应有线网的接口 bool isWiredCableOn = false; //是否插入了网线 bool isWirelessCardOn = false; //是否插入了无线网卡 QString dbusLanIpv4 = ""; QString dbusLanIpv6 = ""; QString dbusLanIpv6Method = ""; QString dbusWifiIpv4Method = ""; QString dbusWifiIpv6Method = ""; QString dbusActiveLanIpv4 = ""; QString dbusActiveLanIpv6 = ""; QString dbusActiveWifiIpv4 = ""; QString dbusActiveWifiIpv6 = ""; QString dbusWifiIpv4 = ""; QString dbusWifiIpv6 = ""; QString dbusLanGateway = ""; QString dbusWiFiCardName = ""; QString dbusWifiMac = ""; QString dbusIfName; QString dbusMacDefault; int dbusActLanDNS; bool oldWifiSwitchState; //上一次获取到的wifi开关状态 public slots: void onNewConnection(QDBusObjectPath objPath); void onConnectionRemoved(QDBusObjectPath objPath); void toCreateNewLan(); bool getWiredCableStateByIfname(QString ifname); QString getConnLanNameByIfname(QString ifname); void onPropertiesChanged(QVariantMap qvm); void onAutoConnect(); void onLanPropertyChanged(QVariantMap qvm); void onLanIpPropertiesChanged(); void onWifiIpPropertiesChanged(); void getPhysicalCarrierState(); void getLanHwAddressState(); void getWiredCardName(); void getWirelessCardName(); void getLanIpDNS(QString uuidName, bool isActNet); void getWifiIp(QString uuid); QString getLanMAC(QString ifname); void getWifiMac(QString netName); void requestScanWifi(); private: MainWindow *mw; Utils *mUtils; QThread *mUtilsThread; QList oldPaths; //已连接网络的对象路径列表 QList oldSettingPaths; //保存之前的路径 QStringList oldPathInfo; //某个已连接网络对象路径对应的网络类型(ethernet or wifi) QGSettings *m_tastbar_gsettings = nullptr; QGSettings *m_gsettings = nullptr; QGSettings *m_transparency_gsettings = nullptr; QStringList m_lanPathList;//有线网dbuspath列表 signals: void updateWiredList(int n); void updateWirelessList(); void requestSendDesktopNotify(QString message); void newConnAdded(int type); void toGetWifiListFinished(QStringList slist); }; #endif // KYLINDBUSINTERFACE_H kylin-nm/src/kylin-network-interface.c0000644000175000017500000007073414205345444016762 0ustar fengfeng/* * 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 #include #include #include #include #include //获取网络接口名 ifname *kylin_network_get_ifacename() { int i = 0; int sockfd; struct ifconf ifconf; struct ifreq *ifreq; unsigned char buf[1024]; //初始化ifconf ifconf.ifc_len = 1024; //字符串指针ifconf.ifc_buf指向buf ifconf.ifc_buf = buf; if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { perror("socket error"); return 0; } //获取所有接口信息 ioctl(sockfd, SIOCGIFCONF, &ifconf); // printf("%s\n",ifconf.ifc_buf); //逐个获取Ip地址 //结构体指针ifreq指向buf,即ifconf.ifc_buf ifreq = (struct ifreq*)buf; int number=ifconf.ifc_len/sizeof(struct ifreq); // printf("%d\n",number); ifname *ifn=(ifname *)malloc(sizeof(ifname)*(number+1)); for(i = number; i>0; i--) { // printf("name = [%s] \n",ifreq->ifr_name); int j=number-i; ifn[j].if_name=(char *)malloc(sizeof(char)*10); strcpy(ifn[j].if_name,ifreq->ifr_name); // ifn[j].if_name=ifreq->ifr_name; // printf("if_name[%d]:%s\n",j,if_name[j]); ifreq++; } ifn[number].if_name=NULL; return ifn; } //获取所有网络连接 conlist *kylin_network_get_conlist_info() { int status = system("nmcli connection show > /tmp/conlist.txt"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'kylin_network_get_conlist_info' failed");} char *filename="/tmp/conlist.txt"; FILE *confp; int connum=0; char ConStrLine[1024]; if((confp=fopen(filename,"r"))==NULL) { printf("error!"); } fgets(ConStrLine,1024,confp); while(!feof(confp)) { fgets(ConStrLine,1024,confp); connum++; } // printf("%d\n",connum); fclose(confp); conlist *clist=(conlist *)malloc(sizeof(conlist)*connum); int count=0; FILE *fp; char StrLine[1024]; if((fp=fopen(filename,"r"))==NULL) { printf("error!"); } fgets(StrLine,1024,fp); while(!feof(fp)) { if(count==connum-1)break; fgets(StrLine,1024,fp); char *index=StrLine; char conname[256]; //截取连接名称 int num=0; for(index;*index!='\n';index++) { if(*index==' ') { if(*(index+1)==' ') break; } num++; } // printf("连接名称长度:%d\n",num); clist[count].con_name=(char *)malloc(sizeof(char)*(num+1)); strncpy(conname,StrLine,num+1); conname[num]='\0'; strncpy(clist[count].con_name,conname,num+1); // printf("%s\n",clist[count].con_name); //截取连接类型 char type[256]; for(index;*index!='\n';index++) { if(*index==' ') { if(*(index+1)=' ') if(*(index+2)!=' ') break; } } char *index1=index+2; for(index1;*index1!='\n';index1++) { if(*index1==' ') { if(*(index1+1)==' ') break; } } int num1=0; char *index2=index1+2; for(index2;*index2!='\n';index2++) { if(*index2==' ')break; num1++; } clist[count].type=(char *)malloc(sizeof(char)*(num1+1)); strncpy(type,index1+2,num1+1); type[num1]='\0'; strncpy(clist[count].type,type,num1+1); // printf("%s\n",clist[count].type); count++; } fclose(fp); clist[count].con_name=NULL; clist[count].type=NULL; return clist; } //获取当前活动网络连接 activecon *kylin_network_get_activecon_info() { struct passwd *pwd; pwd = getpwuid(getuid()); char *name = pwd->pw_name; char *tmpPrefix = "/tmp/kylin-nm-activecon-"; char *chr = "nmcli connection show -active > "; char *cmd; asprintf(&cmd, "%s%s%s", chr, tmpPrefix, name); char *path; asprintf(&path, "%s%s", tmpPrefix, name); int status = system(cmd); if (status != 0) syslog(LOG_ERR, "execute 'nmcli connection show -active' in function 'kylin_network_get_activecon_info' failed"); free(cmd); char *filename = path; FILE *activefp; int activenum=0; char activeStrLine[1024]; if((activefp=fopen(filename,"r"))==NULL) { printf("error!"); } fgets(activeStrLine,1024,activefp); while(!feof(activefp)) { fgets(activeStrLine,1024,activefp); activenum++; } // printf("%d\n",activenum); fclose(activefp); activecon *activelist=(activecon *)malloc(sizeof(activecon)*activenum); int count=0; FILE *fp; char StrLine[1024]; if((fp=fopen(filename,"r"))==NULL) { printf("error!"); } free(path); fgets(StrLine,1024,fp); while(!feof(fp)) { if(count==activenum-1)break; fgets(StrLine,1024,fp); char *index=StrLine; char conname[256]; //截取连接名称 int num=0; for(index;*index!='\n';index++) { if(*index==' ') { if(*(index+1)==' ') break; } num++; } // printf("连接名称长度:%d\n",num); activelist[count].con_name=(char *)malloc(sizeof(char)*(num+1)); strncpy(conname,StrLine,num+1); conname[num]='\0'; strncpy(activelist[count].con_name,conname,num+1); // printf("%s\n",activelist[count].con_name); //截取连接类型 char type[256]; for(index;*index!='\n';index++) { if(*index==' ') { if(*(index+1)=' ') if(*(index+2)!=' ') break; } } char *index1=index+2; for(index1;*index1!='\n';index1++) { if(*index1==' ') { if(*(index1+1)==' ') break; } } int num1=0; char *index2=index1+2; for(index2;*index2!='\n';index2++) { if(*index2==' ')break; num1++; } activelist[count].type=(char *)malloc(sizeof(char)*(num1+1)); strncpy(type,index1+2,num1+1); type[num1]='\0'; strncpy(activelist[count].type,type,num1+1); // printf("%s\n",activelist[count].type); //截取连接所属设备 char *index3=index2; char dev[256]; for(index3;*index3!='\n';index3++) { if(*index3==' ') { if(*(index3+1)!=' ') break; } } int num2=0; char *index4=index3+1; for(index4;*index4!='\n';index4++) { if(*index4==' ')break; num2++; } activelist[count].dev=(char *)malloc(sizeof(char)*(num2+1)); strncpy(dev,index3+1,num2+1); dev[num2]='\0'; strncpy(activelist[count].dev,dev,num2+1); // printf("%s\n",activelist[count].dev); count++; } fclose(fp); activelist[count].con_name=NULL; activelist[count].type=NULL; activelist[count].dev=NULL; return activelist; } //创建新的以太网连接 void kylin_network_create_new_ethernet(char *con_name,char *if_name) { char str[256]; char *net_type="ethernet"; sprintf(str,"nmcli connection add con-name '%s' ifname '%s' type %s",con_name,if_name,net_type); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection add con-name' in function 'kylin_network_create_new_ethernet' failed");} } // 创建新的wifi连接配置 void kylin_network_create_new_wifi(char *con_name, char *if_name) { char str[200]; sprintf(str, "nmcli connection add con-name '%s' ifname '%s' type wifi ssid '%s'", con_name, if_name, con_name); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection add con-name' in function 'kylin_network_create_new_wifi' failed");} } //删除以太网连接 void kylin_network_del_ethernet_con(char *con_name) { char str[256]; sprintf(str,"nmcli connection delete '%s'",con_name); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection delete' in function 'kylin_network_del_ethernet_con' failed");} } //设置动态分配ip void kylin_network_set_automethod(char *con_uuid,char *con_name) { char str[256]; char *automethod="auto"; if (con_name && *con_name!='\0') { sprintf(str,"nmcli connection modify '%s' connection.id %s ipv4.method %s ipv6.method %s",con_uuid,con_name,automethod,automethod); } else { sprintf(str,"nmcli connection modify '%s' ipv4.method %s ipv6.method %s",con_uuid,automethod,automethod); } int status = system(str); if (status != 0) { syslog(LOG_ERR, "execute 'nmcli connection modify' in function 'kylin_network_set_automethod' failed"); } else { syslog(LOG_ERR, "AUTO success: %s", str); } } //设置动态分配ipv6地址 void kylin_network_set_ipv6_automethod(char *con_name) { char str[256]; char *automethod="auto"; sprintf(str,"nmcli connection modify '%s' ipv6.method %s ipv6.address ''",con_name,automethod); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection modify' in function 'kylin_network_set_ipv6_automethod' failed");} } //设置手动分配ip void kylin_network_set_manualmethod(char *con_name,char *ip) { char str[256]; char *method="manual"; sprintf(str,"nmcli connection modify '%s' ipv4.method %s ipv4.address '%s'",con_name,method,ip); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection modify' in function 'kylin_network_set_manualmethod' failed");} } //设置手动分配ipv6地址 void kylin_network_set_ipv6_manualmethod(char *con_name,char *ip) { char str[256]; char *method="manual"; sprintf(str,"nmcli connection modify '%s' ipv6.method %s ipv6.address '%s'",con_name,method,ip); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection modify' in function 'kylin_network_set_ipv6_manualmethod' failed");} } // 设置手动分配all void kylin_network_set_manualall(char *con_name, char *addr, char *mask, char *gateway, char *dns) { char str[200]; sprintf(str, "nmcli connection modify '%s' ipv4.method manual ipv4.address %s/%s ipv4.gateway '%s' ipv4.dns '%s'", con_name, addr, mask, gateway, dns); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection modify' in function 'kylin_network_set_manualall' failed");} } void kylin_network_set(char *con_uuid ,char *con_name, char *ipv4_addr, char *mask, char *gateway, char *dns,char *ipv6_ip) { char str[500] = {0}; char *head = "nmcli connection modify "; strcpy(str, head); strcat(str, con_uuid); if (con_name && *con_name!='\0') { char *name = " connection.id "; strcat(str, name); strcat(str, "'"); strcat(str, con_name); strcat(str, "'"); } if (ipv4_addr && *ipv4_addr!='\0') { char *method = " ipv4.method manual"; strcat(str, method); char *addr = " ipv4.address "; strcat(str, addr); strcat(str, ipv4_addr); char *m = "/"; strcat(str, m); strcat(str, mask); if (gateway && *gateway!='\0') { char *g = " ipv4.gateway "; strcat(str, g); strcat(str, gateway); } if (dns && *dns!='\0') { char *d = " ipv4.dns "; strcat(str, d); strcat(str, dns); } } else { char *method = " ipv4.method auto"; strcat(str, method); } if (ipv6_ip && *ipv6_ip!='\0') { char *ip = " ipv6.method manual ipv6.address "; strcat(str, ip); strcat(str, ipv6_ip); syslog(LOG_DEBUG, "[kylin-nm interface5] %s",str); } else { char *ip = " ipv6.method auto"; strcat(str, ip); syslog(LOG_DEBUG, "[kylin-nm interface5] %s",str); } int status = system(str); if (status != 0) { syslog(LOG_ERR, "MANUALALL FAIL!"); } else { syslog(LOG_DEBUG, "MANUALALL success: '%s'", str); } } //设置是否自动连接 void kylin_network_set_autoconnect(char *con_name,bool autocon) { char str[256]; if(autocon==false) { char *ac="no"; sprintf(str,"nmcli connection modify '%s' connection.autoconnect %s",con_name,ac); } else{ char *ac="yes"; sprintf(str,"nmcli connection modify '%s' connection.autoconnect %s",con_name,ac); } int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection modify' in function 'kylin_network_set_autoconnect' failed");} } //修改ip void kylin_network_mod_ip(char *con_name,char *ip) { char str[256]; sprintf(str,"nmcli connection modify '%s' ipv4.address %s",con_name,ip); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection modify' in function 'kylin_network_mod_ip' failed");} } //修改网关 void kylin_network_mod_gateway(char *con_name,char *gw) { char str[256]; sprintf(str,"nmcli connection modify '%s' ipv4.gateway %s",con_name,gw); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection modify' in function 'kylin_network_mod_gateway' failed");} } //修改dns void kylin_network_mod_dns(char *con_name,char *dns) { char str[256]; sprintf(str,"nmcli connection modify '%s' ipv4.dns %s",con_name,dns); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection modify' in function 'kylin_network_mod_dns' failed");} } //连接以太网 void kylin_network_set_con_up(char *con_name) { char str[256]; sprintf(str,"nmcli connection up '%s'",con_name); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection up' in function 'kylin_network_set_con_up' failed");} } //断开以太网 void kylin_network_set_con_down(char *con_name) { char str[256]; sprintf(str,"nmcli connection down '%s'",con_name); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection down' in function 'kylin_network_set_con_down' failed");} } //连接wifi void kylin_network_set_wifi_up(char *con_name,char *passwd) { char str[256]; sprintf(str,"export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli device wifi connect '%s' password '%s'", con_name,passwd); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli device wifi connect' in function 'kylin_network_set_wifi_up' failed");} } //断开wifi连接 void kylin_network_set_wifi_down(char *if_name) { char str[256]; snprintf(str,sizeof(str),"nmcli device disconnect '%s'",if_name); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli device disconnect' in function 'kylin_network_set_wifi_down' failed");} } //获取wifi列表信息 wifilist *kylin_network_get_wifilist_info() { int status = system("nmcli device wifi > /tmp/wflist.txt"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli device wifi' in function 'kylin_network_get_wifilist_info' failed");} char *filename="/tmp/wflist.txt"; FILE *wffp; int wfnum=0; char WfStrLine[1024]; if((wffp=fopen(filename,"r"))==NULL) { printf("error!"); } fgets(WfStrLine,1024,wffp); while(!feof(wffp)) { fgets(WfStrLine,1024,wffp); wfnum++; } // printf("wifi数量:%d\n",wfnum); fclose(wffp); //wifi实际数量是wfnum-1 wifilist *wflist=(wifilist *)malloc(sizeof(wifilist)*wfnum); int count=0; FILE *fp; char StrLine[1024]; if((fp=fopen(filename,"r"))==NULL) { printf("error!"); } fgets(StrLine,1024,fp); while(!feof(fp)) { if(count==wfnum-1)break; fgets(StrLine,1024,fp); // printf("%s\n",StrLine+3); char *index=StrLine+3; //截取ssid char *str1="Infra"; int num=0; for(index;strcmp(index+5,"\n")!=0;index++) { int result=strncmp(index,str1,5); if(result==0) { // printf("%s\n",index); break; } num++; } char ssid[256]; char *ssidindex=index-1; int ssidnum=0; for(ssidindex;*ssidindex==' ';ssidindex--)ssidnum++; // printf("空格数量:%d\n",ssidnum); // if(ssidnum==1) strncpy(ssid,StrLine+3,num-1); ssid[num-ssidnum]='\0'; // printf("-6666--%s---\n",ssid); wflist[count].ssid=(char *)malloc(sizeof(char)*(num-ssidnum)); strncpy(wflist[count].ssid,ssid,num-ssidnum+1); // printf("第%d个:%s ",count,wflist[count].ssid); //截取信号强度 char *str2="Mbit/s"; for(index;strcmp(index+6,"\n")!=0;index++) { int result=strncmp(index,str2,6); if(result==0) { // printf("%s\n",index); break; } } char signal[10]; char *signalindex=index+8; int signalnum=0; for(signalindex;*signalindex!=' ';signalindex++)signalnum++; strncpy(signal,index+8,signalnum); signal[signalnum]='\0'; // printf("-7777--%s---\n",signal); wflist[count].signal=atoi(signal); // printf("%d ",wflist[count].signal); //截取安全性 char *str3="WPA"; for(index;strcmp(index+3,"\n")!=0;index++) { int result=strncmp(index,str3,3); if(result==0) { // printf("%s\n",index); break; } } char safety[20]; char *safetyindex=index; int safetynum=0; for(safetyindex;strcmp(safetyindex+2,"\n")!=0;safetyindex++) { int result=strncmp(safetyindex," ",2); if(result==0)break; safetynum++; } strncpy(safety,index,safetynum+1); safety[safetynum+1]='\0'; // printf("-8888--%s---\n",safety); wflist[count].safety=(char *)malloc(sizeof(char)*(safetynum+1)); strncpy(wflist[count].safety,safety,safetynum+2); // printf("%s\n",wflist[count].safety); count++; } fclose(fp); wflist[count].ssid=NULL; wflist[count].signal=0; wflist[count].safety=NULL; return wflist; } //启用联网 void kylin_network_enable_networking() { int status = system("nmcli networking on"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli networking on' in function 'kylin_network_enable_networking' failed");} } //禁用联网 void kylin_network_disable_networking() { int status = system("nmcli networking off"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli networking off' in function 'kylin_network_disable_networking' failed");} } //启用wifi void kylin_network_enable_wifi() { int status = system("nmcli radio wifi on;sleep 3"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli radio wifi on' in function 'kylin_network_enable_wifi' failed");} } //禁用wifi void kylin_network_disable_wifi() { int status = system("nmcli radio wifi off;sleep 2"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli radio wifi off' in function 'kylin_network_disable_wifi' failed");} } //获取ip地址 int kylin_network_get_ipaddr(char *if_name,char *ipaddr) { int sock_ip; struct sockaddr_in sin_ip; struct ifreq ifr_ip; if((sock_ip=socket(AF_INET,SOCK_STREAM,0))<0) { perror("sockket error"); return -1; } strcpy(ifr_ip.ifr_name,if_name); if(ioctl(sock_ip,SIOCGIFADDR,&ifr_ip)<0)//直接获取ip地址 { perror("Not setup interface\n"); return -1; } memcpy(&sin_ip,&ifr_ip.ifr_addr,sizeof(sin_ip)); strcpy(ipaddr,inet_ntoa(sin_ip.sin_addr));//#include close(sock_ip); return 0; } //获取广播地址 int kylin_network_get_brdaddr(char *if_name,char *brdaddr) { int sock_brdaddr; struct sockaddr_in sin_brd; struct ifreq ifr_brd; if((sock_brdaddr=socket(AF_INET,SOCK_STREAM,0))<0) { perror("sockket error"); return -1; } strcpy(ifr_brd.ifr_name,if_name); if(ioctl(sock_brdaddr,SIOCGIFBRDADDR,&ifr_brd)<0)//直接获取广播地址 { perror("Not setup interface\n"); return -1; } memcpy(&sin_brd,&ifr_brd.ifr_broadaddr,sizeof(sin_brd)); strcpy(brdaddr,inet_ntoa(sin_brd.sin_addr)); close(sock_brdaddr); return 0; } //获取子网掩码 int kylin_network_get_netmask(char *if_name,char *netmask) { int sock_mask; struct sockaddr_in sin_netmask; struct ifreq ifr_mask; if((sock_mask=socket(AF_INET,SOCK_STREAM,0))<0) { perror("sockket error"); return -1; } strcpy(ifr_mask.ifr_name,if_name); if(ioctl(sock_mask,SIOCGIFNETMASK,&ifr_mask)<0)//直接获取子网掩码 { perror("Not setup interface\n"); return -1; } memcpy(&sin_netmask,&ifr_mask.ifr_netmask,sizeof(sin_netmask)); strcpy(netmask,inet_ntoa(sin_netmask.sin_addr)); close(sock_mask); return 0; } //获取MAC int kylin_network_get_mac(char *if_name,char *macaddr) { int sock_mac; struct ifreq ifr_mac; struct sockaddr_in sin_mac; struct ether_addr ethaddr;//#include sock_mac=socket(AF_INET,SOCK_STREAM,0); strcpy(ifr_mac.ifr_name,if_name); if(-1==ioctl(sock_mac,SIOCGIFHWADDR,&ifr_mac)) { perror("Not setup interface\n"); return -1; } memcpy(ðaddr,&ifr_mac.ifr_hwaddr.sa_data,sizeof(ethaddr)); strcpy(macaddr,ether_ntoa(ðaddr));//#include // strcpy(macaddr,ether_ntoa((struct ether_addr*)ifr_mac.ifr_hwaddr.sa_data)); close(sock_mac); return 0; } //获取MTU int kylin_network_get_mtu(char *if_name) { int sock_mtu; // struct sockaddr_in sin_ip; struct ifreq ifr_MTU; if((sock_mtu=socket(AF_INET,SOCK_STREAM,0))<0) { perror("sockket error"); return -1; } strcpy(ifr_MTU.ifr_name,if_name); if(ioctl(sock_mtu,SIOCGIFMTU,&ifr_MTU)) { perror("Not setup interface\n"); return -1; } int mtu=ifr_MTU.ifr_mtu; // printf("%d\n",ifr_MTU.ifr_mtu); // printf("%d\n",mtu); close(sock_mtu); return mtu; } static void getBuf(char *bufstr) { //O_RDONLY以只读方式打开文件 int fd=open("/proc/net/dev", O_RDONLY); if(-1==fd) { printf("/proc/net/dev not exists!\n"); } char buf[1024*2]; //将读写位置移到文件开头 lseek(fd,0,SEEK_SET); int nBytes=read(fd,buf,sizeof(buf)-1); if(-1==nBytes) { perror("read error"); close(fd); } buf[nBytes]='\0'; strcpy(bufstr,buf); } //总计上传下载数据量 long *kylin_network_get_bytes(char *if_name) { char buf[1024*2]; getBuf(buf); //返回第一次指向if_name位置的指针 char *pDev=strstr(buf,if_name); if(NULL==pDev) { printf("don't find dev %s\n",if_name); return NULL; } char *p; char *value; int i=0; static long rtbyt[2]; /*去除空格,制表符,换行符等不需要的字段*/ for (p = strtok(pDev, " \t\r\n"); p; p = strtok(NULL, " \t\r\n")) { i++; value = (char*)malloc(20); strcpy(value, p); /*得到的字符串中的第二个字段是接收流量*/ if(i == 2) { rtbyt[0] = atol(value); } /*得到的字符串中的第十个字段是发送流量*/ if(i == 10) { rtbyt[1] = atol(value); break; } free(value); } return rtbyt; } //总计上传下载数据包 long *kylin_network_get_packets(char *if_name) { char buf[1024*2]; getBuf(buf); //返回第一次指向if_name位置的指针 char *pDev=strstr(buf,if_name); if(NULL==pDev) { printf("don't find dev %s\n",if_name); return NULL; } char *p; char *value; int i=0; static long rtpkt[2]; /*去除空格,制表符,换行符等不需要的字段*/ for (p = strtok(pDev, " \t\r\n"); p; p = strtok(NULL, " \t\r\n")) { i++; value = (char*)malloc(20); strcpy(value, p); /*得到的字符串中的第三个字段是接收流量*/ if(i == 3) { rtpkt[0] = atol(value); } /*得到的字符串中的第十一个字段是发送流量*/ if(i == 11) { rtpkt[1] = atol(value); break; } free(value); } return rtpkt; } //总计上传下载错误数据包数量 long *kylin_network_get_errs(char *if_name) { char buf[1024*2]; getBuf(buf); //返回第一次指向if_name位置的指针 char *pDev=strstr(buf,if_name); if(NULL==pDev) { printf("don't find dev %s\n",if_name); return NULL; } char *p; char *value; int i=0; static long rterrs[2]; /*去除空格,制表符,换行符等不需要的字段*/ for (p = strtok(pDev, " \t\r\n"); p; p = strtok(NULL, " \t\r\n")) { i++; value = (char*)malloc(20); strcpy(value, p); /*得到的字符串中的第四个字段是接收流量*/ if(i == 4) { rterrs[0] = atol(value); } /*得到的字符串中的第十二个字段是发送流量*/ if(i == 12) { rterrs[1] = atol(value); break; } free(value); } return rterrs; } //总计上传下载丢弃数据包数量 long *kylin_network_get_drop(char *if_name) { char buf[1024*2]; getBuf(buf); //返回第一次指向if_name位置的指针 char *pDev=strstr(buf,if_name); if(NULL==pDev) { printf("don't find dev %s\n",if_name); return NULL; } char *p; char *value; int i=0; static long rtdrop[2]; /*去除空格,制表符,换行符等不需要的字段*/ for (p = strtok(pDev, " \t\r\n"); p; p = strtok(NULL, " \t\r\n")) { i++; value = (char*)malloc(20); strcpy(value, p); /*得到的字符串中的第五个字段是接收流量*/ if(i == 5) { rtdrop[0] = atol(value); } /*得到的字符串中的第十三个字段是发送流量*/ if(i == 13) { rtdrop[1] = atol(value); break; } free(value); } return rtdrop; } //总计上传下载过载数据包数量 long *kylin_network_get_fifo(char *if_name) { char buf[1024*2]; getBuf(buf); //返回第一次指向if_name位置的指针 char *pDev=strstr(buf,if_name); if(NULL==pDev) { printf("don't find dev %s\n",if_name); return NULL; } char *p; char *value; int i=0; static long rtfifo[2]; /*去除空格,制表符,换行符等不需要的字段*/ for (p = strtok(pDev, " \t\r\n"); p; p = strtok(NULL, " \t\r\n")) { i++; value = (char*)malloc(20); strcpy(value, p); /*得到的字符串中的第六个字段是接收流量*/ if(i == 6) { rtfifo[0] = atol(value); } /*得到的字符串中的第十四个字段是发送流量*/ if(i == 14) { rtfifo[1] = atol(value); break; } free(value); } return rtfifo; } kylin-nm/src/dbusadaptor.h0000644000175000017500000000430314205345374014513 0ustar fengfeng/* * 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 DBUSADAPTOR_H #define DBUSADAPTOR_H #include #include #include QT_BEGIN_NAMESPACE class QByteArray; //template class QList; template class QMap; class QString; class QStringList; class QVariant; template class QVector; QT_END_NAMESPACE /* * Adaptor class for interface com.kylin.weather */ #include "mainwindow.h"//added the code manually by lixiang class DbusAdaptor: public QDBusAbstractAdaptor { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "com.kylin.network") Q_CLASSINFO("D-Bus Introspection", "" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" "") public: DbusAdaptor(MainWindow *parent); virtual ~DbusAdaptor(); inline MainWindow *parent() const { return static_cast(QObject::parent()); } public: // PROPERTIES public Q_SLOTS: // METHODS void showMainWindow(); void showPb(QString type, QString name); void requestRefreshWifiList(); QVector getWifiList(); Q_SIGNALS: // SIGNALS void getWifiListFinished(); void configurationChanged(); void wiredConnectionAdded(); void wiredConnectionRemoved(); void actWiredConnectionChanged(); }; #endif kylin-nm/src/onelancform.cpp0000644000175000017500000004720514205345444015047 0ustar fengfeng/* * 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 OneLancForm::OneLancForm(QWidget *parent, MainWindow *mainWindow, ConfForm *confForm, KSimpleNM *ksnm) : QWidget(parent), ui(new Ui::OneLancForm) { ui->setupUi(this); ui->btnConnSub->setText(tr("Connect"));//"连接" ui->btnConn->setText(tr("Connect"));//"连接" ui->btnDisConn->setText(tr("Disconnect"));//"断开连接" ui->btnCancel->setText(tr("Cancel"));//取消连接 ui->lbConned->setAlignment(Qt::AlignLeft); leQssLow = "QLineEdit{border:none;background:transparent;font-size:14px;}"; leQssHigh = "QLineEdit{border:none;background:transparent;font-size:14px;}"; ui->leInfo_1->setStyleSheet(leQssLow); ui->leInfo_2->setStyleSheet(leQssLow); ui->leInfo_3->setStyleSheet(leQssLow); ui->leInfo_4->setStyleSheet(leQssLow); ui->btnInfo->setStyleSheet("QPushButton{border:none;background:transparent;}"); ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(156,156,156,0.1);}"); ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(156,156,156,0);}"); ui->lbName->setStyleSheet("QLabel{font-size:14px;}"); ui->lbConned->setStyleSheet("QLabel{font-size:14px;}"); ui->btnConnSub->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);color:white;font-size:14px;}" "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}"); ui->btnDisConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);color:white;font-size:14px;}" "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}"); ui->btnConn->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);color:white;font-size:14px;}" "QPushButton:Hover{border:0px solid rgba(255,255,255,0.2);border-radius:4px;background-color:rgba(107,142,235,1);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(50,87,202,1);}"); ui->btnCancel->setStyleSheet("QPushButton{border:none;background:transparent;color:white;font-size:14px;}"); ui->lbWaiting->setStyleSheet("QLabel{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);}"); ui->lbWaitingIcon->setStyleSheet("QLabel{border:0px;background-color:transparent;}"); ui->btnInfo->setCursor(QCursor(Qt::PointingHandCursor)); ui->btnInfo->setFocusPolicy(Qt::NoFocus); ui->btnConnSub->setFocusPolicy(Qt::NoFocus); ui->btnConn->setFocusPolicy(Qt::NoFocus); ui->btnDisConn->setFocusPolicy(Qt::NoFocus); ui->btnCancel->setFocusPolicy(Qt::NoFocus); ui->wbg->hide(); ui->wbg_2->show(); ui->lbName->show(); ui->btnConnSub->hide(); ui->btnConn->hide(); ui->btnDisConn->hide(); ui->btnCancel->hide(); ui->line->show(); ui->lbWaiting->hide(); ui->lbWaitingIcon->hide(); this->mw = mainWindow; this->cf = confForm; this->ks = ksnm; this->isSelected = false; this->isActive = false; this->setAttribute(Qt::WA_Hover,true); this->installEventFilter(this); ui->btnInfo->setAttribute(Qt::WA_Hover,true); ui->btnInfo->installEventFilter(this); this->waitTimer = new QTimer(this); connect(waitTimer, SIGNAL(timeout()), this, SLOT(waitAnimStep())); connect(mw, SIGNAL(waitLanStop()), this, SLOT(stopWaiting())); connect(mw, &MainWindow::lanClicked, this, [ = ](QString name) { if (QString::compare(name, this->ssidName) == 0 && !this->isActive) { on_btnConn_clicked(); } }); ui->btnConn->setShortcut(Qt::Key_Return);//将字母区回车键与连接按钮绑定在一起 ui->btnConnSub->setShortcut(Qt::Key_Return);//点击连接按钮触发回车键 srand((unsigned)time(NULL)); } OneLancForm::~OneLancForm() { delete ui; } void OneLancForm::mousePressEvent(QMouseEvent *) { emit selectedOneLanForm(ssidName, uuidName);//避免重名情况 } //事件过滤器 bool OneLancForm::eventFilter(QObject *obj, QEvent *event) { if (obj == ui->btnInfo) { if(event->type() == QEvent::HoverEnter) { ui->leInfo_1->setStyleSheet(leQssHigh); ui->leInfo_2->setStyleSheet(leQssHigh); ui->leInfo_3->setStyleSheet(leQssHigh); ui->leInfo_4->setStyleSheet(leQssHigh); return true; } else if(event->type() == QEvent::HoverLeave) { ui->leInfo_1->setStyleSheet(leQssLow); ui->leInfo_2->setStyleSheet(leQssLow); ui->leInfo_3->setStyleSheet(leQssLow); ui->leInfo_4->setStyleSheet(leQssLow); return true; } } else if (obj == this) { if (event->type() == QEvent::HoverEnter) { if (!this->isTopItem) { if (!this->isSelected) { ui->btnConn->show(); ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(156,156,156,0.1);}"); ui->wbg_2->show(); } } return true; } else if(event->type() == QEvent::HoverLeave) { ui->btnConn->hide(); ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(156,156,156,0);}"); ui->wbg_2->hide(); return true; } } return QWidget::eventFilter(obj,event); } // 是否当前连接的网络,字体设置不同 void OneLancForm::setAct(bool isAct) { if (isAct) { ui->lbConned->show(); ui->btnConnSub->hide(); } else { ui->lbConned->hide(); ui->btnConnSub->hide(); } isActive = isAct; } // 是否选中 void OneLancForm::setSelected(bool isSelected, bool isCurrName) { if (isSelected) { resize(W_ITEM, H_ITEM_EXTEND); ui->wbg->show(); ui->wbg_2->hide(); ui->line->move(X_LINE_EXTEND, Y_LINE_EXTEND); ui->btnConn->hide(); ui->btnConnSub->show(); this->isSelected = true; } else { resize(W_ITEM, H_ITEM); ui->wbg->hide(); ui->wbg_2->show(); ui->line->move(X_LINE, Y_LINE); if(isCurrName){ ui->btnConn->show(); }else{ ui->btnConn->hide(); } ui->btnConnSub->hide(); this->isSelected = false; } ui->btnDisConn->hide(); this->isTopItem = false; } //设置顶部这个item的显示 void OneLancForm::setTopItem(bool isSelected) { if (isSelected) { resize(W_ITEM, H_ITEM_EXTEND); ui->wbg->show(); ui->btnConnSub->hide(); this->isSelected = true; ui->line->move(X_LINE_EXTEND, Y_LINE_EXTEND); } else { resize(W_ITEM, H_ITEM); ui->wbg->hide(); ui->btnConnSub->hide(); this->isSelected = false; ui->line->move(X_LINE, Y_LINE); } if (isConnected) { ui->btnDisConn->show(); } else { ui->btnDisConn->hide(); } ui->btnConn->hide(); ui->wbg_2->hide(); this->isTopItem = true; } //设置网络名称 void OneLancForm::setLanName(QString ssid, QString transSsid, QString uuid, QString interface) { //处理过长SSID QString displayName; if(ssid.length() > 23){ displayName = ssid.mid(0, 20) + "..."; }else{ displayName = ssid; } ui->lbName->setText(displayName); ssidName = ssid; m_sConnectType = transSsid; uuidName = uuid; ifName = interface; } //根据有线网络连接与否,设置显示'已连接'文字的控件的可见与否 void OneLancForm::setConnedString(bool showLable, QString str, QString ifname) { if (!showLable) { ui->lbConned->hide(); ui->lbName->move(63, 18); } else { ui->lbConned->setText(str+ifname); } } //设置item被扩展后出现的网络信息 void OneLancForm::setLanInfo(QString str1, QString str2, QString str3, QString str4) { if (str2 == "" || str2 == "auto") { str2 = tr("No Configuration"); } if (str1 == "" || str1 == "auto") { str1 = tr("No Configuration"); // str2 = tr("No Configuration"); } if (str4 == "--" || str4 == "") { // str1 = tr("No Configuration"); str4 = tr("No IfName"); } if (str3.isEmpty() || str3 == "") { str3 = "--"; } QString strIPv4 = QString(tr("IPv4:")); QString strIPv6 = QString(tr("IPv6:")); QString strBW = QString(tr("BandWidth:")); QString strMAC = QString(tr("MAC:")); ui->leInfo_1->setText(strIPv4 + str1); ui->leInfo_2->setText(strIPv6 + str2); ui->leInfo_3->setText(strBW + str3); ui->leInfo_4->setText(strMAC + str4); } //根据网络是否连接,设置网络状态图标 void OneLancForm::setIcon(bool isOn) { if (isOn) { if (!QIcon::fromTheme("network-wired-connected-symbolic").isNull()) { ui->lbIcon->setPixmap(QIcon::fromTheme("network-wired-connected-symbolic").pixmap(32,32)); ui->lbIcon->setProperty("useIconHighlightEffect", 0x10); } else { ui->lbIcon->setPixmap(QIcon(":/res/l/network-online.png").pixmap(32,32)); } } else { if (!QIcon::fromTheme("network-wired-disconnected-symbolic").isNull()) { ui->lbIcon->setPixmap(QIcon::fromTheme("network-wired-disconnected-symbolic").pixmap(32,32)); ui->lbIcon->setProperty("useIconHighlightEffect", 0x10); } else { ui->lbIcon->setPixmap(QIcon(":/res/l/network-offline.png").pixmap(32,32)); } } } //设置item下方横线的可见与否 void OneLancForm::setLine(bool isShow) { if (isShow) { ui->line->show(); } else { ui->line->hide(); } } void OneLancForm::slotConnLan() { //mw->startLoading(); this->startWaiting(true); //emit sigConnLan(ui->lbName->text(), ifName); emit sigConnLan(uuidName, ifName, m_sConnectType); } //点击网络断开按钮,执行该函数 void OneLancForm::on_btnDisConn_clicked() { qDebug()<<"DisConnect button about lan net is clicked, current wired net name is "<lbName->text(); this->startWaiting(false); mw->is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; //使用有线网ssid断开网络 //kylin_network_set_con_down(ssidName.toUtf8().data()); //使用有线网uuid断开网络 kylin_network_set_con_down(uuidName.toUtf8().data()); //使用dbus接口断开网络 //toDisConnWiredNetwork(uuidName); disconnect(this, SIGNAL(selectedOneLanForm(QString, QString)), mw, SLOT(oneTopLanFormSelected(QString, QString))); emit requestHandleLanDisconn(); } void OneLancForm::toDisConnWiredNetwork(QString netUuid) { QDBusInterface interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); //获取已经连接了那些网络,及这些网络对应的网络类型(ethernet or wifi) QDBusMessage result = interface.call("Get", "org.freedesktop.NetworkManager", "ActiveConnections"); QList outArgs = result.arguments(); QVariant first = outArgs.at(0); QDBusVariant dbvFirst = first.value(); QVariant vFirst = dbvFirst.variant(); QDBusArgument dbusArgs = vFirst.value(); QDBusObjectPath activeConnPath; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { dbusArgs >> activeConnPath; QDBusInterface interfacePro( "org.freedesktop.NetworkManager", activeConnPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply replyUuid = interfacePro.call("Get", "org.freedesktop.NetworkManager.Connection.Active", "Uuid"); if (replyUuid.value().toString() == netUuid) { //断开当前连接网络 QDBusInterface disConnIf("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.NetworkManager", QDBusConnection::systemBus() ); QDBusReply disReply = disConnIf.call("DeactivateConnection", QVariant::fromValue(activeConnPath)); } } dbusArgs.endArray(); } //点击了连接网络按钮,执行该函数 void OneLancForm::on_btnConn_clicked() { qDebug()<<"A button named btnConn about lan net is clicked."; toConnectWiredNetwork(); } //点击了item被扩展中的连接网络按钮,执行该函数 void OneLancForm::on_btnConnSub_clicked() { qDebug()<<"A button named btnConnSub about lan net is clicked."; toConnectWiredNetwork(); } void OneLancForm::toConnectWiredNetwork() { if (mw->is_stop_check_net_state == 1) { return; } mw->is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; QThread *t = new QThread(); BackThread *bt = new BackThread(); bt->moveToThread(t); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, SIGNAL(started()), this, SLOT(slotConnLan())); connect(this, SIGNAL(sigConnLan(QString, QString, QString)), bt, SLOT(execConnLan(QString, QString, QString))); connect(bt, SIGNAL(connDone(int)), mw, SLOT(connLanDone(int))); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); } //点击列表中item扩展后显示信息的位置时,执行该函数,用于显示网络配置界面 void OneLancForm::on_btnInfo_clicked() { QPoint pos = QCursor::pos(); QRect primaryGeometry; for (QScreen *screen : qApp->screens()) { if (screen->geometry().contains(pos)) { primaryGeometry = screen->geometry(); } } if (primaryGeometry.isEmpty()) { primaryGeometry = qApp->primaryScreen()->geometry(); } BackThread *bt = new BackThread(); QString connProp = bt->getConnProp(uuidName); QStringList propList = connProp.split("|"); ConnProperties connection; // QString v4method, addr, mask, gateway, dns, v6method, v6addr, type; foreach (QString line, propList) { if (line.startsWith("method:")) { connection.v4method = line.split(":").at(1); } if (line.startsWith("v4addr:")) { connection.v4addr = line.split(":").at(1); } if (line.startsWith("mask:")) { connection.mask = line.split(":").at(1); } if (line.startsWith("v6method:")) { connection.v6method = line.split(":").at(1); } if (line.startsWith("v6addr:")) { connection.v6addr = line.right(line.length() - line.indexOf(":") - 1); } if (line.startsWith("gateway:")) { connection.gateway= line.split(":").at(1); } if (line.startsWith("dns:")) { connection.dns = line.split(":").at(1); } if (line.startsWith("type:")) { connection.type = line.split(":").at(1); } } // qDebug()<lbName->text(); connection.uuidName = uuidName; connection.isActConf = this->isActive; connect(cf, SIGNAL(requestRefreshLanList(int)), mw, SLOT(onBtnNetListClicked(int))); cf->setProp(connection); qDebug() << Q_FUNC_INFO << __LINE__ << ui->lbName->text() << uuidName; cf->move(primaryGeometry.width() / 2 - cf->width() / 2, primaryGeometry.height() / 2 - cf->height() / 2); cf->show(); cf->raise(); cf->activateWindow(); bt->deleteLater(); } void OneLancForm::waitAnimStep() { QString qpmQss = "QLabel{background-image:url(':/res/s/conning-a/"; qpmQss.append(QString::number(this->waitPage)); qpmQss.append(".png');}"); ui->lbWaitingIcon->setStyleSheet(qpmQss); this->waitPage ++; if (this->waitPage > TOTAL_PAGE) { this->waitPage = 1; //循环播放8张图片 } this->countCurrentTime += FRAME_SPEED; if (this->countCurrentTime >= LIMIT_TIME) { QString cmd = "kill -9 $(pidof nmcli)"; //杀掉当前正在进行的有关nmcli命令的进程 int status = system(cmd.toUtf8().data()); if (status != 0) { qDebug()<<"execute 'kill -9 $(pidof nmcli)' in function 'waitAnimStep' failed"; } this->stopWaiting(); //动画超出时间限制,强制停止动画 mw->is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; } } void OneLancForm::startWaiting(bool isToConnect) { if (isToConnect) { ui->btnCancel->show(); ui->lbWaiting->setStyleSheet("QLabel{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);}"); } else { ui->lbWaitingIcon->move(ui->lbWaitingIcon->x() - 24, ui->lbWaitingIcon->y()); ui->btnDisConn->hide(); ui->lbWaiting->setStyleSheet("QLabel{border:0px;border-radius:4px;background-color:rgba(255,255,255,0.12);}"); } this->countCurrentTime = 0; this->waitPage = 1; //总共有8张图片 this->waitTimer->start(FRAME_SPEED); ui->lbWaiting->show(); ui->lbWaitingIcon->show(); mw->setTrayLoading(true); } void OneLancForm::stopWaiting() { ui->lbWaitingIcon->move(380, 20); ui->btnCancel->hide(); this->waitTimer->stop(); ui->lbWaiting->hide(); ui->lbWaitingIcon->hide(); KylinDBus myKylinDbus; QList actLanSsidUuidState = myKylinDbus.getAtiveLanSsidUuidState(); if (actLanSsidUuidState.size() >= 3) { for (int i=0; isetTrayLoading(false); mw->getActiveInfoAndSetTrayIcon(); } void OneLancForm::on_btnCancel_clicked() { QString cmd = "kill -9 $(pidof nmcli)"; //杀掉当前正在进行的有关nmcli命令的进程 int status = system(cmd.toUtf8().data()); if (status != 0) { qDebug()<<"execute 'kill -9 $(pidof nmcli)' in function 'on_btnCancel_clicked' failed"; } KylinDBus myKylinDbus; QList lanSsidAndUuid = myKylinDbus.getAtiveLanSsidUuidState(); if (lanSsidAndUuid.contains(uuidName)) { kylin_network_set_con_down(uuidName.toUtf8().data()); } this->stopWaiting(); mw->is_stop_check_net_state = 0; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; } kylin-nm/src/singleapplication/0000755000175000017500000000000014205345374015537 5ustar fengfengkylin-nm/src/singleapplication/qt-locked-file.cpp0000644000175000017500000001401414205345374021043 0ustar fengfeng/**************************************************************************** ** ** 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. */ kylin-nm/src/singleapplication/qt-locked-file-unix.cpp0000644000175000017500000000662114205345374022031 0ustar fengfeng/**************************************************************************** ** ** 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(); } kylin-nm/src/singleapplication/qt-single-application.pri0000644000175000017500000000131114205345374022453 0ustar fengfengINCLUDEPATH += $$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 kylin-nm/src/singleapplication/qt-single-application.cpp0000644000175000017500000003075414205345374022460 0ustar fengfeng/**************************************************************************** ** ** 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 "../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) { actWin = 0; peer = new QtLocalPeer(this, appId); // connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&))); connect(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 peer->isClient(); } /*! Tries to send the text \a message to the currently running instance. The QtSingleApplication object in the running instance will emit the messageReceived() signal when it receives the message. This function returns true if the message has been sent to, and processed by, the current instance. If there is no instance currently running, or if the running instance fails to process the message within \a timeout milliseconds, this function return false. \sa isRunning(), messageReceived() */ bool QtSingleApplication::sendMessage(const QString &message, int timeout) { return peer->sendMessage(message, timeout); } /*! Returns the application identifier. Two processes with the same identifier will be regarded as instances of the same application. */ QString QtSingleApplication::id() const { return peer->applicationId(); } /*! Sets the activation window of this application to \a aw. The activation window is the widget that will be activated by activateWindow(). This is typically the application's main window. If \a activateOnMessage is true (the default), the window will be activated automatically every time a message is received, just prior to the messageReceived() signal being emitted. \sa activateWindow(), messageReceived() */ void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessage) { actWin = aw; //目前不需要用到此处的置顶方法,故此信号槽暂时注释掉,若后续需要根据新起进程传递的信号执行部分操作时可以把这里放开 // if (activateOnMessage) // connect(peer, &QtLocalPeer::messageReceived, this, &QtSingleApplication::activateWindow); // else // disconnect(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 actWin; } /*! 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() { //单例置顶策略,由于bootOptionsFilter in mainwindow自带置顶策略,故注掉此处 // if (actWin) { // if(this->applicationState() & Qt::ApplicationInactive) // { // MainWindow* w=qobject_cast(actWin); //// w->loadMainWindow(); // w->clearSearchResult(); // actWin->setWindowState(actWin->windowState() & ~Qt::WindowMinimized); // actWin->raise(); // actWin->showNormal(); // actWin->activateWindow(); // } // else { // actWin->setWindowState(actWin->windowState() & Qt::WindowMinimized); // actWin->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 */ kylin-nm/src/singleapplication/qt-locked-file.h0000644000175000017500000000636014205345374020515 0ustar fengfeng/**************************************************************************** ** ** 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 kylin-nm/src/singleapplication/qt-local-peer.h0000644000175000017500000000527214205345374020363 0ustar fengfeng/**************************************************************************** ** ** 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 kylin-nm/src/singleapplication/qt-single-application.h0000644000175000017500000000771314205345374022124 0ustar fengfeng/**************************************************************************** ** ** 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 *peer; QWidget *actWin; }; #endif // QTSINGLEAPPLICATION_H kylin-nm/src/singleapplication/qt-local-peer.cpp0000644000175000017500000001604514205345374020716 0ustar fengfeng/**************************************************************************** ** ** 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); //获取新进程的启动信息并作为信号发送给前端 } kylin-nm/src/oneconnform.ui0000644000175000017500000001455214205345374014723 0ustar fengfeng 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 245 20 0 0 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 kylin-nm/src/onelancform.h0000644000175000017500000000620314205345374014507 0ustar fengfeng/* * 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 "confform.h" #include "kylin-network-interface.h" #include "backthread.h" #include "ksimplenm.h" #include #include #include #include #include #include #include #include #define FRAME_SPEED 150 #define LIMIT_TIME 60*1000 #define TOTAL_PAGE 8 #define W_ITEM 424 #define H_ITEM 60 #define H_ITEM_EXTEND 162 #define Y_LINE 59 #define X_LINE 2 #define Y_LINE_EXTEND 161 #define X_LINE_EXTEND 2 class MainWindow; namespace Ui { class OneLancForm; } class OneLancForm : public QWidget { Q_OBJECT public: explicit OneLancForm(QWidget *parent = 0, MainWindow *mw = 0, ConfForm *confForm = 0, KSimpleNM *ksnm = 0); ~OneLancForm(); void setLanName(QString ssid, QString transSsid, QString uuid, QString interface); void setIcon(bool isOn); void setLine(bool isShow); void setLanInfo(QString str1, QString str2, QString str3, QString str4); void setSelected(bool isSelected, bool isCurrName); void setTopItem(bool isSelected); void setAct(bool isAct); void setConnedString(bool showLable, QString str, QString ifname); bool isSelected; bool isTopItem; bool isActive; bool isConnected; QString ssidName; QString m_sConnectType; QString uuidName; QString ifName; public slots: void waitAnimStep(); void startWaiting(bool isToConnect); void stopWaiting(); protected: void mousePressEvent(QMouseEvent *event); bool eventFilter(QObject *obj, QEvent *event); private slots: void on_btnConn_clicked(); void on_btnConnSub_clicked(); void on_btnDisConn_clicked(); void toConnectWiredNetwork(); void toDisConnWiredNetwork(QString netUuid); void slotConnLan(); void on_btnInfo_clicked(); void on_btnCancel_clicked(); private: QTimer *waitTimer = nullptr; int waitPage; int countCurrentTime; Ui::OneLancForm *ui = nullptr; MainWindow *mw = nullptr; ConfForm *cf = nullptr; KSimpleNM *ks = nullptr; QString leQssLow, leQssHigh; signals: void selectedOneLanForm(QString lanName, QString uniqueName); void connDone(int connFlag); void requestHandleLanDisconn(); void sigConnLan(QString, QString, QString); }; #endif // ONELANCFORM_H kylin-nm/src/sysdbusregister.h0000644000175000017500000000306114205345374015444 0ustar fengfeng/* * 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 #include #include class SysdbusRegister : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "com.kylin.NetworkManager.interface") public: explicit SysdbusRegister(); ~SysdbusRegister(); private: // QString m_name; signals: // Q_SCRIPTABLE void nameChanged(QString); // Q_SCRIPTABLE void computerinfo(QString); public slots: Q_SCRIPTABLE void systemRun(QString cmd); Q_SCRIPTABLE QStringList getWifiInfo(QString wifiName); Q_SCRIPTABLE bool appendWifiInfo(QString name, QString eap, QString inner, QString user); Q_SCRIPTABLE bool appendWifiUser(QString name, QString user); }; #endif // SYSDBUSREGISTER_H kylin-nm/src/sysdbusregister.cpp0000644000175000017500000000617414205345374016007 0ustar fengfeng/* * 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 SysdbusRegister::SysdbusRegister() { } SysdbusRegister::~SysdbusRegister() { } void SysdbusRegister::systemRun(QString cmd){ QProcess::execute(cmd); } QStringList SysdbusRegister::getWifiInfo(QString wifiName) { //返回名为wifiName的企业wifi的配置信息,包括eap,inner和用户列表 QStringList wlist; QString filename = "/usr/share/kylin-nm/wpaconn.conf"; QFile file(filename); if(!file.exists()) { return wlist; } QSharedPointer autoSettings = QSharedPointer(new QSettings(filename, QSettings::IniFormat)); wlist << autoSettings.get()->value("eap").toString(); wlist << autoSettings.get()->value("inner").toString(); int size = autoSettings.get()->beginReadArray(wifiName); for (int i = 0; i < size; ++i) { autoSettings.get()->setArrayIndex(i); wlist << autoSettings.get()->value("user").toString(); } autoSettings.get()->endArray(); return wlist; } bool SysdbusRegister::appendWifiInfo(QString name, QString eap, QString inner, QString user) { //向配置文件添加名为name的wifi配置,包括eap,inner和它的第一个用户 QString filename = "/usr/share/kylin-nm/wpaconn.conf"; QSharedPointer autoSettings = QSharedPointer(new QSettings(filename, QSettings::IniFormat)); autoSettings.get()->beginGroup(name); autoSettings.get()->setValue("eap", eap); autoSettings.get()->setValue("inner", inner); //以数组形式写入用户名 autoSettings.get()->beginWriteArray(name); autoSettings.get()->setArrayIndex(0); autoSettings.get()->setValue("user", user); autoSettings.get()->endArray(); return true; } bool SysdbusRegister::appendWifiUser(QString name, QString user) { //向名为name的wifi用户列表添加名为user的用户名 QString filename = "/usr/share/kylin-nm/wpaconn.conf"; QSharedPointer autoSettings = QSharedPointer(new QSettings(filename, QSettings::IniFormat)); autoSettings.get()->beginWriteArray(name); autoSettings.get()->setArrayIndex(0); //读到用户名列表长度并在队尾添加一个用户名 int size = autoSettings.get()->beginReadArray(name); autoSettings.get()->setArrayIndex(size); autoSettings.get()->setValue("user", user); autoSettings.get()->endArray(); return true; } kylin-nm/src/mainwindow.ui0000644000175000017500000001551714205345374014556 0ustar fengfeng MainWindow 0 0 490 538 kylin-nm 1 200 37 37 2 200 37 37 412 20 50 24 2 490 37 37 2 348 37 37 2 395 37 37 61 22 120 20 0 0 12 440 22 20 20 11 359 19 19 11 405 19 19 2 10 37 37 2 57 37 37 2 348 37 37 2 395 37 37 2 10 37 37 2 57 37 37 41 0 1 538 background-color: rgba(156, 156, 156,0.1); Qt::Vertical 8 18 24 24 8 65 24 24 8 497 24 24 lbFlyBG lbHotBG lbFlyImg lbHotImg lbBtnNetBG btnNet lbBtnWifiBG btnHotspot btnFlyMode lbBtnWifiBall lbNetListBG lbWifiListBG lbNetwork vLine btnNetListImg btnNetList btnWifiListImg btnConfImg btnWifiList btnAdvConf kylin-nm/src/main.cpp0000644000175000017500000001334114205345374013464 0ustar fengfeng/* * 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 "qt-single-application.h" #include #include #include #include #define LOG_IDENT "ukui_kylin_nm" void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) { QByteArray localMsg = msg.toLocal8Bit(); QByteArray currentTime = QTime::currentTime().toString().toLocal8Bit(); QDateTime dateTime = QDateTime::currentDateTime(); //QLocale locale = QLocale::Chinese;//指定中文显示 QLocale locale = QLocale::English;//指定英文显示 //QLocale locale = QLocale::Japanese;//指定日文显示 //QString strFormat = "当前时间为:yyyy-MM-dd hh:mm:ss dddd"; QString strFormat = "Now : yyyy-MM-dd"; QString strDateTime = locale.toString(dateTime, strFormat); //qDebug() << "当前时间为 : " << strDateTime; 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 (%s:%u, %s)\n", strDateTime.toUtf8().data(), currentTime.constData(), localMsg.constData(), file, context.line, function); break; case QtInfoMsg: fprintf(log_file? log_file: stdout, "Info: %s %s %s: %s (%s:%u, %s)\n", strDateTime.toUtf8().data(),currentTime.constData(), localMsg.constData(), file, context.line, function); break; case QtWarningMsg: fprintf(log_file? log_file: stderr, "Warning: %s %s: %s (%s:%u, %s)\n", strDateTime.toUtf8().data(),currentTime.constData(), localMsg.constData(), file, context.line, function); break; case QtCriticalMsg: fprintf(log_file? log_file: stderr, "Critical: %s %s: %s (%s:%u, %s)\n", strDateTime.toUtf8().data(),currentTime.constData(), localMsg.constData(), file, context.line, function); break; case QtFatalMsg: fprintf(log_file? log_file: stderr, "Fatal: %s %s: %s (%s:%u, %s)\n", strDateTime.toUtf8().data(),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()) { auto connection = QDBusConnection::sessionBus(); QDBusInterface iface("com.kylin.network", "/com/kylin/network", "com.kylin.network", connection); iface.call("showMainWindow"); return 0; } qDebug()<<"Kylin Network Manager Is Already Launched"; // int loopNum = 0; // while (!QSystemTrayIcon::isSystemTrayAvailable()) { // if (loopNum == 15) return 1; // qDebug()<<"I couldn't detect any system tray on this system now"; // loopNum += 1; // sleep(1); // } QApplication::setQuitOnLastWindowClosed(false); // Internationalization QString locale = QLocale::system().name(); QTranslator trans_global; if (locale == "zh_CN") { trans_global.load(":/translations/kylin-nm_zh_CN.qm"); //trans_global.load(":/translations/kylin-nm_bo.qm"); a.installTranslator(&trans_global); } if (locale == "tr_TR") { trans_global.load(":/translations/kylin-nm_tr.qm"); a.installTranslator(&trans_global); } qDebug()<<"Translations Are Already Loaded"; MainWindow w; qDebug()<<"Mainwindow is Already Registered"; 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(); } // QDBusInterface iface("com.kylin.network", // "/com/kylin/network", // "com.kylin.network", // connection); // iface.call("showMainWindow"); // return 0; // } w.justShowTrayIcon(); return a.exec(); } kylin-nm/src/oneconnform.h0000644000175000017500000001116314205345374014530 0ustar fengfeng/* * 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 #include #include #include #include "confform.h" #include "backthread.h" #include "ksimplenm.h" #include "wpawifidialog.h" #define FRAME_SPEED 150 #define LIMIT_TIME 90*1000 #define TOTAL_PAGE 8 #define W_ITEM 424 #define H_ITEM 60 #define H_ITEM_BIG 138 #define H_ITEM_MIDDLE 106 #define H_WIFI_ITEM_BIG_EXTEND 78 //138 - 60 #define H_WIFI_ITEM_SMALL_EXTEND 46 //106 - 60 #define Y_LINE 59 #define X_LINE 2 #define Y_LINE_SMALL_EXTEND 105 #define X_LINE_SMALL_EXTEND 2 #define Y_LINE_BIG_EXTEND 137 #define X_LINE_BIG_EXTEND 2 class MainWindow; namespace Ui { class OneConnForm; } class OneConnForm : public QWidget { Q_OBJECT public: explicit OneConnForm(QWidget *parent = 0, MainWindow *mw = 0, ConfForm *confForm = 0, KSimpleNM *ksnm = 0); ~OneConnForm(); // category:1->normal protocol 1->wifi 6 2->wifi 6+ void setSignal(QString lv, QString secu, QString category = "0", bool hasSignalStrength = true); int getSignal(); void setWifiName(QString name, QString bssid, QString uuid, QString isname, bool isHW, bool is9006C); QString getName(); void setRate(QString rate); void setLine(bool isShow); void setWifiInfo(QString str1, QString str2, QString str3, int freq); void setSelected(bool isSelected, bool isCurrName); void setHideItem(bool isHideItem, bool isShowHideBtn); void setTopItem(bool isSelected); void setAct(bool isAct); void setConnedString(bool showLable, QString str, QString str1); void setLePassword(); bool isWifiConfExist(QString netName); bool isInputtingPwd(); void setlbPwdTipVisble(const bool&); QString wifiName; QString wifiBSsid; QString wifiUuid; QString wifiIfName; QString connType; QString wifiSecu; QLabel * lbFreq = nullptr; QLabel * lbPwdTip = nullptr; bool isHuaweiPC; bool isHuaWei9006C; bool isSelected;\ bool isActive; bool isConnected; bool isTopItem; int signalLv; int m_signal; public slots: void waitAnimStep(); void startWifiWaiting(bool isToConnect); void stopWifiWaiting(bool isUpdateTrayIcon); void onBtnPropertyClicked(); protected: void mousePressEvent(QMouseEvent *event); bool eventFilter(QObject *obj, QEvent *event); private: bool getWifiConfig(WifiConfig &wc, QString netName); bool checkIsSaved(); private slots: void on_btnConn_clicked(); void on_btnConnSub_clicked(); void on_btnDisConn_clicked(); void toConnectWirelessNetwork(); void slotConnWifi(); void slotConnWifiPWD(); void slotConnWifiResult(int connFlag); void on_btnConnPWD_clicked(); void on_btnHideConn_clicked(); void on_lePassword_textEdited(const QString &arg1); void on_btnInfo_clicked(); void on_btnCancel_clicked(); void on_checkBoxPwd_clicked(); bool onMenuTriggered(QAction *); private: QTimer *waitTimer = nullptr; int waitPage; int countCurrentTime; bool isWaiting = false; int psk_flag = 0; //密码存储策略 int getPskFlag(); bool m_connWithPwd = true; //是否使用密码连接 Ui::OneConnForm *ui = nullptr; MainWindow *mw = nullptr; ConfForm *cf = nullptr; KSimpleNM *ks = nullptr; bool hasPwd; QString leQssLow, leQssHigh; QLabel * lbNameText = nullptr; QHBoxLayout * lbNameLyt = nullptr; QString key_mgmt, funcBtnQss; QPushButton *btnProperty = nullptr; QMenu * m_menu = nullptr; signals: void selectedOneWifiForm(QString wifiName, int extendLength); void connDone(int connFlag); void requestHandleWifiDisconn(); void requestRefreshWifiList(); void sigConnWifi(QString, QString); void sigConnWifiPWD(QString, QString, QString, QString, QString); void sigConnWifiPsk(QString); }; #endif // ONECONNFORM_H kylin-nm/hot-spot/0000755000175000017500000000000014205345374013020 5ustar fengfengkylin-nm/hot-spot/dlghotspotcreate.cpp0000644000175000017500000001337614205345374017111 0ustar fengfeng/* * 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 setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); this->setStyleSheet("background-color:white;"); ui->lbLeftup->setStyleSheet("QLabel{background-color:#266ab5;}"); ui->lbLeftupIcon->setStyleSheet("QLabel{background-image:url(:/res/h/no-pwd-wifi.png);background-color:transparent;}"); ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:12px;color:#ffffff;background-color:transparent;}"); ui->btnCancel->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}" "QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}" "QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}"); ui->btnOk->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}" "QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}" "QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}"); ui->checkBoxPwd->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);}"); ui->lbLeftupTitle->setText(tr("Create Hotspot")); //创建个人热点 ui->lbNetName->setText(tr("Network name")); //网络名称: ui->lbSecurity->setText(tr("WLAN security")); //WLAN 安全性: ui->lbPassword->setText(tr("Password")); //密码: ui->btnCancel->setText(tr("Cancel")); //取消 ui->btnOk->setText(tr("Ok")); //确定 ui->btnOk->setEnabled(false); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA and WPA2 Personal")); //WPA 及 WPA2 个人 ui->cbxSecurity->setCurrentIndex(1); connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog())); } DlgHotspotCreate::~DlgHotspotCreate() { delete ui; } //void DlgHotspotCreate::mousePressEvent(QMouseEvent *event){ // if(event->button() == Qt::LeftButton){ // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } //} //void DlgHotspotCreate::mouseReleaseEvent(QMouseEvent *event){ // this->isPress = false; // this->setWindowOpacity(1); //} //void DlgHotspotCreate::mouseMoveEvent(QMouseEvent *event){ // if(this->isPress){ // this->move(this->winPos - (this->dragPos - event->globalPos())); // this->setWindowOpacity(0.9); // event->accept(); // } //} void DlgHotspotCreate::on_btnCancel_clicked() { this->close(); emit btnHotspotState(); } void DlgHotspotCreate::on_btnOk_clicked() { //nmcli device wifi hotspot [ifname ifname] [con-name name] [ssid SSID] [band {a | bg}] [channel channel] [password password] //example: nmcli device wifi hotspot ifname wlan0 con-name MyHostspot ssid MyHostspotSSID password 12345678 QString str; if(ui->cbxSecurity->currentIndex() == 0 ){ str = "nmcli device wifi hotspot ifname '" + wirelessCardName + "' con-name '" + ui->leNetName->text() + "' ssid '" + ui->leNetName->text() + "' SSID"; }else{ str = "nmcli device wifi hotspot ifname '" + wirelessCardName + "' con-name '" + ui->leNetName->text() + "' ssid '" + ui->leNetName->text() + "' password '" + ui->lePassword->text() + "'"; } Utils::m_system(str.toUtf8().data()); this->close(); emit updateHotspotList(); } void DlgHotspotCreate::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword ->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgHotspotCreate::on_leNetName_textEdited(const QString &arg1) { if(ui->cbxSecurity->currentIndex() == 0 ){ if (ui->leNetName->text() == ""){ ui->btnOk->setEnabled(false); } else { ui->btnOk->setEnabled(true); } }else{ if (ui->leNetName->text() == "" || ui->lePassword->text().size() < 5){ ui->btnOk->setEnabled(false); } else { ui->btnOk->setEnabled(true); } } } void DlgHotspotCreate::on_lePassword_textEdited(const QString &arg1) { if (ui->leNetName->text() == "" || ui->lePassword->text().size() < 5){ ui->btnOk->setEnabled(false); } else { ui->btnOk->setEnabled(true); } } void DlgHotspotCreate::changeDialog() { if(ui->cbxSecurity->currentIndex()==0){ ui->lbPassword->setEnabled(false); ui->lePassword->setEnabled(false); ui->checkBoxPwd->setEnabled(false); } else { ui->lbPassword->setEnabled(true); ui->lePassword->setEnabled(true); ui->checkBoxPwd->setEnabled(true); } } kylin-nm/hot-spot/dlghotspotcreate.ui0000644000175000017500000000654614205345374016745 0ustar fengfeng DlgHotspotCreate 0 0 432 250 Dialog 0 0 120 32 9 9 16 16 34 6 80 20 215 210 90 30 315 210 90 30 76 60 90 20 175 55 200 32 76 105 90 20 175 100 200 32 76 150 90 20 175 145 200 32 QLineEdit::Password 350 157 18 9 kylin-nm/hot-spot/dlghotspotcreate.h0000644000175000017500000000324314205345374016546 0ustar fengfeng/* * 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 namespace Ui { class DlgHotspotCreate; } class DlgHotspotCreate : public QDialog { Q_OBJECT public: explicit DlgHotspotCreate(QString wiFiCardName, QWidget *parent = nullptr); ~DlgHotspotCreate(); public slots: void changeDialog(); private slots: void on_btnCancel_clicked(); void on_btnOk_clicked(); void on_checkBoxPwd_stateChanged(int arg1); void on_leNetName_textEdited(const QString &arg1); void on_lePassword_textEdited(const QString &arg1); private: Ui::DlgHotspotCreate *ui; QString wirelessCardName; // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); bool isPress; QPoint winPos; QPoint dragPos; signals: void updateHotspotList(); void btnHotspotState(); }; #endif // DLGHOTSPOTCREATE_H kylin-nm/wireless-security/0000755000175000017500000000000014205345444014743 5ustar fengfengkylin-nm/wireless-security/dlghidewifiwep.cpp0000644000175000017500000002125614205345444020450 0ustar fengfeng/* * 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 setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); this->setAttribute(Qt::WA_TranslucentBackground); //需要添加 void paintEvent(QPaintEvent *event) 函数 this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); MyQss objQss; ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->hide(); ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}"); ui->lbConn->setStyleSheet(objQss.labelQss); ui->lbNetName->setStyleSheet(objQss.labelQss); ui->lbSecurity->setStyleSheet(objQss.labelQss); ui->lbKey->setStyleSheet(objQss.labelQss); ui->lbWEPindex->setStyleSheet(objQss.labelQss); ui->lbAuth->setStyleSheet(objQss.labelQss); ui->cbxConn->setStyleSheet(objQss.cbxQss); ui->cbxConn->setView(new QListView()); ui->leNetName->setStyleSheet(objQss.leQss); ui->leKey->setStyleSheet(objQss.leQss); ui->checkBoxPwd->setStyleSheet(objQss.checkBoxQss); ui->cbxSecurity->setStyleSheet(objQss.cbxQss); ui->cbxSecurity->setView(new QListView()); ui->cbxWEPindex->setStyleSheet(objQss.cbxQss); ui->cbxWEPindex->setView(new QListView()); ui->cbxAuth->setStyleSheet(objQss.cbxQss); ui->cbxAuth->setView(new QListView()); ui->btnCancel->setStyleSheet(objQss.btnOffQss); ui->btnConnect->setStyleSheet(objQss.btnOffQss); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->lbLeftupTitle->setText(tr("Add hidden WLAN")); //加入隐藏Wi-Fi ui->lbConn->setText(tr("Connection")); //连接设置: ui->lbNetName->setText(tr("Network name")); //网络名称: ui->lbSecurity->setText(tr("WLAN security")); //Wi-Fi 安全性: ui->lbKey->setText(tr("Key")); //密钥: ui->lbWEPindex->setText(tr("WEP index")); //WEP 检索: ui->lbAuth->setText(tr("Authentication")); //认证: ui->btnCancel->setText(tr("Cancel")); //取消 ui->btnConnect->setText(tr("Connect")); //连接 ui->cbxConn->addItem(tr("C_reate…")); //新建... int status = system("nmcli connection show>/tmp/kylin-nm-connshow"); qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA and WPA2 Personal")); //WPA 及 WPA2 个人 ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 ui->cbxSecurity->addItem("LEAP"); ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) ui->cbxSecurity->addItem(tr("WPA and WPA2 Enterprise")); //WPA 及 WPA2 企业 if (WepPwdOrCode == 0) { ui->cbxSecurity->setCurrentIndex(2); } else if (WepPwdOrCode == 1) { ui->cbxSecurity->setCurrentIndex(3); } connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog())); ui->cbxWEPindex->addItem(tr("1(default)")); //1(默认) ui->cbxWEPindex->addItem("2"); ui->cbxWEPindex->addItem("3"); ui->cbxWEPindex->addItem("4"); ui->cbxWEPindex->setCurrentIndex(0); ui->cbxAuth->addItem(tr("Open System")); //开放式系统 ui->cbxAuth->addItem(tr("Shared Key")); //共享密钥 ui->cbxAuth->setCurrentIndex(0); ui->btnConnect->setEnabled(false); this->setFixedSize(432,493); } DlgHideWifiWep::~DlgHideWifiWep() { delete ui; } //void DlgHideWifiWep::mousePressEvent(QMouseEvent *event){ // if(event->button() == Qt::LeftButton){ // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } //} //void DlgHideWifiWep::mouseReleaseEvent(QMouseEvent *event){ // this->isPress = false; //} //void DlgHideWifiWep::mouseMoveEvent(QMouseEvent *event){ // if(this->isPress){ // this->move(this->winPos - (this->dragPos - event->globalPos())); // event->accept(); // } //} //切换到其他Wi-Fi安全类型 void DlgHideWifiWep::changeDialog() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifi *connHidWifi = new DlgHideWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(1, 0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { if (WepPwdOrCode == 1) { ui->cbxSecurity->setCurrentIndex(2); WepPwdOrCode = 0; } } else if(ui->cbxSecurity->currentIndex()==3) { if (WepPwdOrCode == 0) { ui->cbxSecurity->setCurrentIndex(3); WepPwdOrCode = 1; } } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiLeap *connHidWifiLeap = new DlgHideWifiLeap(); connHidWifiLeap->show(); } else if(ui->cbxSecurity->currentIndex()==5) { //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapTls *connHidWifiEapTls = new DlgHideWifiEapTls(0); //connHidWifiEapTls->show(); } else { //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapTls *connHidWifiEapTls = new DlgHideWifiEapTls(1); //connHidWifiEapTls->show(); } } void DlgHideWifiWep::on_btnCancel_clicked() { this->close(); } void DlgHideWifiWep::on_btnConnect_clicked() { this->close(); } void DlgHideWifiWep::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->leKey->setEchoMode(QLineEdit::Password); } else { ui->leKey->setEchoMode(QLineEdit::Normal); } } void DlgHideWifiWep::on_leKey_textEdited(const QString &arg1) { if (ui->leNetName->text() == "" || ui->leKey->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiWep::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == "" || ui->leKey->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiWep::paintEvent(QPaintEvent *event) { KylinDBus mkylindbus; double trans = mkylindbus.getTransparentData(); QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlghidewifieappwd.h0000644000175000017500000000351014205345374020575 0ustar fengfeng/* * 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 namespace Ui { class DlgHideWifiEapPwd; } class DlgHideWifiEapPwd : public QDialog { Q_OBJECT public: explicit DlgHideWifiEapPwd(int type, QWidget *parent = 0); ~DlgHideWifiEapPwd(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialogSecu(); void changeDialogAuth(); private slots: void on_btnCancel_clicked(); void on_btnConnect_clicked(); void on_checkBox_stateChanged(int arg1); void on_leNetName_textEdited(const QString &arg1); void on_leUserName_textEdited(const QString &arg1); void on_lePassword_textEdited(const QString &arg1); private: Ui::DlgHideWifiEapPwd *ui; int WepOrWpa = 0;//0 WEP;1WPA // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); // QString labelQss, cbxQss, leQss, btnConnQss, btnCancelQss, lineQss, checkBoxQss, checkBoxCAQss; bool isPress; QPoint winPos; QPoint dragPos; }; #endif // DLGCONNHIDWIFISECPWD_H kylin-nm/wireless-security/dlghidewifieapleap.cpp0000644000175000017500000002525614205345374021272 0ustar fengfeng/* * 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 setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); this->setAttribute(Qt::WA_TranslucentBackground); //需要添加 void paintEvent(QPaintEvent *event) 函数 QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); MyQss objQss; ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->hide(); ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}"); ui->lbConn->setStyleSheet(objQss.labelQss); ui->lbNetName->setStyleSheet(objQss.labelQss); ui->lbSecurity->setStyleSheet(objQss.labelQss); ui->lbAuth->setStyleSheet(objQss.labelQss); ui->lbUserName->setStyleSheet(objQss.labelQss); ui->lbPassword->setStyleSheet(objQss.labelQss); ui->cbxConn->setStyleSheet(objQss.cbxQss); ui->cbxConn->setView(new QListView()); ui->leNetName->setStyleSheet(objQss.leQss); ui->cbxSecurity->setStyleSheet(objQss.cbxQss); ui->cbxSecurity->setView(new QListView()); ui->cbxAuth->setStyleSheet(objQss.cbxQss); ui->cbxAuth->setView(new QListView()); ui->leUserName->setStyleSheet(objQss.leQss); ui->lePassword->setStyleSheet(objQss.leQss); ui->checkBox->setStyleSheet(objQss.checkBoxQss); ui->btnCancel->setStyleSheet(objQss.btnOffQss); ui->btnConnect->setStyleSheet(objQss.btnOffQss); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->lbLeftupTitle->setText(tr("Add hidden WLAN")); //加入隐藏WLAN ui->lbConn->setText(tr("Connection")); //连接设置: ui->lbNetName->setText(tr("Network name")); //网络名称: ui->lbSecurity->setText(tr("WLAN security")); //Wi-Fi安全性: ui->lbAuth->setText(tr("Authentication")); //认证: ui->lbUserName->setText(tr("Username")); //用户名: ui->lbPassword->setText(tr("Password")); //密码: ui->btnCancel->setText(tr("Cancel")); //取消 ui->btnConnect->setText(tr("Connect")); //连接 ui->cbxConn->addItem(tr("C_reate…")); //新建... int status = system("nmcli connection show>/tmp/kylin-nm-connshow"); qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA and WPA2 Personal")); //WPA 及 WPA2 个人 ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 ui->cbxSecurity->addItem("LEAP"); ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) ui->cbxSecurity->addItem(tr("WPA and WPA2 Enterprise")); //WPA 及 WPA2 企业 if (WepOrWpa == 0) { ui->cbxSecurity->setCurrentIndex(5); } else if (WepOrWpa == 1) { ui->cbxSecurity->setCurrentIndex(6); } connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogSecu())); ui->cbxAuth->addItem("TLS"); ui->cbxAuth->addItem("LEAP"); ui->cbxAuth->addItem("PWD"); ui->cbxAuth->addItem("FAST"); ui->cbxAuth->addItem(tr("Tunneled TLS"));//隧道 TLS ui->cbxAuth->addItem(tr("Protected EAP (PEAP)")); //受保护的 EAP ui->cbxAuth->setCurrentIndex(1); connect(ui->cbxAuth,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogAuth())); ui->btnConnect->setEnabled(false); this->setFixedSize(432,487); } DlgHideWifiEapLeap::~DlgHideWifiEapLeap() { delete ui; } //void DlgHideWifiEapLeap::mousePressEvent(QMouseEvent *event){ // if(event->button() == Qt::LeftButton){ // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } //} //void DlgHideWifiEapLeap::mouseReleaseEvent(QMouseEvent *event){ // this->isPress = false; //} //void DlgHideWifiEapLeap::mouseMoveEvent(QMouseEvent *event){ // if(this->isPress){ // this->move(this->winPos - (this->dragPos - event->globalPos())); // event->accept(); // } //} void DlgHideWifiEapLeap::changeDialogSecu() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifi *connHidWifi = new DlgHideWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(1, 0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiLeap *connHidWifiLeap = new DlgHideWifiLeap(); connHidWifiLeap->show(); } else if(ui->cbxSecurity->currentIndex()==5) { if (WepOrWpa == 1) { ui->cbxSecurity->setCurrentIndex(5); WepOrWpa = 0; } } else { if (WepOrWpa == 0){ ui->cbxSecurity->setCurrentIndex(6); WepOrWpa = 1; } } } void DlgHideWifiEapLeap::changeDialogAuth() { if(ui->cbxAuth->currentIndex()==0){ //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapTls *connHidWifiEapTls = new DlgHideWifiEapTls(WepOrWpa); //connHidWifiEapTls->show(); } else if(ui->cbxAuth->currentIndex()==1) { qDebug()<<"it's not need to change dialog"; } else if(ui->cbxAuth->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapPwd *connHidWifiEapPwd = new DlgHideWifiEapPwd(WepOrWpa); connHidWifiEapPwd->show(); } else if(ui->cbxAuth->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapFast *connHidWifiEapFast = new DlgHideWifiEapFast(WepOrWpa); connHidWifiEapFast->show(); } else if(ui->cbxAuth->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapTTLS *connHidWifiEapTTls = new DlgHideWifiEapTTLS(WepOrWpa); connHidWifiEapTTls->show(); } else { //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(WepOrWpa); //connHidWifiEapPeap->show(); } } void DlgHideWifiEapLeap::on_btnCancel_clicked() { this->close(); } void DlgHideWifiEapLeap::on_btnConnect_clicked() { this->close(); } void DlgHideWifiEapLeap::on_checkBox_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword ->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgHideWifiEapLeap::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiEapLeap::on_leUserName_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiEapLeap::on_lePassword_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiEapLeap::paintEvent(QPaintEvent *event) { KylinDBus mkylindbus; double trans = mkylindbus.getTransparentData(); QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlghidewifieaptls.cpp0000644000175000017500000005751014205345374021151 0ustar fengfeng/* * 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 DlgHideWifiEapTls::DlgHideWifiEapTls(int type, int beUsed, MainWindow *mainWindow, QWidget *parent) : WepOrWpa(type), isUsed(beUsed), QDialog(parent), ui(new Ui::DlgHideWifiEapTls) { ui->setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); this->setAttribute(Qt::WA_TranslucentBackground); this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); //需要添加 void paintEvent(QPaintEvent *event) 函数 QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); MyQss objQss; ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->hide(); ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:20px;}"); ui->checkBoxPwd->setStyleSheet(objQss.checkBoxQss); ui->checkBoxPwdSec->setStyleSheet(objQss.checkBoxQss); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->lbLeftupTitle->setText(tr("Add hidden WLAN")); //加入隐藏WLAN ui->lbConn->setText(tr("Connection")); //连接设置: ui->lbNetName->setText(tr("Network name")); //网络名称: ui->lbSecurity->setText(tr("WLAN security")); //Wi-Fi安全性: ui->lbAuth->setText(tr("Authentication")); //认证: ui->lbIdentity->setText(tr("Identity")); //身份: ui->lbDomain->setText(tr("Domain")); //域名: ui->lbCA->setText(tr("CA certificate")); //CA 证书: ui->lbCaPwd->setText(tr("CA certificate password")); //CA 证书密码: ui->checkBoxCA->setText(tr("No CA certificate is required")); //不需要CA证书 ui->lbUserCertify->setText(tr("User certificate")); //用户证书: ui->lbUserCertifyPwd->setText(tr("User certificate password")); //用户证书密码: ui->lbUserPriKey->setText(tr("User private key")); //用户私钥: ui->lbUserKeyPwd->setText(tr("User key password")); //用户密钥密码: ui->btnCancel->setText(tr("Cancel")); //取消 ui->btnConnect->setText(tr("Connect")); //连接 ui->btnCancel->setStyleSheet(objQss.btnOffQss); ui->btnConnect->setStyleSheet(objQss.btnOffQss); ui->cbxConn->addItem(tr("C_reate…")); //新建... int status = system("nmcli connection show>/tmp/kylin-nm-connshow"); qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); connect(ui->cbxConn,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeWindow())); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA and WPA2 Personal")); //WPA 及 WPA2 个人 ui->cbxSecurity->addItem(tr("WPA and WPA2 Enterprise")); //WPA 及 WPA2 企业 //ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) //ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 //ui->cbxSecurity->addItem("LEAP"); //ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) if (WepOrWpa == 0) { ui->cbxSecurity->setCurrentIndex(5); } else if (WepOrWpa == 1) { ui->cbxSecurity->setCurrentIndex(2); } connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogSecu())); ui->cbxAuth->addItem("TLS"); ui->cbxAuth->addItem("LEAP"); ui->cbxAuth->addItem("PWD"); ui->cbxAuth->addItem("FAST"); ui->cbxAuth->addItem(tr("Tunneled TLS"));//隧道 TLS ui->cbxAuth->addItem(tr("Protected EAP (PEAP)")); //受保护的 EAP ui->cbxAuth->setCurrentIndex(0); connect(ui->cbxAuth,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogAuth())); ui->cbxCA->addItem(tr("None")); //无 ui->cbxCA->addItem(tr("Choose from file")); //从文件选择... ui->cbxCA->setCurrentIndex(0); ui->cbxUserCertify->addItem(tr("None")); //无 ui->cbxUserCertify->addItem(tr("Choose from file")); //从文件选择... ui->cbxUserCertify->setCurrentIndex(0); ui->cbxUserPriKey->addItem(tr("None")); //无 ui->cbxUserPriKey->addItem(tr("Choose from file")); //从文件选择... ui->cbxUserPriKey->setCurrentIndex(0); ui->btnConnect->setEnabled(false); ui->lbCaPwd->setEnabled(false); ui->leCaPwd->setEnabled(false); ui->lbUserCertifyPwd->setEnabled(false); ui->leUserCertifyPwd->setEnabled(false); ui->lbUserPriKey->setEnabled(false); ui->cbxUserPriKey->setEnabled(false); ui->lbUserKeyPwd->setEnabled(false); ui->leUserKeyPwd->setEnabled(false); this->setFixedSize(432,705); this->mw = mainWindow; } DlgHideWifiEapTls::~DlgHideWifiEapTls() { delete ui; } //void DlgHideWifiEapTls::mousePressEvent(QMouseEvent *event){ // if(event->button() == Qt::LeftButton){ // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } //} //void DlgHideWifiEapTls::mouseReleaseEvent(QMouseEvent *event){ // this->isPress = false; //} //void DlgHideWifiEapTls::mouseMoveEvent(QMouseEvent *event){ // if(this->isPress){ // this->move(this->winPos - (this->dragPos - event->globalPos())); // event->accept(); // } //} //切换到其他Wi-Fi安全类型 void DlgHideWifiEapTls::changeDialogSecu() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifi *connHidWifi = new DlgHideWifi(0, mw); connHidWifi->show(); connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(1, 0); connHidWifiWpa->show(); connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } else if(ui->cbxSecurity->currentIndex()==2) { qDebug()<<"it's not need to change dialog"; //if (WepOrWpa == 0) { // ui->cbxSecurity->setCurrentIndex(6); // WepOrWpa = 1; //} } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==5) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiLeap *connHidWifiLeap = new DlgHideWifiLeap(); connHidWifiLeap->show(); } else { if (WepOrWpa == 1) { ui->cbxSecurity->setCurrentIndex(5); WepOrWpa = 0; } } } //同一 Wi-Fi安全类型的Authentication变换 void DlgHideWifiEapTls::changeDialogAuth() { if(ui->cbxAuth->currentIndex()==0){ qDebug()<<"it's not need to change dialog"; } else if(ui->cbxAuth->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapLeap *connHidWifiEapLeap = new DlgHideWifiEapLeap(WepOrWpa); connHidWifiEapLeap->show(); } else if(ui->cbxAuth->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapPwd *connHidWifiEapPwd = new DlgHideWifiEapPwd(WepOrWpa); connHidWifiEapPwd->show(); } else if(ui->cbxAuth->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapFast *connHidWifiEapFast = new DlgHideWifiEapFast(WepOrWpa); connHidWifiEapFast->show(); } else if(ui->cbxAuth->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapTTLS *connHidWifiEapTTls = new DlgHideWifiEapTTLS(WepOrWpa); connHidWifiEapTTls->show(); } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(WepOrWpa, 0, mw); connHidWifiEapPeap->show(); } } //同一 Wi-Fi安全类型的窗口变换 void DlgHideWifiEapTls::changeWindow(){ if (ui->cbxConn->currentIndex() == 0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifi *connHidWifi = new DlgHideWifi(0, mw); connHidWifi->show(); connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); }else if (ui->cbxConn->currentIndex() >= 1){ QString tmpPath = "/tmp/kylin-nm-connshow-" + QDir::home().dirName(); QString currStr = "nmcli connection show '" + ui->cbxConn->currentText() + "' >" + tmpPath; int status = system(currStr.toUtf8().data()); qDebug()<<"executed cmd="<hide(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(1, ui->cbxConn->currentIndex(), mw); connHidWifiWpa->show(); connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifi *connHidWifi = new DlgHideWifi(ui->cbxConn->currentIndex(), mw); connHidWifi->show(); connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } } } void DlgHideWifiEapTls::on_cbxCA_currentIndexChanged(const QString &arg1) { if (ui->cbxCA->currentIndex() == 0){ ui->leCaPwd->setText(""); ui->lbCaPwd->setEnabled(false); ui->leCaPwd->setEnabled(false); }else{ ui->leCaPwd->setText(""); ui->lbCaPwd->setEnabled(true); ui->leCaPwd->setEnabled(true); } } void DlgHideWifiEapTls::on_cbxUserCertify_currentIndexChanged(const QString &arg1) { if (ui->cbxUserCertify->currentIndex() == 0){ ui->leUserCertifyPwd->setText(""); ui->lbUserCertifyPwd->setEnabled(false); ui->leUserCertifyPwd->setEnabled(false); ui->lbUserPriKey->setEnabled(false); ui->cbxUserPriKey->setEnabled(false); ui->cbxUserPriKey->setCurrentIndex(0); ui->leUserKeyPwd->setText(""); ui->lbUserKeyPwd->setEnabled(false); ui->leUserKeyPwd->setEnabled(false); }else{ ui->leUserCertifyPwd->setText(""); ui->lbUserCertifyPwd->setEnabled(true); ui->leUserCertifyPwd->setEnabled(true); ui->lbUserPriKey->setEnabled(true); ui->cbxUserPriKey->setEnabled(true); ui->cbxUserPriKey->setCurrentIndex(0); ui->leUserKeyPwd->setText(""); ui->lbUserKeyPwd->setEnabled(false); ui->leUserKeyPwd->setEnabled(false); } } void DlgHideWifiEapTls::on_cbxUserPriKey_currentIndexChanged(const QString &arg1) { if (ui->cbxUserPriKey->currentIndex() == 0){ ui->leUserKeyPwd->setText(""); ui->lbUserKeyPwd->setEnabled(false); ui->leUserKeyPwd->setEnabled(false); }else{ ui->leUserKeyPwd->setText(""); ui->lbUserKeyPwd->setEnabled(true); ui->leUserKeyPwd->setEnabled(true); } } void DlgHideWifiEapTls::on_btnCancel_clicked() { this->close(); } void DlgHideWifiEapTls::on_btnConnect_clicked() { this->close(); } void DlgHideWifiEapTls::on_checkBoxCA_stateChanged(int arg1) { if (arg1 == 0) { ui->cbxCA->setCurrentIndex(0); ui->lbCA->setEnabled(true); ui->cbxCA->setEnabled(true); } else { ui->cbxCA->setCurrentIndex(0); ui->lbCA->setEnabled(false); ui->cbxCA->setEnabled(false); } } void DlgHideWifiEapTls::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->leCaPwd->setEchoMode(QLineEdit::Password); } else { ui->leCaPwd->setEchoMode(QLineEdit::Normal); } } void DlgHideWifiEapTls::on_checkBoxPwdSec_stateChanged(int arg1) { if (arg1 == 0) { ui->leUserCertifyPwd->setEchoMode(QLineEdit::Password); ui->leUserKeyPwd->setEchoMode(QLineEdit::Password); } else { ui->leUserCertifyPwd->setEchoMode(QLineEdit::Normal); ui->leUserKeyPwd->setEchoMode(QLineEdit::Normal); } } void DlgHideWifiEapTls::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leIdentity->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leDomain->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxCA->currentIndex() == 0){ if (ui->cbxUserCertify->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else { if (ui->leUserCertifyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxUserPriKey->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if (ui->leUserKeyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else{ ui->btnConnect->setEnabled(true); } } } } else { if (ui->leCaPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxUserCertify->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else { if (ui->leUserCertifyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxUserPriKey->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if (ui->leUserKeyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else{ ui->btnConnect->setEnabled(true); } } } } } } } void DlgHideWifiEapTls::on_leIdentity_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leIdentity->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leDomain->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxCA->currentIndex() == 0){ if (ui->cbxUserCertify->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else { if (ui->leUserCertifyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxUserPriKey->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if (ui->leUserKeyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else{ ui->btnConnect->setEnabled(true); } } } } else { if (ui->leCaPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxUserCertify->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else { if (ui->leUserCertifyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxUserPriKey->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if (ui->leUserKeyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else{ ui->btnConnect->setEnabled(true); } } } } } } } void DlgHideWifiEapTls::on_leDomain_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leIdentity->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leDomain->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxCA->currentIndex() == 0){ if (ui->cbxUserCertify->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else { if (ui->leUserCertifyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxUserPriKey->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if (ui->leUserKeyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else{ ui->btnConnect->setEnabled(true); } } } } else { if (ui->leCaPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxUserCertify->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else { if (ui->leUserCertifyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxUserPriKey->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if (ui->leUserKeyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else{ ui->btnConnect->setEnabled(true); } } } } } } } void DlgHideWifiEapTls::on_leCaPwd_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leIdentity->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leDomain->text() == ""){ ui->btnConnect->setEnabled(false); } else if(ui->leCaPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxUserCertify->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else { if (ui->leUserCertifyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxUserPriKey->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if (ui->leUserKeyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else{ ui->btnConnect->setEnabled(true); } } } } } void DlgHideWifiEapTls::on_leUserCertifyPwd_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leIdentity->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leDomain->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxCA->currentIndex() == 0){ if (ui->leUserCertifyPwd->text() == ""){ ui->btnConnect->setEnabled(false); }else{ if (ui->cbxUserPriKey->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if (ui->leUserKeyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else{ ui->btnConnect->setEnabled(true); } } } else { if (ui->leCaPwd->text() == ""){ ui->btnConnect->setEnabled(false); }else{ if (ui->leUserCertifyPwd->text() == ""){ ui->btnConnect->setEnabled(false); }else{ if (ui->cbxUserPriKey->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if (ui->leUserKeyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else{ ui->btnConnect->setEnabled(true); } } } } } } void DlgHideWifiEapTls::on_leUserKeyPwd_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leIdentity->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leDomain->text() == ""){ ui->btnConnect->setEnabled(false); } else { if (ui->cbxCA->currentIndex() == 0){ if (ui->leUserCertifyPwd->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leUserKeyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else{ ui->btnConnect->setEnabled(true); } } else { if (ui->leCaPwd->text() == ""){ ui->btnConnect->setEnabled(false); }else{ if (ui->leUserCertifyPwd->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leUserKeyPwd->text() == ""){ ui->btnConnect->setEnabled(false); } else{ ui->btnConnect->setEnabled(true); } } } } } void DlgHideWifiEapTls::paintEvent(QPaintEvent *event) { KylinDBus mkylindbus; double trans = mkylindbus.getTransparentData(); QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlghidewifieapttls.ui0000644000175000017500000002730414205345374021166 0ustar fengfeng DlgHideWifiEapTTLS 0 0 432 665 Connect to Hidden Wi-Fi Network 180 75 200 32 10 180 385 200 32 10 QLineEdit::Password 180 145 200 32 10 315 620 90 30 10 180 545 200 32 10 QLineEdit::Password 215 620 90 30 10 76 310 90 20 10 357 557 18 9 10 76 510 90 20 10 76 190 90 20 10 180 185 200 32 10 180 345 200 32 10 180 465 200 32 10 180 505 200 32 10 QLineEdit::Normal 76 350 90 20 10 180 225 200 32 10 76 270 90 20 10 76 150 90 20 10 180 425 200 25 10 76 470 90 20 10 180 305 200 32 10 76 230 90 20 10 76 80 90 20 10 76 390 90 20 10 76 550 90 20 10 357 397 18 9 10 180 265 200 32 10 0 0 432 665 30 30 140 22 10 125 412 1 Qt::Horizontal 10 600 412 1 Qt::Horizontal lbBoder cbxConn leCaPwd leNetName btnConnect lePassword btnCancel lbDomain checkBoxPwdSec lbUserName lbSecurity cbxSecurity cbxCA cbxInnerAuth leUserName lbCA cbxAuth lbAnonyId lbNetName checkBoxCA lbInnerAuth leDomain lbAuth lbConn lbCaPwd lbPassword checkBoxPwd leAnonyId lbLeftupTitle lineUp lineDown kylin-nm/wireless-security/dlghidewifieapfast.h0000644000175000017500000000366114205345374020747 0ustar fengfeng/* * 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 namespace Ui { class DlgHideWifiEapFast; } class DlgHideWifiEapFast : public QDialog { Q_OBJECT public: explicit DlgHideWifiEapFast(int type, QWidget *parent = 0); ~DlgHideWifiEapFast(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialogSecu(); void changeDialogAuth(); private slots: void on_btnCancel_clicked(); void on_btnConnect_clicked(); void on_checkBoxAutoPCA_stateChanged(int arg1); void on_checkBoxPwd_stateChanged(int arg1); void on_leNetName_textEdited(const QString &arg1); void on_leAnonyId_textEdited(const QString &arg1); void on_leUserName_textEdited(const QString &arg1); void on_lePassword_textEdited(const QString &arg1); private: Ui::DlgHideWifiEapFast *ui; int WepOrWpa = 0;//0 WEP;1WPA // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); // QString labelQss, cbxQss, leQss, btnConnQss, btnCancelQss, lineQss, checkBoxQss; bool isPress; QPoint winPos; QPoint dragPos; }; #endif // DLGCONNHIDWIFISECFAST_H kylin-nm/wireless-security/dlghidewifieappeap.ui0000644000175000017500000003060614205345374021124 0ustar fengfeng DlgHideWifiEapPeap 0 0 432 700 Connect to Hidden WLAN Network 180 141 200 32 10 180 341 200 32 10 76 76 90 20 10 180 301 200 32 10 180 71 200 32 10 180 381 200 32 10 QLineEdit::Password 315 650 90 30 10 180 181 200 32 10 180 261 200 32 10 183 421 200 25 10 76 146 90 20 10 215 650 90 30 10 76 306 90 20 10 76 386 90 20 10 357 593 18 9 10 357 393 18 9 10 76 186 90 20 10 180 461 200 32 10 76 226 90 20 10 76 466 90 20 10 180 221 200 32 10 76 346 90 20 10 76 266 90 20 10 76 586 90 20 10 180 541 200 32 10 180 501 200 32 10 180 581 200 32 10 QLineEdit::Password 76 506 90 20 10 76 546 90 20 10 0 0 432 700 30 28 140 22 10 121 412 1 Qt::Horizontal 10 631 412 1 Qt::Horizontal lbBoder leNetName cbxCA lbConn leDomain cbxConn leCaPwd btnConnect cbxSecurity leAnonyId checkBoxCA lbNetName btnCancel lbDomain lbCaPwd checkBoxPwd lbSecurity cbxPEAPver lbAuth lbPEAPver cbxAuth lbCA lbAnonyId lbPassword leUserName cbxInnerAuth lePassword lbInnerAuth lbUserName checkBoxPwdSec lbLeftupTitle lineUp lineDown kylin-nm/wireless-security/dlghidewifiwpa.ui0000644000175000017500000001172014205345374020274 0ustar fengfeng DlgHideWifiWpa 0 0 432 327 Connect to Hidden Wi-Fi Network 70 151 100 20 10 70 106 100 20 10 215 280 90 30 10 370 203 18 9 10 70 196 100 20 10 181 100 182 32 10 181 191 182 32 10 QLineEdit::Password 315 280 90 30 10 181 145 182 32 10 0 0 432 327 30 30 240 22 10 70 412 1 Qt::Horizontal 10 250 412 1 Qt::Horizontal lbBoder lePassword lbNetName lbSecurity btnCancel checkBoxPwd lbPassword cbxSecurity btnConnect leNetName lbLeftupTitle lineUp lineDown kylin-nm/wireless-security/dlghidewifieappeap.h0000644000175000017500000000462114205345374020734 0ustar fengfeng/* * 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 class MainWindow; namespace Ui { class DlgHideWifiEapPeap; } class DlgHideWifiEapPeap : public QDialog { Q_OBJECT public: //type: 0是动态 WEP, 1是企业wpa, beUsed:是否是之前已经连接过多网络 explicit DlgHideWifiEapPeap(int type, int beUsed, MainWindow *mw = 0, QWidget *parent = 0); ~DlgHideWifiEapPeap(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialogSecu(); void changeDialogAuth(); void changeWindow(); private slots: void on_btnCancel_clicked(); void on_btnConnect_clicked(); void on_cbxCA_currentIndexChanged(const QString &arg1); void on_checkBoxPwd_stateChanged(int arg1); void on_checkBoxCA_stateChanged(int arg1); void on_checkBoxPwdSec_stateChanged(int arg1); void on_leNetName_textEdited(const QString &arg1); void on_leAnonyId_textEdited(const QString &arg1); void on_leDomain_textEdited(const QString &arg1); void on_leCaPwd_textEdited(const QString &arg1); void on_leUserName_textEdited(const QString &arg1); void on_lePassword_textEdited(const QString &arg1); private: Ui::DlgHideWifiEapPeap *ui; int WepOrWpa = 0;//0 WEP;1 WPA int isUsed;//=0 current wifi not used before; >=1 used MainWindow *mw; // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); // QString labelQss, cbxQss, leQss, btnConnQss, btnCancelQss, lineQss, checkBoxQss, checkBoxCAQss; bool isPress; QPoint winPos; QPoint dragPos; }; #endif // DLGCONNHIDWIFISECPEAP_H kylin-nm/wireless-security/dlghidewifieappeap.cpp0000644000175000017500000004674014205345374021277 0ustar fengfeng/* * 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 DlgHideWifiEapPeap::DlgHideWifiEapPeap(int type, int beUsed, MainWindow *mainWindow, QWidget *parent) : WepOrWpa(type), isUsed(beUsed), QDialog(parent), ui(new Ui::DlgHideWifiEapPeap) { ui->setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); this->setAttribute(Qt::WA_TranslucentBackground); this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); //需要添加 void paintEvent(QPaintEvent *event) 函数 QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); MyQss objQss; ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->hide(); ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:20px;}"); ui->checkBoxPwd->setStyleSheet(objQss.checkBoxQss); ui->checkBoxPwdSec->setStyleSheet(objQss.checkBoxQss); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->lbLeftupTitle->setText(tr("Add hidden WLAN")); //加入隐藏WLAN ui->lbConn->setText(tr("Connection")); //连接设置: ui->lbNetName->setText(tr("Network name")); //网络名称: ui->lbSecurity->setText(tr("WLAN security")); //Wi-Fi安全性: ui->lbAuth->setText(tr("Authentication")); //认证: ui->lbAnonyId->setText(tr("Anonymous identity")); //匿名身份: ui->lbDomain->setText(tr("Domain")); //域名: ui->lbCA->setText(tr("CA certificate")); //CA 证书: ui->lbCaPwd->setText(tr("CA certificate password")); //CA 证书密码: ui->checkBoxCA->setText(tr("No CA certificate is required")); //不需要CA证书 ui->lbPEAPver->setText(tr("PEAP version")); //PEAP版本: ui->lbInnerAuth->setText(tr("Inner authentication")); //内部认证: ui->lbUserName->setText(tr("Username")); //用户名: ui->lbPassword->setText(tr("Password")); //密码: ui->btnCancel->setText(tr("Cancel")); //取消 ui->btnConnect->setText(tr("Connect")); //连接 ui->btnCancel->setStyleSheet(objQss.btnOffQss); ui->btnConnect->setStyleSheet(objQss.btnOffQss); ui->cbxConn->addItem("新建..."); int status = system("nmcli connection show>/tmp/kylin-nm-connshow"); qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); connect(ui->cbxConn,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeWindow())); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA and WPA2 Personal")); //WPA 及 WPA2 个人 ui->cbxSecurity->addItem(tr("WPA and WPA2 Enterprise")); //WPA 及 WPA2 企业 //ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) //ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 //ui->cbxSecurity->addItem("LEAP"); //ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) if (WepOrWpa == 0) { ui->cbxSecurity->setCurrentIndex(5); } else if (WepOrWpa == 1) { ui->cbxSecurity->setCurrentIndex(2); } connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogSecu())); //ui->cbxAuth->addItem("TLS"); //ui->cbxAuth->addItem("LEAP"); //ui->cbxAuth->addItem("PWD"); //ui->cbxAuth->addItem("FAST"); //ui->cbxAuth->addItem(tr("Tunneled TLS"));//隧道 TLS ui->cbxAuth->addItem(tr("Protected EAP (PEAP)")); //受保护的 EAP ui->cbxAuth->setCurrentIndex(0); //connect(ui->cbxAuth,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogAuth())); ui->cbxCA->addItem(tr("None")); //无 ui->cbxCA->addItem(tr("Choose from file")); //从文件选择... ui->cbxCA->setCurrentIndex(0); ui->cbxPEAPver->addItem(tr("Automatic")); //自动 ui->cbxPEAPver->addItem(tr("Version 0")); //版本 0 ui->cbxPEAPver->addItem(tr("Version 1")); //版本 1 ui->cbxPEAPver->setCurrentIndex(0); ui->cbxInnerAuth->addItem("MSCHAPv2"); ui->cbxInnerAuth->addItem("MDS"); ui->cbxInnerAuth->addItem("GTC"); ui->cbxInnerAuth->setCurrentIndex(0); if (isUsed == 0) { ui->btnConnect->setEnabled(false); } else { ui->cbxConn->setCurrentIndex(isUsed); ui->leNetName->setText(ui->cbxConn->currentText()); ui->leNetName->setEnabled(false); ui->cbxSecurity->setEnabled(false); ui->cbxAuth->setEnabled(false); ui->leAnonyId->setEnabled(false); ui->leDomain->setEnabled(false); ui->cbxCA->setEnabled(false); ui->leCaPwd->setEnabled(false); ui->checkBoxCA->setEnabled(false); ui->cbxPEAPver->setEnabled(false); ui->cbxInnerAuth->setEnabled(false); ui->leUserName->setText(""); ui->leUserName->setEnabled(false); ui->lePassword->setText(""); ui->lePassword->setEnabled(false); ui->btnConnect->setEnabled(true); } this->setFixedSize(432,700); this->mw = mainWindow; } DlgHideWifiEapPeap::~DlgHideWifiEapPeap() { delete ui; } //void DlgHideWifiEapPeap::mousePressEvent(QMouseEvent *event){ // if (event->button() == Qt::LeftButton) { // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } //} //void DlgHideWifiEapPeap::mouseReleaseEvent(QMouseEvent *event){ // this->isPress = false; //} //void DlgHideWifiEapPeap::mouseMoveEvent(QMouseEvent *event){ // if (this->isPress) { // this->move(this->winPos - (this->dragPos - event->globalPos())); // event->accept(); // } //} //切换到其他Wi-Fi安全类型 void DlgHideWifiEapPeap::changeDialogSecu() { if (ui->cbxSecurity->currentIndex()==0) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifi *connHidWifi = new DlgHideWifi(0); connHidWifi->show(); connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(1, 0); connHidWifiWpa->show(); connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } else if(ui->cbxSecurity->currentIndex()==2) { if (WepOrWpa == 0) { ui->cbxSecurity->setCurrentIndex(6); WepOrWpa = 1; } } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==5) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiLeap *connHidWifiLeap = new DlgHideWifiLeap(); connHidWifiLeap->show(); } else { if (WepOrWpa == 1) { ui->cbxSecurity->setCurrentIndex(5); WepOrWpa = 0; } } } //同一 Wi-Fi安全类型的Authentication变换 void DlgHideWifiEapPeap::changeDialogAuth() { if (ui->cbxAuth->currentIndex()==0) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapTls *connHidWifiEapTls = new DlgHideWifiEapTls(WepOrWpa, 0, mw); connHidWifiEapTls->show(); } else if(ui->cbxAuth->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapLeap *connHidWifiEapLeap = new DlgHideWifiEapLeap(WepOrWpa); connHidWifiEapLeap->show(); } else if(ui->cbxAuth->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapPwd *connHidWifiEapPwd = new DlgHideWifiEapPwd(WepOrWpa); connHidWifiEapPwd->show(); } else if(ui->cbxAuth->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapFast *connHidWifiEapFast = new DlgHideWifiEapFast(WepOrWpa); connHidWifiEapFast->show(); } else if(ui->cbxAuth->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapTTLS *connHidWifiEapTTls = new DlgHideWifiEapTTLS(WepOrWpa); connHidWifiEapTTls->show(); } else { qDebug()<<"it's not need to change dialog"; } } //同一 Wi-Fi安全类型的窗口变换 void DlgHideWifiEapPeap::changeWindow(){ if (ui->cbxConn->currentIndex() == 0) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifi *connHidWifi = new DlgHideWifi(0, mw); connHidWifi->show(); connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } else if (ui->cbxConn->currentIndex() >= 1) { QString tmpPath = "/tmp/kylin-nm-connshow-" + QDir::home().dirName(); QString currStr = "nmcli connection show '" + ui->cbxConn->currentText() + "' > " + tmpPath; int status = system(currStr.toUtf8().data()); qDebug()<<"executed cmd="<hide(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(1, ui->cbxConn->currentIndex(), mw); connHidWifiWpa->show(); connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } if (txt.indexOf("wpa-eap") != -1) { isUsed = ui->cbxConn->currentIndex(); ui->leNetName->setText(ui->cbxConn->currentText()); ui->leNetName->setEnabled(false); ui->cbxSecurity->setEnabled(false); ui->cbxAuth->setEnabled(false); ui->leAnonyId->setEnabled(false); ui->leDomain->setEnabled(false); ui->cbxCA->setEnabled(false); ui->leCaPwd->setEnabled(false); ui->checkBoxCA->setEnabled(false); ui->cbxPEAPver->setEnabled(false); ui->cbxInnerAuth->setEnabled(false); ui->leUserName->setText(""); ui->leUserName->setEnabled(false); ui->lePassword->setText(""); ui->lePassword->setEnabled(false); ui->btnConnect->setEnabled(true); } } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifi *connHidWifi = new DlgHideWifi(ui->cbxConn->currentIndex(), mw); connHidWifi->show(); connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } } } //CA证书的Index变化 void DlgHideWifiEapPeap::on_cbxCA_currentIndexChanged(const QString &arg1) { if (ui->cbxCA->currentIndex() == 0) { ui->leCaPwd->setText(""); ui->lbCaPwd->setEnabled(false); ui->leCaPwd->setEnabled(false); } else { ui->leCaPwd->setText(""); ui->lbCaPwd->setEnabled(true); ui->leCaPwd->setEnabled(true); } } void DlgHideWifiEapPeap::on_btnCancel_clicked() { this->close(); } void DlgHideWifiEapPeap::on_btnConnect_clicked() { this->close(); } //是否显示密码 void DlgHideWifiEapPeap::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->leCaPwd->setEchoMode(QLineEdit::Password); } else { ui->leCaPwd->setEchoMode(QLineEdit::Normal); } } //是否是不需要CA证书 void DlgHideWifiEapPeap::on_checkBoxCA_stateChanged(int arg1) { if (arg1 == 0) { ui->cbxCA->setCurrentIndex(0); ui->leCaPwd->setText(""); ui->lbCA->setEnabled(true); ui->cbxCA->setEnabled(true); } else { ui->cbxCA->setCurrentIndex(0); ui->leCaPwd->setText(""); ui->lbCA->setEnabled(false); ui->cbxCA->setEnabled(false); } } //是否显示密码 void DlgHideWifiEapPeap::on_checkBoxPwdSec_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } //编辑网络名称 void DlgHideWifiEapPeap::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == "") { ui->btnConnect->setEnabled(false); } else { if (ui->checkBoxCA->isChecked()) { //勾选"不需要CA证书" ui->btnConnect->setEnabled(true); } else { //未勾选"不需要CA证书" if (ui->cbxCA->currentIndex() == 0) { ui->btnConnect->setEnabled(true); } else if(ui->leCaPwd->text() == "") { ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } } } //编辑匿名身份 void DlgHideWifiEapPeap::on_leAnonyId_textEdited(const QString &arg1) { if (ui->leNetName->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leAnonyId->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leDomain->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == "") { ui->btnConnect->setEnabled(false); } else { if (ui->cbxCA->currentIndex() == 0) { ui->btnConnect->setEnabled(true); } else if(ui->leCaPwd->text() == "") { ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } } //编辑域名 void DlgHideWifiEapPeap::on_leDomain_textEdited(const QString &arg1) { if (ui->leNetName->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leAnonyId->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leDomain->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == "") { ui->btnConnect->setEnabled(false); } else { if (ui->cbxCA->currentIndex() == 0) { ui->btnConnect->setEnabled(true); } else if(ui->leCaPwd->text() == "") { ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } } //编辑CA证书密码 void DlgHideWifiEapPeap::on_leCaPwd_textEdited(const QString &arg1) { if (ui->leNetName->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leAnonyId->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leDomain->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leCaPwd->text() == "") { ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } //编辑用户名 void DlgHideWifiEapPeap::on_leUserName_textEdited(const QString &arg1) { if (ui->leNetName->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == "") { ui->btnConnect->setEnabled(false); } else { if (ui->checkBoxCA->isChecked()) { //勾选"不需要CA证书" ui->btnConnect->setEnabled(true); } else { //未勾选"不需要CA证书" if (ui->cbxCA->currentIndex() == 0) { ui->btnConnect->setEnabled(true); } else if(ui->leCaPwd->text() == "") { ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } } } //编辑密码 void DlgHideWifiEapPeap::on_lePassword_textEdited(const QString &arg1) { if (ui->leNetName->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == "") { ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == "") { ui->btnConnect->setEnabled(false); } else { if (ui->checkBoxCA->isChecked()) { //勾选"不需要CA证书" ui->btnConnect->setEnabled(true); } else { //未勾选"不需要CA证书" if (ui->cbxCA->currentIndex() == 0) { ui->btnConnect->setEnabled(true); } else if(ui->leCaPwd->text() == "") { ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } } } void DlgHideWifiEapPeap::paintEvent(QPaintEvent *event) { KylinDBus mkylindbus; double trans = mkylindbus.getTransparentData(); QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlghidewifieapfast.cpp0000644000175000017500000003165714205345374021310 0ustar fengfeng/* * 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 setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); this->setAttribute(Qt::WA_TranslucentBackground); //需要添加 void paintEvent(QPaintEvent *event) 函数 QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); MyQss objQss; ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->hide(); ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}"); ui->lbConn->setStyleSheet(objQss.labelQss); ui->lbNetName->setStyleSheet(objQss.labelQss); ui->lbSecurity->setStyleSheet(objQss.labelQss); ui->lbAuth->setStyleSheet(objQss.labelQss); ui->lbAnonyId->setStyleSheet(objQss.labelQss); ui->checkBoxAutoPCA->setStyleSheet(objQss.checkBoxCAQss); ui->lbPCAfile->setStyleSheet(objQss.labelQss); ui->lbInnerAuth->setStyleSheet(objQss.labelQss); ui->lbUserName->setStyleSheet(objQss.labelQss); ui->lbPassword->setStyleSheet(objQss.labelQss); ui->cbxConn->setStyleSheet(objQss.cbxQss); ui->cbxConn->setView(new QListView()); ui->leNetName->setStyleSheet(objQss.leQss); ui->cbxSecurity->setStyleSheet(objQss.cbxQss); ui->cbxSecurity->setView(new QListView()); ui->cbxAuth->setStyleSheet(objQss.cbxQss); ui->cbxAuth->setView(new QListView()); ui->leAnonyId->setStyleSheet(objQss.leQss); ui->cbxAutoPCA->setStyleSheet(objQss.cbxQss); ui->cbxAutoPCA->setView(new QListView()); ui->lePCAfile->setStyleSheet(objQss.leQss); ui->cbxInnerAuth->setStyleSheet(objQss.cbxQss); ui->cbxInnerAuth->setView(new QListView()); ui->leUserName->setStyleSheet(objQss.leQss); ui->lePassword->setStyleSheet(objQss.leQss); ui->checkBoxPwd->setStyleSheet(objQss.checkBoxQss); ui->btnCancel->setStyleSheet(objQss.btnOffQss); ui->btnConnect->setStyleSheet(objQss.btnOffQss); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->lbLeftupTitle->setText(tr("Add hidden WLAN")); //加入隐藏WLAN ui->lbConn->setText(tr("Connection")); //连接设置: ui->lbNetName->setText(tr("Network name")); //网络名称: ui->lbSecurity->setText(tr("WLAN security")); //Wi-Fi安全性: ui->lbAuth->setText(tr("Authentication")); //认证: ui->lbAnonyId->setText(tr("Anonymous identity")); //匿名身份: ui->checkBoxAutoPCA->setText(tr("Allow automatic PAC pro_visioning")); //自动PAC配置: ui->lbPCAfile->setText(tr("PAC file"));//PAC文件: ui->lbInnerAuth->setText(tr("Inner authentication")); //内部认证: ui->lbUserName->setText(tr("Username")); //用户名: ui->lbPassword->setText(tr("Password")); //密码: ui->btnCancel->setText(tr("Cancel")); //取消 ui->btnConnect->setText(tr("Connect")); //连接 ui->checkBoxAutoPCA->setFocusPolicy(Qt::NoFocus); ui->checkBoxPwd->setFocusPolicy(Qt::NoFocus); ui->cbxConn->addItem(tr("C_reate…")); //新建... int status = system("nmcli connection show>/tmp/kylin-nm-connshow"); qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA and WPA2 Personal")); //WPA 及 WPA2 个人 ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 ui->cbxSecurity->addItem("LEAP"); ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) ui->cbxSecurity->addItem(tr("WPA and WPA2 Enterprise")); //WPA 及 WPA2 企业 if (WepOrWpa == 0) { ui->cbxSecurity->setCurrentIndex(5); } else if (WepOrWpa == 1) { ui->cbxSecurity->setCurrentIndex(6); } connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogSecu())); ui->cbxAuth->addItem("TLS"); ui->cbxAuth->addItem("LEAP"); ui->cbxAuth->addItem("PWD"); ui->cbxAuth->addItem("FAST"); ui->cbxAuth->addItem(tr("Tunneled TLS"));//隧道 TLS ui->cbxAuth->addItem(tr("Protected EAP (PEAP)")); //受保护的 EAP ui->cbxAuth->setCurrentIndex(3); connect(ui->cbxAuth,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogAuth())); ui->checkBoxAutoPCA->setCheckState(Qt::Checked); ui->cbxAutoPCA->addItem(tr("Anonymous")); //匿名 ui->cbxAutoPCA->addItem(tr("Authenticated")); //已认证 ui->cbxAutoPCA->addItem(tr("Both")); //两者兼用 ui->cbxAutoPCA->setCurrentIndex(0); ui->lePCAfile->setText(tr("None")); //(无) ui->cbxInnerAuth->addItem("GTC"); ui->cbxInnerAuth->addItem("MSCHAPv2"); ui->cbxInnerAuth->setCurrentIndex(0); ui->btnConnect->setEnabled(false); this->setFixedSize(432,673); } DlgHideWifiEapFast::~DlgHideWifiEapFast() { delete ui; } //void DlgHideWifiEapFast::mousePressEvent(QMouseEvent *event){ // if(event->button() == Qt::LeftButton){ // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } //} //void DlgHideWifiEapFast::mouseReleaseEvent(QMouseEvent *event){ // this->isPress = false; //} //void DlgHideWifiEapFast::mouseMoveEvent(QMouseEvent *event){ // if(this->isPress){ // this->move(this->winPos - (this->dragPos - event->globalPos())); // event->accept(); // } //} void DlgHideWifiEapFast::changeDialogSecu() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifi *connHidWifi = new DlgHideWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(1, 0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiLeap *connHidWifiLeap = new DlgHideWifiLeap(); connHidWifiLeap->show(); } else if(ui->cbxSecurity->currentIndex()==5) { if (WepOrWpa == 1) { ui->cbxSecurity->setCurrentIndex(5); WepOrWpa = 0; } } else { if (WepOrWpa == 0){ ui->cbxSecurity->setCurrentIndex(6); WepOrWpa = 1; } } } void DlgHideWifiEapFast::changeDialogAuth() { if(ui->cbxAuth->currentIndex()==0){ //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapTls *connHidWifiEapTls = new DlgHideWifiEapTls(WepOrWpa); //connHidWifiEapTls->show(); } else if(ui->cbxAuth->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapLeap *connHidWifiEapLeap = new DlgHideWifiEapLeap(WepOrWpa); connHidWifiEapLeap->show(); } else if(ui->cbxAuth->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapPwd *connHidWifiEapPwd = new DlgHideWifiEapPwd(WepOrWpa); connHidWifiEapPwd->show(); } else if(ui->cbxAuth->currentIndex()==3) { qDebug()<<"it's not need to change dialog"; } else if(ui->cbxAuth->currentIndex()==4) { //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapTTLS *connHidWifiEapTTls = new DlgHideWifiEapTTLS(WepOrWpa); //connHidWifiEapTTls->show(); } else { //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(WepOrWpa); //connHidWifiEapPeap->show(); } } void DlgHideWifiEapFast::on_btnCancel_clicked() { this->close(); } void DlgHideWifiEapFast::on_btnConnect_clicked() { this->close(); } void DlgHideWifiEapFast::on_checkBoxAutoPCA_stateChanged(int arg1) { if (arg1 == 0) { ui->cbxAutoPCA->setEnabled(false); } else { ui->cbxAutoPCA->setEnabled(true); } } void DlgHideWifiEapFast::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword ->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgHideWifiEapFast::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if(ui->leAnonyId->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiEapFast::on_leAnonyId_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if(ui->leAnonyId->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiEapFast::on_leUserName_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if(ui->leAnonyId->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiEapFast::on_lePassword_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if(ui->leAnonyId->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiEapFast::paintEvent(QPaintEvent *event) { KylinDBus mkylindbus; double trans = mkylindbus.getTransparentData(); QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlghidewifi.cpp0000644000175000017500000002561314205345444017735 0ustar fengfeng/* * 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 DlgHideWifi::DlgHideWifi(int type, MainWindow *mainWindow, QWidget *parent) : isUsed(type), QDialog(parent), ui(new Ui::DlgHideWifi) { ui->setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); this->setAttribute(Qt::WA_TranslucentBackground); this->setAttribute(Qt::WA_DeleteOnClose); this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); //需要添加 void paintEvent(QPaintEvent *event) 函数 QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); MyQss objQss; ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->hide(); ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:20px;}"); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->lbLeftupTitle->setText(tr("Add Hidden WLAN")); //加入隐藏WLAN ui->lbNetName->setText(tr("WLAN name")); //网络名称: ui->lbSecurity->setText(tr("WLAN security")); //Wi-Fi安全性: ui->btnCancel->setText(tr("Cancel")); //取消 ui->btnConnect->setText(tr("Connect")); //连接 ui->btnCancel->setStyleSheet(objQss.btnOffQss); ui->btnConnect->setStyleSheet(objQss.btnOffQss); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA and WPA2 Personal")); //WPA 及 WPA2 个人 ui->cbxSecurity->addItem(tr("WPA and WPA2 Enterprise")); //WPA 及 WPA2 企业 ui->cbxSecurity->addItem(tr("WPA2 and WPA3 Personal")); //WPA2 及 WPA3 个人 ui->cbxSecurity->addItem(tr("WPA3 Personal")); //WPA3 个人 //ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) //ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 //ui->cbxSecurity->addItem("LEAP"); //ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) ui->cbxSecurity->setCurrentIndex(0); connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog())); if (isUsed == 0) { ui->btnConnect->setEnabled(false); } else { ui->lbNetName->setEnabled(false); ui->leNetName->setEnabled(false); ui->lbSecurity->setEnabled(false); ui->cbxSecurity->setEnabled(false); ui->btnConnect->setEnabled(true); } ui->leNetName->setContextMenuPolicy(Qt::NoContextMenu); //禁止LineEdit的右键菜单 this->setFixedSize(432,288); this->mw = mainWindow; } DlgHideWifi::~DlgHideWifi() { delete ui; } //void DlgHideWifi::mousePressEvent(QMouseEvent *event){ // if(event->button() == Qt::LeftButton){ // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } // return QDialog::mousePressEvent(event); //} //void DlgHideWifi::mouseReleaseEvent(QMouseEvent *event){ // this->isPress = false; // return QDialog::mouseReleaseEvent(event); //} //void DlgHideWifi::mouseMoveEvent(QMouseEvent *event){ // if(this->isPress){ // this->move(this->winPos - (this->dragPos - event->globalPos())); // event->accept(); // } // return QDialog::mouseMoveEvent(event); //} //切换到其他Wi-Fi安全类型 void DlgHideWifi::changeDialog() { if(ui->cbxSecurity->currentIndex()==0){ //无安全性 qDebug()<<"it's not need to change dialog"; } else if(ui->cbxSecurity->currentIndex()==1) { //WPA 及 WPA2 个人 QApplication::setQuitOnLastWindowClosed(false); this->close(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(1, 0, mw); connHidWifiWpa->show(); connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } else if(ui->cbxSecurity->currentIndex()==2) { //WPA 及 WPA2 企业 QApplication::setQuitOnLastWindowClosed(false); this->close(); WpaWifiDialog * wpadlg = new WpaWifiDialog(mw, mw, ""); QPoint pos = QCursor::pos(); QRect primaryGeometry; for (QScreen *screen : qApp->screens()) { if (screen->geometry().contains(pos)) { primaryGeometry = screen->geometry(); } } if (primaryGeometry.isEmpty()) { primaryGeometry = qApp->primaryScreen()->geometry(); } wpadlg->move(primaryGeometry.width() / 2 - wpadlg->width() / 2, primaryGeometry.height() / 2 - wpadlg->height() / 2); wpadlg->show(); #if 0 connect(wpadlg, &WpaWifiDialog::conn_done, this, [ = ]() { QString txt(tr("Conn WLAN Success")); mw->objKyDBus->showDesktopNotify(txt); mw->on_btnWifiList_clicked(); }); connect(wpadlg, &WpaWifiDialog::conn_failed, this, [ = ]() { QString txt(tr("Confirm your WLAN password or usable of wireless card")); mw->objKyDBus->showDesktopNotify(txt); mw->on_btnWifiList_clicked(); }); #endif // DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(1, 0, mw); // connHidWifiEapPeap->show(); } else if(ui->cbxSecurity->currentIndex()==3) { //WPA2 及 WPA3 个人 QApplication::setQuitOnLastWindowClosed(false); this->close(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(3, 0, mw); connHidWifiWpa->show(); connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } else if(ui->cbxSecurity->currentIndex()==4) { //WPA3 个人 QApplication::setQuitOnLastWindowClosed(false); this->close(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(4, 0, mw); connHidWifiWpa->show(); connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } else if(ui->cbxSecurity->currentIndex()==5) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==6) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==7) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiLeap *connHidWifiLeap = new DlgHideWifiLeap(); connHidWifiLeap->show(); } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(0, 0, mw); connHidWifiEapPeap->show(); } } void DlgHideWifi::on_btnCancel_clicked() { //this->close(); this->hide(); } void DlgHideWifi::on_btnConnect_clicked() { mw->is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; mw->is_connect_hide_wifi = 1; QThread *t = new QThread(); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(this, SIGNAL(stopSignal()), t, SLOT(quit())); QString wifiName = ui->leNetName->text(); strWifiname = wifiName; BackThread *bt = new BackThread(); if (isUsed == 0) { bt->moveToThread(t); connect(t, SIGNAL(started()), this, SLOT(slotStartConnectHiddenOpenWifi())); connect(this, SIGNAL(sigConnHiddenWifi(int, QString, QString)), bt, SLOT(execConnHiddenWifiWPA(int, QString,QString))); connect(bt, SIGNAL(connDone(int)), mw, SLOT(connWifiDone(int))); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); } else { bt->moveToThread(t); connect(t, SIGNAL(started()), this, SLOT(slotStartConnectRememberedHiddenWifi())); connect(this, SIGNAL(sigConnRememberedHiddenWifi(QString)), bt, SLOT(execConnRememberedHiddenWifi(QString))); connect(bt, SIGNAL(connDone(int)), mw, SLOT(connWifiDone(int))); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); } t->start(); //this->close(); this->hide(); } void DlgHideWifi::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } if (ui->leNetName->text().size() > 32) { QString cutStr = ui->leNetName->text().mid(0,32); ui->leNetName->setText(cutStr); } } void DlgHideWifi::slotStartLoading() { mw->startLoading(); } void DlgHideWifi::slotStartConnectHiddenOpenWifi() { mw->startLoading(); emit sigConnHiddenWifi(ui->cbxSecurity->currentIndex(), ui->leNetName->text(), QString("")); } void DlgHideWifi::slotStartConnectRememberedHiddenWifi() { mw->startLoading(); emit sigConnRememberedHiddenWifi(ui->leNetName->text()); } void DlgHideWifi::on_execSecConn() { QString str = "nmcli device wifi connect '" + strWifiname + "' password ''"; int status = system(str.toUtf8().data()); qDebug()<<"executed cmd="< DlgHideWifiLeap 0 0 432 434 Connect to Hidden Wi-Fi Network 175 264 182 32 10 175 219 182 32 10 215 390 90 30 10 76 84 90 20 10 Qt::LeftToRight 175 79 182 32 10 76 270 90 20 10 332 321 18 9 10 76 315 90 20 10 76 180 90 20 10 76 225 90 20 10 315 390 90 30 10 175 309 182 32 10 QLineEdit::Password 175 174 182 32 10 0 0 432 434 30 32 140 22 10 134 412 1 Qt::Horizontal 10 364 412 1 Qt::Horizontal lbBoder leUserName cbxSecurity btnCancel lbConn cbxConn lbUserName lbPassword lbNetName lbSecurity btnConnect lePassword leNetName checkBoxPwd lbLeftupTitle lineUp lineDown kylin-nm/wireless-security/dlghidewifiwpa.cpp0000644000175000017500000003200214205345444020433 0ustar fengfeng/* * 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 DlgHideWifiWpa::DlgHideWifiWpa(int securityType, int type, MainWindow *mainWindow, QWidget *parent) : secuType(securityType), isUsed(type), QDialog(parent), ui(new Ui::DlgHideWifiWpa) { ui->setupUi(this); this->setAttribute(Qt::WA_DeleteOnClose); this->setWindowFlags(Qt::FramelessWindowHint); this->setAttribute(Qt::WA_TranslucentBackground); this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); //需要添加 void paintEvent(QPaintEvent *event) 函数 QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); MyQss objQss; ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->hide(); ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:20px;}"); ui->checkBoxPwd->setStyleSheet(objQss.checkBoxQss); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->btnCancel->setFocusPolicy(Qt::NoFocus); ui->checkBoxPwd->setFocusPolicy(Qt::NoFocus); ui->lbLeftupTitle->setText(tr("Add Hidden WLAN")); //加入隐藏Wi-Fi ui->lbNetName->setText(tr("WLAN name")); //网络名称: ui->lbSecurity->setText(tr("WLAN security")); //Wi-Fi 安全性: ui->lbPassword->setText(tr("Password")); //密码: ui->btnCancel->setText(tr("Cancel")); //取消 ui->btnConnect->setText(tr("Connect")); //连接 ui->btnCancel->setStyleSheet(objQss.btnOffQss); ui->btnConnect->setStyleSheet(objQss.btnOffQss); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA and WPA2 Personal")); //WPA 及 WPA2 个人 ui->cbxSecurity->addItem(tr("WPA and WPA2 Enterprise")); //WPA 及 WPA2 企业 ui->cbxSecurity->addItem(tr("WPA2 and WPA3 Personal")); //WPA2 及 WPA3 个人 ui->cbxSecurity->addItem(tr("WPA3 Personal")); //WPA3 个人 //ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) //ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 //ui->cbxSecurity->addItem("LEAP"); //ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) if (secuType == 1) { ui->cbxSecurity->setCurrentIndex(1); } else if (secuType == 3) { ui->cbxSecurity->setCurrentIndex(3); } else if (secuType == 4) { ui->cbxSecurity->setCurrentIndex(4); } connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog())); if (isUsed == 0) { ui->btnConnect->setEnabled(false); } else { ui->leNetName->setEnabled(false); ui->lbNetName->setEnabled(false); ui->lbSecurity->setEnabled(false); ui->cbxSecurity->setEnabled(false); ui->lbPassword->setEnabled(false); ui->lePassword->setText(""); ui->lePassword->setEnabled(false); ui->btnConnect->setEnabled(true); ui->checkBoxPwd->setEnabled(false); } ui->leNetName->setContextMenuPolicy(Qt::NoContextMenu);//禁止LineEdit的右键菜单 ui->lePassword->setContextMenuPolicy(Qt::NoContextMenu); this->setFixedSize(432,327); this->mw = mainWindow; } DlgHideWifiWpa::~DlgHideWifiWpa() { delete ui; } //void DlgHideWifiWpa::mousePressEvent(QMouseEvent *event){ // if(event->button() == Qt::LeftButton){ // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } // return QDialog::mousePressEvent(event); //} //void DlgHideWifiWpa::mouseReleaseEvent(QMouseEvent *event){ // this->isPress = false; // return QDialog::mouseReleaseEvent(event); //} //void DlgHideWifiWpa::mouseMoveEvent(QMouseEvent *event){ // if(this->isPress){ // this->move(this->winPos - (this->dragPos - event->globalPos())); // event->accept(); // } // return QDialog::mouseMoveEvent(event); //} //切换到其他Wi-Fi安全类型 void DlgHideWifiWpa::changeDialog() { if (ui->cbxSecurity->currentIndex()==0) { //无安全性 QApplication::setQuitOnLastWindowClosed(false); this->close(); DlgHideWifi *connHidWifi = new DlgHideWifi(0,mw); connHidWifi->show(); connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } else if(ui->cbxSecurity->currentIndex()==1) { //WPA 及 WPA2 个人 if (secuType == 1) { qDebug()<<"it's not need to change dialog"; } else if (secuType == 3 || secuType == 4) { ui->cbxSecurity->setCurrentIndex(1); } } else if(ui->cbxSecurity->currentIndex()==2) { //WPA 及 WPA2 企业 QApplication::setQuitOnLastWindowClosed(false); this->close(); WpaWifiDialog * wpadlg = new WpaWifiDialog(mw, mw, ""); QPoint pos = QCursor::pos(); QRect primaryGeometry; for (QScreen *screen : qApp->screens()) { if (screen->geometry().contains(pos)) { primaryGeometry = screen->geometry(); } } if (primaryGeometry.isEmpty()) { primaryGeometry = qApp->primaryScreen()->geometry(); } wpadlg->move(primaryGeometry.width() / 2 - wpadlg->width() / 2, primaryGeometry.height() / 2 - wpadlg->height() / 2); wpadlg->show(); #if 0 connect(wpadlg, &WpaWifiDialog::conn_done, this, [ = ]() { QString txt(tr("Conn Wifi Success")); mw->objKyDBus->showDesktopNotify(txt); mw->on_btnWifiList_clicked(); }); connect(wpadlg, &WpaWifiDialog::conn_failed, this, [ = ]() { QString txt(tr("Confirm your WLAN password or usable of wireless card")); mw->objKyDBus->showDesktopNotify(txt); mw->on_btnWifiList_clicked(); }); #endif // DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(1, 0, mw); // connHidWifiEapPeap->show(); } else if(ui->cbxSecurity->currentIndex()==3) { //WPA2 及 WPA3 个人 if (secuType == 1 || secuType == 4) { ui->cbxSecurity->setCurrentIndex(3); } else if (secuType == 3) { qDebug()<<"it's not need to change dialog"; } } else if(ui->cbxSecurity->currentIndex()==4) { //WPA3 个人 if (secuType == 1 || secuType == 3) { ui->cbxSecurity->setCurrentIndex(4); } else if (secuType == 4) { qDebug()<<"it's not need to change dialog"; } } else if(ui->cbxSecurity->currentIndex()==5) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==6) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==7) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiLeap *connHidWifiLeap = new DlgHideWifiLeap(); connHidWifiLeap->show(); } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(0, 0, mw); connHidWifiEapPeap->show(); } } void DlgHideWifiWpa::on_btnCancel_clicked() { //this->close(); this->hide(); } void DlgHideWifiWpa::on_btnConnect_clicked() { mw->is_stop_check_net_state = 1; qDebug()<< Q_FUNC_INFO << __LINE__ <<":set is_stop_check_net_state to"<is_stop_check_net_state; mw->is_connect_hide_wifi = 1; QThread *t = new QThread(); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(this, SIGNAL(stopSignal()), t, SLOT(quit())); QString wifiName = ui->leNetName->text(); QString wifiPassword = ui->lePassword->text(); strWifiname = wifiName; strWifiPassword = wifiPassword; BackThread *bt = new BackThread(); if (isUsed == 0) { bt->moveToThread(t); connect(t, SIGNAL(started()), this, SLOT(slotStartConnectHiddenWifi())); connect(this, SIGNAL(sigConnHiddenWifi(int, QString, QString)), bt, SLOT(execConnHiddenWifiWPA(int, QString,QString))); connect(bt, SIGNAL(connDone(int)), mw, SLOT(connWifiDone(int))); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); } else { bt->moveToThread(t); connect(t, SIGNAL(started()), this, SLOT(slotStartConnectRememberedHiddenWifi())); connect(this, SIGNAL(sigConnRememberedHiddenWifi(QString)), bt, SLOT(execConnRememberedHiddenWifi(QString))); connect(bt, SIGNAL(connDone(int)), mw, SLOT(connWifiDone(int))); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); } t->start(); // this->close(); this->hide(); } //切换密码明文 void DlgHideWifiWpa::on_checkBoxPwd_clicked() { if (ui->lePassword->echoMode() == QLineEdit::Password) { ui->checkBoxPwd->setChecked(true); ui->lePassword->setEchoMode(QLineEdit::Normal); } else { ui->checkBoxPwd->setChecked(false); ui->lePassword->setEchoMode(QLineEdit::Password); } } //void DlgHideWifiWpa::on_checkBoxPwd_released() //{ // ui->checkBoxPwd->setChecked(false); // ui->lePassword->setEchoMode(QLineEdit::Password); //} void DlgHideWifiWpa::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == "" || ui->lePassword->text().size() < 6){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } if (ui->leNetName->text().size() > 32) { QString cutStr = ui->leNetName->text().mid(0,32); ui->leNetName->setText(cutStr); } } void DlgHideWifiWpa::on_lePassword_textEdited(const QString &arg1) { if (ui->leNetName->text() == "" || ui->lePassword->text().size() < 6){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiWpa::slotStartConnectHiddenWifi() { mw->startLoading(); emit sigConnHiddenWifi(ui->cbxSecurity->currentIndex(), ui->leNetName->text(), ui->lePassword->text()); } void DlgHideWifiWpa::slotStartConnectRememberedHiddenWifi() { mw->startLoading(); emit sigConnRememberedHiddenWifi(ui->leNetName->text()); } void DlgHideWifiWpa::on_execSecConn() { QString str = "nmcli device wifi connect '" + strWifiname + "' password '" + strWifiPassword + "'"; int status = system(str.toUtf8().data()); qDebug()<<"executed cmd="<stopSignal(); QFuture < void > future = QtConcurrent::run([=](){ int xx = 1; int nn = 0; do { BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); sleep(1); nn += 1; if (nn == 8) { xx = 0; } else { if (iface->wstate != 2) { qDebug() << "debug: 发出信号"; emit reSetWifiList(); mw->stopLoading(); xx = 0; } } delete iface; bt->deleteLater(); } while(xx == 1); }); } void DlgHideWifiWpa::paintEvent(QPaintEvent *event) { KylinDBus mkylindbus; double trans = mkylindbus.getTransparentData(); QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlghidewifieapttls.h0000644000175000017500000000424314205345374020775 0ustar fengfeng/* * 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 namespace Ui { class DlgHideWifiEapTTLS; } class DlgHideWifiEapTTLS : public QDialog { Q_OBJECT public: explicit DlgHideWifiEapTTLS(int type, QWidget *parent = 0); ~DlgHideWifiEapTTLS(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialogSecu(); void changeDialogAuth(); private slots: void on_btnCancel_clicked(); void on_btnConnect_clicked(); void on_cbxCA_currentIndexChanged(const QString &arg1); void on_checkBoxPwd_stateChanged(int arg1); void on_checkBoxCA_stateChanged(int arg1); void on_checkBoxPwdSec_stateChanged(int arg1); void on_leNetName_textEdited(const QString &arg1); void on_leAnonyId_textEdited(const QString &arg1); void on_leDomain_textEdited(const QString &arg1); void on_leCaPwd_textEdited(const QString &arg1); void on_leUserName_textEdited(const QString &arg1); void on_lePwd_textEdited(const QString &arg1); private: Ui::DlgHideWifiEapTTLS *ui; int WepOrWpa = 0;//0 WEP;1WPA // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); // QString labelQss, cbxQss, leQss, btnConnQss, btnCancelQss, lineQss, checkBoxQss, checkBoxCAQss; bool isPress; QPoint winPos; QPoint dragPos; }; #endif // DLGCONNHIDWIFISECTUNNELTLS_H kylin-nm/wireless-security/dlghidewifileap.cpp0000644000175000017500000002134314205345374020575 0ustar fengfeng/* * 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 setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); this->setAttribute(Qt::WA_TranslucentBackground); //需要添加 void paintEvent(QPaintEvent *event) 函数 this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); MyQss objQss; ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->hide(); ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}"); ui->lbConn->setStyleSheet(objQss.labelQss); ui->lbNetName->setStyleSheet(objQss.labelQss); ui->lbSecurity->setStyleSheet(objQss.labelQss); ui->lbUserName->setStyleSheet(objQss.labelQss); ui->lbPassword->setStyleSheet(objQss.labelQss); ui->cbxConn->setStyleSheet(objQss.cbxQss); ui->cbxConn->setView(new QListView()); ui->leNetName->setStyleSheet(objQss.leQss); ui->leUserName->setStyleSheet(objQss.leQss); ui->lePassword->setStyleSheet(objQss.leQss); ui->cbxSecurity->setStyleSheet(objQss.cbxQss); ui->cbxSecurity->setView(new QListView()); ui->checkBoxPwd->setStyleSheet(objQss.checkBoxQss); ui->btnCancel->setStyleSheet(objQss.btnOffQss); ui->btnConnect->setStyleSheet(objQss.btnOffQss); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->lbLeftupTitle->setText(tr("Add hidden Wi-Fi")); //加入隐藏Wi-Fi ui->lbConn->setText(tr("Connection")); //连接设置: ui->lbNetName->setText(tr("Network name")); //网络名称: ui->lbSecurity->setText(tr("Wi-Fi security")); //Wi-Fi安全性: ui->lbUserName->setText(tr("Username")); //用户名: ui->lbPassword->setText(tr("Password")); //密码: ui->btnCancel->setText(tr("Cancel")); //取消 ui->btnConnect->setText(tr("Connect")); //连接 ui->cbxConn->addItem(tr("C_reate…")); //新建... int status = system("nmcli connection show>/tmp/kylin-nm-connshow"); qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA and WPA2 Personal")); //WPA 及 WPA2 个人 ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 ui->cbxSecurity->addItem("LEAP"); ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) ui->cbxSecurity->addItem(tr("WPA and WPA2 Enterprise")); //WPA 及 WPA2 企业 ui->cbxSecurity->setCurrentIndex(4); connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog())); ui->btnConnect->setEnabled(false); this->setFixedSize(432,434); } DlgHideWifiLeap::~DlgHideWifiLeap() { delete ui; } //void DlgHideWifiLeap::mousePressEvent(QMouseEvent *event){ // if(event->button() == Qt::LeftButton){ // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } //} //void DlgHideWifiLeap::mouseReleaseEvent(QMouseEvent *event){ // this->isPress = false; //} //void DlgHideWifiLeap::mouseMoveEvent(QMouseEvent *event){ // if(this->isPress){ // this->move(this->winPos - (this->dragPos - event->globalPos())); // event->accept(); // } //} //切换到其他Wi-Fi安全类型 void DlgHideWifiLeap::changeDialog() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifi *connHidWifi = new DlgHideWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(1, 0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { qDebug()<<"it's not need to change dialog"; } else if(ui->cbxSecurity->currentIndex()==5) { //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapTls *connHidWifiEapTls = new DlgHideWifiEapTls(0); //connHidWifiEapTls->show(); } else { //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapTls *connHidWifiEapTls = new DlgHideWifiEapTls(1); //connHidWifiEapTls->show(); } } void DlgHideWifiLeap::on_btnCancel_clicked() { this->close(); } void DlgHideWifiLeap::on_btnConnect_clicked() { this->close(); } void DlgHideWifiLeap::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword ->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgHideWifiLeap::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == "" || ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leNetName->text() == "" || ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == "" || ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiLeap::on_leUserName_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiLeap::on_lePassword_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiLeap::paintEvent(QPaintEvent *event) { KylinDBus mkylindbus; double trans = mkylindbus.getTransparentData(); QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlghidewifiwep.ui0000644000175000017500000001646214205345374020310 0ustar fengfeng DlgHideWifiWep 0 0 432 493 Connect to Hidden Wi-Fi Network 76 266 90 20 10 76 311 90 20 10 76 356 90 20 10 175 215 182 32 10 315 440 90 30 10 175 350 182 32 10 76 80 90 20 10 Qt::LeftToRight 175 305 182 32 10 215 440 90 30 10 332 272 18 9 10 76 176 90 20 10 175 260 182 32 10 QLineEdit::Password 175 170 182 32 10 76 221 90 20 10 175 75 182 32 10 0 0 432 493 30 30 140 22 10 140 412 1 Qt::Horizontal 10 410 412 1 Qt::Horizontal lbBoder leKey lbKey lbWEPindex lbAuth cbxSecurity btnConnect cbxAuth lbConn cbxWEPindex btnCancel checkBoxPwd lbNetName leNetName lbSecurity cbxConn lbLeftupTitle lineUp lineDown kylin-nm/wireless-security/dlghidewifieapleap.h0000644000175000017500000000352014205345374020725 0ustar fengfeng/* * 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 namespace Ui { class DlgHideWifiEapLeap; } class DlgHideWifiEapLeap : public QDialog { Q_OBJECT public: explicit DlgHideWifiEapLeap(int type, QWidget *parent = 0); ~DlgHideWifiEapLeap(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialogSecu(); void changeDialogAuth(); private slots: void on_btnCancel_clicked(); void on_btnConnect_clicked(); void on_checkBox_stateChanged(int arg1); void on_leNetName_textEdited(const QString &arg1); void on_leUserName_textEdited(const QString &arg1); void on_lePassword_textEdited(const QString &arg1); private: Ui::DlgHideWifiEapLeap *ui; int WepOrWpa = 0;//0 WEP;1WPA // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); // QString labelQss, cbxQss, leQss, btnConnQss, btnCancelQss, lineQss, checkBoxQss, checkBoxCAQss; bool isPress; QPoint winPos; QPoint dragPos; }; #endif // DLGCONNHIDWIFISECLEAP_H kylin-nm/wireless-security/dlghidewifi.h0000644000175000017500000000411314205345374017374 0ustar fengfeng/* * 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 class MainWindow; namespace Ui { class DlgHideWifi; } class DlgHideWifi : public QDialog { Q_OBJECT public: explicit DlgHideWifi(int type, MainWindow *mw = 0, QWidget *parent = 0); ~DlgHideWifi(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialog(); void emitSignal(); void on_execSecConn(); void slotStartLoading(); void slotStartConnectHiddenOpenWifi(); void slotStartConnectRememberedHiddenWifi(); private slots: void on_btnCancel_clicked(); void on_btnConnect_clicked(); void on_leNetName_textEdited(const QString &arg1); signals: void reSetWifiList(); void stopSignal(); void sigConnHiddenWifi(int secuType, QString wifiName, QString wifiPasswd); void sigConnRememberedHiddenWifi(QString wifiName); private: Ui::DlgHideWifi *ui; int isUsed;//=0 current wifi not used before; >=1 used MainWindow *mw; QString strWifiname; // QString labelQss, cbxQss, leQss, btnConnQss, btnCancelQss, lineQss; // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); bool isPress; QPoint winPos; QPoint dragPos; }; #endif // DLGCONNHIDWIFI_H kylin-nm/wireless-security/dlghidewifi.ui0000644000175000017500000001002614205345374017562 0ustar fengfeng DlgHideWifi 0 0 432 288 Connect to Hidden WLAN Network 70 151 100 20 10 181 100 182 32 10 70 106 100 20 10 181 145 182 32 10 315 240 90 30 10 215 240 90 30 10 30 30 240 22 9 0 0 432 288 10 70 412 1 Qt::Horizontal 10 210 412 1 Qt::Horizontal lbBoder lbNetName cbxSecurity lbSecurity leNetName btnConnect btnCancel lbLeftupTitle lineUp lineDown kylin-nm/wireless-security/kylinheadfile.cpp0000644000175000017500000000667214205345374020274 0ustar fengfeng/* * 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 setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); this->setAttribute(Qt::WA_TranslucentBackground); //需要添加 void paintEvent(QPaintEvent *event) 函数 this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); MyQss objQss; ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->hide(); ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}"); ui->lbConn->setStyleSheet(objQss.labelQss); ui->lbNetName->setStyleSheet(objQss.labelQss); ui->lbSecurity->setStyleSheet(objQss.labelQss); ui->lbAuth->setStyleSheet(objQss.labelQss); ui->lbAnonyId->setStyleSheet(objQss.labelQss); ui->lbDomain->setStyleSheet(objQss.labelQss); ui->lbCA->setStyleSheet(objQss.labelQss); ui->lbCaPwd->setStyleSheet(objQss.labelQss); ui->lbInnerAuth->setStyleSheet(objQss.labelQss); ui->lbUserName->setStyleSheet(objQss.labelQss); ui->lbPassword->setStyleSheet(objQss.labelQss); ui->cbxConn->setStyleSheet(objQss.cbxQss); ui->cbxConn->setView(new QListView()); ui->leNetName->setStyleSheet(objQss.leQss); ui->cbxSecurity->setStyleSheet(objQss.cbxQss); ui->cbxSecurity->setView(new QListView()); ui->cbxAuth->setStyleSheet(objQss.cbxQss); ui->cbxAuth->setView(new QListView()); ui->leAnonyId->setStyleSheet(objQss.leQss); ui->leDomain->setStyleSheet(objQss.leQss); ui->cbxCA->setStyleSheet(objQss.cbxQss); ui->cbxCA->setView(new QListView()); ui->leCaPwd->setStyleSheet(objQss.leQss); ui->checkBoxPwd->setStyleSheet(objQss.checkBoxQss); ui->checkBoxCA->setStyleSheet(objQss.checkBoxCAQss); ui->cbxInnerAuth->setStyleSheet(objQss.cbxQss); ui->cbxInnerAuth->setView(new QListView()); ui->leUserName->setStyleSheet(objQss.leQss); ui->lePassword->setStyleSheet(objQss.leQss); ui->checkBoxPwdSec->setStyleSheet(objQss.checkBoxQss); ui->btnCancel->setStyleSheet(objQss.btnOffQss); ui->btnConnect->setStyleSheet(objQss.btnOffQss); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->checkBoxCA->setFocusPolicy(Qt::NoFocus); ui->lbLeftupTitle->setText(tr("Add hidden WLAN")); //加入隐藏WLAN ui->lbConn->setText(tr("Connection")); //连接设置: ui->lbNetName->setText(tr("Network name")); //网络名称: ui->lbSecurity->setText(tr("WLAN security")); //Wi-Fi安全性: ui->lbAuth->setText(tr("Authentication")); //认证: ui->lbAnonyId->setText(tr("Anonymous identity")); //匿名身份: ui->lbDomain->setText(tr("Domain")); //域名: ui->lbCA->setText(tr("CA certificate")); //CA 证书: ui->lbCaPwd->setText(tr("CA certificate password")); //CA 证书密码: ui->checkBoxCA->setText(tr("No CA certificate is required")); //不需要CA证书 ui->lbInnerAuth->setText(tr("Inner authentication")); //内部认证: ui->lbUserName->setText(tr("Username")); //用户名: ui->lbPassword->setText(tr("Password")); //密码: ui->btnCancel->setText(tr("Cancel")); //取消 ui->btnConnect->setText(tr("Connect")); //连接 ui->cbxConn->addItem(tr("C_reate…")); //新建... int status = system("nmcli connection show>/tmp/kylin-nm-connshow"); qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA and WPA2 Personal")); //WPA 及 WPA2 个人 ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 ui->cbxSecurity->addItem("LEAP"); ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) ui->cbxSecurity->addItem(tr("WPA and WPA2 Enterprise")); //WPA 及 WPA2 企业 if (WepOrWpa == 0) { ui->cbxSecurity->setCurrentIndex(5); } else if (WepOrWpa == 1) { ui->cbxSecurity->setCurrentIndex(6); } connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogSecu())); ui->cbxAuth->addItem("TLS"); ui->cbxAuth->addItem("LEAP"); ui->cbxAuth->addItem("PWD"); ui->cbxAuth->addItem("FAST"); ui->cbxAuth->addItem(tr("Tunneled TLS"));//隧道 TLS ui->cbxAuth->addItem(tr("Protected EAP (PEAP)")); //受保护的 EAP ui->cbxAuth->setCurrentIndex(4); connect(ui->cbxAuth,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogAuth())); ui->cbxCA->addItem(tr("None")); //无 ui->cbxCA->addItem(tr("Choose from file")); //从文件选择... ui->cbxCA->setCurrentIndex(0); ui->cbxInnerAuth->addItem("PAP"); ui->cbxInnerAuth->addItem("MSCHAP"); ui->cbxInnerAuth->addItem("MSCHAPv2"); ui->cbxInnerAuth->addItem("MSCHAPv2(no EAP)"); ui->cbxInnerAuth->addItem("CHAP"); ui->cbxInnerAuth->addItem("MDS"); ui->cbxInnerAuth->addItem("GTC"); ui->cbxInnerAuth->setCurrentIndex(0); ui->btnConnect->setEnabled(false); this->setFixedSize(432,665); } DlgHideWifiEapTTLS::~DlgHideWifiEapTTLS() { delete ui; } //void DlgHideWifiEapTTLS::mousePressEvent(QMouseEvent *event){ // if(event->button() == Qt::LeftButton){ // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } //} //void DlgHideWifiEapTTLS::mouseReleaseEvent(QMouseEvent *event){ // this->isPress = false; //} //void DlgHideWifiEapTTLS::mouseMoveEvent(QMouseEvent *event){ // if(this->isPress){ // this->move(this->winPos - (this->dragPos - event->globalPos())); // event->accept(); // } //} void DlgHideWifiEapTTLS::changeDialogSecu() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifi *connHidWifi = new DlgHideWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(1, 0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiLeap *connHidWifiLeap = new DlgHideWifiLeap(); connHidWifiLeap->show(); } else if(ui->cbxSecurity->currentIndex()==5) { if (WepOrWpa == 1) { ui->cbxSecurity->setCurrentIndex(5); WepOrWpa = 0; } } else { if (WepOrWpa == 0){ ui->cbxSecurity->setCurrentIndex(6); WepOrWpa = 1; } } } void DlgHideWifiEapTTLS::changeDialogAuth() { if(ui->cbxAuth->currentIndex()==0){ //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapTls *connHidWifiEapTls = new DlgHideWifiEapTls(WepOrWpa); //connHidWifiEapTls->show(); } else if(ui->cbxAuth->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapLeap *connHidWifiEapLeap = new DlgHideWifiEapLeap(WepOrWpa); connHidWifiEapLeap->show(); } else if(ui->cbxAuth->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapPwd *connHidWifiEapPwd = new DlgHideWifiEapPwd(WepOrWpa); connHidWifiEapPwd->show(); } else if(ui->cbxAuth->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapFast *connHidWifiEapFast = new DlgHideWifiEapFast(WepOrWpa); connHidWifiEapFast->show(); } else if(ui->cbxAuth->currentIndex()==4) { qDebug()<<"it's not need to change dialog"; } else { //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(WepOrWpa); //connHidWifiEapPeap->show(); } } void DlgHideWifiEapTTLS::on_cbxCA_currentIndexChanged(const QString &arg1) { if (ui->cbxCA->currentIndex() == 0){ ui->leCaPwd->setText(""); ui->lbCaPwd->setEnabled(false); ui->leCaPwd->setEnabled(false); } else { ui->leCaPwd->setText(""); ui->lbCaPwd->setEnabled(true); ui->leCaPwd->setEnabled(true); } } void DlgHideWifiEapTTLS::on_btnCancel_clicked() { this->close(); } void DlgHideWifiEapTTLS::on_btnConnect_clicked() { this->close(); } void DlgHideWifiEapTTLS::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->leCaPwd->setEchoMode(QLineEdit::Password); } else { ui->leCaPwd->setEchoMode(QLineEdit::Normal); } } void DlgHideWifiEapTTLS::on_checkBoxCA_stateChanged(int arg1) { if (arg1 == 0) { ui->cbxCA->setCurrentIndex(0); ui->leCaPwd->setText(""); ui->lbCA->setEnabled(true); ui->cbxCA->setEnabled(true); } else { ui->cbxCA->setCurrentIndex(0); ui->leCaPwd->setText(""); ui->lbCA->setEnabled(false); ui->cbxCA->setEnabled(false); } } void DlgHideWifiEapTTLS::on_checkBoxPwdSec_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgHideWifiEapTTLS::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leAnonyId->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leDomain->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); }else{ if (ui->cbxCA->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if(ui->leCaPwd->text() == ""){ ui->btnConnect->setEnabled(false); }else{ ui->btnConnect->setEnabled(true); } } } void DlgHideWifiEapTTLS::on_leAnonyId_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leAnonyId->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leDomain->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); }else{ if (ui->cbxCA->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if(ui->leCaPwd->text() == ""){ ui->btnConnect->setEnabled(false); }else{ ui->btnConnect->setEnabled(true); } } } void DlgHideWifiEapTTLS::on_leDomain_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leAnonyId->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leDomain->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); }else{ if (ui->cbxCA->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if(ui->leCaPwd->text() == ""){ ui->btnConnect->setEnabled(false); }else{ ui->btnConnect->setEnabled(true); } } } void DlgHideWifiEapTTLS::on_leCaPwd_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leAnonyId->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leDomain->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leCaPwd->text() == ""){ ui->btnConnect->setEnabled(false); }else{ ui->btnConnect->setEnabled(true); } } void DlgHideWifiEapTTLS::on_leUserName_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leAnonyId->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leDomain->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); }else{ if (ui->cbxCA->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if(ui->leCaPwd->text() == ""){ ui->btnConnect->setEnabled(false); }else{ ui->btnConnect->setEnabled(true); } } } void DlgHideWifiEapTTLS::on_lePwd_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leAnonyId->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leDomain->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); }else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); }else{ if (ui->cbxCA->currentIndex() == 0){ ui->btnConnect->setEnabled(true); }else if(ui->leCaPwd->text() == ""){ ui->btnConnect->setEnabled(false); }else{ ui->btnConnect->setEnabled(true); } } } void DlgHideWifiEapTTLS::paintEvent(QPaintEvent *event) { KylinDBus mkylindbus; double trans = mkylindbus.getTransparentData(); QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlghidewifieaptls.ui0000644000175000017500000003101614205345374020775 0ustar fengfeng DlgHideWifiEapTls 0 0 432 705 Connect to Hidden WLAN Network 180 185 200 32 10 180 145 200 32 10 180 505 200 32 10 QLineEdit::Password 180 385 200 32 10 QLineEdit::Password 357 397 18 9 10 76 80 90 20 10 76 150 90 20 10 76 310 90 20 10 76 350 90 20 10 180 465 200 32 10 76 270 90 20 10 76 510 90 20 10 215 660 90 30 10 76 590 90 20 10 180 345 200 32 10 76 550 90 20 10 76 390 90 20 10 180 305 200 32 10 357 597 18 9 10 180 265 200 32 10 180 585 200 32 10 QLineEdit::Password 76 470 90 20 10 76 230 90 20 10 180 225 200 32 10 315 660 90 30 10 180 425 200 25 10 180 75 200 32 10 180 545 200 32 10 76 190 90 20 10 0 0 432 705 30 30 140 22 10 125 412 1 Qt::Horizontal 10 640 412 1 Qt::Horizontal lbBoder cbxSecurity leNetName leUserCertifyPwd leCaPwd checkBoxPwd lbConn lbNetName lbDomain lbCA cbxUserCertify lbIdentity lbUserCertifyPwd btnCancel lbUserKeyPwd cbxCA lbUserPriKey lbCaPwd leDomain leIdentity leUserKeyPwd lbUserCertify lbAuth cbxAuth btnConnect checkBoxCA cbxConn cbxUserPriKey lbSecurity lbLeftupTitle checkBoxPwdSec lineUp lineDown kylin-nm/wireless-security/dlghidewifieapfast.ui0000644000175000017500000002433114205345374021132 0ustar fengfeng DlgHideWifiEapFast 0 0 432 673 Connect to Hidden WLAN Network 332 542 18 9 11 76 176 90 20 10 180 170 182 30 10 76 80 90 20 10 180 260 182 30 10 180 530 182 32 10 QLineEdit::Password 180 485 182 30 10 76 491 90 20 10 180 215 182 30 10 76 536 90 20 10 315 620 90 30 10 180 75 182 32 10 76 266 90 20 10 76 221 90 20 10 215 620 90 30 10 76 311 90 20 10 180 305 182 32 10 76 356 100 25 10 180 350 182 32 10 76 401 90 20 10 180 395 182 32 10 76 446 90 20 10 180 440 182 32 10 30 30 140 22 9 0 0 432 673 10 140 412 1 Qt::Horizontal 10 590 412 1 Qt::Horizontal lbBoder lbNetName leNetName lbConn cbxAuth lePassword leUserName lbUserName cbxSecurity lbPassword btnConnect cbxConn lbAuth lbSecurity btnCancel lbAnonyId leAnonyId checkBoxAutoPCA cbxAutoPCA lbPCAfile lePCAfile lbInnerAuth cbxInnerAuth checkBoxPwd lbLeftupTitle lineUp lineDown kylin-nm/wireless-security/dlghidewifileap.h0000644000175000017500000000333714205345374020245 0ustar fengfeng/* * 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 namespace Ui { class DlgHideWifiLeap; } class DlgHideWifiLeap : public QDialog { Q_OBJECT public: explicit DlgHideWifiLeap(QWidget *parent = 0); ~DlgHideWifiLeap(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialog(); private slots: void on_btnCancel_clicked(); void on_btnConnect_clicked(); void on_checkBoxPwd_stateChanged(int arg1); void on_leNetName_textEdited(const QString &arg1); void on_leUserName_textEdited(const QString &arg1); void on_lePassword_textEdited(const QString &arg1); private: Ui::DlgHideWifiLeap *ui; // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); // QString labelQss, cbxQss, leQss, btnConnQss, btnCancelQss, lineQss, checkBoxQss; bool isPress; QPoint winPos; QPoint dragPos; }; #endif // DLGCONNHIDWIFILEAP_H kylin-nm/wireless-security/dlghidewifiwpa.h0000644000175000017500000000472614205345374020116 0ustar fengfeng/* * 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 MainWindow; namespace Ui { class DlgHideWifiWpa; } class DlgHideWifiWpa : public QDialog { Q_OBJECT public: explicit DlgHideWifiWpa(int secuType, int type, MainWindow *mw = 0, QWidget *parent = 0); ~DlgHideWifiWpa(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialog(); void emitSignal(); void on_execSecConn(); void slotStartConnectHiddenWifi(); void slotStartConnectRememberedHiddenWifi(); private slots: void on_btnCancel_clicked(); void on_btnConnect_clicked(); void on_leNetName_textEdited(const QString &arg1); void on_lePassword_textEdited(const QString &arg1); // void finishedProcess(int res); void on_checkBoxPwd_clicked(); // void on_checkBoxPwd_released(); signals: void reSetWifiList(); void stopSignal(); void stopSignalAgain(); void sigConnHiddenWifi(int secuType, QString wifiName, QString wifiPasswd); void sigConnRememberedHiddenWifi(QString wifiName); private: Ui::DlgHideWifiWpa *ui; int secuType; //=1 is wpa and wpa2, =3 is wpa2 and wpa3, =4 is wpa3 personal int isUsed;//=0 current wifi not used before; >=1 used MainWindow *mw; QString strWifiname; QString strWifiPassword; // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); // QString labelQss, cbxQss, leQss, btnConnQss, btnCancelQss, lineQss, checkBoxQss; bool isPress; QPoint winPos; QPoint dragPos; QString shellOutput = ""; QStringList wlist; QProcess * shellProcess; }; #endif // DLGCONNHIDWIFIWPA_H kylin-nm/wireless-security/kylinheadfile.h0000644000175000017500000000255614205345374017736 0ustar fengfeng/* * 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 #include class MyQss { public: MyQss(); QString labelQss, cbxQss, leQss, btnConnQss, btnCancelQss, lineQss, checkBoxQss, checkBoxCAQss, btnOffQss; }; #endif // KYLINHEADFILE_H kylin-nm/wireless-security/dlghidewifieappwd.ui0000644000175000017500000001624514205345374020774 0ustar fengfeng DlgHideWifiEapPwd 0 0 432 487 Connect to Hidden WLAN Network 333 363 18 9 10 215 440 90 30 10 0 0 432 487 30 30 140 22 175 170 182 32 10 76 266 90 20 10 76 311 90 20 10 76 80 90 20 10 175 75 182 32 10 315 440 90 30 10 175 215 182 32 10 175 305 182 32 10 175 350 182 32 10 QLineEdit::Password 76 176 90 20 10 76 221 90 20 10 76 356 90 20 10 175 260 182 32 10 10 140 412 1 Qt::Horizontal 10 410 412 1 Qt::Horizontal lbBoder btnCancel leNetName lbAuth lbUserName lbConn cbxConn btnConnect cbxSecurity leUserName lePassword lbNetName lbSecurity lbPassword cbxAuth lbLeftupTitle lineUp lineDown checkBox kylin-nm/wireless-security/dlghidewifieapleap.ui0000644000175000017500000001624714205345374021125 0ustar fengfeng DlgHideWifiEapLeap 0 0 432 487 Connect to Hidden WLAN Network 175 215 182 32 10 175 350 182 32 10 QLineEdit::Password 332 362 18 9 10 76 176 90 20 10 76 221 90 20 10 175 305 182 32 10 315 440 90 30 10 175 75 182 32 10 76 311 90 20 10 215 440 90 30 10 175 260 182 32 10 76 266 90 20 10 175 170 182 32 10 76 356 90 20 10 76 80 90 20 10 30 30 140 22 0 0 432 487 10 140 412 1 Qt::Horizontal 10 410 412 1 Qt::Horizontal lbBoder cbxSecurity lePassword checkBox lbNetName lbSecurity leUserName btnConnect cbxConn lbUserName btnCancel cbxAuth lbAuth leNetName lbPassword lbConn lbLeftupTitle lineUp lineDown kylin-nm/wireless-security/dlghidewifieaptls.h0000644000175000017500000000470014205345374020607 0ustar fengfeng/* * 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 class MainWindow; namespace Ui { class DlgHideWifiEapTls; } class DlgHideWifiEapTls : public QDialog { Q_OBJECT public: explicit DlgHideWifiEapTls(int type, int beUsed, MainWindow *mw = 0, QWidget *parent = 0); ~DlgHideWifiEapTls(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialogSecu(); void changeDialogAuth(); void changeWindow(); private slots: void on_btnCancel_clicked(); void on_btnConnect_clicked(); void on_checkBoxCA_stateChanged(int arg1); void on_checkBoxPwd_stateChanged(int arg1); void on_checkBoxPwdSec_stateChanged(int arg1); void on_leNetName_textEdited(const QString &arg1); void on_leIdentity_textEdited(const QString &arg1); void on_leDomain_textEdited(const QString &arg1); void on_leCaPwd_textEdited(const QString &arg1); void on_leUserCertifyPwd_textEdited(const QString &arg1); void on_leUserKeyPwd_textEdited(const QString &arg1); void on_cbxCA_currentIndexChanged(const QString &arg1); void on_cbxUserCertify_currentIndexChanged(const QString &arg1); void on_cbxUserPriKey_currentIndexChanged(const QString &arg1); private: Ui::DlgHideWifiEapTls *ui; int WepOrWpa = 0;//0 WEP;1WPA int isUsed;//=0 current wifi not used before; >=1 used MainWindow *mw; // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); // QString labelQss, cbxQss, leQss, btnConnQss, btnCancelQss, lineQss, checkBoxQss, checkBoxCAQss; bool isPress; QPoint winPos; QPoint dragPos; }; #endif // DLGCONNHIDWIFISECTLS_H kylin-nm/wireless-security/dlghidewifieappwd.cpp0000644000175000017500000002524014205345374021134 0ustar fengfeng/* * 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 setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); this->setAttribute(Qt::WA_TranslucentBackground); //需要添加 void paintEvent(QPaintEvent *event) 函数 this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); MyQss objQss; ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->hide(); ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}"); ui->lbConn->setStyleSheet(objQss.labelQss); ui->lbNetName->setStyleSheet(objQss.labelQss); ui->lbSecurity->setStyleSheet(objQss.labelQss); ui->lbAuth->setStyleSheet(objQss.labelQss); ui->lbUserName->setStyleSheet(objQss.labelQss); ui->lbPassword->setStyleSheet(objQss.labelQss); ui->cbxConn->setStyleSheet(objQss.cbxQss); ui->cbxConn->setView(new QListView()); ui->leNetName->setStyleSheet(objQss.leQss); ui->cbxSecurity->setStyleSheet(objQss.cbxQss); ui->cbxSecurity->setView(new QListView()); ui->cbxAuth->setStyleSheet(objQss.cbxQss); ui->cbxAuth->setView(new QListView()); ui->leUserName->setStyleSheet(objQss.leQss); ui->lePassword->setStyleSheet(objQss.leQss); ui->checkBox->setStyleSheet(objQss.checkBoxQss); ui->btnCancel->setStyleSheet(objQss.btnOffQss); ui->btnConnect->setStyleSheet(objQss.btnOffQss); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->lbLeftupTitle->setText(tr("Add hidden WLAN")); //加入隐藏WLAN ui->lbConn->setText(tr("Connection")); //连接设置: ui->lbNetName->setText(tr("Network name")); //网络名称: ui->lbSecurity->setText(tr("WLAN security")); //Wi-Fi安全性: ui->lbAuth->setText(tr("Authentication")); //认证: ui->lbUserName->setText(tr("Username")); //用户名: ui->lbPassword->setText(tr("Password")); //密码: ui->btnCancel->setText(tr("Cancel")); //取消 ui->btnConnect->setText(tr("Connect")); //连接 ui->cbxConn->addItem(tr("C_reate…")); //新建... int status = system("nmcli connection show>/tmp/kylin-nm-connshow"); qDebug()<<"executed cmd=nmcli connection show>/tmp/kylin-nm-connshow. res="<cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA and WPA2 Personal")); //WPA 及 WPA2 个人 ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 ui->cbxSecurity->addItem("LEAP"); ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) ui->cbxSecurity->addItem(tr("WPA and WPA2 Enterprise")); //WPA 及 WPA2 企业 if (WepOrWpa == 0) { ui->cbxSecurity->setCurrentIndex(5); } else if (WepOrWpa == 1) { ui->cbxSecurity->setCurrentIndex(6); } connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogSecu())); ui->cbxAuth->addItem("TLS"); ui->cbxAuth->addItem("LEAP"); ui->cbxAuth->addItem("PWD"); ui->cbxAuth->addItem("FAST"); ui->cbxAuth->addItem(tr("Tunneled TLS"));//隧道 TLS ui->cbxAuth->addItem(tr("Protected EAP (PEAP)")); //受保护的 EAP ui->cbxAuth->setCurrentIndex(2); connect(ui->cbxAuth,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialogAuth())); ui->btnConnect->setEnabled(false); this->setFixedSize(432,487); } DlgHideWifiEapPwd::~DlgHideWifiEapPwd() { delete ui; } //void DlgHideWifiEapPwd::mousePressEvent(QMouseEvent *event){ // if(event->button() == Qt::LeftButton){ // this->isPress = true; // this->winPos = this->pos(); // this->dragPos = event->globalPos(); // event->accept(); // } //} //void DlgHideWifiEapPwd::mouseReleaseEvent(QMouseEvent *event){ // this->isPress = false; //} //void DlgHideWifiEapPwd::mouseMoveEvent(QMouseEvent *event){ // if(this->isPress){ // this->move(this->winPos - (this->dragPos - event->globalPos())); // event->accept(); // } //} void DlgHideWifiEapPwd::changeDialogSecu() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifi *connHidWifi = new DlgHideWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWpa *connHidWifiWpa = new DlgHideWifiWpa(1, 0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiWep *connHidWifiWep = new DlgHideWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiLeap *connHidWifiLeap = new DlgHideWifiLeap(); connHidWifiLeap->show(); } else if(ui->cbxSecurity->currentIndex()==5) { if (WepOrWpa == 1) { ui->cbxSecurity->setCurrentIndex(5); WepOrWpa = 0; } } else { if (WepOrWpa == 0){ ui->cbxSecurity->setCurrentIndex(6); WepOrWpa = 1; } } } void DlgHideWifiEapPwd::changeDialogAuth() { if(ui->cbxAuth->currentIndex()==0){ //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapTls *connHidWifiEapTls = new DlgHideWifiEapTls(WepOrWpa); //connHidWifiEapTls->show(); } else if(ui->cbxAuth->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapLeap *connHidWifiEapLeap = new DlgHideWifiEapLeap(WepOrWpa); connHidWifiEapLeap->show(); } else if(ui->cbxAuth->currentIndex()==2) { qDebug()<<"it's not need to change dialog"; } else if(ui->cbxAuth->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapFast *connHidWifiEapFast = new DlgHideWifiEapFast(WepOrWpa); connHidWifiEapFast->show(); } else if(ui->cbxAuth->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgHideWifiEapTTLS *connHidWifiEapTTls = new DlgHideWifiEapTTLS(WepOrWpa); connHidWifiEapTTls->show(); } else { //QApplication::setQuitOnLastWindowClosed(false); //this->hide(); //DlgHideWifiEapPeap *connHidWifiEapPeap = new DlgHideWifiEapPeap(WepOrWpa); //connHidWifiEapPeap->show(); } } void DlgHideWifiEapPwd::on_btnCancel_clicked() { this->close(); } void DlgHideWifiEapPwd::on_btnConnect_clicked() { this->close(); } void DlgHideWifiEapPwd::on_checkBox_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword ->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgHideWifiEapPwd::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiEapPwd::on_leUserName_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiEapPwd::on_lePassword_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->leUserName->text() == ""){ ui->btnConnect->setEnabled(false); } else if (ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgHideWifiEapPwd::paintEvent(QPaintEvent *event) { KylinDBus mkylindbus; double trans = mkylindbus.getTransparentData(); QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QRect rect = this->rect(); p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlghidewifiwep.h0000644000175000017500000000334214205345374020113 0ustar fengfeng/* * 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 namespace Ui { class DlgHideWifiWep; } class DlgHideWifiWep : public QDialog { Q_OBJECT public: explicit DlgHideWifiWep(int type, QWidget *parent = 0); ~DlgHideWifiWep(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialog(); private slots: void on_btnCancel_clicked(); void on_btnConnect_clicked(); void on_checkBoxPwd_stateChanged(int arg1); void on_leKey_textEdited(const QString &arg1); void on_leNetName_textEdited(const QString &arg1); private: Ui::DlgHideWifiWep *ui; int WepPwdOrCode = 0; //0 WEP password;1 WEP Code Sentence // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); // QString labelQss, cbxQss, leQss, btnConnQss, btnCancelQss, lineQss, checkBoxQss; bool isPress; QPoint winPos; QPoint dragPos; }; #endif // DLGCONNHIDWIFIWEP_H kylin-nm/README.md0000644000175000017500000000155614205345374012531 0ustar fengfeng# 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 kylin-nm/.gitattributes0000644000175000017500000000015714205345444014137 0ustar fengfengdebian/changelog merge=ours debian/compat merge=ours debian/source/format merge=ours debian/control merge=ours