messagingapp/shareui/inc/shareuiprivate.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:  Offers message creation and sending services.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef SHAREUIPRIVATE_H_
       
    21 #define SHAREUIPRIVATE_H_
       
    22 
       
    23 #include <qobject.h>
       
    24 #include <qfile.h>
       
    25 #include <qstandarditemmodel.h>
       
    26 #include <QModelIndex>
       
    27 #include <QStringList>
       
    28 
       
    29 #include <hbaction.h>
       
    30 #include <hbmenu.h>
       
    31 #include <hbdialog.h>
       
    32 #include <hblabel.h>
       
    33 #include <hblistview.h>
       
    34 #include <hblistviewitem.h>
       
    35 
       
    36 #include <xqaiwrequest.h>
       
    37 #include <xqappmgr.h>
       
    38 #include <xqaiwinterfacedescriptor.h>
       
    39 
       
    40 
       
    41 #define SERVICE_INTERFACE "imessage.send"
       
    42 #define SHARE_OP "send(QVariant)"
       
    43 
       
    44 /**
       
    45  * Private implementaion of shareui.
       
    46  * implements showing sending services dialog and sending files
       
    47  */
       
    48 class ShareUiPrivate : public QObject
       
    49     {
       
    50     Q_OBJECT
       
    51     
       
    52 public:
       
    53     
       
    54     /**
       
    55      * Constructor
       
    56      */
       
    57     ShareUiPrivate();
       
    58     
       
    59     /**
       
    60      * Destructor
       
    61      */
       
    62     virtual ~ShareUiPrivate();
       
    63     
       
    64     /**
       
    65      * method for passing file list to the sending services
       
    66      * @param fileList list of paths to files.eg: c:\images\sunset.jpg
       
    67      * @param embedded true if sendui dialog is embedded in the launched application
       
    68      * 
       
    69      * @return bool true if dialog initialization successfull otherwise false
       
    70      */
       
    71     bool init(QStringList& fileList, bool embedded);
       
    72     
       
    73 
       
    74     
       
    75 public slots:
       
    76 
       
    77     /**
       
    78      * Handles setting th orguments for triggered service
       
    79      */
       
    80     void onTriggered(void); 
       
    81     
       
    82     /**
       
    83      * Slot for handling valid returns from the framework.
       
    84      * 
       
    85      * @param result const QVariant&
       
    86      */
       
    87     void handleOk(const QVariant& result);
       
    88     
       
    89     /**
       
    90      * Slot for handling errors. Error ids are provided as 
       
    91      * 32-bit integers.
       
    92      * @param errorCode qint32
       
    93      */
       
    94     void handleError(int errorCode, const QString& errorMessage);
       
    95 
       
    96 private slots:
       
    97 
       
    98     /** 
       
    99      * When a list box item is pressed, this slot should be invoked. The action
       
   100      * corresponding to the clicked list item should be invoked with the stored lis
       
   101      * of files.
       
   102      * 
       
   103      * @param index QModelIndex
       
   104      * 
       
   105      */
       
   106     void itemActivated(QModelIndex index);
       
   107     
       
   108 private:
       
   109 
       
   110     /**
       
   111      * fetchServiceDescriptors
       
   112      * 
       
   113      * Fetches the service descriptors using the Application Manager api. 
       
   114      * 
       
   115      * @return error boolean true if successfully fetched.
       
   116      */
       
   117     bool fetchServiceDescriptors(QList<XQAiwInterfaceDescriptor>& descriptorList);
       
   118     
       
   119     /**
       
   120      * fetchServiceAction fetches the action associated with a specified interface descriptor.
       
   121      * This is used after the fetchServiceDescriptors is called, and 
       
   122      * 
       
   123      * @param serviceDescriptor ServiceDescriptor fetched using fetchServiceDescriptors
       
   124      * @return error boolean true if successfully fetched.
       
   125      */
       
   126     HbAction* fetchServiceAction(XQAiwInterfaceDescriptor interfaceDescriptor);    
       
   127     
       
   128     /**
       
   129       * Creates the view for the sendui dialog.
       
   130       *  
       
   131       * @return bool true if initialization was successful, false otherwise.
       
   132       */
       
   133     void initializeUi(void);
       
   134     
       
   135     /**
       
   136      * Update the SendUi Dialog (and associated list items) once the required
       
   137      * information has been fetched.
       
   138      * 
       
   139      * @params action HbAction* The action that must be associated with the entry at that point in the list.
       
   140      */
       
   141     bool updateShareUiDialogList(HbAction* action);
       
   142     
       
   143     /**
       
   144      * Enable the UI and show it on the screen.
       
   145      */
       
   146     void enableUi(void);
       
   147     
       
   148     /**
       
   149      * Convert a qaction to hbaction.
       
   150      * 
       
   151      * @param action QAction*
       
   152      * @return HbAction* 
       
   153      */
       
   154     HbAction* convertAction(QAction *action);
       
   155     
       
   156 private:
       
   157     /**
       
   158      * 
       
   159      * List of files to be sent.
       
   160      * 
       
   161      */
       
   162     QList<QVariant> mFileList;
       
   163     
       
   164     /**
       
   165      * Service List
       
   166      */
       
   167     QList<XQAiwRequest*> mAiwRequestList;
       
   168     /**
       
   169      * ShareUi dialog
       
   170      */
       
   171     HbDialog* mSharePopup;
       
   172     
       
   173     /**
       
   174      * 
       
   175      * item model for content list view.
       
   176      */
       
   177     
       
   178     QStandardItemModel* mContentItemModel;
       
   179     /**
       
   180      * content view
       
   181      */
       
   182     
       
   183     HbListView* mContentListView;
       
   184     
       
   185     /**
       
   186      * mapping qmodelindex to the action
       
   187      * 
       
   188      */
       
   189     
       
   190     QMap<QModelIndex, HbAction*> mIndexActionMap;
       
   191     
       
   192     /**
       
   193      * Application Manager
       
   194      */
       
   195     XQApplicationManager mAppManager;
       
   196     
       
   197     /**
       
   198      * Whether to launch the sending application as embedded or not.
       
   199      */
       
   200     bool mIsEmbedded;
       
   201     
       
   202     };
       
   203 
       
   204 #endif /* SENDUIDIALOG_P_H_ */