equal
deleted
inserted
replaced
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 #include "tsdevicedialogcontainer.h" |
|
19 |
18 #include <QAbstractListModel> |
20 #include <QAbstractListModel> |
|
21 |
19 #include <HbDialog> |
22 #include <HbDialog> |
20 #include <HbMainWindow> |
23 #include <HbMainWindow> |
21 #include <HbLabel> |
24 #include <HbLabel> |
|
25 |
22 #include <tspropertydefs.h> |
26 #include <tspropertydefs.h> |
23 |
27 |
24 #include "tsdevicedialogcontainer.h" |
|
25 #include "tstasksgrid.h" |
28 #include "tstasksgrid.h" |
26 #include "tstasksgriditem.h" |
29 #include "tstasksgriditem.h" |
27 |
30 |
28 namespace { |
31 namespace { |
29 const char KDocmlPath[] = ":/resource/layout.docml"; |
32 const char KDocmlPath[] = ":/resource/layout.docml"; |
31 |
34 |
32 TsDeviceDialogContainer::TsDeviceDialogContainer(QAbstractListModel *model, |
35 TsDeviceDialogContainer::TsDeviceDialogContainer(QAbstractListModel *model, |
33 QObject *parent) |
36 QObject *parent) |
34 : |
37 : |
35 QObject(parent), |
38 QObject(parent), |
36 mVisibilityPublisher(TsProperty::KTsPath) |
39 mVisibilityPublisher(TsProperty::KTsPath), |
|
40 mDismissRequestSubscriber(QString("%1/%2").arg(TsProperty::KTsPath).arg(TsProperty::KDismissRequestPath)) |
37 { |
41 { |
38 bool ok(true); |
42 bool ok(true); |
39 mLoader.load(KDocmlPath, &ok); |
43 mLoader.load(KDocmlPath, &ok); |
40 Q_ASSERT(ok); |
44 Q_ASSERT(ok); |
41 |
45 |
89 this, |
93 this, |
90 SLOT(notifyDialogClosed())); |
94 SLOT(notifyDialogClosed())); |
91 mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, |
95 mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, |
92 static_cast<int>(true)); |
96 static_cast<int>(true)); |
93 mVisibilityPublisher.sync(); |
97 mVisibilityPublisher.sync(); |
|
98 |
|
99 connect(&mDismissRequestSubscriber, |
|
100 SIGNAL(contentsChanged()), |
|
101 this, |
|
102 SLOT(handleDismissRequest())); |
94 } |
103 } |
95 |
104 |
96 TsDeviceDialogContainer::~TsDeviceDialogContainer() |
105 TsDeviceDialogContainer::~TsDeviceDialogContainer() |
97 { |
106 { |
98 delete deviceDialogWidget(); |
107 delete deviceDialogWidget(); |
150 |
159 |
151 void TsDeviceDialogContainer::switchViewOnModelChange() |
160 void TsDeviceDialogContainer::switchViewOnModelChange() |
152 { |
161 { |
153 TsTasksGrid *grid = |
162 TsTasksGrid *grid = |
154 qobject_cast<TsTasksGrid *>(mLoader.findWidget("taskgrid")); |
163 qobject_cast<TsTasksGrid *>(mLoader.findWidget("taskgrid")); |
155 HbLabel *noItemsLabel = |
164 HbWidget *noItemsWidget = |
156 qobject_cast<HbLabel *>(mLoader.findWidget("noitemslabel")); |
165 qobject_cast<HbWidget *>(mLoader.findWidget("noitemswidget")); |
157 Q_ASSERT(grid); |
166 Q_ASSERT(grid); |
158 Q_ASSERT(noItemsLabel); |
167 Q_ASSERT(noItemsWidget); |
159 |
168 |
160 if (grid->model()->rowCount()) { |
169 if (grid->model()->rowCount()) { |
161 noItemsLabel->hide(); |
170 noItemsWidget->hide(); |
162 grid->show(); |
171 grid->show(); |
163 } else { |
172 } else { |
164 noItemsLabel->show(); |
173 noItemsWidget->show(); |
165 grid->hide(); |
174 grid->hide(); |
166 } |
175 } |
167 } |
176 } |
|
177 |
|
178 void TsDeviceDialogContainer::handleDismissRequest() |
|
179 { |
|
180 if (mDismissRequestSubscriber.value().toBool()) { |
|
181 emit deviceDialogClosed(); |
|
182 } |
|
183 } |