--- a/creator/inc/notifications.h Fri May 14 15:53:02 2010 +0300
+++ b/creator/inc/notifications.h Thu May 27 12:52:19 2010 +0300
@@ -21,6 +21,11 @@
#include <hbmessagebox.h>
#include <hbselectiondialog.h>
+#include <hbinputdialog.h>
+
+#include "engine.h"
+
+#include <stdexcept>
class HbProgressDialog;
class HbPopup;
@@ -82,6 +87,84 @@
static void showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout = HbPopup::ConfirmationNoteTimeout);
};
+class CreatorDialog
+{
+ Q_DISABLE_COPY(CreatorDialog)
+protected:
+ CreatorDialog(MUIObserver* observer, int userData) throw(std::exception) : mObserver(observer), mUserData(userData)
+ {
+ if(!mObserver)
+ throw std::invalid_argument("module cannot be the null!");
+ };
+protected:
+ virtual void NotifyObserver(TBool aPositiveAction)
+ {
+ TRAPD( err, mObserver->QueryDialogClosedL(aPositiveAction, mUserData) );
+ if(err)
+ {
+ Notifications::error( QString("Symbian Leave: %1 ").arg(err) );
+ }
+ }
+
+protected:
+ MUIObserver* mObserver;
+ int mUserData;
+};
+class CreatorYesNoDialog : public HbMessageBox, public CreatorDialog
+{
+ Q_DISABLE_COPY(CreatorYesNoDialog)
+ Q_OBJECT
+public:
+ static void launch(const QString& text, const QString& label, MUIObserver* observer, int userData) throw( std::exception );
+protected:
+ CreatorYesNoDialog(MUIObserver* observer, int userData);
+protected slots:
+ void DialogClosed(HbAction*);
+};
+class CreatorInputDialog : public HbInputDialog, public CreatorDialog
+{
+ Q_DISABLE_COPY(CreatorInputDialog)
+ Q_OBJECT
+public:
+ static void launch(const QString& label, int* value, bool acceptZero, MUIObserver* observer, int userData) throw( std::exception );
+protected:
+ CreatorInputDialog(int*value, MUIObserver* observer, int userData);
+protected slots:
+ void DialogClosed(HbAction*);
+private:
+ int *mValue;
+};
+
+class CreatorSelectionDialog : public HbSelectionDialog, public CreatorDialog
+{
+ Q_DISABLE_COPY(CreatorSelectionDialog)
+ Q_OBJECT
+public:
+ static void launch(const QString& label, const QStringList& items, TInt* selectedItem, MUIObserver* observer, int userData) throw( std::exception );
+ static void launch(const QString& label, const QStringList& items, CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* observer, int userData) throw( std::exception );
+protected:
+ CreatorSelectionDialog(TInt* selectedItem, MUIObserver* observer, int userData) throw( std::exception );
+ CreatorSelectionDialog(CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* observer, int userData) throw( std::exception );
+protected slots:
+ void DialogClosed(HbAction*);
+private:
+ TInt* mSelectedItem;
+ CArrayFixFlat<TInt>* mSelectedItems;
+};
+
+class CreatorDateTimeDialog : public HbDialog, public CreatorDialog
+{
+ Q_DISABLE_COPY(CreatorDateTimeDialog)
+ Q_OBJECT
+public:
+ static void launch(const QString& label, TTime* value, MUIObserver* observer, int userData) throw( std::exception );
+protected:
+ CreatorDateTimeDialog(TTime* value, MUIObserver* observer, int userData);
+protected slots:
+ void DialogClosed(HbAction*);
+private:
+ TTime *mValue;
+};
#endif // NOTIFICATIONS_H_