messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h
branchRCL_3
changeset 57 ebe688cedc25
equal deleted inserted replaced
54:fa1df4b99609 57:ebe688cedc25
       
     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 #include <HbEffect>
       
    25 
       
    26 class QGraphicsItem;
       
    27 class QGraphicsPixmapItem;
       
    28 class HbMainWindow;
       
    29 class MsgUnifiedEditorView;
       
    30 class UnifiedViewer;
       
    31 class MsgBaseView;
       
    32 class MsgSettingsView;
       
    33 class HbAction;
       
    34 class MsgStoreHandler;
       
    35 
       
    36 class MsgServiceViewManager: public QObject
       
    37 {
       
    38 Q_OBJECT
       
    39 
       
    40 public:
       
    41     /**
       
    42      * Constructor
       
    43      */
       
    44     MsgServiceViewManager(MsgStoreHandler* storeHandler,
       
    45             HbMainWindow* mainWindow, QObject* parent = 0);
       
    46 
       
    47     /**
       
    48      * Destructor.
       
    49      */
       
    50     ~MsgServiceViewManager();
       
    51 
       
    52     /**
       
    53      * Send message.
       
    54      * @param phoneNumber phone number.
       
    55      * @param contactId contactId.
       
    56      * @param displayName displayname.
       
    57      */
       
    58     void send(const QString phoneNumber, 
       
    59               const qint32 contactId, 
       
    60               const QString displayName);
       
    61 
       
    62     /**
       
    63      * Send message.
       
    64      * @param phoneNumber phone number.
       
    65      * @param alias alias.
       
    66      * @param bodyText body text.
       
    67      */
       
    68     void send(const QString phoneNumber, 
       
    69               const QString alias, 
       
    70               const QString bodyText);
       
    71               
       
    72     /**
       
    73      * Send message.
       
    74      * @param addressList list of phone numbers and displaynames. 
       
    75      * key is the phone number and value is the display name.
       
    76      * @param bodyText body text.
       
    77      */
       
    78     void send(const QVariantMap addressList, 
       
    79               const QString bodyText = QString());
       
    80 
       
    81     /**
       
    82      * Send message.
       
    83      * @param data data to be sent.
       
    84      */
       
    85     void send(QVariant data);
       
    86 
       
    87     /**
       
    88      * Opens the viewer to view the message.
       
    89      * @param msgId message id of the message.
       
    90      */
       
    91     void view(int msgId);
       
    92 
       
    93 private:
       
    94     /*
       
    95      * Switch to unieditor.
       
    96      * @param editorData editor data.
       
    97      */
       
    98     void switchToUniEditor(const QVariantList& editorData);
       
    99 
       
   100     /*
       
   101      * Switch to settings view.
       
   102      */
       
   103     void switchToMsgSettings(const QVariantList& data);
       
   104 
       
   105     /**
       
   106      * Handle sms and mms messge
       
   107      * @param msgId message id
       
   108      */
       
   109     void handleSmsMmsMsg(int msgId,int msgType);
       
   110 
       
   111     /**
       
   112      * Handle ringtone message
       
   113      * @param msgId message id
       
   114      */
       
   115     void handleRingtoneMsg(int msgId);
       
   116 
       
   117     /**
       
   118      * Handle provisioning message
       
   119      * @param msgId message id
       
   120      */
       
   121     void handleProvisoningMsg(int msgId);
       
   122 
       
   123     /**
       
   124      * Handle bluetooth message
       
   125      * @param msgId message id
       
   126      */
       
   127     void handleBTMessage(int msgId);
       
   128     
       
   129     /**
       
   130      * Start a custom effect animation
       
   131      * e.g. editor's send effect
       
   132      * @param effectEvent, effect type for animation
       
   133      */
       
   134     void startAnimation(QString effectEvent);
       
   135     
       
   136     /**
       
   137      * Reset a custom effect animation
       
   138      * e.g. editor's send effect
       
   139      * @param effectEvent, animation effect type which needs to be reset
       
   140      * @param item, QGraphicsItem on which the effect was run
       
   141      */
       
   142     void resetAnimation(QString effectEvent, QGraphicsItem* item);
       
   143     
       
   144     /**
       
   145      * Grab screenshot for animation purpose
       
   146      * e.g. editor's send effect animation
       
   147      * @return QGraphicsPixmapItem, item on which animation will run
       
   148      */
       
   149     QGraphicsPixmapItem *screenShot();
       
   150     
       
   151     /**
       
   152      * find and return animation file for an effect
       
   153      * @param effectEvent, effect for which file definition needs to be found
       
   154      * @return QString, animation definition file path
       
   155      */
       
   156     QString getAnimationFile(QString effectEvent);
       
   157     
       
   158 private slots:
       
   159     /**
       
   160      * This slot is called on mainwindows back action.
       
   161      */
       
   162     void onBackAction();
       
   163 
       
   164     /**
       
   165      * This slot is called when switchView signal is emitted from a view.
       
   166      * @param data data required to switch the views.
       
   167      */
       
   168     void switchView(const QVariantList& data);
       
   169     
       
   170 	/**
       
   171      * This slot is called delete message dialog launched.
       
   172      * @param action selected action (yes or no).
       
   173      */
       
   174     void onDialogDeleteMsg(HbAction* action);
       
   175 
       
   176     /**
       
   177      * This slot is called save tone dialog launched.
       
   178      * @param action selected action (yes or no)
       
   179      */
       
   180     void onDialogSaveTone(HbAction* action);
       
   181     
       
   182     /**
       
   183      * Handle a custom effect animation complete signal
       
   184      * e.g. editor's send effect complete
       
   185      * @param status, status information of the effect that has finished
       
   186      */
       
   187     void onAnimationComplete(const HbEffect::EffectStatus &status);
       
   188     
       
   189 private:
       
   190     /**
       
   191      * Main window pointer. 
       
   192      * Not owned.
       
   193      */
       
   194     HbMainWindow* mMainWindow;
       
   195 
       
   196     /**
       
   197      * Unified editor. 
       
   198      * Owned.
       
   199      */
       
   200     MsgUnifiedEditorView* mUniEditor;
       
   201     
       
   202     /**
       
   203      * Unified viewer. 
       
   204      * Owned.
       
   205      */
       
   206     UnifiedViewer* mUniViewer;
       
   207     
       
   208     /**
       
   209      * Settings view. 
       
   210      * Owned.
       
   211      */
       
   212     MsgSettingsView* mSettingsView;
       
   213     
       
   214     /**
       
   215      * Back action 
       
   216      * Owned.
       
   217      */
       
   218     HbAction* mBackAction;
       
   219 
       
   220     /**
       
   221      * Store handler.
       
   222      * Not Owned.
       
   223      */
       
   224     MsgStoreHandler* mStoreHandler;
       
   225     
       
   226     /**
       
   227      * Current view value.
       
   228      */
       
   229     int mCurrentView;
       
   230     
       
   231 	/**
       
   232 	 * message Id
       
   233 	 */
       
   234     int mMessageId;    
       
   235 };
       
   236 
       
   237 #endif /* MSGSERVICEVIEWMANAGER_H_ */