Merge branch 'xcbug3' into 'yhkylin/v101-tablet'

fix bug 144990 145707

See merge request kylinos-src/kylin-nm!27
This commit is contained in:
翟康宁 2022-11-02 10:06:03 +00:00
commit 110d6c0bad
10 changed files with 99 additions and 9 deletions

View File

@ -32,6 +32,9 @@
#define ITEMHEIGH 50 #define ITEMHEIGH 50
#define LAN_TYPE 0 #define LAN_TYPE 0
#define CONTROL_CENTER_WIFI "org.ukui.control-center.wifi.switch" #define CONTROL_CENTER_WIFI "org.ukui.control-center.wifi.switch"
#define KYLIN_APP_MANAGER_NAME "com.kylin.AppManager"
#define KYLIN_APP_MANAGER_PATH "/com/kylin/AppManager"
#define KYLIN_APP_MANAGER_INTERFACE "com.kylin.AppManager"
const QString KLanSymbolic = "network-wired-connected-symbolic"; const QString KLanSymbolic = "network-wired-connected-symbolic";
const QString NoNetSymbolic = "network-wired-disconnected-symbolic"; const QString NoNetSymbolic = "network-wired-disconnected-symbolic";
@ -350,9 +353,10 @@ void NetConnect::initNet()
} }
void NetConnect::runExternalApp() { void NetConnect::runExternalApp() {
QString cmd = "nm-connection-editor"; // QString cmd = "nm-connection-editor";
QProcess process(this); // QProcess process(this);
process.startDetached(cmd); // process.startDetached(cmd);
LaunchApp("nm-connection-editor.desktop");
} }
//刪除 //刪除
@ -928,3 +932,19 @@ int NetConnect::getInsertPos(QString connName, QString deviceName)
} }
return index; return index;
} }
bool NetConnect::LaunchApp(QString desktopFile)
{
QDBusInterface m_appManagerDbusInterface(KYLIN_APP_MANAGER_NAME,
KYLIN_APP_MANAGER_PATH,
KYLIN_APP_MANAGER_INTERFACE,
QDBusConnection::sessionBus());//局部变量
if (!m_appManagerDbusInterface.isValid()) {
qWarning()<<"m_appManagerDbusInterface init error";
return false;
} else {
QDBusReply<bool> reply =m_appManagerDbusInterface.call("LaunchApp",desktopFile);
return reply;
}
}

View File

@ -123,6 +123,7 @@ private:
//单个lan连接状态变化 //单个lan连接状态变化
void itemActiveConnectionStatusChanged(LanItem *item, int status); void itemActiveConnectionStatusChanged(LanItem *item, int status);
bool LaunchApp(QString desktopFile);
protected: protected:
bool eventFilter(QObject *w,QEvent *e); bool eventFilter(QObject *w,QEvent *e);

View File

@ -99,6 +99,9 @@ const QString KApSymbolic = "network-wireless-hotspot-symbolic";
const QString IsApConnection = "1"; const QString IsApConnection = "1";
#define KYLIN_APP_MANAGER_NAME "com.kylin.AppManager"
#define KYLIN_APP_MANAGER_PATH "/com/kylin/AppManager"
#define KYLIN_APP_MANAGER_INTERFACE "com.kylin.AppManager"
#define ACTIVATING 1 #define ACTIVATING 1
#define ACTIVATED 2 #define ACTIVATED 2
@ -713,6 +716,22 @@ void WlanConnect::initSwtichState()
setSwitchBtnState(state); setSwitchBtnState(state);
} }
bool WlanConnect::LaunchApp(QString desktopFile)
{
QDBusInterface m_appManagerDbusInterface(KYLIN_APP_MANAGER_NAME,
KYLIN_APP_MANAGER_PATH,
KYLIN_APP_MANAGER_INTERFACE,
QDBusConnection::sessionBus());//局部变量
if (!m_appManagerDbusInterface.isValid()) {
qWarning()<<"m_appManagerDbusInterface init error";
return false;
} else {
QDBusReply<bool> reply =m_appManagerDbusInterface.call("LaunchApp",desktopFile);
return reply;
}
}
//初始化整体列表和单设备列表 //初始化整体列表和单设备列表
void WlanConnect::initNet() { void WlanConnect::initNet() {
// int count = 1; // int count = 1;
@ -776,9 +795,10 @@ void WlanConnect::initNetListFromDevice(QString deviceName)
//高级设置 //高级设置
void WlanConnect::runExternalApp() { void WlanConnect::runExternalApp() {
QString cmd = "nm-connection-editor"; // QString cmd = "nm-connection-editor";
QProcess process(this); // QProcess process(this);
process.startDetached(cmd); // process.startDetached(cmd);
LaunchApp("nm-connection-editor.desktop");
} }
//根据信号强度分级+安全性分图标 //根据信号强度分级+安全性分图标

View File

@ -149,6 +149,7 @@ private:
} }
} }
bool LaunchApp(QString desktopFile);
protected: protected:
bool eventFilter(QObject *w,QEvent *e); bool eventFilter(QObject *w,QEvent *e);

