javauis/lcdui_akn/lcdui/src/CMIDCommandList.cpp
branchRCL_3
changeset 46 4376525cdefb
parent 24 0fd27995241b
equal deleted inserted replaced
34:71c436fe3ce0 46:4376525cdefb
   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(
   135 TInt CMIDCommandList::HighestNonMappedPriorityCommand(
   136         MMIDCommand::TCommandType aType, TBool aIgnoreForImplicitList) const
   136     MMIDCommand::TCommandType aType, TBool aIgnoreForImplicitList) const
   137 {
   137 {
   138     TInt numCommands = Count();
   138     TInt numCommands = Count();
   139     for (TInt i = 0; i < numCommands; i++)
   139     for (TInt i = 0; i < numCommands; i++)
   140     {
   140     {
   141         CMIDCommand* cmd = At(i).iCommand;
   141         CMIDCommand* cmd = At(i).iCommand;
   142         // In case of IMPLICIT List without highlight, nor OK
   142         // In case of IMPLICIT List without highlight, nor OK
   143         // neither ITEM commands are mapped to soft keys.
   143         // neither ITEM commands are mapped to soft keys.
   144         TBool ignore = aIgnoreForImplicitList 
   144         TBool ignore = aIgnoreForImplicitList
   145                 && (cmd->CommandType() == MMIDCommand::EOk 
   145                        && (cmd->CommandType() == MMIDCommand::EOk
   146                     || cmd->CommandType() == MMIDCommand::EItem);
   146                            || cmd->CommandType() == MMIDCommand::EItem);
   147         if ((cmd->CommandType() == aType) && !cmd->IsMappedToSoftKey() 
   147         if ((cmd->CommandType() == aType) && !cmd->IsMappedToSoftKey()
   148                 && !ignore)
   148                 && !ignore)
   149         {
   149         {
   150             return i;
   150             return i;
   151         }
   151         }
   152     }
   152     }
   163 {
   163 {
   164     TInt numTypes = aSoftKey.AllowedCommandTypes().Count();
   164     TInt numTypes = aSoftKey.AllowedCommandTypes().Count();
   165     for (TInt i = 0; i < numTypes; i++)
   165     for (TInt i = 0; i < numTypes; i++)
   166     {
   166     {
   167         TInt index = HighestNonMappedPriorityCommand(
   167         TInt index = HighestNonMappedPriorityCommand(
   168                 aSoftKey.AllowedCommandTypes()[i], aIgnoreForImplicitList);
   168                          aSoftKey.AllowedCommandTypes()[i], aIgnoreForImplicitList);
   169         if (index != KErrNotFound)
   169         if (index != KErrNotFound)
   170         {
   170         {
   171             return index;
   171             return index;
   172         }
   172         }
   173     }
   173     }