29 #include <QDate> |
29 #include <QDate> |
30 #include <QRegExp> |
30 #include <QRegExp> |
31 |
31 |
32 #include "notifications.h" |
32 #include "notifications.h" |
33 |
33 |
34 // --------------------------------------------------------------------------- |
34 |
35 |
35 |
36 void Notifications::showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout ) |
36 // --------------------------------------------------------------------------- |
37 { |
37 |
38 HbMessageBox *messageBox = new HbMessageBox(type); |
38 void Notifications::about() |
39 messageBox->setText(text); |
39 { |
40 if(label.length()) |
40 HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); |
41 { |
41 messageBox->setText("Version 6.0.0 - April 23rd 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."); |
42 HbLabel *header = new HbLabel(label, messageBox); |
42 HbLabel *header = new HbLabel("About Creator", messageBox); |
43 messageBox->setHeadingWidget(header); |
43 messageBox->setHeadingWidget(header); |
44 } |
44 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
45 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
45 messageBox->setTimeout(HbPopup::NoTimeout); |
46 messageBox->setTimeout(timeout); |
46 messageBox->open(); |
47 messageBox->open(); |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 |
|
52 void Notifications::about() |
|
53 { |
|
54 showMessageBox(HbMessageBox::MessageTypeInformation, |
|
55 "Version 6.0.0 - April 23rd 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.", |
|
56 "About Creator", |
|
57 HbPopup::NoTimeout |
|
58 ); |
|
59 } |
47 } |
60 |
48 |
61 // --------------------------------------------------------------------------- |
49 // --------------------------------------------------------------------------- |
62 |
50 |
63 void Notifications::error(const QString& errorMessage) |
51 void Notifications::error(const QString& errorMessage) |
64 { |
52 { |
65 showMessageBox(HbMessageBox::MessageTypeWarning, errorMessage, QString("Error"), 3000); |
53 HbMessageBox::warning(errorMessage, new HbLabel("Error")); |
66 } |
54 } |
67 |
55 |
68 |
56 |
69 // --------------------------------------------------------------------------- |
57 // --------------------------------------------------------------------------- |
|
58 |
70 |
59 |
71 HbProgressDialog* Notifications::showProgressBar(const QString& text, int max) |
60 HbProgressDialog* Notifications::showProgressBar(const QString& text, int max) |
72 { |
61 { |
73 HbProgressDialog *note = new HbProgressDialog(HbProgressDialog::ProgressDialog); |
62 HbProgressDialog *note = new HbProgressDialog(HbProgressDialog::ProgressDialog); |
74 note->setText(text); |
63 note->setText(text); |
75 note->setMaximum(max); |
64 note->setMaximum(max); |
|
65 |
76 note->show(); |
66 note->show(); |
77 return note; |
67 return note; |
78 |
68 |
79 } |
69 } |
80 |
70 |
81 // --------------------------------------------------------------------------- |
71 // --------------------------------------------------------------------------- |
82 |
72 |
83 void Notifications::showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout) |
73 void Notifications::showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout /*timeout*/) |
84 { |
74 { |
85 showMessageBox(type, text, QString("Creator"), timeout); |
75 if (type == HbMessageBox::HbMessageBox::MessageTypeInformation) |
|
76 HbMessageBox::information(text, new HbLabel("Information")); |
|
77 else |
|
78 HbMessageBox::information(text, new HbLabel("Information")); |
86 } |
79 } |
87 |
80 |
88 // --------------------------------------------------------------------------- |
81 // --------------------------------------------------------------------------- |
89 |
82 |
90 bool Notifications::entriesQueryDialog(int& numberOfEntries, const QString& text, bool acceptsZero) |
83 bool Notifications::entriesQueryDialog(int& numberOfEntries, const QString& text, bool acceptsZero) |
120 |
113 |
121 popup->setPrimaryAction(actionOk); |
114 popup->setPrimaryAction(actionOk); |
122 popup->setSecondaryAction(actionCancel); |
115 popup->setSecondaryAction(actionCancel); |
123 |
116 |
124 // Launch popup syncronously |
117 // Launch popup syncronously |
125 popup->setAttribute(Qt::WA_DeleteOnClose); |
118 HbAction *action = 0; |
126 // TODO: handle dialog close & user input |
119 action = popup->exec(); |
127 popup->open(); |
|
128 |
120 |
129 // continue if ok selected and valid user input exists in line editor |
121 // continue if ok selected and valid user input exists in line editor |
130 /*if (action && action->text() == "Ok" && edit->text() != "") { |
122 if (action && action->text() == "Ok" && edit->text() != "") { |
131 numberOfEntries = edit->text().toInt(&err, 10); |
123 numberOfEntries = edit->text().toInt(&err, 10); |
132 }*/ |
124 } |
133 return err; |
125 return err; |
134 } |
126 } |
135 |
127 |
136 // --------------------------------------------------------------------------- |
128 // --------------------------------------------------------------------------- |
137 bool Notifications::timeQueryDialog(QDate& date, const QString& text) |
129 bool Notifications::timeQueryDialog(QDate& date, const QString& text) |
161 |
153 |
162 popup->setPrimaryAction(actionOk); |
154 popup->setPrimaryAction(actionOk); |
163 popup->setSecondaryAction(actionCancel); |
155 popup->setSecondaryAction(actionCancel); |
164 |
156 |
165 // Launch popup syncronously |
157 // Launch popup syncronously |
166 popup->setAttribute(Qt::WA_DeleteOnClose); |
158 HbAction *action = 0; |
167 // TODO: handle dialog close & user input |
159 action = popup->exec(); |
168 popup->open(); |
|
169 |
160 |
170 // continue if ok selected and valid user input exists in line editor |
161 // continue if ok selected and valid user input exists in line editor |
171 /*if (action && action->text() == "Ok" && edit->text() != "") { |
162 if (action && action->text() == "Ok" && edit->text() != "") { |
172 date = QDate::fromString(edit->text()); |
163 date = QDate::fromString(edit->text()); |
173 err = true; |
164 err = true; |
174 }*/ |
165 } |
175 return err; |
166 return err; |
176 } |
167 } |
177 |
168 |
178 // --------------------------------------------------------------------------- |
169 // --------------------------------------------------------------------------- |
179 |
170 |
180 bool Notifications::yesNoQueryDialog(const QString& text) |
171 bool Notifications::yesNoQueryDialog(const QString& text) |
181 { |
172 { |
182 HbMessageBox::question(text, 0, 0); |
173 return HbMessageBox::question(text); |
183 return false; |
|
184 } |
174 } |
185 |
175 |
186 // --------------------------------------------------------------------------- |
176 // --------------------------------------------------------------------------- |
187 |
177 |
188 void Notifications::popupListDialog(const QString& text, QStringList& items, HbAbstractItemView::SelectionMode mode, QObject* receiver, const char* member) |
178 void Notifications::popupListDialog(const QString& text, QStringList& items, HbAbstractItemView::SelectionMode mode, QObject* receiver, const char* member) |
218 |
208 |
219 popup->setPrimaryAction(actionOk); |
209 popup->setPrimaryAction(actionOk); |
220 popup->setSecondaryAction(actionCancel); |
210 popup->setSecondaryAction(actionCancel); |
221 |
211 |
222 // Launch popup syncronously |
212 // Launch popup syncronously |
223 popup->setAttribute(Qt::WA_DeleteOnClose); |
213 HbAction *action = 0; |
224 // TODO: handle dialog close & user input |
214 action = popup->exec(); |
225 popup->open(); |
|
226 |
215 |
227 // continue if ok selected and valid user input exists in line editor |
216 // continue if ok selected and valid user input exists in line editor |
228 /*if (action && action->text() == "Ok" && edit->text() != "") { |
217 if (action && action->text() == "Ok" && edit->text() != "") { |
229 directory = edit->text(); |
218 directory = edit->text(); |
230 err = true; |
219 err = true; |
231 }*/ |
220 } |
232 return err; |
221 return err; |
233 } |
222 } |
234 |
223 |
235 // --------------------------------------------------------------------------- |
224 // --------------------------------------------------------------------------- |