messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h
changeset 37 518b245aa84c
child 38 4e4b6adb1024
equal deleted inserted replaced
25:84d9eb65b26f 37:518b245aa84c
       
     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: Manages differnt messaging views.
       
    15  * 
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef MSGSERVICEVIEWMANAGER_H_
       
    20 #define MSGSERVICEVIEWMANAGER_H_
       
    21 
       
    22 #include <QObject>
       
    23 #include <QVariant>
       
    24 
       
    25 class HbMainWindow;
       
    26 class MsgUnifiedEditorView;
       
    27 class UnifiedViewer;
       
    28 class MsgBaseView;
       
    29 class MsgSettingsView;
       
    30 class HbAction;
       
    31 class MsgStoreHandler;
       
    32 
       
    33 class MsgServiceViewManager: public QObject
       
    34 {
       
    35 Q_OBJECT
       
    36 
       
    37 public:
       
    38     /**
       
    39      * Constructor
       
    40      */
       
    41     MsgServiceViewManager(MsgStoreHandler* storeHandler,
       
    42             HbMainWindow* mainWindow, QObject* parent = 0);
       
    43 
       
    44     /**
       
    45      * Destructor.
       
    46      */
       
    47     ~MsgServiceViewManager();
       
    48 
       
    49     /**
       
    50      * Send message.
       
    51      * @param phoneNumber phone number.
       
    52      * @param contactId contactId.
       
    53      * @param displayName displayname.
       
    54      */
       
    55     void send(const QString phoneNumber, 
       
    56               const qint32 contactId, 
       
    57               const QString displayName);
       
    58 
       
    59     /**
       
    60      * Send message.
       
    61      * @param phoneNumber phone number.
       
    62      * @param alias alias.
       
    63      * @param bodyText body text.
       
    64      */
       
    65     void send(const QString phoneNumber, 
       
    66               const QString alias, 
       
    67               const QString bodyText);
       
    68               
       
    69     /**
       
    70      * Send message.
       
    71      * @param addressList list of phone numbers and displaynames. 
       
    72      * key is the phone number and value is the display name.
       
    73      * @param bodyText body text.
       
    74      */
       
    75     void send(const QVariantMap addressList, 
       
    76               const QString bodyText = QString());
       
    77 
       
    78     /**
       
    79      * Send message.
       
    80      * @param data data to be sent.
       
    81      */
       
    82     void send(QVariant data);
       
    83 
       
    84     /**
       
    85      * Opens the viewer to view the message.
       
    86      * @param msgId message id of the message.
       
    87      */
       
    88     void view(int msgId);
       
    89 
       
    90 private:
       
    91     /*
       
    92      * Switch to unieditor.
       
    93      * @param editorData editor data.
       
    94      */
       
    95     void switchToUniEditor(const QVariantList& editorData);
       
    96 
       
    97     /*
       
    98      * Switch to settings view.
       
    99      */
       
   100     void switchToMsgSettings(const QVariantList& data);
       
   101 
       
   102     /**
       
   103      * Handle sms and mms messge
       
   104      * @param msgId message id
       
   105      */
       
   106     void handleSmsMmsMsg(int msgId);
       
   107 
       
   108     /**
       
   109      * Handle ringtone message
       
   110      * @param msgId message id
       
   111      */
       
   112     void handleRingtoneMsg(int msgId);
       
   113 
       
   114     /**
       
   115      * Handle provisioning message
       
   116      * @param msgId message id
       
   117      */
       
   118     void handleProvisoningMsg(int msgId);
       
   119 
       
   120     /**
       
   121      * Handle bluetooth message
       
   122      * @param msgId message id
       
   123      */
       
   124     void handleBTMessage(int msgId);
       
   125     
       
   126 private slots:
       
   127     /**
       
   128      * This slot is called on mainwindows back action.
       
   129      */
       
   130     void onBackAction();
       
   131 
       
   132     /**
       
   133      * This slot is called when switchView signal is emitted from a view.
       
   134      * @param data data required to switch the views.
       
   135      */
       
   136     void switchView(const QVariantList& data);
       
   137     
       
   138 	/**
       
   139      * This slot is called delete message dialog launched.
       
   140      * @param action selected action (yes or no).
       
   141      */
       
   142     void onDialogDeleteMsg(HbAction* action);
       
   143 
       
   144     /**
       
   145      * This slot is called save tone dialog launched.
       
   146      * @param action selected action (yes or no)
       
   147      */
       
   148     void onDialogSaveTone(HbAction* action);
       
   149 	
       
   150 private:
       
   151     /**
       
   152      * Main window pointer. 
       
   153      * Not owned.
       
   154      */
       
   155     HbMainWindow* mMainWindow;
       
   156 
       
   157     /**
       
   158      * Unified editor. 
       
   159      * Owned.
       
   160      */
       
   161     MsgUnifiedEditorView* mUniEditor;
       
   162     
       
   163     /**
       
   164      * Unified viewer. 
       
   165      * Owned.
       
   166      */
       
   167     UnifiedViewer* mUniViewer;
       
   168     
       
   169     /**
       
   170      * Settings view. 
       
   171      * Owned.
       
   172      */
       
   173     MsgSettingsView* mSettingsView;
       
   174     
       
   175     /**
       
   176      * Back action 
       
   177      * Owned.
       
   178      */
       
   179     HbAction* mBackAction;
       
   180 
       
   181     /**
       
   182      * Store handler.
       
   183      * Not Owned.
       
   184      */
       
   185     MsgStoreHandler* mStoreHandler;
       
   186     
       
   187     /**
       
   188      * Current view value.
       
   189      */
       
   190     int mCurrentView;
       
   191     
       
   192 	/**
       
   193 	 * message Id
       
   194 	 */
       
   195     int mMessageId;
       
   196   
       
   197 };
       
   198 
       
   199 #endif /* MSGSERVICEVIEWMANAGER_H_ */