diff -r dcf0eedfc1a3 -r d189ee25cf9d emailuis/nmindicatorplugin/src/nmindicatorplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emailuis/nmindicatorplugin/src/nmindicatorplugin.cpp Tue Aug 31 15:04:17 2010 +0300 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "nmindicatorplugin.h" +#include "nmindicator.h" +#include "nmsendingindicator.h" +#include "nmsyncindicator.h" +#include "nmunreadindicator.h" + +#include +#include +#include +#include + +Q_EXPORT_PLUGIN(NmIndicatorPlugin) + +const int NmMaxIndicatorCount = 10; +static const QString NmIndicatorName = "com.nokia.nmail.indicatorplugin_%1/1.0"; + + +/*! + \class NmIndicatorPlugin + \brief Mail indicator plugin class. +*/ + +/*! + Class constructor. +*/ +NmIndicatorPlugin::NmIndicatorPlugin() +: mError(0), mTranslator(0) +{ + NM_FUNCTION; +} + +/*! + Class destructor. +*/ +NmIndicatorPlugin::~NmIndicatorPlugin() +{ + NM_FUNCTION; + + delete mTranslator; +} + +/*! + Return notification types this plugin implements + */ +QStringList NmIndicatorPlugin::indicatorTypes() const +{ + NM_FUNCTION; + + QStringList types; + for (int i=0; iload(appName + lang, path); + QCoreApplication::installTranslator(mTranslator); + } + + 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; +} + +/*! + Returns the last error code. + */ +int NmIndicatorPlugin::error() const +{ + NM_FUNCTION; + + return mError; +}