This commit is contained in:
shine 2019-04-15 11:15:18 +08:00
parent a4be8da40b
commit be0591944d
4 changed files with 27 additions and 2 deletions

View File

@ -55,7 +55,7 @@ IFace* BackThread::execGetIface(){
if(istateStr == "unmanaged"){
iface->lstate = 2;
}
if(istateStr == "disconnected"){
if(istateStr == "disconnected" || istateStr == "unavailable"){
iface->lstate = 1;
}
if(istateStr == "connected"){
@ -94,7 +94,7 @@ void BackThread::execDisNet(){
}
void BackThread::execEnWifi(){
system("nmcli radio wifi on;sleep 5");
system("nmcli radio wifi on;sleep 6");
emit enWifiDone();
emit btFinish();
}

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
kylin-nm (1.0.2-0ubuntu1) disco; urgency=medium
* Fix bugs #1823843 #1823844 #1823845.
-- handsome_feng <jianfengli@ubuntukylin.com> Mon, 15 Apr 2019 11:12:31 +0800
kylin-nm (1.0.1-0ubuntu1) disco; urgency=medium
* Fix some interactive and logic bugs.

View File

@ -30,6 +30,8 @@ MainWindow::MainWindow(QWidget *parent) :
{
ui->setupUi(this);
checkSingle();
// 如果使用Qt::Popup 任务栏不显示且保留X事件如XCB_FOCUS_OUT, 但如果indicator点击鼠标右键触发XCB_FOCUS_OUT事件依然会失效
// 如果使用Qt::ToolTip, Qt::Tool + Qt::WindowStaysOnTopHint, Qt::X11BypassWindowManagerHint等flag则会导致X事件失效
// this->setWindowFlags(Qt::Popup);
@ -140,6 +142,18 @@ MainWindow::~MainWindow()
delete ui;
}
void MainWindow::checkSingle(){
int fd = open("/tmp/kylin-nm-lock", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (fd < 0) {
exit(1);
}
if (lockf(fd, F_TLOCK, 0)) {
qDebug()<<"can't lock single file, exit.";
exit(0);
}
}
bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result){
Q_UNUSED(result);

View File

@ -32,6 +32,10 @@
#include <QDebug>
#include <QString>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <xcb/xcb.h>
#include "ksimplenm.h"
@ -64,6 +68,7 @@ public:
QList<QIcon> loadIcons;
private:
void checkSingle();
void getActiveInfo();
void getIface();
void createTrayIcon();