27 // ----------------------------------------------------------------------------- |
27 // ----------------------------------------------------------------------------- |
28 // LocationPickerContent::LocationPickerContent() |
28 // LocationPickerContent::LocationPickerContent() |
29 // ----------------------------------------------------------------------------- |
29 // ----------------------------------------------------------------------------- |
30 LocationPickerContent::LocationPickerContent() |
30 LocationPickerContent::LocationPickerContent() |
31 :mDataManager(NULL), |
31 :mDataManager(NULL), |
32 mListModel(NULL), |
|
33 mStandardModel(NULL) |
32 mStandardModel(NULL) |
34 { |
33 { |
35 // create data manager to manage data in the model |
34 // create data manager to manage data in the model |
36 mDataManager = LocationPickerDataManager::getInstance(); |
35 mDataManager = LocationPickerDataManager::getInstance(); |
37 |
36 |
38 } |
37 } |
39 |
38 |
40 // ----------------------------------------------------------------------------- |
39 // ----------------------------------------------------------------------------- |
41 // LocationPickerContent::populateModel() |
40 // LocationPickerContent::populateModel() |
42 // ----------------------------------------------------------------------------- |
41 // ----------------------------------------------------------------------------- |
43 bool LocationPickerContent::populateModel( Qt::Orientation aOrientation ) |
42 bool LocationPickerContent::populateModel() |
44 { |
43 { |
45 bool locationsFound; |
44 bool locationsFound; |
46 if(aOrientation == Qt::Vertical) |
45 // Create a standard model for the list view |
|
46 mStandardModel = new QStandardItemModel( this ); |
|
47 if( mDataManager->populateModel( *mStandardModel, ELocationPickerContent ) ) |
47 { |
48 { |
48 // Create a standard model for the list view |
49 locationsFound = true; |
49 mListModel = new QStandardItemModel( this ); |
|
50 if( mDataManager->populateModel( *mListModel, ELocationPickerContent, aOrientation) ) |
|
51 { |
|
52 locationsFound = true; |
|
53 } |
|
54 else |
|
55 { |
|
56 createNoEntryDisplay(mListModel); |
|
57 locationsFound = false; |
|
58 } |
|
59 } |
50 } |
60 //for landscape view |
|
61 else |
51 else |
62 { |
52 { |
63 // Create a standard model for the landscape view |
53 createNoEntryDisplay(mStandardModel); |
64 mStandardModel = new QStandardItemModel( this ); |
54 locationsFound = false; |
65 if( mDataManager->populateModel(*mStandardModel, ELocationPickerContent, aOrientation) ) |
|
66 { |
|
67 locationsFound = true; |
|
68 } |
|
69 else |
|
70 { |
|
71 createNoEntryDisplay(mStandardModel); |
|
72 locationsFound = false; |
|
73 } |
|
74 } |
55 } |
75 return locationsFound; |
56 return locationsFound; |
76 } |
57 } |
77 |
58 |
78 // ----------------------------------------------------------------------------- |
59 // ----------------------------------------------------------------------------- |
79 // LocationPickerContent::LocationPickerContent() |
60 // LocationPickerContent::LocationPickerContent() |
80 // ----------------------------------------------------------------------------- |
61 // ----------------------------------------------------------------------------- |
81 LocationPickerContent::~LocationPickerContent() |
62 LocationPickerContent::~LocationPickerContent() |
82 { |
63 { |
83 delete mListModel; |
|
84 delete mStandardModel; |
64 delete mStandardModel; |
85 } |
65 } |
86 |
66 |
87 // ----------------------------------------------------------------------------- |
|
88 // LocationPickerContent::getStandardListModel() |
|
89 // ----------------------------------------------------------------------------- |
|
90 QStandardItemModel* LocationPickerContent::getStandardListModel() |
|
91 { |
|
92 return mListModel; |
|
93 } |
|
94 |
67 |
95 // ----------------------------------------------------------------------------- |
68 // ----------------------------------------------------------------------------- |
96 // LocationPickerContent::getStandardModel() |
69 // LocationPickerContent::getStandardModel() |
97 // ----------------------------------------------------------------------------- |
70 // ----------------------------------------------------------------------------- |
98 QStandardItemModel* LocationPickerContent::getStandardModel() |
71 QStandardItemModel* LocationPickerContent::getStandardModel() |