ipsservices/nmpopclientplugin/src/nmpopclientplugin.cpp
changeset 38 b4618f2cf6ac
parent 23 2dc6caa42ec3
child 39 b0b89ca206b5
equal deleted inserted replaced
23:2dc6caa42ec3 38:b4618f2cf6ac
    32 /*!
    32 /*!
    33     Constructs a new NmPopClientPlugin.
    33     Constructs a new NmPopClientPlugin.
    34  */
    34  */
    35 NmPopClientPlugin::NmPopClientPlugin()
    35 NmPopClientPlugin::NmPopClientPlugin()
    36 : mSettingsViewLauncher(NULL),
    36 : mSettingsViewLauncher(NULL),
       
    37 mUiEngine(NULL),
    37 mListOptionsMenuRequest(NULL)
    38 mListOptionsMenuRequest(NULL)
    38 {
    39 {
    39     NMLOG("NmPopClientPlugin::NmPopClientPlugin()-->");
    40     NMLOG("NmPopClientPlugin::NmPopClientPlugin()-->");
       
    41     mUiEngine = NmUiEngine::instance();
    40     NMLOG("<--NmPopClientPlugin::NmPopClientPlugin()");
    42     NMLOG("<--NmPopClientPlugin::NmPopClientPlugin()");
    41 }
    43 }
    42 
    44 
    43 /*!
    45 /*!
    44     Destructor.
    46     Destructor.
    72     ) {
    74     ) {
    73         NMLOG("NmPopClientPlugin::getActions(): PluginId incorrect.");
    75         NMLOG("NmPopClientPlugin::getActions(): PluginId incorrect.");
    74         NMLOG(QString("request.mailboxId().pluginId32()=%1").arg(request.mailboxId().pluginId32()));
    76         NMLOG(QString("request.mailboxId().pluginId32()=%1").arg(request.mailboxId().pluginId32()));
    75         return;
    77         return;
    76     }
    78     }
    77 
    79     
    78     // Get the NmBaseClientPlugin implementation of the UI actions.
    80     // Get the NmBaseClientPlugin implementation of the UI actions.
    79     NmBaseClientPlugin::getActions(request, actionList);
    81     NmBaseClientPlugin::getActions(request, actionList);
    80 
    82     
    81     // Append POP plugin specific actions
    83     // Append POP plugin specific actions
    82     switch (request.menuType()) {
    84     switch (request.menuType()) {
    83     case NmActionOptionsMenu:
    85     case NmActionOptionsMenu:
    84         {
    86         {      
    85         if (request.contextView()==NmActionContextViewMessageList){
    87         if (request.contextView()==NmActionContextViewMessageList){
    86             mListOptionsMenuRequest = request;
    88             mListOptionsMenuRequest = request;
    87             // Create sub-menu for standard folders selection
    89             // Create sub-menu for standard folders selection
    88             HbMenu *standardFolders = new HbMenu();
    90             HbMenu *standardFolders = new HbMenu();
    89             NmAction *inboxAction = new NmAction(0);
    91             NmAction *inboxAction = new NmAction(0);            
    90             inboxAction->setObjectName("popclientplugin_folders_inbox");
    92             inboxAction->setObjectName("popclientplugin_folders_inbox");
    91             inboxAction->setText(hbTrId("txt_mail_opt_folders_inbox"));
    93             inboxAction->setText(hbTrId("txt_mail_opt_folders_inbox"));
    92             inboxAction->setCheckable(true);
    94             inboxAction->setCheckable(true);
    93             connect(inboxAction, SIGNAL(triggered()), this, SLOT(switchToStandardFolderInbox()));
    95             connect(inboxAction, SIGNAL(triggered()), this, SLOT(switchToStandardFolderInbox()));
    94             standardFolders->addAction(inboxAction);
    96             standardFolders->addAction(inboxAction);           
    95             NmAction *outboxAction = new NmAction(0);
    97             NmAction *outboxAction = new NmAction(0);
    96             outboxAction->setObjectName("popclientplugin_folders_outbox");
    98             outboxAction->setObjectName("popclientplugin_folders_outbox");
    97             outboxAction->setText(hbTrId("txt_mail_opt_folders_outbox"));
    99             outboxAction->setText(hbTrId("txt_mail_opt_folders_outbox"));
    98             outboxAction->setCheckable(true);
   100             outboxAction->setCheckable(true);
    99             connect(outboxAction, SIGNAL(triggered()), this, SLOT(switchToStandardFolderOutbox()));
   101             connect(outboxAction, SIGNAL(triggered()), this, SLOT(switchToStandardFolderOutbox()));
   107             NmAction *sentAction = new NmAction(0);
   109             NmAction *sentAction = new NmAction(0);
   108             sentAction->setObjectName("popclientplugin_folders_sent");
   110             sentAction->setObjectName("popclientplugin_folders_sent");
   109             sentAction->setText(hbTrId("txt_mail_opt_folders_sent"));
   111             sentAction->setText(hbTrId("txt_mail_opt_folders_sent"));
   110             sentAction->setCheckable(true);
   112             sentAction->setCheckable(true);
   111             connect(sentAction, SIGNAL(triggered()), this, SLOT(switchToStandardFolderSent()));
   113             connect(sentAction, SIGNAL(triggered()), this, SLOT(switchToStandardFolderSent()));
   112             standardFolders->addAction(sentAction);
   114             standardFolders->addAction(sentAction);          
   113             // Set active action
   115             // Set active action
   114             NmFolderType curFolderType(NmFolderOther);
   116             NmFolderType curFolderType(NmFolderOther);
   115             if (mUiEngine) {
   117             if (mUiEngine) {
   116                 curFolderType = mUiEngine->folderTypeById(request.mailboxId(),request.folderId());
   118             curFolderType = mUiEngine->folderTypeById(request.mailboxId(),request.folderId());   
   117             }
   119             } 
   118             switch (curFolderType){
   120             switch (curFolderType){
   119                 case NmFolderInbox: {
   121                 case NmFolderInbox: {
   120                     inboxAction->setChecked(true);
   122                     inboxAction->setChecked(true);
   121                     break;
   123                     break;
   122                 }
   124                 }
   123                 case NmFolderOutbox: {
   125                 case NmFolderOutbox: {
   124                     outboxAction->setChecked(true);
   126                     outboxAction->setChecked(true);
   125                     break;
   127                     break;
   126                 }
   128                 } 
   127                 case NmFolderDrafts: {
   129                 case NmFolderDrafts: {
   128                     draftsAction->setChecked(true);
   130                     draftsAction->setChecked(true);
   129                     break;
   131                     break;
   130                 }
   132                 }
   131                 case NmFolderSent: {
   133                 case NmFolderSent: {
   132                     sentAction->setChecked(true);
   134                     sentAction->setChecked(true);
   133                     break;
   135                     break;
   134                 }
   136                 }
   135             }
   137             }
   136 
   138             
   137             // Add folders selection with sub-menu
   139             // Add folders selection with sub-menu
   138             NmAction *foldersAction = new NmAction(0);
   140             NmAction *foldersAction = new NmAction(0); 
   139             foldersAction->setObjectName("baseclientplugin_folders");
   141             foldersAction->setObjectName("baseclientplugin_folders");
   140             foldersAction->setText(hbTrId("txt_mail_opt_folders"));
   142             foldersAction->setText(hbTrId("txt_mail_opt_folders"));
   141             foldersAction->setMenu(standardFolders);
   143             foldersAction->setMenu(standardFolders);
   142             actionList.append(foldersAction);
   144             actionList.append(foldersAction);        
   143             }
   145             }
   144         }
   146         }
   145         break;
   147         break;
   146     default:
   148     default:
   147         break;
   149         break;
   148     }
   150     }     
   149 
   151     
   150     NMLOG("<--NmPopClientPlugin::getActions()");
   152     NMLOG("<--NmPopClientPlugin::getActions()");
   151 }
   153 }
   152 
   154 
   153 /*!
   155 /*!
   154     Slot connected to options menu settings NmAction.
   156     Slot connected to options menu settings NmAction.
   182                 this, SLOT(goOffline(const NmId &)));
   184                 this, SLOT(goOffline(const NmId &)));
   183         }
   185         }
   184 
   186 
   185         mSettingsViewLauncher->launchSettingsView(id, mailbox->name());
   187         mSettingsViewLauncher->launchSettingsView(id, mailbox->name());
   186     }
   188     }
   187 
   189  
   188     NMLOG("<--NmPopClientPlugin::settings()");
   190     NMLOG("<--NmPopClientPlugin::settings()");
   189 }
   191 }
   190 
   192 
   191 /*!
   193 /*!
   192     Private slot to switch message list contents
   194     Private slot to switch message list contents 
   193     to standard folder inbox
   195     to standard folder inbox
   194 */
   196 */
   195 void NmPopClientPlugin::switchToStandardFolderInbox()
   197 void NmPopClientPlugin::switchToStandardFolderInbox()
   196 {
   198 {
   197     if (mListOptionsMenuRequest.observer()){
   199     if (mListOptionsMenuRequest.observer()){
   198         NmId folderId=mUiEngine->standardFolderId(mListOptionsMenuRequest.mailboxId(),NmFolderInbox);
   200         NmId folderId=mUiEngine->standardFolderId(mListOptionsMenuRequest.mailboxId(),NmFolderInbox);
   199         NmActionResponse response(NmActionResponseCommandSwitchFolder, NmActionOptionsMenu,
   201         NmActionResponse response(NmActionResponseCommandSwitchFolder, NmActionOptionsMenu,
   200                                   NmActionContextViewNone, mListOptionsMenuRequest.mailboxId(),
   202                                   NmActionContextViewNone, mListOptionsMenuRequest.mailboxId(),
   201                                   folderId);
   203                                   folderId); 
   202         mListOptionsMenuRequest.observer()->handleActionCommand(response);
   204         mListOptionsMenuRequest.observer()->handleActionCommand(response);
   203     }
   205     }
   204 }
   206 }
   205 
   207 
   206 /*!
   208 /*!
   207     Private slot to switch message list contents
   209     Private slot to switch message list contents 
   208     to standard folder outbox
   210     to standard folder outbox
   209 */
   211 */
   210 void NmPopClientPlugin::switchToStandardFolderOutbox()
   212 void NmPopClientPlugin::switchToStandardFolderOutbox()
   211 {
   213 {
   212     if (mListOptionsMenuRequest.observer()){
   214     if (mListOptionsMenuRequest.observer()){
   213         NmId folderId=mUiEngine->standardFolderId(mListOptionsMenuRequest.mailboxId(),NmFolderOutbox);
   215         NmId folderId=mUiEngine->standardFolderId(mListOptionsMenuRequest.mailboxId(),NmFolderOutbox);
   214         NmActionResponse response(NmActionResponseCommandSwitchFolder, NmActionOptionsMenu,
   216         NmActionResponse response(NmActionResponseCommandSwitchFolder, NmActionOptionsMenu,
   215                                   NmActionContextViewNone, mListOptionsMenuRequest.mailboxId(),
   217                                   NmActionContextViewNone, mListOptionsMenuRequest.mailboxId(),
   216                                   folderId);
   218                                   folderId); 
   217         mListOptionsMenuRequest.observer()->handleActionCommand(response);
   219         mListOptionsMenuRequest.observer()->handleActionCommand(response);
   218     }
   220     }   
   219 }
   221 }
   220 
   222 
   221 /*!
   223 /*!
   222     Private slot to switch message list contents
   224     Private slot to switch message list contents 
   223     to standard folder drafts
   225     to standard folder drafts
   224 */
   226 */
   225 void NmPopClientPlugin::switchToStandardFolderDrafts()
   227 void NmPopClientPlugin::switchToStandardFolderDrafts()
   226 {
   228 {
   227     if (mListOptionsMenuRequest.observer()){
   229     if (mListOptionsMenuRequest.observer()){
   228         NmId folderId=mUiEngine->standardFolderId(mListOptionsMenuRequest.mailboxId(),NmFolderDrafts);
   230         NmId folderId=mUiEngine->standardFolderId(mListOptionsMenuRequest.mailboxId(),NmFolderDrafts);
   229         NmActionResponse response(NmActionResponseCommandSwitchFolder, NmActionOptionsMenu,
   231         NmActionResponse response(NmActionResponseCommandSwitchFolder, NmActionOptionsMenu,
   230                                   NmActionContextViewNone, mListOptionsMenuRequest.mailboxId(),
   232                                   NmActionContextViewNone, mListOptionsMenuRequest.mailboxId(),
   231                                   folderId);
   233                                   folderId); 
   232         mListOptionsMenuRequest.observer()->handleActionCommand(response);
   234         mListOptionsMenuRequest.observer()->handleActionCommand(response);
   233     }
   235     }
   234 }
   236 }
   235 
   237 
   236 /*!
   238 /*!
   237     Private slot to switch message list contents
   239     Private slot to switch message list contents 
   238     to standard folder sent
   240     to standard folder sent
   239 */
   241 */
   240 void NmPopClientPlugin::switchToStandardFolderSent()
   242 void NmPopClientPlugin::switchToStandardFolderSent()
   241 {
   243 {
   242     if (mListOptionsMenuRequest.observer()){
   244     if (mListOptionsMenuRequest.observer()){
   243         NmId folderId=mUiEngine->standardFolderId(mListOptionsMenuRequest.mailboxId(),NmFolderSent);
   245         NmId folderId=mUiEngine->standardFolderId(mListOptionsMenuRequest.mailboxId(),NmFolderSent);
   244         NmActionResponse response(NmActionResponseCommandSwitchFolder, NmActionOptionsMenu,
   246         NmActionResponse response(NmActionResponseCommandSwitchFolder, NmActionOptionsMenu,
   245                                   NmActionContextViewNone, mListOptionsMenuRequest.mailboxId(),
   247                                   NmActionContextViewNone, mListOptionsMenuRequest.mailboxId(),
   246                                   folderId);
   248                                   folderId); 
   247         mListOptionsMenuRequest.observer()->handleActionCommand(response);
   249         mListOptionsMenuRequest.observer()->handleActionCommand(response);
   248     }
   250     }
   249 }
   251 }
   250 
   252 
   251 /*!
   253 /*!