messagingapp/shareui/src/shareuiprivate.cpp
branchGCC_SURGE
changeset 47 5b14749788d7
parent 27 e4592d119491
parent 44 36f374c67aa8
equal deleted inserted replaced
35:a32b19fb291e 47:5b14749788d7
    67 /**
    67 /**
    68  * Destructor.
    68  * Destructor.
    69  */
    69  */
    70 ShareUiPrivate::~ShareUiPrivate()
    70 ShareUiPrivate::~ShareUiPrivate()
    71     {
    71     {
    72     reset();
       
    73     }
    72     }
    74 
    73 
    75 /**
    74 /**
    76  * Clear the internal data structures
    75  * Clear the internal data structures
    77  */
    76  */
    78 void ShareUiPrivate::reset()
    77 void ShareUiPrivate::reset()
    79     {
    78     {
    80     mFileList.clear();
    79     mFileList.clear();
    81 
    80 
    82     mIndexActionMap.clear();
    81     mIndexActionMap.clear();
       
    82     foreach(XQAiwRequest* request,mAiwRequestList)
       
    83     {
       
    84         delete request;
       
    85     }
    83     mAiwRequestList.clear();
    86     mAiwRequestList.clear();
    84 
    87 
    85     if ( mSharePopup )
       
    86         {
       
    87         delete mSharePopup;
       
    88         mSharePopup = 0;
       
    89         }
       
    90     }
    88     }
    91 
    89 
    92 /**
    90 /**
    93  * Initialize and start the dialog
    91  * Initialize and start the dialog
    94  * 
    92  * 
    97  * 
    95  * 
    98  */
    96  */
    99 bool ShareUiPrivate::init(QStringList& fileList, bool embedded)
    97 bool ShareUiPrivate::init(QStringList& fileList, bool embedded)
   100     {    
    98     {    
   101     reset();
    99     reset();
   102     
   100     mIsEmbedded = embedded;
   103     // No input files
   101     // No input files
   104     if ( fileList.count() == 0 )
   102     if ( fileList.count() == 0 )
   105         {
   103         {
   106         showNote(LOC_NO_FILES);
   104         showNote(LOC_NO_FILES);
   107         return true;       
   105         return true;       
   128     
   126     
   129     // Some protected content
   127     // Some protected content
   130     if ( fileList.count() != filteredFileList.count() )
   128     if ( fileList.count() != filteredFileList.count() )
   131         {
   129         {
   132         showNote(LOC_PROTECTED_CONTENT);      
   130         showNote(LOC_PROTECTED_CONTENT);      
       
   131         return true;
   133         }
   132         }
   134     
   133     
   135     // Only protected content
   134     // Only protected content
   136     if ( filteredFileList.count() == 0 )
   135     if ( filteredFileList.count() == 0 )
   137         {
   136         {
   208     mSharePopup = new HbDialog();
   207     mSharePopup = new HbDialog();
   209     // make it delete itself on close
   208     // make it delete itself on close
   210     mSharePopup->setAttribute( Qt::WA_DeleteOnClose, true );
   209     mSharePopup->setAttribute( Qt::WA_DeleteOnClose, true );
   211     HbTextItem* heading = new HbTextItem(LOC_SEND_SELECTED_ITEM, mSharePopup);
   210     HbTextItem* heading = new HbTextItem(LOC_SEND_SELECTED_ITEM, mSharePopup);
   212     heading->setAlignment(Qt::AlignCenter);
   211     heading->setAlignment(Qt::AlignCenter);
   213     mSharePopup->setDismissPolicy(HbDialog::NoDismiss);
   212     mSharePopup->setDismissPolicy(HbDialog::TapAnywhere);
   214     mSharePopup->setHeadingWidget(heading);
   213     mSharePopup->setHeadingWidget(heading);
   215     mSharePopup->setFrameType(HbDialog::Strong);
   214     mSharePopup->setFrameType(HbDialog::Strong);
       
   215     connect(mSharePopup, SIGNAL(aboutToClose()), this, SLOT(reset()));
   216         
   216         
   217     // Content widget
   217     // Content widget
   218     mContentListView = new HbListView(mSharePopup);
   218     mContentListView = new HbListView(mSharePopup);
   219     ShareListItem *prototype = new ShareListItem(mSharePopup);
   219     ShareListItem *prototype = new ShareListItem(mSharePopup);
   220     mContentListView->setItemPrototype(prototype);
   220     mContentListView->setItemPrototype(prototype);
   271 /**
   271 /**
   272  * Slot for handling send service selection on the UI.
   272  * Slot for handling send service selection on the UI.
   273  */
   273  */
   274 void ShareUiPrivate::onTriggered(void)
   274 void ShareUiPrivate::onTriggered(void)
   275     {
   275     {
       
   276     
   276     XQAiwRequest* request = 0;
   277     XQAiwRequest* request = 0;
   277     request = qobject_cast<XQAiwRequest*>(sender());
   278     request = qobject_cast<XQAiwRequest*>(sender());
   278     if(request)
   279     if(request)
   279         {
   280         {
   280         QList<QVariant> args;
   281         QList<QVariant> args;
   281         QVariant fileList(mFileList);
   282         QVariant fileList(mFileList);
   282         args << fileList;
   283         args << fileList;
       
   284         request->setEmbedded(mIsEmbedded);
   283         request->setArguments(args);
   285         request->setArguments(args);
   284         }
   286         }
   285     }
   287     }
   286 
   288 
   287 /**
   289 /**
   288  * Slot for handling valid returns from the framework.
   290  * Slot for handling valid returns from the framework.
   289  */
   291  */
   290 void ShareUiPrivate::handleOk(const QVariant& result)
   292 void ShareUiPrivate::handleOk(const QVariant& result)
   291     {
   293 {
   292     Q_UNUSED(result)
   294     Q_UNUSED(result)
   293     }
   295          
       
   296     XQAiwRequest* request = 0;
       
   297     request = qobject_cast<XQAiwRequest*>(sender());
       
   298     if(request)
       
   299     {
       
   300        disconnect(request, 
       
   301                SIGNAL(requestError(int,const QString&)), 
       
   302                this, 
       
   303                SLOT(handleError(int,const QString&)));
       
   304     }
       
   305 }
   294 
   306 
   295 /**
   307 /**
   296  * Slot for handling errors from the framework.
   308  * Slot for handling errors from the framework.
   297  */
   309  */
   298 void ShareUiPrivate::handleError(int errorCode, const QString& errorMessage)
   310 void ShareUiPrivate::handleError(int errorCode, const QString& errorMessage)
   317     
   329     
   318     if ( action )
   330     if ( action )
   319         {
   331         {
   320         action->setEnabled(true);
   332         action->setEnabled(true);
   321         action->activate(HbAction::Trigger);
   333         action->activate(HbAction::Trigger);
   322         }    
   334         } 
       
   335     
   323     mSharePopup->close();
   336     mSharePopup->close();
   324     }
   337     }
   325 
   338 
   326 
   339 
   327 /**
   340 /**