|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #ifndef LOGSBASEVIEW_H |
|
18 #define LOGSBASEVIEW_H |
|
19 |
|
20 #include <hbview.h> |
|
21 #include <logsservices.h> |
|
22 #include "logsdefs.h" |
|
23 |
|
24 class LogsComponentRepository; |
|
25 class LogsAbstractViewManager; |
|
26 class Dialpad; |
|
27 class LogsCall; |
|
28 class LogsMessage; |
|
29 class LogsContact; |
|
30 class LogsDetailsModel; |
|
31 class HbAbstractViewItem; |
|
32 class HbMenu; |
|
33 class QSignalMapper; |
|
34 class HbLabel; |
|
35 class HbListView; |
|
36 |
|
37 /** |
|
38 * |
|
39 */ |
|
40 class LogsBaseView : public HbView |
|
41 { |
|
42 Q_OBJECT |
|
43 friend class UT_LogsBaseView; |
|
44 |
|
45 public: |
|
46 |
|
47 virtual ~LogsBaseView(); |
|
48 |
|
49 public: |
|
50 enum LogsViewMap{ |
|
51 ViewAll, |
|
52 ViewCalled, |
|
53 ViewReceived, |
|
54 ViewMissed |
|
55 }; |
|
56 |
|
57 LogsAppViewId viewId() const; |
|
58 virtual void activated(bool showDialer, QVariant args); |
|
59 virtual void deactivated(); |
|
60 virtual bool isExitAllowed(); |
|
61 virtual void resetView(); |
|
62 |
|
63 public slots: |
|
64 |
|
65 virtual void handleExit(); |
|
66 void closeEmptyMenu(); |
|
67 |
|
68 signals: |
|
69 |
|
70 void exitAllowed(); |
|
71 |
|
72 protected slots: |
|
73 |
|
74 virtual void handleBackSoftkey(); |
|
75 virtual void dialpadOpened(); |
|
76 virtual void dialpadClosed(); |
|
77 virtual void dialpadEditorTextChanged(); |
|
78 virtual void updateEmptyListWidgetsVisibility(); |
|
79 virtual void updateWidgetsSizeAndLayout(); |
|
80 |
|
81 //slots bellow are used in *.docml |
|
82 void showFilterMenu(); |
|
83 void openDialpad(); |
|
84 void openContactsApp(); |
|
85 void notSupported(); |
|
86 void changeFilter(HbAction* action); |
|
87 |
|
88 //other slots |
|
89 void showListItemMenu(HbAbstractViewItem* item, const QPointF& coords); |
|
90 void initiateCallback(const QModelIndex &listIndex); |
|
91 void initiateCall(int callType); |
|
92 void createMessage(); |
|
93 void saveContact(); |
|
94 void updateEmptyListLabelVisibility(); |
|
95 void showCallDetails(); |
|
96 void deleteEvent(); |
|
97 |
|
98 void handleOrientationChanged(); |
|
99 |
|
100 protected: |
|
101 |
|
102 explicit LogsBaseView( LogsAppViewId viewId, |
|
103 LogsComponentRepository& repository, |
|
104 LogsAbstractViewManager& viewManager ); |
|
105 |
|
106 void setDialpadPosition(); |
|
107 void initFilterMenu(); |
|
108 void addActionNamesToMap(); |
|
109 |
|
110 void updateCall(const QModelIndex& listIndex); |
|
111 void updateMessage(const QModelIndex& listIndex); |
|
112 void updateContact(const QModelIndex& listIndex); |
|
113 void updateDetailsModel(const QModelIndex &listIndex); |
|
114 |
|
115 /** |
|
116 * Sets appropriate list widget layout using listView.setLayoutName() |
|
117 * @param ignoreDialpad if true, dialpad visiblilty won't affect layout |
|
118 */ |
|
119 void updateListLayoutName( HbListView& list, bool ignoreDialpad = false ); |
|
120 /** |
|
121 * Loads appropriate section from *.docml to resize list widget |
|
122 */ |
|
123 void updateListSize(); |
|
124 |
|
125 protected: |
|
126 |
|
127 /** |
|
128 * Initialize view widgets from the docml file. Must be called once on first |
|
129 * view activation. |
|
130 */ |
|
131 virtual void initView(); |
|
132 |
|
133 virtual QAbstractItemModel* model() const; |
|
134 |
|
135 virtual void populateListItemMenu(HbMenu& menu); |
|
136 |
|
137 /** |
|
138 * Updates data specific to the list item, e.g. call/message/contact |
|
139 */ |
|
140 virtual void updateListItemData(const QModelIndex& listIndex); |
|
141 |
|
142 /* |
|
143 * Update call button state. |
|
144 */ |
|
145 virtual void updateCallButton(); |
|
146 |
|
147 void activateEmptyListIndicator(QAbstractItemModel* model); |
|
148 void deactivateEmptyListIndicator(QAbstractItemModel* model); |
|
149 |
|
150 void addViewSwitchingEffects(); |
|
151 void toggleActionAvailability( HbAction* action, bool available ); |
|
152 /* |
|
153 * |
|
154 */ |
|
155 bool askConfirmation( QString heading , QString text ); |
|
156 |
|
157 protected: |
|
158 |
|
159 LogsAppViewId mViewId; |
|
160 LogsComponentRepository& mRepository; |
|
161 LogsAbstractViewManager& mViewManager; |
|
162 HbAction* mSoftKeyBackAction; |
|
163 |
|
164 HbMenu* mShowFilterMenu; //not owned |
|
165 Dialpad* mDialpad; //not owned |
|
166 HbLabel* mEmptyListLabel; // not owned |
|
167 |
|
168 QMap<LogsServices::LogsView, QString> mActionMap; |
|
169 |
|
170 bool mInitialized; |
|
171 |
|
172 LogsCall* mCall; //owned |
|
173 LogsMessage* mMessage; //owned |
|
174 LogsContact* mContact; //owned |
|
175 LogsDetailsModel* mDetailsModel; //owned |
|
176 |
|
177 QSignalMapper* mCallTypeMapper; |
|
178 QString mLayoutSectionName; |
|
179 }; |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 #endif // LOGSBASEVIEW_H |