javauis/lcdui_akn/lcdui/src/CMIDCommandList.cpp
changeset 23 98ccebc37403
parent 21 2a9601315dfc
child 46 4376525cdefb
equal deleted inserted replaced
21:2a9601315dfc 23:98ccebc37403
   130   unless the command has already been mapped to a sk
   130   unless the command has already been mapped to a sk
   131    - commands are in priority order so the first one
   131    - commands are in priority order so the first one
   132   of a particular type that we find will be the highest priority
   132   of a particular type that we find will be the highest priority
   133   command of that type.
   133   command of that type.
   134 */
   134 */
   135 TInt CMIDCommandList::HighestNonMappedPriorityCommand(MMIDCommand::TCommandType aType) const
   135 TInt CMIDCommandList::HighestNonMappedPriorityCommand(
       
   136         MMIDCommand::TCommandType aType, TBool aIgnoreForImplicitList) const
   136 {
   137 {
   137     TInt numCommands = Count();
   138     TInt numCommands = Count();
   138     for (TInt i = 0; i < numCommands; i++)
   139     for (TInt i = 0; i < numCommands; i++)
   139     {
   140     {
   140         CMIDCommand* cmd = At(i).iCommand;
   141         CMIDCommand* cmd = At(i).iCommand;
   141         if ((cmd->CommandType() == aType) && !cmd->IsMappedToSoftKey())
   142         // In case of IMPLICIT List without highlight, nor OK
       
   143         // neither ITEM commands are mapped to soft keys.
       
   144         TBool ignore = aIgnoreForImplicitList 
       
   145                 && (cmd->CommandType() == MMIDCommand::EOk 
       
   146                     || cmd->CommandType() == MMIDCommand::EItem);
       
   147         if ((cmd->CommandType() == aType) && !cmd->IsMappedToSoftKey() 
       
   148                 && !ignore)
   142         {
   149         {
   143             return i;
   150             return i;
   144         }
   151         }
   145     }
   152     }
   146 
   153 
   149 
   156 
   150 /**
   157 /**
   151     Given a softkey, return the index of the highest priority command
   158     Given a softkey, return the index of the highest priority command
   152     that is allowed for this softkey.
   159     that is allowed for this softkey.
   153  */
   160  */
   154 TInt CMIDCommandList::FindCommandForSoftKey(const CMIDSoftKey& aSoftKey) const
   161 TInt CMIDCommandList::FindCommandForSoftKey(const CMIDSoftKey& aSoftKey,
       
   162         TBool aIgnoreForImplicitList) const
   155 {
   163 {
   156     TInt numTypes = aSoftKey.AllowedCommandTypes().Count();
   164     TInt numTypes = aSoftKey.AllowedCommandTypes().Count();
   157     for (TInt i = 0; i < numTypes; i++)
   165     for (TInt i = 0; i < numTypes; i++)
   158     {
   166     {
   159         TInt index = HighestNonMappedPriorityCommand(aSoftKey.AllowedCommandTypes()[i]);
   167         TInt index = HighestNonMappedPriorityCommand(
       
   168                 aSoftKey.AllowedCommandTypes()[i], aIgnoreForImplicitList);
   160         if (index != KErrNotFound)
   169         if (index != KErrNotFound)
   161         {
   170         {
   162             return index;
   171             return index;
   163         }
   172         }
   164     }
   173     }