bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp
changeset 67 16e4b9007960
parent 57 5ebadcda06cb
child 70 f5508c13dfe0
--- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp	Wed Sep 29 13:09:05 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp	Wed Oct 13 13:15:31 2010 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
  * All rights reserved.
  * This component and the accompanying materials are made available
  * under the terms of "Eclipse Public License v1.0""
@@ -16,12 +16,7 @@
  */
 
 #include "btsenddialogwidget.h"
-#include <hblabel.h>
-#include <hblistview.h>
-#include <hbtoolbar.h>
-#include <hblistwidget.h>
-#include <qstandarditemmodel.h>
-#include <hbaction.h>
+#include "btdevicedialogpluginerrors.h"
 
 
 #define LOC_SENDING_FILES_TO_DEVICE hbTrId("txt_bt_title_sending_file_l1l2_to_3")
@@ -31,56 +26,29 @@
 BTSendDialogWidget::BTSendDialogWidget(const QVariantMap &parameters)
 {
     mLoader = 0;
+    mLastError = NoError;
     constructDialog(parameters);
 }
 
 BTSendDialogWidget::~BTSendDialogWidget()
 {
     delete mLoader;
- /*   if(mContentItemModel)
-        {
-        delete mContentItemModel;
-        mContentItemModel = NULL;
-        }*/
 }
 
 bool BTSendDialogWidget::setDeviceDialogParameters(const QVariantMap &parameters)
 {
+	mLastError = NoError;
     if(mFileIndex != parameters.value("currentFileIdx").toString().toInt() )
     {
         mDialogHeading->setTextWrapping(Hb::TextWordWrap);
         mDialogHeading->setAlignment(Qt::AlignHCenter);
-        //Todo - replace this with the actual text from parameters
     
         QString headLabel = QString(LOC_SENDING_FILES_TO_DEVICE).arg(parameters.value("currentFileIdx").toInt())
                                         .arg(parameters.value("totalFilesCnt").toInt())
                                         .arg(parameters.value("destinationName").toString());
-      /*  headLabel.append(QString("Sending file "));
-        headLabel.append(parameters.value("currentFileIdx").toString());
-        headLabel.append('/');
-        headLabel.append(parameters.value("totalFilesCnt").toString());
-        headLabel.append(QString(" to "));
-        headLabel.append(parameters.value("destinationName").toString());*/
         mDialogHeading->setPlainText(headLabel);
         
- /*       QStringList info;
-        info.append(parameters.value("fileName").toString());
-        info.append(parameters.value("fileSzTxt").toString());
-                    
-        QStandardItem* listitem = new QStandardItem();
-        // parameters.
-        listitem->setData(info, Qt::DisplayRole);
-    
-        //Todo - Insert file icons here thumbnail icon        
-        QIcon icon(QString(":/icons/qtg_large_bluetooth.svg"));
-        listitem->setIcon(icon);
-    
-        delete mContentItemModel;
-        mContentItemModel = new QStandardItemModel(this);
-        mListView->setModel(mContentItemModel);//, prototype);
-    
-        mContentItemModel->appendRow(listitem);*/
-        //Todo - Insert file icons here thumbnail icon        
+        //Todo - Insert file icons here instead of bluetooth image        
         QIcon icon(QString(":/icons/qtg_large_bluetooth.svg"));        
         mFileIconLabel->setIcon(icon);
         mFileNameLabel->setPlainText(parameters.value("fileName").toString());
@@ -99,7 +67,7 @@
 
 int BTSendDialogWidget::deviceDialogError() const
 {
-    return 0;
+    return mLastError;
 }
 
 void BTSendDialogWidget::closeDeviceDialog(bool byClient)
@@ -120,8 +88,9 @@
     return const_cast<BTSendDialogWidget*>(this);
 }  
 
-bool BTSendDialogWidget::constructDialog(const QVariantMap&/*parameters*/)
+void BTSendDialogWidget::constructDialog(const QVariantMap& parameters)
 {
+		Q_UNUSED(parameters);
     mLoader = new HbDocumentLoader();
     bool ok = false;
     
@@ -133,59 +102,23 @@
         mFileIconLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileIcon"));
         mFileNameLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileName"));
         mFileSizeLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileSize"));
- //       mSendDialog->setHeadingWidget(mLabel);
-   /*     mListView = qobject_cast<HbListView*>(mLoader->findWidget("listView"));
-        if(mListView)
-            {
-            mContentItemModel = new QStandardItemModel(this);
-            mListView->setModel(mContentItemModel);//, prototype);
-            }*/
          
         mProgressBar = qobject_cast<HbProgressBar*>(mLoader->findWidget("sendProgressBar"));
-                
-   //     HbAction* hide = new HbAction("Hide");
-     //   HbAction* cancel = new HbAction("Cancel");
-        
-    //    this->addAction(hide);
-  //      this->addAction(cancel);
-        
-  //      QGraphicsWidget *widget = mLoader->findWidget(QString("container"));
-   //     this->setContentWidget(widget);
+		    mSendDialog->setBackgroundFaded(false);
+		    mSendDialog->setDismissPolicy(HbPopup::NoDismiss);
+		    mSendDialog->setTimeout(HbPopup::NoTimeout);
+		    mSendDialog->setAttribute(Qt::WA_DeleteOnClose);
+		    
+		    mCancelAction = static_cast<HbAction*>( mLoader->findObject( "cancelAction" ) );
+		    
+		    connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked()));
     }
-
-    mSendDialog->setBackgroundFaded(false);
-    mSendDialog->setDismissPolicy(HbPopup::NoDismiss);
-    mSendDialog->setTimeout(HbPopup::NoTimeout);
-    mSendDialog->setAttribute(Qt::WA_DeleteOnClose);
-    
-    mHideAction = static_cast<HbAction*>( mLoader->findObject( "hideAction" ) );
-    mHideAction->disconnect(mSendDialog);  // Todo:  needed?
-    
-    mCancelAction = static_cast<HbAction*>( mLoader->findObject( "cancelAction" ) );
-    mCancelAction->disconnect(mSendDialog); // Todo:  needed?
-    
-    connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked()));
-
-    return true;
+    else
+    	{
+			mLastError = DocMLLoadingError;    		
+    	}
 }
 
-/*void BTSendDialogWidget::hideEvent(QHideEvent *event)
-    {
-    HbDialog::hideEvent(event);
-    emit deviceDialogClosed();
-    }
-
-void BTSendDialogWidget::showEvent(QShowEvent *event)
-    {
-    HbDialog::showEvent(event);
-    }*/
-
-/*void BTSendDialogWidget::hideClicked()
-    {
-    // TODO
-    this->close();
-    emit deviceDialogClosed();
-    }*/
 
 void BTSendDialogWidget::cancelClicked()
 {
@@ -193,14 +126,4 @@
     emit deviceDialogClosed();
 }
 
-/*void BTSendDialogWidget::inputClosed(HbAction* action)
-    {
-    QVariantMap data;
-     
-    HbDialog *dlg=static_cast<HbDialog*>(sender());
-    if(dlg->actions().first() == action) {
-    } 
-    else if(dlg->actions().at(1) == action) {
-      }
-    }*/