|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NOTIFICATIONS_H_ |
|
20 #define NOTIFICATIONS_H_ |
|
21 |
|
22 #include <hbmessagebox.h> |
|
23 #include <hbselectiondialog.h> |
|
24 #include <hbinputdialog.h> |
|
25 |
|
26 #include "engine.h" |
|
27 |
|
28 #include <stdexcept> |
|
29 |
|
30 class HbProgressDialog; |
|
31 class HbPopup; |
|
32 |
|
33 class Notifications : public HbPopup |
|
34 { |
|
35 |
|
36 Q_OBJECT |
|
37 |
|
38 public: |
|
39 /** |
|
40 * shows massage box |
|
41 */ |
|
42 static void showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout ); |
|
43 |
|
44 /** |
|
45 * shows about box |
|
46 */ |
|
47 static void about(); |
|
48 |
|
49 /** |
|
50 * shows error message |
|
51 */ |
|
52 static void error(const QString& errorMessage); |
|
53 |
|
54 /** |
|
55 * to shows progressbar |
|
56 */ |
|
57 static HbProgressDialog* showProgressBar(const QString& text, int max); |
|
58 |
|
59 /** |
|
60 * shows global HbGlobalCommonNote type note |
|
61 */ |
|
62 static void showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout = HbPopup::ConfirmationNoteTimeout); |
|
63 }; |
|
64 |
|
65 class CreatorDialog |
|
66 { |
|
67 Q_DISABLE_COPY(CreatorDialog) |
|
68 protected: |
|
69 CreatorDialog(MUIObserver* observer, int userData) throw(std::exception) : mObserver(observer), mUserData(userData) |
|
70 { |
|
71 if(!mObserver) |
|
72 throw std::invalid_argument("module cannot be the null!"); |
|
73 }; |
|
74 protected: |
|
75 virtual void NotifyObserver(TBool aPositiveAction) |
|
76 { |
|
77 TRAPD( err, mObserver->QueryDialogClosedL(aPositiveAction, mUserData) ); |
|
78 if(err) |
|
79 { |
|
80 Notifications::error( QString("Symbian Leave: %1 ").arg(err) ); |
|
81 } |
|
82 } |
|
83 |
|
84 protected: |
|
85 MUIObserver* mObserver; |
|
86 int mUserData; |
|
87 }; |
|
88 |
|
89 class CreatorYesNoDialog : public HbMessageBox, public CreatorDialog |
|
90 { |
|
91 Q_DISABLE_COPY(CreatorYesNoDialog) |
|
92 Q_OBJECT |
|
93 public: |
|
94 static void launch(const QString& text, const QString& label, MUIObserver* observer, int userData) throw( std::exception ); |
|
95 protected: |
|
96 CreatorYesNoDialog(MUIObserver* observer, int userData); |
|
97 protected slots: |
|
98 void DialogClosed(HbAction*); |
|
99 }; |
|
100 |
|
101 class CreatorInputDialog : public HbInputDialog, public CreatorDialog |
|
102 { |
|
103 Q_DISABLE_COPY(CreatorInputDialog) |
|
104 Q_OBJECT |
|
105 public: |
|
106 static void launch(const QString& label, int* value, bool acceptZero, MUIObserver* observer, int userData) throw( std::exception ); |
|
107 static void launch(const QString& label, TDes& value, MUIObserver* observer, int userData) throw( std::exception ); |
|
108 protected: |
|
109 CreatorInputDialog(int* value, MUIObserver* observer, int userData); |
|
110 CreatorInputDialog(TDes& value, MUIObserver* observer, int userData); |
|
111 protected slots: |
|
112 void DialogClosed(HbAction*); |
|
113 private: |
|
114 int *mIntValue; |
|
115 TDes& mStrValue; |
|
116 TBuf<1> mDummy; |
|
117 }; |
|
118 |
|
119 class CreatorSelectionDialog : public HbSelectionDialog, public CreatorDialog |
|
120 { |
|
121 Q_DISABLE_COPY(CreatorSelectionDialog) |
|
122 Q_OBJECT |
|
123 public: |
|
124 static void launch(const QString& label, const QStringList& items, TInt* selectedItem, MUIObserver* observer, int userData) throw( std::exception ); |
|
125 static void launch(const QString& label, const QStringList& items, CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* observer, int userData) throw( std::exception ); |
|
126 protected: |
|
127 CreatorSelectionDialog(TInt* selectedItem, MUIObserver* observer, int userData) throw( std::exception ); |
|
128 CreatorSelectionDialog(CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* observer, int userData) throw( std::exception ); |
|
129 protected slots: |
|
130 void DialogClosed(HbAction*); |
|
131 private: |
|
132 TInt* mSelectedItem; |
|
133 CArrayFixFlat<TInt>* mSelectedItems; |
|
134 }; |
|
135 |
|
136 class CreatorDateTimeDialog : public HbDialog, public CreatorDialog |
|
137 { |
|
138 Q_DISABLE_COPY(CreatorDateTimeDialog) |
|
139 Q_OBJECT |
|
140 public: |
|
141 static void launch(const QString& label, TTime* value, MUIObserver* observer, int userData) throw( std::exception ); |
|
142 protected: |
|
143 CreatorDateTimeDialog(TTime* value, MUIObserver* observer, int userData); |
|
144 protected slots: |
|
145 void DialogClosed(HbAction*); |
|
146 private: |
|
147 TTime *mValue; |
|
148 }; |
|
149 #endif // NOTIFICATIONS_H_ |