wvuing/wvuiave/AppSrc/CCAGroupPropertiesDialog.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:  Editing and  viewing class for chat group properties
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCAGROUPPROPERTIESDIALOG_H
       
    21 #define CCAGROUPPROPERTIESDIALOG_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <aknform.h>
       
    25 #include <eiklbo.h>
       
    26 #include <bldvariant.hrh>
       
    27 
       
    28 #include "TEnumsPC.h"
       
    29 // FORWARD DECLARATIONS
       
    30 class CAknSettingItemArray;
       
    31 class CCAStatusPaneHandler;
       
    32 class CAknSettingStyleListBox;
       
    33 class CCAAppUi;
       
    34 class MCAGroupPC;
       
    35 class MCAGroupPropertiesPC;
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39  *  Dialog class for setting and editing group properties
       
    40  *
       
    41  *  @lib chatng.app
       
    42  *  @since 3.2
       
    43  */
       
    44 class CCAGroupPropertiesDialog : public CAknDialog,
       
    45             public MEikListBoxObserver
       
    46     {
       
    47     public:  // Constructors and destructor
       
    48 
       
    49         /**
       
    50          * C++ default constructor.
       
    51          *
       
    52          * @param aTitleBar The in-memory representation of the
       
    53          *                  statuspanehandler.
       
    54          * @param aEditMode ETrue if editing else group properties are set
       
    55          *
       
    56          * @param aUserList List of users
       
    57          * @param aAdmins List of administrators
       
    58          * @param aBannedUsers List of banned users
       
    59          *
       
    60          * @param aGroupId Group id
       
    61          * @param aAreItemsEdited ETrue if items are edited
       
    62          */
       
    63         CCAGroupPropertiesDialog( CCAStatusPaneHandler& aTitleBar,
       
    64                                   TBool aEditMode,
       
    65                                   CDesCArray& aUserList,
       
    66                                   CDesCArray& aAdmins,
       
    67                                   CDesCArray& aBannedUsers,
       
    68                                   const TDesC& aGroupId,
       
    69                                   TBool& aAreItemsEdited );
       
    70 
       
    71         /**
       
    72          * Destructor
       
    73          */
       
    74         virtual ~CCAGroupPropertiesDialog();
       
    75 
       
    76         /**
       
    77          * 2nd level constructor.
       
    78          * @param aMenuResource The menu resource
       
    79          */
       
    80         void ConstructL( TInt aMenuResource );
       
    81 
       
    82     private: // New functions
       
    83 
       
    84         /**
       
    85          * This method launches access list dialog
       
    86          * @return 1 if dialog is exit by ok else 0
       
    87          */
       
    88         TInt LaunchAccessListDialogL();
       
    89 
       
    90         /**
       
    91          * This method launches editing rights list dialog
       
    92          * @return Dialog exit code
       
    93          */
       
    94         TInt LaunchEditingRightsListDialogL();
       
    95 
       
    96         /**
       
    97          * This method launches banned users list dialog
       
    98          * @return Dialog exit code
       
    99          */
       
   100         TInt LaunchBannedUsersListDialogL();
       
   101 
       
   102         /**
       
   103          * This method changes CBA labels
       
   104          */
       
   105         void HandleCBAChangeL();
       
   106 
       
   107         /**
       
   108          * Helper to launch a popup and handle Cancel
       
   109          * correctly with various list dialogs. Needed for AVKON
       
   110          * quirks.
       
   111          * @param aPopupResourceId The resource id for the popup texts
       
   112          * @param aSettingResourceId The radiobutton settings page resource id
       
   113          * @param aSelectionIndex user`s selection
       
   114          * @param aCallBack Pointer to member to invoke under conditions of
       
   115          * aBoolPtr and aInvokeOnFalse
       
   116          * @param aInvokeOnFalse ETrue means to invoke aCallBack when *aBoolPtr
       
   117          * is EFalse
       
   118          * @since 2.common
       
   119          * @return The aCallBack return value
       
   120          */
       
   121         TInt LaunchDialogHelperL(
       
   122             TInt aPopupResourceId,
       
   123             TInt aSettingResourceId,
       
   124             TInt& aSelectionIndex,
       
   125             TInt ( CCAGroupPropertiesDialog::* aCallBack )(),
       
   126             TBool aInvokeOnFalse = EFalse );
       
   127 
       
   128         TInt LaunchDialogHelperL(
       
   129             TInt aPopupResourceId,
       
   130             TInt aSettingResourceId,
       
   131             TInt& aSelectionIndex,
       
   132             TInt ( CCAGroupPropertiesDialog::* aCallBack )(),
       
   133             TEnumsPC::TImpsPropertyBoolPC  aInvokeOnTrue );
       
   134     private: //New methods
       
   135 
       
   136         /**
       
   137          * This method checks if items are edited
       
   138          * @since 2.1
       
   139          * @return ETrue if edited
       
   140          */
       
   141         TBool AreItemsEdited();
       
   142 
       
   143         /**
       
   144          * Adds text setting item to setting item array
       
   145          * @param aSettingPageResourceId Setting page resoure
       
   146          * @param aTitleResourceId Resource id of title
       
   147          * @param aOrdinal Ordinal id
       
   148          * @param aEmptyText Empty item text
       
   149          * @param aModifiedBuffer Descriptor that contains modified value
       
   150          */
       
   151         void AddTextSettingItemL( TInt aSettingPageResourceId,
       
   152                                   TInt aTitleResourceId,
       
   153                                   TInt aOrdinal,
       
   154                                   TDesC& aEmptyText,
       
   155                                   TDes& aModifiedBuffer );
       
   156 
       
   157         /**
       
   158          * Adds integer setting item to setting item array
       
   159          * @param aSettingPageResourceId Setting page resource Id
       
   160          * @param aTitleResourceId Title resource id
       
   161          * @param aOrdinal Ordinal id
       
   162          * @param aModigiedValue Contains modified value after change
       
   163          */
       
   164         void AddIntegerSettingItemL( TInt aSettingPageResourceId,
       
   165                                      TInt aTitleResourceId,
       
   166                                      TInt aOrdinal,
       
   167                                      TInt& aModifiedValue );
       
   168 
       
   169         /**
       
   170          * Adds binary setting item to setting item array
       
   171          * @param aSettingPageResourceId Setting page resource Id
       
   172          * @param aTitleResourceId Title resource id
       
   173          * @param aAssociatedResourceId Associated resource id
       
   174          * @param aOrdinal Ordinal id
       
   175          * @param aModigiedValue Contains modified value after change
       
   176          */
       
   177         void AddBinarySettingItemL( TInt aSettingPageResourceId,
       
   178                                     TInt aTitleResourceId,
       
   179                                     TInt aAssociatedResourceId,
       
   180                                     TInt aOrdinal,
       
   181                                     TEnumsPC::TImpsPropertyBoolPC& aModifiedValue );
       
   182 
       
   183         /**
       
   184         * Launches a edit dialog from currently focused listbox item.
       
   185         * Note! Do NOT call this method directly. Use LaunchCorrectDialogL.
       
   186         * @return if dialog was launched (ETrue) else (EFalse)
       
   187         */
       
   188         TBool DoLaunchCorrectDialogL();
       
   189 
       
   190         /**
       
   191          * Sets up the async dialog launching.
       
   192          * Calling this will method will eventually launch
       
   193          * DoLaunchCorrectDialogL, which should do all the work.
       
   194          * Async launching is done to release the pointer- and keyevents.
       
   195          */
       
   196         void LaunchCorrectDialog();
       
   197 
       
   198         /**
       
   199          * Static TCallBack method to launch dialogs
       
   200          * This will call DoLaunchCorrectDialogL
       
   201          * @param aDlg pointer to calling dialog (this)
       
   202          * @return TInt return value needed for TCallBack
       
   203          * @see DoLaunchCorrectDialogL
       
   204          */
       
   205         static TInt LaunchDlgCallBack( TAny* aDlg );
       
   206 
       
   207     public:	//From MEikCommandObserver
       
   208 
       
   209         /**
       
   210          * Processes user commands
       
   211          * @param ID of the command to respond to
       
   212          */
       
   213         void ProcessCommandL( TInt aCommand );
       
   214 
       
   215     public: // Functions from MEikListBoxObserver
       
   216 
       
   217         /**
       
   218          * From MEikListBoxObserver Handles listbox events
       
   219          * @param aListBox In memory representation of listbox
       
   220          * @param aEventType Event type od listbox
       
   221          */
       
   222         void HandleListBoxEventL( CEikListBox* aListBox,
       
   223                                   TListBoxEvent aEventType );
       
   224 
       
   225     public:
       
   226 
       
   227         /**
       
   228          * Dynamically initialises a menu pane. The Uikon framework calls this
       
   229          * function, if it is implemented in a menu’s observer, immediately
       
   230          * before the menu pane is activated.
       
   231          * @param aResourceId Resource ID identifying the menu bar to
       
   232          *                    initialise
       
   233          * @param The in-memory representation of the menu bar
       
   234          */
       
   235         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   236 
       
   237     public:     // from CCoeControl
       
   238 
       
   239         /**
       
   240         * @see CCoeControl.
       
   241         */
       
   242         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   243 
       
   244 
       
   245 
       
   246         /**
       
   247          * Help Key Support
       
   248          * This function is called by the Framework to get the context to launch
       
   249          * Help
       
   250          *
       
   251          * @param aContext	The context that contains the appid and the help id.
       
   252          */
       
   253         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   254     protected:  // Functions from CEikDialog
       
   255 
       
   256         /**
       
   257          * From CEikDialog Sets the dialog layout when dialog is started
       
   258          * @see CEikDialog
       
   259          */
       
   260         void PreLayoutDynInitL();
       
   261 
       
   262         /**
       
   263          * From CEikDialog. Called when dialog is dismissed
       
   264          * @see CEikDialog
       
   265          */
       
   266         TBool OkToExitL( TInt aButtonId );
       
   267 
       
   268         /**
       
   269          * This method stores the values of setting items
       
   270          */
       
   271         void StoreValuesL();
       
   272 
       
   273     private:    // enumerations for setting item ids
       
   274 
       
   275         enum TSettingItemId
       
   276             {
       
   277             ESetGroupName = 0,
       
   278             ESetGroupId,
       
   279             ESetGroupTopic,
       
   280             ESetGroupWelcomeNote,
       
   281             ESetGroupSize,
       
   282             ESetGroupAllowSearch,
       
   283             ESetGroupAdminSelected,
       
   284             ESetGroupIsOpen,
       
   285             ESetGroupBannedUsers,
       
   286             ESetGroupAllowWhisper
       
   287             };
       
   288 
       
   289     private:    // Data
       
   290 
       
   291         //Doesn't own.
       
   292         CCAStatusPaneHandler& iTitlePane;
       
   293 
       
   294         TBool iEditMode;
       
   295 
       
   296         //Doesn't own.
       
   297         CDesCArray& iUserList;
       
   298 
       
   299         //Doesn't own.
       
   300         CDesCArray& iAdmins;
       
   301 
       
   302         //Doesn't own
       
   303         CDesCArray& iBannedUsers;
       
   304 
       
   305         //Group id . Doesnt own
       
   306         const TDesC& iGroupId;
       
   307 
       
   308         //Whether the properties of the group has been changed by the user
       
   309         TBool& iAreItemsEdited;
       
   310 
       
   311         //name od the group
       
   312         TPtr iGroupName;
       
   313 
       
   314         //Name of the group before editting. Doesnt own
       
   315         HBufC* iOldGroupName;
       
   316 
       
   317         //Group topic. Doesnt own
       
   318         TPtr iTopic;
       
   319 
       
   320         //Topic of the group before editting. Doesnt own
       
   321         HBufC* iOldTopic;
       
   322 
       
   323         //Welcome note to the group. Doesnt own
       
   324         TPtr iWelcomeNote;
       
   325 
       
   326         //Welcome note before editting. Doesnt own
       
   327         HBufC* iOldWelcomeNote;
       
   328 
       
   329         //Owns
       
   330         CAknSettingItemArray* iSettingItemArray;
       
   331 
       
   332         //Owns
       
   333         HBufC* iGroupNameBuf;
       
   334 
       
   335         //Owns
       
   336         HBufC* iTopicBuf;
       
   337 
       
   338         //Owns
       
   339         HBufC* iWelcomeNoteBuf;
       
   340 
       
   341         //Size of the group. Doesnt own
       
   342         TInt iSize;
       
   343 
       
   344         //Size property of the group before editting
       
   345         TInt iOldSize;
       
   346 
       
   347         //Allow search propery
       
   348         TEnumsPC::TImpsPropertyBoolPC iAllowSearch;
       
   349 
       
   350         //Allow search property before editting
       
   351         TEnumsPC::TImpsPropertyBoolPC iOldAllowSearch;
       
   352 
       
   353         //Allow whisper messages property
       
   354         TEnumsPC::TImpsPropertyBoolPC iAllowWhisper;
       
   355 
       
   356         //Allow whisper messages property before editting
       
   357         TEnumsPC::TImpsPropertyBoolPC iOldAllowWhisper;
       
   358 
       
   359         //Is group open
       
   360         TEnumsPC::TImpsPropertyBoolPC iIsOpen;
       
   361 
       
   362         //Propery of group before editting
       
   363         TEnumsPC::TImpsPropertyBoolPC iOldIsOpen;
       
   364 
       
   365         //To launch banned users list
       
   366         TInt iIsBannedUsers;
       
   367         //Flag to check for banned users list before editting
       
   368         TBool iOldIsBannedUsers;
       
   369 
       
   370         //To launch admin privileges list
       
   371         TInt iOldAdminSelected;
       
   372 
       
   373         //Flag for admin privileges list before editting
       
   374         TInt iAdminSelected;
       
   375 
       
   376         //Flag to check if the properties have been editted for a group
       
   377         TBool iIsEdited;
       
   378 
       
   379         //To launch the member acces list dialog again, after modifying it
       
   380         TBool iIsMemberAccessModified;
       
   381 
       
   382         //To launch the member admin privileges list again, after modifying it
       
   383         TBool iIsAdminStatusModified;
       
   384 
       
   385         //To launch the member banned list again, after modifying it
       
   386         TBool iIsBannedListModified;
       
   387 
       
   388         // Doesn't own. pointer to dialogs listbox.
       
   389         CAknSettingStyleListBox* iListbox;
       
   390 
       
   391         // Dialog launcher
       
   392         CIdle* iDialogLaunchCallback;
       
   393 
       
   394         //doesnt own. pointer to the app UI instance
       
   395         CCAAppUi* iAppUi;
       
   396 
       
   397         //Doesnt Own.
       
   398         MCAGroupPropertiesPC* iGroupPropertiesPC;
       
   399 
       
   400     };
       
   401 
       
   402 #endif      // CCAGROUPPROPERTIESDIALOG_H   
       
   403 
       
   404 // End of File