idlefw/plugins/shortcutplugin/inc/caiscutsettingsitem.h
branchRCL_3
changeset 9 d0529222e3f0
parent 4 1a2a00e78665
child 10 5ef93ea513cb
child 18 bd874ee5e5e2
equal deleted inserted replaced
4:1a2a00e78665 9:d0529222e3f0
     1 /*
       
     2 * Copyright (c) 2005-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:  Class for shortcut setting items.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAISCUTSETTINGSITEM_H
       
    20 #define CAISCUTSETTINGSITEM_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "aiscutsettings.hrh"
       
    24 
       
    25 class CAiScutSettingsModel;
       
    26 class CRepository;
       
    27 
       
    28 /**
       
    29  * Line format for the settings list box
       
    30  */
       
    31 _LIT(KSettingListboxLineFormat, " \t%S\t\t%S");
       
    32 
       
    33 /**
       
    34  * Implements a shortcut setting item
       
    35  *
       
    36  * @since S60 v3.2
       
    37  */
       
    38 class CAiScutSettingsItem : public CBase
       
    39 {
       
    40 
       
    41 public:
       
    42 
       
    43     /**
       
    44      * Constructs a new settings item leaving it on the cleanup stack
       
    45      *
       
    46      * @since S60 v3.2
       
    47      * @param aModel Reference to the plug-in model
       
    48      * @param aIndex Index of the setting in the setting list
       
    49      * @param aKey Setting item key
       
    50      * @param aValue Setting item value
       
    51      */
       
    52     static CAiScutSettingsItem* NewLC(
       
    53         CAiScutSettingsModel&   aModel,
       
    54         TInt                    aIndex,
       
    55         TUint32                 aKey);
       
    56 
       
    57     static CAiScutSettingsItem* NewLC(
       
    58         CAiScutSettingsModel&   aModel,
       
    59         TInt                    aIndex,
       
    60         TUint32                 aKey,
       
    61         const TDesC&            aValue);
       
    62 
       
    63     /**
       
    64      * Get item value from CRepository
       
    65      */
       
    66     void ReadL(CRepository* aRepository);
       
    67 
       
    68     /**
       
    69      * set item value into CRepository
       
    70      */
       
    71     TInt Save(CRepository* aRepository);
       
    72 
       
    73     /**
       
    74      *
       
    75      */
       
    76     virtual ~CAiScutSettingsItem();
       
    77 
       
    78     /**
       
    79      * Returns the setting item key
       
    80      *
       
    81      * @since S60 v3.2
       
    82      * @return Setting item key
       
    83      */
       
    84     inline TUint32 Key() const;
       
    85 
       
    86     /**
       
    87      * Returns the target shortcut uid
       
    88      *
       
    89      * @since S60 v3.2
       
    90      * @return Target shortcut uid
       
    91      */
       
    92     inline TUid Uid() const;
       
    93 
       
    94     /**
       
    95      * Returns the setting item type
       
    96      *
       
    97      * @since S60 v3.2
       
    98      * @return Setting item type
       
    99      */
       
   100     inline TAiScutSettingType Type() const;
       
   101 
       
   102     /**
       
   103      * Returns the setting item value
       
   104      *
       
   105      * @since S60 v3.2
       
   106      * @return Setting item value
       
   107      */
       
   108     TPtrC Value() const;
       
   109 
       
   110     /**
       
   111      * Returns the formatted listbox line descriptor
       
   112      *
       
   113      * @since S60 v3.2
       
   114      * @return Listbox line descriptor
       
   115      */
       
   116      TPtrC ListBoxLine() const;
       
   117 
       
   118     /**
       
   119      * Returns the setting item title
       
   120      *
       
   121      * @since S60 v3.2
       
   122      * @return setting item title
       
   123      */
       
   124     inline TPtrC Title() const;
       
   125 
       
   126     /**
       
   127      * Changes the setting item target application.
       
   128      * Can be used to change the setting item type to application setting
       
   129      *
       
   130      * @since S60 v3.2
       
   131      * @param aUid Target application uid
       
   132      * @param aParams Target application parameters, if any
       
   133      * @param aCaption Target application caption
       
   134      */
       
   135     void ChangeApplicationL(TUid aUid, const TDesC& aParams, const TDesC& aCaption);
       
   136 
       
   137     /**
       
   138      * Changes the setting item target bookmark.
       
   139      * Can be used to change the setting item type to bookmark setting
       
   140      *
       
   141      * @since S60 v3.2
       
   142      * @param aParams Target bookmark parameters
       
   143      * @param aCaption Target bookmark caption
       
   144      */
       
   145     void ChangeBookmarkL(const TDesC& aParams, const TDesC& aCaption);
       
   146 
       
   147     /**
       
   148      * Changes the setting item target url
       
   149      * Can be used to change the setting item type to an url setting
       
   150      *
       
   151      * @since S60 v3.2
       
   152      * @param aUrl Target url
       
   153      */
       
   154     void ChangeUrlL(const TDesC& aUrl);
       
   155 
       
   156 private:
       
   157 
       
   158     /**
       
   159      *
       
   160      */
       
   161     CAiScutSettingsItem(
       
   162         CAiScutSettingsModel&   aModel,
       
   163         TInt                    aIndex,
       
   164         TUint32                 aKey);
       
   165 
       
   166     /**
       
   167      *
       
   168      */
       
   169     void ConstructL();
       
   170 
       
   171     /**
       
   172      *
       
   173      */
       
   174     void ConstructL(const TDesC& aValue);
       
   175 
       
   176     /**
       
   177      *
       
   178      */
       
   179     TInt ParseValueL(const TDesC& aValue);
       
   180 
       
   181     /**
       
   182      * Creates a formatted listbox line
       
   183      *
       
   184      * @since S60 v3.2
       
   185      * @param aCaption Caption to use in the listbox line
       
   186      */
       
   187     void CreateListBoxLineL(const TDesC& aCaption);
       
   188 
       
   189     /**
       
   190      * Creates a setting item title
       
   191      * Leaves the created descriptor on cleanup stack
       
   192      *
       
   193      * @since S60 v3.2
       
   194      * @return Key title
       
   195      */
       
   196     HBufC* CreateItemTitleLC();
       
   197 
       
   198     /**
       
   199      * Creates a key title for an optionally visible shortcut.
       
   200      * Leaves the created descriptor on cleanup stack
       
   201      *
       
   202      * @since S60 v3.2
       
   203      * @return Key title
       
   204      */
       
   205     HBufC* CreateOptionallyVisibleKeyTitleLC();
       
   206 
       
   207     /**
       
   208      * Creates a key title for a non-visible shortcut.
       
   209      * Leaves the created descriptor on cleanup stack
       
   210      *
       
   211      * @since S60 v3.2
       
   212      * @return Key title
       
   213      */
       
   214     //    HBufC* CreateNonVisibleKeyTitleLC();
       
   215 
       
   216 protected:  // data
       
   217 
       
   218     /**
       
   219      * Reference to the plug-in model
       
   220      */
       
   221     CAiScutSettingsModel&   iModel;
       
   222 
       
   223     /**
       
   224      * Setting item index in the setting list
       
   225      */
       
   226     TInt                    iIndex;
       
   227 
       
   228     /**
       
   229      * Setting item key
       
   230      */
       
   231     TUint32                 iKey;
       
   232 
       
   233     /**
       
   234      * Setting item value
       
   235      * Own.
       
   236      */
       
   237     HBufC*                  iValue;
       
   238 
       
   239     /**
       
   240      * Target application uid
       
   241      */
       
   242     TUid                    iUid;
       
   243 
       
   244     /**
       
   245      * Setting item type
       
   246      */
       
   247     TAiScutSettingType      iType;
       
   248 
       
   249     /**
       
   250      * Formatted listbox line
       
   251      * Own.
       
   252      */
       
   253     HBufC*                  iListBoxLine;
       
   254 
       
   255     /**
       
   256      * Setting item title. Points to the iListBoxLine buffer
       
   257      */
       
   258     TPtrC                   iTitle;
       
   259 
       
   260 };
       
   261 
       
   262 #include "caiscutsettingsitem.inl"
       
   263 
       
   264 #endif // CAISCUTSETTINGSITEM_H
       
   265 
       
   266 // End of File.