On Wed, 23 Mar 2011 08:47:38 +0200 Arun Ravindran <ext-arun.1.ravind...@nokia.com> wrote:
> Hi Shane, > > > On Tue, 15 Mar 2011 14:37:15 +0200 > > Arun Ravindran<ext-arun.1.ravind...@nokia.com> wrote: > > > >> Hi Shane/Michael, > >> > >> We had some time back this discussion while working on BMC#8559. > >> > > Not sure how this relates to bug 8559 "Normal phone call can be > > started from UI even without SIM card"? > > > > Did you mean bug 14320 "Unable to make emergency call whether SIM > > card inserted or not"? > > > This fixes the behavior where the user is able to make normal call > even if there is no SIM. > As you know the emergency call support is non existent in oFono, at > least we filter the call attempt here. Arun, OK, I've re-worked your patch for BMC#8559, making changes per my previous comments. If you approve of my revisions, I'll apply this to master. One observation I have though is that this is really quite un-testable (at least AFAICS) on the master branch because the only way right now to put the modem into "flight" mode is to offline it, but this will cause the CallManager instance to become invalid since oFono will remove the VoiceCallManager interface in this mode. I don't have an invalid SIM or one with FDN/BDN enabled either. Do you have other suggestions on how to test this on the master branch? One solution might be to make it part of the headless branch for now. Thoughts or comments? Shane... >From fb8a96b97af049dc891d63b794efd61faa7d4185 Mon Sep 17 00:00:00 2001 From: Arun Ravindran <ext-arun.1.ravind...@nokia.com> Date: Mon, 4 Apr 2011 16:33:58 -0700 Subject: [PATCH] Fixed: BMC# 8559 - Non-emergency call can be made without SIM card - Implimented missing "online" modem property - Check if modem is both Powered and Online before attempting to dial, if not, then requested number must be in the list of allowed EmergencyNumbers from oFono - Exposed new showErrorDialog() method that allows message to be set - Added notification message when non-emergency call is requested and current state prohibits it. Signed-off-by: Shane Bryan <shane.br...@linux.intel.com> --- src/callmanager.cpp | 20 +++++++++++++++++++- src/callmanager.h | 1 + src/dialerapplication.cpp | 6 ++++++ src/dialerapplication.h | 1 + src/dialerpage.cpp | 13 ++++++++++++- src/dialerpage.h | 1 + src/modemproxy.cpp | 15 +++++++++++++++ src/modemproxy.h | 6 ++++++ 8 files changed, 61 insertions(+), 2 deletions(-) diff --git a/src/callmanager.cpp b/src/callmanager.cpp index 0a92068..1006d3e 100644 --- a/src/callmanager.cpp +++ b/src/callmanager.cpp @@ -174,6 +174,24 @@ void CallManager::dial(const PeopleItem *person) void CallManager::dial(const QString number) { TRACE + ModemProxy* p = ManagerProxy::instance()->modem(); + + // Nothing to do if the modem is not powered up + if(!p->powered()) { + emit callsChanged(); + return; + } + + // If not online (flight mode?), check if the requested number is + // one of the allowed EmergencyNumbers, in which case, continue. + // Otherwise, notify that only Emergency calls are permitted. + if(!p->online()) { + if(p->powered() && !m_emergencyNumbers.contains(number)) { + emit callsChanged(); + emit onlyEmergencyCalls(); + return; + } + } ResourceProxy *resource = ManagerProxy::instance()->resource(); @@ -823,7 +841,7 @@ void CallManager::propertyChanged(const QString &in0, const QDBusVariant &in1) calls = qdbus_cast<QList<QDBusObjectPath> >(in1.variant()); setMultipartyCalls(calls); } else if (in0 == "EmergencyNumbers") { - qDebug() << QString("TODO: Handle EmergencyNumber..."); + m_emergencyNumbers = qdbus_cast<QStringList>(in1.variant()); } else qDebug() << QString("Unexpected property changed..."); } diff --git a/src/callmanager.h b/src/callmanager.h index 86ee1f6..11f3301 100644 --- a/src/callmanager.h +++ b/src/callmanager.h @@ -92,6 +92,7 @@ Q_SIGNALS: void callResourceLost(const QString); void connected(); void disconnected(); + void onlyEmergencyCalls(); private Q_SLOTS: void updateCallItems(); diff --git a/src/dialerapplication.cpp b/src/dialerapplication.cpp index da44fff..e781e28 100644 --- a/src/dialerapplication.cpp +++ b/src/dialerapplication.cpp @@ -264,6 +264,12 @@ void DialerApplication::messagesWaitingChanged() vmail->publish(); } +int DialerApplication::showErrorDialog(const QString msg) +{ + setError(msg); + return showErrorDialog(); +} + int DialerApplication::showErrorDialog() { TRACE diff --git a/src/dialerapplication.h b/src/dialerapplication.h index 02bde70..6dfe627 100644 --- a/src/dialerapplication.h +++ b/src/dialerapplication.h @@ -39,6 +39,7 @@ public: bool isConnected(); QString lastError(); int showErrorDialog(); + int showErrorDialog(const QString msg); static DialerApplication *instance(); SeasideSyncModel *seasideModel(); SeasideProxyModel *seasideProxy(); diff --git a/src/dialerpage.cpp b/src/dialerpage.cpp index 3a2e7b2..31cf189 100644 --- a/src/dialerpage.cpp +++ b/src/dialerpage.cpp @@ -121,8 +121,10 @@ void DialerPage::createContent() connect(this, SIGNAL(disappeared()), SLOT(pageHidden())); CallManager *cm = ManagerProxy::instance()->callManager(); - if (cm->isValid()) + if (cm->isValid()) { + connect (cm, SIGNAL(onlyEmergencyCalls()),this, SLOT(notifyEmergencyCallsOnly())); connect(cm, SIGNAL(callsChanged()), this, SLOT(updateCalls())); + } else qCritical("DialerPage: CallManager not ready yet!"); @@ -132,6 +134,15 @@ void DialerPage::createContent() connect(m_bksp, SIGNAL(released()), SLOT(handleBkspRelease())); } +void DialerPage::notifyEmergencyCallsOnly() +{ + TRACE + DialerApplication *DA = DialerApplication::instance(); + //% "Error: Only Emergency Calls Allowed" + DA->showErrorDialog(qtTrId("only_emergency_calls")); + return; +} + void DialerPage::updateCalls() { CallManager *cm = dynamic_cast<CallManager *>(sender()); diff --git a/src/dialerpage.h b/src/dialerpage.h index ac4ef83..c18c1cf 100644 --- a/src/dialerpage.h +++ b/src/dialerpage.h @@ -35,6 +35,7 @@ private Q_SLOTS: void doBackspace(); void handleBkspPress(); void handleBkspRelease(); + void notifyEmergencyCallsOnly(); private: CallItem *m_activeCall; diff --git a/src/modemproxy.cpp b/src/modemproxy.cpp index d5f950d..264f594 100644 --- a/src/modemproxy.cpp +++ b/src/modemproxy.cpp @@ -43,6 +43,7 @@ QString ModemProxy::model() const { return m_model; } QString ModemProxy::revision() const { return m_revision; } QString ModemProxy::serial() const { return m_serial; } bool ModemProxy::powered() const { return m_powered; } +bool ModemProxy::online() const { return m_online; } void ModemProxy::setPowered(bool is_powered) { @@ -57,6 +58,19 @@ void ModemProxy::setPowered(bool is_powered) m_powered = is_powered; } +void ModemProxy::setOnline(bool is_online) +{ + if (m_online == is_online) + return; + + QDBusPendingReply<QVariantMap> reply; + reply = SetProperty("Online", QDBusVariant(m_online?"true":"false")); + if (reply.isError()) + qCritical() << "SetProperty \"Powered\" failed!"; + else + m_online = is_online; +} + void ModemProxy::modemDBusGetPropDone(QDBusPendingCallWatcher *call) { QDBusPendingReply<QVariantMap> reply = *call; @@ -73,6 +87,7 @@ void ModemProxy::modemDBusGetPropDone(QDBusPendingCallWatcher *call) m_powered = qdbus_cast<bool>(properties["Powered"]); m_revision = qdbus_cast<QString>(properties["Revision"]); m_serial = qdbus_cast<QString>(properties["Serial"]); + m_online = qdbus_cast<bool>(properties["Online"]); #ifdef WANT_DEBUG qDebug() << "Modem Details:"; diff --git a/src/modemproxy.h b/src/modemproxy.h index 6c8e53d..9c50b06 100644 --- a/src/modemproxy.h +++ b/src/modemproxy.h @@ -28,6 +28,7 @@ class ModemProxy: public org::ofono::Modem Q_PROPERTY(QString revision READ revision) Q_PROPERTY(QString serial READ serial) Q_PROPERTY(bool powered READ powered WRITE setPowered) + Q_PROPERTY(bool online READ online WRITE setOnline) public: ModemProxy(const QString &objectPath); @@ -40,15 +41,19 @@ public: QString revision() const; QString serial() const; bool powered() const; + bool online() const; QStringList dumpProperties(); public slots: void setPowered(bool is_powered); + void setOnline(bool is_online); + void modemDBusGetPropDone(QDBusPendingCallWatcher *call); Q_SIGNALS: void poweredChanged(bool powered); + void onlineChanged(bool powered); void connected(); void disconnected(); @@ -61,6 +66,7 @@ private: QString m_revision; QString m_serial; bool m_powered; + bool m_online; bool m_connected; }; -- 1.7.2.2 _______________________________________________ MeeGo-handset mailing list MeeGo-handset@lists.meego.com http://lists.meego.com/listinfo/meego-handset