summaryrefslogtreecommitdiffstats
path: root/examples/qtmail/app/emailclient.cpp
diff options
context:
space:
mode:
authorValerio Valerio <valerio.valerio@nokia.com>2012-01-27 14:10:03 +0200
committerValerio Valerio <valerio.valerio@nokia.com>2012-01-27 14:10:03 +0200
commit21d7582f2c4ab456258b89776f82ac1c4391ee00 (patch)
tree2f82eefd8fd4b3f115695b0cfb42648fa3b35bba /examples/qtmail/app/emailclient.cpp
parent0aa63fdba06c032ab2ef40cee14e8e4860dcc6f8 (diff)
Add service action to find and create standard folders.
void QMailRetrievalAction::createStandardFolders(const QMailAccountId &accountId) Requests that the message server create the standard folders for the account accountId. If all standard folders are already set in the storage the service action will return success immediately, in case some standard folders are not set, a matching attempt against a predefined list of translations will be made, if the folders can't be matched, messageserver will try to create them in the server side and match them if the creation is successful. In case folder creation is not allowed for the account accountId the service action will return.
Diffstat (limited to 'examples/qtmail/app/emailclient.cpp')
-rw-r--r--examples/qtmail/app/emailclient.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/qtmail/app/emailclient.cpp b/examples/qtmail/app/emailclient.cpp
index 86ada777..1ae939b6 100644
--- a/examples/qtmail/app/emailclient.cpp
+++ b/examples/qtmail/app/emailclient.cpp
@@ -818,6 +818,10 @@ void EmailClient::initActions()
connect(settingsAction, SIGNAL(triggered()), this, SLOT(settings()));
settingsAction->setIconText(QString());
+ standardFoldersAction = new QAction( Qtmail::icon("Create standard folders"), tr("Create standard folders"), this );
+ connect(standardFoldersAction, SIGNAL(triggered()), this, SLOT(createStandardFolders()));
+ standardFoldersAction->setIconText(QString());
+
workOfflineAction = new QAction( Qtmail::icon("workoffline"), tr("Work offline"), this );
connect(workOfflineAction, SIGNAL(triggered()), this, SLOT(connectionStateChanged()));
workOfflineAction->setCheckable(true);
@@ -919,6 +923,7 @@ void EmailClient::initActions()
fileMenu->addAction( cancelButton );
fileMenu->addAction( emptyTrashAction );
fileMenu->addAction( settingsAction );
+ fileMenu->addAction(standardFoldersAction);
fileMenu->addAction( workOfflineAction );
fileMenu->addAction( notificationAction );
fileMenu->addSeparator();
@@ -1063,6 +1068,7 @@ void EmailClient::init()
searchButton = 0;
synchronizeAction = 0;
settingsAction = 0;
+ standardFoldersAction = 0;
workOfflineAction = 0;
emptyTrashAction = 0;
moveAction = 0;
@@ -2587,6 +2593,18 @@ void EmailClient::settings()
settingsDialog.exec();
}
+void EmailClient::createStandardFolders()
+{
+ QMailAccountKey retrieveKey(QMailAccountKey::status(QMailAccount::CanRetrieve, QMailDataComparator::Includes));
+ QMailAccountKey enabledKey(QMailAccountKey::status(QMailAccount::Enabled, QMailDataComparator::Includes));
+ availableAccounts = QMailStore::instance()->queryAccounts(retrieveKey & enabledKey);
+
+ if (!availableAccounts.isEmpty()) {
+ foreach(QMailAccountId accountId, availableAccounts)
+ retrieveAction("createStandardfolders")->createStandardFolders(accountId);
+ }
+}
+
void EmailClient::notificationStateChanged()
{
#ifndef QT_NO_SYSTEMTRAYICON