messagingapp/msgui/msgapp/inc/msgviewmanager.h
changeset 23 238255e8b033
child 25 84d9eb65b26f
equal deleted inserted replaced
5:4697dfb2d7ad 23:238255e8b033
       
     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 
       
    35 class MsgViewManager: public QObject
       
    36     {
       
    37     Q_OBJECT   
       
    38    
       
    39 public:
       
    40     /**
       
    41      * constructor
       
    42      */
       
    43     MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent = 0);
       
    44     
       
    45     /**
       
    46      * Destructor.
       
    47      */
       
    48     ~MsgViewManager();
       
    49     
       
    50     /**
       
    51      * call back function will be called from MsgServiceInterface.
       
    52      */
       
    53     void send(const qint32 contactId, const QString phoneNumber, const QString displayName);
       
    54     
       
    55     /**
       
    56      * call back function called from MsgServiceInterface to set service request flag.
       
    57      */
       
    58     void setServiceRequest(bool request);
       
    59     
       
    60     /**
       
    61      * call back function called MsgServiceInterface.
       
    62      */
       
    63     void open(qint64 conversationId);
       
    64     
       
    65     /**
       
    66      * call back function called MsgServiceInterface.
       
    67      */
       
    68     void send(QVariant data);
       
    69     
       
    70     /**
       
    71      * depricated api. will be removed in future.
       
    72      */
       
    73     void openEditor(QString number, QString name);
       
    74     
       
    75 private:
       
    76     /**
       
    77      * swiches back to last view after service request is complete.
       
    78      */
       
    79     void switchToLastSavedView();
       
    80     
       
    81     /**
       
    82      * find conversation id corresponding to given phone no.
       
    83      * @param phoneNum
       
    84      */
       
    85     qint64 findConversationId(const QString phoneNum);
       
    86     
       
    87     /**
       
    88      * helper method to complete back action.
       
    89      */
       
    90     void completeServiceRequest();
       
    91 
       
    92     /*
       
    93      * switch to clv.
       
    94      */
       
    95     void switchToClv(const QVariantList& data);
       
    96 
       
    97     /*
       
    98      * switch to cv.
       
    99      */
       
   100     void switchToCv(const QVariantList& data);
       
   101 
       
   102     /*
       
   103      * switch to dlv.
       
   104      */
       
   105     void switchToDlv(const QVariantList& data);
       
   106 
       
   107     /*
       
   108      * switch to unieditor.
       
   109      */
       
   110     void switchToUniEditor(const QVariantList& data);
       
   111 
       
   112     /*
       
   113      * switch to univiewer.
       
   114      */
       
   115     void switchToUniViewer(const QVariantList& data);
       
   116 
       
   117     /*
       
   118      * switch to settings.
       
   119      */
       
   120     void switchToMsgSettings(const QVariantList& data);
       
   121 
       
   122     /*
       
   123      * handle other cases.
       
   124      */
       
   125     void handleDefault(const QVariantList& data);
       
   126 
       
   127 private slots:
       
   128     /**
       
   129      * this slot is called on mainwindows back action.
       
   130      */
       
   131     void onBackAction();
       
   132     
       
   133     /**
       
   134      * This slot is called when switchView signal is emitted from a view.
       
   135      */
       
   136     void switchView(const QVariantList& data);
       
   137     
       
   138 private:
       
   139     /**
       
   140      * main window reference not owned.
       
   141      */
       
   142     HbMainWindow* mMainWindow;
       
   143     
       
   144     /**
       
   145      * different views.
       
   146      */
       
   147     MsgUnifiedEditorView* mUniEditor;
       
   148     MsgListView* mListView;
       
   149     MsgConversationBaseView* mConversationView;
       
   150     UnifiedViewer* mUniViewer;
       
   151     DraftsListView* mDraftsListView;
       
   152     MsgSettingsView* mSettingsView;
       
   153     HbAction* mBackAction;
       
   154 
       
   155     int mPreviousView;
       
   156     int mCurrentView;
       
   157     int mViewAtServiceRequest;
       
   158     bool mServiceRequest;
       
   159     qint64 mConversationId;
       
   160     };
       
   161 
       
   162 #endif /* MSGVIEWMANAGER_H_ */