cmmanager/cpdestinationplugin/src/cpiapitem.cpp
changeset 20 9c97ad6591ae
child 23 7ec726f93df1
child 28 860702281757
equal deleted inserted replaced
18:fcbbe021d614 20:9c97ad6591ae
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *   Data item for representing access points in UI.
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <QObject>
       
    20 #include <HbMenu>
       
    21 #include <HbAction>
       
    22 #include <HbDocumentLoader>
       
    23 #include <HbRadioButtonList>
       
    24 #include <HbDialog>
       
    25 #include <HbMessageBox>
       
    26 #include <HbPopup>
       
    27 #include <HbLabel>
       
    28 #include <HbDataFormViewItem>
       
    29 #include <HbDataForm>
       
    30 #include <HbDataFormModel>
       
    31 #include <cpbasesettingview.h>
       
    32 #include <cpsettingformitemdata.h>
       
    33 #include <cpsettingformentryitemdata.h>
       
    34 #include <cpitemdatahelper.h>
       
    35 #include <cmdestination_shim.h>
       
    36 #include <cmmanager_shim.h>
       
    37 #include <cmconnectionmethod_shim.h>
       
    38 
       
    39 // User includes
       
    40 #include "cpiapitem.h"
       
    41 #include "cpdestinationentryitem.h"
       
    42 #include "cpbearerapplugininterface.h"
       
    43 #include "OstTraceDefinitions.h"
       
    44 #ifdef OST_TRACE_COMPILER_IN_USE
       
    45 #include "cpiapitemTraces.h"
       
    46 #endif
       
    47 /*!
       
    48     \class  CpIapItem
       
    49     \brief  This class represents access point in data model. 
       
    50             It takes care of all access point related operations.
       
    51 */
       
    52 
       
    53 // External function prototypes
       
    54 
       
    55 // Local constants
       
    56 
       
    57 // ======== LOCAL FUNCTIONS ========
       
    58 
       
    59 // ======== MEMBER FUNCTIONS ========
       
    60 
       
    61 /*!         
       
    62    Constructor.
       
    63    
       
    64    @param[in] itemDataHelper Helper for connecting signals and slots.
       
    65    @param[in] iapId Unique ID if the access point this object represents.
       
    66    @param[in] iapName Name of the access point this object represents.
       
    67    @param[in] destId Unique ID of the destination that contains reference to 
       
    68               the access point this object represents.
       
    69    @param[in] bearerPlugin Pointer to the object that implements settings view
       
    70               for this access point.
       
    71  */
       
    72 CpIapItem::CpIapItem(
       
    73     CpItemDataHelper &itemDataHelper,  
       
    74     int iapId, 
       
    75     const QString &iapName, 
       
    76     int destId,
       
    77     bool apProtected,
       
    78     CpBearerApPluginInterface *bearerPlugin) :
       
    79     CpSettingFormEntryItemData(itemDataHelper), 
       
    80     mIapId(iapId), 
       
    81     mIapName(iapName),
       
    82     mDestId(destId),
       
    83     mProtected(apProtected),
       
    84     mBearerPlugin(bearerPlugin),
       
    85     mMoveOngoing(false),
       
    86     mDialog(0),
       
    87     mList(0)
       
    88 {
       
    89     OstTraceFunctionEntry0(CPIAPITEM_CPIAPITEM_ENTRY);
       
    90     try {
       
    91         mCmm = new CmManagerShim();
       
    92     } catch (const std::exception&) {
       
    93         OstTrace0(TRACE_NORMAL, CPIAPITEM_CPIAPITEM, "CpIapItem::CpIapItem: Exception caught");
       
    94         mCmm = NULL;
       
    95     }
       
    96     
       
    97     // Fix connections
       
    98     itemDataHelper.removeConnection(this,SIGNAL(pressed()),this,SLOT(onLaunchView()));
       
    99     itemDataHelper.addConnection(
       
   100         this,
       
   101         SIGNAL(longPress(QPointF)),
       
   102         this,
       
   103         SLOT(showItemMenu(QPointF)));
       
   104     if (!apProtected) {
       
   105         itemDataHelper.addConnection(this,SIGNAL(clicked()),this,SLOT(onLaunchView()));
       
   106     }
       
   107     OstTraceFunctionExit0(CPIAPITEM_CPIAPITEM_EXIT);
       
   108 }
       
   109 
       
   110 /*!
       
   111     Destructor
       
   112  */
       
   113 CpIapItem::~CpIapItem()
       
   114 {
       
   115     OstTraceFunctionEntry0(DUP1_CPIAPITEM_CPIAPITEM_ENTRY);
       
   116     delete mCmm;
       
   117     OstTraceFunctionExit0(DUP1_CPIAPITEM_CPIAPITEM_EXIT);
       
   118 }
       
   119 
       
   120 /*!
       
   121     \return Returns ID of this access point
       
   122  */
       
   123 int CpIapItem::getIapId() const
       
   124 {
       
   125     OstTraceFunctionEntry0(CPIAPITEM_GETIAPID_ENTRY);
       
   126     OstTraceFunctionExit0(CPIAPITEM_GETIAPID_EXIT);
       
   127     return mIapId;
       
   128 }
       
   129 
       
   130 /*!
       
   131     Shows user the item specific menu. The menu is triggered by long pressing
       
   132     the access point item.
       
   133     
       
   134     @param[in] position Preferred position for the item specific menu.
       
   135  */
       
   136 void CpIapItem::showItemMenu(QPointF position)
       
   137 {
       
   138     OstTraceFunctionEntry0(CPIAPITEM_SHOWITEMMENU_ENTRY);
       
   139     if (isCmManagerAvailable()) {
       
   140         bool settingsReadSuccessful = true;
       
   141         CMManagerShim::CmmProtectionLevel protLvl;
       
   142         try {      
       
   143             if (mDestId == 0) {
       
   144                 protLvl = CMManagerShim::ProtLevel0;
       
   145             } else {
       
   146                 CmDestinationShim *destination = mCmm->destination(mDestId);
       
   147                 protLvl = destination->protectionLevel();
       
   148                 delete destination;
       
   149             }              
       
   150         } 
       
   151         catch (const std::exception&)  {
       
   152             OstTrace0(TRACE_NORMAL, CPIAPITEM_SHOWITEMMENU, "CpIapItem::showItemMenu: Exception caught");
       
   153             settingsReadSuccessful = false;
       
   154         }
       
   155         if (settingsReadSuccessful) {
       
   156             // Settings could be read from commsdat: show menu.
       
   157             createItemMenu(protLvl, position)->show();
       
   158         }    
       
   159     }
       
   160     OstTraceFunctionExit0(CPIAPITEM_SHOWITEMMENU_EXIT);
       
   161 }
       
   162 
       
   163 /*!
       
   164     Prompts user for destination where access point is to be 
       
   165     added and then makes the move in commsdat.
       
   166  */
       
   167 void CpIapItem::moveIap()
       
   168 {
       
   169     OstTraceFunctionEntry0(CPIAPITEM_MOVEIAP_ENTRY);
       
   170     mMoveOngoing = true;
       
   171     queryDestination();
       
   172     OstTraceFunctionExit0(CPIAPITEM_MOVEIAP_EXIT);
       
   173 }
       
   174 
       
   175 /*!
       
   176     Shows confirmation query for access point deletion.
       
   177  */
       
   178 void CpIapItem::showDeleteConfirmation()
       
   179 {
       
   180     OstTraceFunctionEntry0(CPIAPITEM_SHOWDELETECONFIRMATION_ENTRY);
       
   181     HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
       
   182     note->clearActions();
       
   183     note->setAttribute(Qt::WA_DeleteOnClose);
       
   184     note->setText(hbTrId("txt_occ_info_delete_access_point_1").arg(mIapName));
       
   185     HbAction *primaryAction = new HbAction(hbTrId("txt_common_button_yes"));
       
   186     bool connected = connect(
       
   187         primaryAction, 
       
   188         SIGNAL(triggered()), 
       
   189         this, 
       
   190         SLOT(deleteConfirmed()));
       
   191     Q_ASSERT(connected);
       
   192     note->addAction(primaryAction);
       
   193     note->addAction(new HbAction(hbTrId("txt_common_button_no")));
       
   194     note->setTimeout(HbPopup::NoTimeout);
       
   195     note->show();
       
   196     OstTraceFunctionExit0(CPIAPITEM_SHOWDELETECONFIRMATION_EXIT);
       
   197 }
       
   198 
       
   199 /*!
       
   200     Prompts user for target destination and then adds access point 
       
   201     that this object represents to the prompted destination.
       
   202  */
       
   203 void CpIapItem::shareIap()
       
   204 {
       
   205     OstTraceFunctionEntry0(CPIAPITEM_SHAREIAP_ENTRY);
       
   206     mMoveOngoing = false;
       
   207     queryDestination();
       
   208     OstTraceFunctionExit0(CPIAPITEM_SHAREIAP_EXIT);
       
   209 }
       
   210 
       
   211 /*!
       
   212     Completes either saving or sharing of access point by 
       
   213     making the move in commsdat.
       
   214  */
       
   215 void CpIapItem::queryDialogClosed()
       
   216 {
       
   217     OstTraceFunctionEntry0(CPIAPITEM_QUERYDIALOGCLOSED_ENTRY);
       
   218     if (mMoveOngoing) {
       
   219         saveMove(mDestinationList[mList->selected()]);
       
   220     } else {
       
   221         saveShare(mDestinationList[mList->selected()]);
       
   222     }
       
   223     OstTraceFunctionExit0(CPIAPITEM_QUERYDIALOGCLOSED_EXIT);
       
   224 }
       
   225 
       
   226 /*!
       
   227     Completes the deletion process by deleting access point from
       
   228     commsdat.
       
   229  */
       
   230 void CpIapItem::deleteConfirmed()
       
   231 {
       
   232     OstTraceFunctionEntry0(CPIAPITEM_DELETECONFIRMED_ENTRY);
       
   233     bool deleteSuccessful = true;
       
   234     try  {
       
   235         if (mDestId != 0) {
       
   236             CmDestinationShim *destination = mCmm->destination(mDestId);
       
   237             CmConnectionMethodShim *cm = destination->connectionMethodByID(mIapId);
       
   238             destination->deleteConnectionMethod(cm);
       
   239             destination->update();
       
   240             delete destination;
       
   241         } else {
       
   242             CmConnectionMethodShim *cm = mCmm->connectionMethod(mIapId);
       
   243             cm->deleteConnectionMethod();
       
   244             delete cm;
       
   245         }
       
   246     } catch (const std::exception&) {
       
   247         OstTrace0(TRACE_NORMAL, DUP1_CPIAPITEM_DELETECONFIRMED, "CpIapItem::deleteConfirmed: Exception caught");
       
   248         deleteSuccessful = false;
       
   249     }
       
   250     if (deleteSuccessful) {
       
   251         HbDataForm *form = static_cast<HbDataForm*>(model()->parent());
       
   252         QModelIndex index = static_cast<HbDataFormModel*>(this->model())->indexFromItem(this);
       
   253         HbDataFormViewItem *viewItem = form->dataFormViewItem(index);
       
   254         viewItem->deleteLater();
       
   255         OstTrace0(TRACE_NORMAL, CPIAPITEM_DELETECONFIRMED, "CpIapItem::deleteConfirmed: Emit access point changed signal");
       
   256         emit iapChanged();
       
   257     } else {
       
   258         showErrorNote(hbTrId("txt_occ_info_unable_to_save_setting"));
       
   259     }
       
   260     OstTraceFunctionExit0(CPIAPITEM_DELETECONFIRMED_EXIT);
       
   261 }
       
   262 
       
   263 /*!
       
   264     Updates access point item name when the item becomes visible.
       
   265  */
       
   266 void CpIapItem::updateIap(const QModelIndex index)
       
   267 {
       
   268     OstTrace0( TRACE_FLOW, CPIAPITEM_UPDATEIAP_ENTRY, "CpIapItem::updateIap entry" );
       
   269     Q_UNUSED(index);
       
   270     try {
       
   271         CmConnectionMethodShim *cm = mCmm->connectionMethod(mIapId);
       
   272         this->setContentWidgetData("text", cm->getStringAttribute(CMManagerShim::CmName));
       
   273         delete cm;
       
   274     } catch (const std::exception&) {
       
   275         OstTrace0( TRACE_NORMAL, CPIAPITEM_UPDATEIAP, "CpIapItem::updateIap: exception caught, CM name reading failed" );
       
   276     }
       
   277     // Disconnect because we need to do this only after returning
       
   278     // from accees point settings view
       
   279     HbDataForm *form = static_cast<HbDataForm*>(model()->parent());
       
   280     disconnect(
       
   281         form, 
       
   282         SIGNAL(itemShown(const QModelIndex)),
       
   283         this, 
       
   284         SLOT(updateIap(const QModelIndex)));
       
   285     OstTrace0( TRACE_FLOW, DUP1_CPIAPITEM_UPDATEIAP_EXIT, "CpIapItem::updateIap exit" );
       
   286 }
       
   287 
       
   288 /*!
       
   289     Gets access point specific view from bearer plugin.
       
   290     
       
   291     \return Returns settings view containing access point settings.
       
   292  */
       
   293 CpBaseSettingView *CpIapItem::createSettingView() const
       
   294 {
       
   295     OstTraceFunctionEntry0(CPIAPITEM_CREATESETTINGVIEW_ENTRY);
       
   296     CpBaseSettingView *view = NULL;
       
   297     if (mBearerPlugin != NULL) {
       
   298         HbDataForm *form = static_cast<HbDataForm*>(model()->parent()); 
       
   299         bool connected = connect(
       
   300             form, 
       
   301             SIGNAL(itemShown(const QModelIndex)),
       
   302             this, 
       
   303             SLOT(updateIap(const QModelIndex)));
       
   304         Q_ASSERT(connected);
       
   305         view = mBearerPlugin->createSettingView(mIapId);
       
   306     }
       
   307     OstTraceFunctionExit0(CPIAPITEM_CREATESETTINGVIEW_EXIT);
       
   308     return view;
       
   309 }
       
   310 
       
   311 /*!
       
   312     Prompts user for destination.
       
   313  */
       
   314 void CpIapItem::queryDestination()
       
   315 {
       
   316     OstTraceFunctionEntry0(CPIAPITEM_QUERYDESTINATION_ENTRY);
       
   317     bool readingSuccessful = true;
       
   318     QStringList destinations;
       
   319     try {
       
   320         mCmm->allDestinations(mDestinationList);
       
   321         
       
   322         for (int i = 0; i < mDestinationList.count(); i++) {
       
   323             CmDestinationShim *destination = mCmm->destination(mDestinationList[i]);
       
   324             if ((destination->id() != mDestId)
       
   325                 && !destination->isHidden()) {
       
   326 
       
   327                 QString dest = destination->name();
       
   328                 destinations.append(dest);
       
   329             } else {
       
   330                 // Remove this destination from list to sync both lists
       
   331                 mDestinationList.removeAt(i);
       
   332                 i--;
       
   333             }
       
   334             delete destination;
       
   335         }
       
   336     } catch (const std::exception&) {
       
   337         OstTrace0(TRACE_NORMAL, CPIAPITEM_QUERYDESTINATION, "CpIapItem::queryDestination: exception caught");
       
   338         readingSuccessful = false;
       
   339     }
       
   340     
       
   341     if (readingSuccessful) {
       
   342         // Load DocML 
       
   343         bool ok = false;
       
   344         HbDocumentLoader *loader = new HbDocumentLoader();
       
   345         loader->load(":/docml/cpdestinationplugindialogs.docml", &ok);
       
   346         mDialog = qobject_cast<HbDialog *>(loader->findWidget("dialog"));
       
   347         HbLabel *heading = qobject_cast<HbLabel *>(loader->findWidget("heading"));
       
   348         heading->setPlainText(hbTrId("txt_occ_dialog_select_network_destination_to_be_ac"));
       
   349         mList = qobject_cast<HbRadioButtonList *>(loader->findWidget("radioButtonList")); 
       
   350         mList->setItems(destinations);
       
   351         mList->setSelected(0);
       
   352         mOk = qobject_cast<HbAction *>(loader->findObject("okAction"));
       
   353         bool connected = connect(mOk, 
       
   354                                  SIGNAL(triggered()), 
       
   355                                  this, 
       
   356                                  SLOT(queryDialogClosed()));
       
   357         Q_ASSERT(connected);
       
   358         mDialog->show();
       
   359         delete loader;
       
   360     } else {
       
   361         OstTrace0(TRACE_NORMAL, DUP1_CPIAPITEM_QUERYDESTINATION, " CpIapItem::queryDestination: exception caught");
       
   362         showErrorNote(hbTrId("txt_occ_info_unable_to_read_settings"));
       
   363     }
       
   364     OstTraceFunctionExit0(CPIAPITEM_QUERYDESTINATION_EXIT);
       
   365 }
       
   366 
       
   367 /*!
       
   368     Shares access point to given destination.
       
   369     
       
   370     @param[in] id Target destination's ID
       
   371  */
       
   372 void CpIapItem::saveShare(int id)
       
   373 {
       
   374     OstTraceFunctionEntry0(CPIAPITEM_SAVESHARE_ENTRY);
       
   375     try {
       
   376         CmConnectionMethodShim *cm;
       
   377         if (mDestId != 0) {
       
   378             CmDestinationShim *source = mCmm->destination(mDestId);
       
   379             cm = source->connectionMethodByID(mIapId);
       
   380             delete source;
       
   381         } else {
       
   382             cm = mCmm->connectionMethod(mIapId);
       
   383         }
       
   384         CmDestinationShim *target = mCmm->destination(id);
       
   385         target->addConnectionMethod(cm);
       
   386         target->update();
       
   387         delete cm;
       
   388         delete target;
       
   389         OstTrace0(TRACE_NORMAL, CPIAPITEM_SAVESHARE, "CpIapItem::saveShare: Emit access point changed signal");
       
   390         emit iapChanged();
       
   391     } catch (const std::exception&) {
       
   392         OstTrace0(TRACE_NORMAL, DUP1_CPIAPITEM_SAVESHARE, "CpIapItem::saveShare: Exception caught");
       
   393         showErrorNote(hbTrId("txt_occ_info_unable_to_read_settings"));
       
   394     }
       
   395     OstTraceFunctionExit0(CPIAPITEM_SAVESHARE_EXIT);
       
   396 }
       
   397 
       
   398 /*!
       
   399     Moves access point from current destination to given destination.
       
   400     
       
   401     @param[in] id Target destination's ID
       
   402  */
       
   403 void CpIapItem::saveMove(int id)
       
   404 {
       
   405     OstTraceFunctionEntry0(CPIAPITEM_SAVEMOVE_ENTRY);
       
   406     try {
       
   407         // Make move in commsdat
       
   408         CmConnectionMethodShim *cm = NULL;
       
   409         if (mDestId != 0) {
       
   410             CmDestinationShim *source = mCmm->destination(mDestId);
       
   411             cm = source->connectionMethodByID(mIapId);
       
   412             source->removeConnectionMethod(cm);
       
   413             source->update();
       
   414             delete source;
       
   415         } else {
       
   416             cm = mCmm->connectionMethod(mIapId);
       
   417         }
       
   418         CmDestinationShim *target = mCmm->destination(id);
       
   419         target->addConnectionMethod(cm);
       
   420         target->update();
       
   421         delete target;
       
   422         delete cm;
       
   423     }
       
   424     catch (const std::exception&) {
       
   425         OstTrace0(TRACE_NORMAL, DUP1_CPIAPITEM_SAVEMOVE, "CpIapItem::saveMove: Exception caught");
       
   426         showErrorNote(hbTrId("txt_occ_info_unable_to_save_setting"));
       
   427     }
       
   428     OstTrace0(TRACE_NORMAL, CPIAPITEM_SAVEMOVE, "CpIapItem::saveMove: Emit access point changed signal");
       
   429     emit iapChanged(); 
       
   430     OstTraceFunctionExit0(CPIAPITEM_SAVEMOVE_EXIT);
       
   431 }
       
   432 
       
   433 /*!
       
   434     Tests if CmManagerShim has been created successfully
       
   435     earlier. If not, it retries.
       
   436  */
       
   437 bool CpIapItem::isCmManagerAvailable()
       
   438 {
       
   439     OstTraceFunctionEntry0(CPIAPITEM_ISCMMANAGERAVAILABLE_ENTRY);
       
   440     bool retval = false;
       
   441     if (mCmm == NULL) {
       
   442         try {
       
   443             mCmm = new CmManagerShim();
       
   444             retval = true;
       
   445         }
       
   446         catch (const std::exception&) {
       
   447             OstTrace0(TRACE_NORMAL, CPIAPITEM_ISCMMANAGERAVAILABLE, "CpIapItem::isCmManagerAvailable: Exception caught");
       
   448             mCmm = NULL;
       
   449         }
       
   450     } else {
       
   451         retval = true;
       
   452     }
       
   453     OstTraceFunctionExit0(CPIAPITEM_ISCMMANAGERAVAILABLE_EXIT);
       
   454     return retval;
       
   455 }
       
   456 
       
   457 /*!
       
   458     Helper function for creating item specific menu.
       
   459     
       
   460     @param[in] protLvl Effective protection level for this
       
   461                        access point.
       
   462  */
       
   463 HbMenu *CpIapItem::createItemMenu(
       
   464     CMManagerShim::CmmProtectionLevel protLvl,
       
   465     const QPointF &position)
       
   466 {
       
   467     OstTraceFunctionEntry0(CPIAPITEM_CREATEITEMMENU_ENTRY);
       
   468     HbMenu* menu = new HbMenu();
       
   469     menu->setAttribute(Qt::WA_DeleteOnClose);
       
   470     HbAction* moveIapAction 
       
   471         = menu->addAction(hbTrId("txt_occ_menu_move_to_other_destination"));
       
   472     bool connected = connect(moveIapAction, SIGNAL(triggered()), this, SLOT(moveIap()));
       
   473     Q_ASSERT(connected);
       
   474     HbAction* deleteIapAction 
       
   475         = menu->addAction(hbTrId("txt_common_menu_delete"));
       
   476     connected = connect(
       
   477         deleteIapAction, 
       
   478         SIGNAL(triggered()), 
       
   479         this, 
       
   480         SLOT(showDeleteConfirmation()));
       
   481     Q_ASSERT(connected);
       
   482     HbAction* shareIapAction 
       
   483         = menu->addAction(hbTrId("txt_occ_menu_share_to_other_destination"));
       
   484     connected = connect(shareIapAction, SIGNAL(triggered()), this, SLOT(shareIap()));
       
   485     Q_ASSERT(connected);
       
   486        
       
   487     if (protLvl == CMManagerShim::ProtLevel1) {
       
   488         // Disable operations for protected destinations
       
   489         moveIapAction->setDisabled(true);
       
   490         deleteIapAction->setDisabled(true);
       
   491         shareIapAction->setDisabled(true);
       
   492     } else if (protLvl == CMManagerShim::ProtLevel3) {
       
   493         // Disable operations for protected access points.
       
   494         moveIapAction->setDisabled(mProtected);
       
   495         deleteIapAction->setDisabled(mProtected);
       
   496         shareIapAction->setDisabled(mProtected);
       
   497     }
       
   498     
       
   499     // Can't share uncategorised APs
       
   500     if (mDestId == 0)
       
   501     {
       
   502         shareIapAction->setDisabled(true);
       
   503     }
       
   504        
       
   505     menu->setPreferredPos(position);
       
   506     OstTraceFunctionExit0(CPIAPITEM_CREATEITEMMENU_EXIT);
       
   507     return menu;
       
   508 }
       
   509 
       
   510 /*!
       
   511     Helper function for showing error notes.
       
   512     
       
   513     @param[in] info Info string to be shown in note.
       
   514  */
       
   515 void CpIapItem::showErrorNote(const QString &info)
       
   516 {
       
   517     OstTraceFunctionEntry0(CPIAPITEM_SHOWERRORNOTE_ENTRY);
       
   518     HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeInformation);
       
   519     note->clearActions();
       
   520     note->setAttribute(Qt::WA_DeleteOnClose);
       
   521     note->setText(info);
       
   522     note->setTimeout(HbPopup::NoTimeout);
       
   523     HbAction *errorOk = new HbAction(hbTrId("txt_common_button_ok"));                       
       
   524     note->addAction(errorOk);
       
   525     note->show();    
       
   526     OstTraceFunctionExit0(CPIAPITEM_SHOWERRORNOTE_EXIT);
       
   527 }