View File

@ -33,6 +33,8 @@
#define SCROAREA_WIDTH 480 #define SCROAREA_WIDTH 480
#define MEDIUM_WEIGHT_VALUE 57 #define MEDIUM_WEIGHT_VALUE 57
bool LaunchApp(QString desktopFile);
JoinHiddenWiFiPage::JoinHiddenWiFiPage(QString devName, KDialog *parent) JoinHiddenWiFiPage::JoinHiddenWiFiPage(QString devName, KDialog *parent)
:m_devName(devName), :m_devName(devName),
KDialog(parent) KDialog(parent)
@ -52,9 +54,19 @@ JoinHiddenWiFiPage::~JoinHiddenWiFiPage()
} }
void JoinHiddenWiFiPage::setJoinHiddenWiFiShowed(bool state)
{
m_joinHiddenWiFiShowed = state;
}
void JoinHiddenWiFiPage::closeEvent(QCloseEvent *event) void JoinHiddenWiFiPage::closeEvent(QCloseEvent *event)
{ {
Q_EMIT this->hiddenWiFiPageClose(m_devName); Q_EMIT this->hiddenWiFiPageClose(m_devName);
if (m_joinHiddenWiFiShowed) {
LaunchApp("ukui-control-center.desktop");
m_joinHiddenWiFiShowed = false;
}
return QWidget::closeEvent(event); return QWidget::closeEvent(event);
} }

View File

@ -43,6 +43,8 @@ public:
JoinHiddenWiFiPage(QString devName, KDialog *parent = nullptr); JoinHiddenWiFiPage(QString devName, KDialog *parent = nullptr);
~JoinHiddenWiFiPage(); ~JoinHiddenWiFiPage();
void setJoinHiddenWiFiShowed(bool state);
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
@ -78,6 +80,7 @@ private:
bool m_isJoinBtnEnable = false; bool m_isJoinBtnEnable = false;
bool m_isSecuOk = false; bool m_isSecuOk = false;
bool m_joinHiddenWiFiShowed = false;
ConInfo m_info; ConInfo m_info;
private Q_SLOTS: private Q_SLOTS:

View File

