messagingapp/msgui/msgapp/inc/msgviewmanager.h
changeset 31 ebfee66fde93
child 34 84197e66a4bd
equal deleted inserted replaced
30:6a20128ce557 31:ebfee66fde93
       
     1 /*
       
     2  * Copyright (c) 2009 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  * class to manage differnt messaging views.
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef MSGVIEWMANAGER_H_
       
    20 #define MSGVIEWMANAGER_H_
       
    21 
       
    22 #include <QObject>
       
    23 #include <QVariant>
       
    24 
       
    25 class HbMainWindow;
       
    26 class MsgUnifiedEditorView;
       
    27 class MsgListView;
       
    28 class MsgConversationBaseView;
       
    29 class UnifiedViewer;
       
    30 class MsgBaseView;
       
    31 class DraftsListView;
       
    32 class MsgSettingsView;
       
    33 class HbAction;
       
    34 class HbView;
       
    35 
       
    36 class MsgViewManager: public QObject
       
    37 {
       
    38 Q_OBJECT
       
    39 
       
    40 public:
       
    41     /**
       
    42      * constructor
       
    43      */
       
    44     MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent = 0);
       
    45 
       
    46     /**
       
    47      * Destructor.
       
    48      */
       
    49     ~MsgViewManager();
       
    50 
       
    51     /**
       
    52      * call back function will be called from MsgServiceInterface.
       
    53      */
       
    54     void send(const qint32 contactId, const QString phoneNumber, const QString displayName);
       
    55 
       
    56     /**
       
    57      * call back function called from MsgServiceInterface to set service request flag.
       
    58      */
       
    59     void setServiceRequest(bool request);
       
    60 
       
    61     /**
       
    62      * call back function called MsgServiceInterface.
       
    63      */
       
    64     void open(qint64 conversationId);
       
    65 
       
    66     /**
       
    67      * call back function called MsgServiceInterface.
       
    68      */
       
    69     void send(QVariant data);
       
    70 
       
    71     /**
       
    72      * depricated api. will be removed in future.
       
    73      */
       
    74     void openEditor(QString number, QString name);
       
    75 
       
    76     /**
       
    77      * call back function will be called from MsgServiceInterface.
       
    78      */
       
    79     void send(const QString phoneNumber, const QString alias, const QString bodyText);
       
    80 
       
    81     /**
       
    82      * Opens the viewer to view the message.
       
    83      * @param msgId message id of the message.
       
    84      */
       
    85     void view(int msgId);
       
    86 
       
    87 private:
       
    88     /**
       
    89      * swiches back to last view after service request is complete.
       
    90      */
       
    91     void switchToLastSavedView();
       
    92 
       
    93     /**
       
    94      * find conversation id corresponding to given phone no.
       
    95      * @param phoneNum
       
    96      */
       
    97     qint64 findConversationId(const QString phoneNum);
       
    98 
       
    99     /**
       
   100      * helper method to complete back action.
       
   101      */
       
   102     void completeServiceRequest();
       
   103 
       
   104     /*
       
   105      * switch to clv.
       
   106      */
       
   107     void switchToClv(const QVariantList& data);
       
   108 
       
   109     /*
       
   110      * switch to cv.
       
   111      */
       
   112     void switchToCv(const QVariantList& data);
       
   113 
       
   114     /*
       
   115      * switch to dlv.
       
   116      */
       
   117     void switchToDlv(const QVariantList& data);
       
   118 
       
   119     /*
       
   120      * switch to unieditor.
       
   121      */
       
   122     void switchToUniEditor(const QVariantList& data);
       
   123 
       
   124     /*
       
   125      * switch to univiewer.
       
   126      */
       
   127     void switchToUniViewer(const QVariantList& data);
       
   128 
       
   129     /*
       
   130      * switch to settings.
       
   131      */
       
   132     void switchToMsgSettings(const QVariantList& data);
       
   133 
       
   134     /*
       
   135      * handle other cases.
       
   136      */
       
   137     void handleDefault(const QVariantList& data);
       
   138 
       
   139     /**
       
   140      * handle sms and mms messge
       
   141      * @param msgId message id
       
   142      */
       
   143     void handleSmsMmsMsg(int msgId);
       
   144 
       
   145     /**
       
   146      * handle ringtone message
       
   147      * @param msgId message id
       
   148      */
       
   149     void handleRingtoneMsg(int msgId);
       
   150 
       
   151     /**
       
   152      * handle provisioning message
       
   153      * @param msgId message id
       
   154      */
       
   155     void handleProvisoningMsg(int msgId);
       
   156     
       
   157 	/**
       
   158 	* Appends the views to be deleted into a QList to be deleted when view is ready
       
   159 	*/
       
   160     void appendViewToBeDeleted(HbView* view);
       
   161     
       
   162 private slots:
       
   163     /**
       
   164      * this slot is called on mainwindows back action.
       
   165      */
       
   166     void onBackAction();
       
   167 
       
   168     /**
       
   169      * This slot is called when switchView signal is emitted from a view.
       
   170      */
       
   171     void switchView(const QVariantList& data);
       
   172 
       
   173     /**
       
   174      * This slot is called when viewReady signal is emitted from main window.
       
   175      */
       
   176     void setViewInteractive();
       
   177 
       
   178     /**
       
   179      * Slot to delete previous view instances on view switch
       
   180      */
       
   181     void deletePreviousView();
       
   182 	
       
   183 	/**
       
   184      * This slot is called when delete message dialog is launched.
       
   185      * @param action selected action (yes or no).
       
   186      */	
       
   187     void onDialogDeleteMsg(HbAction* action);
       
   188     
       
   189 	/**
       
   190      * This slot is called when save tone dialog is launched.
       
   191      * @param action selected action (yes or no).
       
   192      */	
       
   193     void onDialogSaveTone(HbAction* action);
       
   194 	
       
   195 private:
       
   196     /**
       
   197      * main window reference not owned.
       
   198      */
       
   199     HbMainWindow* mMainWindow;
       
   200 
       
   201     /**
       
   202      * different views.
       
   203      */
       
   204     MsgUnifiedEditorView* mUniEditor;
       
   205     MsgListView* mListView;
       
   206     MsgConversationBaseView* mConversationView;
       
   207     UnifiedViewer* mUniViewer;
       
   208     DraftsListView* mDraftsListView;
       
   209     MsgSettingsView* mSettingsView;
       
   210     HbAction* mBackAction;
       
   211 
       
   212     int mPreviousView;
       
   213     int mCurrentView;
       
   214     int mViewAtServiceRequest;
       
   215     bool mServiceRequest;
       
   216     qint64 mConversationId;
       
   217     bool mViewServiceRequest;
       
   218     QList<HbView*> mViewTobeDeleted;
       
   219     HbView* mDummyview;
       
   220     int mMessageId;
       
   221 };
       
   222 
       
   223 #endif /* MSGVIEWMANAGER_H_ */