messagingapp/shareui/src/shareuiprivate.cpp
changeset 27 e4592d119491
parent 25 84d9eb65b26f
child 47 5b14749788d7
equal deleted inserted replaced
25:84d9eb65b26f 27:e4592d119491
    76  * Clear the internal data structures
    76  * Clear the internal data structures
    77  */
    77  */
    78 void ShareUiPrivate::reset()
    78 void ShareUiPrivate::reset()
    79     {
    79     {
    80     mFileList.clear();
    80     mFileList.clear();
    81     
    81 
    82     mIndexActionMap.clear(); // TODO Is there MEM leak.
    82     mIndexActionMap.clear();
    83     mAiwRequestList.clear(); // TODO Is there MEM leak.
    83     mAiwRequestList.clear();
    84     
    84 
    85     if ( mContentItemModel )
       
    86         {
       
    87         delete mContentItemModel;
       
    88         mContentItemModel = 0;
       
    89         }
       
    90     
       
    91     if ( mContentListView )
       
    92         {
       
    93         delete mContentListView;
       
    94         mContentListView = 0;
       
    95         }
       
    96     
       
    97     if ( mSharePopup )
    85     if ( mSharePopup )
    98         {
    86         {
    99         delete mSharePopup;
    87         delete mSharePopup;
   100         mSharePopup = 0;
    88         mSharePopup = 0;
   101         }
    89         }
   199             {
   187             {
   200             showNote(LOC_NO_SERVICES);
   188             showNote(LOC_NO_SERVICES);
   201             return true;
   189             return true;
   202             }
   190             }
   203 
   191 
   204         mSharePopup->exec();
   192         mSharePopup->show();
   205         }
   193         }
   206     else
   194     else
   207         {
   195         {
   208         showNote(LOC_NO_SERVICES);
   196         showNote(LOC_NO_SERVICES);
   209         }
   197         }
   216   */
   204   */
   217 void ShareUiPrivate::initializeUi()
   205 void ShareUiPrivate::initializeUi()
   218     {
   206     {
   219     // Dialog
   207     // Dialog
   220     mSharePopup = new HbDialog();
   208     mSharePopup = new HbDialog();
   221     
   209     // make it delete itself on close
       
   210     mSharePopup->setAttribute( Qt::WA_DeleteOnClose, true );
   222     HbTextItem* heading = new HbTextItem(LOC_SEND_SELECTED_ITEM, mSharePopup);
   211     HbTextItem* heading = new HbTextItem(LOC_SEND_SELECTED_ITEM, mSharePopup);
   223     heading->setAlignment(Qt::AlignCenter);
   212     heading->setAlignment(Qt::AlignCenter);
       
   213     mSharePopup->setDismissPolicy(HbDialog::NoDismiss);
   224     mSharePopup->setHeadingWidget(heading);
   214     mSharePopup->setHeadingWidget(heading);
   225     mSharePopup->setTimeout(HbDialog::NoTimeout);  
       
   226     mSharePopup->setFrameType(HbDialog::Strong);
   215     mSharePopup->setFrameType(HbDialog::Strong);
   227     mSharePopup->setPrimaryAction(new HbAction(LOC_BUTTON_CANCEL, mSharePopup));
       
   228         
   216         
   229     // Content widget
   217     // Content widget
   230     mContentListView = new HbListView(mSharePopup);
   218     mContentListView = new HbListView(mSharePopup);
   231     ShareListItem *prototype = new ShareListItem(mSharePopup);
   219     ShareListItem *prototype = new ShareListItem(mSharePopup);
   232     mContentListView->setItemPrototype(prototype);
   220     mContentListView->setItemPrototype(prototype);
   235     mContentListView->setModel(mContentItemModel); 
   223     mContentListView->setModel(mContentItemModel); 
   236     mContentListView->setUniformItemSizes(true);
   224     mContentListView->setUniformItemSizes(true);
   237     mSharePopup->setContentWidget(mContentListView);
   225     mSharePopup->setContentWidget(mContentListView);
   238     connect(mContentListView, SIGNAL(activated(QModelIndex)),
   226     connect(mContentListView, SIGNAL(activated(QModelIndex)),
   239             this, SLOT(itemActivated(QModelIndex)));  
   227             this, SLOT(itemActivated(QModelIndex)));  
       
   228     
       
   229     HbAction* cancelAction = new HbAction(LOC_BUTTON_CANCEL,mSharePopup);
       
   230     mSharePopup->addAction(cancelAction);
   240     }
   231     }
   241 
   232 
   242 /**
   233 /**
   243  * fetchServiceAction fetches the action associated with a specified interface descriptor.
   234  * fetchServiceAction fetches the action associated with a specified interface descriptor.
   244  * This is used after the fetchServiceDescriptors is called, and 
   235  * This is used after the fetchServiceDescriptors is called, and