messagingapp/msgnotifications/msgindicatorplugin/src/msgindicatorplugin.cpp
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
--- a/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicatorplugin.cpp	Fri Apr 16 14:56:15 2010 +0300
+++ b/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicatorplugin.cpp	Mon May 03 12:29:07 2010 +0300
@@ -18,6 +18,8 @@
 #include "msgindicatorplugin.h"
 
 #include "msgindicator.h"
+#include "msginfodefs.h"
+
 #include <QtPlugin>
 #include <QVariant>
 
@@ -27,9 +29,13 @@
 // MsgIndicatorPlugin::MsgIndicatorPlugin
 // @see msgindicatorplugin.h
 // ----------------------------------------------------------------------------
-MsgIndicatorPlugin::MsgIndicatorPlugin() : mError(0)
+MsgIndicatorPlugin::MsgIndicatorPlugin() :
+    mError(0)
 {
-   
+    mIndicatorTypes.append(QString("com.nokia.messaging.newindicatorplugin"));
+    mIndicatorTypes.append(QString("com.nokia.messaging.failedindicatorplugin"));
+    mIndicatorTypes.append(QString("com.nokia.messaging.pendingindicatorplugin"));
+
 }
 
 // ----------------------------------------------------------------------------
@@ -47,9 +53,7 @@
 // ----------------------------------------------------------------------------
 QStringList MsgIndicatorPlugin::indicatorTypes() const
 {
-  QStringList types; 
-  types << "com.nokia.messaging.indicatorplugin/1.0";
-  return types;
+    return mIndicatorTypes;
 }
 
 // ----------------------------------------------------------------------------
@@ -72,10 +76,13 @@
 // MsgIndicatorPlugin::createIndicator
 // @see msgindicatorplugin.h
 // ----------------------------------------------------------------------------
-HbIndicatorInterface* MsgIndicatorPlugin::createIndicator(
-        const QString &indicatorType)
+HbIndicatorInterface* MsgIndicatorPlugin::createIndicator(const QString &indicatorType)
 {
-    HbIndicatorInterface *indicator = new MsgIndicator(indicatorType);
+    HbIndicatorInterface *indicator = NULL;
+    int index(typeIndex(indicatorType));
+    if (index >= 0) {
+        indicator = new MsgIndicator(indicatorType);
+    }
 
     return indicator;
 }
@@ -89,6 +96,16 @@
     return mError;
 }
 
-
-
-
+// ----------------------------------------------------------------------------
+// MsgIndicatorPlugin::typeIndex
+// @see msgindicatorplugin.h
+// ----------------------------------------------------------------------------
+int MsgIndicatorPlugin::typeIndex(const QString &indicatorType) const
+{
+    for (int i = 0; i < mIndicatorTypes.count(); ++i) {
+        if (mIndicatorTypes.at(i) == indicatorType) {
+            return i;
+        }
+    }
+    return -1;
+}