35 delete mLoader; |
35 delete mLoader; |
36 } |
36 } |
37 |
37 |
38 bool BTSendDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) |
38 bool BTSendDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) |
39 { |
39 { |
40 mLastError = NoError; |
40 if(!mLastError) |
41 if(mFileIndex != parameters.value("currentFileIdx").toString().toInt() ) |
|
42 { |
41 { |
43 mDialogHeading->setTextWrapping(Hb::TextWordWrap); |
42 if(mFileIndex != parameters.value("currentFileIdx").toString().toInt() ) |
44 mDialogHeading->setAlignment(Qt::AlignHCenter); |
43 { |
45 |
44 mDialogHeading->setTextWrapping(Hb::TextWordWrap); |
46 QString headLabel = QString(LOC_SENDING_FILES_TO_DEVICE).arg(parameters.value("currentFileIdx").toInt()) |
45 mDialogHeading->setAlignment(Qt::AlignHCenter); |
47 .arg(parameters.value("totalFilesCnt").toInt()) |
|
48 .arg(parameters.value("destinationName").toString()); |
|
49 mDialogHeading->setPlainText(headLabel); |
|
50 |
46 |
51 //Todo - Insert file icons here instead of bluetooth image |
47 QString headLabel = QString(LOC_SENDING_FILES_TO_DEVICE).arg(parameters.value("currentFileIdx").toInt()) |
52 QIcon icon(QString(":/icons/qtg_large_bluetooth.svg")); |
48 .arg(parameters.value("totalFilesCnt").toInt()) |
53 mFileIconLabel->setIcon(icon); |
49 .arg(parameters.value("destinationName").toString()); |
54 mFileNameLabel->setPlainText(parameters.value("fileName").toString()); |
50 mDialogHeading->setPlainText(headLabel); |
55 mFileSizeLabel->setPlainText(parameters.value("fileSzTxt").toString()); |
51 |
56 mProgressBar->setMinimum(0); |
52 //Todo - Insert file icons here instead of bluetooth image |
57 mProgressBar->setProgressValue(0); |
53 QIcon icon(QString(":/icons/qtg_large_bluetooth.svg")); |
58 mProgressBar->setMaximum(parameters.value("fileSz").toInt()); |
54 mFileIconLabel->setIcon(icon); |
59 mFileIndex = parameters.value("currentFileIdx").toString().toInt(); |
55 mFileNameLabel->setPlainText(parameters.value("fileName").toString()); |
|
56 mFileSizeLabel->setPlainText(parameters.value("fileSzTxt").toString()); |
|
57 mProgressBar->setMinimum(0); |
|
58 mProgressBar->setProgressValue(0); |
|
59 mProgressBar->setMaximum(parameters.value("fileSz").toInt()); |
|
60 mFileIndex = parameters.value("currentFileIdx").toString().toInt(); |
|
61 } |
|
62 else |
|
63 { |
|
64 mProgressBar->setProgressValue(parameters.value("progressValue").toInt()); |
|
65 } |
|
66 return true; |
60 } |
67 } |
61 else |
68 else |
62 { |
69 { |
63 mProgressBar->setProgressValue(parameters.value("progressValue").toInt()); |
70 return false; |
64 } |
71 } |
65 return true; |
|
66 } |
72 } |
67 |
73 |
68 int BTSendDialogWidget::deviceDialogError() const |
74 int BTSendDialogWidget::deviceDialogError() const |
69 { |
75 { |
70 return mLastError; |
76 return mLastError; |
88 return const_cast<BTSendDialogWidget*>(this); |
94 return const_cast<BTSendDialogWidget*>(this); |
89 } |
95 } |
90 |
96 |
91 void BTSendDialogWidget::constructDialog(const QVariantMap& parameters) |
97 void BTSendDialogWidget::constructDialog(const QVariantMap& parameters) |
92 { |
98 { |
93 Q_UNUSED(parameters); |
99 Q_UNUSED(parameters); |
94 mLoader = new HbDocumentLoader(); |
100 mLoader = new HbDocumentLoader(); |
95 bool ok = false; |
101 bool ok = false; |
96 |
102 |
97 mLoader->load(DOCML_BT_SEND_DIALOG, &ok); |
103 mLoader->load(DOCML_BT_SEND_DIALOG, &ok); |
98 if(ok) |
104 if(ok) |
102 mFileIconLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileIcon")); |
108 mFileIconLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileIcon")); |
103 mFileNameLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileName")); |
109 mFileNameLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileName")); |
104 mFileSizeLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileSize")); |
110 mFileSizeLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileSize")); |
105 |
111 |
106 mProgressBar = qobject_cast<HbProgressBar*>(mLoader->findWidget("sendProgressBar")); |
112 mProgressBar = qobject_cast<HbProgressBar*>(mLoader->findWidget("sendProgressBar")); |
107 mSendDialog->setBackgroundFaded(false); |
113 mSendDialog->setBackgroundFaded(false); |
108 mSendDialog->setDismissPolicy(HbPopup::NoDismiss); |
114 mSendDialog->setDismissPolicy(HbPopup::NoDismiss); |
109 mSendDialog->setTimeout(HbPopup::NoTimeout); |
115 mSendDialog->setTimeout(HbPopup::NoTimeout); |
110 mSendDialog->setAttribute(Qt::WA_DeleteOnClose); |
116 mSendDialog->setAttribute(Qt::WA_DeleteOnClose); |
111 |
117 |
112 mCancelAction = static_cast<HbAction*>( mLoader->findObject( "cancelAction" ) ); |
118 mCancelAction = static_cast<HbAction*>( mLoader->findObject( "cancelAction" ) ); |
113 |
119 |
114 connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); |
120 connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); |
115 } |
121 } |
116 else |
122 else |
117 { |
123 { |
118 mLastError = DocMLLoadingError; |
124 mLastError = DocMLLoadingError; |
119 } |
125 } |
120 } |
126 } |
121 |
127 |
122 |
128 |
123 void BTSendDialogWidget::cancelClicked() |
129 void BTSendDialogWidget::cancelClicked() |
124 { |
130 { |