messagingapp/shareui/src/shareuiprivate.cpp
changeset 37 518b245aa84c
parent 25 84d9eb65b26f
child 38 4e4b6adb1024
--- a/messagingapp/shareui/src/shareuiprivate.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/shareui/src/shareuiprivate.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -69,7 +69,6 @@
  */
 ShareUiPrivate::~ShareUiPrivate()
     {
-    reset();
     }
 
 /**
@@ -78,27 +77,14 @@
 void ShareUiPrivate::reset()
     {
     mFileList.clear();
-    
-    mIndexActionMap.clear(); // TODO Is there MEM leak.
-    mAiwRequestList.clear(); // TODO Is there MEM leak.
-    
-    if ( mContentItemModel )
-        {
-        delete mContentItemModel;
-        mContentItemModel = 0;
-        }
-    
-    if ( mContentListView )
-        {
-        delete mContentListView;
-        mContentListView = 0;
-        }
-    
-    if ( mSharePopup )
-        {
-        delete mSharePopup;
-        mSharePopup = 0;
-        }
+
+    mIndexActionMap.clear();
+    foreach(XQAiwRequest* request,mAiwRequestList)
+    {
+        delete request;
+    }
+    mAiwRequestList.clear();
+
     }
 
 /**
@@ -111,7 +97,7 @@
 bool ShareUiPrivate::init(QStringList& fileList, bool embedded)
     {    
     reset();
-    
+    mIsEmbedded = embedded;
     // No input files
     if ( fileList.count() == 0 )
         {
@@ -142,6 +128,7 @@
     if ( fileList.count() != filteredFileList.count() )
         {
         showNote(LOC_PROTECTED_CONTENT);      
+        return true;
         }
     
     // Only protected content
@@ -201,7 +188,7 @@
             return true;
             }
 
-        mSharePopup->exec();
+        mSharePopup->show();
         }
     else
         {
@@ -218,13 +205,14 @@
     {
     // Dialog
     mSharePopup = new HbDialog();
-    
+    // make it delete itself on close
+    mSharePopup->setAttribute( Qt::WA_DeleteOnClose, true );
     HbTextItem* heading = new HbTextItem(LOC_SEND_SELECTED_ITEM, mSharePopup);
     heading->setAlignment(Qt::AlignCenter);
+    mSharePopup->setDismissPolicy(HbDialog::NoDismiss);
     mSharePopup->setHeadingWidget(heading);
-    mSharePopup->setTimeout(HbDialog::NoTimeout);  
     mSharePopup->setFrameType(HbDialog::Strong);
-    mSharePopup->setPrimaryAction(new HbAction(LOC_BUTTON_CANCEL, mSharePopup));
+    connect(mSharePopup, SIGNAL(aboutToClose()), this, SLOT(reset()));
         
     // Content widget
     mContentListView = new HbListView(mSharePopup);
@@ -237,6 +225,9 @@
     mSharePopup->setContentWidget(mContentListView);
     connect(mContentListView, SIGNAL(activated(QModelIndex)),
             this, SLOT(itemActivated(QModelIndex)));  
+    
+    HbAction* cancelAction = new HbAction(LOC_BUTTON_CANCEL,mSharePopup);
+    mSharePopup->addAction(cancelAction);
     }
 
 /**
@@ -289,6 +280,7 @@
         QList<QVariant> args;
         QVariant fileList(mFileList);
         args << fileList;
+        request->setEmbedded(mIsEmbedded);
         request->setArguments(args);
         }
     }
@@ -329,7 +321,6 @@
         action->setEnabled(true);
         action->activate(HbAction::Trigger);
         }    
-    mSharePopup->close();
     }