homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsuninstallitemstate.cpp
changeset 90 3ac3aaebaee5
parent 86 e4f038c420f7
equal deleted inserted replaced
86:e4f038c420f7 90:3ac3aaebaee5
    13  *
    13  *
    14  * Description: Menu delete collection item state
    14  * Description: Menu delete collection item state
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 #include <hbmessagebox.h>
    18 
    19 #include <hbaction.h>
    19 #include <QScopedPointer>
    20 #include <hsmenuservice.h>
    20 #include <QStandardItemModel>
    21 #include <hsshortcutservice.h>
    21 #include <QStandardItem>
       
    22 #include <QStateMachine>
       
    23 
       
    24 #include <HbMessageBox>
       
    25 #include <HbAction>
    22 #include <HbDocumentLoader>
    26 #include <HbDocumentLoader>
    23 #include <HbLabel>
    27 #include <HbLabel>
    24 #include <HbListView>
    28 #include <HbListView>
    25 #include <HbParameterLengthLimiter>
    29 #include <HbParameterLengthLimiter>
    26 
    30 
    27 #include <QScopedPointer>
    31 #include "hsmenuservice.h"
    28 #include <QStandardItemModel>
    32 #include "hsshortcutservice.h"
    29 #include <QStandardItem>
    33 #include "hsuninstallitemstate.h"
    30 #include <QStateMachine>
    34 #include "hsmenuevent.h"
       
    35 #include "hsmenudialogfactory.h"
       
    36 #include "hsdialogcontroller.h"
       
    37 #include "hsmenueventfactory.h"
       
    38 
    31 #include <casoftwareregistry.h>
    39 #include <casoftwareregistry.h>
    32 #include <caquery.h>
    40 #include <caquery.h>
    33 #include <canotifier.h>
    41 #include <canotifier.h>
    34 
    42 
    35 #include "hsuninstallitemstate.h"
    43 const char definition02 [] = "uninstallDialogDefinition02";
    36 #include "hsmenuevent.h"
    44 const char definition03 [] = "uninstallDialogDefinition03";
    37 #include "hsmenudialogfactory.h"
    45 const char definition04 [] = "uninstallDialogDefinition04";
    38 #include "hsmenuentryremovedhandler.h"
    46 
    39 #include "hsmenueventfactory.h"
       
    40 
    47 
    41 /*!
    48 /*!
    42  \class HsUninstallItemState
    49  \class HsUninstallItemState
    43  \ingroup group_hsworkerstateplugin
    50  \ingroup group_hsworkerstateplugin
    44  \brief Uninstall Item State.
    51  \brief Uninstall Item State.
    49  Constructor.
    56  Constructor.
    50  \param parent Parent state.
    57  \param parent Parent state.
    51  */
    58  */
    52 HsUninstallItemState::HsUninstallItemState(QState *parent) :
    59 HsUninstallItemState::HsUninstallItemState(QState *parent) :
    53     QState(parent),
    60     QState(parent),
    54     mItemId(0),
    61     mEntry(NULL)
    55     mUninstallMessage(NULL),
       
    56     mUninstallJavaMessage(NULL),
       
    57     mConfirmAction(NULL)
       
    58 {
    62 {
    59     construct();
    63     construct();
    60 }
    64 }
    61 
    65 
    62 /*!
    66 /*!
    63  Destructor.
    67  Destructor.
    64  */
    68  */
    65 HsUninstallItemState::~HsUninstallItemState()
    69 HsUninstallItemState::~HsUninstallItemState()
    66 {
    70 {
    67     cleanUp(); // in case of throw
    71     QT_TRY {
       
    72         emit exit();
       
    73     } QT_CATCH (...) {
       
    74         qDebug("Exception thrown");
       
    75     }
    68 }
    76 }
    69 
    77 
    70 /*!
    78 /*!
    71  Constructs contained objects.
    79  Constructs contained objects.
    72  */
    80  */
    75     setObjectName("/UninstallItemState");
    83     setObjectName("/UninstallItemState");
    76     if (this->parent()) {
    84     if (this->parent()) {
    77         setObjectName(this->parent()->objectName() + objectName());
    85         setObjectName(this->parent()->objectName() + objectName());
    78     }
    86     }
    79     connect(this, SIGNAL(exited()), SLOT(cleanUp()));
    87     connect(this, SIGNAL(exited()), SLOT(cleanUp()));
    80     
       
    81 }
    88 }
    82 
    89 
    83 /*!
    90 /*!
    84  Sets entry event.
    91  Sets entry event.
    85  \param event entry event.
    92  \param event entry event.
    86  */
    93  */
    87 void HsUninstallItemState::onEntry(QEvent *event)
    94 void HsUninstallItemState::onEntry(QEvent *event)
    88 {
    95 {
    89     HSMENUTEST_FUNC_ENTRY("HsUninstallItemState::onEntry");
    96     HSMENUTEST_FUNC_ENTRY("HsUninstallItemState::onEntry");
       
    97     qDebug("HsUninstallItemState::onEntry()");
       
    98 
    90     QState::onEntry(event);
    99     QState::onEntry(event);
    91     qDebug("HsUninstallItemState::onEntry()");
   100 
    92     HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event);
   101     HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event);
    93     QVariantMap data = menuEvent->data();
   102     int itemId = menuEvent->data().value(Hs::itemIdKey).toInt();
    94 
   103     mEntry = CaService::instance()->getEntry(itemId);
    95     mItemId = data.value(Hs::itemIdKey).toInt();
   104 
    96     QSharedPointer<CaEntry> entry = CaService::instance()->getEntry(mItemId);
   105     if (mEntry) {
    97     QString appType = entry->attribute(Hs::swTypeKey);
   106         QString appType = mEntry->attribute(Hs::swTypeKey);
    98     if (!appType.compare(Hs::javaSwType)) {
   107 
    99         // java
   108         if (!appType.compare(Hs::javaSwType)) {
   100         createUninstallJavaMessage();
   109             // java
   101     } else {
   110             createUninstallJavaMessage();
   102         // other
   111         } else {
   103         createSimpleUninstallMessage();
   112             // other
   104     }
   113             createSimpleUninstallMessage();
   105         
   114         }
       
   115     }
   106     HSMENUTEST_FUNC_EXIT("HsUninstallItemState::onEntry");
   116     HSMENUTEST_FUNC_EXIT("HsUninstallItemState::onEntry");
   107 }
   117 }
   108 
   118 
   109 /*!
   119 /*!
   110  Action after closed confirmation dialog.
   120  Slots. Uninstalls item controlled by the state.
   111  \param finishedAction chosen action.
   121  \retval void
   112  \retval void
   122  */
   113  */
   123 #ifdef COVERAGE_MEASUREMENT
   114 void HsUninstallItemState::uninstallMessageFinished(HbAction* finishedAction)
   124 #pragma CTC SKIP
   115 {
   125 #endif //COVERAGE_MEASUREMENT
   116     if (static_cast<QAction*>(finishedAction) == mConfirmAction) {
   126 void HsUninstallItemState::uninstallItem()
   117 
   127 {
   118         HsMenuService::executeAction(mItemId, Hs::removeActionIdentifier, 
   128     HsMenuService::executeAction(*mEntry.data(), Hs::removeActionIdentifier,
   119                 this, SLOT(uninstallFailed(int)));
   129             this, SLOT(uninstallFailed(int)));
   120     }
   130 }
   121     mConfirmAction = NULL;
   131 #ifdef COVERAGE_MEASUREMENT
   122     mUninstallMessage = NULL;
   132 #pragma CTC ENDSKIP
   123 	mUninstallJavaMessage = NULL;
   133 #endif //COVERAGE_MEASUREMENT
   124     emit exit();
       
   125 }
       
   126 
   134 
   127 /*!
   135 /*!
   128  Return information about a component: component name, a list of names
   136  Return information about a component: component name, a list of names
   129  of applications in this component and a delete message.
   137  of applications in this component and a delete message.
   130  \param[out] componentName component name.
   138  \param[out] componentName component name.
   137     QString &confirmationMessage)
   145     QString &confirmationMessage)
   138 {
   146 {
   139     componentName.clear();
   147     componentName.clear();
   140     applicationsNames.clear();
   148     applicationsNames.clear();
   141     confirmationMessage.clear();
   149     confirmationMessage.clear();
   142     
   150 
   143     QSharedPointer<CaService> service = CaService::instance();
   151     QSharedPointer<CaService> service = CaService::instance();
   144     QSharedPointer<CaEntry> entry = service->getEntry(mItemId);
   152     const int componentId = mEntry->attribute(
   145     const int componentId =
   153             Hs::componentIdAttributeName).toInt();
   146         entry->attribute(Hs::componentIdAttributeName).toInt();
   154 
   147     
       
   148     QSharedPointer<CaSoftwareRegistry> softwareRegistry =
       
   149         CaSoftwareRegistry::create();
       
   150     QStringList appUids;
   155     QStringList appUids;
   151     bool retval = softwareRegistry->getUninstallDetails(componentId,
   156     bool retval = CaSoftwareRegistry::create()->getUninstallDetails(
   152         componentName,
   157             componentId, componentName, appUids, confirmationMessage);
   153         appUids,
       
   154         confirmationMessage);
       
   155     if (retval) {
   158     if (retval) {
   156         CaQuery query;
   159         CaQuery query;
   157         foreach (QString uid, appUids) {
   160         foreach (QString uid, appUids) {
   158             query.setAttribute(Hs::applicationUidEntryKey, uid);
   161             query.setAttribute(Hs::applicationUidEntryKey, uid);
   159             QList< QSharedPointer<CaEntry> > entries =
   162             QList< QSharedPointer<CaEntry> > entries =
   160                 service->getEntries(query);
   163                     service->getEntries(query);
   161             if (entries.length() > 0) {
   164             if (entries.length() > 0) {
   162                 applicationsNames << entries[0]->text();
   165                 applicationsNames << entries[0]->text();
   163             }
   166             }
   164         }
   167         }
   165         if (applicationsNames.length()==1
   168         if (applicationsNames.length() == 1
   166             && applicationsNames[0]==componentName) {
   169                 && applicationsNames[0] == componentName) {
   167             applicationsNames.clear();
   170             applicationsNames.clear();
   168         }
   171         }
   169     }
   172     }
   170     return retval;
   173     return retval;
   171 }
   174 }
   175  Slot launched after state has exited and in destructor.
   178  Slot launched after state has exited and in destructor.
   176  \retval void
   179  \retval void
   177  */
   180  */
   178 void HsUninstallItemState::cleanUp()
   181 void HsUninstallItemState::cleanUp()
   179 {
   182 {
   180     // Close messagebox if App key was pressed
   183     mEntry.clear();
   181     if (mUninstallMessage != NULL) {
       
   182         mUninstallMessage->close();
       
   183         mUninstallMessage = NULL;
       
   184     }
       
   185     
       
   186     if (mUninstallJavaMessage != NULL) {
       
   187         mUninstallJavaMessage->close();
       
   188         mUninstallJavaMessage = NULL;
       
   189     }
       
   190 
       
   191     mConfirmAction = NULL;
       
   192     mItemId = 0;
       
   193 }
   184 }
   194 
   185 
   195 #ifdef COVERAGE_MEASUREMENT
   186 #ifdef COVERAGE_MEASUREMENT
   196 #pragma CTC SKIP
   187 #pragma CTC SKIP
   197 #endif //COVERAGE_MEASUREMENT (only returns HbMainWindow)
   188 #endif //COVERAGE_MEASUREMENT (only returns HbMainWindow)
   214  \retval void
   205  \retval void
   215  */
   206  */
   216 void HsUninstallItemState::createSimpleUninstallMessage(bool isJava)
   207 void HsUninstallItemState::createSimpleUninstallMessage(bool isJava)
   217 {
   208 {
   218     CaQuery parentsQuery;
   209     CaQuery parentsQuery;
   219     parentsQuery.setChildId(mItemId);
   210     parentsQuery.setChildId(mEntry->id());
   220     parentsQuery.setEntryTypeNames(QStringList(Hs::collectionTypeName));
   211     parentsQuery.setEntryTypeNames(QStringList(Hs::collectionTypeName));
   221     QList<int> parentsIds = CaService::instance()->getEntryIds(
   212     QList<int> parentsIds = CaService::instance()->getEntryIds(parentsQuery);
   222             parentsQuery);
       
   223     QString message;
   213     QString message;
   224     if (HsShortcutService::instance()->isItemShortcutWidget(mItemId) || (parentsIds.count() > 0)) {
   214     if (HsShortcutService::instance()->isItemShortcutWidget(mEntry->id())
   225         message.append(
   215             || (parentsIds.count() > 0)) {
   226             HbParameterLengthLimiter("txt_applib_dialog_uninstalls_1_and_deletes_all_sh").arg(
   216         message.append(HbParameterLengthLimiter(
   227                 HsMenuService::getName(mItemId)));
   217                 "txt_applib_dialog_uninstalls_1_and_deletes_all_sh").arg(
       
   218                         mEntry->text()));
   228     } else {
   219     } else {
   229         message.append(
   220         message.append(HbParameterLengthLimiter(
   230             HbParameterLengthLimiter("txt_applib_dialog_1_will_be_removed_from_phone_c").arg(
   221                 "txt_applib_dialog_1_will_be_removed_from_phone_c").arg(
   231                 HsMenuService::getName(mItemId)));
   222                         mEntry->text()));
   232     }
   223     }
   233 
   224 
   234     // create and show message box
   225     // create and show message box
   235     mUninstallMessage = HsMenuDialogFactory().create(message);
   226 
   236     if( isJava ){
   227     QScopedPointer<HbMessageBox> dialog(
   237         QSharedPointer<CaEntry> entry = CaService::instance()->getEntry(mItemId);
   228             HsMenuDialogFactory().create(message));
   238         HbIcon icon = entry->makeIcon();
   229     if (isJava){
   239         mUninstallMessage->setIcon(icon);
   230         dialog->setIcon(mEntry->makeIcon());
   240     }
   231     }
   241     mConfirmAction = mUninstallMessage->actions().value(0);
   232 
   242     
   233     QScopedPointer<HsDialogController> dialogController(
   243     QScopedPointer<HsMenuEntryRemovedHandler> entryObserver(
   234             new HsDialogController(dialog.take(),
   244         new HsMenuEntryRemovedHandler(mItemId, this, SIGNAL(exit())));
   235                     HsMenuDialogFactory::acceptActionIndex(),
   245     entryObserver.take()->setParent(mUninstallMessage);
   236                     HsMenuDialogFactory::rejectActionIndex()));
   246     
   237 
   247     mUninstallMessage->open(this, SLOT(uninstallMessageFinished(HbAction*)));
   238     connect(dialogController.data(), SIGNAL(acceptActionTriggered(QAction*)),
       
   239             this, SLOT(uninstallItem()));
       
   240 
       
   241     connect(dialogController.data(), SIGNAL(dialogCompleted()),
       
   242             this, SIGNAL(exit()));
       
   243 
       
   244     // ensure dialog is dismissed on app key pressed
       
   245     connect(this, SIGNAL(exited()),
       
   246             dialogController.data(), SLOT(dismissDialog()));
       
   247 
       
   248     dialogController.take()->openDialog(mEntry->id());
   248 }
   249 }
   249 
   250 
   250 /*!
   251 /*!
   251  Method create uninstall confirmation dialog for java.
   252  Method create uninstall confirmation dialog for java.
   252  \retval void
   253  \retval void
   253  */
   254  */
   254 void HsUninstallItemState::createUninstallJavaMessage()
   255 void HsUninstallItemState::createUninstallJavaMessage()
   255 {
   256 {
   256     HbDocumentLoader loader;
       
   257     bool loadStatusOk = false;
       
   258     loader.load(HS_UNINSTALL_DIALOG_LAYOUT, &loadStatusOk);
       
   259     
       
   260     Q_ASSERT_X(loadStatusOk,
       
   261             HS_UNINSTALL_DIALOG_LAYOUT,
       
   262            "Error while loading docml file.");
       
   263 
       
   264     QString componentName;
   257     QString componentName;
   265     QStringList applicationsNames;
   258     QStringList applicationsNames;
   266     QString detailsMessage;
   259     QString detailsMessage;
   267     getApplicationsNames(componentName, applicationsNames, detailsMessage);
   260     getApplicationsNames(componentName, applicationsNames, detailsMessage);
   268     
   261 
       
   262     if (applicationsNames.isEmpty() && detailsMessage.isEmpty()) {
       
   263         createSimpleUninstallMessage(true);
       
   264     } else {
       
   265         HbDocumentLoader loader;
       
   266 
       
   267         QString section = loadProperSection(applicationsNames,
       
   268                 detailsMessage, loader);
       
   269         if (!section.isNull()) {
       
   270             HbDialog *const dialog = qobject_cast<HbDialog*>(
       
   271                     loader.findWidget(HS_UNINSTALL_DIALOG_NAME));
       
   272 
       
   273             if (dialog) {
       
   274                 prepareDialog(dialog);
       
   275 
       
   276                 HbLabel* iconLabel = qobject_cast<HbLabel*>(loader.findWidget(
       
   277                         HS_UNINSTALL_DIALOG_CONFIRMATION_DIALOG_ICON));
       
   278                 iconLabel->setIcon(mEntry->makeIcon());
       
   279 
       
   280                 prepareDialogLabel(componentName, loader);
       
   281 
       
   282                 if ((section == definition02) || (section == definition04)) {
       
   283                     qobject_cast<HbLabel*>( loader.findWidget(
       
   284                             HS_UNINSTALL_DIALOG_DELETE_LABEL))->setPlainText(
       
   285                                     detailsMessage);
       
   286                 }
       
   287 
       
   288                 if ((section == definition02) || (section == definition03)) {
       
   289                     prepareApplicationListLabel(applicationsNames, loader);
       
   290                 }
       
   291 
       
   292                 QScopedPointer<HsDialogController> dialogController(
       
   293                         new HsDialogController( dialog,
       
   294                                 HsMenuDialogFactory::acceptActionIndex(),
       
   295                                 HsMenuDialogFactory::rejectActionIndex()));
       
   296                 connect(dialogController.data(), SIGNAL(acceptActionTriggered(QAction*)),
       
   297                         this, SLOT(uninstallItem()));
       
   298                 connect(dialogController.data(), SIGNAL(dialogCompleted()),
       
   299                         this, SIGNAL(exit()));
       
   300                 connect(this, SIGNAL(exited()),
       
   301                         dialogController.data(), SLOT(dismissDialog()));
       
   302 
       
   303                 dialogController.take()->openDialog(mEntry->id());
       
   304             }
       
   305         }
       
   306     }
       
   307 }
       
   308 
       
   309 void HsUninstallItemState::prepareDialogLabel(
       
   310     QString &componentName, HbDocumentLoader &loader)
       
   311 {
       
   312     CaQuery parentsQuery;
       
   313     parentsQuery.setChildId(mEntry->id());
       
   314     parentsQuery.setEntryTypeNames(QStringList(Hs::collectionTypeName));
       
   315     QList<int> parentsIds = CaService::instance()->getEntryIds(parentsQuery);
       
   316 
       
   317     HbLabel* textLabel = qobject_cast<HbLabel*>(loader.findWidget(
       
   318             HS_UNINSTALL_DIALOG_CONFIRMATION_DIALOG_LABEL));
       
   319 
       
   320     QString plainText;
       
   321     if (HsShortcutService::instance()->isItemShortcutWidget(mEntry->id())
       
   322             || parentsIds.count()) {
       
   323         plainText = HbParameterLengthLimiter(
       
   324                 "txt_applib_info_delete_1_all_its_shortcuts_and").arg(
       
   325                         componentName);
       
   326     } else {
       
   327         plainText = HbParameterLengthLimiter(
       
   328                 "txt_applib_info_delete_1_and_associated_data").arg(
       
   329                         componentName);
       
   330     }
       
   331     textLabel->setPlainText(plainText);
       
   332 }
       
   333 
       
   334 void HsUninstallItemState::prepareApplicationListLabel(
       
   335         QStringList & applicationsNames, HbDocumentLoader & loader)
       
   336 {
       
   337     QString applicationsList;
       
   338     QString newLine("\n");
       
   339     for(int i = 0;i < applicationsNames.count();i++){
       
   340         applicationsList += applicationsNames[i] + newLine;
       
   341     }
       
   342 
       
   343     HbLabel *listView;
       
   344     listView = qobject_cast<HbLabel*>(loader.findWidget(
       
   345             HS_UNINSTALL_DIALOG_LIST_VIEW_LABEL));
       
   346     listView->setPlainText(applicationsList);
       
   347 }
       
   348 
       
   349 QString HsUninstallItemState::loadProperSection(
       
   350         QStringList &applicationsNames, QString &detailsMessage,
       
   351         HbDocumentLoader &loader)
       
   352 {
   269     QString section;
   353     QString section;
   270     if (applicationsNames.isEmpty() && detailsMessage.isEmpty()) {        
   354     if (!applicationsNames.isEmpty() && !detailsMessage.isEmpty()) {
   271         createSimpleUninstallMessage(true);
   355         section = QString(definition02);
   272     }
   356     } else if (!applicationsNames.isEmpty() && detailsMessage.isEmpty()) {
   273     else {
   357         section = QString(definition03);
   274         if ( (!applicationsNames.isEmpty()) && (!detailsMessage.isEmpty())) {
   358     }else if (applicationsNames.isEmpty() && !detailsMessage.isEmpty()) {
   275             mDialogType = UninstallDialogDefinition02;
   359         section = QString(definition04);
   276             section = QString("uninstallDialogDefinition02");
   360     }
   277             loader.load(
   361     if(!section.isNull()){
       
   362         bool loadStatusOk = false;
       
   363         loader.load(HS_UNINSTALL_DIALOG_LAYOUT, &loadStatusOk);
       
   364 
       
   365         Q_ASSERT_X(loadStatusOk,
       
   366                 HS_UNINSTALL_DIALOG_LAYOUT,
       
   367                "Error while loading docml file.");
       
   368 
       
   369         loader.load(
   278                 HS_UNINSTALL_DIALOG_LAYOUT, section, &loadStatusOk);
   370                 HS_UNINSTALL_DIALOG_LAYOUT, section, &loadStatusOk);
   279         }
   371         Q_ASSERT_X(loadStatusOk,
   280         else if ( (!applicationsNames.isEmpty() && detailsMessage.isEmpty())) {
   372                 HS_UNINSTALL_DIALOG_LAYOUT,
   281             mDialogType = UninstallDialogDefinition03;
   373                "Error while loading docml file section.");
   282             section = QString("uninstallDialogDefinition03");
   374     }
   283             loader.load(
   375     return section;
   284                 HS_UNINSTALL_DIALOG_LAYOUT, section, &loadStatusOk);
   376 }
   285         }
   377 
   286         else if (applicationsNames.isEmpty() && (!detailsMessage.isEmpty())) {
   378 HsDialogController *HsUninstallItemState::prepareDialog(
   287             mDialogType = UninstallDialogDefinition04;
   379         HbDialog *dialog)
   288             section = QString("uninstallDialogDefinition04");
   380 {
   289             loader.load(
   381     dialog->setAttribute(Qt::WA_DeleteOnClose);
   290                 HS_UNINSTALL_DIALOG_LAYOUT, section, &loadStatusOk);
   382     dialog->setTimeout(HbPopup::NoTimeout);
   291         }
   383     dialog->actions()[0]->setParent(dialog);
   292 
   384     dialog->actions()[1]->setParent(dialog);
   293         mUninstallJavaMessage = qobject_cast<HbDialog*>(
   385     return NULL;
   294             loader.findWidget(HS_UNINSTALL_DIALOG_NAME));
   386 }
   295 
       
   296         if (mUninstallJavaMessage) {
       
   297             mUninstallJavaMessage->setAttribute(Qt::WA_DeleteOnClose);
       
   298             mUninstallJavaMessage->setTimeout(HbPopup::NoTimeout);
       
   299             mUninstallJavaMessage->actions()[0]->setParent(mUninstallJavaMessage);
       
   300             mUninstallJavaMessage->actions()[1]->setParent(mUninstallJavaMessage);
       
   301 
       
   302             HbLabel* iconLabel =
       
   303             qobject_cast<HbLabel*>(
       
   304                 loader.findWidget(HS_UNINSTALL_DIALOG_CONFIRMATION_DIALOG_ICON));
       
   305             QSharedPointer<CaEntry> entry2 = CaService::instance()->getEntry(mItemId);
       
   306             HbIcon icon = entry2->makeIcon();
       
   307             iconLabel->setIcon(icon);
       
   308 
       
   309             CaQuery parentsQuery;
       
   310             parentsQuery.setChildId(mItemId);
       
   311             parentsQuery.setEntryTypeNames(QStringList(Hs::collectionTypeName));
       
   312             QList<int> parentsIds = CaService::instance()->getEntryIds(
       
   313                     parentsQuery);
       
   314             
       
   315             HbLabel* textLabel =
       
   316             qobject_cast<HbLabel*>(
       
   317                 loader.findWidget(HS_UNINSTALL_DIALOG_CONFIRMATION_DIALOG_LABEL));
       
   318             if (HsShortcutService::instance()->isItemShortcutWidget(mItemId) ||
       
   319                 (parentsIds.count() > 0)) {
       
   320                 textLabel->setPlainText(HbParameterLengthLimiter(
       
   321                     "txt_applib_info_delete_1_all_its_shortcuts_and").arg(
       
   322                             componentName));
       
   323             } else {
       
   324                 textLabel->setPlainText(HbParameterLengthLimiter(
       
   325                     "txt_applib_info_delete_1_and_associated_data").arg(
       
   326                             componentName));
       
   327             }
       
   328 
       
   329             HbLabel* detailsUninstalLabel;
       
   330             if ((mDialogType == UninstallDialogDefinition02) ||
       
   331                 (mDialogType == UninstallDialogDefinition04)) {
       
   332                 detailsUninstalLabel= qobject_cast<HbLabel*>(
       
   333                     loader.findWidget(HS_UNINSTALL_DIALOG_DELETE_LABEL));
       
   334                 detailsUninstalLabel->setPlainText(detailsMessage);
       
   335             }
       
   336 
       
   337             HbLabel* listView;
       
   338             QString applicationsList;
       
   339             QString newLine("\n");
       
   340             if ((mDialogType == UninstallDialogDefinition02) ||
       
   341                 (mDialogType == UninstallDialogDefinition03)) {
       
   342                 listView = qobject_cast<HbLabel*>(
       
   343                     loader.findWidget(HS_UNINSTALL_DIALOG_LIST_VIEW_LABEL));
       
   344 
       
   345                 for (int i=0; i<applicationsNames.count(); i++) {
       
   346                     applicationsList = applicationsList + applicationsNames[i] + newLine;
       
   347                 }
       
   348                 listView->setPlainText(applicationsList);
       
   349             }
       
   350 
       
   351             mConfirmAction = qobject_cast<HbAction*>(loader.findObject(
       
   352                     HS_UNINSTALL_DIALOG_CONFIRMATION_ACTION));
       
   353         
       
   354             QScopedPointer<HsMenuEntryRemovedHandler> entryObserver(
       
   355                 new HsMenuEntryRemovedHandler(mItemId, this, SIGNAL(exit())));
       
   356             entryObserver.take()->setParent(mUninstallJavaMessage);
       
   357             
       
   358             mUninstallJavaMessage->open(this, SLOT(uninstallMessageFinished(HbAction*)));
       
   359         }
       
   360     }
       
   361 }