Commit 15d4c4e9 authored by Lamarque Souza's avatar Lamarque Souza
Browse files

Try to prevent gsm connection access technology change from freezing

plasma-desktop for a few seconds.
There are some other changes for wifi connections as well.

CCBUG: 286424
parent 4714f5b7
......@@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QAction>
#include <QLabel>
#include <QGraphicsGridLayout>
#include <QTimer>
#include <KGlobalSettings>
#include <KIcon>
......@@ -47,7 +48,7 @@ GsmInterfaceConnectionItem::GsmInterfaceConnectionItem(RemoteGsmInterfaceConnect
{
connect(remote, SIGNAL(signalQualityChanged(int)), this, SLOT(setQuality(int)));
connect(remote, SIGNAL(accessTechnologyChanged(const int)), this, SLOT(setAccessTechnology(const int)));
connect(remote, SIGNAL(changed()), SLOT(update()));
connect(remote, SIGNAL(changed()), SLOT(updateGsmInfo()));
connect(remote, SIGNAL(activationStateChanged(Knm::InterfaceConnection::ActivationState, Knm::InterfaceConnection::ActivationState)),
this, SLOT(activationStateChanged(Knm::InterfaceConnection::ActivationState, Knm::InterfaceConnection::ActivationState)));
m_state = Knm::InterfaceConnection::Unknown;
......@@ -102,9 +103,8 @@ void GsmInterfaceConnectionItem::setupItem()
RemoteGsmInterfaceConnection * remoteconnection = qobject_cast<RemoteGsmInterfaceConnection*>(m_activatable);
if (remoteconnection) {
m_connectButton->setIcon(remoteconnection->iconName());
setAccessTechnology(remoteconnection->getAccessTechnology());
m_connectButton->setText(remoteconnection->connectionName());
m_strengthMeter->setValue(remoteconnection->getSignalQuality());
m_strengthMeter->setToolTip(i18n("Signal quality: %1%", remoteconnection->getSignalQuality()));
activationStateChanged(Knm::InterfaceConnection::Unknown, remoteconnection->activationState());
} else {
m_connectButton->setIcon("network-wired");
......@@ -129,7 +129,7 @@ void GsmInterfaceConnectionItem::setupItem()
connect(m_connectButton, SIGNAL(clicked()), this, SLOT(emitClicked()));
m_layoutIsDirty = true;
update();
QTimer::singleShot(0, this, SLOT(updateGsmInfo()));
}
GsmInterfaceConnectionItem::~GsmInterfaceConnectionItem()
......@@ -175,12 +175,13 @@ void GsmInterfaceConnectionItem::activationStateChanged(Knm::InterfaceConnection
update();
}
void GsmInterfaceConnectionItem::update()
void GsmInterfaceConnectionItem::updateGsmInfo()
{
RemoteGsmInterfaceConnection * remote = qobject_cast<RemoteGsmInterfaceConnection*>(m_activatable);
if (remote) {
setQuality(remote->getSignalQuality());
setAccessTechnology(remote->getAccessTechnology());
update();
}
}
......
......@@ -50,7 +50,7 @@ class GsmInterfaceConnectionItem : public ActivatableItem
private Q_SLOTS:
void setQuality(int quality);
void setAccessTechnology(const int tech);
void update();
void updateGsmInfo();
void activationStateChanged(Knm::InterfaceConnection::ActivationState oldState, Knm::InterfaceConnection::ActivationState newState);
private:
......
......@@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QAction>
#include <QLabel>
#include <QGraphicsGridLayout>
#include <QTimer>
#include <KGlobalSettings>
#include <KIcon>
......@@ -52,7 +53,7 @@ WirelessNetworkItem::WirelessNetworkItem(RemoteWirelessNetwork * remote, QGraphi
{
m_wirelessStatus = new WirelessStatus(remote);
connect(m_wirelessStatus, SIGNAL(strengthChanged(int)), this, SLOT(setStrength(int)));
connect(m_remote, SIGNAL(changed()), SLOT(update()));
connect(m_remote, SIGNAL(changed()), SLOT(updateWifiInfo()));
connect(remote, SIGNAL(activationStateChanged(Knm::InterfaceConnection::ActivationState, Knm::InterfaceConnection::ActivationState)),
this, SLOT(activationStateChanged(Knm::InterfaceConnection::ActivationState, Knm::InterfaceConnection::ActivationState)));
m_state = Knm::InterfaceConnection::Unknown;
......@@ -143,7 +144,7 @@ void WirelessNetworkItem::setupItem()
connect(m_connectButton, SIGNAL(clicked()), this, SLOT(emitClicked()));
m_layoutIsDirty = true;
update();
QTimer::singleShot(0, this, SLOT(updateWifiInfo()));
}
WirelessNetworkItem::~WirelessNetworkItem()
......@@ -183,14 +184,13 @@ void WirelessNetworkItem::activationStateChanged(Knm::InterfaceConnection::Activ
update();
}
void WirelessNetworkItem::update()
void WirelessNetworkItem::updateWifiInfo()
{
//kDebug() << "updating" << m_wirelessStatus->ssid() << wirelessNetworkItem()->strength();
if (m_activatable) {
setStrength((static_cast<RemoteWirelessNetwork*>(m_activatable))->strength());
update();
}
return;
}
QString WirelessNetworkItem::ssid()
......
......@@ -53,7 +53,7 @@ class WirelessNetworkItem : public ActivatableItem
private Q_SLOTS:
void setStrength(int strength);
void update();
void updateWifiInfo();
void activationStateChanged(Knm::InterfaceConnection::ActivationState oldState, Knm::InterfaceConnection::ActivationState newState);
private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment