creator/inc/notifications.h
changeset 27 271e901a9423
parent 25 31fc1277642e
child 28 4cc0d1a608c1
equal deleted inserted replaced
26:41ebde60981f 27:271e901a9423
    19 #ifndef NOTIFICATIONS_H_
    19 #ifndef NOTIFICATIONS_H_
    20 #define NOTIFICATIONS_H_
    20 #define NOTIFICATIONS_H_
    21 
    21 
    22 #include <hbmessagebox.h>
    22 #include <hbmessagebox.h>
    23 #include <hbselectiondialog.h>
    23 #include <hbselectiondialog.h>
       
    24 #include <hbinputdialog.h>
       
    25 
       
    26 #include "engine.h"
       
    27 
       
    28 #include <stdexcept>
    24 
    29 
    25 class HbProgressDialog;
    30 class HbProgressDialog;
    26 class HbPopup;
    31 class HbPopup;
    27 
    32 
    28 class Notifications : public HbPopup
    33 class Notifications : public HbPopup
    80      * shows global HbGlobalCommonNote type note
    85      * shows global HbGlobalCommonNote type note
    81      */
    86      */
    82 	static void showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout = HbPopup::ConfirmationNoteTimeout);
    87 	static void showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout = HbPopup::ConfirmationNoteTimeout);
    83     };
    88     };
    84 
    89 
       
    90 class CreatorDialog
       
    91 {
       
    92     Q_DISABLE_COPY(CreatorDialog)
       
    93 protected:
       
    94     CreatorDialog(MUIObserver* observer, int userData) throw(std::exception) : mObserver(observer), mUserData(userData)
       
    95         {
       
    96             if(!mObserver)
       
    97                 throw std::invalid_argument("module cannot be the null!");
       
    98         };
       
    99 protected:
       
   100     virtual void NotifyObserver(TBool aPositiveAction)
       
   101         {
       
   102         TRAPD( err, mObserver->QueryDialogClosedL(aPositiveAction, mUserData) );
       
   103         if(err)
       
   104             {
       
   105             Notifications::error( QString("Symbian Leave: %1 ").arg(err) );
       
   106             }
       
   107         }
       
   108     
       
   109 protected:
       
   110     MUIObserver* mObserver;
       
   111     int mUserData;
       
   112 };
    85 
   113 
       
   114 class CreatorYesNoDialog : public HbMessageBox, public CreatorDialog
       
   115 {
       
   116     Q_DISABLE_COPY(CreatorYesNoDialog)
       
   117     Q_OBJECT
       
   118 public:
       
   119     static void launch(const QString& text, const QString& label, MUIObserver* observer, int userData) throw( std::exception );
       
   120 protected:
       
   121     CreatorYesNoDialog(MUIObserver* observer, int userData);
       
   122 protected slots:
       
   123     void DialogClosed(HbAction*);
       
   124 };
    86 
   125 
       
   126 class CreatorInputDialog : public HbInputDialog, public CreatorDialog
       
   127 {
       
   128     Q_DISABLE_COPY(CreatorInputDialog)
       
   129     Q_OBJECT
       
   130 public:
       
   131     static void launch(const QString& label, int* value, bool acceptZero,  MUIObserver* observer, int userData) throw( std::exception );
       
   132 protected:
       
   133     CreatorInputDialog(int*value, MUIObserver* observer, int userData);
       
   134 protected slots:
       
   135     void DialogClosed(HbAction*);
       
   136 private:
       
   137     int *mValue;
       
   138 };
       
   139 
       
   140 class CreatorSelectionDialog : public HbSelectionDialog, public CreatorDialog
       
   141 {
       
   142     Q_DISABLE_COPY(CreatorSelectionDialog)
       
   143     Q_OBJECT
       
   144 public:
       
   145     static void launch(const QString& label, const QStringList& items, TInt* selectedItem, MUIObserver* observer, int userData) throw( std::exception );
       
   146     static void launch(const QString& label, const QStringList& items, CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* observer, int userData) throw( std::exception );
       
   147 protected:
       
   148     CreatorSelectionDialog(TInt* selectedItem, MUIObserver* observer, int userData) throw( std::exception );
       
   149     CreatorSelectionDialog(CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* observer, int userData) throw( std::exception );
       
   150 protected slots:
       
   151     void DialogClosed(HbAction*);
       
   152 private:
       
   153     TInt* mSelectedItem;
       
   154     CArrayFixFlat<TInt>* mSelectedItems;
       
   155 };
       
   156 
       
   157 class CreatorDateTimeDialog : public HbDialog, public CreatorDialog
       
   158 {
       
   159     Q_DISABLE_COPY(CreatorDateTimeDialog)
       
   160     Q_OBJECT
       
   161 public:
       
   162     static void launch(const QString& label, TTime* value, MUIObserver* observer, int userData) throw( std::exception );
       
   163 protected:
       
   164     CreatorDateTimeDialog(TTime* value, MUIObserver* observer, int userData);
       
   165 protected slots:
       
   166     void DialogClosed(HbAction*);
       
   167 private:
       
   168     TTime *mValue;
       
   169 };
    87 #endif // NOTIFICATIONS_H_
   170 #endif // NOTIFICATIONS_H_