homesync/contentmanager/mediaservant/inc/msfillruleeditlist.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2008 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:  Definition for MediaServant fill rule editor class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_MSFILLRULEEDITLIST_H
       
    20 #define C_MSFILLRULEEDITLIST_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <aknsettingitemlist.h>
       
    24 
       
    25 #include "cmcommontypes.h"
       
    26 #include "msengineobserver.h"
       
    27 #include "msparameteragent.h"
       
    28 #include "mediaservant.hrh"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CMSAppUi;
       
    32 class CMSFillRuleEditView;
       
    33 class CCmFillRuleContainer;
       
    34 class CCmFillRule;
       
    35 class CCmMediaServerFull;
       
    36 class CSelectionItemList;
       
    37 class CMSMetadataCollector;
       
    38 class CCmSqlPropertyContainer;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43  * CMSFillRuleEditList general class. This class is used to
       
    44  * create setting items to several setting item lists.
       
    45  *
       
    46  * @since S60 5.1
       
    47  */
       
    48 NONSHARABLE_CLASS( CMSFillRuleEditList ): public CAknSettingItemList,
       
    49                            public MMSEngineObserver
       
    50     {
       
    51     // process states
       
    52     enum TMSFillStates
       
    53         {
       
    54         EMSIdle = 0,
       
    55         EMSFillPreprocess,
       
    56         EMSFetchMetadata
       
    57         };
       
    58 
       
    59     public: // Constructor and destructor
       
    60 
       
    61         /**         
       
    62          * two-phase constructor.         
       
    63          */
       
    64         static CMSFillRuleEditList* NewL( CMSAppUi& aAppUi,
       
    65                                           CMSFillRuleEditView& aView );
       
    66 
       
    67         /**
       
    68          * two-phase constructor. 
       
    69          */
       
    70         static CMSFillRuleEditList* NewLC( CMSAppUi& aAppUi,
       
    71                                           CMSFillRuleEditView& aView );
       
    72                                           
       
    73         /**
       
    74          * Destructor.
       
    75          */
       
    76         virtual ~CMSFillRuleEditList();
       
    77 
       
    78         /**
       
    79          * Opens the selected listbox item
       
    80          * @since S60 5.1
       
    81          */
       
    82         void OpenSelectedListboxItemL();
       
    83 
       
    84         /**
       
    85          * Removes rule
       
    86          * @since S60 5.1
       
    87          */
       
    88         void RemoveCurrentRuleL();
       
    89 
       
    90         /**
       
    91          * Tests if rule is additional
       
    92          * @since S60 5.1
       
    93          * @return TBool, ETrue if additional
       
    94          */
       
    95         TBool IsCurrentRuleAdditional();
       
    96 
       
    97         /**
       
    98          * List media type
       
    99          * @since S60 5.1
       
   100          * @return TCmMediaType, media type of the list
       
   101          */
       
   102         TCmMediaType ListMediaType();
       
   103 
       
   104         /**
       
   105          * List media type
       
   106          * @since S60 5.1
       
   107          * @param aName name of fill rule
       
   108          * @return TBool, whether names are same
       
   109          */
       
   110         TBool CheckSameNameL( const TDesC& aName ) const;
       
   111 
       
   112 // From base class CAknSettingItemList
       
   113 
       
   114         /**
       
   115          * From CAknSettingItemList
       
   116          * See base class definition
       
   117          */
       
   118         void ActivateL();
       
   119 
       
   120     protected:
       
   121     
       
   122 // From base class CAknSettingItemList
       
   123 
       
   124         /**
       
   125          * From CAknSettingItemList
       
   126          * See base class definition
       
   127          */
       
   128         CAknSettingItem* CreateSettingItemL( TInt aSettingId );
       
   129 
       
   130         /**
       
   131          * From CAknSettingItemList
       
   132          * See base class definition
       
   133          */
       
   134         void  HandleListBoxEventL ( CEikListBox *aListBox,
       
   135                                     TListBoxEvent aEventType);
       
   136 
       
   137         /**
       
   138          * From CAknSettingItemList
       
   139          * See base class definition
       
   140          */
       
   141         void EditItemL (TInt aIndex, TBool aCalledFromMenu);
       
   142         
       
   143 // From base class CCoeControl
       
   144 
       
   145         /**
       
   146          * From CCoeControl
       
   147          * See base class definition
       
   148          */
       
   149         void SizeChanged();
       
   150 
       
   151         /**
       
   152          * From CCoeControl
       
   153          * See base class definition
       
   154          */
       
   155         void HandleResourceChange( TInt aType );
       
   156 
       
   157         /**
       
   158          * From CCoeControl
       
   159          * See base class definition
       
   160          */
       
   161         void GetHelpContext(TCoeHelpContext& aContext) const;        
       
   162 
       
   163 // From base class MMSEngineObserver
       
   164 
       
   165         /**
       
   166          * From MMSEngineObserver
       
   167          * See base class definition
       
   168          */
       
   169         void ReadyL( TCmService aService, TInt aError );
       
   170 
       
   171     private:
       
   172 
       
   173         /**
       
   174          * Reads rules associated to the template
       
   175          * @since S60 5.1
       
   176          * @param aTemplate, Template ID
       
   177          */
       
   178         void ReadTemplateRulesL( TInt aTemplate );
       
   179 
       
   180         /**
       
   181          * Adds fill rule to the list
       
   182          * @since S60 5.1
       
   183          */
       
   184         void AddFillRuleL();
       
   185 
       
   186         /**
       
   187          * Sets default value defined by template
       
   188          * @since S60 5.1
       
   189          * @param aId, setting id
       
   190          * @param aValue, default value
       
   191          */
       
   192         void SetDefaultValue( TInt aId, TInt aValue );
       
   193 
       
   194         /**
       
   195          * Sets list type
       
   196          * @since S60 5.1
       
   197          * @param aType, command id
       
   198          */
       
   199         void SetListType( TInt aType );
       
   200 
       
   201         /**
       
   202          * Get values for the setting list
       
   203          * @since S60 5.1
       
   204          */
       
   205         void GetRuleValuesL();
       
   206 
       
   207         /**
       
   208          * Deletes rule
       
   209          * @since S60 5.1
       
   210          * @param aField, metadatafield to be deleted
       
   211          */
       
   212         void DeleteRule( TCmMetadataField aField );
       
   213 
       
   214         /**
       
   215          * Get values for the setting list
       
   216          * @since S60 5.1
       
   217          * @param aField, metadatafield to be deleted
       
   218          * @param aType, operator
       
   219          */
       
   220         void DeleteRule( TCmMetadataField aField, TCmOperatorType aType );
       
   221 
       
   222         /**
       
   223          * Adds additinal rules to fill list
       
   224          * @since S60 5.1
       
   225          * @param aArray, item array
       
   226          * @param aField, metadatafield to be added
       
   227          * @param aOperator, operator type
       
   228          */
       
   229         void AddAdditionalRuleL( CDesCArray* aArray,
       
   230                                  TCmMetadataField aField,
       
   231                                  TCmOperatorType aOperator );
       
   232 
       
   233         /**
       
   234          * Adds additinal rules to fill list
       
   235          * @since S60 5.1
       
   236          * @param aArray, item array
       
   237          * @param aField, metadatafield to be added
       
   238          * @param aOperator, operator type
       
   239          */
       
   240         void AddAdditionalRuleL( RArray<TInt>& aArray,
       
   241                                  TCmMetadataField aField,
       
   242                                  TCmOperatorType aOperator );
       
   243 
       
   244         /**
       
   245          * Adds additinal rules to fill list
       
   246          * @since S60 5.1
       
   247          * @param aArray, item array
       
   248          * @param aField, metadatafield to be added
       
   249          * @param aOperator, operator type
       
   250          */
       
   251         void AddAdditionalRuleL( TCmMetadataField aMetadataField,
       
   252                                  TCmOperatorType aOperator,
       
   253                                  TInt aValue );
       
   254 
       
   255         /**
       
   256          * Appends item to the list
       
   257          * @since S60 5.1
       
   258          * @param aArray, item array
       
   259          * @param aParam, item
       
   260          */
       
   261         void AppendItemToListL( RArray<TInt>* aArray, TInt aParam );
       
   262 
       
   263         /**
       
   264          * Sets audio file size selection
       
   265          * @since S60 5.1
       
   266          */
       
   267         void SetAudioFileSizeSelection();
       
   268 
       
   269         /**
       
   270          * Sets audio file size selection
       
   271          * @since S60 5.1
       
   272          */
       
   273         void SaveTrackFileSizeL();
       
   274 
       
   275         /**
       
   276          * Sets audio file duration selection
       
   277          * @since S60 5.1
       
   278          */
       
   279         void SetAudioFileDurationSelection();
       
   280 
       
   281         /**
       
   282          * Sets audio file size selection
       
   283          * @since S60 5.1
       
   284          */
       
   285         void SaveTrackDurationL();
       
   286 
       
   287         /**
       
   288          * Sets modified additional rules visible
       
   289          * @since S60 5.1
       
   290          */
       
   291         void DisplayModifiedAdditionalRules();
       
   292 
       
   293         /**
       
   294          * Searches item from the list be item ID
       
   295          * @since S60 5.1
       
   296          * @param aId, item id
       
   297          * @return CAknSettingItem, item pointer
       
   298          */
       
   299         CAknSettingItem* SearchItemById( TMSFillEditItems aId );
       
   300 
       
   301         /**
       
   302          * Sets shrinking status to image list
       
   303          * @since S60 5.1
       
   304          */
       
   305         void SetShrinkingStatus();
       
   306 
       
   307         /**
       
   308          * Initializes parameters
       
   309          * @since S60 5.1
       
   310          */
       
   311         void InitializeValues();
       
   312 
       
   313         /**
       
   314          * Sets navi pane text
       
   315          * @since S60 5.1
       
   316          */
       
   317         void CreateAndSetNaviPaneTextL();
       
   318 
       
   319         /**
       
   320          * Saves values to rule container
       
   321          * @since S60 5.1
       
   322          */
       
   323         void SaveValueL( CAknSettingItem* aItem );
       
   324 
       
   325         /**
       
   326          * Checks current item setting page acceptance
       
   327          * @since S60 5.1
       
   328          * @param aItem, edited item
       
   329          * @return TBool, ETrue if accepted EFalse if cancelled
       
   330          */
       
   331         TBool CheckSettingPageAcceptance( CAknSettingItem* aItem );
       
   332 
       
   333         /**
       
   334          * Constructs setting list and starts getting data from server
       
   335          * @since S60 5.1
       
   336          */
       
   337         void ConstructListAndStartDataReadingL();
       
   338 
       
   339         /**
       
   340          * Starts list preprocessing
       
   341          * @since S60 5.1
       
   342          */
       
   343         void PreprocessListL();
       
   344 
       
   345         /**
       
   346          * Saves list values from visible setting items
       
   347          * @since S60 5.1
       
   348          */
       
   349         void SaveListValuesL();
       
   350 
       
   351         /**
       
   352          * Creates selection list for server setting
       
   353          * @since S60 5.1
       
   354          */
       
   355         void CreateServerSettingListL();
       
   356 
       
   357         /**
       
   358          * Adds selected servers to rule
       
   359          * @since S60 5.1
       
   360          */
       
   361         void HandleServerSelectionL();
       
   362 
       
   363         /**
       
   364          * Deletes servers from rule
       
   365          * @since S60 5.1
       
   366          */
       
   367         void DeleteAllServersFromRuleL();
       
   368 
       
   369         /**
       
   370          * Saves and preprocesses list
       
   371          * @since S60 5.1
       
   372          * @param aItem, item to be processed
       
   373          */
       
   374         void SaveAndPreprocesslistL( CAknSettingItem* aItem );
       
   375 
       
   376         /**
       
   377          * Gets mediaservers and removes not active servers
       
   378          * @since S60 5.1
       
   379          */
       
   380         void GetServersAndCheckActivityL();
       
   381 
       
   382         /**
       
   383          * Updates multiselection setting items
       
   384          * @since S60 5.1
       
   385          */
       
   386         void UpdateSettingItemsL();
       
   387 
       
   388         /**
       
   389          * Handles list name change
       
   390          * @since S60 5.1
       
   391          * @param aItem, name setting item
       
   392          */
       
   393         void HandleListNameL( CAknSettingItem* aItem );
       
   394 
       
   395     private:
       
   396 
       
   397         /**
       
   398          * ConstructL
       
   399          * Second phase constructor.
       
   400          * @param aAppUi : application ui reference
       
   401          * @param aView : view reference
       
   402          */
       
   403         void ConstructL( CMSAppUi& aAppUi,
       
   404                          CMSFillRuleEditView& aView );
       
   405 
       
   406         /**
       
   407          * Constructor.
       
   408          */
       
   409         CMSFillRuleEditList();
       
   410 
       
   411     private:
       
   412 
       
   413         /**
       
   414          * pointer to AppUi object
       
   415          */
       
   416         CMSAppUi*                               iAppUi;         // not owned
       
   417         /**
       
   418          * amount of files
       
   419          */
       
   420         TInt                                    iAmount;
       
   421         /**
       
   422          * servers
       
   423          */
       
   424         TBuf<KMaxFileName>                      iSettingText;
       
   425         /**
       
   426          * pointer to view
       
   427          */
       
   428         CMSFillRuleEditView*                    iView;          // not owned
       
   429         /**
       
   430          * Fill rule
       
   431          */
       
   432         CCmFillRule*                            iRule;          // not owned
       
   433         /**
       
   434          * MediaServers
       
   435          */
       
   436         RPointerArray<CCmMediaServerFull>*      iServers;       //owned
       
   437         /**
       
   438          * Image shrinking
       
   439          */
       
   440         TMSShrinkImages                         iShrinkImages;
       
   441         /**
       
   442          * Starting with setting
       
   443          */
       
   444         TInt                                    iStartWith;
       
   445         /**
       
   446          * date from
       
   447          */
       
   448         TTime                                   iDateFrom;
       
   449         /**
       
   450          * date until
       
   451          */
       
   452         TTime                                   iDateUntil;
       
   453         /**
       
   454          * free text
       
   455          */
       
   456         TBuf<KMaxFileName>                      iFreeText;
       
   457         /**
       
   458          * list name
       
   459          */
       
   460         TBuf<KMaxFileName>                      iListName;
       
   461         /**
       
   462          * rule template
       
   463          */
       
   464         TMSTemplate                             iRuleTemplate;
       
   465         /**
       
   466          * array of visible rules
       
   467          */
       
   468         RArray<TMSFillEditItems>                iVisibleRules;
       
   469         /**
       
   470          * limit type (pieces or MBs )
       
   471          */
       
   472         TCmLimitType                            iLimitType;
       
   473         /**
       
   474          * Dummy text buffer for "Add more rules"
       
   475          */
       
   476         TBuf<10>                                iDummyText;
       
   477         /**
       
   478          * Track lenght
       
   479          */
       
   480         TInt                                    iTrackLengthEnum;
       
   481         /**
       
   482          * Track lenght
       
   483          */
       
   484         TInt                                    iMinTrackLength;
       
   485         /**
       
   486          * Track lenght
       
   487          */
       
   488         TInt                                    iMaxTrackLength;
       
   489         /**
       
   490          * File size
       
   491          */
       
   492         TInt                                    iFileSize;
       
   493         /**
       
   494          * File size enumeration
       
   495          */
       
   496         TInt                                    iFileSizeEnum;
       
   497         /**
       
   498          * Min file size
       
   499          */
       
   500         TInt                                    iMinFileSize;
       
   501         /**
       
   502          * Min file size set
       
   503          */
       
   504         TInt                                    iMinFileSizeSet;
       
   505         /**
       
   506          * Max file size
       
   507          */
       
   508         TInt                                    iMaxFileSize;
       
   509         /**
       
   510          * Max file size set
       
   511          */
       
   512         TInt                                    iMaxFileSizeSet;
       
   513         /**
       
   514          * Previously selected rule identifier
       
   515          */
       
   516         TInt                                    iPreviousRuleIdentifier;
       
   517         /**
       
   518          * array of metadata video titles
       
   519          */
       
   520         CCmSqlPropertyContainer*                iMetadataTitles;    //owned
       
   521         /**
       
   522          * Selected video title array
       
   523          */
       
   524         RArray<TInt>                            iVideoTitleArray;   //owned
       
   525         /**
       
   526          * Selected artist array
       
   527          */
       
   528         RArray<TInt>                            iArtistArray;       //owned
       
   529         /**
       
   530          * Selected genre array
       
   531          */
       
   532         RArray<TInt>                            iGenreArray;        //owned
       
   533         /**
       
   534          * Selected album array
       
   535          */
       
   536         RArray<TInt>                            iAlbumArray;        //owned
       
   537         /**
       
   538          * Selected track array
       
   539          */
       
   540         RArray<TInt>                            iTrackArray;        //owned
       
   541         /**
       
   542          * List media type
       
   543          */
       
   544         TCmMediaType                            iMediaType;
       
   545         /**
       
   546          * New list indicator
       
   547          */
       
   548         TBool                                   iNewList;
       
   549         /**
       
   550          * Metadata request state
       
   551          */
       
   552         TMSFillStates                           iState;
       
   553         /**
       
   554          * Selected list index from CMSFillView
       
   555          */
       
   556         TInt                                    iSelectedList;
       
   557         /**
       
   558          * setting page item array (servers)
       
   559          */
       
   560         CSelectionItemList*                     iServerArray;       // owned
       
   561         /**
       
   562          * metadata collector
       
   563          */
       
   564         CMSMetadataCollector*                   iMetadataCollector; // owned
       
   565     };
       
   566 
       
   567 #endif // C_MSFILLRULEEDITLIST_H
       
   568 
       
   569 // End of File