wvuing/wvuiave/AppSrc/CCAContactSelectionDialog.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Multi/single contact selection dialog
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCACONTACTSELECTIONDIALOG_H
       
    21 #define CCACONTACTSELECTIONDIALOG_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "MCAMainViewObserverPC.h"
       
    25 #include "MCAMainViewArrayPC.h"
       
    26 
       
    27 #include "TEnumsPC.h"
       
    28 #include "CCAAppUi.h"
       
    29 #include <akndialog.h>
       
    30 #include <eiklbo.h>
       
    31 
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class CAknSingle2GraphicStyleListBox;
       
    35 class CAknSearchField;
       
    36 class MCASkinVariant;
       
    37 class CAknNavigationControlContainer;
       
    38 class CCAStatusPaneHandler;
       
    39 class CAknNavigationDecorator;
       
    40 class CCAContactListBox;
       
    41 class MCASettingsPC;
       
    42 
       
    43 // CLASS DECLARATION
       
    44 
       
    45 /**
       
    46  *  Multi/single contact selection dialog
       
    47  *  Used for selecting contact(s)
       
    48  *
       
    49  *  @lib chat.exe
       
    50  *  @since Series 60 3.0
       
    51  */
       
    52 
       
    53 
       
    54 
       
    55 class CCAContactSelectionDialog : public CAknDialog,
       
    56             public MEikListBoxObserver,
       
    57             public MCAMainViewObserverPC
       
    58     {
       
    59     public:  // Constructors and destructor
       
    60 
       
    61         /**
       
    62           * static method for displaying the dialog
       
    63           * @param Array to be filled by on pcside and returned
       
    64           * with selectedcontacts,
       
    65           * @param aSelectMultiple ETrue if multiplecontacts
       
    66           *                        need to be selected(selection
       
    67           *                        list to be displayed)
       
    68           *                        else EFalse
       
    69           * @param aFilter If defined it is used, otherwise
       
    70           *                filtering is based on variation
       
    71           *                and settings.
       
    72           * @param aDisplayFilter If not defined display
       
    73           *                filtering is based on iFilter.
       
    74          */
       
    75         static TBool ShowDialogL(
       
    76             CDesCArray& aSelectedContacts,
       
    77             MCAMainViewArrayPC& aMainViewArrayPC,
       
    78             MCASkinVariant& aSkinVariant,
       
    79             MCASettingsPC& aSettings,
       
    80             TDesC& aMbmPath,
       
    81             TEnumsPC::TListSelectionType aSelectMultiple,
       
    82             TInt aResourceId,
       
    83             CCAStatusPaneHandler& aStatusPaneHandler,
       
    84             CDesCArray* aSelectedIdentifications,
       
    85             TEnumsPC::TFilterType aFilter
       
    86             = TEnumsPC::EFilterNotDefined,
       
    87             TEnumsPC::TFilterType aDisplayFilter
       
    88             = TEnumsPC::EFilterNotDefined,
       
    89             TBool aBlockingSelection = EFalse,
       
    90             TInt aSelectedListIndex = 0,
       
    91             TBool* aShutDialogFromFSW = NULL );
       
    92 
       
    93     protected:  // Functions from MCAMainViewObserverPC
       
    94 
       
    95         /**
       
    96           * From MCAMainViewObserverPC, called when a contact is deleted.
       
    97           * @since 2.1
       
    98           * @see MCAMainViewObserverPC
       
    99           */
       
   100         virtual void HandleDelete( const TDesC& aContactId ,
       
   101                                    TEnumsPC::TItem aType );
       
   102 
       
   103         /**
       
   104          * From MCAMainViewObserverPC, called when a contact is added.
       
   105          * @since 2.1
       
   106          * @see MCAMainViewObserverPC
       
   107          */
       
   108         virtual void HandleAddition( TEnumsPC::TItem aType, TInt aIndex );
       
   109 
       
   110         /**
       
   111          * From MCAMainViewObserverPC, called when a contact is changed.
       
   112          * @since 2.1
       
   113          * @see MCAMainViewObserverPC
       
   114          */
       
   115         virtual void HandleChange( TEnumsPC::TItem aType, TInt aIndex,
       
   116                                    TEnumsPC::TChange changeType );
       
   117 
       
   118         /**
       
   119          * Handles setting changes.
       
   120          * @param aChangedSettingEnum specifies the changed setting.
       
   121          */
       
   122         virtual void HandleSettingsChangeL( TInt aChangedSettingEnum );
       
   123 
       
   124         /**
       
   125          * From MCAMainViewObserverPC, called when a contact is changed.
       
   126          * @since 2.1
       
   127          * @see MCAMainViewObserverPC
       
   128          */
       
   129         virtual void HandleWatcherEvent( const TDesC &  aString , TEnumsPC::TOnlineStatus aOnlineStatus );
       
   130 
       
   131         /**
       
   132          * From MCAMainViewObserverPC, called when a invitation is received.
       
   133          * @since 2.1
       
   134          * @see MCAMainViewObserverPC
       
   135          */
       
   136         virtual void HandleInvitationEventL( TEnumsPC::TInviteType /* aInviteType */,
       
   137                                              const TDesC& aUserID,
       
   138                                              const TDesC& aMessage );
       
   139 
       
   140         /**
       
   141          * From MCAMainViewObserverPC, called when a invitation is received.
       
   142          * @since 2.1
       
   143          * @see MCAMainViewObserverPC
       
   144          */
       
   145         virtual void HandleInvitationResponse( TBool /*aAcceptance*/,
       
   146                                                const TDesC& /*aUserId*/,
       
   147                                                const TDesC&  /*aGroupName*/,
       
   148                                                const TDesC& /*aResponse*/ );
       
   149     protected:	// Functions from MEikListBoxObserver
       
   150 
       
   151         /**
       
   152          * Handles list box event
       
   153          */
       
   154         void HandleListBoxEventL( CEikListBox* aListBox,
       
   155                                   TListBoxEvent aEventType );
       
   156 
       
   157     protected:  // Functions from MCoeControlObserver
       
   158 
       
   159         /**
       
   160          * Handles events from findpane
       
   161          */
       
   162         void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
       
   163 
       
   164 
       
   165     protected:  // Functions from CAknDialog
       
   166 
       
   167         /**
       
   168          * @see CCoeControl
       
   169          */
       
   170         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   171                                      TEventCode aType );
       
   172 
       
   173         /**
       
   174         * @see CCoeControl
       
   175         */
       
   176         TInt CountComponentControls() const;
       
   177 
       
   178         /**
       
   179         * @see CCoeControl
       
   180         */
       
   181         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   182 
       
   183         /**
       
   184          * @see MEikMenuObserver
       
   185          */
       
   186         void DynInitMenuPaneL( TInt aResourceId,
       
   187                                CEikMenuPane* aMenuPane );
       
   188 
       
   189         /**
       
   190          * @see CEikDialog
       
   191          */
       
   192         void PreLayoutDynInitL();
       
   193 
       
   194         /**
       
   195            * @see CEikDialog
       
   196          */
       
   197         void PostLayoutDynInitL();
       
   198 
       
   199         /**
       
   200          * @see CEikDialog
       
   201          */
       
   202         TBool OkToExitL( TInt aButtonId );
       
   203 
       
   204         /**
       
   205          * @see CAknDialog
       
   206          */
       
   207         void ProcessCommandL( TInt aCommandId );
       
   208 
       
   209         /**
       
   210          * @see CAknDialog
       
   211          */
       
   212         void Draw( const TRect &aRect ) const;
       
   213 
       
   214         /**
       
   215          * @see CAknDialog
       
   216          * @since S60 v3.1
       
   217          */
       
   218         void SetSizeAndPosition( const TSize& aSize );
       
   219 
       
   220         /**
       
   221          * Creates custom controls for dialog:
       
   222          *      - Search field
       
   223          *      - List box, CCAContactListBox
       
   224          * @see CAknDialog
       
   225          * @since S60 v3.1
       
   226          */
       
   227         SEikControlInfo CreateCustomControlL( TInt aControlType );
       
   228 
       
   229         /**
       
   230          * @see CEikDialog
       
   231          */
       
   232         void HandleDialogPageEventL( TInt aEventID );
       
   233 
       
   234     private:    // new functions
       
   235 
       
   236         /**
       
   237          * Current index
       
   238          * @return current index
       
   239          */
       
   240         TInt CurrentIndex();
       
   241 
       
   242         /**
       
   243          * Set new navi label for current situation.
       
   244          */
       
   245         void SetNaviLabelL();
       
   246 
       
   247         /**
       
   248          * Reset the search box.
       
   249          * @since 3.0
       
   250          */
       
   251         void ResetFindBoxL();
       
   252 
       
   253         /**
       
   254          * Update the filter when collapsing the list.
       
   255          * @since 3.0
       
   256          */
       
   257         void UpdateFilterL();
       
   258 
       
   259         /**
       
   260          * Return search field from dialog.
       
   261          * @since S60 v3.1
       
   262          * @return CAknSearchField
       
   263          */
       
   264         CAknSearchField* FindBox() const;
       
   265 
       
   266         /**
       
   267          * Return list box from dialog.
       
   268          * @since S60 v3.1
       
   269          * @return CEikListBox, can be casted to CCAContactListBox
       
   270          */
       
   271         CEikListBox* ListBox() const;
       
   272 
       
   273         /**
       
   274          * Updates CBA.
       
   275          * @since S60 v3.1
       
   276          */
       
   277         void UpdateCbaL();
       
   278 
       
   279     private:
       
   280 
       
   281         /**
       
   282           * C++ default constructor.
       
   283            */
       
   284         CCAContactSelectionDialog(
       
   285             CDesCArray& aSelectedContacts,
       
   286             MCAMainViewArrayPC& aMainViewArrayPC,
       
   287             MCASettingsPC& aSettings,
       
   288             MCASkinVariant& aSkinVariant,
       
   289             TDesC& aMbmPath,
       
   290             TEnumsPC::TListSelectionType aSelectMultiple,
       
   291             CCAStatusPaneHandler& aStatusPaneHandler,
       
   292             CDesCArray* aSelectedIdentifications,
       
   293             TEnumsPC::TFilterType aFilter,
       
   294             TEnumsPC::TFilterType aDisplayFilter,
       
   295             TBool* iShutDialogFromFSW,
       
   296             TBool aBlockingSelection );
       
   297 
       
   298         /**
       
   299          * By default Symbian 2nd phase constructor is private.
       
   300           */
       
   301         TBool ConstructL( TInt aSelectedListIndex = 0 );
       
   302 
       
   303         /**
       
   304         * Layouts current components according to AVKON LAF
       
   305         */
       
   306         void SetLayout();
       
   307 
       
   308         /**
       
   309          * Destructor.
       
   310           */
       
   311         virtual ~CCAContactSelectionDialog();
       
   312 
       
   313     private:    // Data
       
   314 
       
   315         // Doesn't own.
       
   316         CDesCArray& iSelectedContacts;
       
   317 
       
   318         // Doesn't own.interface to MainViewArrayPC
       
   319         MCAMainViewArrayPC& iMainViewArrayPC;
       
   320 
       
   321         // Doesn't own. interface to SettingsPC
       
   322         MCASettingsPC& iSettings;
       
   323 
       
   324         // Doesn't own. interface to skinvariant for loading bitmaps
       
   325         MCASkinVariant& iSkinVariant;
       
   326 
       
   327         // Doesn't own. path to bitmap file
       
   328         TDesC& iMbmPath;
       
   329 
       
   330         // Can we select multiple contacts
       
   331         TEnumsPC::TListSelectionType iSelectMultiple;
       
   332 
       
   333         // Doesn't own, interface to navipane
       
   334         CAknNavigationControlContainer* iNaviPane;
       
   335 
       
   336         // Owns. Navi pane text.
       
   337         CAknNavigationDecorator* iNaviPaneText;
       
   338 
       
   339         // Do we have pushed navipane in stack
       
   340         TBool iNaviPanePushed;
       
   341 
       
   342         // Do we need to remove the cleared navepane from stack
       
   343         TBool iNaviPaneCleared;
       
   344 
       
   345         // Owns. old titlepane text
       
   346         HBufC* iOldTitle;
       
   347 
       
   348         // selection counter
       
   349         TInt iSelectionCount;
       
   350 
       
   351         // set this to ETrue before calling TryExitL
       
   352         TBool iExiting;
       
   353 
       
   354         // filter that should be used with contact list model
       
   355         TEnumsPC::TFilterType iFilter;
       
   356 
       
   357         // filter that was previously used
       
   358         TEnumsPC::TFilterType iDisplayFilter;
       
   359 
       
   360         // status pane handler
       
   361         CCAStatusPaneHandler& iStatusPaneHandler;
       
   362 
       
   363         // Doesn't own.
       
   364         CDesCArray* iSelectedIdentifications;
       
   365 
       
   366         TBool iBlockingSelection;
       
   367 
       
   368         CCAAppUi* iAppUi;
       
   369 
       
   370         // if success remove from cleanupstack in destructor
       
   371         TBool iDialogCreationSuccess;
       
   372 
       
   373         // ETrue if user try to exit IM from FSW (Fast Swap Window), else always is EFalse.
       
   374         TBool* iShutDialogFromFSW;
       
   375     };
       
   376 
       
   377 #endif      // CCACONTACTSELECTIONDIALOG_H
       
   378 
       
   379 // End of File