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