@ -56,9 +56,28 @@
#define PEAP_SCRO_HEIGHT 300 #define PEAP_SCRO_HEIGHT 300
#define TLS_SCRO_HEIGHT 480 #define TLS_SCRO_HEIGHT 480
#define MAX_TAB_TEXT_LENGTH 44 #define MAX_TAB_TEXT_LENGTH 44
#define KYLIN_APP_MANAGER_NAME "com.kylin.AppManager"
#define KYLIN_APP_MANAGER_PATH "/com/kylin/AppManager"
#define KYLIN_APP_MANAGER_INTERFACE "com.kylin.AppManager"
//extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); //extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
bool LaunchApp(QString desktopFile)
{
QDBusInterface m_appManagerDbusInterface(KYLIN_APP_MANAGER_NAME,
KYLIN_APP_MANAGER_PATH,
KYLIN_APP_MANAGER_INTERFACE,
QDBusConnection::sessionBus());//局部变量
if (!m_appManagerDbusInterface.isValid()) {
qWarning()<<"m_appManagerDbusInterface init error";
return false;
} else {
QDBusReply<bool> reply =m_appManagerDbusInterface.call("LaunchApp",desktopFile);
return reply;
}
}
void NetDetail::showDesktopNotify(const QString &message, QString soundName) void NetDetail::showDesktopNotify(const QString &message, QString soundName)
{ {
QDBusInterface iface("org.freedesktop.Notifications", QDBusInterface iface("org.freedesktop.Notifications",
@ -265,6 +284,11 @@ void NetDetail::closeEvent(QCloseEvent *event)
{ {
Q_EMIT this->detailPageClose(false); Q_EMIT this->detailPageClose(false);
Q_EMIT this->createPageClose(m_deviceName); Q_EMIT this->createPageClose(m_deviceName);
if (m_hasDetailPageShowed) {
LaunchApp("ukui-control-center.desktop");
m_hasDetailPageShowed = false;
}
return QWidget::closeEvent(event); return QWidget::closeEvent(event);
} }
@ -411,6 +435,7 @@ void NetDetail::loadPage()
pageFrame->hide(); pageFrame->hide();
stackWidget->setCurrentIndex(CREATE_NET_PAGE_NUM); stackWidget->setCurrentIndex(CREATE_NET_PAGE_NUM);
this->setWindowTitle(tr("Add Lan Connect")); this->setWindowTitle(tr("Add Lan Connect"));
setDetailPageShowed(true);
} else { } else {
stackWidget->setCurrentIndex(DETAIL_PAGE_NUM); stackWidget->setCurrentIndex(DETAIL_PAGE_NUM);
this->setWindowTitle(m_name); this->setWindowTitle(m_name);
@ -1120,6 +1145,11 @@ bool NetDetail::eventFilter(QObject *w, QEvent *event)
return QWidget::eventFilter(w, event); return QWidget::eventFilter(w, event);
} }
void NetDetail::setDetailPageShowed(bool state)
{
m_hasDetailPageShowed = state;
}
void NetDetail::setNetTabToolTip() void NetDetail::setNetTabToolTip()
{ {
int tabCount = m_netTabBar->count(); int tabCount = m_netTabBar->count();

View File

@ -100,6 +100,8 @@ public:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
bool eventFilter(QObject *w, QEvent *event); bool eventFilter(QObject *w, QEvent *event);
void setDetailPageShowed(bool state);
private: private:
void initUI(); void initUI();
void centerToScreen(); void centerToScreen();
@ -184,7 +186,7 @@ private:
bool isIpv6Ok; bool isIpv6Ok;
bool isSecuOk; bool isSecuOk;
bool isConfirmBtnEnable; bool isConfirmBtnEnable;
bool m_hasDetailPageShowed = false;
ConInfo m_info; ConInfo m_info;
ThreadObject *m_object; ThreadObject *m_object;

View File

@ -1265,6 +1265,7 @@ void LanPage::showDetailPage(QString devName, QString uuid)
NetDetail *netDetail = new NetDetail(devName, p_item->m_connectName, uuid, isActive, false, false); NetDetail *netDetail = new NetDetail(devName, p_item->m_connectName, uuid, isActive, false, false);
netDetail->show(); netDetail->show();
netDetail->setDetailPageShowed(true);
delete p_item; delete p_item;
p_item = nullptr; p_item = nullptr;

View File

@ -1099,7 +1099,7 @@ void WlanPage::requestScan()
void WlanPage::onHiddenWlanClicked() void WlanPage::onHiddenWlanClicked()
{ {
// qDebug() << "[wlanPage] AddHideWifi Clicked! " << Q_FUNC_INFO << __LINE__ ; qDebug() << "[wlanPage] AddHideWifi Clicked! " << Q_FUNC_INFO << __LINE__ ;
// NetDetail *netDetail = new NetDetail(m_currentDevice, "", "", false, true, true); // NetDetail *netDetail = new NetDetail(m_currentDevice, "", "", false, true, true);
// netDetail->show(); // netDetail->show();
if(m_hiddenWiFi != nullptr){ if(m_hiddenWiFi != nullptr){
@ -1486,7 +1486,7 @@ void WlanPage::showDetailPage(QString devName, QString ssid)
NetDetail *netDetail = new NetDetail(devName, ssid, wirelessNetItem.m_connectUuid, isActive, true, !wirelessNetItem.m_isConfigured); NetDetail *netDetail = new NetDetail(devName, ssid, wirelessNetItem.m_connectUuid, isActive, true, !wirelessNetItem.m_isConfigured);
netDetail->show(); netDetail->show();
netDetail->setDetailPageShowed(true);
return; return;
} }