14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "btsenddialogwidget.h" |
18 #include "btsenddialogwidget.h" |
19 #include <hblabel.h> |
19 #include "btdevicedialogpluginerrors.h" |
20 #include <hblistview.h> |
|
21 #include <hbtoolbar.h> |
|
22 #include <hblistwidget.h> |
|
23 #include <qstandarditemmodel.h> |
|
24 #include <hbaction.h> |
|
25 |
20 |
26 |
21 |
27 #define LOC_SENDING_FILES_TO_DEVICE hbTrId("txt_bt_title_sending_file_l1l2_to_3") |
22 #define LOC_SENDING_FILES_TO_DEVICE hbTrId("txt_bt_title_sending_file_l1l2_to_3") |
28 |
23 |
29 const char* DOCML_BT_SEND_DIALOG = ":/docml/bt-send-dialog.docml"; |
24 const char* DOCML_BT_SEND_DIALOG = ":/docml/bt-send-dialog.docml"; |
30 |
25 |
31 BTSendDialogWidget::BTSendDialogWidget(const QVariantMap ¶meters) |
26 BTSendDialogWidget::BTSendDialogWidget(const QVariantMap ¶meters) |
32 { |
27 { |
33 mLoader = 0; |
28 mLoader = 0; |
|
29 mLastError = NoError; |
34 constructDialog(parameters); |
30 constructDialog(parameters); |
35 } |
31 } |
36 |
32 |
37 BTSendDialogWidget::~BTSendDialogWidget() |
33 BTSendDialogWidget::~BTSendDialogWidget() |
38 { |
34 { |
39 delete mLoader; |
35 delete mLoader; |
40 /* if(mContentItemModel) |
|
41 { |
|
42 delete mContentItemModel; |
|
43 mContentItemModel = NULL; |
|
44 }*/ |
|
45 } |
36 } |
46 |
37 |
47 bool BTSendDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) |
38 bool BTSendDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) |
48 { |
39 { |
|
40 mLastError = NoError; |
49 if(mFileIndex != parameters.value("currentFileIdx").toString().toInt() ) |
41 if(mFileIndex != parameters.value("currentFileIdx").toString().toInt() ) |
50 { |
42 { |
51 mDialogHeading->setTextWrapping(Hb::TextWordWrap); |
43 mDialogHeading->setTextWrapping(Hb::TextWordWrap); |
52 mDialogHeading->setAlignment(Qt::AlignHCenter); |
44 mDialogHeading->setAlignment(Qt::AlignHCenter); |
53 //Todo - replace this with the actual text from parameters |
|
54 |
45 |
55 QString headLabel = QString(LOC_SENDING_FILES_TO_DEVICE).arg(parameters.value("currentFileIdx").toInt()) |
46 QString headLabel = QString(LOC_SENDING_FILES_TO_DEVICE).arg(parameters.value("currentFileIdx").toInt()) |
56 .arg(parameters.value("totalFilesCnt").toInt()) |
47 .arg(parameters.value("totalFilesCnt").toInt()) |
57 .arg(parameters.value("destinationName").toString()); |
48 .arg(parameters.value("destinationName").toString()); |
58 /* headLabel.append(QString("Sending file ")); |
|
59 headLabel.append(parameters.value("currentFileIdx").toString()); |
|
60 headLabel.append('/'); |
|
61 headLabel.append(parameters.value("totalFilesCnt").toString()); |
|
62 headLabel.append(QString(" to ")); |
|
63 headLabel.append(parameters.value("destinationName").toString());*/ |
|
64 mDialogHeading->setPlainText(headLabel); |
49 mDialogHeading->setPlainText(headLabel); |
65 |
50 |
66 /* QStringList info; |
51 //Todo - Insert file icons here instead of bluetooth image |
67 info.append(parameters.value("fileName").toString()); |
|
68 info.append(parameters.value("fileSzTxt").toString()); |
|
69 |
|
70 QStandardItem* listitem = new QStandardItem(); |
|
71 // parameters. |
|
72 listitem->setData(info, Qt::DisplayRole); |
|
73 |
|
74 //Todo - Insert file icons here thumbnail icon |
|
75 QIcon icon(QString(":/icons/qtg_large_bluetooth.svg")); |
|
76 listitem->setIcon(icon); |
|
77 |
|
78 delete mContentItemModel; |
|
79 mContentItemModel = new QStandardItemModel(this); |
|
80 mListView->setModel(mContentItemModel);//, prototype); |
|
81 |
|
82 mContentItemModel->appendRow(listitem);*/ |
|
83 //Todo - Insert file icons here thumbnail icon |
|
84 QIcon icon(QString(":/icons/qtg_large_bluetooth.svg")); |
52 QIcon icon(QString(":/icons/qtg_large_bluetooth.svg")); |
85 mFileIconLabel->setIcon(icon); |
53 mFileIconLabel->setIcon(icon); |
86 mFileNameLabel->setPlainText(parameters.value("fileName").toString()); |
54 mFileNameLabel->setPlainText(parameters.value("fileName").toString()); |
87 mFileSizeLabel->setPlainText(parameters.value("fileSzTxt").toString()); |
55 mFileSizeLabel->setPlainText(parameters.value("fileSzTxt").toString()); |
88 mProgressBar->setMinimum(0); |
56 mProgressBar->setMinimum(0); |
131 mSendDialog = qobject_cast<HbDialog*>(mLoader->findWidget("sendProgressDialog")); |
100 mSendDialog = qobject_cast<HbDialog*>(mLoader->findWidget("sendProgressDialog")); |
132 mDialogHeading = qobject_cast<HbLabel*>(mLoader->findWidget("sendDialogHeading")); |
101 mDialogHeading = qobject_cast<HbLabel*>(mLoader->findWidget("sendDialogHeading")); |
133 mFileIconLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileIcon")); |
102 mFileIconLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileIcon")); |
134 mFileNameLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileName")); |
103 mFileNameLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileName")); |
135 mFileSizeLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileSize")); |
104 mFileSizeLabel = qobject_cast<HbLabel*>(mLoader->findWidget("fileSize")); |
136 // mSendDialog->setHeadingWidget(mLabel); |
|
137 /* mListView = qobject_cast<HbListView*>(mLoader->findWidget("listView")); |
|
138 if(mListView) |
|
139 { |
|
140 mContentItemModel = new QStandardItemModel(this); |
|
141 mListView->setModel(mContentItemModel);//, prototype); |
|
142 }*/ |
|
143 |
105 |
144 mProgressBar = qobject_cast<HbProgressBar*>(mLoader->findWidget("sendProgressBar")); |
106 mProgressBar = qobject_cast<HbProgressBar*>(mLoader->findWidget("sendProgressBar")); |
145 |
107 mSendDialog->setBackgroundFaded(false); |
146 // HbAction* hide = new HbAction("Hide"); |
108 mSendDialog->setDismissPolicy(HbPopup::NoDismiss); |
147 // HbAction* cancel = new HbAction("Cancel"); |
109 mSendDialog->setTimeout(HbPopup::NoTimeout); |
148 |
110 mSendDialog->setAttribute(Qt::WA_DeleteOnClose); |
149 // this->addAction(hide); |
111 |
150 // this->addAction(cancel); |
112 mCancelAction = static_cast<HbAction*>( mLoader->findObject( "cancelAction" ) ); |
151 |
113 |
152 // QGraphicsWidget *widget = mLoader->findWidget(QString("container")); |
114 connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); |
153 // this->setContentWidget(widget); |
|
154 } |
115 } |
155 |
116 else |
156 mSendDialog->setBackgroundFaded(false); |
117 { |
157 mSendDialog->setDismissPolicy(HbPopup::NoDismiss); |
118 mLastError = DocMLLoadingError; |
158 mSendDialog->setTimeout(HbPopup::NoTimeout); |
119 } |
159 mSendDialog->setAttribute(Qt::WA_DeleteOnClose); |
|
160 |
|
161 mHideAction = static_cast<HbAction*>( mLoader->findObject( "hideAction" ) ); |
|
162 mHideAction->disconnect(mSendDialog); // Todo: needed? |
|
163 |
|
164 mCancelAction = static_cast<HbAction*>( mLoader->findObject( "cancelAction" ) ); |
|
165 mCancelAction->disconnect(mSendDialog); // Todo: needed? |
|
166 |
|
167 connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); |
|
168 |
|
169 return true; |
|
170 } |
120 } |
171 |
121 |
172 /*void BTSendDialogWidget::hideEvent(QHideEvent *event) |
|
173 { |
|
174 HbDialog::hideEvent(event); |
|
175 emit deviceDialogClosed(); |
|
176 } |
|
177 |
|
178 void BTSendDialogWidget::showEvent(QShowEvent *event) |
|
179 { |
|
180 HbDialog::showEvent(event); |
|
181 }*/ |
|
182 |
|
183 /*void BTSendDialogWidget::hideClicked() |
|
184 { |
|
185 // TODO |
|
186 this->close(); |
|
187 emit deviceDialogClosed(); |
|
188 }*/ |
|
189 |
122 |
190 void BTSendDialogWidget::cancelClicked() |
123 void BTSendDialogWidget::cancelClicked() |
191 { |
124 { |
192 mSendDialog->close(); |
125 mSendDialog->close(); |
193 emit deviceDialogClosed(); |
126 emit deviceDialogClosed(); |
194 } |
127 } |
195 |
128 |
196 /*void BTSendDialogWidget::inputClosed(HbAction* action) |
|
197 { |
|
198 QVariantMap data; |
|
199 |
|
200 HbDialog *dlg=static_cast<HbDialog*>(sender()); |
|
201 if(dlg->actions().first() == action) { |
|
202 } |
|
203 else if(dlg->actions().at(1) == action) { |
|
204 } |
|
205 }*/ |
|
206 |
129 |