summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamarque V. Souza <lamarque@kde.org>2012-02-18 01:10:25 (GMT)
committerLamarque V. Souza <lamarque@kde.org>2012-02-18 01:16:30 (GMT)
commit21ff56d2058f0e5ed022f464d2cfd8dbd71fbd11 (patch)
tree77cc9fa0c87e07383e9aabc703124eece349bd8e
parent1ac4f566a309104227ff1e24f18b2e144dc81187 (diff)
Cache data in Solid ModemManager backend to prevent desktop freeze.
(cherry picked from commit 112163ad4e2163a78e9f77ac323268387e9313bb)
-rw-r--r--solid/modemmanager-0.4/modemgsmnetworkinterface.cpp46
-rw-r--r--solid/modemmanager-0.4/modemgsmnetworkinterface.h1
-rw-r--r--solid/modemmanager-0.4/modemgsmnetworkinterface_p.h4
3 files changed, 28 insertions, 23 deletions
diff --git a/solid/modemmanager-0.4/modemgsmnetworkinterface.cpp b/solid/modemmanager-0.4/modemgsmnetworkinterface.cpp
index 7d01abe..65c8c39 100644
--- a/solid/modemmanager-0.4/modemgsmnetworkinterface.cpp
+++ b/solid/modemmanager-0.4/modemgsmnetworkinterface.cpp
@@ -43,6 +43,11 @@ MMModemGsmNetworkInterface::MMModemGsmNetworkInterface(const QString & path, MMM
this, SLOT(slotRegistrationInfoChanged(uint,QString,QString)));
connect( &d->modemGsmNetworkIface, SIGNAL(SignalQuality(uint)),
this, SIGNAL(signalQualityChanged(uint)));
+
+ d->signalQuality = d->modemGsmNetworkIface.GetSignalQuality();
+ d->registrationInfo = d->modemGsmNetworkIface.GetRegistrationInfo();
+ d->accessTechnology = (Solid::Control::ModemInterface::AccessTechnology)d->modemGsmNetworkIface.accessTechnology();
+ d->allowedMode = (Solid::Control::ModemInterface::AllowedMode)d->modemGsmNetworkIface.allowedMode();
}
MMModemGsmNetworkInterface::~MMModemGsmNetworkInterface()
@@ -69,27 +74,34 @@ void MMModemGsmNetworkInterface::propertiesChanged(const QString & interface, co
}
}
+void MMModemGsmNetworkInterface::slotSignalQualityChanged(uint signalQuality)
+{
+ Q_D(MMModemGsmNetworkInterface);
+ d->signalQuality = signalQuality;
+ emit signalQualityChanged(d->signalQuality);
+}
+
void MMModemGsmNetworkInterface::slotRegistrationInfoChanged(uint status, const QString & operatorCode, const QString &operatorName)
{
- RegistrationInfoType r;
+ Q_D(MMModemGsmNetworkInterface);
- r.status = (Solid::Control::ModemGsmNetworkInterface::RegistrationStatus) status;
- r.operatorCode = operatorCode;
- r.operatorName = operatorName;
+ d->registrationInfo.status = (Solid::Control::ModemGsmNetworkInterface::RegistrationStatus) status;
+ d->registrationInfo.operatorCode = operatorCode;
+ d->registrationInfo.operatorName = operatorName;
- emit registrationInfoChanged(r);
+ emit registrationInfoChanged(d->registrationInfo);
}
Solid::Control::ModemInterface::AllowedMode MMModemGsmNetworkInterface::getAllowedMode() const
{
Q_D(const MMModemGsmNetworkInterface);
- return (Solid::Control::ModemInterface::AllowedMode) d->modemGsmNetworkIface.allowedMode();
+ return d->allowedMode;
}
Solid::Control::ModemInterface::AccessTechnology MMModemGsmNetworkInterface::getAccessTechnology() const
{
Q_D(const MMModemGsmNetworkInterface);
- return (Solid::Control::ModemInterface::AccessTechnology) d->modemGsmNetworkIface.accessTechnology();
+ return d->accessTechnology;
}
void MMModemGsmNetworkInterface::registerToNetwork(const QString & networkId)
@@ -130,26 +142,14 @@ Solid::Control::ModemInterface::Band MMModemGsmNetworkInterface::getBand()
RegistrationInfoType MMModemGsmNetworkInterface::getRegistrationInfo()
{
- Q_D(MMModemGsmNetworkInterface);
- QDBusReply< RegistrationInfoType > registrationInfo = d->modemGsmNetworkIface.GetRegistrationInfo();
-
- if (registrationInfo.isValid())
- return registrationInfo.value();
-
- kDebug(1441) << "Error getting registration info for operator: " << registrationInfo.error().name() << ": " << registrationInfo.error().message();
- return RegistrationInfoType();
+ Q_D(const MMModemGsmNetworkInterface);
+ return d->registrationInfo;
}
uint MMModemGsmNetworkInterface::getSignalQuality()
{
- Q_D(MMModemGsmNetworkInterface);
- QDBusReply< uint > signalQuality = d->modemGsmNetworkIface.GetSignalQuality();
-
- if (signalQuality.isValid())
- return signalQuality.value();
-
- kDebug(1441) << "Error getting signal quality: " << signalQuality.error().name() << ": " << signalQuality.error().message();
- return 0;
+ Q_D(const MMModemGsmNetworkInterface);
+ return d->signalQuality;
}
void MMModemGsmNetworkInterface::setAllowedMode(const Solid::Control::ModemInterface::AllowedMode mode)
diff --git a/solid/modemmanager-0.4/modemgsmnetworkinterface.h b/solid/modemmanager-0.4/modemgsmnetworkinterface.h
index 9f1346d..67cb469 100644
--- a/solid/modemmanager-0.4/modemgsmnetworkinterface.h
+++ b/solid/modemmanager-0.4/modemgsmnetworkinterface.h
@@ -50,6 +50,7 @@ public:
Solid::Control::ModemInterface::AllowedMode getAllowedMode() const;
Solid::Control::ModemInterface::AccessTechnology getAccessTechnology() const;
public Q_SLOTS:
+ void slotSignalQualityChanged(uint signalQuality);
void slotRegistrationInfoChanged(uint status, const QString & operatorCode, const QString &operatorName);
void propertiesChanged(const QString & interface, const QVariantMap & properties);
Q_SIGNALS:
diff --git a/solid/modemmanager-0.4/modemgsmnetworkinterface_p.h b/solid/modemmanager-0.4/modemgsmnetworkinterface_p.h
index 21a39cd..ae9f2fd 100644
--- a/solid/modemmanager-0.4/modemgsmnetworkinterface_p.h
+++ b/solid/modemmanager-0.4/modemgsmnetworkinterface_p.h
@@ -30,6 +30,10 @@ class MMModemGsmNetworkInterfacePrivate: public MMModemInterfacePrivate
public:
MMModemGsmNetworkInterfacePrivate(const QString &path, QObject *owner);
OrgFreedesktopModemManagerModemGsmNetworkInterface modemGsmNetworkIface;
+ uint signalQuality;
+ Solid::Control::ModemGsmNetworkInterface::RegistrationInfoType registrationInfo;
+ Solid::Control::ModemInterface::AccessTechnology accessTechnology;
+ Solid::Control::ModemInterface::AllowedMode allowedMode;
};
#endif