idlefw/plugins/shortcutplugin/inc/caiscuttargetbkm.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     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 bookmark shortcut target.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAISCUTTARGETBKM_H
       
    20 #define CAISCUTTARGETBKM_H
       
    21 
       
    22 #include "caiscuttarget.h"
       
    23 
       
    24 /**
       
    25  *  Implements an bookmark shortcut target
       
    26  *
       
    27  *  Handles parsing and launching an bookmark shortcut target
       
    28  *
       
    29  *  @since S60 v3.2
       
    30  */
       
    31 class CAiScutTargetBkm : public CAiScutTarget
       
    32 {
       
    33 
       
    34 public:
       
    35 
       
    36     /**
       
    37      * First phase constructor
       
    38      *
       
    39      * @since S60 v3.2
       
    40      * @param aEngine Reference to the plug-in engine
       
    41      * @param aParser Shortcut definition parser
       
    42      */
       
    43     static CAiScutTargetBkm* NewL(
       
    44         CAiScutEngine& aEngine, TShortcutType aType, const TAiScutParser& aParser);
       
    45 
       
    46     virtual ~CAiScutTargetBkm();
       
    47 
       
    48     /**
       
    49      * Returns the shortcut definition string
       
    50      *
       
    51      * @since S60 v3.2
       
    52      * @return Shortcut definition string
       
    53      */
       
    54     TPtrC Definition() const;
       
    55 
       
    56     /**
       
    57      * Returns the shortcut target caption.
       
    58      * Caption can be either a descriptor or a resource id.
       
    59      * If the return value has a non-zero value, it is the resource id.
       
    60      * Zero indicates that the descriptor reference parameter is used.
       
    61      * Default implementation returns KErrNotSupported;
       
    62      *
       
    63      * Getting the target caption and icon utilizes the "lazy evaluation" idiom
       
    64      * which means they are created only when they are first needed. This is because
       
    65      * there are (atleast) two scenarios where they are never needed:
       
    66      * 1. The active theme does not support shortcut captions or icons.
       
    67      * 2. Shortcuts launched using LaunchByValue are never published.
       
    68      *
       
    69      * @since S60 v3.2
       
    70      * @param aDes On return, the descriptor if used
       
    71      * @return The resource id or zero to indicate that the descriptor is used.
       
    72      */
       
    73     TInt GetCaption(TPtrC& aDes, TAiScutAppTitleType aTitleType) const;
       
    74 
       
    75     /**
       
    76      * Returns the shortcut target icon.
       
    77      * Icon can be either an icon pointer or a resource id.
       
    78      * If the return value has a non-zero value, it is the resource id.
       
    79      * Zero indicates that the icon pointer is used.
       
    80      * Default implementation returns KErrNotSupported;
       
    81      *
       
    82      * Uses the "lazy evaluation" idiom to get the icon. See Caption()
       
    83      *
       
    84      * @since S60 v3.2
       
    85      * @param aIcon On return, the icon pointer if used
       
    86      * @return The resource id or zero to indicate that the icon pointer is used.
       
    87      */
       
    88     TInt GetIcon(CGulIcon*& aIcon) const;
       
    89 
       
    90     /**
       
    91      * Checks if the shortcut target is accessible
       
    92      *
       
    93      * @since S60 v3.2
       
    94      * @param aCheckType Specifies which kind of shortcuts should check its access
       
    95      * @return ETrue if accessible, EFalse if not
       
    96      */
       
    97     TBool IsAccessibleL(TInt aCheckType);
       
    98 
       
    99     /**
       
   100      * Launches the shortcut
       
   101      *
       
   102      * @since S60 v3.2
       
   103      */
       
   104     void LaunchL();
       
   105 
       
   106     /**
       
   107      * Return application uid this target launches.
       
   108      *
       
   109      * @since S60 v3.2
       
   110      */
       
   111     TUid AppUid() const;
       
   112     
       
   113     /**
       
   114      * Return an additional id this target may use when 
       
   115      * launching. Default implementation return TUid(-1)
       
   116      *
       
   117      * @since S60 v3.2
       
   118      */
       
   119     TUid AdditionalUid() const;
       
   120 
       
   121 protected:
       
   122 
       
   123 private:
       
   124 
       
   125     CAiScutTargetBkm(CAiScutEngine& aEngine, TShortcutType aType);
       
   126 
       
   127     void ConstructL(const TAiScutParser& aParser);
       
   128 
       
   129     /**
       
   130      *
       
   131      */
       
   132     void GetCaptionL() const;
       
   133 
       
   134 private:  // data
       
   135 
       
   136     /**
       
   137      * Bookmark uid.
       
   138      */
       
   139     TUid                iBkmUid;
       
   140 
       
   141     /**
       
   142      * Shortcut caption.
       
   143      * Own.
       
   144      */
       
   145     mutable HBufC*      iCaption;
       
   146 
       
   147     /**
       
   148      * Holds the shortcut definition string.
       
   149      * Own.
       
   150      */
       
   151     HBufC*              iDefinition;
       
   152 
       
   153 };
       
   154 
       
   155 #endif // CAISCUTTARGETAPP_H
       
   156 
       
   157 // End of File.