21 #include <xqconversions.h> |
21 #include <xqconversions.h> |
22 |
22 |
23 #include "tsservice.h" |
23 #include "tsservice.h" |
24 #include "tsmodelobserver.h" |
24 #include "tsmodelobserver.h" |
25 #include "tsserviceobserver.h" |
25 #include "tsserviceobserver.h" |
|
26 #include "tsresourcemanager.h" |
|
27 |
26 |
28 |
27 // ----------------------------------------------------------------------------- |
29 // ----------------------------------------------------------------------------- |
28 LOCAL_C QVariantHash valueL( QObject *aModel, TInt aOffset ) |
30 LOCAL_C QVariantHash valueL( QObject *aModel, TInt aOffset ) |
29 { |
31 { |
30 QList<QVariantHash> items; |
32 QList<QVariantHash> items; |
38 } |
40 } |
39 return items.at(aOffset); |
41 return items.at(aOffset); |
40 } |
42 } |
41 |
43 |
42 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
43 CTsService* CTsService::NewLC(QObject* model) |
45 CTsService* CTsService::NewLC(MTsResourceManager& resources, QObject* model) |
44 { |
46 { |
45 CTsService *self = new (ELeave)CTsService(); |
47 CTsService *self = new (ELeave)CTsService(); |
46 CleanupStack::PushL(self); |
48 CleanupStack::PushL(self); |
47 self->ConstructL(model); |
49 self->ConstructL(resources, model); |
48 return self; |
50 return self; |
49 } |
51 } |
50 |
52 |
51 // ----------------------------------------------------------------------------- |
53 // ----------------------------------------------------------------------------- |
52 CTsService::CTsService() |
54 CTsService::CTsService() |
53 { |
55 { |
54 //No implementation required |
56 //No implementation required |
55 } |
57 } |
56 |
58 |
57 // ----------------------------------------------------------------------------- |
59 // ----------------------------------------------------------------------------- |
58 void CTsService::ConstructL( QObject* model ) |
60 void CTsService::ConstructL( MTsResourceManager& resources, QObject* model ) |
59 { |
61 { |
60 iModel = model; |
62 iModel = model; |
61 User::LeaveIfNull(iModel); |
63 User::LeaveIfNull(iModel); |
62 // @todo: add checking for all necessary methods |
64 // @todo: add checking for all necessary methods |
63 |
65 |
65 User::LeaveIfNull(iServiceObserver); |
67 User::LeaveIfNull(iServiceObserver); |
66 QObject::connect(iModel, |
68 QObject::connect(iModel, |
67 SIGNAL(dataChanged()), |
69 SIGNAL(dataChanged()), |
68 iServiceObserver, |
70 iServiceObserver, |
69 SLOT(dataChanged())); |
71 SLOT(dataChanged())); |
|
72 QMetaObject::invokeMethod(iModel, |
|
73 "setResources", |
|
74 Q_ARG(MTsResourceManager&, resources)); |
70 } |
75 } |
71 |
76 |
72 // ----------------------------------------------------------------------------- |
77 // ----------------------------------------------------------------------------- |
73 CTsService::~CTsService() |
78 CTsService::~CTsService() |
74 { |
79 { |
144 } |
149 } |
145 |
150 |
146 // ----------------------------------------------------------------------------- |
151 // ----------------------------------------------------------------------------- |
147 TBool CTsService::IsMandatoryL( TInt aOffset ) const |
152 TBool CTsService::IsMandatoryL( TInt aOffset ) const |
148 { |
153 { |
149 return IntValueL(aOffset, "TaskIsMandatory" ); |
154 const QVariantHash values(valueL(iModel, aOffset)); |
|
155 const QString key("TaskIsMandatory"); |
|
156 return values.contains(key) ? values.value(key).toInt() : ETrue; |
150 } |
157 } |
151 |
158 |
152 // ----------------------------------------------------------------------------- |
159 // ----------------------------------------------------------------------------- |
153 TBool CTsService::CloseL( TTsModelItemKey aKey ) const |
160 TBool CTsService::CloseL( TTsModelItemKey aKey ) const |
154 { |
161 { |