From 67cd032a230409699fc29fce906a86c68727de16 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 25 Jul 2014 12:51:09 +0200 Subject: [PATCH] Purge CSD remnants. This code is entirely tied to the (closed source) CSD stuff which is going absolutely nowhere. Anything really useful here (the voicemail bits) will presumably need full reimplementation, and the stuff here is useless for that. Burn it. Reviewed-by: John Brooks --- src/constants.h | 12 -- src/mwilistener.cpp | 177 ------------------ src/mwilistener.h | 89 --------- src/notificationmanager.cpp | 24 +-- src/notificationmanager.h | 4 - src/src.pro | 2 - .../ut_notificationmanager.cpp | 3 - .../ut_notificationmanager.pro | 2 - 8 files changed, 2 insertions(+), 311 deletions(-) delete mode 100644 src/mwilistener.cpp delete mode 100644 src/mwilistener.h diff --git a/src/constants.h b/src/constants.h index 2bb5498..e7f2008 100644 --- a/src/constants.h +++ b/src/constants.h @@ -54,18 +54,6 @@ namespace RTComLogger { #define VOICEMAIL_METHOD QLatin1String("voicemail") #define REPLACE_TYPE QLatin1String("sms-replace-number") -#define CSD_SIM_SERVICE_NAME QLatin1String("com.nokia.csd.SIM") -#define CSD_SIM_OBJECT_PATH QLatin1String("/com/nokia/csd/sim") -#define CSD_SIM_INTERFACE QLatin1String("com.nokia.csd.SIM") -#define CSD_SIM_SETTINGS_INTERFACE QLatin1String("com.nokia.csd.SIM.Settings") -#define CSD_SIM_SET_MWI_METHOD QLatin1String("SetMessageWaitingIndicationStatus") -#define CSD_SIM_GET_MWI_METHOD QLatin1String("GetMessageWaitingIndicationStatus") -#define CSD_SIM_GET_SIM_STATUS QLatin1String("GetSIMStatus") -#define CSD_SIM_STATUS_SIGNAL QLatin1String("SIMStatus") -#define CSD_SIM_STATUS_OK QLatin1String("Ok") -#define CSD_SIM_STATUS_REMOVED QLatin1String("Removed") -#define CSD_SIM_STATUS_NO_SIM QLatin1String("NoSIM") - #define RING_ACCOUNT_PATH QLatin1String("/org/freedesktop/Telepathy/Account/ring/tel/account0") #define CONTACT_SEPARATOR_IN_NOTIFICATION_GROUP QLatin1String(", ") diff --git a/src/mwilistener.cpp b/src/mwilistener.cpp deleted file mode 100644 index 23b53d6..0000000 --- a/src/mwilistener.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/****************************************************************************** -** -** This file is part of commhistory-daemon. -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Reto Zingg -** -** This library is free software; you can redistribute it and/or modify it -** under the terms of the GNU Lesser General Public License version 2.1 as -** published by the Free Software Foundation. -** -** This library is distributed in the hope that it will be useful, but -** WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -** License for more details. -** -** You should have received a copy of the GNU Lesser General Public License -** along with this library; if not, write to the Free Software Foundation, Inc., -** 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -** -******************************************************************************/ - -#include -#include -#include - -// Our includes -#include "mwilistener.h" -#include "constants.h" -#include "debug.h" - -using namespace RTComLogger; - -MWIListener::MWIListener(QObject *parent) : - QObject(parent), - m_countsLoaded(false), - m_savePending(false), - m_simSettings(CSD_SIM_SERVICE_NAME, - CSD_SIM_OBJECT_PATH, - CSD_SIM_SETTINGS_INTERFACE, - QDBusConnection::systemBus()) -{ - QDBusConnection dbus = QDBusConnection::systemBus(); - dbus.connect(CSD_SIM_SERVICE_NAME, - CSD_SIM_OBJECT_PATH, - CSD_SIM_INTERFACE, - CSD_SIM_STATUS_SIGNAL, - this, - SLOT(onSIMStatusChanged(const QString&))); - - QDBusInterface sim(CSD_SIM_SERVICE_NAME, - CSD_SIM_OBJECT_PATH, - CSD_SIM_INTERFACE, - dbus); - - QDBusPendingCall pcall = sim.asyncCall(CSD_SIM_GET_SIM_STATUS); - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this); - QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(onGetSIMStatus(QDBusPendingCallWatcher*))); -} - -void MWIListener::onGetSIMStatus(QDBusPendingCallWatcher *call) -{ - QDBusPendingReply reply = *call; - - if (reply.isError()) { - qWarning() << "Failed to get SIM status" << reply.error(); - } else { - QString simStatus = reply.value(); - - DEBUG() << Q_FUNC_INFO << simStatus; - - if (simStatus == CSD_SIM_STATUS_OK) - loadMWI(); - } - - call->deleteLater(); -} - -void MWIListener::onSIMStatusChanged(const QString &simStatus) -{ - DEBUG() << Q_FUNC_INFO << simStatus; - - if (simStatus == CSD_SIM_STATUS_REMOVED - || simStatus == CSD_SIM_STATUS_NO_SIM) - updateCount(0); - else if (simStatus == CSD_SIM_STATUS_OK) - loadMWI(); -} - -void MWIListener::saveMWI(int count) -{ - DEBUG() << Q_FUNC_INFO << count; - - updateCount(count); - - if (m_countsLoaded) - doSaveMWI(); - else - m_savePending = true; -} - -void MWIListener::doSaveMWI() -{ - QDBusPendingCall pcall = m_simSettings.asyncCall(CSD_SIM_SET_MWI_METHOD, - m_counts.voicemail, - m_counts.fax, - m_counts.email, - m_counts.other); - - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this); - QObject::connect(watcher, - SIGNAL(finished(QDBusPendingCallWatcher*)), - this, - SLOT(onSetMWICount(QDBusPendingCallWatcher*))); - - m_savePending = false; -} - -void MWIListener::onSetMWICount(QDBusPendingCallWatcher *call) -{ - QDBusPendingReply<> reply = *call; - - if (reply.isError()) { - DEBUG() << "Failed to set MWI counts" << reply.error(); - } - - call->deleteLater(); -} - -void MWIListener::loadMWI() -{ - QDBusPendingCall pcall = m_simSettings.asyncCall(CSD_SIM_GET_MWI_METHOD); - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this); - QObject::connect(watcher, - SIGNAL(finished(QDBusPendingCallWatcher*)), - this, - SLOT(onGetMWICount(QDBusPendingCallWatcher*))); -} - -void MWIListener::onGetMWICount(QDBusPendingCallWatcher *call) -{ - QDBusPendingReply reply = *call; - - if (reply.isError()) { - DEBUG() << "Failed to get MWI counts" << reply.error(); - updateCount(0); - } else { - updateCount(reply.argumentAt<0>()); - // keep other counts for correct SIM update - m_counts.fax = reply.argumentAt<1>(); - m_counts.email = reply.argumentAt<2>(); - m_counts.other = reply.argumentAt<3>(); - - m_countsLoaded = true; - - if (m_savePending) - doSaveMWI(); - } - - call->deleteLater(); -} - -int MWIListener::MWICount() const -{ - DEBUG() << Q_FUNC_INFO << m_counts.voicemail; - - return m_counts.voicemail; -} - -void MWIListener::updateCount(int count) -{ - if (m_counts.voicemail != count) { - m_counts.voicemail = count; - emit MWICountChanged(MWICount()); - } -} diff --git a/src/mwilistener.h b/src/mwilistener.h deleted file mode 100644 index d954f8d..0000000 --- a/src/mwilistener.h +++ /dev/null @@ -1,89 +0,0 @@ -/****************************************************************************** -** -** This file is part of commhistory-daemon. -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Reto Zingg -** -** This library is free software; you can redistribute it and/or modify it -** under the terms of the GNU Lesser General Public License version 2.1 as -** published by the Free Software Foundation. -** -** This library is distributed in the hope that it will be useful, but -** WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -** License for more details. -** -** You should have received a copy of the GNU Lesser General Public License -** along with this library; if not, write to the Free Software Foundation, Inc., -** 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -** -******************************************************************************/ - -#ifndef MWI_LISTENER_H -#define MWI_LISTENER_H - -#include -#include -#include - -namespace RTComLogger -{ - -/*! - * \class MWIListener - * \brief class responsible for checking any unhandled messages and redelivering them - * using stored messages interface - * Once all stored messages are processed, the object will delete itself. - */ -class MWIListener : public QObject -{ - Q_OBJECT - -public: - explicit MWIListener(QObject *parent = 0); - - /*! - * \breif - * Set voice mail MWI count - * - * \param count voice mail count, -1 means unknown - */ - void saveMWI(int count); - /*! - * \breif - * \return voice mail MWI count, -1 means unknown - */ - int MWICount() const; - -Q_SIGNALS: - void MWICountChanged(int count); - -private Q_SLOTS: - void onSIMStatusChanged(const QString &status); - void onGetSIMStatus(QDBusPendingCallWatcher *call); - void onGetMWICount(QDBusPendingCallWatcher *call); - void onSetMWICount(QDBusPendingCallWatcher *call); - -private: - void loadMWI(); - void updateCount(int count); - void doSaveMWI(); - -private: - struct { - int voicemail; // only voicemail count is used - int fax; // rest are kept to avoid overwritting - int email; - int other; - } m_counts; - bool m_countsLoaded; //set after loadMWI finish - bool m_savePending; // set if saveMWI called before loadMWI finish - // in that case save is postponed until - // valid fax/email/other counts are available - QDBusInterface m_simSettings; -}; - -} // namespace RTComLogger - -#endif // MWI_LISTENER_H diff --git a/src/notificationmanager.cpp b/src/notificationmanager.cpp index bc7ec97..5bfe4c1 100644 --- a/src/notificationmanager.cpp +++ b/src/notificationmanager.cpp @@ -47,7 +47,6 @@ #include "notificationmanager.h" #include "locstrings.h" #include "constants.h" -#include "mwilistener.h" #include "commhistoryservice.h" #include "debug.h" @@ -103,12 +102,6 @@ void NotificationManager::init() if (hasMessageNotification()) groupModel(); - m_pMWIListener = new MWIListener(this); - connect(m_pMWIListener, - SIGNAL(MWICountChanged(int)), - this, - SLOT(slotMWICountChanged(int))); - m_Initialised = true; } @@ -692,21 +685,8 @@ void NotificationManager::slotGroupRemoved(const QModelIndex &index, int start, } void NotificationManager::showVoicemailNotification(int count) { - m_pMWIListener->saveMWI(count); -} - -void NotificationManager::slotMWICountChanged(int count) -{ - DEBUG() << Q_FUNC_INFO << count; - - if (count < -1) { - qCritical() << "Invalid voicemail count" << count; - return; - } - - if (count == 0) { - removeNotificationGroup(CommHistory::Event::VoicemailEvent); - } + Q_UNUSED(count) + qWarning() << Q_FUNC_INFO << "Stub"; } bool NotificationManager::hasMessageNotification() const diff --git a/src/notificationmanager.h b/src/notificationmanager.h index d9d89ab..7fe365c 100644 --- a/src/notificationmanager.h +++ b/src/notificationmanager.h @@ -53,8 +53,6 @@ namespace Ngf { namespace RTComLogger { -class MWIListener; - typedef QPair TpContactUid; /*! @@ -126,7 +124,6 @@ private Q_SLOTS: void slotInboxObservedChanged(); void slotCallHistoryObservedChanged(bool observed); void slotGroupRemoved(const QModelIndex &index, int start, int end); - void slotMWICountChanged(int count); void slotGroupDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); void slotNgfEventFinished(quint32 id); void slotContactUpdated(quint32 localId, const QString &name, const QList &addresses); @@ -170,7 +167,6 @@ private Q_SLOTS: QSharedPointer m_contactListener; CommHistory::GroupModel *m_GroupModel; - MWIListener *m_pMWIListener; Ngf::Client *m_ngfClient; quint32 m_ngfEvent; diff --git a/src/src.pro b/src/src.pro index f88e131..3149204 100644 --- a/src/src.pro +++ b/src/src.pro @@ -69,7 +69,6 @@ HEADERS += logger.h \ connectionutils.h \ contactauthorizationlistener.h \ contactauthorizer.h \ - mwilistener.h \ constants.h \ accountoperationsobserver.h \ accountpresenceifadaptor.h \ @@ -97,7 +96,6 @@ SOURCES += main.cpp \ connectionutils.cpp \ contactauthorizationlistener.cpp \ contactauthorizer.cpp \ - mwilistener.cpp \ accountoperationsobserver.cpp \ accountpresenceifadaptor.cpp \ accountpresenceservice.cpp \ diff --git a/tests/ut_notificationmanager/ut_notificationmanager.cpp b/tests/ut_notificationmanager/ut_notificationmanager.cpp index e0ffcb3..916349c 100644 --- a/tests/ut_notificationmanager/ut_notificationmanager.cpp +++ b/tests/ut_notificationmanager/ut_notificationmanager.cpp @@ -24,7 +24,6 @@ #include "ut_notificationmanager.h" #include "locstrings.h" #include "constants.h" -#include "mwilistener.h" // Qt includes #include @@ -55,8 +54,6 @@ void Ut_NotificationManager::initTestCase() { nm = NotificationManager::instance(); nm->m_Groups.clear(); - - nm->m_pMWIListener->disconnect(nm); } /*! diff --git a/tests/ut_notificationmanager/ut_notificationmanager.pro b/tests/ut_notificationmanager/ut_notificationmanager.pro index 9a81ff4..b457eed 100644 --- a/tests/ut_notificationmanager/ut_notificationmanager.pro +++ b/tests/ut_notificationmanager/ut_notificationmanager.pro @@ -40,13 +40,11 @@ TEST_SOURCES += $$COMMHISTORYDSRCDIR/notificationmanager.cpp \ $$COMMHISTORYDSRCDIR/notificationgroup.cpp \ $$COMMHISTORYDSRCDIR/personalnotification.cpp \ $$COMMHISTORYDSRCDIR/serialisable.cpp \ - $$COMMHISTORYDSRCDIR/mwilistener.cpp \ $$COMMHISTORYDSRCDIR/commhistoryservice.cpp TEST_HEADERS += $$COMMHISTORYDSRCDIR/notificationmanager.h \ $$COMMHISTORYDSRCDIR/notificationgroup.h \ $$COMMHISTORYDSRCDIR/personalnotification.h \ $$COMMHISTORYDSRCDIR/serialisable.h \ - $$COMMHISTORYDSRCDIR/mwilistener.h \ $$COMMHISTORYDSRCDIR/commhistoryservice.h HEADERS += ut_notificationmanager.h \