diff -r 139d4b7b2938 -r 99bcbff212ad emailuis/nmindicatorplugin/src/nmindicatorplugin.cpp --- a/emailuis/nmindicatorplugin/src/nmindicatorplugin.cpp Mon May 24 21:02:02 2010 +0300 +++ b/emailuis/nmindicatorplugin/src/nmindicatorplugin.cpp Fri May 28 13:56:43 2010 +0300 @@ -17,19 +17,20 @@ #include "nmindicatorplugin.h" #include "nmindicator.h" +#include "nmsendingindicator.h" +#include "nmsyncindicator.h" +#include "nmunreadindicator.h" #include #include #include #include -#include -#include - Q_EXPORT_PLUGIN(NmIndicatorPlugin) const int NmMaxIndicatorCount = 10; -static const QString emailServiceNameMailbox = "nmail.com.nokia.symbian.IEmailInboxView"; +static const QString NmIndicatorName = "com.nokia.nmail.indicatorplugin_%1/1.0"; + /*! \class NmIndicatorPlugin @@ -40,8 +41,9 @@ Class constructor. */ NmIndicatorPlugin::NmIndicatorPlugin() -: mError(0), mTranslator(0), mStatusBarIndicator(0), mSending(false) +: mError(0), mTranslator(0) { + NM_FUNCTION; } /*! @@ -49,7 +51,8 @@ */ NmIndicatorPlugin::~NmIndicatorPlugin() { - NMLOG("NmIndicatorPlugin::~NmIndicatorPlugin"); + NM_FUNCTION; + delete mTranslator; } @@ -58,11 +61,16 @@ */ QStringList NmIndicatorPlugin::indicatorTypes() const { + NM_FUNCTION; + QStringList types; for (int i=0; iacceptIcon(sending); - } - else { - // No indicator is showing the status now. - indicatorIconLost(); - } -} - /*! Creates an indicator of type indicatorType. Ownership is passed to the caller. */ HbIndicatorInterface* NmIndicatorPlugin::createIndicator( const QString &indicatorType) { + NM_FUNCTION; + if (!mTranslator) { mTranslator = new QTranslator(); QString lang = QLocale::system().name(); @@ -114,12 +108,19 @@ QCoreApplication::installTranslator(mTranslator); } - NmIndicator* indicator = new NmIndicator(indicatorType); - connect(indicator, SIGNAL(indicatorIconLost()), this, SLOT(indicatorIconLost())); - connect(indicator, SIGNAL(destroyed(QObject *)), this, SLOT(indicatorDeactivated(QObject *))); - connect(indicator, SIGNAL(globalStatusChanged(bool)), this, SLOT(globalStatusChanged(bool))); - connect(indicator, SIGNAL(mailboxLaunched(quint64)), this, SLOT(showMailbox(quint64))); - mIndicators.append(indicator); + HbIndicatorInterface *indicator; + if (indicatorType == NmSendingIndicatorType) { + indicator = new NmSendingIndicator(indicatorType); + } + else if (indicatorType == NmUnreadIndicatorType) { + indicator = new NmUnreadIndicator(indicatorType); + } + else if (indicatorType == NmSyncIndicator::IndicatorType) { + indicator = new NmSyncIndicator(); + } + else { + indicator = new NmIndicator(indicatorType); + } return indicator; } @@ -129,65 +130,7 @@ */ int NmIndicatorPlugin::error() const { + NM_FUNCTION; + return mError; } - -/*! - Called when an indicator signals about lost indicator. - \param true if a new indicator was found - */ -bool NmIndicatorPlugin::indicatorIconLost() -{ - bool found(false); - mStatusBarIndicator = NULL; - - foreach (NmIndicator* indicator, mIndicators) { - // Find a new candidate to handle the status bar icon - if (indicator->acceptIcon(mSending)) { - mStatusBarIndicator = indicator; - found = true; - break; - } - } - return found; -} - -/*! - Remove destroyed indicators from the list. - \param indicator item that has been deleted - */ -void NmIndicatorPlugin::indicatorDeactivated(QObject *indObject) -{ - NMLOG(QString("NmIndicatorPlugin::indicatorDeactivated %1").arg((int)indObject)); - NmIndicator *indicator = static_cast(indObject); - mIndicators.removeAll(indicator); - if (mStatusBarIndicator == indicator) { - mStatusBarIndicator = NULL; - - // Find new indicator to take care of the status bar icon - indicatorIconLost(); - } -} - -/*! - Opens inbox view to specific mailbox - \return true if inbox is succesfully opened -*/ -bool NmIndicatorPlugin::showMailbox(quint64 mailboxId) -{ - NMLOG("NmIndicatorPlugin::showMailbox"); - XQServiceRequest request( - emailServiceNameMailbox, - emailOperationViewInbox, - true); - - QList list; - list.append(QVariant(mailboxId)); - - request.setArguments(list); - - int returnValue(-1); - return request.send(returnValue); -} - -