diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp index f56414e..048f9f6 100644 --- a/src/lockwidget.cpp +++ b/src/lockwidget.cpp @@ -173,16 +173,16 @@ bool LockWidget::eventFilter(QObject *obj, QEvent *event) } } - if(event->type() == QEvent::WindowActivate){ + if(event->type() == QEvent::WindowActivate || event->type() == 8){ // QEvent::FocusIn if(!isNetFinished){ - isNetFinished = true; + isNetFinished = true; QTimer::singleShot(2000, this, [=](){ - m_kylinNM = new KylinNM(this); + m_kylinNM = new KylinNM(this); m_kylinNM->installEventFilter(this); - connect(m_kylinNM, &KylinNM::onConnectChanged, this,[=](){ + connect(m_kylinNM, &KylinNM::onConnectChanged, this,[=](){ updateNetIcon(m_kylinNM->getConnectStatus()); }); - m_kylinNM->hide(); + m_kylinNM->hide(); QtConcurrent::run([=](){ updateNetIcon(getNetStatus()); }); @@ -671,9 +671,9 @@ void LockWidget::initUI() QDBusInterface *powerInterface = new QDBusInterface( "org.ukui.upower", "/upower", "org.ukui.upower", QDBusConnection::sessionBus(), this); if (batInterface->isValid()) { - QDBusReply reply = powerInterface->call("MachineType"); + QDBusReply reply = powerInterface->call("MachineType"); if (reply.isValid()) { - if ("book" == reply.value()) { + if (1 == reply.value()) { QDBusReply iconreply = batInterface->call("IconName"); setBatteryIcon(iconreply.value()); QDBusConnection::sessionBus().connect( @@ -1004,7 +1004,6 @@ void LockWidget::showNetManager(bool keynavigation) if(!m_kylinNM){ return; } - if(m_kylinNM->isVisible()) { setCheckedSheet(NETWORKBTN, false);