33
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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: Provides input methods like query dialogs
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef SATAPPINPUTPROVIDER_H
|
|
19 |
#define SATAPPINPUTPROVIDER_H
|
|
20 |
|
|
21 |
// includes
|
|
22 |
#include <QObject>
|
|
23 |
#include <QTime>
|
|
24 |
#include <msatuiobserver.h>
|
|
25 |
|
|
26 |
// forward declarations
|
|
27 |
class HbDialog;
|
|
28 |
class SatAppAction;
|
|
29 |
class QTimer;
|
|
30 |
|
|
31 |
class SatAppInputProvider : public QObject
|
|
32 |
{
|
|
33 |
Q_OBJECT
|
|
34 |
|
|
35 |
public:
|
|
36 |
SatAppInputProvider(QObject *parent = 0);
|
|
37 |
virtual ~SatAppInputProvider();
|
|
38 |
|
|
39 |
public slots:
|
|
40 |
|
|
41 |
/** requests user to enter a SINGLE key, character or digit */
|
|
42 |
void getInkey(SatAppAction& action);
|
|
43 |
|
|
44 |
/** requests user to enter a STRING of free text, number or password etc. */
|
|
45 |
void getInput(SatAppAction& action);
|
|
46 |
|
|
47 |
/** Resets the UI state commits pending server requests if any */
|
|
48 |
void resetState();
|
|
49 |
|
|
50 |
private slots:
|
|
51 |
|
|
52 |
/** update the actions when content in getinput changed */
|
|
53 |
void updateQueryAction();
|
|
54 |
/** update the actions according the text */
|
|
55 |
void updateQueryAction(QString text);
|
|
56 |
/** get the input key in get inkey */
|
|
57 |
void transmitInkeyFromDialog();
|
|
58 |
/** get the input key in get inkey immediate */
|
|
59 |
void transmitInkeyImmediately(QString text);
|
|
60 |
/** get the input key in get inkey yesno query */
|
|
61 |
void transmitInkeyTrue();
|
|
62 |
/** get the input key in get inkey yesno query */
|
|
63 |
void transmitInkeyFalse();
|
|
64 |
/** get the get input string */
|
|
65 |
void transmitStringFromDialog();
|
|
66 |
/** clear the query timeout timer */
|
|
67 |
void clearDurationTimer();
|
|
68 |
|
|
69 |
private: // private implementation
|
|
70 |
|
|
71 |
/** show get inkey query */
|
|
72 |
void showGetInkeyQuery(const QString &aHeading,
|
|
73 |
TSatCharacterSet aCharacterSet, int aDuration);
|
|
74 |
/** show get inkey immediate query */
|
|
75 |
void showGetImmediateQuery(const QString &aHeading, int aDuration);
|
|
76 |
/** show get inkey yes no query */
|
|
77 |
void showGetYesNoQuery(const QString &aText, int aDuration);
|
|
78 |
|
|
79 |
/** show get input query */
|
|
80 |
void showGetInputQuery(const QString &heading, const QString &content,
|
|
81 |
TSatCharacterSet characterSet, int minLength, int maxLength,
|
|
82 |
bool aHideInput);
|
|
83 |
/** dialog type */
|
|
84 |
enum DialogMode {
|
|
85 |
GetInkey,
|
|
86 |
GetYesNo,
|
|
87 |
GetImmediate,
|
|
88 |
GetInput};
|
|
89 |
|
|
90 |
/** update dialog according type */
|
|
91 |
void composeDialog(HbDialog *dlg, DialogMode mode);
|
|
92 |
/** set the get inkey result to action */
|
|
93 |
void transmitInkey(int key);
|
|
94 |
/** start dialog timeout timer */
|
|
95 |
void startDurationTimer(int duration);
|
|
96 |
|
|
97 |
private:
|
|
98 |
/** not own */
|
|
99 |
SatAppAction* mCurrentAction;
|
|
100 |
/** own */
|
|
101 |
HbDialog* mCurrentDialog;
|
|
102 |
/** own */
|
|
103 |
QTime mInputTimer;
|
|
104 |
/** own */
|
|
105 |
QTimer* mDurationTimer;
|
|
106 |
|
|
107 |
/**for unit testing */
|
|
108 |
friend class InputProviderTest;
|
|
109 |
};
|
|
110 |
|
|
111 |
#endif /* SATAPPINPUTPROVIDER_H */
|