diff -r 26b6f0522fd8 -r 8110bf1194d1 appinstaller/AppinstUi/sifuiinstallindicatorplugin/src/sifuiinstallindicator.cpp --- a/appinstaller/AppinstUi/sifuiinstallindicatorplugin/src/sifuiinstallindicator.cpp Mon May 03 12:38:03 2010 +0300 +++ b/appinstaller/AppinstUi/sifuiinstallindicatorplugin/src/sifuiinstallindicator.cpp Fri May 14 15:58:48 2010 +0300 @@ -20,15 +20,19 @@ #include #include +const char KSifUiDefaultApplicationIcon[] = "qtg_large_application.svg"; +const QString KSifUiPathSeparator = "/"; + // --------------------------------------------------------------------------- // SifUiInstallIndicator::SifUiInstallIndicator() // --------------------------------------------------------------------------- // SifUiInstallIndicator::SifUiInstallIndicator(const QString &indicatorType) : - HbIndicatorInterface(indicatorType, HbIndicatorInterface::GroupPriorityHigh, - InteractionActivated), mAppName(), mPublisher(0) + HbIndicatorInterface(indicatorType, HbIndicatorInterface::ProgressCategory, + InteractionActivated), mAppName(), mPublisher(0), mIsActive(false) { + mPublisher = new QTM_PREPEND_NAMESPACE(QValueSpacePublisher(KSifUiInstallIndicatorPath)); } // --------------------------------------------------------------------------- @@ -37,6 +41,9 @@ // SifUiInstallIndicator::~SifUiInstallIndicator() { + if (mPublisher && mIsActive) { + publishActivityStatus(false); + } delete mPublisher; } @@ -50,6 +57,7 @@ if (type == InteractionActivated) { emit deactivate(); + publishActivityStatus(false); handled = true; } @@ -65,19 +73,21 @@ QVariant data; switch(role) { - case IconNameRole: case DecorationNameRole: - // TODO: use proper icon when available - data = QString("note_info.svg"); + data = QString(KSifUiDefaultApplicationIcon); break; case PrimaryTextRole: //: Primary text for application installation progress displayed in //: universal indicator menu. Secondary text is the application name. // TODO: use localised UI string when available - data = tr("Installing..."); + data = tr("Installing"); + // TODO: text must indicate installation phase, need to support also + // tr("Downloading") and tr("Doing OCSP checks") break; case SecondaryTextRole: - data = mAppName; + if (!mAppName.isEmpty()) { + data = tr("%1 (%L2 %)").arg(mAppName).arg(mProgress); + } default: break; } @@ -115,9 +125,12 @@ // void SifUiInstallIndicator::processParameters(const QVariant ¶meter) { - if (parameter.isValid() && (parameter.type() == QVariant::Map)) { - QVariantMap map = parameter.toMap(); - mAppName = map.value(KSifUiIndicatorApplicationName).toString(); + if (parameter.isValid() && (parameter.type() == QVariant::String)) { + mAppName = parameter.toString(); + mProgress = 0; + + // TODO: get icon if standard icon needs to be replaced + // TODO: start listening USIF installation progress } } @@ -127,9 +140,13 @@ // void SifUiInstallIndicator::publishActivityStatus(bool status) { - if (!mPublisher) { - mPublisher = new QTM_PREPEND_NAMESPACE(QValueSpacePublisher(KSifUiIndicatorPath)); + if (status != mIsActive) { + if (mPublisher) { + int intStatus = status; + mPublisher->setValue(KSifUiInstallIndicatorStatus, QVariant(intStatus)); + mPublisher->sync(); + } + mIsActive = status; } - mPublisher->setValue(KSifUiIndicatorActive, QVariant(status)); }