27 #define LOC_SENDING_FILES_TO_DEVICE hbTrId("txt_bt_title_sending_file_l1l2_to_3") |
27 #define LOC_SENDING_FILES_TO_DEVICE hbTrId("txt_bt_title_sending_file_l1l2_to_3") |
28 |
28 |
29 const char* DOCML_BT_SEND_DIALOG = ":/docml/bt-send-dialog.docml"; |
29 const char* DOCML_BT_SEND_DIALOG = ":/docml/bt-send-dialog.docml"; |
30 |
30 |
31 BTSendDialogWidget::BTSendDialogWidget(const QVariantMap ¶meters) |
31 BTSendDialogWidget::BTSendDialogWidget(const QVariantMap ¶meters) |
32 { |
32 { |
33 mLoader = 0; |
33 mLoader = 0; |
34 constructDialog(parameters); |
34 constructDialog(parameters); |
35 } |
35 } |
36 |
36 |
37 BTSendDialogWidget::~BTSendDialogWidget() |
37 BTSendDialogWidget::~BTSendDialogWidget() |
38 { |
38 { |
39 delete mLoader; |
39 delete mLoader; |
40 /* if(mContentItemModel) |
40 /* if(mContentItemModel) |
41 { |
41 { |
42 delete mContentItemModel; |
42 delete mContentItemModel; |
43 mContentItemModel = NULL; |
43 mContentItemModel = NULL; |
44 }*/ |
44 }*/ |
45 } |
45 } |
46 |
46 |
47 bool BTSendDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) |
47 bool BTSendDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) |
48 { |
48 { |
49 if(mFileIndex != parameters.value("currentFileIdx").toString().toInt() ) |
49 if(mFileIndex != parameters.value("currentFileIdx").toString().toInt() ) |
50 { |
50 { |
51 mDialogHeading->setTextWrapping(Hb::TextWordWrap); |
51 mDialogHeading->setTextWrapping(Hb::TextWordWrap); |
52 mDialogHeading->setAlignment(Qt::AlignHCenter); |
52 mDialogHeading->setAlignment(Qt::AlignHCenter); |
53 //Todo - replace this with the actual text from parameters |
53 //Todo - replace this with the actual text from parameters |
54 |
54 |
55 QString headLabel = QString(LOC_SENDING_FILES_TO_DEVICE).arg(parameters.value("currentFileIdx").toInt()) |
55 QString headLabel = QString(LOC_SENDING_FILES_TO_DEVICE).arg(parameters.value("currentFileIdx").toInt()) |
87 mFileSizeLabel->setPlainText(parameters.value("fileSzTxt").toString()); |
87 mFileSizeLabel->setPlainText(parameters.value("fileSzTxt").toString()); |
88 mProgressBar->setMinimum(0); |
88 mProgressBar->setMinimum(0); |
89 mProgressBar->setProgressValue(0); |
89 mProgressBar->setProgressValue(0); |
90 mProgressBar->setMaximum(parameters.value("fileSz").toInt()); |
90 mProgressBar->setMaximum(parameters.value("fileSz").toInt()); |
91 mFileIndex = parameters.value("currentFileIdx").toString().toInt(); |
91 mFileIndex = parameters.value("currentFileIdx").toString().toInt(); |
92 } |
92 } |
93 else |
93 else |
94 { |
94 { |
95 mProgressBar->setProgressValue(parameters.value("progressValue").toInt()); |
95 mProgressBar->setProgressValue(parameters.value("progressValue").toInt()); |
96 } |
96 } |
97 return true; |
97 return true; |
98 } |
98 } |
99 |
99 |
100 int BTSendDialogWidget::deviceDialogError() const |
100 int BTSendDialogWidget::deviceDialogError() const |
101 { |
101 { |
102 return 0; |
102 return 0; |
103 } |
103 } |
104 |
104 |
105 void BTSendDialogWidget::closeDeviceDialog(bool byClient) |
105 void BTSendDialogWidget::closeDeviceDialog(bool byClient) |
106 { |
106 { |
107 Q_UNUSED(byClient); |
107 Q_UNUSED(byClient); |
108 mSendDialog->close(); |
108 mSendDialog->close(); |
109 // below redundant call is required because of the api documentation. |
109 // below redundant call is required because of the api documentation. |
110 emit deviceDialogClosed(); |
110 emit deviceDialogClosed(); |
111 } |
111 } |
112 |
112 |
113 HbPopup* BTSendDialogWidget::deviceDialogWidget() const |
113 HbPopup* BTSendDialogWidget::deviceDialogWidget() const |
114 { |
114 { |
115 return mSendDialog; |
115 return mSendDialog; |
116 } |
116 } |
117 |
117 |
118 QObject *BTSendDialogWidget::signalSender() const |
118 QObject *BTSendDialogWidget::signalSender() const |
119 { |
119 { |
120 return const_cast<BTSendDialogWidget*>(this); |
120 return const_cast<BTSendDialogWidget*>(this); |
121 } |
121 } |
122 |
122 |
123 bool BTSendDialogWidget::constructDialog(const QVariantMap&/*parameters*/) |
123 bool BTSendDialogWidget::constructDialog(const QVariantMap&/*parameters*/) |
124 { |
124 { |
125 mLoader = new HbDocumentLoader(); |
125 mLoader = new HbDocumentLoader(); |
126 bool ok = false; |
126 bool ok = false; |
127 |
127 |
128 mLoader->load(DOCML_BT_SEND_DIALOG, &ok); |
128 mLoader->load(DOCML_BT_SEND_DIALOG, &ok); |
129 if(ok) |
129 if(ok) |
130 { |
130 { |
131 mSendDialog = qobject_cast<HbDialog*>(mLoader->findWidget("senddialog")); |
131 mSendDialog = qobject_cast<HbDialog*>(mLoader->findWidget("sendProgressDialog")); |
132 mDialogHeading = qobject_cast<HbLabel*>(mLoader->findWidget("heading")); |
132 mDialogHeading = qobject_cast<HbLabel*>(mLoader->findWidget("sendDialogHeading")); |
133 mFileIconLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileiconlabel")); |
133 mFileIconLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileIcon")); |
134 mFileNameLabel = qobject_cast<HbLabel*>(mLoader->findWidget("filenamelabel")); |
134 mFileNameLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileName")); |
135 mFileSizeLabel = qobject_cast<HbLabel*>(mLoader->findWidget("filesizelabel")); |
135 mFileSizeLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileSize")); |
136 // mSendDialog->setHeadingWidget(mLabel); |
136 // mSendDialog->setHeadingWidget(mLabel); |
137 /* mListView = qobject_cast<HbListView*>(mLoader->findWidget("listView")); |
137 /* mListView = qobject_cast<HbListView*>(mLoader->findWidget("listView")); |
138 if(mListView) |
138 if(mListView) |
139 { |
139 { |
140 mContentItemModel = new QStandardItemModel(this); |
140 mContentItemModel = new QStandardItemModel(this); |
141 mListView->setModel(mContentItemModel);//, prototype); |
141 mListView->setModel(mContentItemModel);//, prototype); |
142 }*/ |
142 }*/ |
143 |
143 |
144 mProgressBar = qobject_cast<HbProgressBar*>(mLoader->findWidget("horizontalProgressBar")); |
144 mProgressBar = qobject_cast<HbProgressBar*>(mLoader->findWidget("sendProgressBar")); |
145 |
145 |
146 // HbAction* hide = new HbAction("Hide"); |
146 // HbAction* hide = new HbAction("Hide"); |
147 // HbAction* cancel = new HbAction("Cancel"); |
147 // HbAction* cancel = new HbAction("Cancel"); |
148 |
148 |
149 // this->addAction(hide); |
149 // this->addAction(hide); |
150 // this->addAction(cancel); |
150 // this->addAction(cancel); |
151 |
151 |
152 // QGraphicsWidget *widget = mLoader->findWidget(QString("container")); |
152 // QGraphicsWidget *widget = mLoader->findWidget(QString("container")); |
153 // this->setContentWidget(widget); |
153 // this->setContentWidget(widget); |
154 } |
154 } |
155 |
155 |
156 mSendDialog->setBackgroundFaded(false); |
156 mSendDialog->setBackgroundFaded(false); |
157 mSendDialog->setDismissPolicy(HbPopup::NoDismiss); |
157 mSendDialog->setDismissPolicy(HbPopup::NoDismiss); |
158 mSendDialog->setTimeout(HbPopup::NoTimeout); |
158 mSendDialog->setTimeout(HbPopup::NoTimeout); |
159 mSendDialog->setAttribute(Qt::WA_DeleteOnClose); |
159 mSendDialog->setAttribute(Qt::WA_DeleteOnClose); |
160 |
160 |
161 mHideAction = static_cast<HbAction*>( mLoader->findObject( "hideaction" ) ); |
161 mHideAction = static_cast<HbAction*>( mLoader->findObject( "hideAction" ) ); |
162 mHideAction->disconnect(mSendDialog); |
162 mHideAction->disconnect(mSendDialog); // Todo: needed? |
163 |
163 |
164 mCancelAction = static_cast<HbAction*>( mLoader->findObject( "cancelaction" ) ); |
164 mCancelAction = static_cast<HbAction*>( mLoader->findObject( "cancelAction" ) ); |
165 mCancelAction->disconnect(mSendDialog); |
165 mCancelAction->disconnect(mSendDialog); // Todo: needed? |
166 |
166 |
167 connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); |
167 connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); |
168 |
168 |
169 return true; |
169 return true; |
170 } |
170 } |
171 |
171 |
172 /*void BTSendDialogWidget::hideEvent(QHideEvent *event) |
172 /*void BTSendDialogWidget::hideEvent(QHideEvent *event) |
173 { |
173 { |
174 HbDialog::hideEvent(event); |
174 HbDialog::hideEvent(event); |
175 emit deviceDialogClosed(); |
175 emit deviceDialogClosed(); |