|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef TESTMODELUI_H |
|
43 #define TESTMODELUI_H |
|
44 |
|
45 // |
|
46 // W A R N I N G |
|
47 // ------------- |
|
48 // |
|
49 // This file is not part of the Qt API. It exists purely as an |
|
50 // implementation detail. This header file may change from version to |
|
51 // version without notice, or even be removed. |
|
52 // |
|
53 // We mean it. |
|
54 // |
|
55 |
|
56 #include <QWidget> |
|
57 #include <QListView> |
|
58 |
|
59 #include "qtcontactsglobal.h" // for QContactLocalId... |
|
60 #include "qcontactlistmodel.h" |
|
61 #include "filterdialog.h" |
|
62 |
|
63 QT_BEGIN_NAMESPACE |
|
64 class QStackedWidget; |
|
65 class QTextEdit; |
|
66 class QLabel; |
|
67 class QPushButton; |
|
68 QT_END_NAMESPACE |
|
69 |
|
70 QTM_BEGIN_NAMESPACE |
|
71 class QContactFetchRequest; |
|
72 class QContactManager; |
|
73 QTM_END_NAMESPACE |
|
74 |
|
75 QTM_USE_NAMESPACE |
|
76 class TestModelView : public QListView |
|
77 { |
|
78 Q_OBJECT |
|
79 |
|
80 public: |
|
81 TestModelView(QContactManager* manager = 0); |
|
82 ~TestModelView(); |
|
83 |
|
84 QContactLocalId currentId() const; |
|
85 QVariant currentData(QContactListModel::ContactDataRole role) const; |
|
86 |
|
87 private: |
|
88 QContactListModel *model; |
|
89 }; |
|
90 |
|
91 class TestModelUi : public QWidget |
|
92 { |
|
93 Q_OBJECT |
|
94 |
|
95 public: |
|
96 TestModelUi(); |
|
97 ~TestModelUi(); |
|
98 |
|
99 public slots: |
|
100 void populateContacts(); |
|
101 void dataAvailable(QContactFetchRequest* request, bool appendOnly); |
|
102 void filterResults(QContactFetchRequest* request, bool appendOnly); |
|
103 void filterFound(); |
|
104 |
|
105 void findContact(); |
|
106 void showFilterDialog(); |
|
107 void finishedFindContact(); |
|
108 void dial(); |
|
109 void incoming(); |
|
110 void talking(); |
|
111 void hangup(); |
|
112 void missedCall(); |
|
113 |
|
114 private: |
|
115 QContactManager *manager; |
|
116 FilterDialog *dialog; |
|
117 TestModelView *list; |
|
118 QTextEdit *textEdit; |
|
119 QStackedWidget *viewArea; |
|
120 QPushButton *leftButton; |
|
121 QPushButton *middleButton; |
|
122 QPushButton *rightButton; |
|
123 |
|
124 QTimer *incomingCallTimer; // we generate incoming calls from this |
|
125 QTimer *dialTimer; // we simulate them answering after x seconds |
|
126 QTimer *answerTimer; // incoming calls are ignored after y seconds |
|
127 QLabel *missedCalls; // the display label for missed calls |
|
128 QLabel *missedCallsNbr; // the count is displayed in this widget |
|
129 int nbrMissedCalls; |
|
130 |
|
131 enum CallState { |
|
132 WaitingState = 0, |
|
133 IncomingState, |
|
134 DialingState, |
|
135 TalkingState |
|
136 }; |
|
137 CallState currentState; |
|
138 |
|
139 QContactFetchRequest* fetchRequest; |
|
140 QContactFetchRequest* filterRequest; |
|
141 QString talkingToName; |
|
142 QString talkingToNumber; |
|
143 QString talkingToDetails; |
|
144 QString talkingToFirstLine; |
|
145 }; |
|
146 |
|
147 #endif |