bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvprgrsdialogwidget.cpp
changeset 70 f5508c13dfe0
parent 57 5ebadcda06cb
child 71 083fd884d7dd
equal deleted inserted replaced
67:16e4b9007960 70:f5508c13dfe0
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include "btrecvprgrsdialogwidget.h"
    19 #include "btrecvprgrsdialogwidget.h"
    20 #include "bluetoothdevicedialogs.h"
    20 #include "bluetoothdevicedialogs.h"
       
    21 #include "btdevicedialogpluginerrors.h"
    21 
    22 
    22 const char* DOCML_BT_RECV_PRGRS_DIALOG = ":/docml/bt-recv-progress-dialog.docml";
    23 const char* DOCML_BT_RECV_PRGRS_DIALOG = ":/docml/bt-recv-progress-dialog.docml";
    23 
    24 
    24 
    25 
    25 BTRecvPrgrsDialogWidget::BTRecvPrgrsDialogWidget(const QVariantMap &parameters)
    26 BTRecvPrgrsDialogWidget::BTRecvPrgrsDialogWidget(const QVariantMap &parameters)
       
    27 :mLoader(0), mError(NoError)
    26 {
    28 {
    27     mLoader = 0;
       
    28     constructDialog(parameters);
    29     constructDialog(parameters);
    29 }
    30 }
    30 
    31 
    31 BTRecvPrgrsDialogWidget::~BTRecvPrgrsDialogWidget()
    32 BTRecvPrgrsDialogWidget::~BTRecvPrgrsDialogWidget()
    32 {
    33 {
    37     }
    38     }
    38 }
    39 }
    39 
    40 
    40 bool BTRecvPrgrsDialogWidget::setDeviceDialogParameters(const QVariantMap &parameters)
    41 bool BTRecvPrgrsDialogWidget::setDeviceDialogParameters(const QVariantMap &parameters)
    41 {
    42 {
    42     mProgressBar->setMinimum(0);
    43     if(!mError)
    43     mProgressBar->setMaximum(mFileSz);
    44     {
    44     mProgressBar->setProgressValue(parameters.value("progress").toInt());
    45         mProgressBar->setMinimum(0);
    45     return true;
    46         mProgressBar->setMaximum(mFileSz);
       
    47         mProgressBar->setProgressValue(parameters.value("progress").toInt());
       
    48         return true;
       
    49     }
       
    50     else
       
    51     {
       
    52         return false;
       
    53     }
    46 }
    54 }
    47 
    55 
    48 int BTRecvPrgrsDialogWidget::deviceDialogError() const
    56 int BTRecvPrgrsDialogWidget::deviceDialogError() const
    49 {
    57 {
    50     return 0;
    58     return mError;
    51 }
    59 }
    52 
    60 
    53 void BTRecvPrgrsDialogWidget::closeDeviceDialog(bool byClient)
    61 void BTRecvPrgrsDialogWidget::closeDeviceDialog(bool byClient)
    54 {
    62 {
    55     Q_UNUSED(byClient);
    63     Q_UNUSED(byClient);
    65 QObject* BTRecvPrgrsDialogWidget::signalSender() const
    73 QObject* BTRecvPrgrsDialogWidget::signalSender() const
    66 {
    74 {
    67     return const_cast<BTRecvPrgrsDialogWidget*>(this);
    75     return const_cast<BTRecvPrgrsDialogWidget*>(this);
    68 }
    76 }
    69 
    77 
    70 bool BTRecvPrgrsDialogWidget::constructDialog(const QVariantMap &parameters)
    78 void BTRecvPrgrsDialogWidget::constructDialog(const QVariantMap &parameters)
    71 {
    79 {
    72     mLoader = new HbDocumentLoader();
    80     mLoader = new HbDocumentLoader();
    73     bool ok = false;
    81     bool ok = false;
    74     
    82     
    75     mLoader->load(DOCML_BT_RECV_PRGRS_DIALOG, &ok);
    83     mLoader->load(DOCML_BT_RECV_PRGRS_DIALOG, &ok);
   151             mFileCount->setVisible(true);  
   159             mFileCount->setVisible(true);  
   152             
   160             
   153             QString fCntStr(hbTrId("txt_bt_info_ln_files_already_received", fCnt));
   161             QString fCntStr(hbTrId("txt_bt_info_ln_files_already_received", fCnt));
   154             mFileCount->setPlainText(fCntStr);
   162             mFileCount->setPlainText(fCntStr);
   155             }
   163             }
       
   164 
       
   165         mDialog->setBackgroundFaded(false);
       
   166         mDialog->setDismissPolicy(HbPopup::NoDismiss);
       
   167         mDialog->setTimeout(HbPopup::NoTimeout);
       
   168          
       
   169         connect(mHide, SIGNAL(triggered()), this, SLOT(hideClicked()));
       
   170         connect(mCancel, SIGNAL(triggered()), this, SLOT(cancelClicked()));
       
   171 
   156     }
   172     }
   157 
   173     else
   158     mDialog->setBackgroundFaded(false);
   174     {
   159     mDialog->setDismissPolicy(HbPopup::NoDismiss);
   175         mError = DocMLLoadingError;
   160     mDialog->setTimeout(HbPopup::NoTimeout);
   176     }
   161      
       
   162     connect(mHide, SIGNAL(triggered()), this, SLOT(hideClicked()));
       
   163     connect(mCancel, SIGNAL(triggered()), this, SLOT(cancelClicked()));
       
   164     
       
   165     return true;
       
   166 }
   177 }
   167 
   178 
   168 void BTRecvPrgrsDialogWidget::hideClicked()
   179 void BTRecvPrgrsDialogWidget::hideClicked()
   169 {
   180 {
   170     QVariantMap data;
   181     QVariantMap data;