trayIcon and itemshow bug

This commit is contained in:
king 2021-10-13 21:05:32 +08:00
parent b1690dc2ec
commit d2e035ed8a
5 changed files with 38 additions and 32 deletions

View File

@ -81,6 +81,32 @@ free_wifi_info (SecretsRequest *req)
}
}
void
applet_secrets_request_free (SecretsRequest *req)
{
g_return_if_fail (req != NULL);
if (req->free_func)
req->free_func (req);
secrets_reqs = g_slist_remove (secrets_reqs, req);
g_object_unref (req->connection);
g_free (req->setting_name);
g_strfreev (req->hints);
memset (req, 0, req->totsize);
g_free (req);
}
void
applet_secrets_request_complete (SecretsRequest *req,
GVariant *settings,
GError *error)
{
req->callback (req->agent, error ? NULL : settings, error, req->callback_data);
}
static void
get_secrets_dialog_response_cb (GtkDialog *foo,
gint response,
@ -230,24 +256,6 @@ l_out:
//return 0;
}
void
applet_secrets_request_free (SecretsRequest *req)
{
g_return_if_fail (req != NULL);
if (req->free_func)
req->free_func (req);
secrets_reqs = g_slist_remove (secrets_reqs, req);
g_object_unref (req->connection);
g_free (req->setting_name);
g_strfreev (req->hints);
memset (req, 0, req->totsize);
g_free (req);
}
static SecretsRequest *
applet_secrets_request_new (size_t totsize,
NMConnection *connection,
@ -277,15 +285,6 @@ applet_secrets_request_new (size_t totsize,
return req;
}
void
applet_secrets_request_complete (SecretsRequest *req,
GVariant *settings,
GError *error)
{
req->callback (req->agent, error ? NULL : settings, error, req->callback_data);
}
static void
get_existing_secrets_cb (NMSecretAgentOld *agent,
NMConnection *connection,

View File

@ -151,6 +151,7 @@ void MainWindow::initTrayIcon()
m_trayIconMenu->addAction(m_showSettingsAction);
m_trayIcon->setContextMenu(m_trayIconMenu);
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-signal-excellent-symbolic"));
onRefreshTrayIcon();
connect(m_trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::onTrayIconActivated);
// connect(m_showMainwindowAction, &QAction::triggered, this, &MainWindow::onShowMainwindowActionTriggled);

View File

@ -766,8 +766,6 @@ void LanPage::updateConnectionArea(QString uuid)
qDebug()<<"[LanPage] update connection item"<<p_newItem->m_connectName;
QListWidgetItem *p_listWidgetItem = addNewItem(p_newItem, m_inactivatedLanListWidget);
m_deactiveMap.insert(p_newItem, p_listWidgetItem);
emit this->lanConnectChanged();
} else {
delete p_newItem;
p_newItem = nullptr;
@ -790,8 +788,12 @@ void LanPage::onUpdateLanlist(QString uuid,
if (state == NetworkManager::ActiveConnection::State::Activated) {
updateActivatedConnectionArea(uuid);
m_isLanConnected = true;
emit this->lanConnectChanged();
} else if (state == NetworkManager::ActiveConnection::State::Deactivated) {
updateConnectionArea(uuid);
m_isLanConnected = false;
emit this->lanConnectChanged();
}
return;
@ -1040,7 +1042,6 @@ void LanPage::activateWired(const QString& devName, const QString& connUuid)
{
qDebug() << "[LanPage] activateWired" << devName << connUuid;
m_wiredConnectOperation->activateConnection(connUuid, devName);
emit this->lanConnectChanged();
}
void LanPage::deactivateWired(const QString& devName, const QString& connUuid)

View File

@ -254,6 +254,8 @@ void WlanPage::getActiveWlan()
m_activatedWlanSSid.clear();
m_activatedWlanUuid.clear();
WlanListItem *wlanItemWidget = new WlanListItem();
connect(wlanItemWidget, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
connect(wlanItemWidget, &WlanListItem::connectButtonClicked, this, &WlanPage::onConnectButtonClicked);
qDebug() << "There is no activated wlan." << Q_FUNC_INFO << __LINE__ ;
QListWidgetItem *wlanItem = new QListWidgetItem();
wlanItem->setSizeHint(QSize(m_activatedNetListWidget->width(), wlanItemWidget->height()));
@ -277,11 +279,12 @@ void WlanPage::appendActiveWlan(const QString &uuid, int &height)
}
KyWirelessNetItem *item_data = new KyWirelessNetItem(data);
WlanListItem *wlanItemWidget = new WlanListItem(m_resource, item_data, m_defaultDevice);
connect(wlanItemWidget, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
connect(wlanItemWidget, &WlanListItem::connectButtonClicked, this, &WlanPage::onConnectButtonClicked);
qDebug() << "Activated wlan: ssid = " << item_data->m_NetSsid;
QListWidgetItem *wlanItem = new QListWidgetItem();
wlanItem->setSizeHint(QSize(m_activatedNetListWidget->width(), wlanItemWidget->height()));
m_activatedNetListWidget->addItem(wlanItem);
emit this->wlanConnectChanged();
qDebug() << "[wlanpage]emit wlanConnectChanged()" << Q_FUNC_INFO << __LINE__ ;
m_activatedNetListWidget->setItemWidget(wlanItem, wlanItemWidget);
wlanItemWidget->setActive(true);
@ -493,9 +496,11 @@ void WlanPage::onActivatedWlanChanged(QString uuid, NetworkManager::ActiveConnec
if(NetworkManager::ActiveConnection::State::Activated == state){
m_wlanIsConnected = true;
qDebug() << "[wlanpage] wlanIsConnected status : " << m_wlanIsConnected << Q_FUNC_INFO << __LINE__ ;
emit this->wlanConnectChanged();
} else {
m_wlanIsConnected = false;
qDebug() << "[wlanpage] wlanIsConnected status : " << m_wlanIsConnected << Q_FUNC_INFO << __LINE__ ;
emit this->wlanConnectChanged();
}
//弹窗显示wifi连接状况

View File

@ -83,7 +83,7 @@ int main(int argc, char *argv[])
// QApplication a(argc, argv);
QString id = QString("kylin-nm"+ QLatin1String(getenv("DISPLAY")));
QtSingleApplication a(id, argc, argv);
qInstallMessageHandler(messageOutput);
// qInstallMessageHandler(messageOutput);
if (a.isRunning()) {
auto connection = QDBusConnection::sessionBus();
QDBusInterface iface("com.kylin.network",