kylin-nm/0000755000175000017500000000000013645635471011252 5ustar fengfengkylin-nm/translations/0000755000175000017500000000000013645621273013766 5ustar fengfengkylin-nm/translations/kylin-nm_zh_CN.ts0000644000175000017500000017653013645621273017171 0ustar fengfeng BackThread Confirm your Wi-Fi password 请再次确认Wi-Fi密码 ConfForm edit network 编辑网络设置 Network name: 网络名称: Method: 编辑IP设置: Address: IP地址: Netmask: 子网掩码: Gateway: 默认网关: DNS 1: 首选DNS: DNS 2: 备选DNS: Edit Conn 网络设置 Auto(DHCP) 自动(DHCP) Manual 手动 Cancel 取消 Save 保存 Ok 确定 New network already created 已创建新的有线网络 New network settings already finished 新的网络配置已经完成 create wired network successfully 已创建新的有线网络 change configuration of wired network successfully 新的设置已经生效 New settings already effective 新的设置已经生效 add wired network 新建有线网络 DlgConnHidWifi Add hidden Wi-Fi 加入隐藏Wi-Fi Connection 连接设置: Network name 网络名称: Wi-Fi security Wi-Fi 安全性: Cancel 取消 Connect 连接 C_reate… 新建... None WPA & WPA2 Personal 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 企业 Connect to Hidden Wi-Fi Network 连接到隐藏 Wi-Fi 网络 DlgConnHidWifiLeap Connect to Hidden Wi-Fi Network 连接到隐藏 Wi-Fi 网络 Add hidden Wi-Fi 加入隐藏Wi-Fi Connection 连接设置: Network name 网络名称: Wi-Fi security Wi-Fi 安全性: Username 用户名: Password 密码: Cancel 取消 Connect 连接 C_reate… 新建... None WPA & WPA2 Personal 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 企业 DlgConnHidWifiSecFast Connect to Hidden Wi-Fi Network 连接到隐藏 Wi-Fi 网络 Add hidden Wi-Fi 加入隐藏Wi-Fi Connection 连接设置: Network name 网络名称: Wi-Fi security Wi-Fi 安全性: Authentication 认证: Anonymous identity 匿名身份: Allow automatic PAC pro_visioning 自动PAC配置: PAC file PAC文件: Inner authentication 内部认证: Username 用户名: Password 密码: Cancel 取消 Connect 连接 C_reate… 新建... None WPA & WPA2 Personal 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 两者兼用 DlgConnHidWifiSecLeap Connect to Hidden Wi-Fi Network 连接到隐藏 Wi-Fi 网络 Add hidden Wi-Fi 加入隐藏Wi-Fi Connection 连接设置: Network name 网络名称: Wi-Fi security Wi-Fi 安全性: Authentication 认证: Username 用户名: Password 密码: Cancel 取消 Connect 连接 C_reate… 新建... None WPA & WPA2 Personal 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 DlgConnHidWifiSecPeap Connect to Hidden Wi-Fi Network 连接到隐藏 Wi-Fi 网络 Add hidden Wi-Fi 加入隐藏Wi-Fi Connection 连接设置: Network name 网络名称: Wi-Fi security Wi-Fi 安全性: 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 & WPA2 Personal 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 DlgConnHidWifiSecPwd Connect to Hidden Wi-Fi Network 连接到隐藏 Wi-Fi 网络 Add hidden Wi-Fi 加入隐藏Wi-Fi Connection 连接设置: Network name 网络名称: Wi-Fi security Wi-Fi 安全性: Authentication 认证: Username 用户名: Password 密码: Cancel 取消 Connect 连接 C_reate… 新建... None WPA & WPA2 Personal 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 DlgConnHidWifiSecTls Connect to Hidden Wi-Fi Network 连接到隐藏 Wi-Fi 网络 Add hidden Wi-Fi 加入隐藏Wi-Fi Connection 连接设置: Network name 网络名称: Wi-Fi security Wi-Fi 安全性: 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 & WPA2 Personal 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 从文件选择... DlgConnHidWifiSecTunnelTLS Connect to Hidden Wi-Fi Network 连接到隐藏 Wi-Fi 网络 Add hidden Wi-Fi 加入隐藏Wi-Fi Connection 连接设置: Network name 网络名称: Wi-Fi security Wi-Fi 安全性: 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 & WPA2 Personal 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 从文件选择... DlgConnHidWifiWep Connect to Hidden Wi-Fi Network 连接到隐藏 Wi-Fi 网络 Add hidden Wi-Fi 加入隐藏Wi-Fi Connection 连接设置: Network name 网络名称: Wi-Fi security Wi-Fi 安全性: Key 密钥 WEP index WEP 检索 Authentication 认证: Cancel 取消 Connect 连接 C_reate… 新建... None WPA & WPA2 Personal 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 共享密钥 DlgConnHidWifiWpa Connect to Hidden Wi-Fi Network 连接到隐藏 Wi-Fi 网络 Add hidden Wi-Fi 加入隐藏Wi-Fi Connection 连接设置: Network name 网络名称: Wi-Fi security Wi-Fi 安全性: Password 密码: Cancel 取消 Connect 连接 C_reate… 新建... None WPA & WPA2 Personal 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 企业 DlgHotspotCreate Dialog Create Hotspot 创建个人热点 Network name 网络名称: Wi-Fi security Wi-Fi 安全性: Password 密码: Cancel 取消 Ok 确定 None WPA & WPA2 Personal WPA 及 WPA2 个人 KylinDBus kylin network applet desktop message 麒麟网络工具信息提示 MainWindow kylin-nm 网络工具 Network 网络 Advanced 网络配置 Ethernet 有线网络 Connect Hide Network 加入网络 Wifi 无线网络 Enabled 已开启 Disabled 已关闭 HotSpot 个人热点 FlyMode 飞行模式 Show MainWindow 显示网络连接界面 Not connected 当前未连接任何网络 Disconnected 未连接 No Other Wired Network Scheme 列表中无其他有线网络 No Other Wireless Network Scheme 未检测到其他无线网络 Wired net is disconnected 断开有线网络 Wi-Fi is disconnected 断开无线网络 Confirm your Wi-Fi password or usable of wireless card 请确认Wi-Fi密码或无线设备 Ethernet Networks 可用有线网络列表 Create Lan Net 新建网络 Add Hide Network 加入网络 No usable network in the list 列表暂无可连接网络 Connected 已连接, Wifi Networks 可用无线网络列表 None keep wired network switch is on before turning on wireless switch 打开无线网开关前保持有线网开关打开 please insert the wireless network adapter 请先插入无线网卡 Abnormal connection exist, program will delete it 正在断开异常连接的网络 update Wi-Fi list now, click again 正在更新 Wi-Fi列表 请再次点击 update Wi-Fi list now 正在更新 Wi-Fi列表 Conn Ethernet Success 连接有线网络成功 Conn Ethernet Fail 连接有线网络失败 Conn Wifi Success 连接无线网络成功 NotifySend Form -- OneConnForm Form -- Input password 输入密码 Config 设置 Connect 连接 Disconnect 断开 Input Password... 输入密码... Connect to Hidden Wi-Fi Network 连接到隐藏 Wi-Fi 网络 Public 开放 Safe 安全 Rate 速率 None Conn Wifi Failed 连接无线网络失败 OneLancForm Form -- Config 设置 Connect 连接 Disconnect 断开 no configuration 未配置 Auto 自动 kylin-nm/translations/kylin-nm_bo.ts0000644000175000017500000016255013645621273016565 0ustar fengfeng ConfForm edit network Network name: Method: Address: Netmask: Gateway: DNS 1: DNS 2: Edit Conn Auto(DHCP) Manual Cancel Save Ok New network already created New network settings already finished New settings already effective add wired network DlgConnHidWifi Connect to Hidden Wi-Fi Network Add hidden Wi-Fi Connection Network name Wi-Fi security Cancel Connect C_reate… None WPA & WPA2 Personal DlgConnHidWifiLeap Connect to Hidden Wi-Fi Network Add hidden Wi-Fi Connection Network name Wi-Fi security Username Password Cancel Connect C_reate… None WPA & WPA2 Personal WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) WPA & WPA2 Enterprise DlgConnHidWifiSecFast Connect to Hidden Wi-Fi Network Add hidden Wi-Fi Connection Network name Wi-Fi security Authentication Anonymous identity Allow automatic PAC pro_visioning PAC file Inner authentication Username Password Cancel Connect C_reate… None WPA & WPA2 Personal WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) WPA & WPA2 Enterprise Tunneled TLS Protected EAP (PEAP) Anonymous Authenticated Both DlgConnHidWifiSecLeap Connect to Hidden Wi-Fi Network Add hidden Wi-Fi Connection Network name Wi-Fi security Authentication Username Password Cancel Connect C_reate… None WPA & WPA2 Personal WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) WPA & WPA2 Enterprise Tunneled TLS Protected EAP (PEAP) DlgConnHidWifiSecPeap Connect to Hidden Wi-Fi Network Add hidden Wi-Fi Connection Network name Wi-Fi 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 & WPA2 Personal WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) WPA & WPA2 Enterprise Tunneled TLS Protected EAP (PEAP) Choose from file Automatic Version 0 Version 1 DlgConnHidWifiSecPwd Connect to Hidden Wi-Fi Network Add hidden Wi-Fi Connection Network name Wi-Fi security Authentication Username Password Cancel Connect C_reate… None WPA & WPA2 Personal WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) WPA & WPA2 Enterprise Tunneled TLS Protected EAP (PEAP) DlgConnHidWifiSecTls Connect to Hidden Wi-Fi Network Add hidden Wi-Fi Connection Network name Wi-Fi 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 & WPA2 Personal WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) WPA & WPA2 Enterprise Tunneled TLS Protected EAP (PEAP) Choose from file DlgConnHidWifiSecTunnelTLS Connect to Hidden Wi-Fi Network Add hidden Wi-Fi Connection Network name Wi-Fi 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 & WPA2 Personal WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) WPA & WPA2 Enterprise Tunneled TLS Protected EAP (PEAP) Choose from file DlgConnHidWifiWep Connect to Hidden Wi-Fi Network Add hidden Wi-Fi Connection Network name Wi-Fi security Key WEP index Authentication Cancel Connect C_reate… None WPA & WPA2 Personal WEP 40/128-bit Key (Hex or ASCII) WEP 128-bit Passphrase Dynamic WEP (802.1X) WPA & WPA2 Enterprise 1(default) Open System Shared Key DlgConnHidWifiWpa Connect to Hidden Wi-Fi Network Add hidden Wi-Fi Connection Network name Wi-Fi security Password Cancel Connect C_reate… None WPA & WPA2 Personal DlgHotspotCreate Dialog Create Hotspot Network name Wi-Fi security Password Cancel Ok None WPA & WPA2 Personal KylinDBus kylin network applet desktop message MainWindow kylin-nm Advanced Ethernet Wifi HotSpot FlyMode Not connected Disconnected Ethernet Networks Connected Wifi Networks Create Lan Net Add Hide Network No usable network in the list Show MainWindow No Other Wired Network Scheme No Other Wireless Network Scheme Confirm your Wi-Fi password or usable of wireless card please insert the wireless network adapter Abnormal connection exist, program will delete it Wired net is disconnected Wi-Fi is disconnected Conn Ethernet Success Conn Ethernet Fail Conn Wifi Success NotifySend Form OneConnForm Form Connect Disconnect Input Password... Connect to Hidden Wi-Fi Network None Conn Wifi Failed OneLancForm Form Connect Disconnect no configuration kylin-nm/translations/kylin-nm_zh_CN.qm0000644000175000017500000004764313645621273017162 0ustar fengfeng0}DJdڿ<ڿڿ[ڿ";ڿ)ڿ1&+)B3Co7 >7D20@-B3f lI qlIlI,ph8p eA)s@ 6o~ 6o~%6o~6o~6o~%6o~-6o~4e>e>&[e>.v0dC_l^?IiI5II III 3I&(I.=I5aI:9I` :{~{~{~0Hq)q)q) q)q)Nq)nq)$q),|q)4q)92F    " )O 1)DZ)D()D0BB JBBB"B$B,1B4B9oB<$B=<cy#"1i;=kI7 5*D 54 55 JɅ JɅ JɅ{ JɅ JɅ# JɅ* JɅ2 JɅ7 . % ` C C CA C C" C2@ a4E a4F eKb eK eK eK eKh eK f eK& eK. eK5 eK:i eKE9 eKFz      & . 5 : Ed ֫J ŴI( @" 4@ A' 8 c3 ` & &e & h &c & &% &- &5' &9 ) M?* ˝4k UP U5 U5 U5R U5r U5# U5+ U53` U58 nnF I I I6 I I I$/ I+ I3 I9 I; I= UuU Uu%X Uu-[ R{ H*k >EA Ta U% U UV U U U! U(@ U0 U6 U;5 U<  { {% {- $^#Y+28rFbDy v!;'/6]|BB4B,2@QGd?Yi$A *#iG1 IPW0W@:  Address: ConfFormR(DHCP) Auto(DHCP)ConfFormSmCancelConfForm DNS: DNS 1: ConfFormY DNS: DNS 2: ConfFormQ~܋n Edit ConnConfForm ؋QQs:  Gateway: ConfFormbKRManualConfFormIPn: Method: ConfForm [PQcx:  Netmask: ConfForm Q~T yNetwork name: ConfForm]R^evg ~Q~New network already createdConfFormevQ~ܑMn]~[b%New network settings already finishedConfFormevn]~ueHNew settings already effectiveConfFormxn[OkConfFormO[XSaveConfForm e^g ~Q~add wired networkConfForm Q~܋n edit networkConfFormRQeWi-FiAdd hidden Wi-FiDlgConnHidWifi e^... C_reate…DlgConnHidWifiSmCancelDlgConnHidWificConnectDlgConnHidWificR0 Wi-Fi Q~Connect to Hidden Wi-Fi NetworkDlgConnHidWifi cn: ConnectionDlgConnHidWifi Q~T y: Network nameDlgConnHidWifieNoneDlgConnHidWifiWPA S WPA2 N*NWPA & WPA2 PersonalDlgConnHidWifiWi-Fi [Qh`':Wi-Fi securityDlgConnHidWifiRQeWi-FiAdd hidden Wi-FiDlgConnHidWifiLeap e^... C_reate…DlgConnHidWifiLeapSmCancelDlgConnHidWifiLeapcConnectDlgConnHidWifiLeapcR0 Wi-Fi Q~Connect to Hidden Wi-Fi NetworkDlgConnHidWifiLeap cn: ConnectionDlgConnHidWifiLeapR` WEP (802.1x)Dynamic WEP (802.1X)DlgConnHidWifiLeap Q~T y: Network nameDlgConnHidWifiLeapeNoneDlgConnHidWifiLeap[x:PasswordDlgConnHidWifiLeapu(b7T :UsernameDlgConnHidWifiLeapWEP 128 OM[xSWEP 128-bit PassphraseDlgConnHidWifiLeap4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgConnHidWifiLeapWPA S WPA2 ONWPA & WPA2 EnterpriseDlgConnHidWifiLeapWPA S WPA2 N*NWPA & WPA2 PersonalDlgConnHidWifiLeapWi-Fi [Qh`':Wi-Fi securityDlgConnHidWifiLeapRQeWi-FiAdd hidden Wi-FiDlgConnHidWifiSecFastRPACMn:!Allow automatic PAC pro_visioningDlgConnHidWifiSecFastS?T  AnonymousDlgConnHidWifiSecFast S?T N:Anonymous identityDlgConnHidWifiSecFast]򋤋 AuthenticatedDlgConnHidWifiSecFast:AuthenticationDlgConnHidWifiSecFastN$Q|u(BothDlgConnHidWifiSecFast e^... C_reate…DlgConnHidWifiSecFastSmCancelDlgConnHidWifiSecFastcConnectDlgConnHidWifiSecFastcR0 Wi-Fi Q~Connect to Hidden Wi-Fi NetworkDlgConnHidWifiSecFast cn: ConnectionDlgConnHidWifiSecFastR` WEP (802.1x)Dynamic WEP (802.1X)DlgConnHidWifiSecFast Q苤:Inner authenticationDlgConnHidWifiSecFast Q~T y: Network nameDlgConnHidWifiSecFasteNoneDlgConnHidWifiSecFast PACeN:PAC fileDlgConnHidWifiSecFast[x:PasswordDlgConnHidWifiSecFastSObv EAPProtected EAP (PEAP)DlgConnHidWifiSecFast S TLS Tunneled TLSDlgConnHidWifiSecFastu(b7T :UsernameDlgConnHidWifiSecFastWEP 128 OM[xSWEP 128-bit PassphraseDlgConnHidWifiSecFast4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgConnHidWifiSecFastWPA S WPA2 ONWPA & WPA2 EnterpriseDlgConnHidWifiSecFastWPA S WPA2 N*NWPA & WPA2 PersonalDlgConnHidWifiSecFastWi-Fi [Qh`':Wi-Fi securityDlgConnHidWifiSecFastRQeWi-FiAdd hidden Wi-FiDlgConnHidWifiSecLeap:AuthenticationDlgConnHidWifiSecLeap e^... C_reate…DlgConnHidWifiSecLeapSmCancelDlgConnHidWifiSecLeapcConnectDlgConnHidWifiSecLeapcR0 Wi-Fi Q~Connect to Hidden Wi-Fi NetworkDlgConnHidWifiSecLeap cn: ConnectionDlgConnHidWifiSecLeapR` WEP (802.1x)Dynamic WEP (802.1X)DlgConnHidWifiSecLeap Q~T y: Network nameDlgConnHidWifiSecLeapeNoneDlgConnHidWifiSecLeap[x:PasswordDlgConnHidWifiSecLeapSObv EAPProtected EAP (PEAP)DlgConnHidWifiSecLeap S TLS Tunneled TLSDlgConnHidWifiSecLeapu(b7T :UsernameDlgConnHidWifiSecLeapWEP 128 OM[xSWEP 128-bit PassphraseDlgConnHidWifiSecLeap4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgConnHidWifiSecLeapWPA S WPA2 ONWPA & WPA2 EnterpriseDlgConnHidWifiSecLeapWPA S WPA2 N*NWPA & WPA2 PersonalDlgConnHidWifiSecLeapWi-Fi [Qh`':Wi-Fi securityDlgConnHidWifiSecLeapRQeWi-FiAdd hidden Wi-FiDlgConnHidWifiSecPeap S?T N:Anonymous identityDlgConnHidWifiSecPeap:AuthenticationDlgConnHidWifiSecPeapR AutomaticDlgConnHidWifiSecPeap CA Nf:CA certificateDlgConnHidWifiSecPeapCA Nf[x:CA certificate passwordDlgConnHidWifiSecPeapSmCancelDlgConnHidWifiSecPeapNeN b...Choose from fileDlgConnHidWifiSecPeapcConnectDlgConnHidWifiSecPeapcR0 Wi-Fi Q~Connect to Hidden Wi-Fi NetworkDlgConnHidWifiSecPeap cn: ConnectionDlgConnHidWifiSecPeapWT :DomainDlgConnHidWifiSecPeapR` WEP (802.1x)Dynamic WEP (802.1X)DlgConnHidWifiSecPeap Q苤:Inner authenticationDlgConnHidWifiSecPeap Q~T y: Network nameDlgConnHidWifiSecPeapN CANfNo CA certificate is requiredDlgConnHidWifiSecPeapeNoneDlgConnHidWifiSecPeapPEAPrHg,: PEAP versionDlgConnHidWifiSecPeap[x:PasswordDlgConnHidWifiSecPeapSObv EAPProtected EAP (PEAP)DlgConnHidWifiSecPeap S TLS Tunneled TLSDlgConnHidWifiSecPeapu(b7T :UsernameDlgConnHidWifiSecPeaprHg, 0 Version 0DlgConnHidWifiSecPeaprHg, 1 Version 1DlgConnHidWifiSecPeapWEP 128 OM[xSWEP 128-bit PassphraseDlgConnHidWifiSecPeap4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgConnHidWifiSecPeapWPA S WPA2 ONWPA & WPA2 EnterpriseDlgConnHidWifiSecPeapWPA S WPA2 N*NWPA & WPA2 PersonalDlgConnHidWifiSecPeapWi-Fi [Qh`':Wi-Fi securityDlgConnHidWifiSecPeapRQeWi-FiAdd hidden Wi-FiDlgConnHidWifiSecPwd:AuthenticationDlgConnHidWifiSecPwd e^... C_reate…DlgConnHidWifiSecPwdSmCancelDlgConnHidWifiSecPwdcConnectDlgConnHidWifiSecPwdcR0 Wi-Fi Q~Connect to Hidden Wi-Fi NetworkDlgConnHidWifiSecPwd cn: ConnectionDlgConnHidWifiSecPwdR` WEP (802.1x)Dynamic WEP (802.1X)DlgConnHidWifiSecPwd Q~T y: Network nameDlgConnHidWifiSecPwdeNoneDlgConnHidWifiSecPwd[x:PasswordDlgConnHidWifiSecPwdSObv EAPProtected EAP (PEAP)DlgConnHidWifiSecPwd S TLS Tunneled TLSDlgConnHidWifiSecPwdu(b7T :UsernameDlgConnHidWifiSecPwdWEP 128 OM[xSWEP 128-bit PassphraseDlgConnHidWifiSecPwd4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgConnHidWifiSecPwdWPA S WPA2 ONWPA & WPA2 EnterpriseDlgConnHidWifiSecPwdWPA S WPA2 N*NWPA & WPA2 PersonalDlgConnHidWifiSecPwdWi-Fi [Qh`':Wi-Fi securityDlgConnHidWifiSecPwdRQeWi-FiAdd hidden Wi-FiDlgConnHidWifiSecTls:AuthenticationDlgConnHidWifiSecTls CA Nf:CA certificateDlgConnHidWifiSecTlsCA Nf[x:CA certificate passwordDlgConnHidWifiSecTls e^... C_reate…DlgConnHidWifiSecTlsSmCancelDlgConnHidWifiSecTlsNeN b...Choose from fileDlgConnHidWifiSecTlscConnectDlgConnHidWifiSecTlscR0 Wi-Fi Q~Connect to Hidden Wi-Fi NetworkDlgConnHidWifiSecTls cn: ConnectionDlgConnHidWifiSecTlsWT :DomainDlgConnHidWifiSecTlsR` WEP (802.1x)Dynamic WEP (802.1X)DlgConnHidWifiSecTlsN:IdentityDlgConnHidWifiSecTls Q~T y: Network nameDlgConnHidWifiSecTlsN CANfNo CA certificate is requiredDlgConnHidWifiSecTlseNoneDlgConnHidWifiSecTlsSObv EAPProtected EAP (PEAP)DlgConnHidWifiSecTls S TLS Tunneled TLSDlgConnHidWifiSecTls u(b7Nf:User certificateDlgConnHidWifiSecTlsu(b7Nf[x:User certificate passwordDlgConnHidWifiSecTlsu(b7[Ɣ[x:User key passwordDlgConnHidWifiSecTls u(b7y:User private keyDlgConnHidWifiSecTlsWEP 128 OM[xSWEP 128-bit PassphraseDlgConnHidWifiSecTls4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgConnHidWifiSecTlsWPA S WPA2 ONWPA & WPA2 EnterpriseDlgConnHidWifiSecTlsWPA S WPA2 N*NWPA & WPA2 PersonalDlgConnHidWifiSecTlsWi-Fi [Qh`':Wi-Fi securityDlgConnHidWifiSecTlsRQeWi-FiAdd hidden Wi-FiDlgConnHidWifiSecTunnelTLS S?T N:Anonymous identityDlgConnHidWifiSecTunnelTLS:AuthenticationDlgConnHidWifiSecTunnelTLS CA Nf:CA certificateDlgConnHidWifiSecTunnelTLSCA Nf[x:CA certificate passwordDlgConnHidWifiSecTunnelTLS e^... C_reate…DlgConnHidWifiSecTunnelTLSSmCancelDlgConnHidWifiSecTunnelTLSNeN b...Choose from fileDlgConnHidWifiSecTunnelTLScConnectDlgConnHidWifiSecTunnelTLScR0 Wi-Fi Q~Connect to Hidden Wi-Fi NetworkDlgConnHidWifiSecTunnelTLS cn: ConnectionDlgConnHidWifiSecTunnelTLSWT :DomainDlgConnHidWifiSecTunnelTLSR` WEP (802.1x)Dynamic WEP (802.1X)DlgConnHidWifiSecTunnelTLS Q苤:Inner authenticationDlgConnHidWifiSecTunnelTLS Q~T y: Network nameDlgConnHidWifiSecTunnelTLSN CANfNo CA certificate is requiredDlgConnHidWifiSecTunnelTLSeNoneDlgConnHidWifiSecTunnelTLS[x:PasswordDlgConnHidWifiSecTunnelTLSSObv EAPProtected EAP (PEAP)DlgConnHidWifiSecTunnelTLS S TLS Tunneled TLSDlgConnHidWifiSecTunnelTLSu(b7T :UsernameDlgConnHidWifiSecTunnelTLSWEP 128 OM[xSWEP 128-bit PassphraseDlgConnHidWifiSecTunnelTLS4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgConnHidWifiSecTunnelTLSWPA S WPA2 ONWPA & WPA2 EnterpriseDlgConnHidWifiSecTunnelTLSWPA S WPA2 N*NWPA & WPA2 PersonalDlgConnHidWifiSecTunnelTLSWi-Fi [Qh`':Wi-Fi securityDlgConnHidWifiSecTunnelTLS 1(؋) 1(default)DlgConnHidWifiWepRQeWi-FiAdd hidden Wi-FiDlgConnHidWifiWep:AuthenticationDlgConnHidWifiWep e^... C_reate…DlgConnHidWifiWepSmCancelDlgConnHidWifiWepcConnectDlgConnHidWifiWepcR0 Wi-Fi Q~Connect to Hidden Wi-Fi NetworkDlgConnHidWifiWep cn: ConnectionDlgConnHidWifiWepR` WEP (802.1x)Dynamic WEP (802.1X)DlgConnHidWifiWep[ƔKeyDlgConnHidWifiWep Q~T y: Network nameDlgConnHidWifiWepeNoneDlgConnHidWifiWep _e>_|~ Open SystemDlgConnHidWifiWepQqN[Ɣ Shared KeyDlgConnHidWifiWepWEP 128 OM[xSWEP 128-bit PassphraseDlgConnHidWifiWep4WEP 40/128 OM[Ɣ(SAQmR6bASCII)!WEP 40/128-bit Key (Hex or ASCII)DlgConnHidWifiWep WEP h}" WEP indexDlgConnHidWifiWepWPA S WPA2 ONWPA & WPA2 EnterpriseDlgConnHidWifiWepWPA S WPA2 N*NWPA & WPA2 PersonalDlgConnHidWifiWepWi-Fi [Qh`':Wi-Fi securityDlgConnHidWifiWepRQeWi-FiAdd hidden Wi-FiDlgConnHidWifiWpa e^... C_reate…DlgConnHidWifiWpaSmCancelDlgConnHidWifiWpacConnectDlgConnHidWifiWpacR0 Wi-Fi Q~Connect to Hidden Wi-Fi NetworkDlgConnHidWifiWpa cn: ConnectionDlgConnHidWifiWpa Q~T y: Network nameDlgConnHidWifiWpaeNoneDlgConnHidWifiWpa[x:PasswordDlgConnHidWifiWpaWPA S WPA2 N*NWPA & WPA2 PersonalDlgConnHidWifiWpaWi-Fi [Qh`':Wi-Fi securityDlgConnHidWifiWpaSmCancelDlgHotspotCreate R^N*NppCreate HotspotDlgHotspotCreate Q~T y: Network nameDlgHotspotCreateeNoneDlgHotspotCreatexn[OkDlgHotspotCreate[x:PasswordDlgHotspotCreateWPA S WPA2 N*NWPA & WPA2 PersonalDlgHotspotCreateWi-Fi [Qh`':Wi-Fi securityDlgHotspotCreateQ~]QwO`ocy:$kylin network applet desktop message KylinDBuskcW(e__^8cvQ~1Abnormal connection exist, program will delete it MainWindowRQeQ~Add Hide Network MainWindowQ~ܑMnAdvanced MainWindowxnWi-Fi[xbe~Y6Confirm your Wi-Fi password or usable of wireless card MainWindowcg ~Q~Y1%Conn Ethernet Fail MainWindowcg ~Q~bRConn Ethernet Success MainWindowce~Q~bRConn Wifi Success MainWindow]c  Connected MainWindowe^Q~Create Lan Net MainWindowg*c Disconnected MainWindowg ~Q~Ethernet MainWindowSu(g ~Q~RhEthernet Networks MainWindowވLj!_FlyMode MainWindowN*NppHotSpot MainWindowRhN-eQvNg ~Q~No Other Wired Network Scheme MainWindowg*hmKR0QvNe~Q~ No Other Wireless Network Scheme MainWindowRhfeScQ~No usable network in the list MainWindow_SRMg*cNOUQ~ Not connected MainWindowf>y:Q~܏cuLbShow MainWindow MainWindow e_e~Q~Wi-Fi is disconnected MainWindowe~Q~Wifi MainWindowSu(e~Q~Rh Wifi Networks MainWindow e_g ~Q~Wired net is disconnected MainWindowQ~]Qwkylin-nm MainWindowQHcQee~QSa*please insert the wireless network adapter MainWindow--Form NotifySendce~Q~Y1%Conn Wifi Failed OneConnFormcConnect OneConnFormcR0 Wi-Fi Q~Connect to Hidden Wi-Fi Network OneConnForme_ Disconnect OneConnForm--Form OneConnFormQe[x...Input Password... OneConnFormeNone OneConnFormcConnect OneLancForme_ Disconnect OneLancForm--Form OneLancFormg*Mnno configuration OneLancFormkylin-nm/translations/kylin-nm_bo.qm0000644000175000017500000000002013625110037016520 0ustar fengfeng res/x/setup.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 res/g/down_arrow.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/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_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 kylin-nm/man/0000755000175000017500000000000013574604740012021 5ustar fengfengkylin-nm/man/kylin-nm.10000644000175000017500000000140213522470453013631 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/qss/0000755000175000017500000000000013640637261012052 5ustar fengfengkylin-nm/qss/style.qss0000644000175000017500000000126613640637261013747 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/hot-spot/0000755000175000017500000000000013640637261013021 5ustar fengfengkylin-nm/hot-spot/dlghotspotcreate.cpp0000644000175000017500000001355313640637261017107 0ustar fengfeng/* * Copyright (C) 2019 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("Wi-Fi security")); //Wi-Fi 安全性: 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 & 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()); // int status = system(str.toUtf8().data()); // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli device wifi hotspot' in function 'on_btnOk_clicked' failed");} 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.h0000644000175000017500000000175213636616643016560 0ustar fengfeng#ifndef DLGHOTSPOTCREATE_H #define DLGHOTSPOTCREATE_H #include #include #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/hot-spot/dlghotspotcreate.ui0000644000175000017500000000654613625110037016734 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/AUTHORS0000644000175000017500000000004313522470453012306 0ustar fengfengshine kylin-nm/COPYING0000644000175000017500000010451313522470453012300 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/kylin-nm.desktop0000644000175000017500000000066213522470453014376 0ustar fengfeng[Desktop Entry] Encoding=UTF-8 Name=Kylin NM Name[zh_CN]=麒麟网络设置工具 Name[zh_HK]=麒麟網路設置工具 Name[zh_TW]=麒麟網路設置工具 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 kylin-nm/res/0000755000175000017500000000000013625110037012023 5ustar fengfengkylin-nm/res/h/0000755000175000017500000000000013636616643012272 5ustar fengfengkylin-nm/res/h/right-pwd.png0000644000175000017500000000256613542127052014701 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/show-pwd.png0000644000175000017500000000241113542127052014531 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/no-pwd-wifi.png0000644000175000017500000000315313542127052015125 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/hide-pwd.png0000644000175000017500000000265413542127052014473 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/0000755000175000017500000000000013625110037012256 5ustar fengfengkylin-nm/res/l/network-offline.png0000644000175000017500000000077213625110037016103 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-online.svg0000644000175000017500000000142113625110037015750 0ustar fengfenggnome-dev-ethernet32kylin-nm/res/l/network-offline.svg0000644000175000017500000000234113625110037016110 0ustar fengfeng kylin-nm/res/l/network-online.png0000644000175000017500000000062613625110037015743 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/w/0000755000175000017500000000000013625110037012271 5ustar fengfengkylin-nm/res/w/wifi-low-pwd.png0000644000175000017500000000121313625110037015321 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-high.png0000644000175000017500000000113513625110037014652 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxVNA `ACrZ؂ vvpvvbg|~~Y[6\C! Rhoٌ+w 6Lrvg͛=-vc,MހY#6&-E !yds@:ʒ|$K]K SF{2|JA-R>QF,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/wifi-none.png0000644000175000017500000000106513625110037014674 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;{m 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/wifi-medium-pwd.png0000644000175000017500000000122713625110037016005 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_{@aDaA.@: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‹ (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.png0000644000175000017500000000113613625110037015214 0ustar fengfengPNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<IDATxV=OP-2I0: .Ln'O` :8PHtDX4sSҼ5~ I`ܻIENDB`kylin-nm/res/w/wifi-high-pwd.png0000644000175000017500000000125213625110037015442 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=S7 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/g/0000755000175000017500000000000013640637261012263 5ustar fengfengkylin-nm/res/g/down_arrow.png0000644000175000017500000000016113522470453015145 0ustar fengfengPNG  IHDR8IDAT]I g>ha)`'Q)5as,ӽwIENDB`kylin-nm/res/g/close_black.png0000644000175000017500000000031513640637261015231 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.png0000644000175000017500000000023013640637261015271 0ustar fengfengPNG  IHDR;0_IDATHA 0 DzKT!EBJX/BDd_|${w"ͷ?.RgWL=;EQOR*2OIENDB`kylin-nm/res/x/0000755000175000017500000000000013636616643012312 5ustar fengfengkylin-nm/res/x/load-up.png0000644000175000017500000000030213625110037014334 0ustar fengfengPNG  IHDRatEXtSoftwareAdobe ImageReadyqe<dIDATxb`WB|Ƨ  P6VC:&lȶ`5 @,&| X43@K#63ĂQ`~F0>IENDB`kylin-nm/res/x/fly-mode-on.svg0000644000175000017500000000175513625110037015151 0ustar fengfeng 画板 1 kylin-nm/res/x/fly-mode-off.svg0000644000175000017500000000225713625110037015305 0ustar fengfeng 画板 1 kylin-nm/res/x/net-list-bg.svg0000644000175000017500000000154313625110037015143 0ustar fengfeng kylin-nm/res/x/load-down.png0000644000175000017500000000030013625110037014655 0ustar fengfengPNG  IHDRatEXtSoftwareAdobe ImageReadyqe<bIDATxb`hK"BdBX2QQ`#; pNCB.X?@{hl AbP9aTxH" BH &q_1DIENDB`kylin-nm/res/x/hot-spot-off.svg0000644000175000017500000000225513625110037015344 0ustar fengfeng kylin-nm/res/x/wifi-list-bg.svg0000644000175000017500000000163713625110037015317 0ustar fengfeng 画板 1 kylin-nm/res/x/hot-spot-on.svg0000644000175000017500000000175313625110037015210 0ustar fengfeng kylin-nm/res/x/setup.png0000644000175000017500000000067413522470453014156 0ustar fengfengPNG  IHDRĴl;IDAT8UQ }wsP JJ9!}2nf2%ILԓ<::;r,$KZY<נ]Yd}_x`u[D[(/ZEz`Yg :] yWLrFVL%'iK#{0 pV3x:u$b,hDshSq}C MvI-Ka͢Xӈnɵn1Uwk f3Z9X <;8gos@Bġ#j(3U>?=ݦ<_˯ɴ۝r31FXIENDB`kylin-nm/res/s/0000755000175000017500000000000013636616643012305 5ustar fengfengkylin-nm/res/s/conning-s/0000755000175000017500000000000013522470453014167 5ustar fengfengkylin-nm/res/s/conning-s/5.png0000644000175000017500000003576313522470453015057 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:80cb5efe-aa4d-4147-88e6-594283898978 xmp.did:7B2E89420A8211E98EE4E6B7603190BC xmp.iid:04d6fa36-919e-9048-9347-9134b274656d xmp.iid:e8be5e07-b71c-b34d-9757-8b5a6653d928 adobe:docid:photoshop:29a095e0-fc56-11e8-a001-be3e9f4db054 saved xmp.iid:04d6fa36-919e-9048-9347-9134b274656d 2018-12-29T10:05:04+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-29T10:00:13+08:00 2018-12-29T10:05:04+08:00 2018-12-29T10:05:04+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 ў cHRMz%u0`:o_FIDATxb?(#d3&!. X100iP">(.^Tlϱ Dѷ PXؙ8 A\ފ W'< d$ T ǐ /llѡ AoOh[utŀ9 H(uhn^ɴK-xb߅'W\fϸc2PEx۞9T^?tBPa$Cج2L)RAQ2J.Eۍg=tP1}FOSPf,I(()a޲هV` fhǂ)^)$3؅Of,QE[lPEG(a9Ucb^ӃF_ݗ IENDB`kylin-nm/res/s/conning-s/1.png0000644000175000017500000003577413522470453015055 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:80cb5efe-aa4d-4147-88e6-594283898978 xmp.did:6C2CC09A0A8211E98021BC1D1DBBB3B0 xmp.iid:e02570e4-26df-b04b-9ed4-fe8e2c78467c xmp.iid:e8be5e07-b71c-b34d-9757-8b5a6653d928 adobe:docid:photoshop:29a095e0-fc56-11e8-a001-be3e9f4db054 saved xmp.iid:e02570e4-26df-b04b-9ed4-fe8e2c78467c 2018-12-29T10:01:36+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-29T10:00:13+08:00 2018-12-29T10:01:36+08:00 2018-12-29T10:01:36+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 oۿ cHRMz%u0`:o_FIDATxb?b@q-LfBWŀ  llα PчXZha1JlL  mX#bHjG`Œ+G=Ŏ%lϱ `E`kC l d ’l| :R][\0.;A*!8P:d<0 [W8 2N8a*SEh6A@pjTP yL6Vd&HNR")v7/N%lSnLP 9V m|A3p$ Gdy+0JwF́k[#\ np t2i[̙<[жa͟ xmp.did:80cb5efe-aa4d-4147-88e6-594283898978 xmp.did:8CA9AD8B0A8211E99C85FDDEF66B48DF xmp.iid:cd8139d7-323c-6e4e-a737-2767ddd77c98 xmp.iid:e8be5e07-b71c-b34d-9757-8b5a6653d928 adobe:docid:photoshop:29a095e0-fc56-11e8-a001-be3e9f4db054 saved xmp.iid:cd8139d7-323c-6e4e-a737-2767ddd77c98 2018-12-29T10:04:12+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-29T10:00:13+08:00 2018-12-29T10:04:12+08:00 2018-12-29T10:04:12+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 BMՉ cHRMz%u0`:o_FIDATxb? #d3 &PBW P'A:dΡ 0c,0 C4U8|7AU3jRF+&숾LHM1 .PlС P`"0tG3@Et@A1iSNr}9(wNc&hQg"fWlG T8fr\B?m/C ?,&AM,bQ.&` {a+l,^`Q2~&͛?üy3TCeq7XY<0D M Ul֘zOu1HXi&` _bxFB񲛨,1vi)K)pZ R)bIENDB`kylin-nm/res/s/conning-s/8.png0000644000175000017500000003574113522470453015056 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:80cb5efe-aa4d-4147-88e6-594283898978 xmp.did:84F3FC020A8211E9BAFFBA3CCAEE2AD1 xmp.iid:6ad41c69-466c-bd41-b475-0de4dfc61148 xmp.iid:e8be5e07-b71c-b34d-9757-8b5a6653d928 adobe:docid:photoshop:29a095e0-fc56-11e8-a001-be3e9f4db054 saved xmp.iid:6ad41c69-466c-bd41-b475-0de4dfc61148 2018-12-29T10:04:33+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-29T10:00:13+08:00 2018-12-29T10:04:33+08:00 2018-12-29T10:04:33+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 EQ8 cHRMz%u0`:o_FIDATxb?#d3`L`CBW  ͐f``xl1 0rj!pfJ`t  HrFËK0rƒ48 lϱ P\AXVB괢NK6> ɻ?<^qgZl'u#)":`{5*pCHXs%reu0f:SEQEIl61& nAp $# @);M_y>߿j袄xͯ=.3x$Д-GD8Āu裍A XEF@ 8aR^/ y<]6 +|5Mc|o͂{!IENDB`kylin-nm/res/s/conning-s/3.png0000644000175000017500000003576613522470453015060 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:80cb5efe-aa4d-4147-88e6-594283898978 xmp.did:73D490260A8211E99A2EF08291EE6AB5 xmp.iid:795e48be-3243-7d42-8190-1f80b3548928 xmp.iid:e8be5e07-b71c-b34d-9757-8b5a6653d928 adobe:docid:photoshop:29a095e0-fc56-11e8-a001-be3e9f4db054 saved xmp.iid:795e48be-3243-7d42-8190-1f80b3548928 2018-12-29T10:05:24+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-29T10:00:13+08:00 2018-12-29T10:05:24+08:00 2018-12-29T10:05:24+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 2(H cHRMz%u0`:o_FIDATxb?#d1|000 +000|Ab``h2#lΡ0Dh H(phH= 7;7/>2 P10uܑplϱ QaƚX`hjb$p ؁ ل5XXk wfvJ`/aivJu|ǼD]36c<-NIϼ]+(qE2W0/`4+0d 6f; $U3Qymv}i^xcKmD4q jb*;F0Q8`2kRFW8&PEq utp|,ԄV[DIENDB`kylin-nm/res/s/conning-s/12.png0000644000175000017500000003576113522470453015133 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:80cb5efe-aa4d-4147-88e6-594283898978 xmp.did:949752600A8211E9AEA4D30FCDF20E43 xmp.iid:87b34079-eb02-c24e-a720-159b53c1f2a2 xmp.iid:e8be5e07-b71c-b34d-9757-8b5a6653d928 adobe:docid:photoshop:29a095e0-fc56-11e8-a001-be3e9f4db054 saved xmp.iid:87b34079-eb02-c24e-a720-159b53c1f2a2 2018-12-29T10:03:47+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-29T10:00:13+08:00 2018-12-29T10:03:47+08:00 2018-12-29T10:03:47+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 ! cHRMz%u0`:o_FIDATx ۪LZbDa````@&@C)BW] n P3300|dα +g`pњ-,mHsǃ.d.\HӸ"Ι'ܨlϱ Pø, Z 4WpV |&qc p,ˁYmBTSD(wӆ'VO~_FX8GwQY xmp.did:80cb5efe-aa4d-4147-88e6-594283898978 xmp.did:704A45750A8211E98FDDDFE8AE792867 xmp.iid:7246b194-8698-b145-b6fd-e50c32d80bd3 xmp.iid:e8be5e07-b71c-b34d-9757-8b5a6653d928 adobe:docid:photoshop:29a095e0-fc56-11e8-a001-be3e9f4db054 saved xmp.iid:7246b194-8698-b145-b6fd-e50c32d80bd3 2018-12-29T10:03:35+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-29T10:00:13+08:00 2018-12-29T10:03:35+08:00 2018-12-29T10:03:35+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 O cHRMz%u0`:o_FIDATxb?#d3&!\ʡ X9^a oC%Y'L<dCmdα 7#{0˘Z1;װ"!xq aۅǟ܅897|l1AQ5֠H z}؀:&/;9_z 0gƬ\0w,$#|zqh\V5Ix[oLn@`W?XoQ79 xmp.did:80cb5efe-aa4d-4147-88e6-594283898978 xmp.did:7746FF280A8211E9B8B3C2E8C32DF133 xmp.iid:dc63eeda-63f7-9b41-a4ea-007ceed031b9 xmp.iid:e8be5e07-b71c-b34d-9757-8b5a6653d928 adobe:docid:photoshop:29a095e0-fc56-11e8-a001-be3e9f4db054 saved xmp.iid:dc63eeda-63f7-9b41-a4ea-007ceed031b9 2018-12-29T10:05:13+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-29T10:00:13+08:00 2018-12-29T10:05:13+08:00 2018-12-29T10:05:13+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 c,I cHRMz%u0`:o_FIDATxb?#d3 &0! BW  P$000|a``b``B6- i 7a :*0|= .h Μ _000lС ADos BWPY{ xmp.did:80cb5efe-aa4d-4147-88e6-594283898978 xmp.did:90E70A8D0A8211E9ADC4E5914F6F6378 xmp.iid:60fddef0-8b1e-cf43-ad7c-f8abdd6b649c xmp.iid:e8be5e07-b71c-b34d-9757-8b5a6653d928 adobe:docid:photoshop:29a095e0-fc56-11e8-a001-be3e9f4db054 saved xmp.iid:60fddef0-8b1e-cf43-ad7c-f8abdd6b649c 2018-12-29T10:04+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-29T10:00:13+08:00 2018-12-29T10:04+08:00 2018-12-29T10:04+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 a{; cHRMz%u0`:o_FIDATxb?#d3&!*BWm ^sRiWe`` S\1 @GBMsFH@p.0 @7dv ;Nd ^aOJ% 3lϡ QDѳ`T G$á( *`'|fo0`Ngx5IUIrlpo<O,K7ƝΝ۟@cu (F* yTDMExIvp=};aʨi)/'Hp2i6}4GZN8 E)MWk<1v0@ ?M,rG5py&ca@+w0IENDB`kylin-nm/res/s/conning-s/6.png0000644000175000017500000003575213522470453015056 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp xmp.did:80cb5efe-aa4d-4147-88e6-594283898978 xmp.did:7E9316970A8211E9AA47B93CEDC4C09F xmp.iid:ca1aafab-2417-594a-a5e0-417d13e7bde4 xmp.iid:e8be5e07-b71c-b34d-9757-8b5a6653d928 adobe:docid:photoshop:29a095e0-fc56-11e8-a001-be3e9f4db054 saved xmp.iid:ca1aafab-2417-594a-a5e0-417d13e7bde4 2018-12-29T10:04:54+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-29T10:00:13+08:00 2018-12-29T10:04:54+08:00 2018-12-29T10:04:54+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 aݤ cHRMz%u0`:o_FIDATxb?:#d3`6L"BW ~ %d``xSB6c)C6 a :`L, Н9!l1 P/w`c6B b)l-Ҥ6b)l\ xmp.did:80cb5efe-aa4d-4147-88e6-594283898978 xmp.did:8928A46A0A8211E9949D99564296DEA4 xmp.iid:d624eb93-cc59-5642-bb6d-b4fb9a1b105e xmp.iid:e8be5e07-b71c-b34d-9757-8b5a6653d928 adobe:docid:photoshop:29a095e0-fc56-11e8-a001-be3e9f4db054 saved xmp.iid:d624eb93-cc59-5642-bb6d-b4fb9a1b105e 2018-12-29T10:04:24+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-29T10:00:13+08:00 2018-12-29T10:04:24+08:00 2018-12-29T10:04:24+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16  cHRMz%u0`:o_FIDATxb?#d3L`kBW  +ٌWb``Slα "< e pq ˤć:5qsf /lϱ BQ.4ڊb"X `NVy.N'$;~<:N{UmccCIr'}]IrŲXVAi'ngN1*~c( "lYM,,vMU(I ]MY3u<ЉS1 xmp.did:80cb5efe-aa4d-4147-88e6-594283898978 xmp.did:81C809430A8211E9B1F1C5AEEE90FE08 xmp.iid:f1059704-4318-ba45-9926-d9f64cf6004c xmp.iid:e8be5e07-b71c-b34d-9757-8b5a6653d928 adobe:docid:photoshop:29a095e0-fc56-11e8-a001-be3e9f4db054 saved xmp.iid:f1059704-4318-ba45-9926-d9f64cf6004c 2018-12-29T10:04:43+08:00 Adobe Photoshop CC 2017 (Windows) / Adobe Photoshop CC 2017 (Windows) 2018-12-29T10:00:13+08:00 2018-12-29T10:04:43+08:00 2018-12-29T10:04:43+08:00 image/png 3 1 720000/10000 720000/10000 2 65535 16 16 YJ cHRMz%u0`:o_FIDATxb?#d3`LL1 0 T BRQ $ƣ7JҰd1 otTB]X ɟr]^(8PB_Bm-!#&|ϱ Qȥ!YY؁u``2&8aw~vg4xԡs\cTpft銶$a5mIa?,q/fOue~u(uKv4]C tK<{gwp|R^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)*=!ޟ嚽; s ^IENDB`kylin-nm/res/s/conning-a/2.png0000644000175000017500000000614213625110037015010 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/4.png0000644000175000017500000000615413625110037015015 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/6.png0000644000175000017500000000614513625110037015017 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ڬԻ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'H( 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/rescan/0000755000175000017500000000000013522470453013547 5ustar fengfengkylin-nm/res/s/rescan/5.png0000644000175000017500000003602513522470453014427 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.png0000644000175000017500000003566113522470453014430 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/10.png0000644000175000017500000003603613522470453014505 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/8.png0000644000175000017500000003571513522470453014437 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: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/12.png0000644000175000017500000003572413522470453014512 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/2.png0000644000175000017500000003603213522470453014422 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/4.png0000644000175000017500000003604513522470453014430 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/11.png0000644000175000017500000003602713522470453014506 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/6.png0000644000175000017500000003604113522470453014426 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/9.png0000644000175000017500000003603713522470453014436 0ustar fengfengPNG  IHDRh pHYs  9iTXtXML:com.adobe.xmp 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/7.png0000644000175000017500000003564713522470453014442 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  IDATx] le~3]wmPA4Q4AT+^ jIG4D##7F bbD A *A@ ]|?vov_e-J(b)(Dl,%$]H((4V`ƀ(^HaBdGq 󽙌 .E@BA&NK^!^ `DnavIa&z%20 gO/BEAj%2' 8 IX{  I?_A[RA"k\bÞB Ե]na='$Kh4A@Bp>kkaUT~k3ה;tYå(o:մzXGB`L5q}0ݑЫBM5ԪUI%課P\S< W&)m4Jxi$\u('^Z*,|@XFaoWEt$;M"X6syu?)4 Bٞ#%,{m3,@tЖ"g+ Arg *!&RN$ρ}ؔ ~uB9,m;#ݠzABOLKl1@H Š3{VPp6Ml""$NMz̿3H+RF*\)xֽJ$.5 ($2)"79*,ϑ@ |Ā_H)\/K CB_ m(U|qK*reSxd^b̉-[P6CE>nT$5&`<^ϣp PtY.BgQ` `΀$# 4*)tMr/pzـb@m[0׍EUZXЏT**FMօ8'g~ K z A&VD^,Ues ؊d oA.,B 1ʤ-l9tv6HIH$x)$Nbo% O?#' 1PRk_H뀔I(]]f|Q!NEYrVty*/WSDb$Yb  Y!U-p[ ?dyH| x=䎸l$ *kU8.Dp 9kOBqZ*\"CR Ld&VkR'g:k\Qro1]Lκ˩W>/Jj2O \pQ+{\# I=nfIn/RQ/*\B>ҝ_+<@l>lj$; WJ?%\VEoTyw+2M!ڸW>aO'ҽL}5$.GEysL AlYƕWt^<nMu #ϣ ^{OAj1g$g=Wve^l01R(nܒVbۂϵ.d1~,K[Ng!w=*MTla2,c(>E݀Cplm?ESJwX#0c];Tgo AU S+8hsqZăߊZ ryc+L?wh2`y~߉<`xn!ۑڙOx4<.5D@Z,=$N]lYOI2dP>fȶ; ca"&9t4bgoQYߡE;G.psm5ԻZőC|*1+-!G&zX _-aq8[̷ YQX Zb "R'xh)GlnIu ~tȈx@b$ =P*<7}cSRnBpm M9ŀJ@@ 6D@&B"KvT Hn@N&'2սv:IENDB`kylin-nm/res/s/conning-b/1.png0000644000175000017500000000536013522470453015020 0ustar fengfengPNG  IHDR``w8tEXtSoftwareAdobe ImageReadyqe<iTXtXML:com.adobe.xmp 8 IDATx]O\U?3ᣅ~k t&`jHM5eZRݸ5Ÿ- tc q}_ri3|UUDN@zM$/$aT!!Dy BsJp`BvفT"Jdl'RJ*0 [8v,9S Ŧʨv<ۇLC `~LEPsJX׈4`z$tXm;j`OQgc\l[ lP]`22#Yd U,U8m "҉a+[+Gƿͮf `\FZ3s3py VU/Y#g.m $kp: [pmME|lv-QE=XYc,+8$r \ 5DY1klc%4M@B,~=q(0 gLڳG'[V ^3{BaRVɃDfqt2LQdQj`}R=sr5Ez0]n6dÜ]sW*Gϊ6Q}sYiKXeop"MzcPfTY+ I: tJ延|wattSzHv'L 3(aIVİ2ɧj>ژ-kKF (y"w@>Mό?P^d=Z ʴF)cf?犏ٛ2IENDB`kylin-nm/res/s/conning-b/10.png0000644000175000017500000000663313522470453015104 0ustar fengfengPNG  IHDR``w8tEXtSoftwareAdobe ImageReadyqe<iTXtXML:com.adobe.xmp g IDATx]WlUެc'q -PBD" >(D/BB @B h5 jK@(!Aĉ];]aΰÒػ3o{o)w+T*d6EN C@*D9bHpE3y*2\O?SuM,*ދ!HT\؏-Mœ(vAs Sܜd/m !(aPu Ҵݠg0g4a) TM4A+Q|2f&{v-S~ Zmm*k2E$/c+[ݭO(DQ>>jj>_^RZnΠe bI@9,iO&3QK@VlϦz\.ē7D)y꼜 ;, :n(yHenBk2t)V*EY㚀Ba t P9 8h.1_޷zn8 %Rp# ևg/ے3 [W`CHWvD=/WtZ:KгNrQ*>O  ˮCBWGaDš z+?8pwcRa.9Y pniQ%h &PBOV@:%I ;z@&k"Q] S6'vsH[PSvs+^&4qx%NV[DXllA\_zx`zEq% !øBĴ@Rr}x>`cZatA 8A UѥLt#sLByZXϋ흘'rPY(L$XCReF@6`6C2Lt Mp 8Rr"_c6r/l3cXcǢ+I2Y|W f@BbIw_%ޔ)/Ž!HCѨ@U~R@t_1˯ԟ2k4mPF31.S-r1+v wwIu*4FA Z2R4B8م6hmvB .oXķhd*  4r IDATx]lU\α  @T;@ hћU&@  IJ@ZDN!%1}O{߮}#=qvf^PIPd~)rD"%(RLKJo& 2=)ÊQ !KǞ>Lurdmti&v} #4 %"u5  XDN% CIŵvԵ$-C[: I"uj|ZjA@ex LRɨdeNfI#4S] tՆN_|6䮆0lHK`J@˒" 5WiL iYY82TiNCFRg5!YNRͥT }L^`bL9g{ Gj#ź5( 6'H+M+6W;TBxQ54UPTLP3 {<>h-.Ikm8AYOU*])S\Kbkފ#hV Nb*/` Ap5 "W%Ž7SS(%^{L )S|hߙh;|F*6QeU]:moE~N C\%J@qbwdƟ؀uiO6 Yo~@&EBt#};خǰ8.$ g0 *65_6ԽXɚSxeIܯb{13G-|v2?0Z/_2$Y!PCB%r5I$Ȳox;mp}FZ><ޏQ>O# K~%AeaIn<)y$!$QEv.n,IqohPKҳ=XqcΌTyD©/Bn:ٖqVXL4Z[Y#&hۀ=+P_K(eǬua:bT--!)&`,edJ Vt02tpg@aBśr6Kzw t^~Wly+}SJBlK'"F~mSl}O@Έi=yit$0Nҷ=ͱ2s A(1P&cx}[AUimDnKɅ+P ~)Q>(Fo$>R~E _Jro) >G`!${ ( I;C#%(C~ .+uEzM̩l!Z syc3i4GIKQ p+2KQlm@,K|DuB&H$99٧(.lL*Ɛ"|#Ԁ o)[V8 k%X'Eߦ؉)w0l9i8ߗ&={%Hԡnp;%3~I.OBI/nDG"FiH)E Y>&sU\(aW`W,*ؽXy_%اp5GI-{Uj* ]]*<L ސ<,7V@gB. {\ B `hd'jJA1_Ɔ";\%%JVCݲ`J:%^cO`}d9ԟ"q6p*'0OJ(gثnz{T3ft̐^,6Au:NJ&ʽ;J.xſl$H2Ao^@p:\ j 鐭ˉm;9w?[Q%@")c+B] ]Xgek]%'V*%o"P*\sՊ/ew-DZI X# IDATx]ilTU>:L,e*. D[ .(FMĨ?DM&$j\Q n%ƨ(AQ)Lg_ؖ9I̴yoweJT2C:Bb.]D*h&E@D DFaDAFA3eP0Ԡi GRM3ƙQH`3uA`sV8Mz##S SЪ9i:$ $UQW FPJpcq|?A@dp LR3H1R 6)q&t&A0*Kι#n7)|r! 3k_MJ@6HBN ܫ9& 3HC͸f=rdU.Ԓ!YU&fS8e/S1'N'^l?$~ĠCQo"h_5 t5N&q t=`I-L 85.Lj dƚ4T荀 bId &/z-5Xϑo`6f,2/ OBO',g*T+CvcWįoZH{p"?<_ 6Xfmwwdx^@NEx-!3"MKJ#Ikop:KtqDLj\L[8JEtVe"0nfu$9,-!)^`/9'-E,My= E!?_PIP*F/`cxx-XDXm~Nw̲6F69Xv\m0?D3YPf$/DWsUV8ȋH.ڒ? w3rP.0wي '+DJ1zR=$'=̌{2 &h跈7r!qz26$ٞ(&kdd7 ٗS{.c$|l^cK61SMu AY/ȷM@& %G̴Eʤg W rŋ@1ݟLXLաJ׀3A$ 3au $&[o3rIEJY=ˤ UX_֙4 K6J ?9mgtzsq_fN]+/y0 6;||V%.v9HE]Նv&FsUer߲VRr2I irQZ,wAZ4=%:zotCB%TJZC7\0GnZ9XQU;5 X鎆,At1!+h5u ?[CL 9H8(HU$Nx9GlϹݨt.M`^sĨΥn*^g&ou]/Lu APP"o<@n!EK yJ BDlWK˅?c׺Nܮ US:my4L2Lf& rZ Z?<(~+86B3.h f,8Tdn384FԶY,b?m8<,t-"q83cxHtVL;YBjRwAYe0a3DGmԖ;b,6āQ os^X0/EŶ?,hZAasfhFnwD|Aqz% RnĚ!kseU)bgOilz>jU &mlEE B={)^ G.84MU( Xs( `zGL,`#U}Xn38?oĖo?zfpߘUSyHPQx)s--Qgm_P)hBSFIa;_b u*u5EcgP#j|\Hr6E_ǬⴍDUN5$n G|U6}> 2F-5|OS5T*z i IDATx]iE~3;{.x⁚(GL0&F? *JLD㭉WTJ4T"xTT/݅evm64]ݳ/U;%RTU"A䉜YEb Mň(Үh#r5Rzu^ a#eK@3jȗ}L 0I*Mz##$ D g~9V: Xr(9lG&)RJplaaPC姥g L&$ϕT~Oԡ3Wo(!OS<3/Eٟ6{%ŏu WB7sHVA1l~(b_튷-qbbbW¢(|A!uE"rF-oPk-1i~W\Xla\e n|cv{"P>Lge#C.ZH[ .!fTb2hMJ7I|L˽\ Fb)#|. A$p՗![=ɠ@\MG9CF'36j\ݧ=uSmŲZWf08c" qj$q|oCI3Ow@3T)8u|c ?x]]NUN;u1F-l&jB]i.5diA~bI/XLᑊ_~#)I`FYM] A&p:-v= g/e<= )NĖtU=8Oqv( OxB_au[nћ@%)cߧx@b]hj`Z{*T>E." y"fNS&I@Xc`PΠ}MԚc*N]wф}"LGiL}=C |iK460|2ay~Kq8;,'EmXBV2 l#\ xfezS%NFI4[15%\qOfMTEsirajY#[!`hF3 2!M10A ˟sGs&!,.LC054Ay$~wa!5?RE=GPZʐ('&iOfa M_+w0#Pr+u,Qqշ" g øŸGF'%g|ߌO}6/pp ;>FO3QC۪k/\SGËZd` c=a?9!t4.=Q*.F,(UKIuW'ϵ0nlưQ~wcHsqKSmEKpvl*MT؂}9q n,7x R3;|Š~.a78š-ݣGGSp"A < e&K([ŒG[$q|m<ͫM6}WP>A] "O ڃ:ҁtQh]ٲGش~MXԴr?MDsQ#@lP%dפG;ĠFs f) y )A en0@P21/ sA <%;$%jliKhcE2ޒNEMs+_\Nn}~3N{4agv{RS EYփܨ*nħpN$r"nHU$V2Y3^扚:< Bu֗7:{Ddxcli\EPùJnR ptxo`iE16 (t ba~e3Qk,Nj|"(jf*KITav]ş'rd9X6`NVIENDB`kylin-nm/res/s/conning-b/2.png0000644000175000017500000000660313522470453015022 0ustar fengfengPNG  IHDR``w8tEXtSoftwareAdobe ImageReadyqe<iTXtXML:com.adobe.xmp x-5 IDATx] lTU3R +bԈB%nF$Kc&jBQcqIFq hE`ގϷCig794}3w|>/1bQ)dHhUѦh!bE31"ZAsҬh"SIL;d4(S*A@B=_-j'71M@%]hׇГI{ZK{(`\7s u(IO;lC&jRG0'X6#~rN~V@%"}?L:r2M MQ0?%O*z:t߽ zC@%u~*ʚRwBn1u~1hU)s)jz;jKFV#N-&X+:Q1 z3Lt7>#?Ian=0; *)GqU8~B%K e b@BwBTpE%(s _+Sz"KG!(YyMX;\bM?-s*w{(: HTCRZ76"հ<š7V**^K7 ;G*TLPUbՔ(]*" Bŕq zSx }wS#{6|OZ;*VՉ _xXX))N/5$w=m "?HqbFV|12Eq٥kFa pG]%o;9H)銷Z.ԏ0ޣ@*ŗEwI\ qd t]Q/h}:A ]Ǭ :8Z~}\O~s(ppv" +ӵCzHť=Mx€2Ǖ zA)A k sxIKŌz p*tt\Y^T";zbOq**Ȫ4;iÌbFN>Wjh"Ŀ%| Sd1HVlnWOoPR+MaEdJFq>*j w]4hloHFE S)h0H.aK2G 8Z0~%^NwtB2Ym6JrpTg1%gL q4ZC WwKsU櫠! 0ou1j'71?YFXİ)s /c8QEĻtˑѵJE7K k2ߊw_&[wua|N댘ZI:AyմarPD@DVN$xwX1ѸbŻ;N쫺` r6C+mƄاĻcrxwCtVpҶ> .W>rD=!ޝѨe_~.TO$F]=.+dP;7xN* ] ; 9\WOMckq;EY:+nNϠw_u0.E2CV2UWI.F{6bIckP qjg[T5kV[ mFC??$-yWRtH:ƓC P@B#$ᜀUN;\ڂV!!՜HnAmՑyE: ]2$]\?+v5"6l0b`m <9uyڅq !ҤBV@THG$J+'5lBېy:q"xLz8*.wI@fJtT;4nqmEM@TAVNz"q"+Br>@F:rP~[Z[>[` sQEIENDB`kylin-nm/res/s/conning-b/4.png0000644000175000017500000000666713522470453015036 0ustar fengfengPNG  IHDR``w8tEXtSoftwareAdobe ImageReadyqe<iTXtXML:com.adobe.xmp Z IDATx]iU=XX.JP &HL(#j^(#H ` \* }UavwvMT{vf{^zCX|*!F.È0.B#FC>"@DtRϨ8J/-d0jSB BB5]ZzyIDψu%3 I:^hĮ# Ht"Ps텖Dz!IqABWQ~Eu: QזJ7>߰?tԽDLR9bP<'$P  .18TTVYǃ>ܩ`̬ް D-]ZP3sHtI7njj=G^Z&$:K b~;q``C+87z,c_a=G:iI[?x)9!K06xݟQܜiR 硥iK)c93-(r8uC{ǐ)C` =iX $|,[-孥+"~҄aLB03b,E#OAoŸ9ΩE_2`: -vŤl`X˜eyYVoNhL FZ!(/BC8nHB%cNF@JNbp!:Kq.YfQDNf107ES<1q9"!3n/ =(K9/<;O1^E˘m^3A,lP\췴txY +8`:RYQ8T⨟甯W 2Aa /mUOh٪^~qg\|| '8_m't%^`mgp>Ow?'unWI>_bu,Ȥ| e$~ⵢFaWG\ϸ ;kόʹ<[@g_`lx͏c9I2?WnG(j5Ψ! Dz+VđMgB?IOVl0.49>7=n 7p>C:H\ppAd0+w_ $@߈d$ GiEJs-S~L-?&XP!`^hwRp&vz"%`7ZfA  4"Ds閐" 4 Q VBUo 1h) j1y&'t$%2F4 8LQ $'@+B ~U5C% Up(,$@t] Q8 w&ZQN8/'IKZ&R^ 1)_fo`RC4 Y㌀F#QQ+zB8*iq"`$~dcXy*p-aRôM1SlR7:.v!9K.[%vN7qZ"N84Y*TcKWJ'(^"OSO*^m,ʖ ST_0‡H%Gz:R~NGkG|H@LLѵ{LZvR" bܐAZQrRM=@{Dx:f}BZ.:@|m.?S$IZ9 ג=& qS"/&9"=X"a!9˕d#F* |Dtcz +tdZRXTb˂p+Ȇl5@nBiߒSj*{=wdT]`WS2o2na܌Ϥ:ivkD Y<ap0ZdM.d0)wsGzS BeVkjr$p7Nr0YhWGH{wݾς 9)10ɤseS JOߓ32tزIM{Y& 9Uh1^0u F8Nr\ pd-2*Xg,jcvh2'}3l!g7.Nv3kxv z[W}ͧP['=2_0Kh$C/{>7Hoʨ/gwIO]P;9.Te<$8 Yv(TIᕀSsV~wU_Mʤ>*=f'#2}['$(W2<]=)C䳇y&l3H oe(im F@D$79Ymoʮ)\+B-.x*ފbl ?WkZC>u\k)s8SU0SPzşБq`tm `O:4e7AtX`|VIIENDB`kylin-nm/res/s/conning-b/11.png0000644000175000017500000000660313522470453015102 0ustar fengfengPNG  IHDR``w8tEXtSoftwareAdobe ImageReadyqe<iTXtXML:com.adobe.xmp }q IDATx]gU>؅T[, 5co-E݈F(ј؍c,ذP)D&|-ι3;'o7f~{L>JFѝ)dHh^EQGA31"ZNqYQK4xޓ(s|mQt)z(*36g% Ùi6P3tI&v/#$ u"εg~ghzɂ8~$3 m؎:L2s|s`[߰:! 8YZTE2"#4d QГ%O\풀 F:4$n!m~*5jBVva_9*%s.`Ӟhx؅0U$kO:O]Ǖlc0ii"~p ((vUS Wa{iԀd{yLz n+}x%$(J&L@9< ϙS1h_{igr~^)VV,U-+Z#'IKueYk ƠO /ќmА1w;PA~^A&ʿ]iqw_psC~xE3m?g u !` 8+ŦNgD CZ5S@ ]a/gFJn5 .,jX4$nԂAbtlA(BLϞ$$@9%"{/Q DEϘ`UMHq3VKIӹmW3\-19*H->2 rq]P>~omxN}sny#=xH&ˆ @( ΢$GDTagaxFhq9ݛ\LyͰRg$4FzW3RPPF»2Lnm.JGν wNnݠzO46#^ω)^%^eG[Dm҃O! 0G+^v 1o ?MzIYPP%=3.5ck&ޮ47b"6!b_3px CȄdu{ ܾ0*u_*(C%^tsuI#F-hLjGYQ~X$XDe(a-a8c5O4u#SoرՐ psYI*#HN1*F\3h]K!r,T\+ʎH κt4 V?7H..-GB<؏LJzxw1v?ûqzz|}bz|}'a&) |/%}U :EnI_e1~^扚z< B: ~_ Y' ysPID._ρ7k^&n x!Ǽw x &qtƑK uطA+5t;x" ?.s|t5b[ #rLskXlcvdHS *O4Pϱܡb hoxIENDB`kylin-nm/res/s/conning-b/6.png0000644000175000017500000000665013522470453015030 0ustar fengfengPNG  IHDR``w8tEXtSoftwareAdobe ImageReadyqe<iTXtXML:com.adobe.xmp e& IDATx]TU3; ̂v{ŎDcODh%j{F &K-; 2;=0}ݹɟݙr{w߻流Ţx*)IQ#H"Q T$|ДG@,^O!DA@u|mѮXΞүh x҇z%žDZtI+M0F2IDO/EP -"' X$Pz;z"}[?}"uDm}-aA= K姥 Lҟ$#6`[+'ߤȞ"rT~"s{b򻂏ZCZ̆_*m$dCMOo:ԛ&ibb=+ݓȰ(hQyxvC凑ba>AnPΧɞat\Zm$>S̕ A6Xb xU XMxR9G[X{𓊯HŸݥ+2OB Vrh-߳QsR{c%?x])דxmSኣ?*UTr쥘2<}08Q1'ܫx1 s9RYP9t3$N!IQKZw $򃊫.V&t+o8JSܧxJAcل ݍ=eki$3e^^P6G܆i* *1."#[(f$=󥾠AL9hQf_xݱMލ$Ɩy9] Lc-Qt(fmGGFbp9J@$°^J*J%*vFi*GeiOv`5 (SlD?hMsNŨ O L͌22\.+% m|`[oe[ z۠exlt$c%pY_JSu 5(r-;=Mt!2?)Ff "ì@6$ e8| K2!SO)04ͩq_S|-ɑC7 3q|^ z Bg_R VABL Byח UOT^q_+?w~.ɕ4::-6`C/&O<jE&ÑpjOpG<_/xQVX,m`HTieY̕2Fec @zH7ԝCkmzɶi$fc Ә3^E+0zu]WFۏ߬]%9 >/X Uv % \Q_'l/ycO1ښwF- @aDRsWŚ̐Ͳm[ T0_;aTC?Қ,xD> aЕ$J8tݙ|$Io(>R~E6XY'D:%\Fyu:TH/BPlljUr/)>4 W Q8cL a]'U3#`h vu{oa'V?Ŵ-O!Jtjp苠h~c#{7B~֡ $ ȮwpͲ2bxj&D{;Q2Bb@FK)rlp[> PG&jv=ml8Sؗ$`%T;09M>?ŖKL:f%آ knR[atXލUwz0{(Ps23W~hSV[h<=(ys1aD\I[@\oَs| @kP>{Y߇4aIn4{sL^.J_", z6TJ *`v*E句b0}K{3YY&nW#M, RSbMEF"fLYu=jt*v&߷,k9Y=rxs~?q>-qB_hSľɖ(isFI 4=ՅfNHٮ8\3g0rMIt]hfz/枪9Nn5֏(!-Z)~ݙ?tY]aKIWT}_=mRņTBhQ9ioPVJ s뵦¨*^ħX^cJEnƫ k^ey.۫ylc$ o1#GS1 $*>Oś& I)Ws]"޴ኀI7-~)N㒀RG,W+˩tq? :vr a IDATx]iSU>}StMMeAkԠ(L4bQ j&F?FĨKH2t:{xߥ鴝מޛ$_^f=߹眻H$Q (* V K Х xJ b Uel{3 "R W/Іk% K'^Z3S?+|Md(=5#^'{pO8*9IuHMo*v.&~Ի!%8w-|JK%~ %dJM nK]NE@)tYe($!$EN5e=guG` hԭP?O!}3fR Vc u4g:ƒ$ϥ`_`@F9NVUq0QdgޭЈ5_mGyw`g ^[ЖGôջ(v9- o&vBn"d~yµ 7A*`{UbG)L!ScUpC 2jf(BeD]X?^ohAO ud/+{Ly= FX@Y) ^WF3<|{j3?K bEnk! )?Ba Bݷٙxs)lW_V@m08W6IZe|9P~d\XnPi h.}+ dmg htD0[ BǑ01d6&}|r I#FLgx]P) H~pej҂~t}#}e7_@4Mz ZJK ; ;N%&( [ ˏ E% cҺR}$֯)@{BatPCkKz~G4P\gGOlsMۼץ㢐& t &+U#!FMǔkX ~s|DĪ0懤H~@N;WqIEp*ً#L6A,iidOKH$SЅwaX6d6-gR3RnkوR3Pa39P;EȅP><=uA׵H g[* D7cJc\R. )}3"3K[T^,W(\p MMHkL*g])㊔Á8v8W&d,U]*r4J[<~. E|>!-@U o {p F馤9Sf njD*e4Bam0\O7G1x$s 'Iz{GγAȘ<]#7x/\: ;%;*D$]$Ao`wXe#l@ :F{:uTL+S/T@>Jׁ)s *WI/DYyv.xsu-T"JLbZB$HQo8ShVJ794n~V~re2J9X[w:ՠL |O5Vq;JKEnHUS2<]T/i䱗yDžl]$@"%oԂ/^*}ADЧs:b{g Rz\Q1EU #ao@ӈbL;T"PFn:~D6}/!^s:陓.pS1Jn mxL1g+z_'(Y8wa#.&/|IENDB`kylin-nm/res/s/conning-b/7.png0000644000175000017500000000557613522470453015037 0ustar fengfengPNG  IHDR``w8tEXtSoftwareAdobe ImageReadyqe<iTXtXML:com.adobe.xmp 8IDATx]SE%Rj`*8! wJYe-ZH*9ijg%K\vWh&0?vWjBf߯G)a(EAJ7KJQJIB!uMjRAh!H=%C)zNː{{Ra)E@>|"amK@#2{M2v"F{? TUxMAd2>- : KȜ8z$HY, (_ć%(䱯Oe1Ȃ ﯊ӚL!% w:B罴bډUjڔ; *qWX (#% %.TYYPT3[O&U) DS) jqR"] m`"$eQ?d-t\1,eT|y/ Xx0v&L^q)~H;RbUMɨ~]-rOʺ%Wy,lweF݆6+ AV)]ʏRގX=eӮEI &>@'76+PT1@(,) V"OD))s+#0ngWX8_OJo>H EcA^LU5a@p wF  m14C"U>W&JM+pUݦX@@gWS@&"8M6QNvE# .o?p4l>UrGKJ=>XnW/ж6sGwAB rrpmfpnR.N!pƂTỳñ*5@,3`.;Ls#嫬hgM|êü$TE'c|$ţH_Fb!ڲZ/Y#ߪ6! xS(|v/,p-o#t'9"0W5l0p&^$(ULׯs<4H_X:{iqPcEpkti3 F 8$uG>pgڬnH-5 m]!cgj@[U)px ڂ,q"p`ZE;a&V8ݭý uf7D~t8:9APU 2ʭo wQP0L\= SGWIM!m=c( aTW,gFiVy]&:P>kQ[)&3:bة"bDaIZuО=v6f `N-}D&D3"#6Z6n]>j0MLB 5* :cү){)o!`VpS-AL[I-@ԑ~&f'7`Q6|!|`7R>!17h:~l*7["N&@[E:\O[]`b #include #include #include #include #include class LoadingDiv : public QWidget { Q_OBJECT public: explicit LoadingDiv(QWidget *parent = nullptr); signals: void toStopLoading(); public slots: void switchAnimStep(); void startLoading(); void stopLoading(); private: QLabel *loadingGif = nullptr; QTimer *switchTimer = nullptr; int currentPage; int countCurrentTime; }; #endif // LOADINGDIV_H kylin-nm/src/mainwindow.h0000644000175000017500000002227213645621273014366 0ustar fengfeng/* * Copyright (C) 2019 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 #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 414 //白色小球在左边 #define X_RIGHT_WIFI_BALL 440 //白色小球在右边 #define Y_WIFI_BALL 22 //白色小球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 #define H_GAP_UP 10 #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 440 #define H_SCROLL_AREA 360 #define W_TOP_LIST_WIDGET 435 #define W_LIST_WIDGET 440 #define W_BTN_FUN 57 #define H_BTN_FUN 14 #define X_BTN_FUN 361 #define Y_BTN_FUN 87 //新建网络,加入网络按钮的宽高、x坐标、y坐标 #define W_NO_ITEM_TIP 220 #define H_NO_ITEM_TIP 20 class OneConnForm; class ConfForm; namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); void editQssString(); void createTopLanUI(); void createTopWifiUI(); void createOtherUI(); void createListAreaUI(); void createLeftAreaUI(); void startLoading(); void stopLoading(); void setTrayIcon(QIcon icon); void setTrayLoading(bool isLoading); void getActiveInfo(); void initTimer(); void changeTimerState(); void checkIsWirelessDeviceOn(); void init_widget_action(QWidget *wid, QString iconstr, QString textstr); QIcon iconLanOnline, iconLanOffline; QIcon iconWifiFull, iconWifiHigh, iconWifiMedium, iconWifiLow; QIcon iconConnecting; QList loadIcons; QString mwBandWidth; KylinDBus *objKyDBus = nullptr; NetworkSpeed *objNetSpeed = nullptr; NotifySend *m_notify = nullptr; //状态设置,0为假,1为真 int is_update_wifi_list = 0; //是否是update wifi列表,而不是load wifi列表 int is_by_click_connect = 0; //是否是通过点击连接按钮进行的连接 int is_btnNetList_clicked = 1; //是否处于有线网界面 int is_btnWifiList_clicked = 0; //是否处于无线网界面 int is_wired_line_ready = 1; //主机是否连接网线 int is_wireless_adapter_ready = 1; //主机是否插入无线网卡 int is_keep_wifi_turn_on_state = 1; //是否要执行wifi开关变为打开样式 int is_stop_check_net_state = 0; //是否要在进行其他操作时停止检查网络状态 int is_fly_mode_on = 0; //是否已经打开飞行模式 int is_hot_sopt_on = 0; //是否已经打开热点 QString currSelNetName = ""; //当前ScrollArea中选中的网络名称 public slots: void onPhysicalCarrierChanged(bool flag); void onCarrierUpHandle(); void onCarrierDownHandle(); void onDeleteLan(); void onNetworkDeviceAdded(QDBusObjectPath objPath); void onNetworkDeviceRemoved(QDBusObjectPath objPath); void getLanBandWidth(); void oneLanFormSelected(QString lanName); void oneTopLanFormSelected(QString lanName); void oneWifiFormSelected(QString wifiName, int extendLength); void oneTopWifiFormSelected(QString wifiName, int extendLength); void on_btnHotspot_clicked(); void on_btnHotspotState(); void onBtnWifiClicked(int flag = 0); //flag =0为打开、1为关闭、2为其他 protected: bool eventFilter(QObject *obj, QEvent *event); private: void checkSingle(); void initNetwork(); void createTrayIcon(); void handleIconClicked(); void showTrayIconMenu(); bool checkLanOn(); bool checkWlOn(); void getLanList(); void getWifiList(); void getInitLanSlist(); 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; ConfForm *cf = nullptr; QSystemTrayIcon *trayIcon = nullptr; QMenu *trayIconMenu = nullptr; QWidgetAction *mShowWindow = nullptr; QWidgetAction *mAdvConf = nullptr; QWidget *widShowWindow = nullptr; QWidget *widAdvConf = nullptr; QString lname, wname; // 以太网卡和无线网卡名称 QString btnOffQss, btnOnQss, btnBgOffQss, btnBgOnQss, btnBgHoverQss, btnBgLeaveQss; // 主界面按钮底色 QString scrollBarQss, leftBtnQss, funcBtnQss; QStringList oldLanSlist; //上一次获取Lan列表 QStringList oldWifiSlist; //上一次获取wifi列表 //循环检测网络连接状态 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; long int start_rcv_rates = 0; //保存开始时的流量计数 long int end_rcv_rates = 0; //保存结束时的流量计数 long int start_tx_rates = 0; //保存开始时的流量计数 long int end_tx_rates = 0; //保存结束时的流量计数 private slots: void iconActivated(QSystemTrayIcon::ActivationReason reason); bool nativeEvent(const QByteArray &eventType, void *message, long *result); void on_btnNet_clicked(); void on_btnWifiList_clicked(); void onBtnNetListClicked(int flag=0); void getLanListDone(QStringList slist); void getWifiListDone(QStringList slist); void loadWifiListDone(QStringList slist); void updateWifiListDone(QStringList slist); void on_showWindowAction(); void on_btnAdvConf_clicked(); void on_btnNetList_pressed(); void on_btnWifiList_pressed(); void activeLanDisconn(); void activeWifiDisconn(); void activeStartLoading(); void activeGetWifiList(); void on_btnAdvConf_pressed(); void on_btnAdvConf_released(); void on_checkWifiListChanged(); void on_setNetSpeed(); void on_checkOverTime(); void on_isLanConnect(); void on_isWifiConnect(); void on_isNetOn(); // 后台回调 void enNetDone(); void disNetDone(); void enWifiDone(); void launchLanDone(); void disWifiDone(); void disWifiStateKeep(); void disWifiDoneChangeUI(); void connLanDone(int connFlag); void connWifiDone(int connFlag); void iconStep(); void on_btnFlyMode_clicked(); void onBtnAddNetClicked(); void onBtnCreateNetClicked(); signals: void disConnSparedNet(QString type); void waitWifiStop(); void waitLanStop(); }; #endif // MAINWINDOW_H kylin-nm/src/onelancform.cpp0000644000175000017500000003073013645621273015046 0ustar fengfeng/* * Copyright (C) 2019 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->lbConned->setAlignment(Qt::AlignLeft); ui->lbInfo->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}"); ui->btnInfo->setStyleSheet("QPushButton{border:none;background:transparent;}"); ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(255,255,255,0.1);}"); ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(255,255,255,0);}"); ui->lbName->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.91);}"); ui->lbConned->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}"); 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->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(255,255,255,0.2);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0.08);}"); 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->wbg->hide(); ui->wbg_2->show(); ui->lbName->show(); ui->btnConnSub->hide(); ui->btnConn->hide(); ui->btnDisConn->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())); srand((unsigned)time(NULL)); } OneLancForm::~OneLancForm() { delete ui; } void OneLancForm::mousePressEvent(QMouseEvent *){ emit selectedOneLanForm(lanName); } //事件过滤器 bool OneLancForm::eventFilter(QObject *obj, QEvent *event) { if (obj == ui->btnInfo){ if(event->type() == QEvent::HoverEnter) { ui->lbInfo->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.91);}"); return true; } else if(event->type() == QEvent::HoverLeave){ ui->lbInfo->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}"); 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(255,255,255,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(255,255,255,0);}"); ui->wbg_2->hide(); return true; } } return QWidget::eventFilter(obj,event); } // 是否当前连接的网络,字体设置不同 void OneLancForm::setAct(bool isAct){ if(isAct){ ui->lbName->setStyleSheet("QLabel{font-size:14px;color:#ffffff;}"); ui->lbConned->show(); ui->btnConnSub->hide(); }else{ ui->lbName->setStyleSheet("QLabel{font-size:14px;color:#ffffff;}"); 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; } void OneLancForm::setTopItem(bool isSelected) { if(isSelected){ resize(W_ITEM, H_ITEM_EXTEND); ui->wbg->show(); ui->btnConnSub->hide(); this->isSelected = true; }else{ resize(W_ITEM, H_ITEM); ui->wbg->hide(); ui->btnConnSub->hide(); this->isSelected = false; } if (isConnected){ ui->btnDisConn->show(); } else { ui->btnDisConn->hide(); } ui->btnConn->hide(); ui->wbg_2->hide(); ui->line->hide(); this->isTopItem = true; } void OneLancForm::setName(QString name){ ui->lbName->setText(name); lanName = name; } void OneLancForm::setConnedString(bool showLable, QString str){ if (!showLable){ ui->lbConned->hide(); ui->lbName->move(63, 18); }else{ ui->lbConned->setText(str); } } void OneLancForm::setLanInfo(QString str1, QString str2, QString str3, QString str4) { if (str1 == "" || str1 == "auto"){ str1 = tr("no configuration"); } if (str2 == "" || str2 == "auto"){ str2 = tr("no configuration"); } QString str = "IPv4地址:" + str1 + "\nIPv6地址:" + str2 + "\n带宽:" + str3 + " \n物理地址(MAC):" + str4; ui->lbInfo->setText(str); } void OneLancForm::setIcon(bool isOn){ if(isOn){ ui->lbIcon->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/l/network-online.png);}"); }else{ ui->lbIcon->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/l/network-offline.png);}"); } } 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()); } void OneLancForm::on_btnDisConn_clicked() { syslog(LOG_DEBUG, "DisConnect button about lan net is clicked, current wired net name is %s .", ui->lbName->text().toUtf8().data()); qDebug()<<"DisConnect button about lan net is clicked, current wired net name is "<lbName->text(); this->startWaiting(false); kylin_network_set_con_down(ui->lbName->text().toUtf8().data()); disconnect(this, SIGNAL(selectedOneLanForm(QString)), mw, SLOT(oneLanFormSelected(QString))); emit disconnActiveLan(); } void OneLancForm::on_btnConn_clicked() { syslog(LOG_DEBUG, "A button named btnConn about lan net is clicked."); qDebug()<<"A button named btnConn about lan net is clicked."; 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)), bt, SLOT(execConnLan(QString))); connect(bt, SIGNAL(connDone(int)), mw, SLOT(connLanDone(int))); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); } void OneLancForm::on_btnConnSub_clicked() { syslog(LOG_DEBUG, "A button named btnConnSub about lan net is clicked."); qDebug()<<"A button named btnConnSub about lan net is clicked."; 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)), bt, SLOT(execConnLan(QString))); connect(bt, SIGNAL(connDone(int)), mw, SLOT(connLanDone(int))); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); } 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(ui->lbName->text()); QStringList propList = connProp.split("|"); QString v4method, addr, mask, gateway, dns; foreach (QString line, propList) { if(line.startsWith("method:")){ v4method = line.split(":").at(1); } if(line.startsWith("addr:")){ addr = line.split(":").at(1); } if(line.startsWith("mask:")){ mask = line.split(":").at(1); } if(line.startsWith("gateway:")){ gateway= line.split(":").at(1); } if(line.startsWith("dns:")){ dns = line.split(":").at(1); } } // qDebug()<setProp(ui->lbName->text(), v4method, addr, mask, gateway, dns, this->isActive); //cf->move(primaryGeometry.width() / 2 - cf->width() / 2, primaryGeometry.height() / 2 - cf->height() / 2); cf->show(); cf->raise(); } 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 < 1){ this->waitPage = TOTAL_PAGE; } this->countCurrentTime += FRAME_SPEED; if (this->countCurrentTime >= LIMIT_TIME){ this->stopWaiting(); } } void OneLancForm::startWaiting(bool isConn){ if (isConn){ ui->lbWaiting->setStyleSheet("QLabel{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);}"); }else{ 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 = TOTAL_PAGE; this->waitTimer->start(FRAME_SPEED); ui->lbWaiting->show(); ui->lbWaitingIcon->show(); mw->setTrayLoading(true); } void OneLancForm::stopWaiting(){ this->waitTimer->stop(); ui->lbWaiting->hide(); ui->lbWaitingIcon->hide(); mw->setTrayLoading(false); mw->getActiveInfo(); } kylin-nm/src/mainwindow.ui0000644000175000017500000001616713640637261014561 0ustar fengfeng MainWindow 0 0 480 538 kylin-nm 1 200 37 37 2 200 37 37 412 20 50 24 412 20 50 24 2 490 37 37 10 498 22 22 2 490 37 37 2 348 37 37 2 395 37 37 61 22 80 20 440 22 20 20 11 359 19 19 11 405 19 19 2 10 37 37 2 57 37 37 11 20 19 19 11 67 19 19 2 348 37 37 2 395 37 37 2 10 37 37 2 57 37 37 41 0 1 538 background-color: rgba(255, 255, 255,0.06); Qt::Vertical lbFlyBG lbHotBG lbFlyImg lbHotImg lbBtnNetBG btnNet lbBtnWifiBG lbBtnConfBG lbBtnConfImg btnAdvConf btnHotspot btnFlyMode lbBtnWifiBall btnWifi lbNetListBG lbWifiListBG lbWifiListImg lbNetListImg btnNetList btnWifiList lbNetwork vLine kylin-nm/src/utils.h0000644000175000017500000001055413640637261013351 0ustar fengfeng#ifndef UTILS_H #define UTILS_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /////////////////////////////////////////////////////////////////////////////// // The Utils class, used to do some assist function class Utils { public: Utils(); static int m_system(char *cmd); }; /////////////////////////////////////////////////////////////////////////////// // 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); //获取当前的流量,参数为将获取到的流量保 }; /////////////////////////////////////////////////////////////////////////////// // The CustomStyle class, inherit from class QProxyStyle, to change control style customize class CustomStyle : public QProxyStyle { Q_OBJECT public: explicit CustomStyle(const QString &proxyStyleName = "windows", QObject *parent = nullptr); virtual void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const; virtual void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const; virtual void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const; virtual void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; virtual void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const; virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const; virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = nullptr) const; virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const; virtual QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const; //virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget); virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const; virtual void polish(QWidget *widget); virtual void polish(QApplication *application); virtual void polish(QPalette &palette); virtual void unpolish(QWidget *widget); virtual void unpolish(QApplication *application); virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const; virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const; virtual QPalette standardPalette() const; virtual int styleHint(QStyle::StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const; virtual QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget = nullptr) const; virtual QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const; signals: public slots: }; #endif // UTILS_H kylin-nm/src/backthread.h0000644000175000017500000000410713640637261014276 0ustar fengfeng/* * Copyright (C) 2019 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 IFace{ public: QString lname; QString wname; int lstate; // 0已连接 1未连接 2已关闭 int wstate; // 0已连接 1未连接 2已关闭 }; class BackThread : public QObject { Q_OBJECT public: explicit BackThread(QObject *parent = nullptr); ~BackThread(); IFace* execGetIface(); QString getConnProp(QString connName); bool execChkWifiExist(QString connName); QString execChkLanWidth(QString ethName); QProcess *cmdConnWifi = nullptr; public slots: void execEnNet(); void execDisNet(); void execEnWifi(); void execDisWifi(); void execConnLan(QString connName); void execConnWifi(QString connName); void execConnWifiPWD(QString connName, QString password); void disConnSparedNetSlot(QString type); void disConnLanOrWifi(QString type); void on_readoutput(); void on_readerror(); signals: void enNetDone(); void disNetDone(); void enWifiDone(); void launchLanDone(); void disWifiDone(); void connDone(int connFlag); void btFinish(); void disFinish(); void ttFinish(); }; #endif // BACKTHREAD_H kylin-nm/src/confform.ui0000644000175000017500000001777113645621273014221 0ustar fengfeng ConfForm 0 0 432 510 0 0 432 510 1 180 430 260 175 15 182 32 10 175 60 182 32 10 175 105 182 32 10 175 150 182 32 10 76 20 80 20 10 76 65 80 20 10 76 110 80 20 10 76 155 80 20 10 175 195 182 32 10 76 200 80 20 10 1 1 430 180 175 120 182 32 10 76 125 80 20 10 76 80 80 20 10 175 75 182 32 10 1 440 430 70 315 15 90 30 10 215 15 90 30 10 315 15 90 30 30 30 140 22 10 175 412 1 Qt::Horizontal 10 430 412 1 Qt::Horizontal kylin-nm/src/onelancform.ui0000644000175000017500000001002213640637261014670 0ustar fengfeng OneLancForm 0 0 424 60 Form 63 8 190 20 316 14 100 34 316 14 100 34 316 14 100 34 63 31 52 20 0 0 424 162 63 64 238 85 63 64 238 85 14 14 32 32 0 59 424 1 background-color: rgba(255, 255, 255,0.05); Qt::Horizontal 0 0 424 60 316 14 100 34 356 20 20 20 lbName lbConned lbIcon line wbg wbg_2 btnConnSub btnDisConn btnConn lbWaiting lbWaitingIcon kylin-nm/src/utils.cpp0000644000175000017500000002111613645621273013701 0ustar fengfeng/* * Copyright (C) 2019 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 /////////////////////////////////////////////////////////////////////////////// // The Utils class Utils::Utils(){} int Utils::m_system(char *cmd) { int status = 0; pid_t pid; if ((pid = vfork()) <0){ qDebug()<<"failed to create a subprocess by using vfork"; syslog(LOG_ERR, "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); if (execve("/bin/sh",(char *const *) new_argv, NULL) <0) { qDebug()<<"failed to execve a shell command in function m_system"; syslog(LOG_ERR, "failed to execve %s! errno: %d\n",cmd, errno); exit(1); } else { exit(0); } } else { waitpid(pid,&status,0); } return status; } /////////////////////////////////////////////////////////////////////////////// // The NetworkSpeed class, used to get network speed NetworkSpeed::NetworkSpeed(QObject *parent) :QObject(parent){} int NetworkSpeed::getCurrentDownloadRates(char *netname, long *save_rate, long *tx_rate) { FILE * net_dev_file; //文件指针 char buffer[1024]; //文件中的内容暂存在字符缓冲区里 //size_t bytes_read; //实际读取的内容大小 char * match; //用以保存所匹配字符串及之后的内容 int counter = 0; //int i = 0; char tmp_value[128]; if((NULL == netname)||(NULL == save_rate)||(NULL == tx_rate)){ qDebug()<<"parameter pass to function getCurrentDownloadRates() error"; syslog(LOG_ERR, "parameter pass to function getCurrentDownloadRates() error"); return -1; } if ( (net_dev_file=fopen("/proc/net/dev", "r")) == NULL ){ //打开文件/pro/net/dev/,从中读取流量数据 qDebug()<<"error occurred when try to open file /proc/net/dev/"; syslog(LOG_ERR, "error occurred when try to open file /proc/net/dev/"); return -1; } memset(buffer,0,sizeof(buffer)); while(fgets(buffer,sizeof(buffer),net_dev_file) != NULL){ match = strstr(buffer,netname); if(NULL == match){ // qDebug()<<"No eth0 keyword to find!"; continue; }else{ match = match + strlen(netname) + strlen(":"); //地址偏移到冒号 sscanf(match,"%ld ",save_rate); memset(tmp_value,0,sizeof(tmp_value)); sscanf(match,"%s ",tmp_value); match = match + strlen(tmp_value); for(size_t i=0;iinherits("QTipLabel")){ widget->setAttribute(Qt::WA_TranslucentBackground); QPainterPath path; auto rect = widget->rect(); rect.adjust(0, 0, -0, -0); path.addRoundedRect(rect, 3, 3); widget->setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); } } return QProxyStyle::polish(widget); } void CustomStyle::polish(QApplication *application) { return QProxyStyle::polish(application); } void CustomStyle::polish(QPalette &palette) { return QProxyStyle::polish(palette); } void CustomStyle::unpolish(QWidget *widget) { return QProxyStyle::unpolish(widget); } void CustomStyle::unpolish(QApplication *application) { return QProxyStyle::unpolish(application); } QSize CustomStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const { return QProxyStyle::sizeFromContents(type, option, contentsSize, widget); } QIcon CustomStyle::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { return QProxyStyle::standardIcon(standardIcon, option, widget); } QPalette CustomStyle::standardPalette() const { return QProxyStyle::standardPalette(); } int CustomStyle::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const { return QProxyStyle::styleHint(hint, option, widget, returnData); } QRect CustomStyle::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const { return QProxyStyle::subControlRect(control, option, subControl, widget); } QRect CustomStyle::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const { return QProxyStyle::subElementRect(element, option, widget); } kylin-nm/src/kylin-dbus-interface.h0000644000175000017500000000417113645621273016227 0ustar fengfeng#ifndef KYLINDBUSINTERFACE_H #define KYLINDBUSINTERFACE_H #include #include #include #include #include #include #include #include #include #include #include #include #include class MainWindow; class KylinDBus : public QObject { Q_OBJECT public: explicit KylinDBus(MainWindow *mw = 0, QObject *parent = nullptr); void getObjectPath(); int getAccessPointsNumber(); int getLanConnState(); void showDesktopNotify(QString message); 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); QDBusObjectPath wiredPath; QDBusObjectPath wirelessPath; bool isWiredCableOn = false; bool isWirelessCardOn = false; QString dbusLanCardName = ""; QString dbusLanIpv4 = ""; QString dbusLanIpv6 = ""; QString dbusLanGateway = ""; QString dbusLanMac = ""; QString dbusWiFiCardName = ""; QString dbusWifiMac = ""; public slots: void onNewConnection(QDBusObjectPath objPath); void onConnectionRemoved(QDBusObjectPath objPath); void onLanPropertyChanged(QVariantMap qvm); void onWifiPropertyChanged(QVariantMap qvm); void onAccessPointAdded(QDBusObjectPath objPath); void getPhysicalCarrierState(int n); void getLanHwAddressState(); void getWiredCardName(); void getWirelessCardName(); void getLanIp(QString netName); void getWifiMac(QString netName); void getActWifiMac(QString netName); void slot_timeout(); private: MainWindow *mw; int a = 0; bool isRunningFunction = false; QTimer *time = nullptr; QGSettings *m_tastbar_gsettings = nullptr; QGSettings *m_gsettings = nullptr; signals: void updateWiredList(int n); }; #endif // KYLINDBUSINTERFACE_H kylin-nm/src/backthread.cpp0000644000175000017500000003405113645632352014633 0ustar fengfeng/* * Copyright (C) 2019 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 BackThread::BackThread(QObject *parent) : QObject(parent){ cmdConnWifi = new QProcess(this); connect(cmdConnWifi , SIGNAL(readyReadStandardOutput()) , this , SLOT(on_readoutput())); connect(cmdConnWifi , SIGNAL(readyReadStandardError()) , this , SLOT(on_readerror())); cmdConnWifi->start("bash"); cmdConnWifi->waitForStarted(); } BackThread::~BackThread() { cmdConnWifi->close(); } 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()); // int status = system(cmd.toUtf8().data()); // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli device' in function 'execGetIface' failed");} QFile file(tmpPath); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) { syslog(LOG_ERR, "Can't open the file /tmp/kylin-nm-iface!"); qDebug()<<"Can't open the file /tmp/kylin-nm-iface!"<lstate = 2; iface->wstate = 2; 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->lname = iname; if(istateStr == "unmanaged"){ iface->lstate = 2; } if(istateStr == "disconnected" || istateStr == "unavailable"){ iface->lstate = 1; } if(istateStr == "connected"){ iface->lstate = 0; } } if(type == "wifi"){ iface->wname = iname; if(istateStr == "unmanaged" || istateStr == "unavailable"){ iface->wstate = 2; } if(istateStr == "disconnected"){ iface->wstate = 1; } if(istateStr == "connected"){ iface->wstate = 0; } } } } return iface; } void BackThread::execEnNet(){ char *chr = "nmcli networking on"; Utils::m_system(chr); // int status = system("nmcli networking on"); // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli networking on' in function 'execEnNet' failed");} while(1){ if (execGetIface()->lstate != 2){ sleep(3); emit enNetDone(); emit btFinish(); break; } sleep(1); } } void BackThread::execDisNet(){ if (execGetIface()->wstate != 2){ char *chr = "nmcli radio wifi off"; Utils::m_system(chr); // int status = system("nmcli radio wifi off"); // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli radio wifi off' in function 'execDisNet' failed");} while(1){ if (execGetIface()->wstate == 2){ emit disWifiDone(); emit btFinish(); break; } sleep(1); } } char *chr1 = "nmcli networking off"; Utils::m_system(chr1); // int status1 = system("nmcli networking off"); // if (status1 != 0){ syslog(LOG_ERR, "execute 'nmcli networking off' in function 'execDisNet' failed");} while(1){ if (execGetIface()->lstate == 2){ emit disNetDone(); emit btFinish(); break; } sleep(1); } } void BackThread::execEnWifi(){ // if (execGetIface()->lstate == 2){ // char *chr = "nmcli networking on"; // Utils::m_system(chr); // //int status = system("nmcli networking on"); // //if (status != 0){ syslog(LOG_ERR, "execute 'nmcli networking on' in function 'execEnWifi' failed");} // while(1){ // if (execGetIface()->lstate != 2){ // emit launchLanDone(); // break; // } // sleep(1); // } // } char *chr1 = "nmcli radio wifi on"; Utils::m_system(chr1); // int status1 = system("nmcli radio wifi on"); // if (status1 != 0){ syslog(LOG_ERR, "execute 'nmcli radio wifi on' in function 'execEnWifi' failed");} while(1){ if (execGetIface()->wstate != 2){ KylinDBus objKyDbus; while(1){ if (objKyDbus.getAccessPointsNumber() > 0){ emit enWifiDone(); emit btFinish(); break; } sleep(2); } break; } sleep(1); } } void BackThread::execDisWifi(){ char *chr = "nmcli radio wifi off"; Utils::m_system(chr); // int status = system("nmcli radio wifi off"); // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli radio wifi off' in function 'execDisWifi' failed");} while(1){ if (execGetIface()->wstate == 2){ emit disWifiDone(); emit btFinish(); break; } sleep(1); } } void BackThread::execConnLan(QString connName){ disConnLanOrWifi("ethernet"); KylinDBus objKyDbus; if(objKyDbus.isWiredCableOn){ QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "'"; Utils::m_system(cmd.toUtf8().data()); // int status = system(cmd.toUtf8().data()); // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection up' in function 'execConnLan' failed");} qDebug()<<"debug: in function execConnLan, wired net state is: "<lstate); syslog(LOG_DEBUG, "In function execConnLan, wired net state is: %d", execGetIface()->lstate); emit connDone(0); } else { emit connDone(1); } emit btFinish(); } void BackThread::execConnWifiPWD(QString connName, QString password){ disConnLanOrWifi("wifi"); 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()); // int status = system(cmdStr.toUtf8().data()); // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli device wifi connect' in function 'execConnWifiPWD' failed");} QFile file(tmpPath); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ syslog(LOG_DEBUG, "Can't open the file /tmp/kylin-nm-btoutput !"); qDebug()<<"Can't open the file /tmp/kylin-nm-btoutput !"<wstate); syslog(LOG_DEBUG, "In function execConnWifiPWD, wireless net state is: %d", execGetIface()->wstate); }else{ emit connDone(1); } emit btFinish(); } void BackThread::execConnWifi(QString connName){ disConnLanOrWifi("wifi"); QString cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "'\n"; cmdConnWifi->write(cmdStr.toUtf8().data()); } void BackThread::on_readoutput() { QString str = cmdConnWifi->readAllStandardOutput(); cmdConnWifi->close(); qDebug()<<"on_readoutput: "<< str; if(str.indexOf("successfully") != -1){ emit connDone(0); qDebug()<<"debug: in function on_readoutput, wireless net state is: "<wstate); syslog(LOG_DEBUG, "In function on_readoutput, wireless net state is: %d", execGetIface()->wstate); }else if(str.indexOf("unknown") != -1){ emit connDone(2); }else{ emit connDone(1); } emit btFinish(); } void BackThread::on_readerror() { QString str = cmdConnWifi->readAllStandardError(); cmdConnWifi->close(); qDebug()<<"on_readerror: "<< str; if(str.indexOf("successfully") != -1){ emit connDone(0); }else if(str.indexOf("unknown") != -1){ emit connDone(2); }else{ emit connDone(1); } emit btFinish(); } 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()); // int status = system(cmd.toUtf8().data()); // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'getConnProp' failed");} QFile file(tmpPath); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ syslog(LOG_ERR, "Can't open the file /tmp/kylin-nm-connprop!"); qDebug()<<"Can't open the file /tmp/kylin-nm-connprop!"< " + tmpPath; Utils::m_system(cmd.toUtf8().data()); // int status = system(cmd.toUtf8().data()); // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'execChkWifiExist' failed");} QFile file(tmpPath); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) { syslog(LOG_ERR, "Can't open the file /tmp/kylin-nm-chkwifiexist!"); qDebug()<<"Can't open the file /tmp/kylin-nm-chkwifiexist!"< " + tmpPath; Utils::m_system(cmd.toUtf8().data()); // int status = system(cmd.toUtf8().data()); // if (status != 0){ syslog(LOG_ERR, "execute 'ethtool' in function 'execChkLanWidth' failed");} QFile file(tmpPath); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) { syslog(LOG_ERR, "Can't open the file /tmp/kylin-nm-bandwidth!"); qDebug()<<"Can't open the file /tmp/kylin-nm-bandwidth!"< #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_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); /* * Set up manual all prop. */ void kylin_network_set_manualall(char *con_name, char *addr, char *mask, char *gateway, char *dns); /* * 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/ksimplenm.cpp0000644000175000017500000000411113640637261014533 0ustar fengfeng/* * Copyright (C) 2019 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 #define MAX_LEN 2048 #define MAX_PATH 1024 KSimpleNM::KSimpleNM(QObject *parent) : QObject(parent) { runShellProcess = new QProcess(this); connect(runShellProcess, &QProcess::readyRead, this, &KSimpleNM::readProcess); connect(runShellProcess, SIGNAL(finished(int)), this, SLOT(finishedProcess(int))); } void KSimpleNM::execGetLanList(){ if (isExecutingGetWifiList){ syslog(LOG_DEBUG, "It is running getting wifi list when getting lan list"); qDebug()<<"debug: it is running getting wifi list when getting lan list"; isUseOldLanSlist = true; } isExecutingGetLanList = true; shellOutput = ""; type = 0; runShellProcess->start("nmcli -f type,device,name connection show"); } void KSimpleNM::execGetWifiList(){ isExecutingGetWifiList = true; shellOutput = ""; type = 1; runShellProcess->start("nmcli -f signal,rate,security,ssid device wifi"); } void KSimpleNM::readProcess(){ QString output = runShellProcess->readAll(); shellOutput += output; } void KSimpleNM::finishedProcess(int msg){ QStringList slist = shellOutput.split("\n"); if(type == 0){ emit getLanListFinished(slist); isExecutingGetLanList = false; }else{ emit getWifiListFinished(slist); isExecutingGetWifiList = false; } } kylin-nm/src/notifysend.ui0000644000175000017500000000262213640637261014556 0ustar fengfeng NotifySend 0 0 400 70 Form 0 0 60 70 360 20 30 30 80 20 260 27 0 0 400 70 backwidget lbColor btnClose leText kylin-nm/src/loadingdiv.cpp0000644000175000017500000000361013645621273014660 0ustar fengfeng/* * Copyright (C) 2019 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 resize(480, 538); this->loadingGif = new QLabel(this); this->loadingGif->resize(96, 96); this->loadingGif->move(this->width()/2 - 96/2 + 41/2, this->height()/2 + 20); this->loadingGif->show(); this->switchTimer = new QTimer(this); connect(switchTimer, SIGNAL(timeout()), this, SLOT(switchAnimStep())); this->raise(); this->hide(); } void LoadingDiv::switchAnimStep(){ QString qpmQss = "QLabel{background-image:url(':/res/s/conning-b/"; qpmQss.append(QString::number(this->currentPage)); qpmQss.append(".png');}"); loadingGif->setStyleSheet(qpmQss); this->currentPage --; if(this->currentPage < 1){ this->currentPage = 12; } this->countCurrentTime += FRAMESPEED; if (this->countCurrentTime >= ALLTIME){ emit this->toStopLoading(); } } void LoadingDiv::startLoading(){ this->currentPage = 12; this->countCurrentTime = 0; this->switchTimer->start(FRAMESPEED); this->show(); } void LoadingDiv::stopLoading(){ this->switchTimer->stop(); this->hide(); } kylin-nm/src/oneconnform.ui0000644000175000017500000001247413640637261014725 0ustar fengfeng OneConnForm 0 0 424 60 Form 63 8 190 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 64 230 61 0 59 424 1 background-color: rgba(255, 255, 255,0.05); Qt::Horizontal 0 0 424 60 316 14 100 34 356 20 20 20 wbg_3 wbg_2 lbName lbSignal lbConned line wbg btnConnSub btnConn btnConnPWD btnDisConn btnHideConn lbWaiting lbWaitingIcon kylin-nm/src/onelancform.h0000644000175000017500000000507513645621273014517 0ustar fengfeng/* * Copyright (C) 2019 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" #define FRAME_SPEED 150 #define LIMIT_TIME 30*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 0 #define Y_LINE_EXTEND 161 #define X_LINE_EXTEND 0 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 setName(QString name); 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); bool isSelected; bool isTopItem; bool isActive; bool isConnected; QString lanName; signals: void selectedOneLanForm(QString lanName); void connDone(int connFlag); void disconnActiveLan(); void sigConnLan(QString); 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 slotConnLan(); void waitAnimStep(); void startWaiting(bool isConn); void stopWaiting(); void on_btnInfo_clicked(); private: QTimer *waitTimer = nullptr; int waitPage; int countCurrentTime; Ui::OneLancForm *ui = nullptr; MainWindow *mw = nullptr; ConfForm *cf = nullptr; KSimpleNM *ks = nullptr; }; #endif // ONELANCFORM_H kylin-nm/src/ksimplenm.h0000644000175000017500000000257713640637261014216 0ustar fengfeng/* * Copyright (C) 2019 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 KSimpleNM : public QObject { Q_OBJECT public: explicit KSimpleNM(QObject *parent = nullptr); QProcess *runShellProcess = nullptr; QString shellOutput; int type; bool isExecutingGetLanList = false; bool isExecutingGetWifiList = false; bool isUseOldLanSlist = false; void execGetLanList(); void execGetWifiList(); signals: void getLanListFinished(QStringList slist); void getWifiListFinished(QStringList slist); public slots: void readProcess(); void finishedProcess(int msg); }; #endif // KSIMPLENM_H kylin-nm/src/kylin-network-interface.c0000644000175000017500000006333713645640455016772 0ustar fengfeng/* * Copyright (C) 2019 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[100]; //截取连接名称 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[100]; 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[100]; //截取连接名称 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[100]; 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[100]; 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[100]; 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[100]; 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_name) { char str[100]; char *automethod="auto"; sprintf(str,"nmcli connection modify '%s' ipv4.method %s",con_name,automethod); int status = system(str); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection modify' in function 'kylin_network_set_automethod' failed");} } //设置手动分配ip void kylin_network_set_manualmethod(char *con_name,char *ip) { char str[100]; 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");} } // 设置手动分配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_autoconnect(char *con_name,bool autocon) { char str[100]; 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[100]; 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[100]; 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[100]; 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[100]; 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[100]; 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[100]; 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[100]; sprintf(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[100]; 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/notifysend.h0000644000175000017500000000073313640637261014371 0ustar fengfeng#ifndef NOTIFYSEND_H #define NOTIFYSEND_H #include #include #include namespace Ui { class NotifySend; } class NotifySend : public QWidget { Q_OBJECT public: explicit NotifySend(QWidget *parent = nullptr); ~NotifySend(); void execNotifySend(QString text); private: Ui::NotifySend *ui; private slots: void closeNotifyDialog(); void on_btnClose_clicked(); signals: void timeout(); }; #endif // NOTIFYSEND_H kylin-nm/src/notifysend.cpp0000644000175000017500000000332313640637261014722 0ustar fengfeng#include "notifysend.h" #include "ui_notifysend.h" NotifySend::NotifySend(QWidget *parent) : QWidget(parent), ui(new Ui::NotifySend) { ui->setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup); this->setAttribute(Qt::WA_TranslucentBackground); QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 4, 4); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); this->setStyleSheet("QWidget{border:none;border-radius:4px;}"); ui->backwidget->setStyleSheet("QWidget{border:1px solid rgba(255, 255, 255, 0.05);border-radius:4px;background:rgba(19,19,20,0.7);}"); ui->lbColor->setStyleSheet("QLabel{border:none;background:rgba(61,107,229,1);}"); ui->leText->setStyleSheet("QLineEdit{border:none;background:transparent;font-size:14px;color:white;font-size:14px;}"); ui->btnClose->setStyleSheet("QPushButton{background-image:url(:/res/g/close_white.png);background-color:transparent;border:none;}"); ui->btnClose->setFocusPolicy(Qt::NoFocus); QRect availableGeometry = qApp->primaryScreen()->availableGeometry(); int d = 10; //窗口上边沿到屏幕边沿距离 int s = 10; //窗口右边沿到屏幕边沿距离 this->move(availableGeometry.x() + availableGeometry.width() - this->width() - s, availableGeometry.y() + d); } NotifySend::~NotifySend() { delete ui; } void NotifySend::execNotifySend(QString text) { ui->leText->setText(text); this->show(); QTimer::singleShot(4000, this, SLOT(closeNotifyDialog() )); } void NotifySend::closeNotifyDialog(){ ui->leText->setText(""); this->hide(); } void NotifySend::on_btnClose_clicked() { this->hide(); } kylin-nm/src/main.cpp0000644000175000017500000000305213640637261013463 0ustar fengfeng/* * Copyright (C) 2019 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 #define LOG_IDENT "ukui_kylin_nm" int main(int argc, char *argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication a(argc, argv); openlog(LOG_IDENT, LOG_NDELAY | LOG_NOWAIT | LOG_PID, LOG_USER); syslog(LOG_DEBUG, "Kylin Network Manager Is Already Launched"); // 国际化 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); } MainWindow w; return a.exec(); } kylin-nm/src/mainwindow.cpp0000644000175000017500000030250713645631031014714 0ustar fengfeng/* * Copyright (C) 2019 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 QString llname, lwname, hideWiFiConn; int currentActWifiSignalLv, count_loop; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); checkSingle(); syslog(LOG_DEBUG, "Using the icon theme named 'ukui-icon-theme-default'"); 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->setAttribute(Qt::WA_TranslucentBackground);//设置窗口背景透明 UseQssFile::setStyle("style.qss"); QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); path.addRoundedRect(rect, 6, 6); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); this->setStyleSheet("QWidget{border:none;border-radius:6px;}"); // this->setStyleSheet("QToolTip{background:rgba(26,26,26,0.7);" // "font: 14px;" // "color:rgba(255,255,255,1);" // "border-radius: 3px;" // "border:1px solid rgba(255,255,255,0.2);" // "padding: 0px 4px;" // "outline:none;}"); ui->centralWidget->setStyleSheet("#centralWidget{border:1px solid rgba(255,255,255,0.05);" "border-radius:6px;background:rgba(19,19,20,0.7);}"); editQssString(); //编辑部分控件QSS createTopLanUI(); //创建顶部有线网item createTopWifiUI(); //创建顶部无线网item createOtherUI(); //创建上传下载控件,列表区无item时的说明控件 createListAreaUI(); //创建列表区域的控件 createLeftAreaUI(); //创建左侧区域控件 lname = "-1"; wname = "-1"; llname = "-1"; lwname = "-1"; hideWiFiConn = "Connect to Hidden Wi-Fi Network"; currentActWifiSignalLv = -1; count_loop = 0; createTrayIcon(); connect(trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::iconActivated); connect(mShowWindow,SIGNAL(triggered()),this,SLOT(on_showWindowAction())); connect(mAdvConf,SIGNAL(triggered()),this,SLOT(on_btnAdvConf_clicked())); trayIcon->show(); objKyDBus = new KylinDBus(this); objNetSpeed = new NetworkSpeed(); //m_notify = new NotifySend(); this->confForm = new ConfForm(); this->ksnm = new KSimpleNM(); connect(ksnm, SIGNAL(getLanListFinished(QStringList)), this, SLOT(getLanListDone(QStringList))); connect(ksnm, SIGNAL(getWifiListFinished(QStringList)), this, SLOT(getWifiListDone(QStringList))); loading = new LoadingDiv(this); connect(loading, SIGNAL(toStopLoading() ), this, SLOT(on_checkOverTime() )); checkIsWirelessDeviceOn(); //检测无线网卡是否插入 getInitLanSlist(); //初始化有线网列表 initNetwork(); //初始化网络 initTimer(); //初始化定时器 //changeTimerState();//停止所有定时器 connect(ui->btnNetList, &QPushButton::clicked, this, &MainWindow::onBtnNetListClicked); connect(ui->btnWifi, &QPushButton::clicked, this, &MainWindow::onBtnWifiClicked); // auto app = static_cast(QCoreApplication::instance()); // app->setStyle(new CustomStyle()); ui->btnNetList->setAttribute(Qt::WA_Hover,true); ui->btnNetList->installEventFilter(this); ui->btnWifiList->setAttribute(Qt::WA_Hover,true); ui->btnWifiList->installEventFilter(this); // KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } MainWindow::~MainWindow() { delete ui; } void MainWindow::checkSingle() { int fd = 0; try{ QStringList homePath = QStandardPaths::standardLocations(QStandardPaths::HomeLocation); QString lockPath = homePath.at(0) + "/.config/kylin-nm-lock"; 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); } } bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) { Q_UNUSED(result); if(eventType != "xcb_generic_event_t"){ return false; } xcb_generic_event_t *event = (xcb_generic_event_t*)message; switch (event->response_type & ~0x80){ case XCB_FOCUS_OUT: this->hide(); break; } return false; } bool MainWindow::eventFilter(QObject *obj, QEvent *event) { if (obj == ui->btnNetList){ if(event->type() == QEvent::HoverEnter) { if (!is_btnNetList_clicked){ ui->lbNetListBG->setStyleSheet(btnBgHoverQss); } return true; } else if(event->type() == QEvent::HoverLeave){ if (!is_btnNetList_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(255,255,255,0.12)}"; 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.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);}"; 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() { 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); lbTopLanList->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.97);}"); 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("Create Lan Net"));//"新建网络" btnCreateNet->setStyleSheet(funcBtnQss); btnCreateNet->setFocusPolicy(Qt::NoFocus); btnCreateNet->show(); connect(btnCreateNet,SIGNAL(clicked()),this,SLOT(onBtnCreateNetClicked())); } void MainWindow::createTopWifiUI() { 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("Wifi Networks"));//"可用网络列表" lbTopWifiList->resize(W_MIDDLE_WORD, H_MIDDLE_WORD); lbTopWifiList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_GAP_UP); lbTopWifiList->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.97);}"); lbTopWifiList->show(); /*新建有线网按钮*/ btnAddNet = new QPushButton(topWifiListWidget); btnAddNet->resize(W_BTN_FUN, H_BTN_FUN); btnAddNet->move(X_BTN_FUN, Y_BTN_FUN); btnAddNet->setText(tr("Add Hide Network"));//"加入网络" btnAddNet->setStyleSheet(funcBtnQss); btnAddNet->setFocusPolicy(Qt::NoFocus); btnAddNet->show(); connect(btnAddNet,SIGNAL(clicked()),this,SLOT(onBtnAddNetClicked())); } void MainWindow::createOtherUI() { 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;font-size:14px;color:rgba(255,255,255,0.91);}"); lbNoItemTip->setText(tr("No usable network in the list"));//列表暂无可连接网络 lbNoItemTip->setAlignment(Qt::AlignCenter); lbNoItemTip->hide(); } void MainWindow::createListAreaUI() { 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;color:rgba(255,255,255,0.97);}"); 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;color:rgba(255,255,255,0.57);}"); lbLoadDown->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}"); lbLoadUp->setText("0KB/s"); lbLoadDown->setText("0KB/s."); this->on_setNetSpeed(); scrollAreal->setStyleSheet("QScrollArea{border:none;}"); scrollAreal->viewport()->setStyleSheet("background-color:transparent;"); //scrollAreal->verticalScrollBar()->setStyleSheet(scrollBarQss); scrollAreaw->setStyleSheet("QScrollArea{border:none;}"); scrollAreaw->viewport()->setStyleSheet("background-color:transparent;"); //scrollAreaw->verticalScrollBar()->setStyleSheet(scrollBarQss); } void MainWindow::createLeftAreaUI() { ui->btnNetList->setFocusPolicy(Qt::NoFocus); QString txtEthernet(tr("Ethernet")); ui->btnNetList->setToolTip(txtEthernet); ui->lbNetListBG->setStyleSheet(btnOffQss); ui->lbNetListImg->setStyleSheet("QLabel{background-image:url(:/res/x/net-list-bg.svg);}"); ui->btnWifiList->setFocusPolicy(Qt::NoFocus); QString txtWifi(tr("Wifi")); ui->btnWifiList->setToolTip(txtWifi); ui->lbWifiListBG->setStyleSheet(btnOffQss); ui->lbWifiListImg->setStyleSheet("QLabel{background-image:url(:/res/x/wifi-list-bg.svg);}"); ui->btnNet->hide(); ui->lbBtnNetBG->hide(); ui->btnWifi->setFocusPolicy(Qt::NoFocus); ui->btnWifi->setStyleSheet("QPushButton{border:none;background:transparent;}"); ui->lbBtnWifiBall->setStyleSheet("QLabel{min-width: 16px; min-height: 16px;max-width:16px; max-height: 16px;" "border-radius: 8px; border:1px solid white;background:white;}"); 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); ui->lbBtnConfImg->setStyleSheet("QLabel{background-image:url(:/res/x/setup.png);}"); ui->lbBtnConfBG->hide(); ui->lbBtnConfBG->setStyleSheet(btnOffQss); } // 初始化有线网列表 void MainWindow::getInitLanSlist() { oldLanSlist.append("TYPE DEVICE NAME "); QString strSlist; const int BUF_SIZE = 1024; char buf[BUF_SIZE]; FILE * p_file = NULL; p_file = popen("nmcli 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"; } while (fgets(buf, BUF_SIZE, p_file) != NULL) { QString line(buf); if(line.indexOf("ethernet") != -1){ QStringList subLine = line.split(" "); if (subLine[1].size() == 1){ strSlist = "ethernet -- " + subLine[0]+ " " + subLine[1] + " "; }else{strSlist = "ethernet -- " + subLine[0] + " "; } // qDebug()<execGetIface(); wname = iface->wname; lwname = iface->wname; lname = iface->lname; llname = iface->lname; mwBandWidth = bt->execChkLanWidth(lname); // 开关状态 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: lan state =%d, wifi state =%d", iface->lstate, iface->wstate); qDebug()<<"==="; ui->lbBtnNetBG->setStyleSheet(btnOnQss); if(iface->wstate == 0 || iface->wstate == 1){ ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss); ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL); }else{ ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss); ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL); } // 初始化网络列表 if(iface->wstate != 2){ if (iface->wstate == 0){ connWifiDone(3); }else{ if (iface->lstate == 0){ connLanDone(3); }else{ //syslog(LOG_DEBUG, "Launch kylin-nm, will check if Lan or Wifi connected circularly"); //qDebug()<<"连接状态:启动kylin-nm, 即将循环检测 Lan或Wifi 是否连接"; //changeTimerState(); //checkIfNetworkOn->start(8000); } } 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 != 2){ if (iface->lstate == 0) { connLanDone(3); } else{ //syslog(LOG_DEBUG, "Launch kylin-nm, will check if Lan or Wifi connected circularly"); //qDebug()<<"连接状态:启动kylin-nm, 即将循环检测 Lan或Wifi 是否连接"; //changeTimerState(); //checkIfNetworkOn->start(8000); } 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(); qDebug()<<"m_lstate ="<lstate<<" m_wstate ="<wstate ; m_bt->disConnLanOrWifi("ethernet"); sleep(1); m_bt->disConnLanOrWifi("ethernet"); sleep(1); m_bt->disConnLanOrWifi("ethernet"); delete m_iface; m_bt->deleteLater(); char *chr = "nmcli networking on"; Utils::m_system(chr); // int status = system("nmcli networking on"); // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli networking on' in function 'initNetwork' failed");} 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;}"); //disNetDone(); } } } // 初始化定时器 void MainWindow::initTimer() { // checkIfLanConnect = new QTimer(this); // checkIfLanConnect->setTimerType(Qt::PreciseTimer); // QObject::connect(checkIfLanConnect, SIGNAL(timeout()), this, SLOT(on_isLanConnect())); // checkIfLanConnect->start(2000); // checkIfWifiConnect = new QTimer(this); // checkIfWifiConnect->setTimerType(Qt::PreciseTimer); // QObject::connect(checkIfWifiConnect, SIGNAL(timeout()), this, SLOT(on_isWifiConnect())); // checkIfWifiConnect->start(2000); // checkIfNetworkOn = new QTimer(this); // checkIfNetworkOn->setTimerType(Qt::PreciseTimer); // QObject::connect(checkIfNetworkOn, SIGNAL(timeout()), this, SLOT(on_isNetOn())); // checkIfNetworkOn->start(2000); //循环检测wifi列表的变化,可用于更新wifi列表 checkWifiListChanged = new QTimer(this); checkWifiListChanged->setTimerType(Qt::PreciseTimer); QObject::connect(checkWifiListChanged, SIGNAL(timeout()), this, SLOT(on_checkWifiListChanged())); checkWifiListChanged->start(7000); //网线插入时定时执行 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())); //定时处理异常网络,即当点击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(3000); } void MainWindow::changeTimerState() { if (checkIfLanConnect->isActive()){ checkIfLanConnect->stop(); } if (checkIfNetworkOn->isActive()){ checkIfNetworkOn->stop(); } if (checkIfWifiConnect->isActive()){ checkIfWifiConnect->stop(); } } /////////////////////////////////////////////////////////////////////////////// // 任务栏托盘管理、托盘图标处理 void MainWindow::createTrayIcon() { trayIcon = new QSystemTrayIcon(this); trayIcon->setToolTip(QString(tr("kylin-nm"))); trayIconMenu = new QMenu(this); trayIconMenu->setAttribute(Qt::WA_TranslucentBackground);//设置窗口背景透明 trayIconMenu->setStyleSheet("QMenu {background-color: rgba(19,19,20,0.7);" "border:1px solid rgba(255, 255, 255, 0.05);" "padding: 6px 2px;" "border-radius: 6px;}" "QMenu::item {font-size: 14px;color: #ffffff;" "height: 36px;width: 248px;}" "QMenu::separator{height:1px;background-color:rgba(19,19,20,0);" "margin-top:1px;margin-bottom:2px;}"); mShowWindow = new QWidgetAction(trayIconMenu); mAdvConf = new QWidgetAction(trayIconMenu); widShowWindow = new QWidget(); widAdvConf = new QWidget(); mShowWindow->setDefaultWidget(widShowWindow); mAdvConf->setDefaultWidget(widAdvConf); init_widget_action(widShowWindow, "", tr("Show MainWindow")); init_widget_action(widAdvConf, ":/res/x/setup.png", tr("Advanced")); trayIconMenu->addAction(mShowWindow); trayIconMenu->addSeparator(); trayIconMenu->addAction(mAdvConf); trayIcon->setContextMenu(trayIconMenu); // 初始化托盘所有Icon iconLanOnline = QIcon::fromTheme("nm-device-wired"); iconLanOffline = QIcon::fromTheme("nm-no-connection"); iconWifiFull = QIcon::fromTheme("nm-signal-100"); iconWifiHigh = QIcon::fromTheme("nm-signal-75"); iconWifiMedium = QIcon::fromTheme("nm-signal-50"); iconWifiLow = QIcon::fromTheme("nm-signal-25"); loadIcons.append(QIcon(":/res/s/conning-s/1.png")); loadIcons.append(QIcon(":/res/s/conning-s/2.png")); loadIcons.append(QIcon(":/res/s/conning-s/3.png")); loadIcons.append(QIcon(":/res/s/conning-s/4.png")); loadIcons.append(QIcon(":/res/s/conning-s/5.png")); loadIcons.append(QIcon(":/res/s/conning-s/6.png")); loadIcons.append(QIcon(":/res/s/conning-s/7.png")); loadIcons.append(QIcon(":/res/s/conning-s/8.png")); loadIcons.append(QIcon(":/res/s/conning-s/9.png")); loadIcons.append(QIcon(":/res/s/conning-s/10.png")); loadIcons.append(QIcon(":/res/s/conning-s/11.png")); loadIcons.append(QIcon(":/res/s/conning-s/12.png")); iconTimer = new QTimer(this); connect(iconTimer, SIGNAL(timeout()), this, SLOT(iconStep())); setTrayIcon(iconLanOnline); } void MainWindow::iconStep() { if(currentIconIndex < 0){ currentIconIndex = 11; } setTrayIcon(loadIcons.at(currentIconIndex)); currentIconIndex --; } void MainWindow::setTrayIcon(QIcon icon){ trayIcon->setIcon(icon); } void MainWindow::setTrayLoading(bool isLoading){ if(isLoading){ currentIconIndex = 11; iconTimer->start(60); }else{ iconTimer->stop(); } } void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason) { // switch (reason) { // case QSystemTrayIcon::Trigger: // case QSystemTrayIcon::DoubleClick: // case QSystemTrayIcon::MiddleClick: // break; // } switch(reason){ case QSystemTrayIcon::Trigger: case QSystemTrayIcon::MiddleClick: handleIconClicked(); if(this->isHidden()){ this->showNormal(); }else{ this->hide(); } break; case QSystemTrayIcon::DoubleClick: this->hide(); break; case QSystemTrayIcon::Context: //右键点击托盘图标弹出菜单 showTrayIconMenu(); break; default: break; } } void MainWindow::handleIconClicked() { QRect availableGeometry = qApp->primaryScreen()->availableGeometry(); QRect screenGeometry = qApp->primaryScreen()->geometry(); QDesktopWidget* desktopWidget = QApplication::desktop(); QRect deskMainRect = desktopWidget->availableGeometry(0);//获取可用桌面大小 QRect screenMainRect = desktopWidget->screenGeometry(0);//获取设备屏幕大小 QRect deskDupRect = desktopWidget->availableGeometry(1);//获取可用桌面大小 QRect screenDupRect = desktopWidget->screenGeometry(1);//获取设备屏幕大小 // qDebug()<<" "; // qDebug()<<"trayIcon:"<geometry(); // qDebug()<<"screenGeometry: "<getTaskBarPos("position"); int m = objKyDBus->getTaskBarHeight("height"); int d = 2; //窗口边沿到任务栏距离 if (screenGeometry.width() == availableGeometry.width() && screenGeometry.height() == availableGeometry.height()){ if(n == 0){ //任务栏在下侧 this->move(availableGeometry.x() + availableGeometry.width() - this->width(), screenMainRect.y() + availableGeometry.height() - this->height() - m - d); }else if(n == 1){ //任务栏在上侧 this->move(availableGeometry.x() + availableGeometry.width() - this->width(), screenMainRect.y() + screenGeometry.height() - availableGeometry.height() + m + d); } else if (n == 2){ //任务栏在左侧 this->move(m + d, screenMainRect.y() + screenMainRect.height() - this->height()); // if (screenGeometry.x() == 0){//主屏在左侧 // this->move(screenGeometry.width() - availableGeometry.width() + m + d, screenMainRect.y() + screenMainRect.height() - this->height()); // }else{//主屏在右侧 // this->move(screenGeometry.width() - availableGeometry.width() + m + d,screenDupRect.y() + screenDupRect.height() - this->height()); // } } else if (n == 3){ //任务栏在右侧 this->move(screenMainRect.width() - this->width() - m - d, screenMainRect.y() + screenMainRect.height() - this->height()); // if (screenGeometry.x() == 0){//主屏在左侧 // this->move(screenMainRect.width() + screenDupRect.width() - this->width() - m - d, screenDupRect.y() + screenDupRect.height() - this->height()); // }else{//主屏在右侧 // this->move(availableGeometry.x() + availableGeometry.width() - this->width() - m - d, screenMainRect.y() + screenMainRect.height() - this->height()); // } } } else if(screenGeometry.width() == availableGeometry.width() ){ if (trayIcon->geometry().y() > availableGeometry.height()/2){ //任务栏在下侧 this->move(availableGeometry.x() + availableGeometry.width() - this->width(), screenMainRect.y() + availableGeometry.height() - this->height() - d); }else{ //任务栏在上侧 this->move(availableGeometry.x() + availableGeometry.width() - this->width(), screenMainRect.y() + screenGeometry.height() - availableGeometry.height() + d); } } else if (screenGeometry.height() == availableGeometry.height()){ if (trayIcon->geometry().x() > availableGeometry.width()/2){ //任务栏在右侧 this->move(availableGeometry.x() + availableGeometry.width() - this->width() - d, screenMainRect.y() + screenGeometry.height() - this->height()); } else { //任务栏在左侧 this->move(screenGeometry.width() - availableGeometry.width() + d, screenMainRect.y() + screenGeometry.height() - this->height()); } } } void MainWindow::showTrayIconMenu() { QRect availableGeometry = qApp->primaryScreen()->availableGeometry(); QRect screenGeometry = qApp->primaryScreen()->geometry(); QDesktopWidget* desktopWidget = QApplication::desktop(); // QRect deskMainRect = desktopWidget->availableGeometry(0);//获取可用桌面大小 QRect screenMainRect = desktopWidget->screenGeometry(0);//获取设备屏幕大小 // QRect deskDupRect = desktopWidget->availableGeometry(1);//获取可用桌面大小 QRect screenDupRect = desktopWidget->screenGeometry(1);//获取设备屏幕大小 int n = objKyDBus->getTaskBarPos("position"); int m = objKyDBus->getTaskBarHeight("height"); int d = 2; //窗口边沿到任务栏距离 int s = 80; //窗口边沿到屏幕边沿距离 if (screenGeometry.width() == availableGeometry.width() && screenGeometry.height() == availableGeometry.height()){ if(n == 0){ //任务栏在下侧 trayIconMenu->move(availableGeometry.x() + availableGeometry.width() - trayIconMenu->width(), screenMainRect.y() + availableGeometry.height() - trayIconMenu->height() - m - d); }else if(n == 1){ //任务栏在上侧 trayIconMenu->move(availableGeometry.x() + availableGeometry.width() - trayIconMenu->width(), screenMainRect.y() + screenGeometry.height() - availableGeometry.height() + m + d); } else if (n == 2){ //任务栏在左侧 trayIconMenu->move(m + d, screenMainRect.y() + screenMainRect.height() - trayIconMenu->height() - s); // if (screenGeometry.x() == 0){//主屏在左侧 // trayIconMenu->move(screenGeometry.width() - availableGeometry.width() + m + d, screenMainRect.y() + screenMainRect.height() - trayIconMenu->height() - s); // }else{//主屏在右侧 // trayIconMenu->move(screenGeometry.width() - availableGeometry.width() + m + d,screenDupRect.y() + screenDupRect.height() - trayIconMenu->height() - s); // } } else if (n == 3){ //任务栏在右侧 trayIconMenu->move(screenMainRect.width() - trayIconMenu->width() - m - d, screenDupRect.y() + screenDupRect.height() - trayIconMenu->height() - s); // if (screenGeometry.x() == 0){//主屏在左侧 // trayIconMenu->move(screenMainRect.width() + screenDupRect.width() - trayIconMenu->width() - m - d, screenDupRect.y() + screenDupRect.height() - trayIconMenu->height() - s); // }else{//主屏在右侧 // trayIconMenu->move(availableGeometry.x() + availableGeometry.width() - trayIconMenu->width() - m - d, screenMainRect.y() + screenMainRect.height() - trayIconMenu->height() - s); // } } } else if(screenGeometry.width() == availableGeometry.width() ){ if (trayIcon->geometry().y() > availableGeometry.height()/2){ //任务栏在下侧 trayIconMenu->move(availableGeometry.x() + availableGeometry.width() - trayIconMenu->width(), screenMainRect.y() + availableGeometry.height() - trayIconMenu->height() - d); }else{ //任务栏在上侧 trayIconMenu->move(availableGeometry.x() + availableGeometry.width() - trayIconMenu->width(), 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, screenMainRect.y() + screenGeometry.height() - trayIconMenu->height() - s); } else { //任务栏在左侧 trayIconMenu->move(screenGeometry.width() - availableGeometry.width() + d, screenMainRect.y() + screenGeometry.height() - trayIconMenu->height() - s); } } } void MainWindow::on_showWindowAction() { handleIconClicked(); this->showNormal(); } void MainWindow::init_widget_action(QWidget *wid, QString iconstr, QString textstr) { QString style="QWidget{background:transparent;border:0px;border-radius: 4px;}\ QWidget:hover{background-color:#34bed8ef;}\ QWidget:pressed{background-color:#3abed8ef;}"; QHBoxLayout* layout=new QHBoxLayout(wid); wid->setLayout(layout); wid->setFixedSize(248, 36); wid->setStyleSheet(style); wid->setFocusPolicy(Qt::NoFocus); if(!iconstr.isEmpty()) { QLabel* labelicon=new QLabel(wid); labelicon->setFixedSize(16, 16); labelicon->move(10, 12); QPixmap *pixmap = new QPixmap(":/res/x/setup.png"); pixmap->scaled(labelicon->size(), Qt::KeepAspectRatio); labelicon->setScaledContents(true); labelicon->setPixmap(*pixmap); // QLabel* labelicon=new QLabel(wid); // QSvgRenderer* svg=new QSvgRenderer(wid); //#include // svg->load(iconstr); // QPixmap* pixmap=new QPixmap(22, 22); // pixmap->fill(Qt::transparent); // QPainter p(pixmap); // svg->render(&p); // labelicon->setPixmap(*pixmap); // labelicon->setFixedSize(pixmap->size()); // labelicon->move(10, 14); // labelicon->setAlignment(Qt::AlignCenter); // labelicon->setStyleSheet("QLabel{background:transparent;border:0px;}"); // labelicon->setStyleSheet("QLabel{background-image:url(:/res/x/setup.png);}"); // layout->addWidget(labelicon); } QLabel* labeltext=new QLabel(wid); labeltext->setStyleSheet("background:transparent;border:0px;color:rgba(255,255,255,0.91);font-size:14px;"); QByteArray textbyte=textstr.toLocal8Bit(); char* text=textbyte.data(); labeltext->setText(tr(text)); labeltext->adjustSize(); layout->addWidget(labeltext); iconstr = ""; //用QSvgRenderer的话这句要注释掉 if(!iconstr.isEmpty()) { layout->setContentsMargins(10,0,wid->width()-16-labeltext->width()-20,0); layout->setSpacing(5); } else { layout->setContentsMargins(36,0,0,0); } } /////////////////////////////////////////////////////////////////////////////// //加载动画,获取当前连接的网络和状态并设置图标 void MainWindow::startLoading() { loading->startLoading(); setTrayLoading(true); } void MainWindow::stopLoading() { loading->stopLoading(); setTrayLoading(false); getActiveInfo(); } void MainWindow::on_checkOverTime() { this->stopLoading(); //超时停止等待动画 } void MainWindow::getActiveInfo() { QString actLanName = "--"; QString actWifiName = "--"; activecon *act = kylin_network_get_activecon_info(); int index = 0; while(act[index].con_name != NULL){ if(QString(act[index].type) == "ethernet"){ actLanName = QString(act[index].con_name); } if(QString(act[index].type) == "wifi"){ actWifiName = QString(act[index].con_name); } index ++; } //ukui2.0中获取currentActWifiSignalLv的值 //QList wifiList = wifiListWidget->findChildren(); //for(int i = 0; i < wifiList.size(); i ++){ // OneConnForm *ocf = wifiList.at(i); // if(ocf->isActive == true){ // currentActWifiSignalLv = ocf->signalLv; // break; // } //} //ukui3.0中获取currentActWifiSignalLv的值 if(activeWifiSignalLv > 75){ currentActWifiSignalLv = 1; }else if(activeWifiSignalLv > 55 && activeWifiSignalLv <= 75){ currentActWifiSignalLv = 2; }else if(activeWifiSignalLv > 35 && activeWifiSignalLv <= 55){ currentActWifiSignalLv = 3; }else if( activeWifiSignalLv <= 35){ currentActWifiSignalLv = 4; } // 设置图标 if(actWifiName != "--"){ switch (currentActWifiSignalLv) { case 1: setTrayIcon(iconWifiFull); break; case 2: setTrayIcon(iconWifiHigh); break; case 3: setTrayIcon(iconWifiMedium); break; case 4: setTrayIcon(iconWifiLow); break; default: setTrayIcon(iconWifiFull); break; } }else{ if(actLanName != "--"){ setTrayIcon(iconLanOnline); }else{ setTrayIcon(iconLanOffline); } } } /////////////////////////////////////////////////////////////////////////////// //网络设备管理 //网线插拔处理,由kylin-dbus-interface.cpp调用 void MainWindow::onPhysicalCarrierChanged(bool flag) { is_stop_check_net_state = 1; this->startLoading(); if (flag){ syslog(LOG_DEBUG,"wired physical cable is already plug in"); wiredCableUpTimer->start(2000); } else{ syslog(LOG_DEBUG,"wired physical cable is already plug out"); wiredCableDownTimer->start(6000); } } void MainWindow::onCarrierUpHandle() { wiredCableUpTimer->stop(); BackThread *up_bt = new BackThread(); up_bt->disConnLanOrWifi("ethernet"); sleep(1); up_bt->disConnLanOrWifi("ethernet"); sleep(1); up_bt->disConnLanOrWifi("ethernet"); up_bt->deleteLater(); this->stopLoading(); onBtnNetListClicked(1); is_stop_check_net_state = 0; } void MainWindow::onCarrierDownHandle() { wiredCableDownTimer->stop(); this->stopLoading(); onBtnNetListClicked(0); is_stop_check_net_state = 0; } void MainWindow::onDeleteLan() { deleteLanTimer->stop(); BackThread *btn_bt = new BackThread(); btn_bt->disConnLanOrWifi("ethernet"); sleep(1); btn_bt->disConnLanOrWifi("ethernet"); sleep(1); btn_bt->disConnLanOrWifi("ethernet"); btn_bt->deleteLater(); this->stopLoading(); onBtnNetListClicked(0); is_stop_check_net_state = 0; } //无线网卡插拔处理 void MainWindow::onNetworkDeviceAdded(QDBusObjectPath objPath) { //仅处理无线网卡插入情况 objKyDBus->isWirelessCardOn = false; objKyDBus->getObjectPath(); if (objKyDBus->wirelessPath.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(0); } } } void MainWindow::onNetworkDeviceRemoved(QDBusObjectPath objPath) { //仅处理无线网卡拔出情况 if (objKyDBus->wirelessPath.path() == objPath.path()){ //证明移出的是无线网卡 syslog(LOG_DEBUG,"wireless device is already plug out"); qDebug()<<"wireless device is already plug out"; is_wireless_adapter_ready = 0; onBtnWifiClicked(0); } } void MainWindow::checkIsWirelessDeviceOn() { //启动时判断是否有无线网卡 // 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(); lname = iface->lname; mwBandWidth = bt->execChkLanWidth(lname); } //检测网络设备状态 bool MainWindow::checkLanOn() { BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); if(iface->lstate == 2){ return false; }else{ return true; } delete iface; bt->deleteLater(); } bool MainWindow::checkWlOn() { BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); if(iface->wstate == 2){ return false; }else{ return true; } delete iface; bt->deleteLater(); } /////////////////////////////////////////////////////////////////////////////// //有线网与无线网按钮响应 void MainWindow::on_btnNet_clicked() { 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; QThread *t = new QThread(); BackThread *bt = new BackThread(); bt->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()<<"the value of flag = "<setWifiSwitchState(false); lbTopWifiList->hide(); btnAddNet->hide(); QThread *t = new QThread(); BackThread *bt = new BackThread(); 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{ if (is_fly_mode_on == 0){ on_btnWifiList_clicked(); is_stop_check_net_state = 1; objKyDBus->setWifiCardState(true); objKyDBus->setWifiSwitchState(true); lbTopWifiList->show(); btnAddNet->show(); QThread *t = new QThread(); BackThread *bt = new BackThread(); 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(launchLanDone()), this, SLOT(launchLanDone())); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); this->startLoading(); } } } else if(flag == 1) { if (is_fly_mode_on == 0){ on_btnWifiList_clicked(); is_stop_check_net_state = 1; lbTopWifiList->show(); btnAddNet->show(); QThread *t = new QThread(); BackThread *bt = new BackThread(); 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(launchLanDone()), this, SLOT(launchLanDone())); connect(bt, SIGNAL(btFinish()), t, SLOT(quit())); t->start(); this->startLoading(); } } else if(flag == 2) { lbTopWifiList->hide(); btnAddNet->hide(); QThread *t = new QThread(); BackThread *bt = new BackThread(); 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("please insert the wireless network adapter")); //m_notify->execNotifySend(txt); //显示本应用自带的桌面通知 objKyDBus->showDesktopNotify(txt); //QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "' -t 3800"; //int status = system(cmd.toUtf8().data()); //if (status != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'onBtnWifiClicked' failed");} disWifiStateKeep(); } } void MainWindow::onBtnNetListClicked(int flag) { this->is_btnNetList_clicked = 1; this->is_btnWifiList_clicked = 0; ui->lbNetListBG->setStyleSheet(btnOnQss); ui->lbWifiListBG->setStyleSheet(btnOffQss); BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); lbLoadDown->show(); lbLoadUp->show(); lbLoadDownImg->show(); lbLoadUpImg->show(); if(iface->lstate != 0){ lbLoadDown->hide(); lbLoadUp->hide(); lbLoadDownImg->hide(); lbLoadUpImg->hide(); } lbNoItemTip->hide(); ui->lbNetwork->setText(tr("Ethernet")); ui->btnWifi->hide(); ui->lbBtnWifiBG->hide(); ui->lbBtnWifiBall->hide(); // 强行设置为打开 if(flag == 1){ this->startLoading(); this->ksnm->execGetLanList(); this->scrollAreal->show(); this->topLanListWidget->show(); this->scrollAreaw->hide(); this->topWifiListWidget->hide(); on_btnNetList_pressed(); return; } if(iface->lstate != 2){ this->startLoading(); this->ksnm->execGetLanList(); } else { this->startLoading(); this->ksnm->execGetLanList(); } this->scrollAreal->show(); this->topLanListWidget->show(); this->scrollAreaw->hide(); this->topWifiListWidget->hide(); on_btnNetList_pressed(); delete iface; bt->deleteLater(); } void MainWindow::on_btnWifiList_clicked() { this->is_btnWifiList_clicked = 1; this->is_btnNetList_clicked = 0; BackThread *bt = new BackThread(); IFace *iface = bt->execGetIface(); lbLoadDown->show(); lbLoadUp->show(); lbLoadDownImg->show(); lbLoadUpImg->show(); if(iface->wstate != 0){ lbLoadDown->hide(); lbLoadUp->hide(); lbLoadDownImg->hide(); lbLoadUpImg->hide(); } ui->lbNetListBG->setStyleSheet(btnOffQss); ui->lbWifiListBG->setStyleSheet(btnOnQss); lbNoItemTip->hide(); ui->lbNetwork->setText(tr("Wifi")); ui->btnWifi->show(); ui->lbBtnWifiBG->show(); ui->lbBtnWifiBall->show(); if(iface->wstate != 2){ lbTopWifiList->show(); btnAddNet->show(); this->startLoading(); this->ksnm->execGetWifiList(); }else{ 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->setName(tr("Not connected"));//"当前未连接任何 Wifi" ccf->setSignal("0", "--"); 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(); this->lanListWidget->hide(); this->wifiListWidget->show(); } this->scrollAreal->hide(); this->topLanListWidget->hide(); this->scrollAreaw->show(); this->topWifiListWidget->show(); on_btnWifiList_pressed(); delete iface; bt->deleteLater(); } void MainWindow::on_btnNetList_pressed() { // ui->btnNetList->setStyleSheet("#btnNetList{font-size:12px;color:white;border:1px solid rgba(255,255,255,0.1);border:1px solid rgba(255,255,255,0.5);background:transparent;background-color:rgba(255,255,255,0.1);}"); // ui->btnWifiList->setStyleSheet("#btnWifiList{font-size:12px;color:white;border:1px solid rgba(255,255,255,0.1);background:transparent;background-color:rgba(0,0,0,0.2);}" // "#btnWifiList:Pressed{border:1px solid rgba(255,255,255,0.5);background:transparent;background-color:rgba(255,255,255,0.1);}"); } void MainWindow::on_btnWifiList_pressed() { // ui->btnWifiList->setStyleSheet("#btnWifiList{font-size:12px;color:white;border:1px solid rgba(255,255,255,0.1);border:1px solid rgba(255,255,255,0.5);background:transparent;background-color:rgba(255,255,255,0.1);}"); // ui->btnNetList->setStyleSheet("#btnNetList{font-size:12px;color:white;border:1px solid rgba(255,255,255,0.1);background:transparent;background-color:rgba(0,0,0,0.2);}" // "#btnNetList:Pressed{border:1px solid rgba(255,255,255,0.5);background:transparent;background-color:rgba(255,255,255,0.1);}"); } /////////////////////////////////////////////////////////////////////////////// //网络列表加载与更新 // 获取lan列表回调 void MainWindow::getLanListDone(QStringList slist) { if (this->ksnm->isUseOldLanSlist){ slist = oldLanSlist; this->ksnm->isUseOldLanSlist = false; } 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 name QString actLanName = "--"; activecon *act = kylin_network_get_activecon_info(); int index = 0; while(act[index].con_name != NULL){ if(QString(act[index].type) == "ethernet"){ actLanName = QString(act[index].con_name); break; } index ++; } // 若当前lan name为"--",设置OneConnForm OneLancForm *ccf = new OneLancForm(topLanListWidget, this, confForm, ksnm); if(actLanName == "--"){ ccf->setName(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(); // 填充可用网络列表 QString headLine = slist.at(0); headLine = headLine.trimmed(); int indexDevice = headLine.indexOf("DEVICE"); int indexName = headLine.indexOf("NAME"); for(int i = 1, j = 0; i < slist.size(); i ++) { QString line = slist.at(i); QString ltype = line.mid(0, indexDevice).trimmed(); QString nname = line.mid(indexName).trimmed(); if(ltype != "wifi" && ltype != "" && ltype != "--"){ // 当前连接的lan objKyDBus->getLanIp(nname); if(nname == actLanName){ if (mwBandWidth == "Unknown!") { getLanBandWidth(); } connect(ccf, SIGNAL(selectedOneLanForm(QString)), this, SLOT(oneTopLanFormSelected(QString))); connect(ccf, SIGNAL(disconnActiveLan()), this, SLOT(activeLanDisconn())); ccf->setName(nname); ccf->setIcon(true); ccf->setLanInfo(objKyDBus->dbusLanIpv4, objKyDBus->dbusLanIpv6, mwBandWidth, objKyDBus->dbusLanMac); ccf->setConnedString(1, tr("Connected"));//"已连接" ccf->isConnected = true; ifLanConnected = true; lbLoadDown->show(); lbLoadUp->show(); lbLoadDownImg->show(); lbLoadUpImg->show(); ccf->setTopItem(false); currSelNetName = ""; syslog(LOG_DEBUG, "already insert an active lannet in the top of lan list"); }else{ lanListWidget->resize(W_LIST_WIDGET, lanListWidget->height() + H_NORMAL_ITEM); OneLancForm *ocf = new OneLancForm(lanListWidget, this, confForm, ksnm); connect(ocf, SIGNAL(selectedOneLanForm(QString)), this, SLOT(oneLanFormSelected(QString))); ocf->setName(nname); ocf->setIcon(true); ocf->setLine(true); ocf->setLanInfo(objKyDBus->dbusLanIpv4, objKyDBus->dbusLanIpv6, tr("Disconnected"), objKyDBus->dbusLanMac); ocf->setConnedString(0, tr("Disconnected"));//"未连接" ocf->move(L_VERTICAL_LINE_TO_ITEM, j * H_NORMAL_ITEM); ocf->show(); j ++; } } } QList itemList = lanListWidget->findChildren(); int n = itemList.size(); if (n >= 1){ OneLancForm *lastItem = itemList.at(n-1); lastItem->setLine(false); lbNoItemTip->hide(); } else { if (!ifLanConnected){ lbNoItemTip->hide(); lbTopLanList->hide(); btnCreateNet->hide(); } else{ lbNoItemTip->show(); lbNoItemTip->setText(tr("No Other Wired Network Scheme")); } } this->lanListWidget->show(); this->topLanListWidget->show(); this->wifiListWidget->hide(); this->topWifiListWidget->hide(); this->stopLoading(); oldLanSlist = slist; } // 获取wifi列表回调 void MainWindow::getWifiListDone(QStringList slist) { qDebug()<<"debug: oldWifiSlist.size()="<setName(tr("Not connected"));//"当前未连接任何 Wifi" ccf->setSignal("0", "--"); activeWifiSignalLv = 0; ccf->setConnedString(1, tr("Disconnected"), "");//"未连接" ccf->isConnected = false; ifWLanConnected = 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(); // 填充可用网络列表 QString headLine = slist.at(0); headLine = headLine.trimmed(); int indexRate = headLine.indexOf("RATE"); int indexSecu = headLine.indexOf("SECURITY"); int indexName = headLine.indexOf("SSID"); QStringList wnames; int count = 0; for(int i = 1, j = 0; i < slist.size(); i ++) { QString line = slist.at(i); QString wsignal = line.mid(0, indexRate).trimmed(); QString wrate = line.mid(indexRate, indexSecu - indexRate).trimmed(); QString wsecu = line.mid(indexSecu, indexName - indexSecu).trimmed(); QString wname = line.mid(indexName).trimmed(); bool isContinue = false; foreach (QString addName, wnames) { // 重复的网络名称,跳过不处理 if(addName == wname){ isContinue = true; } } if(isContinue){ continue; } if(wname != "" && wname != "--"){ // 当前连接的wifi if(wname == actWifiName){ connect(ccf, SIGNAL(selectedOneWifiForm(QString,int)), this, SLOT(oneTopWifiFormSelected(QString,int))); connect(ccf, SIGNAL(disconnActiveWifi()), this, SLOT(activeWifiDisconn())); ccf->setName(wname); ccf->setRate(wrate); ccf->setSignal(wsignal, wsecu); activeWifiSignalLv = wsignal.toInt(); //objKyDBus->getActWifiMac(wname); objKyDBus->getWifiMac(wname); ccf->setWifiInfo(wsecu, wsignal, objKyDBus->dbusWifiMac); ccf->setConnedString(1, tr("Connected"), wsecu);//"已连接" ccf->isConnected = true; ifWLanConnected = true; lbLoadDown->show(); lbLoadUp->show(); lbLoadDownImg->show(); lbLoadUpImg->show(); ccf->setTopItem(false); currSelNetName = ""; syslog(LOG_DEBUG, "already insert an active wifi in the top of wifi list"); }else{ wifiListWidget->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))); ocf->setName(wname); ocf->setRate(wrate); ocf->setLine(true); ocf->setSignal(wsignal, wsecu); objKyDBus->getWifiMac(wname); ocf->setWifiInfo(wsecu, wsignal, objKyDBus->dbusWifiMac); ocf->setConnedString(0, tr("Disconnected"), wsecu); ocf->move(L_VERTICAL_LINE_TO_ITEM, j * H_NORMAL_ITEM); ocf->setSelected(false, false); ocf->show(); j ++; count ++; } wnames.append(wname); } } QList itemList = wifiListWidget->findChildren(); int n = itemList.size(); if (n >= 1){ OneConnForm *lastItem = itemList.at(n-1); lastItem->setLine(false); lbNoItemTip->hide(); }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(); is_stop_check_net_state = 0; this->stopLoading(); } // 更新wifi列表 void MainWindow::updateWifiListDone(QStringList slist) { if (this->ksnm->isExecutingGetLanList){ return;} //获取表头信息 QString lastHeadLine = oldWifiSlist.at(0); lastHeadLine = lastHeadLine.trimmed(); int lastIndexName = lastHeadLine.indexOf("SSID"); QString headLine = slist.at(0); headLine = headLine.trimmed(); int indexRate = headLine.indexOf("RATE"); int indexSecu = headLine.indexOf("SECURITY"); int indexName = headLine.indexOf("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 { 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 {after_ocf->move(L_VERTICAL_LINE_TO_ITEM, after_ocf->y() - H_NORMAL_ITEM);} } wifiListWidget->resize(W_LIST_WIDGET, wifiListWidget->height() - H_NORMAL_ITEM); break; } } } } //end if (j == slist.size()-1) } //end (int j=1; j wifiList = wifiListWidget->findChildren(); int n = wifiList.size(); int posY = 0; if (n >= 1){ OneConnForm *lastOcf = wifiList.at(n-1); lastOcf->setLine(true); posY = lastOcf->y()+H_NORMAL_ITEM; } wifiListWidget->resize(W_LIST_WIDGET, wifiListWidget->height() + H_NORMAL_ITEM); OneConnForm *addItem = new OneConnForm(wifiListWidget, this, confForm, ksnm); connect(addItem, SIGNAL(selectedOneWifiForm(QString,int)), this, SLOT(oneWifiFormSelected(QString,int))); addItem->setName(wname); addItem->setRate(wrate); addItem->setLine(false); addItem->setSignal(wsignal, wsecu); objKyDBus->getWifiMac(wname); addItem->setWifiInfo(wsecu, wsignal, objKyDBus->dbusWifiMac); addItem->setConnedString(0, tr("Disconnected"), wsecu);//"未连接" addItem->move(L_VERTICAL_LINE_TO_ITEM, posY); addItem->setSelected(false, false); addItem->show(); count += 1; } } } this->lanListWidget->hide(); this->topLanListWidget->hide(); this->wifiListWidget->show(); this->topWifiListWidget->show(); this->stopLoading(); } /////////////////////////////////////////////////////////////////////////////// //主窗口其他按钮点击响应 void MainWindow::on_btnAdvConf_clicked() { QProcess *qprocess = new QProcess(this); qprocess->start("nm-connection-editor &"); // int status = system("nm-connection-editor &"); // if (status != 0){ syslog(LOG_ERR, "execute 'nm-connection-editor &' in function 'on_btnAdvConf_clicked' failed");} } void MainWindow::on_btnAdvConf_pressed() { ui->lbBtnConfBG->setStyleSheet(btnOnQss); } void MainWindow::on_btnAdvConf_released() { ui->lbBtnConfBG->setStyleSheet(btnOffQss); } void MainWindow::on_btnFlyMode_clicked() { if(is_fly_mode_on == 0){ ui->lbFlyImg->setStyleSheet("QLabel{background-image:url(:/res/x/fly-mode-on.svg);}"); ui->lbFlyBG->setStyleSheet(btnOnQss); is_fly_mode_on = 1; onBtnWifiClicked(0); on_btnWifiList_clicked(); } else { ui->lbFlyImg->setStyleSheet("QLabel{background-image:url(:/res/x/fly-mode-off.svg);}"); ui->lbFlyBG->setStyleSheet(btnOffQss); 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); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0, this); connect(connHidWifi, SIGNAL(reSetWifiList() ), this, SLOT(on_btnWifiList_clicked()) ); connHidWifi->show(); } void MainWindow::onBtnCreateNetClicked() { ConfForm *m_cf = new ConfForm(); m_cf->cbTypeChanged(3); m_cf->show(); } /////////////////////////////////////////////////////////////////////////////// //处理窗口变化、网络状态变化 //列表中item的扩展与收缩 void MainWindow::oneLanFormSelected(QString lanName) { 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 == lanName){ // 缩小所有选项卡 for(int i = 0;i < lanList.size(); i ++){ OneLancForm *ocf = lanList.at(i); if(ocf->lanName == lanName){ 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->lanName == lanName){ 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->lanName == lanName){ ocf->setSelected(true, false); selectY = ocf->y(); }else{ ocf->setSelected(false, false); } } currSelNetName = lanName; } QList itemList = lanListWidget->findChildren(); int n = itemList.size(); if(n >= 1){ OneLancForm *lastItem = itemList.at(n-1); lastItem->setLine(false); } //**********************处理上方列表-界面所有控件回原位********************// topLanListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM + H_GAP_UP + X_ITEM); // 顶部的item缩小 lbTopLanList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_GAP_UP); btnCreateNet->move(X_BTN_FUN, Y_BTN_FUN); scrollAreal->move(W_LEFT_AREA, Y_SCROLL_AREA); lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2); OneLancForm *ocf = topLanList.at(0); ocf->setTopItem(false); } void MainWindow::oneTopLanFormSelected(QString lanName) { QList topLanList = topLanListWidget->findChildren(); QList lanList = lanListWidget->findChildren(); if (currSelNetName == lanName){ // 与上一次选中同一个网络框,缩小当前选项卡 topLanListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM + H_GAP_UP + X_ITEM); lbTopLanList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_GAP_UP); btnCreateNet->move(X_BTN_FUN, Y_BTN_FUN); scrollAreal->move(W_LEFT_AREA, Y_SCROLL_AREA); lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2); OneLancForm *ocf = topLanList.at(0); 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); } topLanListWidget->resize(W_TOP_LIST_WIDGET, H_NORMAL_ITEM + H_LAN_ITEM_EXTEND + H_GAP_UP + X_ITEM); lbTopLanList->move(X_MIDDLE_WORD, H_NORMAL_ITEM + H_LAN_ITEM_EXTEND + H_GAP_UP); btnCreateNet->move(X_BTN_FUN, Y_BTN_FUN + H_LAN_ITEM_EXTEND); scrollAreal->move(W_LEFT_AREA, Y_SCROLL_AREA + H_LAN_ITEM_EXTEND); lbNoItemTip->move(this->width()/2 - W_NO_ITEM_TIP/2 + W_LEFT_AREA/2, this->height()/2 + 80); OneLancForm *ocf = topLanList.at(0); ocf->setTopItem(true); currSelNetName = lanName; } } void MainWindow::oneWifiFormSelected(QString wifiName, int extendLength) { 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 == wifiName){ // 缩小所有选项卡 for(int i = 0;i < wifiList.size(); i ++){ OneConnForm *ocf = wifiList.at(i); if(ocf->wifiName == wifiName){ if (ocf->wifiName == hideWiFiConn){ ocf->setHideItem(true, true); }else{ ocf->setSelected(false, true); } } else{ if (ocf->wifiName == 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->wifiName == wifiName){ selectY = ocf->y(); //获取选中item的y坐标 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->wifiName == wifiName){ if (ocf->wifiName == hideWiFiConn){ ocf->setHideItem(true, true); }else{ ocf->setSelected(true, false); } }else{ if (ocf->wifiName == hideWiFiConn){ ocf->setHideItem(true, true); }else{ ocf->setSelected(false, false); } } } currSelNetName = wifiName; } //最后一个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 wifiName, int extendLength) { QListtopWifiList = topWifiListWidget->findChildren(); QList wifiList = wifiListWidget->findChildren(); if (currSelNetName == wifiName){ // 与上一次选中同一个网络框,缩小当前选项卡 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 = wifiName; } } //断开网络处理 void MainWindow::activeLanDisconn() { syslog(LOG_DEBUG, "Wired net is disconnected"); QString txt(tr("Wired net is disconnected")); //m_notify->execNotifySend(txt); objKyDBus->showDesktopNotify(txt); //QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "...' -t 3800"; //int status1 = system(cmd.toUtf8().data()); //if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'execConnWifiPWD' failed");} currSelNetName = ""; //this->startLoading(); emit this->waitLanStop(); this->ksnm->execGetLanList(); } void MainWindow::activeWifiDisconn() { QThread *tt = new QThread(); BackThread *btt = new BackThread(); btt->moveToThread(tt); connect(tt, SIGNAL(finished()), tt, SLOT(deleteLater())); connect(tt, SIGNAL(started()), this, SLOT(activeStartLoading())); connect(this, SIGNAL(disConnSparedNet(QString)), btt, SLOT(disConnSparedNetSlot(QString))); connect(btt, SIGNAL(disFinish()), this, SLOT(activeGetWifiList())); connect(btt, SIGNAL(ttFinish()), tt, SLOT(quit())); tt->start(); } void MainWindow::activeStartLoading() { syslog(LOG_DEBUG, "Wi-Fi is disconnected"); QString txt(tr("Wi-Fi is disconnected")); //m_notify->execNotifySend(txt); objKyDBus->showDesktopNotify(txt); //QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "...' -t 3800"; //int status1 = system(cmd.toUtf8().data()); //if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'execConnWifiPWD' failed");} currSelNetName = ""; //this->startLoading(); emit this->disConnSparedNet("wifi"); } void MainWindow::activeGetWifiList() { emit this->waitWifiStop(); this->ksnm->execGetWifiList(); } //网络开关处理,打开与关闭网络 void MainWindow::enNetDone() { BackThread *bt = new BackThread(); mwBandWidth = bt->execChkLanWidth(lname); ui->lbBtnNetBG->setStyleSheet(btnOnQss); // 打开网络开关时如果Wifi开关是打开的,设置其样式 if(checkWlOn()){ ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss); ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL); } onBtnNetListClicked(1); is_stop_check_net_state = 0; qDebug()<<"debug: already turn on the switch of lan network"; syslog(LOG_DEBUG, "Already turn on the switch of lan network"); } void MainWindow::disNetDone() { this->is_btnNetList_clicked = 1; this->is_btnWifiList_clicked = 0; ui->lbNetListBG->setStyleSheet(btnOnQss); ui->lbWifiListBG->setStyleSheet(btnOffQss); ui->lbNetwork->setText("有线网络"); ui->btnWifi->hide(); ui->lbBtnWifiBG->hide(); ui->lbBtnWifiBall->hide(); 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->setName(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(); ui->lbBtnNetBG->setStyleSheet(btnOffQss); ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss); ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL); this->lanListWidget->show(); this->wifiListWidget->hide(); this->scrollAreal->show(); this->topLanListWidget->show(); this->scrollAreaw->hide(); this->topWifiListWidget->hide(); on_btnNetList_pressed(); 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::launchLanDone() { ui->lbBtnNetBG->setStyleSheet(btnOnQss); } void MainWindow::enWifiDone() { ui->lbBtnWifiBG->setStyleSheet(btnBgOnQss); ui->lbBtnWifiBall->move(X_RIGHT_WIFI_BALL, Y_WIFI_BALL); is_update_wifi_list = 0; this->ksnm->execGetWifiList(); qDebug()<<"debug: already turn on the switch of wifi network"; syslog(LOG_DEBUG, "Already turn on the switch of wifi network"); } void MainWindow::disWifiDone() { disWifiDoneChangeUI(); on_btnWifiList_pressed(); qDebug()<<"debug: already turn off the switch of wifi network"; syslog(LOG_DEBUG, "Already turn off the switch of wifi network"); this->stopLoading(); } void MainWindow::disWifiStateKeep() { if(this->is_btnNetList_clicked == 1) { ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss); ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL); } if(this->is_btnWifiList_clicked== 1) { disWifiDoneChangeUI(); // this->stopLoading(); getActiveInfo(); } } 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->setName(tr("Not connected"));//"当前未连接任何 Wifi" ocf->setSignal("0", "--"); ocf->setConnedString(1, tr("Disconnected"), "");//"未连接" 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(); } } ui->lbBtnWifiBG->setStyleSheet(btnBgOffQss); ui->lbBtnWifiBall->move(X_LEFT_WIFI_BALL, Y_WIFI_BALL); 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; } /////////////////////////////////////////////////////////////////////////////// //循环处理部分,目前仅on_checkWifiListChanged 与on_setNetSpeed两个函数在运行 void MainWindow::on_checkWifiListChanged() { 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){ is_update_wifi_list = 1; this->ksnm->execGetWifiList(); //更新wifi列表 } delete loop_iface; loop_bt->deleteLater(); } } 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_btnNetList_clicked == 1){ if ( objNetSpeed->getCurrentDownloadRates(objKyDBus->dbusLanCardName.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)/800; long int delta_tx = (start_tx_rates - end_tx_rates)/8; if (delta_rcv>=10000 || delta_rcv<0){delta_rcv = 0;} if (delta_tx>=10000 || delta_tx<0){delta_tx = 0;} int rcv_num = delta_rcv/3; int tx_num = delta_tx/3; QString str_rcv; QString str_tx; if (rcv_num < 1000){ str_rcv = QString::number(rcv_num) + "KB/s."; } else { int remainder; if (rcv_num%1000 < 100) { remainder = 0; }else{ remainder = (rcv_num%1000)/100; } str_rcv = QString::number(rcv_num/1000) + "." + QString::number(remainder) + "MB/s."; } if (tx_num < 1000){ str_tx = QString::number(tx_num) + "KB/s"; } else { int remainder; if (tx_num%1000 < 100) { remainder = 0; }else{ remainder = (tx_num%1000)/100; } str_tx = QString::number(tx_num/1000) + "." + QString::number(remainder) + "MB/s"; } lbLoadDown->setText(str_rcv); lbLoadUp->setText(str_tx); switch (str_rcv.size()) { case 6: lbLoadUp->move(X_ITEM + 187, Y_TOP_ITEM + 32); lbLoadUpImg->move(X_ITEM + 170, Y_TOP_ITEM + 35); break; case 7: lbLoadUp->move(X_ITEM + 194, Y_TOP_ITEM + 32); lbLoadUpImg->move(X_ITEM + 176, Y_TOP_ITEM + 35); break; case 8: lbLoadUp->move(X_ITEM + 199, Y_TOP_ITEM + 32); lbLoadUpImg->move(X_ITEM + 186, Y_TOP_ITEM + 35); break; default: break; } end_rcv_rates = start_rcv_rates; end_tx_rates = start_tx_rates; } } void MainWindow::connLanDone(int connFlag) { emit this->waitLanStop(); //停止加载动画 // Lan连接结果,0点击连接成功 1失败 3开机启动网络工具时已经连接 if(connFlag == 0){ syslog(LOG_DEBUG, "Wired net already connected by clicking button"); //syslog(LOG_DEBUG, "Wired net already connected by clicking button, will check if Lan disconnected again circularly"); //qDebug()<<"连接状态:有线网络已经点击连接,即将重新检测 Lan 是否断开"; this->is_wired_line_ready = 1; this->is_by_click_connect = 1; this->ksnm->execGetLanList(); QString txt(tr("Conn Ethernet Success")); //m_notify->execNotifySend(txt); objKyDBus->showDesktopNotify(txt); //QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "' -t 3800"; //int status = system(cmd.toUtf8().data()); //if (status != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'connLanDone' failed");} //changeTimerState(); //checkIfLanConnect->start(8000); } if(connFlag == 1){ qDebug()<<"without net line connect to computer"; this->is_wired_line_ready = 0; //without net line connect to computer QString txt(tr("Conn Ethernet Fail")); //m_notify->execNotifySend(txt); objKyDBus->showDesktopNotify(txt); //QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "' -t 3800"; //int status = system(cmd.toUtf8().data()); //if (status != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'connLanDone' failed");} } if(connFlag == 3){ syslog(LOG_DEBUG, "Launch kylin-nm, Lan already connected"); //syslog(LOG_DEBUG, "Launch kylin-nm, Lan already connected, will check if Lan disconnected circularly"); //qDebug()<<"连接状态:启动kylin-nm,Lan已经开启,即将循环检测是否断开"; this->is_wired_line_ready = 1; //changeTimerState(); //checkIfLanConnect->start(8000); } this->stopLoading(); } void MainWindow::on_isLanConnect() { BackThread *loop_bt = new BackThread(); IFace *loop_iface = loop_bt->execGetIface(); if (is_stop_check_net_state == 0){ if (loop_iface->lstate == 1){ syslog(LOG_DEBUG, "Wired net is disconnected"); qDebug()<<"连接状态:有线网络连接已经断开"; if(this->is_btnNetList_clicked == 1) { this->ksnm->execGetLanList(); } if(this->is_btnWifiList_clicked== 1) { this->ksnm->execGetWifiList(); } this->is_by_click_connect = 0; checkIfLanConnect->stop(); if (loop_iface->wstate != 0){ syslog(LOG_DEBUG, "Will check if LAN or Wi-Fi connected again circularly"); qDebug()<<"连接状态:即将循环检测是否重新连接 Lan或Wifi"; //changeTimerState(); //checkIfNetworkOn->start(8000); } } else if (loop_iface->wstate != 2) { count_loop = 1; if (count_loop==1 && this->is_btnWifiList_clicked == 1){ if (this->isVisible() ){ is_update_wifi_list = 1; this->ksnm->execGetWifiList(); //更新wifi列表 } } if (count_loop >= 2){ count_loop = 1;} } } delete loop_iface; delete loop_bt; } void MainWindow::on_isNetOn() { BackThread *loop_bt = new BackThread(); IFace *loop_iface = loop_bt->execGetIface(); if (is_stop_check_net_state == 0){ if (loop_iface->lstate == 0 && this->is_by_click_connect == 0 && this->is_wired_line_ready == 1){ syslog(LOG_DEBUG, "Lan already connected again, will check if Wi-Fi disconnected circularly"); qDebug()<<"连接状态:有线网络已经重新连接,即将循环检测 Lan 是否断开"; if(this->is_btnNetList_clicked == 1) { this->ksnm->execGetLanList(); } if(this->is_btnWifiList_clicked== 1) { this->ksnm->execGetWifiList(); } checkIfNetworkOn->stop(); //changeTimerState(); //checkIfLanConnect->start(8000); } else if (loop_iface->lstate == 0 && this->is_by_click_connect == 1){ qDebug()<<"连接状态:有线网络已经点击连接,即将重新循环检测 Lan 是否断开"; checkIfNetworkOn->stop(); } else if (loop_iface->wstate == 0 && this->is_by_click_connect == 0){ syslog(LOG_DEBUG, "Wi-Fi already connected again, will check if Wi-Fi disconnected circularly"); qDebug()<<"连接状态:Wifi网络已经重新连接,即将循环检测 Wifi 是否断开"; if(this->is_btnNetList_clicked == 1) { this->ksnm->execGetLanList(); } if(this->is_btnWifiList_clicked== 1) { this->ksnm->execGetWifiList(); } checkIfNetworkOn->stop(); //changeTimerState(); //checkIfWifiConnect->start(8000); } else if (loop_iface->wstate == 0 && this->is_by_click_connect == 1){ qDebug()<<"连接状态:Wifi网络已经点击连接,即将重新循环检测 Wifi 是否断开"; checkIfNetworkOn->stop(); } else if (loop_iface->wstate != 2) { count_loop = 1; if (count_loop==1 && this->is_btnWifiList_clicked == 1){ if (this->isVisible() ){ is_update_wifi_list = 1; this->ksnm->execGetWifiList(); //更新wifi列表 } } if (count_loop >= 2){ count_loop = 1;} } } delete loop_iface; delete loop_bt; } void MainWindow::connWifiDone(int connFlag) { // Wifi连接结果,0点击连接成功 1失败 2没有配置文件 3开机启动网络工具时已经连接 if(connFlag == 0){ syslog(LOG_DEBUG, "Wi-Fi already connected by clicking button"); //syslog(LOG_DEBUG, "Wi-Fi already connected by clicking button, will check if Wi-Fi disconnected again circularly"); //qDebug()<<"连接状态:Wifi网络已经点击连接,即将重新循环检测 Wifi 是否断开"; this->is_by_click_connect = 1; this->ksnm->execGetWifiList(); QString txt(tr("Conn Wifi Success")); //m_notify->execNotifySend(txt); objKyDBus->showDesktopNotify(txt); //QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "' -t 3800"; //int status = system(cmd.toUtf8().data()); //if (status != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'connWifiDone' failed");} //changeTimerState(); //checkIfWifiConnect->start(8000); } else if (connFlag == 1) { is_stop_check_net_state = 0; QString txt(tr("Confirm your Wi-Fi password or usable of wireless card")); //m_notify->execNotifySend(txt); objKyDBus->showDesktopNotify(txt); //QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "...' -t 3800"; //int status1 = system(cmd.toUtf8().data()); //if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'execConnWifiPWD' failed");} } else if (connFlag == 3) { syslog(LOG_DEBUG, "Launch kylin-nm, Wi-Fi already connected"); //syslog(LOG_DEBUG, "Launch kylin-nm, Wi-Fi already connected, will check if Wi-Fi disconnected circularly"); //qDebug()<<"连接状态:启动kylin-nm, Wifi已经连接,即将循环检测是否断开"; //changeTimerState(); //checkIfWifiConnect->start(8000); } } void MainWindow::on_isWifiConnect() { BackThread *loop_bt = new BackThread(); IFace *loop_iface = loop_bt->execGetIface(); if (is_stop_check_net_state == 0){ if (loop_iface->wstate == 1){ syslog(LOG_DEBUG, "Wi-Fi is disconnected"); qDebug()<<"连接状态:Wifi 网络连接已经断开"; if(this->is_btnNetList_clicked == 1) { this->ksnm->execGetLanList(); } if(this->is_btnWifiList_clicked== 1) { this->ksnm->execGetWifiList(); } this->is_by_click_connect = 0; checkIfWifiConnect->stop(); if (loop_iface->lstate != 0){ syslog(LOG_DEBUG, "Will check if LAN or Wi-Fi connected again circularly"); qDebug()<<"连接状态:即将循环检测是否重新开启 Lan或Wifi"; //changeTimerState(); //checkIfNetworkOn->start(8000); } } else if (loop_iface->wstate != 2){ count_loop = 1; if (count_loop==1 && this->is_btnWifiList_clicked == 1){ if (this->isVisible() ){ is_update_wifi_list = 1; this->ksnm->execGetWifiList(); //更新wifi列表 } } if (count_loop >= 2){ count_loop = 1;} } } delete loop_iface; delete loop_bt; } kylin-nm/src/oneconnform.h0000644000175000017500000000661613645621273014541 0ustar fengfeng/* * Copyright (C) 2019 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 "confform.h" #include "backthread.h" #include "ksimplenm.h" #include "notifysend.h" #define FRAME_SPEED 150 #define LIMIT_TIME 30*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 0 #define Y_LINE_SMALL_EXTEND 105 #define X_LINE_SMALL_EXTEND 0 #define Y_LINE_BIG_EXTEND 137 #define X_LINE_BIG_EXTEND 0 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(); void setSignal(QString lv, QString secu); void setName(QString name); void setSpecialName(QString name); QString getName(); void setRate(QString rate); void setLine(bool isShow); void setWifiInfo(QString str1, QString str2, QString str3); 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(); NotifySend *m_notify = nullptr; QString wifiName; bool isSelected; bool isActive; bool isConnected; bool isTopItem; int signalLv; signals: void selectedOneWifiForm(QString wifiName, int extendLength); void connDone(int connFlag); void disconnActiveWifi(); void sigConnWifi(QString); void sigConnWifiPWD(QString, QString); protected: void mousePressEvent(QMouseEvent *event); bool eventFilter(QObject *obj, QEvent *event); private slots: void on_btnConn_clicked(); void on_btnDisConn_clicked(); void slotConnWifi(); void slotConnWifiPWD(); void slotConnWifiResult(int connFlag); void on_btnConnPWD_clicked(); void on_btnHideConn_clicked(); void on_checkBoxPwd_stateChanged(int arg1); void on_lePassword_textEdited(const QString &arg1); void on_btnConnSub_clicked(); void waitAnimStep(); void startWaiting(bool isConn); void stopWaiting(); void on_btnInfo_clicked(); private: QTimer *waitTimer = nullptr; int waitPage; int countCurrentTime; bool isWaiting = false; Ui::OneConnForm *ui = nullptr; MainWindow *mw = nullptr; ConfForm *cf = nullptr; KSimpleNM *ks = nullptr; bool hasPwd; }; #endif // ONECONNFORM_H kylin-nm/src/oneconnform.cpp0000644000175000017500000006032613645621273015072 0ustar fengfeng/* * Copyright (C) 2019 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); 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->lePassword->setText(tr("Input Password..."));//"输入密码..." ui->lbConned->setAlignment(Qt::AlignLeft); ui->lePassword->setEchoMode(QLineEdit::Normal); ui->btnConnPWD->setEnabled(false); ui->lbInfo->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);line-height:24px;}"); ui->btnInfo->setStyleSheet("QPushButton{border:none;background:transparent;}"); ui->wbg->setStyleSheet("#wbg{border-radius:4px;background-color:rgba(255,255,255,0);}"); ui->wbg_2->setStyleSheet("#wbg_2{border-radius:4px;background-color:rgba(255,255,255,0.1);}"); ui->wbg_3->setStyleSheet("#wbg_3{border-radius:4px;background-color:rgba(255,255,255,0.1);}"); ui->lbName->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.91);}"); ui->lbConned->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);}"); ui->lePassword->setStyleSheet("QLineEdit{border:1px solid rgba(61,107,229,1);border-radius:4px;" "background:rgba(0,0,0,0.2);color:rgba(255,255,255,0.35);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(255,255,255,0.2);}" "QPushButton:Pressed{border-radius:4px;background-color:rgba(255,255,255,0.08);}"); 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->lbInfo->hide(); ui->lePassword->hide(); ui->checkBoxPwd->hide(); ui->checkBoxPwd->setChecked(true); ui->btnConnSub->hide(); ui->btnConn->hide(); ui->btnDisConn->hide(); ui->btnConnPWD->hide(); ui->btnHideConn->hide(); ui->line->show(); ui->lbWaiting->hide(); ui->lbWaitingIcon->hide(); ui->btnInfo->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->lePassword->setAttribute(Qt::WA_Hover,true); ui->lePassword->installEventFilter(this); ui->btnInfo->setAttribute(Qt::WA_Hover,true); ui->btnInfo->installEventFilter(this); //m_notify = new NotifySend(); connect(ui->lePassword, SIGNAL(returnPressed()), this, SLOT(on_btnConnPWD_clicked())); ui->btnConn->setShortcut(Qt::Key_Return);//将字母区回车键与登录按钮绑定在一起 this->waitTimer = new QTimer(this); connect(waitTimer, SIGNAL(timeout()), this, SLOT(waitAnimStep())); connect(mw, SIGNAL(waitWifiStop()), this, SLOT(stopWaiting())); } OneConnForm::~OneConnForm() { m_notify->deleteLater(); delete ui; } void OneConnForm::mousePressEvent(QMouseEvent *){ emit selectedOneWifiForm(wifiName, H_WIFI_ITEM_BIG_EXTEND); } //事件过滤器 bool OneConnForm::eventFilter(QObject *obj, QEvent *event) { if (obj == ui->btnInfo){ if(event->type() == QEvent::HoverEnter) { ui->lbInfo->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.91);line-height:24px;}"); return true; } else if(event->type() == QEvent::HoverLeave){ ui->lbInfo->setStyleSheet("QLabel{font-size:14px;color:rgba(255,255,255,0.57);line-height:24px;}"); 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(255,255,255,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(255,255,255,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->lbName->setStyleSheet("QLabel{font-size:14px;color:#ffffff;}"); ui->lbConned->show(); }else{ ui->lbName->setStyleSheet("QLabel{font-size:14px;color:#ffffff;}"); ui->lbConned->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->lbInfo->show(); this->isSelected = true; }else{ resize(W_ITEM, H_ITEM); ui->lePassword->setText(""); ui->wbg_3->hide(); ui->lbInfo->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->lbInfo->show(); ui->btnConn->hide(); ui->btnConnSub->show(); this->isSelected = true; }else{ resize(W_ITEM, H_ITEM); ui->lePassword->setText(tr("Input Password..."));//"输入密码..." ui->lePassword->setStyleSheet("QLineEdit{border:1px solid rgba(61,107,229,1);border-radius:4px;" "background:rgba(0,0,0,0.2);color:rgba(255,255,255,0.35);font-size:14px;}"); ui->lePassword->setEchoMode(QLineEdit::Normal); ui->checkBoxPwd->setChecked(true); ui->line->move(X_LINE, Y_LINE); ui->wbg->show(); ui->wbg_2->hide(); ui->wbg_3->hide(); ui->lbInfo->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::setName(QString name){ ui->lbName->setText(name); wifiName = name; } void OneConnForm::setSpecialName(QString name) { ui->lbName->setText(tr("Connect to Hidden Wi-Fi Network")); //连接到隐藏的 Wi-Fi 网络 wifiName = name; } QString OneConnForm::getName() { return ui->lbName->text(); } 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){ int signal = lv.toInt(); if (secu == "--" || secu == ""){ hasPwd = false; }else{ hasPwd = true; } if(signal > 75){ if(hasPwd){ ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-full-pwd.png);}"); }else{ ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-full.png);}"); } signalLv = 1; } if(signal > 55 && signal <= 75){ if(hasPwd){ ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-high-pwd.png);}"); }else{ ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-high.png);}"); } signalLv = 2; } if(signal > 35 && signal <= 55){ if(hasPwd){ ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-medium-pwd.png);}"); }else{ ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-medium.png);}"); } signalLv = 3; } if(signal > 15 && signal <= 35){ if(hasPwd){ ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-low-pwd.png);}"); }else{ ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-low.png);}"); } signalLv = 4; } if(signal <= 15){ if(hasPwd){ ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-none-pwd.png);}"); }else{ ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-none.png);}"); } signalLv = 4; } } void OneConnForm::setWifiInfo(QString str1, QString str2, QString str3) { if (str1 == "--" || str1 == ""){ str1 = tr("None"); }; QString str = "Wi-Fi安全性:" + str1 + "\n信号强度:" + str2 + "%\n物理地址(MAC):" + str3; ui->lbInfo->setText(str); } void OneConnForm::slotConnWifi() { // mw->startLoading(); this->startWaiting(true); emit sigConnWifi(ui->lbName->text()); } void OneConnForm::slotConnWifiPWD(){ // mw->startLoading(); this->startWaiting(true); emit sigConnWifiPWD(ui->lbName->text(), ui->lePassword->text()); } //点击后断开wifi网络 void OneConnForm::on_btnDisConn_clicked() { syslog(LOG_DEBUG, "DisConnect button about wifi net is clicked, current wifi name is %s .", ui->lbName->text().toUtf8().data()); qDebug()<<"DisConnect button about wifi net is clicked, current wifi name is "<lbName->text(); this->startWaiting(false); mw->is_stop_check_net_state = 1; mw->on_btnHotspotState(); kylin_network_set_con_down(ui->lbName->text().toUtf8().data()); disconnect(this, SIGNAL(selectedOneWifiForm(QString,int)), mw, SLOT(oneWifiFormSelected(QString,int))); emit disconnActiveWifi(); } //点击列表item扩展时会出现该按钮 用于连接网络 void OneConnForm::on_btnConnSub_clicked() { syslog(LOG_DEBUG, "A button named on_btnConnSub about wifi net is clicked."); qDebug()<<"A button named on_btnConnSub about wifi net is clicked."; if (ui->lbConned->text() == "--" || ui->lbConned->text() == " "){ on_btnConnPWD_clicked(); return; } mw->is_stop_check_net_state = 1; 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)), bt, SLOT(execConnWifi(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_btnConn_clicked() { syslog(LOG_DEBUG, "A button named btnConn about wifi net is clicked."); qDebug()<<"A button named btnConn about wifi net is clicked."; if (ui->lbConned->text() == "--" || ui->lbConned->text() == " "){ on_btnConnPWD_clicked(); return; } mw->is_stop_check_net_state = 1; 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)), bt, SLOT(execConnWifi(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_btnConnPWD_clicked() { syslog(LOG_DEBUG, "A button named btnConnPWD about wifi net is clicked."); qDebug()<<"A button named btnConnPWD about wifi net is clicked."; mw->is_stop_check_net_state = 1; 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)), bt, SLOT(execConnWifiPWD(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); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0, mw); connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); connHidWifi->show(); } //设置密码隐藏或可见 void OneConnForm::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword ->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } 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);color:rgba(255,255,255,0.91);font-size:14px;}"); if (ui->lePassword->text().size() < 5){ 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); 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);color:rgba(255,255,255,0.35);font-size:14px;}"); } } 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);}"); 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(ui->lbName->text()); QStringList propList = connProp.split("|"); QString v4method, addr, mask, gateway, dns; foreach (QString line, propList) { if(line.startsWith("method:")){ v4method = line.split(":").at(1); } if(line.startsWith("addr:")){ addr = line.split(":").at(1); } if(line.startsWith("mask:")){ mask = line.split(":").at(1); } if(line.startsWith("gateway:")){ gateway= line.split(":").at(1); } if(line.startsWith("dns:")){ dns = line.split(":").at(1); } } // qDebug()<setProp(ui->lbName->text(), v4method, addr, mask, gateway, dns, this->isActive); //cf->move(primaryGeometry.width() / 2 - cf->width() / 2, primaryGeometry.height() / 2 - cf->height() / 2); cf->show(); cf->raise(); } // Wifi连接结果,0成功 1失败 2没有配置文件 void OneConnForm::slotConnWifiResult(int connFlag){ qDebug()<<"Function slotConnWifiResult receives a number: "<currSelNetName = ""; emit selectedOneWifiForm(ui->lbName->text(), H_WIFI_ITEM_SMALL_EXTEND); resize(W_ITEM, H_ITEM_MIDDLE); ui->wbg->hide(); ui->wbg_2->show(); ui->wbg_3->hide(); ui->lbInfo->hide(); ui->btnHideConn->hide(); ui->btnDisConn->hide(); ui->btnConn->hide(); ui->btnConnSub->hide(); ui->lbInfo->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 == 1){ // 使用配置文件连接失败,需要删除该配置文件 QString txt(tr("Conn Wifi Failed"));//"连接 Wifi 失败" syslog(LOG_DEBUG, "Try to connect wifi named %s, but failed, will delete it's configuration file", ui->lbName->text().toUtf8().data()); //m_notify->execNotifySend(txt); KylinDBus kylindbus; kylindbus.showDesktopNotify(txt); //QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection delete '" + ui->lbName->text() + "';notify-send '" + txt + "...' -t 3800"; //int status = system(cmd.toUtf8().data()); //if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection delete' in function 'slotConnWifiResult' failed");} } // 设置全局变量,当前连接Wifi的信号强度 currentActWifiSignalLv = signalLv; this->stopWaiting(); // if (connFlag != 0){ // mw->stopLoading(); // } } 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 < 1){ this->waitPage = TOTAL_PAGE; } this->countCurrentTime += FRAME_SPEED; if (this->countCurrentTime >= LIMIT_TIME){ this->stopWaiting(); } } void OneConnForm::startWaiting(bool isConn){ this->isWaiting = true; if (isConn){ ui->lbWaiting->setStyleSheet("QLabel{border:0px;border-radius:4px;background-color:rgba(61,107,229,1);}"); }else{ 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 = TOTAL_PAGE; this->waitTimer->start(FRAME_SPEED); ui->lbWaiting->show(); ui->lbWaitingIcon->show(); mw->setTrayLoading(true); } void OneConnForm::stopWaiting(){ this->isWaiting = false; this->waitTimer->stop(); ui->lbWaiting->hide(); ui->lbWaitingIcon->hide(); mw->setTrayLoading(false); mw->getActiveInfo(); } kylin-nm/src/confform.cpp0000644000175000017500000003506513645621273014362 0ustar fengfeng/* * Copyright (C) 2019 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) : QWidget(parent), ui(new Ui::ConfForm) { ui->setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); this->setWindowTitle(tr("edit network"));//"网络设置" 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())); this->setStyleSheet("QWidget{border-radius:6px;border:none;}"); ui->centralWidget->setStyleSheet("#centralWidget{border:1px solid rgba(255,255,255,0.05);border-radius:6px;background:rgba(19,19,20,0.7);}"); ui->lbName->setText(tr("Network 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->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"); ui->cbMask->addItem("255.255.254.0"); ui->cbMask->addItem("255.255.252.0"); ui->cbMask->addItem("255.255.0.0"); ui->cbMask->addItem("255.0.0.0"); ui->btnCancel->setText(tr("Cancel"));//"取消" ui->btnOk->setText(tr("Save"));//"保存" ui->btnCreate->setText(tr("Ok"));//"确定" 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{border-radius:0px;font-size:13px;color:rgba(255,255,255,0.91);height: 32px;background-color:#48484C;outline:0px;}" "QComboBox QAbstractItemView::item:hover{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{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);}"; btnOnQss = "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);}"; lineQss = "background:rgba(255,255,255,0.08);"; // ui->centralWidget->setStyleSheet("#centralWidget{border:1px solid #297a97;background-color:#ffffff;}"); ui->wdHead->setStyleSheet("#wdHead{border:none}"); ui->wgManual->setStyleSheet("#wgManual{border:none}"); ui->wdBottom->setStyleSheet("#wdBottom{border:none}"); ui->lbLeftupTitle->setStyleSheet("QLabel{border:0px;font-size:20px;color:rgba(255,255,255,0.97);background-color:transparent;}"); ui->lbName->setStyleSheet(labelQss); ui->lbTxt1->setStyleSheet(labelQss); ui->lbTxt2->setStyleSheet(labelQss); ui->lbTxt3->setStyleSheet(labelQss); ui->lbTxt4->setStyleSheet(labelQss); ui->lbTxt5->setStyleSheet(labelQss); ui->lbTxt6->setStyleSheet(labelQss); ui->cbType->setStyleSheet(cbxQss); ui->cbType->setView(new QListView()); ui->cbMask->setStyleSheet(cbxQss); ui->cbMask->setView(new QListView()); ui->leName->setStyleSheet(leQss); ui->leAddr->setStyleSheet(leQss); ui->leGateway->setStyleSheet(leQss); ui->leDns->setStyleSheet(leQss); ui->leDns2->setStyleSheet(leQss); ui->btnCancel->setStyleSheet(btnOffQss); ui->btnOk->setStyleSheet(btnOnQss); ui->btnCreate->setStyleSheet(btnOnQss); ui->lineUp->setStyleSheet(lineQss); ui->lineDown->setStyleSheet(lineQss); ui->lineUp->hide(); ui->lineDown->hide(); ui->btnCancel->setFocusPolicy(Qt::NoFocus); ui->btnOk->setFocusPolicy(Qt::NoFocus); ui->btnCreate->setFocusPolicy(Qt::NoFocus); //m_notify = new NotifySend(); //显示桌面通知 // 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"); 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)); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } ConfForm::~ConfForm() { m_notify->deleteLater(); 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(); } } 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(); } } void ConfForm::setProp(QString connName, QString v4method, QString addr, QString mask, QString gateway, QString dns, bool isActConf){ this->isActConf = isActConf; ui->leName->setText(connName); if(v4method == "auto" || v4method == ""){ ui->cbType->setCurrentIndex(0); cbTypeChanged(0); }else{ ui->cbType->setCurrentIndex(1); cbTypeChanged(1); } ui->leAddr->setText(addr); ui->leGateway->setText(gateway); // 配置中有多个DNS,只处理前两个 if(dns.indexOf(",") != -1){ QStringList dnss = dns.split(","); ui->leDns->setText(dnss.at(0)); ui->leDns2->setText(dnss.at(1)); }else{ ui->leDns->setText(dns); ui->leDns2->setText(""); } if(mask == "24"){ ui->cbMask->setCurrentIndex(0); }else if(mask == "23"){ ui->cbMask->setCurrentIndex(1); }else if(mask == "22"){ ui->cbMask->setCurrentIndex(2); }else if(mask == "16"){ ui->cbMask->setCurrentIndex(3); }else if(mask == "8"){ ui->cbMask->setCurrentIndex(4); }else{ ui->cbMask->setCurrentIndex(0); } } void ConfForm::on_btnCreate_clicked() { QString cmdStr = "nmcli connection add con-name '" + ui->leName->text() + "' type ethernet"; Utils::m_system(cmdStr.toUtf8().data()); // int status = system(cmdStr.toUtf8().data()); // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection add con-name' in function 'on_btnCreate_clicked' failed");} if(ui->cbType->currentIndex() == 1){ //config the ipv4 and netmask and gateway if select Manual this->on_btnOk_clicked(); } else { QString txt(tr("New network already created")); //m_notify->execNotifySend(txt); KylinDBus kylindbus; kylindbus.showDesktopNotify(txt); //QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "...' -t 3800"; //int status1 = system(cmd.toUtf8().data()); //if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'execConnWifiPWD' failed");} } this->hide(); } void ConfForm::on_btnOk_clicked() { 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(ui->cbType->currentIndex() == 0){ kylin_network_set_automethod(ui->leName->text().toUtf8().data()); }else{ QString dnss = ui->leDns->text(); if(ui->leDns2->text() != ""){ dnss.append(","); dnss.append(ui->leDns2->text()); } kylin_network_set_manualall(ui->leName->text().toUtf8().data(), ui->leAddr->text().toUtf8().data(), mask.toUtf8().data(), ui->leGateway->text().toUtf8().data(), dnss.toUtf8().data()); } QString txt(tr("New network settings already finished")); //m_notify->execNotifySend(txt); KylinDBus kylindbus; kylindbus.showDesktopNotify(txt); //QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "...' -t 3800"; //int status1 = system(cmd.toUtf8().data()); //if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'execConnWifiPWD' failed");} this->hide(); // 如果是修改当前连接的网络,则修改设置后简略重连网络 if(this->isActConf == true){ //QString cmd = "/usr/share/kylin-nm/shell/connup.sh '" + ui->leName->text() + "'"; QString cmdStr = "nmcli connection up '" + ui->leName->text() + "'"; Utils::m_system(cmdStr.toUtf8().data()); // int status = system(cmd.toUtf8().data()); // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection up' in function 'on_btnOk_clicked' failed");} QString m_txt(tr("New settings already effective")); //m_notify->execNotifySend(m_txt); KylinDBus m_kylindbus; m_kylindbus.showDesktopNotify(m_txt); //QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + m_txt + "' -t 3800"; //int status1 = system(cmd.toUtf8().data()); //if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'on_btnOk_clicked' failed");} } } void ConfForm::on_btnCancel_clicked() { this->hide(); } void ConfForm::cbTypeChanged(int index){ if (isShowSaveBtn){ ui->leName->setEnabled(false); ui->btnOk->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->wdBottom->move(1, 170); this->setEnableOfBtn(); this->resize(432, 230); } if(index == 1){ ui->lineUp->show(); ui->lineDown->show(); ui->wgManual->show(); ui->centralWidget->resize(432, 510); ui->wdBottom->move(1, 440); this->setEnableOfBtn(); this->resize(432, 510); } if(index == 3){ ui->btnOk->setStyleSheet(btnOffQss); ui->btnOk->setEnabled(false); ui->btnCreate->setStyleSheet(btnOffQss); ui->btnCreate->setEnabled(false); ui->leName->setEnabled(true); ui->btnOk->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->wdBottom->move(1, 170); this->resize(432, 230); } } void ConfForm::on_leName_textEdited(const QString &arg1) { this->setEnableOfBtn(); } void ConfForm::on_leAddr_textEdited(const QString &arg1) { this->setEnableOfBtn(); } void ConfForm::on_leGateway_textEdited(const QString &arg1) { this->setEnableOfBtn(); } void ConfForm::on_leDns_textEdited(const QString &arg1) { this->setEnableOfBtn(); } void ConfForm::on_leDns2_textEdited(const QString &arg1) { // this->setEnableOfBtn(); } void ConfForm::setEnableOfBtn() { if (ui->leName->text().size() == 0 ){ this->setBtnEnableFalse(); return; } if (ui->cbType->currentIndex() == 1){ if (!this->getTextEditState(ui->leAddr->text()) ){ this->setBtnEnableFalse(); return; } if (!this->getTextEditState(ui->leGateway->text()) ){ this->setBtnEnableFalse(); return; } if (!this->getTextEditState(ui->leDns->text()) ){ this->setBtnEnableFalse(); return; } } ui->btnOk->setStyleSheet(btnOnQss); ui->btnOk->setEnabled(true); ui->btnCreate->setStyleSheet(btnOnQss); ui->btnCreate->setEnabled(true); } 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); // qDebug()<<"the match result is: " << match; return match; } void ConfForm::setBtnEnableFalse() { ui->btnOk->setStyleSheet(btnOffQss); ui->btnOk->setEnabled(false); ui->btnCreate->setStyleSheet(btnOffQss); ui->btnCreate->setEnabled(false); } void ConfForm::paintEvent(QPaintEvent *event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QWidget::paintEvent(event); } kylin-nm/src/kylin-dbus-interface.cpp0000644000175000017500000005777613645621273016605 0ustar fengfeng/* * Copyright (C) 2019 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 KylinDBus::KylinDBus(MainWindow *mainWindow, QObject *parent) :QObject(parent) { this->mw = mainWindow; getObjectPath(); //获取dbus中 lan 与 WiFi 的device路径 getPhysicalCarrierState(0); //初始化获取网线插入状态 getLanHwAddressState(); //获取有线网Mac地址 getWiredCardName(); //获取有线网卡名称 //initTaskbarGsetting(); //初始化taskbar的GSetting方法 getWifiSwitchState(); //初始化wifi开关GSetting通信方法 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 (wiredPath.path() != ""){ QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), QString(wiredPath.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 (wirelessPath.path() != ""){ QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), QString(wirelessPath.path()), QString("org.freedesktop.NetworkManager.Device.Wireless"), QString("PropertiesChanged"), this, SLOT(onWifiPropertyChanged(QVariantMap) ) ); QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), QString(wirelessPath.path()), QString("org.freedesktop.NetworkManager.Device.Wireless"), QString("AccessPointAdded"), this, SLOT(onAccessPointAdded(QDBusObjectPath) ) ); getWirelessCardName();//获取无线网卡名称 } else { qDebug()<<"Can not find wireless device object path when using dbus."; } time = new QTimer(this); time->setTimerType(Qt::PreciseTimer); QObject::connect(time, SIGNAL(timeout()), this, SLOT(slot_timeout())); QObject::connect(this, SIGNAL(updateWiredList(int)), mw, SLOT(onBtnNetListClicked(int))); } /////////////////////////////////////////////////////////////////////////////// //下方使用Dbus 进程通信方法 void KylinDBus::getObjectPath() { QDBusInterface m_interface( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.NetworkManager", QDBusConnection::systemBus() ); QDBusReply> 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){ wiredPath = obj_path; } else if (reply.value().indexOf("org.freedesktop.NetworkManager.Device.Wireless") != -1){ wirelessPath = obj_path; isWirelessCardOn = true; } } } void KylinDBus::getPhysicalCarrierState(int n) { QDBusInterface interface( "org.freedesktop.NetworkManager", wiredPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply reply = interface.call("Get", "org.freedesktop.NetworkManager.Device.Wired", "Carrier"); try{ if (reply.value().toString() == "true"){ isWiredCableOn = true; if (n == 1){ this->mw->onPhysicalCarrierChanged(isWiredCableOn);} } else if (reply.value().toString() == "false"){ isWiredCableOn = false; if (n == 1){ this->mw->onPhysicalCarrierChanged(isWiredCableOn);} } else { throw -1; } }catch(...){ syslog(LOG_ERR, "Error occurred when get the property 'Carrier' of Wired"); qDebug()<<"Error occurred when get the property 'Carrier' of Wired"; } } void KylinDBus::getLanHwAddressState() { QDBusInterface lanInterface( "org.freedesktop.NetworkManager", wiredPath.path(), "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() ); QDBusReply lanReply = lanInterface.call("Get", "org.freedesktop.NetworkManager.Device.Wired", "HwAddress"); if (!lanReply.isValid()) { qDebug()<<"can not get the attribute 'HwAddress' in func getLanHwAddressState()"; } else { dbusLanMac = lanReply.value().toString(); } } void KylinDBus::getWiredCardName() { QDBusInterface lanInterface( "org.freedesktop.NetworkManager", wiredPath.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 { dbusLanCardName = lanReply.value().toString(); } } void KylinDBus::getWirelessCardName() { QDBusInterface lanInterface( "org.freedesktop.NetworkManager", wirelessPath.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(); } } void KylinDBus::getLanIp(QString netName) { 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"); const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); //DBus type : a{sa{sv}}, a map with a key of QString, which maps to another map of QString,QVariant 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 == "id"){ //const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value(); if (netName == outsideMap.value(search_key).toString()){ // qDebug()<<"aaaaaa"< innerMap = map.value(key); //qDebug() << "Key: " << 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;// append map to a vector here if you want to keep it } dbusArg2nd.endArray(); //qDebug()<<" " << m_map.value("address").toString(); dbusLanIpv4 = m_map.value("address").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(); //qDebug()<<" " << m_map.value("address").toString(); dbusLanIpv6 = m_map.value("address").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::getWifiMac(QString netName) { dbusWifiMac = ""; // //将wifi名转为utf-8 十进制形式 // std::vector vec; // int len_encoded; // int len_netName = netName.size(); // for (int i=0;ifromUnicode(netName.at(i)).toHex(); // len_encoded = encoded.size(); // qDebug()<<"debug: 11"<> reply = interface.call("GetAllAccessPoints"); 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){ 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(); } } } void KylinDBus::getActWifiMac(QString netName) { dbusWifiMac = ""; 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()){ for (QString subkey : map.keys()){ QMap subMap = map.value(subkey); if (subkey == "802-11-wireless"){ dbusWifiMac = subMap.value("seen-bssids").toString(); } } //end for (QString subkey : map.keys()) } } } } } } // end foreach (QDBusObjectPath objNet, m_objNets) } int KylinDBus::getAccessPointsNumber() { QDBusInterface interface( "org.freedesktop.NetworkManager", wirelessPath.path(), "org.freedesktop.NetworkManager.Device.Wireless", QDBusConnection::systemBus() ); QDBusReply> reply = interface.call("GetAllAccessPoints"); QList objPaths = reply.value(); // foreach (QDBusObjectPath objPath, objPaths){ // qDebug()<<"debug: *****path is: "< reply = interface.call("Get", "org.freedesktop.NetworkManager.Device", "ActiveConnection"); return 0; } 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"); 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(0); syslog(LOG_DEBUG, "A new wired network was created."); qDebug()<<"A new wired network was created."; } } } void KylinDBus::onConnectionRemoved(QDBusObjectPath objPath) { syslog(LOG_DEBUG, "An old network was removed from configure directory."); qDebug()<<"An old network was removed from configure directory."; if (mw->is_btnNetList_clicked == 1){ emit this->updateWiredList(0); } } void KylinDBus::onLanPropertyChanged(QVariantMap qvm) { if (!isRunningFunction) { syslog(LOG_DEBUG, "kylin-nm receive a signal 'Device.Wired PropertiesChanged' about interface."); qDebug()<<"kylin-nm receive a signal 'Device.Wired PropertiesChanged' about interface."; isRunningFunction = true; time->start(3000); QString str = qvm.value("Carrier").toString(); if (str == "false" || str == "true"){ getPhysicalCarrierState(1); } } else { a = 0; } } void KylinDBus::slot_timeout() { isRunningFunction = false; time->stop(); } void KylinDBus::onWifiPropertyChanged(QVariantMap qvm) { //qDebug()<<"debug: *************"< args; args<<(QCoreApplication::applicationName()) <<((unsigned int) 0) < reply = interface.call("GetPanelPosition", str); return reply; } int KylinDBus::getTaskBarHeight(QString str) { QDBusInterface interface( "com.ukui.panel.desktop", "/", "com.ukui.panel.desktop", QDBusConnection::sessionBus() ); QDBusReply reply = interface.call("GetPanelSize", str); return reply; } /////////////////////////////////////////////////////////////////////////////// //下方使用Gsetting 进程通信方法 void KylinDBus::initTaskbarGsetting() { if(QGSettings::isSchemaInstalled("org.ukui.panel.settings")) { m_tastbar_gsettings = new QGSettings("org.ukui.panel.settings"); } } 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; } } 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; } } 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") { bool judge = getSwitchStatus(key); if (judge){ mw->onBtnWifiClicked(1); //打开wifi开关 }else{ mw->onBtnWifiClicked(2); //关闭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; } 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); } kylin-nm/src/confform.h0000644000175000017500000000417413640637261014023 0ustar fengfeng/* * Copyright (C) 2019 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 namespace Ui { class ConfForm; } class ConfForm : public QWidget { Q_OBJECT public: explicit ConfForm(QWidget *parent = 0); ~ConfForm(); void setProp(QString connName, QString v4method, QString addr, QString mask, QString gateway, QString dns, bool isActConf); NotifySend *m_notify = nullptr; public slots: void cbTypeChanged(int index); protected: void paintEvent(QPaintEvent *event); private slots: void on_btnOk_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); void setBtnEnableFalse(); private: Ui::ConfForm *ui; void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); bool isPress; QPoint winPos; QPoint dragPos; bool isActConf; bool isShowSaveBtn = true; QString labelQss, cbxQss, leQss, lineQss, btnOnQss, btnOffQss; }; #endif // CONFFORM_H kylin-nm/README.md0000644000175000017500000000155613640637261012532 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 extention 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/res.qrc0000644000175000017500000000000713522470453012536 0ustar fengfeng kylin-nm/kylin-nm.pro0000644000175000017500000000774113640637261013535 0ustar fengfeng#------------------------------------------------- # # Project created by QtCreator 2018-10-19T15:29:47 # #------------------------------------------------- QT += core gui x11extras dbus KWindowSystem 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 += gsettings-qt LIBS += -L/usr/lib/ -lgsettings-qt target.path = /usr/bin target.source += $$TARGET desktop.path = /etc/xdg/autostart/ desktop.files = kylin-nm.desktop INSTALLS += target \ desktop # 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) SOURCES += \ src/backthread.cpp \ src/confform.cpp \ src/ksimplenm.cpp \ src/kylin-dbus-interface.cpp \ src/kylin-network-interface.c \ src/loadingdiv.cpp \ src/main.cpp \ src/mainwindow.cpp \ src/notifysend.cpp \ src/oneconnform.cpp \ src/onelancform.cpp \ src/utils.cpp \ wireless-security/dlgconnhidwifi.cpp \ wireless-security/dlgconnhidwifisecfast.cpp \ wireless-security/dlgconnhidwifisectunneltls.cpp \ wireless-security/dlgconnhidwifisecpeap.cpp \ wireless-security/dlgconnhidwifisectls.cpp \ wireless-security/dlgconnhidwifisecleap.cpp \ wireless-security/dlgconnhidwifisecpwd.cpp \ wireless-security/dlgconnhidwifiwep.cpp \ wireless-security/dlgconnhidwifileap.cpp \ wireless-security/dlgconnhidwifiwpa.cpp \ wireless-security/kylinheadfile.cpp \ hot-spot/dlghotspotcreate.cpp HEADERS += \ src/backthread.h \ src/confform.h \ src/ksimplenm.h \ src/kylin-dbus-interface.h \ src/kylin-network-interface.h \ src/loadingdiv.h \ src/mainwindow.h \ src/notifysend.h \ src/oneconnform.h \ src/onelancform.h \ src/utils.h \ wireless-security/dlgconnhidwifi.h \ wireless-security/dlgconnhidwifisecfast.h \ wireless-security/dlgconnhidwifisectunneltls.h \ wireless-security/dlgconnhidwifisecpeap.h \ wireless-security/dlgconnhidwifisectls.h \ wireless-security/dlgconnhidwifisecleap.h \ wireless-security/dlgconnhidwifisecpwd.h \ wireless-security/dlgconnhidwifiwep.h \ wireless-security/dlgconnhidwifileap.h \ wireless-security/dlgconnhidwifiwpa.h \ wireless-security/kylinheadfile.h \ hot-spot/dlghotspotcreate.h FORMS += \ src/confform.ui \ src/mainwindow.ui \ src/notifysend.ui \ src/oneconnform.ui \ src/onelancform.ui \ wireless-security/dlgconnhidwifi.ui \ wireless-security/dlgconnhidwifisecfast.ui \ wireless-security/dlgconnhidwifisectunneltls.ui \ wireless-security/dlgconnhidwifisecpeap.ui \ wireless-security/dlgconnhidwifisectls.ui \ wireless-security/dlgconnhidwifisecleap.ui \ wireless-security/dlgconnhidwifisecpwd.ui \ wireless-security/dlgconnhidwifiwep.ui \ wireless-security/dlgconnhidwifileap.ui \ wireless-security/dlgconnhidwifiwpa.ui \ hot-spot/dlghotspotcreate.ui RESOURCES += \ nmqrc.qrc unix { UI_DIR = .ui MOC_DIR = .moc OBJECTS_DIR = .obj } TRANSLATIONS = translations/kylin-nm_zh_CN.ts \ translations/kylin-nm_bo.ts DISTFILES += kylin-nm/wireless-security/0000755000175000017500000000000013645621235014745 5ustar fengfengkylin-nm/wireless-security/dlgconnhidwifi.cpp0000644000175000017500000002703013645632375020452 0ustar fengfeng/* * Copyright (C) 2019 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 DlgConnHidWifi::DlgConnHidWifi(int type, MainWindow *mainWindow, QWidget *parent) : isUsed(type), QDialog(parent), ui(new Ui::DlgConnHidWifi) { ui->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())); 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->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->btnCancel->setStyleSheet(objQss.btnCancelQss); ui->btnConnect->setStyleSheet(objQss.btnConnQss); 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->btnCancel->setText(tr("Cancel")); //取消 ui->btnConnect->setText(tr("Connect")); //连接 ui->cbxConn->addItem(tr("C_reate…")); //新建... QString tmpPath = "/tmp/kylin-nm-connshow-" + QDir::home().dirName(); QString cmd = "nmcli connection show>" + tmpPath; int status = system(cmd.toUtf8().data()); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgConnHidWifi' failed");} QFile file(tmpPath); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"Can't open the file!"; } QString txt = file.readAll(); QStringList txtLine = txt.split("\n"); file.close(); foreach (QString line, txtLine) { if(line.indexOf("wifi") != -1){ QStringList subLine = line.split(" "); ui->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 & 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 & WPA2 Enterprise")); //WPA 及 WPA2 企业 ui->cbxSecurity->setCurrentIndex(0); connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog())); if (isUsed == 0){ ui->btnConnect->setEnabled(false); }else{ ui->cbxConn->setCurrentIndex(isUsed); ui->leNetName->setText(ui->cbxConn->currentText()); ui->lbNetName->setEnabled(false); ui->leNetName->setEnabled(false); ui->lbSecurity->setEnabled(false); ui->cbxSecurity->setEnabled(false); ui->btnConnect->setEnabled(true); } this->setFixedSize(432,358); this->mw = mainWindow; KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgConnHidWifi::~DlgConnHidWifi() { delete ui; } void DlgConnHidWifi::mousePressEvent(QMouseEvent *event){ if(event->button() == Qt::LeftButton){ this->isPress = true; this->winPos = this->pos(); this->dragPos = event->globalPos(); event->accept(); } } void DlgConnHidWifi::mouseReleaseEvent(QMouseEvent *event){ this->isPress = false; } void DlgConnHidWifi::mouseMoveEvent(QMouseEvent *event){ if(this->isPress){ this->move(this->winPos - (this->dragPos - event->globalPos())); event->accept(); } } //切换到其他Wi-Fi安全类型 void DlgConnHidWifi::changeDialog() { if(ui->cbxSecurity->currentIndex()==0){ qDebug()<<"it's not need to change dialog"; } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0, mw); connHidWifiWpa->show(); connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap(); connHidWifiLeap->show(); } else if(ui->cbxSecurity->currentIndex()==5) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(0); connHidWifiSecTls->show(); } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(1); connHidWifiSecTls->show(); } } //同一 Wi-Fi安全类型的窗口变换 void DlgConnHidWifi::changeWindow(){ if (ui->cbxConn->currentIndex() == 0){ isUsed = ui->cbxConn->currentIndex(); ui->cbxConn->setCurrentIndex(0); ui->leNetName->setText(""); ui->lbNetName->setEnabled(true); ui->leNetName->setEnabled(true); ui->lbSecurity->setEnabled(true); ui->cbxSecurity->setEnabled(true); ui->btnConnect->setEnabled(false); }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()); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'changeWindow' failed");} QFile file(tmpPath); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"Can't open the file!"; } QString txt = file.readAll(); file.close(); if (txt.indexOf("802-11-wireless-security.key-mgmt:") != -1){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(ui->cbxConn->currentIndex(), mw); connHidWifiWpa->show(); connect(connHidWifiWpa, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); }else { isUsed = ui->cbxConn->currentIndex(); ui->leNetName->setText(ui->cbxConn->currentText()); ui->lbNetName->setEnabled(false); ui->leNetName->setEnabled(false); ui->lbSecurity->setEnabled(false); ui->cbxSecurity->setEnabled(false); ui->btnConnect->setEnabled(true); } } } void DlgConnHidWifi::on_btnCancel_clicked() { this->close(); } void DlgConnHidWifi::on_btnConnect_clicked() { QThread *t = new QThread(); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, SIGNAL(started()), this, SLOT(slotStartLoading())); connect(this, SIGNAL(stopSignal()), t, SLOT(quit())); t->start(); QString wifiName = ui->leNetName->text(); BackThread *bt = new BackThread(); strWifiname = wifiName; //点击连接按钮以连接隐藏WiFi if (isUsed == 0){ int x = 0; do { sleep(1); QString tmpPath = "/tmp/kylin-nm-btoutput-" + QDir::home().dirName(); QString cmd = "nmcli device wifi connect " + wifiName + " password '' hidden yes > " + tmpPath; int status = system(cmd.toUtf8().data()); if (status != 0) syslog(LOG_ERR, "execute 'nmcli device wifi connect' in function 'on_btnConnect_clicked' failed"); QFile file(tmpPath); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "Can't open the file!" << endl; } QString text = file.readAll(); file.close(); if(text.indexOf("Scanning not allowed") != -1){x = 1;} else { x = 0;} } while(x); connect(this, SIGNAL(execSecConn()), this,SLOT(on_execSecConn() )); QTimer::singleShot(5*1000, this, SLOT(on_execSecConn() )); } else { bt->execConnWifi(wifiName); connect(this, SIGNAL(sendMessage()), this,SLOT(emitSignal() )); QTimer::singleShot(4*1000, this, SLOT(emitSignal() )); } this->close(); } void DlgConnHidWifi::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgConnHidWifi::slotStartLoading() { mw->startLoading(); } void DlgConnHidWifi::on_execSecConn() { QString str = "nmcli device wifi connect " + strWifiname + " password ''"; int status = system(str.toUtf8().data()); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli device wifi connect' in function 'on_execSecConn' failed");} connect(this, SIGNAL(sendMessage()), this,SLOT(emitSignal() )); QTimer::singleShot(3*1000, this, SLOT(emitSignal() )); } void DlgConnHidWifi::emitSignal() { emit reSetWifiList(); mw->stopLoading(); emit this->stopSignal(); } void DlgConnHidWifi::paintEvent(QPaintEvent *event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlgconnhidwifisecleap.h0000644000175000017500000000221513636616643021452 0ustar fengfeng#ifndef DLGCONNHIDWIFISECLEAP_H #define DLGCONNHIDWIFISECLEAP_H #include #include namespace Ui { class DlgConnHidWifiSecLeap; } class DlgConnHidWifiSecLeap : public QDialog { Q_OBJECT public: explicit DlgConnHidWifiSecLeap(int type, QWidget *parent = 0); ~DlgConnHidWifiSecLeap(); 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::DlgConnHidWifiSecLeap *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/dlgconnhidwifisecfast.cpp0000644000175000017500000003134613640637261022022 0ustar fengfeng/* * Copyright (C) 2019 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 DlgConnHidWifiSecFast::DlgConnHidWifiSecFast(int type, QWidget *parent) : WepOrWpa(type), QDialog(parent), ui(new Ui::DlgConnHidWifiSecFast) { ui->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())); 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.btnCancelQss); ui->btnConnect->setStyleSheet(objQss.btnConnQss); 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->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"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgConnHidWifiSecFast' failed");} QFile file("/tmp/kylin-nm-connshow"); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"Can't open the file!"; } QString txt = file.readAll(); QStringList txtLine = txt.split("\n"); file.close(); foreach (QString line, txtLine) { if(line.indexOf("wifi") != -1){ QStringList subLine = line.split(" "); ui->cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA & 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 & 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); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgConnHidWifiSecFast::~DlgConnHidWifiSecFast() { delete ui; } void DlgConnHidWifiSecFast::mousePressEvent(QMouseEvent *event){ if(event->button() == Qt::LeftButton){ this->isPress = true; this->winPos = this->pos(); this->dragPos = event->globalPos(); event->accept(); } } void DlgConnHidWifiSecFast::mouseReleaseEvent(QMouseEvent *event){ this->isPress = false; } void DlgConnHidWifiSecFast::mouseMoveEvent(QMouseEvent *event){ if(this->isPress){ this->move(this->winPos - (this->dragPos - event->globalPos())); event->accept(); } } void DlgConnHidWifiSecFast::changeDialogSecu() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap(); 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 DlgConnHidWifiSecFast::changeDialogAuth() { if(ui->cbxAuth->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(WepOrWpa); connHidWifiSecTls->show(); } else if(ui->cbxAuth->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecLeap *connHidWifiSecLeap = new DlgConnHidWifiSecLeap(WepOrWpa); connHidWifiSecLeap->show(); } else if(ui->cbxAuth->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecPwd *connHidWifiSecPwd = new DlgConnHidWifiSecPwd(WepOrWpa); connHidWifiSecPwd->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(); DlgConnHidWifiSecTunnelTLS *connHidWifiSecTuTls = new DlgConnHidWifiSecTunnelTLS(WepOrWpa); connHidWifiSecTuTls->show(); } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecPeap *connHidWifiSecPeap = new DlgConnHidWifiSecPeap(WepOrWpa); connHidWifiSecPeap->show(); } } void DlgConnHidWifiSecFast::on_btnCancel_clicked() { this->close(); } void DlgConnHidWifiSecFast::on_btnConnect_clicked() { this->close(); } void DlgConnHidWifiSecFast::on_checkBoxAutoPCA_stateChanged(int arg1) { if (arg1 == 0) { ui->cbxAutoPCA->setEnabled(false); } else { ui->cbxAutoPCA->setEnabled(true); } } void DlgConnHidWifiSecFast::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword ->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgConnHidWifiSecFast::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 DlgConnHidWifiSecFast::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 DlgConnHidWifiSecFast::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 DlgConnHidWifiSecFast::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 DlgConnHidWifiSecFast::paintEvent(QPaintEvent *event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlgconnhidwifisecpeap.ui0000644000175000017500000003061513636616643021651 0ustar fengfeng DlgConnHidWifiSecPeap 0 0 432 700 Connect to Hidden Wi-Fi 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/dlgconnhidwifisecleap.ui0000644000175000017500000001625613636616643021652 0ustar fengfeng DlgConnHidWifiSecLeap 0 0 432 487 Connect to Hidden Wi-Fi 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/dlgconnhidwifi.ui0000644000175000017500000001156613642570510020301 0ustar fengfeng DlgConnHidWifi 0 0 432 358 Connect to Hidden Wi-Fi Network 76 80 90 20 10 Qt::LeftToRight 175 75 182 32 10 76 221 90 20 10 175 170 182 32 10 76 176 90 20 10 175 215 182 32 10 315 310 90 30 10 215 310 90 30 10 30 30 140 22 9 0 0 432 358 10 140 412 1 Qt::Horizontal 10 280 412 1 Qt::Horizontal lbBoder lbConn cbxConn lbNetName cbxSecurity lbSecurity leNetName btnConnect btnCancel lbLeftupTitle lineUp lineDown kylin-nm/wireless-security/dlgconnhidwifileap.h0000644000175000017500000000203413636616643020756 0ustar fengfeng#ifndef DLGCONNHIDWIFILEAP_H #define DLGCONNHIDWIFILEAP_H #include #include namespace Ui { class DlgConnHidWifiLeap; } class DlgConnHidWifiLeap : public QDialog { Q_OBJECT public: explicit DlgConnHidWifiLeap(QWidget *parent = 0); ~DlgConnHidWifiLeap(); 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::DlgConnHidWifiLeap *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/dlgconnhidwifiwpa.cpp0000644000175000017500000003130013645632410021143 0ustar fengfeng/* * Copyright (C) 2019 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 DlgConnHidWifiWpa::DlgConnHidWifiWpa(int type, MainWindow *mainWindow, QWidget *parent) : isUsed(type), QDialog(parent), ui(new Ui::DlgConnHidWifiWpa) { ui->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())); 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->lbPassword->setStyleSheet(objQss.labelQss); ui->cbxConn->setStyleSheet(objQss.cbxQss); ui->cbxConn->setView(new QListView()); ui->leNetName->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.btnCancelQss); ui->btnConnect->setStyleSheet(objQss.btnConnQss); 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 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->lbPassword->setText(tr("Password")); //密码: ui->btnCancel->setText(tr("Cancel")); //取消 ui->btnConnect->setText(tr("Connect")); //连接 ui->cbxConn->addItem(tr("C_reate…")); //新建... QString tmpPath = "/tmp/kylin-nm-connshow-" + QDir::home().dirName(); QString cmd = "nmcli connection show > " + tmpPath; int status = system(cmd.toUtf8().data()); if (status != 0) syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgConnHidWifiWpa' failed"); QFile file(tmpPath); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"Can't open the file!"; } QString txt = file.readAll(); QStringList txtLine = txt.split("\n"); file.close(); foreach (QString line, txtLine) { if(line.indexOf("wifi") != -1){ QStringList subLine = line.split(" "); ui->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 & 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 & WPA2 Enterprise")); //WPA 及 WPA2 企业 ui->cbxSecurity->setCurrentIndex(1); connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog())); if (isUsed == 0){ ui->btnConnect->setEnabled(false); } else { ui->cbxConn->setCurrentIndex(isUsed); ui->leNetName->setText(ui->cbxConn->currentText()); 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); } this->setFixedSize(432,397); this->mw = mainWindow; KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgConnHidWifiWpa::~DlgConnHidWifiWpa() { delete ui; } void DlgConnHidWifiWpa::mousePressEvent(QMouseEvent *event){ if(event->button() == Qt::LeftButton){ this->isPress = true; this->winPos = this->pos(); this->dragPos = event->globalPos(); event->accept(); } } void DlgConnHidWifiWpa::mouseReleaseEvent(QMouseEvent *event){ this->isPress = false; } void DlgConnHidWifiWpa::mouseMoveEvent(QMouseEvent *event){ if(this->isPress){ this->move(this->winPos - (this->dragPos - event->globalPos())); event->accept(); } } //切换到其他Wi-Fi安全类型 void DlgConnHidWifiWpa::changeDialog() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0,mw); connHidWifi->show(); connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } else if(ui->cbxSecurity->currentIndex()==1) { qDebug()<<"it's not need to change dialog"; } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap(); connHidWifiLeap->show(); } else if(ui->cbxSecurity->currentIndex()==5) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(0); connHidWifiSecTls->show(); } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(1); connHidWifiSecTls->show(); } } //同一 Wi-Fi安全类型的窗口变换 void DlgConnHidWifiWpa::changeWindow(){ if (ui->cbxConn->currentIndex() == 0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(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()); if (status != 0) syslog(LOG_ERR, "execute 'nmcli connection show' in function 'changeWindow' failed"); QFile file(tmpPath); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"Can't open the file!"; } QString txt = file.readAll(); file.close(); if (txt.indexOf("802-11-wireless-security.key-mgmt:") != -1){ isUsed = ui->cbxConn->currentIndex(); ui->lbNetName->setEnabled(false); ui->leNetName->setText(ui->cbxConn->currentText()); ui->leNetName->setEnabled(false); ui->lbSecurity->setEnabled(false); ui->cbxSecurity->setEnabled(false); ui->lePassword->setText(""); ui->lbPassword->setEnabled(false); ui->lePassword->setEnabled(false); ui->btnConnect->setEnabled(true); }else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(ui->cbxConn->currentIndex(), mw); connHidWifi->show(); connect(connHidWifi, SIGNAL(reSetWifiList() ), mw, SLOT(on_btnWifiList_clicked()) ); } } } void DlgConnHidWifiWpa::on_btnCancel_clicked() { this->close(); } void DlgConnHidWifiWpa::on_btnConnect_clicked() { QThread *t = new QThread(); connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, SIGNAL(started()), this, SLOT(slotStartLoading())); connect(this, SIGNAL(stopSignal()), t, SLOT(quit())); t->start(); QString wifiName = ui->leNetName->text(); QString wifiPassword = ui->lePassword->text(); BackThread *bt = new BackThread(); strWifiname = wifiName; strWifiPassword = wifiPassword; if (isUsed == 0){ int x = 0; do{ sleep(1); QString tmpPath = "/tmp/kylin-nm-btoutput-" + QDir::home().dirName(); QString cmd = "nmcli device wifi connect " + wifiName + " password " + wifiPassword + " hidden yes > " + tmpPath; int status = system(cmd.toUtf8().data()); if (status != 0) syslog(LOG_ERR, "execute 'nmcli device wifi connect' in function 'on_btnConnect_clicked' failed"); QFile file(tmpPath); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug()<<"Can't open the file!"<execConnWifi(wifiName); connect(this, SIGNAL(sendMessage()), this,SLOT(emitSignal() )); QTimer::singleShot(4*1000, this, SLOT(emitSignal() )); } this->close(); } void DlgConnHidWifiWpa::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword ->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgConnHidWifiWpa::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == "" || ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgConnHidWifiWpa::on_lePassword_textEdited(const QString &arg1) { if (ui->leNetName->text() == "" || ui->lePassword->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgConnHidWifiWpa::slotStartLoading() { mw->startLoading(); } void DlgConnHidWifiWpa::on_execSecConn() { QString str = "nmcli device wifi connect " + strWifiname + " password " + strWifiPassword; int status = system(str.toUtf8().data()); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli device wifi connect' in function 'on_execSecConn' failed");} connect(this, SIGNAL(sendMessage()), this,SLOT(emitSignal() )); QTimer::singleShot(3*1000, this, SLOT(emitSignal() )); } void DlgConnHidWifiWpa::emitSignal() { emit reSetWifiList(); mw->stopLoading(); emit this->stopSignal(); } void DlgConnHidWifiWpa::paintEvent(QPaintEvent *event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlgconnhidwifisecpwd.cpp0000644000175000017500000002473013640637261021656 0ustar fengfeng/* * Copyright (C) 2019 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 DlgConnHidWifiSecPwd::DlgConnHidWifiSecPwd(int type, QWidget *parent) : WepOrWpa(type), QDialog(parent), ui(new Ui::DlgConnHidWifiSecPwd) { ui->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())); 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.btnCancelQss); ui->btnConnect->setStyleSheet(objQss.btnConnQss); 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->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"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgConnHidWifiSecPwd' failed");} QFile file("/tmp/kylin-nm-connshow"); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"Can't open the file!"; } QString txt = file.readAll(); QStringList txtLine = txt.split("\n"); file.close(); foreach (QString line, txtLine) { if(line.indexOf("wifi") != -1){ QStringList subLine = line.split(" "); ui->cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA & 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 & 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); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgConnHidWifiSecPwd::~DlgConnHidWifiSecPwd() { delete ui; } void DlgConnHidWifiSecPwd::mousePressEvent(QMouseEvent *event){ if(event->button() == Qt::LeftButton){ this->isPress = true; this->winPos = this->pos(); this->dragPos = event->globalPos(); event->accept(); } } void DlgConnHidWifiSecPwd::mouseReleaseEvent(QMouseEvent *event){ this->isPress = false; } void DlgConnHidWifiSecPwd::mouseMoveEvent(QMouseEvent *event){ if(this->isPress){ this->move(this->winPos - (this->dragPos - event->globalPos())); event->accept(); } } void DlgConnHidWifiSecPwd::changeDialogSecu() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap(); 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 DlgConnHidWifiSecPwd::changeDialogAuth() { if(ui->cbxAuth->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(WepOrWpa); connHidWifiSecTls->show(); } else if(ui->cbxAuth->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecLeap *connHidWifiSecLeap = new DlgConnHidWifiSecLeap(WepOrWpa); connHidWifiSecLeap->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(); DlgConnHidWifiSecFast *connHidWifiSecFast = new DlgConnHidWifiSecFast(WepOrWpa); connHidWifiSecFast->show(); } else if(ui->cbxAuth->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTunnelTLS *connHidWifiSecTuTls = new DlgConnHidWifiSecTunnelTLS(WepOrWpa); connHidWifiSecTuTls->show(); } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecPeap *connHidWifiSecPeap = new DlgConnHidWifiSecPeap(WepOrWpa); connHidWifiSecPeap->show(); } } void DlgConnHidWifiSecPwd::on_btnCancel_clicked() { this->close(); } void DlgConnHidWifiSecPwd::on_btnConnect_clicked() { this->close(); } void DlgConnHidWifiSecPwd::on_checkBox_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword ->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgConnHidWifiSecPwd::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 DlgConnHidWifiSecPwd::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 DlgConnHidWifiSecPwd::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 DlgConnHidWifiSecPwd::paintEvent(QPaintEvent *event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlgconnhidwifisectls.h0000644000175000017500000000314213636616643021333 0ustar fengfeng#ifndef DLGCONNHIDWIFISECTLS_H #define DLGCONNHIDWIFISECTLS_H #include #include namespace Ui { class DlgConnHidWifiSecTls; } class DlgConnHidWifiSecTls : public QDialog { Q_OBJECT public: explicit DlgConnHidWifiSecTls(int type, QWidget *parent = 0); ~DlgConnHidWifiSecTls(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialogSecu(); void changeDialogAuth(); 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::DlgConnHidWifiSecTls *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 // DLGCONNHIDWIFISECTLS_H kylin-nm/wireless-security/dlgconnhidwifisectls.cpp0000644000175000017500000005616713640637261021677 0ustar fengfeng/* * Copyright (C) 2019 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 DlgConnHidWifiSecTls::DlgConnHidWifiSecTls(int type, QWidget *parent) : WepOrWpa(type), QDialog(parent), ui(new Ui::DlgConnHidWifiSecTls) { ui->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())); 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->lbIdentity->setStyleSheet(objQss.labelQss); ui->lbDomain->setStyleSheet(objQss.labelQss); ui->lbCA->setStyleSheet(objQss.labelQss); ui->lbCaPwd->setStyleSheet(objQss.labelQss); ui->lbUserCertify->setStyleSheet(objQss.labelQss); ui->lbUserCertifyPwd->setStyleSheet(objQss.labelQss); ui->lbUserPriKey->setStyleSheet(objQss.labelQss); ui->lbUserKeyPwd->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->leIdentity->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->cbxUserCertify->setStyleSheet(objQss.cbxQss); ui->cbxUserCertify->setView(new QListView()); ui->leUserCertifyPwd->setStyleSheet(objQss.leQss); ui->cbxUserPriKey->setStyleSheet(objQss.cbxQss); ui->cbxUserPriKey->setView(new QListView()); ui->leUserKeyPwd->setStyleSheet(objQss.leQss); ui->checkBoxPwdSec->setStyleSheet(objQss.checkBoxQss); ui->btnCancel->setStyleSheet(objQss.btnCancelQss); ui->btnConnect->setStyleSheet(objQss.btnCancelQss); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->checkBoxCA->setFocusPolicy(Qt::NoFocus); 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->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->cbxConn->addItem(tr("C_reate…")); //新建... int status = system("nmcli connection show>/tmp/kylin-nm-connshow"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgConnHidWifiSecTls' failed");} QFile file("/tmp/kylin-nm-connshow"); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"Can't open the file!"; } QString txt = file.readAll(); QStringList txtLine = txt.split("\n"); file.close(); foreach (QString line, txtLine) { if(line.indexOf("wifi") != -1){ QStringList subLine = line.split(" "); ui->cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA & 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 & 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(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); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgConnHidWifiSecTls::~DlgConnHidWifiSecTls() { delete ui; } void DlgConnHidWifiSecTls::mousePressEvent(QMouseEvent *event){ if(event->button() == Qt::LeftButton){ this->isPress = true; this->winPos = this->pos(); this->dragPos = event->globalPos(); event->accept(); } } void DlgConnHidWifiSecTls::mouseReleaseEvent(QMouseEvent *event){ this->isPress = false; } void DlgConnHidWifiSecTls::mouseMoveEvent(QMouseEvent *event){ if(this->isPress){ this->move(this->winPos - (this->dragPos - event->globalPos())); event->accept(); } } void DlgConnHidWifiSecTls::changeDialogSecu() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap(); 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 DlgConnHidWifiSecTls::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(); DlgConnHidWifiSecLeap *connHidWifiSecLeap = new DlgConnHidWifiSecLeap(WepOrWpa); connHidWifiSecLeap->show(); } else if(ui->cbxAuth->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecPwd *connHidWifiSecPwd = new DlgConnHidWifiSecPwd(WepOrWpa); connHidWifiSecPwd->show(); } else if(ui->cbxAuth->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecFast *connHidWifiSecFast = new DlgConnHidWifiSecFast(WepOrWpa); connHidWifiSecFast->show(); } else if(ui->cbxAuth->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTunnelTLS *connHidWifiSecTuTls = new DlgConnHidWifiSecTunnelTLS(WepOrWpa); connHidWifiSecTuTls->show(); } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecPeap *connHidWifiSecPeap = new DlgConnHidWifiSecPeap(WepOrWpa); connHidWifiSecPeap->show(); } } void DlgConnHidWifiSecTls::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 DlgConnHidWifiSecTls::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 DlgConnHidWifiSecTls::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 DlgConnHidWifiSecTls::on_btnCancel_clicked() { this->close(); } void DlgConnHidWifiSecTls::on_btnConnect_clicked() { this->close(); } void DlgConnHidWifiSecTls::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 DlgConnHidWifiSecTls::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->leCaPwd->setEchoMode(QLineEdit::Password); } else { ui->leCaPwd->setEchoMode(QLineEdit::Normal); } } void DlgConnHidWifiSecTls::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 DlgConnHidWifiSecTls::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 DlgConnHidWifiSecTls::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 DlgConnHidWifiSecTls::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 DlgConnHidWifiSecTls::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 DlgConnHidWifiSecTls::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 DlgConnHidWifiSecTls::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 DlgConnHidWifiSecTls::paintEvent(QPaintEvent *event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlgconnhidwifileap.ui0000644000175000017500000001477413636616643021162 0ustar fengfeng DlgConnHidWifiLeap 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/dlgconnhidwifisecpwd.ui0000644000175000017500000001625413636616643021521 0ustar fengfeng DlgConnHidWifiSecPwd 0 0 432 487 Connect to Hidden Wi-Fi 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/dlgconnhidwifisectls.ui0000644000175000017500000003102513636616643021522 0ustar fengfeng DlgConnHidWifiSecTls 0 0 432 705 Connect to Hidden Wi-Fi 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/dlgconnhidwifisectunneltls.ui0000644000175000017500000002732413636616643022757 0ustar fengfeng DlgConnHidWifiSecTunnelTLS 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/dlgconnhidwifiwep.cpp0000644000175000017500000002065713640637261021170 0ustar fengfeng/* * Copyright (C) 2019 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 DlgConnHidWifiWep::DlgConnHidWifiWep(int type, QWidget *parent) : WepPwdOrCode(type), QDialog(parent), ui(new Ui::DlgConnHidWifiWep) { ui->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())); 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->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.btnCancelQss); ui->btnConnect->setStyleSheet(objQss.btnConnQss); 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->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"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgConnHidWifiWep' failed");} QFile file("/tmp/kylin-nm-connshow"); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"Can't open the file!"; } QString txt = file.readAll(); QStringList txtLine = txt.split("\n"); file.close(); foreach (QString line, txtLine) { if(line.indexOf("wifi") != -1){ QStringList subLine = line.split(" "); ui->cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA & 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 & 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); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgConnHidWifiWep::~DlgConnHidWifiWep() { delete ui; } void DlgConnHidWifiWep::mousePressEvent(QMouseEvent *event){ if(event->button() == Qt::LeftButton){ this->isPress = true; this->winPos = this->pos(); this->dragPos = event->globalPos(); event->accept(); } } void DlgConnHidWifiWep::mouseReleaseEvent(QMouseEvent *event){ this->isPress = false; } void DlgConnHidWifiWep::mouseMoveEvent(QMouseEvent *event){ if(this->isPress){ this->move(this->winPos - (this->dragPos - event->globalPos())); event->accept(); } } //切换到其他Wi-Fi安全类型 void DlgConnHidWifiWep::changeDialog() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(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(); DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap(); connHidWifiLeap->show(); } else if(ui->cbxSecurity->currentIndex()==5) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(0); connHidWifiSecTls->show(); } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(1); connHidWifiSecTls->show(); } } void DlgConnHidWifiWep::on_btnCancel_clicked() { this->close(); } void DlgConnHidWifiWep::on_btnConnect_clicked() { this->close(); } void DlgConnHidWifiWep::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->leKey->setEchoMode(QLineEdit::Password); } else { ui->leKey->setEchoMode(QLineEdit::Normal); } } void DlgConnHidWifiWep::on_leKey_textEdited(const QString &arg1) { if (ui->leNetName->text() == "" || ui->leKey->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgConnHidWifiWep::on_leNetName_textEdited(const QString &arg1) { if (ui->leNetName->text() == "" || ui->leKey->text() == ""){ ui->btnConnect->setEnabled(false); } else { ui->btnConnect->setEnabled(true); } } void DlgConnHidWifiWep::paintEvent(QPaintEvent *event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlgconnhidwifisecpeap.h0000644000175000017500000000272613636616643021465 0ustar fengfeng#ifndef DLGCONNHIDWIFISECPEAP_H #define DLGCONNHIDWIFISECPEAP_H #include #include namespace Ui { class DlgConnHidWifiSecPeap; } class DlgConnHidWifiSecPeap : public QDialog { Q_OBJECT public: explicit DlgConnHidWifiSecPeap(int type, QWidget *parent = 0); ~DlgConnHidWifiSecPeap(); 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_lePassword_textEdited(const QString &arg1); private: Ui::DlgConnHidWifiSecPeap *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 // DLGCONNHIDWIFISECPEAP_H kylin-nm/wireless-security/dlgconnhidwifisecleap.cpp0000644000175000017500000002474713640637261022015 0ustar fengfeng/* * Copyright (C) 2019 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 DlgConnHidWifiSecLeap::DlgConnHidWifiSecLeap(int type, QWidget *parent) : WepOrWpa(type), QDialog(parent), ui(new Ui::DlgConnHidWifiSecLeap) { ui->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())); 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.btnCancelQss); ui->btnConnect->setStyleSheet(objQss.btnConnQss); 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->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"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgConnHidWifiSecLeap' failed");} QFile file("/tmp/kylin-nm-connshow"); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"Can't open the file!"; } QString txt = file.readAll(); QStringList txtLine = txt.split("\n"); file.close(); foreach (QString line, txtLine) { if(line.indexOf("wifi") != -1){ QStringList subLine = line.split(" "); ui->cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA & 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 & 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); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgConnHidWifiSecLeap::~DlgConnHidWifiSecLeap() { delete ui; } void DlgConnHidWifiSecLeap::mousePressEvent(QMouseEvent *event){ if(event->button() == Qt::LeftButton){ this->isPress = true; this->winPos = this->pos(); this->dragPos = event->globalPos(); event->accept(); } } void DlgConnHidWifiSecLeap::mouseReleaseEvent(QMouseEvent *event){ this->isPress = false; } void DlgConnHidWifiSecLeap::mouseMoveEvent(QMouseEvent *event){ if(this->isPress){ this->move(this->winPos - (this->dragPos - event->globalPos())); event->accept(); } } void DlgConnHidWifiSecLeap::changeDialogSecu() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap(); 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 DlgConnHidWifiSecLeap::changeDialogAuth() { if(ui->cbxAuth->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(WepOrWpa); connHidWifiSecTls->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(); DlgConnHidWifiSecPwd *connHidWifiSecPwd = new DlgConnHidWifiSecPwd(WepOrWpa); connHidWifiSecPwd->show(); } else if(ui->cbxAuth->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecFast *connHidWifiSecFast = new DlgConnHidWifiSecFast(WepOrWpa); connHidWifiSecFast->show(); } else if(ui->cbxAuth->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTunnelTLS *connHidWifiSecTuTls = new DlgConnHidWifiSecTunnelTLS(WepOrWpa); connHidWifiSecTuTls->show(); } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecPeap *connHidWifiSecPeap = new DlgConnHidWifiSecPeap(WepOrWpa); connHidWifiSecPeap->show(); } } void DlgConnHidWifiSecLeap::on_btnCancel_clicked() { this->close(); } void DlgConnHidWifiSecLeap::on_btnConnect_clicked() { this->close(); } void DlgConnHidWifiSecLeap::on_checkBox_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword ->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgConnHidWifiSecLeap::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 DlgConnHidWifiSecLeap::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 DlgConnHidWifiSecLeap::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 DlgConnHidWifiSecLeap::paintEvent(QPaintEvent *event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlgconnhidwifiwpa.ui0000644000175000017500000001345613642570510021011 0ustar fengfeng DlgConnHidWifiWpa 0 0 432 397 Connect to Hidden Wi-Fi Network 76 221 90 20 10 76 176 90 20 10 215 350 90 30 10 175 75 182 32 10 332 272 18 9 10 76 266 90 20 10 175 170 182 32 10 175 261 182 32 10 QLineEdit::Password 315 350 90 30 10 76 80 90 20 10 Qt::LeftToRight 175 215 182 32 10 0 0 432 397 30 30 140 22 10 140 412 1 Qt::Horizontal 10 320 412 1 Qt::Horizontal lbBoder lePassword lbNetName lbSecurity btnCancel cbxConn checkBoxPwd lbPassword cbxSecurity btnConnect lbConn leNetName lbLeftupTitle lineUp lineDown kylin-nm/wireless-security/dlgconnhidwifisecfast.ui0000644000175000017500000002434013636616643021657 0ustar fengfeng DlgConnHidWifiSecFast 0 0 432 673 Connect to Hidden Wi-Fi 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/dlgconnhidwifiwep.h0000644000175000017500000000203713636616643020633 0ustar fengfeng#ifndef DLGCONNHIDWIFIWEP_H #define DLGCONNHIDWIFIWEP_H #include #include namespace Ui { class DlgConnHidWifiWep; } class DlgConnHidWifiWep : public QDialog { Q_OBJECT public: explicit DlgConnHidWifiWep(int type, QWidget *parent = 0); ~DlgConnHidWifiWep(); 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::DlgConnHidWifiWep *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/wireless-security/dlgconnhidwifisecfast.h0000644000175000017500000000235613636616643021474 0ustar fengfeng#ifndef DLGCONNHIDWIFISECFAST_H #define DLGCONNHIDWIFISECFAST_H #include #include namespace Ui { class DlgConnHidWifiSecFast; } class DlgConnHidWifiSecFast : public QDialog { Q_OBJECT public: explicit DlgConnHidWifiSecFast(int type, QWidget *parent = 0); ~DlgConnHidWifiSecFast(); 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::DlgConnHidWifiSecFast *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/dlgconnhidwifisecpwd.h0000644000175000017500000000220513636616643021322 0ustar fengfeng#ifndef DLGCONNHIDWIFISECPWD_H #define DLGCONNHIDWIFISECPWD_H #include #include namespace Ui { class DlgConnHidWifiSecPwd; } class DlgConnHidWifiSecPwd : public QDialog { Q_OBJECT public: explicit DlgConnHidWifiSecPwd(int type, QWidget *parent = 0); ~DlgConnHidWifiSecPwd(); 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::DlgConnHidWifiSecPwd *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/dlgconnhidwifisectunneltls.cpp0000644000175000017500000004067313640637261023120 0ustar fengfeng/* * Copyright (C) 2019 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 DlgConnHidWifiSecTunnelTLS::DlgConnHidWifiSecTunnelTLS(int type, QWidget *parent) : WepOrWpa(type), QDialog(parent), ui(new Ui::DlgConnHidWifiSecTunnelTLS) { ui->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())); 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->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.btnCancelQss); ui->btnConnect->setStyleSheet(objQss.btnConnQss); ui->lineUp->setStyleSheet(objQss.lineQss); ui->lineDown->setStyleSheet(objQss.lineQss); ui->checkBoxCA->setFocusPolicy(Qt::NoFocus); 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->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"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgConnHidWifiSecTunnelTLS' failed");} QFile file("/tmp/kylin-nm-connshow"); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"Can't open the file!"; } QString txt = file.readAll(); QStringList txtLine = txt.split("\n"); file.close(); foreach (QString line, txtLine) { if(line.indexOf("wifi") != -1){ QStringList subLine = line.split(" "); ui->cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA & 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 & 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); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgConnHidWifiSecTunnelTLS::~DlgConnHidWifiSecTunnelTLS() { delete ui; } void DlgConnHidWifiSecTunnelTLS::mousePressEvent(QMouseEvent *event){ if(event->button() == Qt::LeftButton){ this->isPress = true; this->winPos = this->pos(); this->dragPos = event->globalPos(); event->accept(); } } void DlgConnHidWifiSecTunnelTLS::mouseReleaseEvent(QMouseEvent *event){ this->isPress = false; } void DlgConnHidWifiSecTunnelTLS::mouseMoveEvent(QMouseEvent *event){ if(this->isPress){ this->move(this->winPos - (this->dragPos - event->globalPos())); event->accept(); } } void DlgConnHidWifiSecTunnelTLS::changeDialogSecu() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap(); 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 DlgConnHidWifiSecTunnelTLS::changeDialogAuth() { if(ui->cbxAuth->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(WepOrWpa); connHidWifiSecTls->show(); } else if(ui->cbxAuth->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecLeap *connHidWifiSecLeap = new DlgConnHidWifiSecLeap(WepOrWpa); connHidWifiSecLeap->show(); } else if(ui->cbxAuth->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecPwd *connHidWifiSecPwd = new DlgConnHidWifiSecPwd(WepOrWpa); connHidWifiSecPwd->show(); } else if(ui->cbxAuth->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecFast *connHidWifiSecFast = new DlgConnHidWifiSecFast(WepOrWpa); connHidWifiSecFast->show(); } else if(ui->cbxAuth->currentIndex()==4) { qDebug()<<"it's not need to change dialog"; } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecPeap *connHidWifiSecPeap = new DlgConnHidWifiSecPeap(WepOrWpa); connHidWifiSecPeap->show(); } } void DlgConnHidWifiSecTunnelTLS::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 DlgConnHidWifiSecTunnelTLS::on_btnCancel_clicked() { this->close(); } void DlgConnHidWifiSecTunnelTLS::on_btnConnect_clicked() { this->close(); } void DlgConnHidWifiSecTunnelTLS::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->leCaPwd->setEchoMode(QLineEdit::Password); } else { ui->leCaPwd->setEchoMode(QLineEdit::Normal); } } void DlgConnHidWifiSecTunnelTLS::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 DlgConnHidWifiSecTunnelTLS::on_checkBoxPwdSec_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgConnHidWifiSecTunnelTLS::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 DlgConnHidWifiSecTunnelTLS::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 DlgConnHidWifiSecTunnelTLS::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 DlgConnHidWifiSecTunnelTLS::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 DlgConnHidWifiSecTunnelTLS::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 DlgConnHidWifiSecTunnelTLS::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 DlgConnHidWifiSecTunnelTLS::paintEvent(QPaintEvent *event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlgconnhidwifiwep.ui0000644000175000017500000001647013636616643021027 0ustar fengfeng DlgConnHidWifiWep 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/dlgconnhidwifisecpeap.cpp0000644000175000017500000004100313640637261022001 0ustar fengfeng/* * Copyright (C) 2019 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 DlgConnHidWifiSecPeap::DlgConnHidWifiSecPeap(int type, QWidget *parent) : WepOrWpa(type), QDialog(parent), ui(new Ui::DlgConnHidWifiSecPeap) { ui->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())); 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->lbDomain->setStyleSheet(objQss.labelQss); ui->lbCA->setStyleSheet(objQss.labelQss); ui->lbCaPwd->setStyleSheet(objQss.labelQss); ui->lbPEAPver->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->cbxPEAPver->setStyleSheet(objQss.cbxQss); ui->cbxPEAPver->setView(new QListView()); 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.btnCancelQss); ui->btnConnect->setStyleSheet(objQss.btnConnQss); 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->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->cbxConn->addItem("新建..."); int status = system("nmcli connection show>/tmp/kylin-nm-connshow"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgConnHidWifiSecPeap' failed");} QFile file("/tmp/kylin-nm-connshow"); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"Can't open the file!"; } QString txt = file.readAll(); QStringList txtLine = txt.split("\n"); file.close(); foreach (QString line, txtLine) { if(line.indexOf("wifi") != -1){ QStringList subLine = line.split(" "); ui->cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA & 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 & 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(5); 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); ui->btnConnect->setEnabled(false); this->setFixedSize(432,700); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgConnHidWifiSecPeap::~DlgConnHidWifiSecPeap() { delete ui; } void DlgConnHidWifiSecPeap::mousePressEvent(QMouseEvent *event){ if(event->button() == Qt::LeftButton){ this->isPress = true; this->winPos = this->pos(); this->dragPos = event->globalPos(); event->accept(); } } void DlgConnHidWifiSecPeap::mouseReleaseEvent(QMouseEvent *event){ this->isPress = false; } void DlgConnHidWifiSecPeap::mouseMoveEvent(QMouseEvent *event){ if(this->isPress){ this->move(this->winPos - (this->dragPos - event->globalPos())); event->accept(); } } void DlgConnHidWifiSecPeap::changeDialogSecu() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(1); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiLeap *connHidWifiLeap = new DlgConnHidWifiLeap(); 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 DlgConnHidWifiSecPeap::changeDialogAuth() { if(ui->cbxAuth->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(WepOrWpa); connHidWifiSecTls->show(); } else if(ui->cbxAuth->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecLeap *connHidWifiSecLeap = new DlgConnHidWifiSecLeap(WepOrWpa); connHidWifiSecLeap->show(); } else if(ui->cbxAuth->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecPwd *connHidWifiSecPwd = new DlgConnHidWifiSecPwd(WepOrWpa); connHidWifiSecPwd->show(); } else if(ui->cbxAuth->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecFast *connHidWifiSecFast = new DlgConnHidWifiSecFast(WepOrWpa); connHidWifiSecFast->show(); } else if(ui->cbxAuth->currentIndex()==4) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTunnelTLS *connHidWifiSecTuTls = new DlgConnHidWifiSecTunnelTLS(WepOrWpa); connHidWifiSecTuTls->show(); } else { qDebug()<<"it's not need to change dialog"; } } void DlgConnHidWifiSecPeap::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 DlgConnHidWifiSecPeap::on_btnCancel_clicked() { this->close(); } void DlgConnHidWifiSecPeap::on_btnConnect_clicked() { this->close(); } void DlgConnHidWifiSecPeap::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->leCaPwd->setEchoMode(QLineEdit::Password); } else { ui->leCaPwd->setEchoMode(QLineEdit::Normal); } } void DlgConnHidWifiSecPeap::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 DlgConnHidWifiSecPeap::on_checkBoxPwdSec_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgConnHidWifiSecPeap::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 DlgConnHidWifiSecPeap::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 DlgConnHidWifiSecPeap::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 DlgConnHidWifiSecPeap::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 DlgConnHidWifiSecPeap::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 DlgConnHidWifiSecPeap::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->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 DlgConnHidWifiSecPeap::paintEvent(QPaintEvent *event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlgconnhidwifileap.cpp0000644000175000017500000002075413640637261021314 0ustar fengfeng/* * Copyright (C) 2019 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 DlgConnHidWifiLeap::DlgConnHidWifiLeap(QWidget *parent) : QDialog(parent), ui(new Ui::DlgConnHidWifiLeap) { ui->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())); 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->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.btnCancelQss); ui->btnConnect->setStyleSheet(objQss.btnConnQss); 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"); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection show' in function 'DlgConnHidWifiLeap' failed");} QFile file("/tmp/kylin-nm-connshow"); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"Can't open the file!"; } QString txt = file.readAll(); QStringList txtLine = txt.split("\n"); file.close(); foreach (QString line, txtLine) { if(line.indexOf("wifi") != -1){ QStringList subLine = line.split(" "); ui->cbxConn->addItem(subLine[0]); } } ui->cbxConn->setCurrentIndex(0); ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA & 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 & 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); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgConnHidWifiLeap::~DlgConnHidWifiLeap() { delete ui; } void DlgConnHidWifiLeap::mousePressEvent(QMouseEvent *event){ if(event->button() == Qt::LeftButton){ this->isPress = true; this->winPos = this->pos(); this->dragPos = event->globalPos(); event->accept(); } } void DlgConnHidWifiLeap::mouseReleaseEvent(QMouseEvent *event){ this->isPress = false; } void DlgConnHidWifiLeap::mouseMoveEvent(QMouseEvent *event){ if(this->isPress){ this->move(this->winPos - (this->dragPos - event->globalPos())); event->accept(); } } //切换到其他Wi-Fi安全类型 void DlgConnHidWifiLeap::changeDialog() { if(ui->cbxSecurity->currentIndex()==0){ QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifi *connHidWifi = new DlgConnHidWifi(0); connHidWifi->show(); } else if(ui->cbxSecurity->currentIndex()==1) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWpa *connHidWifiWpa = new DlgConnHidWifiWpa(0); connHidWifiWpa->show(); } else if(ui->cbxSecurity->currentIndex()==2) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(0); connHidWifiWep->show(); } else if(ui->cbxSecurity->currentIndex()==3) { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiWep *connHidWifiWep = new DlgConnHidWifiWep(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(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(0); connHidWifiSecTls->show(); } else { QApplication::setQuitOnLastWindowClosed(false); this->hide(); DlgConnHidWifiSecTls *connHidWifiSecTls = new DlgConnHidWifiSecTls(1); connHidWifiSecTls->show(); } } void DlgConnHidWifiLeap::on_btnCancel_clicked() { this->close(); } void DlgConnHidWifiLeap::on_btnConnect_clicked() { this->close(); } void DlgConnHidWifiLeap::on_checkBoxPwd_stateChanged(int arg1) { if (arg1 == 0) { ui->lePassword ->setEchoMode(QLineEdit::Password); } else { ui->lePassword->setEchoMode(QLineEdit::Normal); } } void DlgConnHidWifiLeap::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 DlgConnHidWifiLeap::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 DlgConnHidWifiLeap::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 DlgConnHidWifiLeap::paintEvent(QPaintEvent *event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QWidget::paintEvent(event); } kylin-nm/wireless-security/dlgconnhidwifiwpa.h0000644000175000017500000000256713636616643020637 0ustar fengfeng#ifndef DLGCONNHIDWIFIWPA_H #define DLGCONNHIDWIFIWPA_H #include #include #include class MainWindow; namespace Ui { class DlgConnHidWifiWpa; } class DlgConnHidWifiWpa : public QDialog { Q_OBJECT public: explicit DlgConnHidWifiWpa(int type, MainWindow *mw = 0, QWidget *parent = 0); ~DlgConnHidWifiWpa(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialog(); void changeWindow(); void emitSignal(); void on_execSecConn(); void slotStartLoading(); 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_lePassword_textEdited(const QString &arg1); signals: void reSetWifiList(); void sendMessage(); void execSecConn(); void stopSignal(); private: Ui::DlgConnHidWifiWpa *ui; 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; }; #endif // DLGCONNHIDWIFIWPA_H kylin-nm/wireless-security/dlgconnhidwifi.h0000644000175000017500000000235513636616643020122 0ustar fengfeng#ifndef DLGCONNHIDWIFI_H #define DLGCONNHIDWIFI_H #include #include #include #include #include class MainWindow; namespace Ui { class DlgConnHidWifi; } class DlgConnHidWifi : public QDialog { Q_OBJECT public: explicit DlgConnHidWifi(int type, MainWindow *mw = 0, QWidget *parent = 0); ~DlgConnHidWifi(); protected: void paintEvent(QPaintEvent *event); public slots: void changeDialog(); void changeWindow(); void emitSignal(); void on_execSecConn(); void slotStartLoading(); private slots: void on_btnCancel_clicked(); void on_btnConnect_clicked(); void on_leNetName_textEdited(const QString &arg1); signals: void reSetWifiList(); void sendMessage(); void execSecConn(); void stopSignal(); private: Ui::DlgConnHidWifi *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/kylinheadfile.cpp0000644000175000017500000000430513636616643020272 0ustar fengfeng#include "kylinheadfile.h" MyQss::MyQss() { 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{border-radius:0px;font-size:13px;color:rgba(255,255,255,0.91);height: 32px;background-color:#48484C;outline:0px;}" "QComboBox QAbstractItemView::item:hover{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);}"; 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);}"; checkBoxCAQss = "QCheckBox{boder:none;color:rgba(255,255,255,0.97);background-color:transparent;}"; btnCancelQss = "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);}"; btnConnQss = "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);}"; lineQss = "background:rgba(255,255,255,0.08);"; } kylin-nm/wireless-security/dlgconnhidwifisectunneltls.h0000644000175000017500000000277113636616643022570 0ustar fengfeng#ifndef DLGCONNHIDWIFISECTUNNELTLS_H #define DLGCONNHIDWIFISECTUNNELTLS_H #include #include namespace Ui { class DlgConnHidWifiSecTunnelTLS; } class DlgConnHidWifiSecTunnelTLS : public QDialog { Q_OBJECT public: explicit DlgConnHidWifiSecTunnelTLS(int type, QWidget *parent = 0); ~DlgConnHidWifiSecTunnelTLS(); 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::DlgConnHidWifiSecTunnelTLS *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/kylinheadfile.h0000644000175000017500000000124213636616643017734 0ustar fengfeng#ifndef KYLINHEADFILE_H #define KYLINHEADFILE_H #include "dlgconnhidwifi.h" #include "dlgconnhidwifileap.h" #include "dlgconnhidwifisecfast.h" #include "dlgconnhidwifisecleap.h" #include "dlgconnhidwifisecpeap.h" #include "dlgconnhidwifisecpwd.h" #include "dlgconnhidwifisectls.h" #include "dlgconnhidwifisectunneltls.h" #include "dlgconnhidwifiwep.h" #include "dlgconnhidwifiwpa.h" #include #include #include #include #include #include class MyQss { public: MyQss(); QString labelQss, cbxQss, leQss, btnConnQss, btnCancelQss, lineQss, checkBoxQss, checkBoxCAQss; }; #endif // KYLINHEADFILE_H