ipsservices/nmipssettings/src/nmipssettingsplugin.cpp
author hgs
Wed, 15 Sep 2010 17:47:19 +0300
changeset 69 4e54af54a4a1
parent 68 83cc6bae1de8
child 74 6c59112cfd31
permissions -rw-r--r--
201037_1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#include <QCoreApplication>
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <QTranslator>
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <QScopedPointer>
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <QLocale>
43
hgs
parents: 23
diff changeset
    22
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
    23
#include <HbStringUtil>
43
hgs
parents: 23
diff changeset
    24
#include <HbDataForm>
hgs
parents: 23
diff changeset
    25
#include <HbDataFormModel>
hgs
parents: 23
diff changeset
    26
#include <HbDataFormModelItem>
hgs
parents: 23
diff changeset
    27
#include <HbLineEdit>
62
hgs
parents: 57
diff changeset
    28
#include <HbAction>
43
hgs
parents: 23
diff changeset
    29
hgs
parents: 23
diff changeset
    30
#include <cpsettingformitemdata.h>
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include "nmipssettingsplugin.h"
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include "nmipssettingshelper.h"
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include "nmipssettingsmanagerbase.h"
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include "nmipssettingsmanagerfactory.h"
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include "nmipssettingitems.h"
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
#include "nmcommon.h"
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    38
#include "ipssettingkeys.h"
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
#include "nmipssettingscustomitem.h"
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
#include "nmipssettingslabeledcombobox.h"
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
68
hgs
parents: 62
diff changeset
    43
static const QString NmIpsSettingsComboItems("comboItems");
hgs
parents: 62
diff changeset
    44
static const QString NmIpsSettingsLabelTexts("labelTexts");
hgs
parents: 62
diff changeset
    45
static const QString NmIpsSettingsItems("items");
hgs
parents: 62
diff changeset
    46
static const int NmIpsSettingsReceptionUserDefinedProfileEnabled(1);
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
    47
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
/*!
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
    \class NmIpsSettingsPlugin
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
    \brief The class implements NmSettingsPluginInterface which is an interface
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
           for NMail settings plug-ins.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
*/
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
// ======== MEMBER FUNCTIONS ========
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
/*!
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
    Constructor of NmIpsSettingsPlugin.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
*/
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
NmIpsSettingsPlugin::NmIpsSettingsPlugin()
68
hgs
parents: 62
diff changeset
    61
: mSettingsHelper(NULL),
hgs
parents: 62
diff changeset
    62
  mSettingsManager(NULL),
62
hgs
parents: 57
diff changeset
    63
  mHiddenItem(false),
68
hgs
parents: 62
diff changeset
    64
  mSelectedPopupRadioButtonIndex(-1)
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
{
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
    QString lang = QLocale::system().name();
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
    QString path = "Z:/resource/qt/translations/";
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    68
    QString appName = "mailips_";
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    69
    QString commonName = "common_";
68
hgs
parents: 62
diff changeset
    70
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    71
    // Load common strings
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    72
	QScopedPointer<QTranslator> commonTranslator(new QTranslator(this));
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    73
    commonTranslator->load(commonName + lang, path);
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    74
    QCoreApplication::installTranslator(commonTranslator.data());
68
hgs
parents: 62
diff changeset
    75
    (void)commonTranslator.take();
hgs
parents: 62
diff changeset
    76
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    77
    // Load IPS settings specific strings
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    78
	QScopedPointer<QTranslator> translator(new QTranslator(this));
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
    translator->load(appName + lang, path);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
    QCoreApplication::installTranslator(translator.data());
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    81
    (void)translator.take();
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
}
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
/*!
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
    Destructor of NmIpsSettingsPlugin.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
*/
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
NmIpsSettingsPlugin::~NmIpsSettingsPlugin()
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
{
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
    delete mSettingsManager;
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
    delete mSettingsHelper;
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
}
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
/*!
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
    Populates the form items into model.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
    \param model Reference to the model.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
    \param form Reference to the form.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
    \param mailboxId Id of the mailbox.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
    \return <code>true</code> if plug-in contains certain mailbox otherwise <code>false</code>
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
*/
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
bool NmIpsSettingsPlugin::populateModel(HbDataFormModel &model,
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
    HbDataForm &form, const NmId &mailboxId)
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
{
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
    // populateModel is called each time when a new settings view is created and this
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
    // plugin is destructed only after the mail settings is exited, so
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
    // SettingsManager and SettingsHelper needs to be deleted.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
    delete mSettingsManager;
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
    delete mSettingsHelper;
68
hgs
parents: 62
diff changeset
   108
    mSettingsHelper = NULL;
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
    mSettingsManager = NmIpsSettingsManagerFactory::createSettingManager(mailboxId);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
    bool result(false);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
    // This plugin is only used when the mailbox is a IMAP or POP3 account.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
    // Settings manager object is valid if the mailboxId is IMAP or POP3 account.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
    if (mSettingsManager) {
47
hgs
parents: 44
diff changeset
   116
        // Turns AlwaysOnline OFF
hgs
parents: 44
diff changeset
   117
        setAlwaysOnlineState(EServerAPIEmailTurnOff, mailboxId);
68
hgs
parents: 62
diff changeset
   118
47
hgs
parents: 44
diff changeset
   119
        // Store model and form pointers.
hgs
parents: 44
diff changeset
   120
        mModel = &model;
hgs
parents: 44
diff changeset
   121
        mForm = &form;
68
hgs
parents: 62
diff changeset
   122
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
        // Create settings helper.
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   124
        mSettingsHelper = new NmIpsSettingsHelper(*mSettingsManager, form, model);
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   126
        connect(mSettingsHelper,
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   127
                SIGNAL(mailboxListChanged(const NmId &, NmSettings::MailboxEventType)),
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
                this, SIGNAL(mailboxListChanged(const NmId &, NmSettings::MailboxEventType)));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
        connect(mSettingsHelper, SIGNAL(mailboxPropertyChanged(const NmId &, QVariant, QVariant)),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
                this, SIGNAL(mailboxPropertyChanged(const NmId &, QVariant, QVariant)));
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   132
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   133
        connect(mSettingsHelper, SIGNAL(goOffline(const NmId &)),
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   134
                this, SIGNAL(goOffline(const NmId &)));
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   135
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   136
        connect(mSettingsHelper, SIGNAL(createUserDefinedMode()),
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   137
                this, SLOT(createUserDefinedMode()));
68
hgs
parents: 62
diff changeset
   138
44
hgs
parents: 43
diff changeset
   139
        // Get the value if some ui items need to be hidden.
hgs
parents: 43
diff changeset
   140
        QVariant data;
hgs
parents: 43
diff changeset
   141
        mSettingsManager->readSetting(IpsServices::UserNameHidden, data);
hgs
parents: 43
diff changeset
   142
        mHiddenItem = data.toBool();
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
        // Add items to the model.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
        initGroupItems();
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
        result = true;
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
    }
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
    return result;
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
}
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
/*!
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   151
    This slot can be used in cases when plugin needs to handle stuff before settingsview is closed.
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
*/
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   153
void NmIpsSettingsPlugin::aboutToClose()
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
{
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   155
    QVariant profileIndex;
43
hgs
parents: 23
diff changeset
   156
    const NmId mailboxId = mSettingsManager->mailboxId();
68
hgs
parents: 62
diff changeset
   157
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   158
	mSettingsManager->readSetting(IpsServices::ReceptionActiveProfile, profileIndex);
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   159
	if ((mSettingsHelper->isOffline()) && (profileIndex.toInt() != IpsServices::EmailSyncProfileManualFetch)) {
43
hgs
parents: 23
diff changeset
   160
		emit goOnline(mailboxId);
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   161
	}
68
hgs
parents: 62
diff changeset
   162
43
hgs
parents: 23
diff changeset
   163
	// Turns AlwaysOnline ON
hgs
parents: 23
diff changeset
   164
	setAlwaysOnlineState(EServerAPIEmailTurnOn, mailboxId);
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
}
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
/*!
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   168
    Appends the group items to the model.
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
*/
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
void NmIpsSettingsPlugin::initGroupItems()
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
{
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
    HbDataFormModelItem *rootItem = mModel->invisibleRootItem();
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
    HbDataFormModelItem *preferencesItem =
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
        mModel->appendDataFormItem(HbDataFormModelItem::GroupItem,
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
                                   hbTrId("txt_mailips_subhead_preferences"),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
                                   rootItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
    initPreferenceItems(*preferencesItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
    HbDataFormModelItem *receivingScheduleItem =
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
        mModel->appendDataFormItem(HbDataFormModelItem::GroupItem,
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
                                   hbTrId("txt_mailips_subhead_receiving_schedule"),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
                                   rootItem);
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   184
    mSettingsHelper->setReceivingScheduleGroupItem(receivingScheduleItem);
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
    initReceivingScheduleItems(*receivingScheduleItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
    HbDataFormModelItem *userInfoItem =
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
        mModel->appendDataFormItem(HbDataFormModelItem::GroupItem,
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
                                   hbTrId("txt_mailips_subhead_user_info"),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
                                   rootItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
    initUserInfoItems(*userInfoItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
    HbDataFormModelItem *serverInfoItem =
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
        mModel->appendDataFormItem(HbDataFormModelItem::GroupItem,
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
                                   hbTrId("txt_mailips_subhead_server_info"),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
                                   rootItem);
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   197
    mSettingsHelper->setServerInfoGroupItem(serverInfoItem);
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
    initServerInfoItems(*serverInfoItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
    // Create the delete mailbox button.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
    HbDataFormModelItem::DataItemType buttonItem =
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   202
        static_cast<HbDataFormModelItem::DataItemType>(
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
            HbDataFormModelItem::CustomItemBase + 2);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
    HbDataFormModelItem *deleteMailboxButtonItem =
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
        mModel->appendDataFormItem(buttonItem, QString(), rootItem);
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   207
    deleteMailboxButtonItem->setContentWidgetData(QString("text"),
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   208
                                                  hbTrId("txt_mailips_button_delete_mailbox"));
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
    mForm->addConnection(deleteMailboxButtonItem, SIGNAL(clicked()),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
                         mSettingsHelper, SLOT(deleteButtonPress()));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
}
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
/*!
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
    Appends the preferences items to the group item.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
    \param item Reference to the parent group item.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
*/
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
void NmIpsSettingsPlugin::initPreferenceItems(HbDataFormModelItem &item) const
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
{
43
hgs
parents: 23
diff changeset
   221
    // 1. Connection
hgs
parents: 23
diff changeset
   222
    QVariant destId;
hgs
parents: 23
diff changeset
   223
    mSettingsManager->readSetting(IpsServices::Connection, destId);
hgs
parents: 23
diff changeset
   224
    QString destName(mSettingsHelper->destinationNameFromIdentifier(destId.toUInt()));
hgs
parents: 23
diff changeset
   225
    HbDataFormModelItem::DataItemType buttonItem =
hgs
parents: 23
diff changeset
   226
        static_cast<HbDataFormModelItem::DataItemType>(
hgs
parents: 23
diff changeset
   227
            HbDataFormModelItem::CustomItemBase + 2);
hgs
parents: 23
diff changeset
   228
    CpSettingFormItemData *connectionButtonItem = new CpSettingFormItemData(buttonItem,
hgs
parents: 23
diff changeset
   229
        hbTrId("txt_mailips_setlabel_connection"));
hgs
parents: 23
diff changeset
   230
    connectionButtonItem->setContentWidgetData(QString("text"), destName);
hgs
parents: 23
diff changeset
   231
    mSettingsHelper->insertContentItem(IpsServices::Connection, connectionButtonItem);
hgs
parents: 23
diff changeset
   232
    mForm->addConnection(connectionButtonItem, SIGNAL(clicked()),
hgs
parents: 23
diff changeset
   233
                         mSettingsHelper, SLOT(connectionButtonPress()));
hgs
parents: 23
diff changeset
   234
    item.appendChild(connectionButtonItem);
hgs
parents: 23
diff changeset
   235
hgs
parents: 23
diff changeset
   236
    // 2. My Name
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
    QVariant myName;
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
    mSettingsManager->readSetting(IpsServices::EmailAlias, myName);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
    CpSettingFormItemData *myNameItem = new CpSettingFormItemData(
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
        HbDataFormModelItem::TextItem, hbTrId("txt_mailips_setlabel_my_name"));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
    mSettingsHelper->insertContentItem(IpsServices::EmailAlias, myNameItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
    myNameItem->setContentWidgetData(QString("text"), myName);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
    mForm->addConnection(myNameItem, SIGNAL(editingFinished()),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
                         mSettingsHelper, SLOT(saveMyName()));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
    mForm->addConnection(myNameItem, SIGNAL(textChanged(QString)),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
                         mSettingsHelper, SLOT(myNameTextChange(QString)));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
    item.appendChild(myNameItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
43
hgs
parents: 23
diff changeset
   249
    // 3. Mailbox Name
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
    QVariant mailboxName;
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
    mSettingsManager->readSetting(IpsServices::MailboxName, mailboxName);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
    CpSettingFormItemData *mailboxNameItem = new CpSettingFormItemData(
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
        HbDataFormModelItem::TextItem, hbTrId("txt_mailips_setlabel_mailbox_name"));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
    mSettingsHelper->insertContentItem(IpsServices::MailboxName, mailboxNameItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
    mailboxNameItem->setContentWidgetData(QString("text"), mailboxName);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
    mForm->addConnection(mailboxNameItem, SIGNAL(editingFinished()),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
                         mSettingsHelper, SLOT(saveMailboxName()));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
    mForm->addConnection(mailboxNameItem, SIGNAL(textChanged(QString)),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
                         mSettingsHelper, SLOT(mailboxNameTextChange(QString)));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
    item.appendChild(mailboxNameItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
}
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
/*!
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
    Appends the receiving schedule items to the group item.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
    \param item Reference to the parent group item.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
*/
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
void NmIpsSettingsPlugin::initReceivingScheduleItems(HbDataFormModelItem &item)
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
{
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
    // Active sync profile
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
    // Append custom item to the prototype list.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
    NmIpsSettingsCustomItem *prototype = new NmIpsSettingsCustomItem();
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
    QList<HbAbstractViewItem *> protoTypeList = mForm->itemPrototypes();
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
    protoTypeList.append(prototype);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
    mForm->setItemPrototypes(protoTypeList);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   277
    // 1. Active sync profile
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
    HbDataFormModelItem *infoItem = new HbDataFormModelItem(
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
        static_cast<HbDataFormModelItem::DataItemType>(NmIpsSettingsCustomItem::LabeledComboBox),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
        hbTrId("txt_mailips_setlabel_selected_mode"));
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   281
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   282
    mSettingsHelper->insertContentItem(IpsServices::ReceptionActiveProfile, infoItem);
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
    item.appendChild(infoItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   285
    QStringList modeList;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   286
    modeList << hbTrId("txt_mailips_setlabel_selected_mode_val_keep_upto")          // 0
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   287
             << hbTrId("txt_mailips_setlabel_selected_mode_val_save_energy")        // 1
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   288
             << hbTrId("txt_mailips_setlabel_selected_mode_val_fetch_manua");       // 2
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   289
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   290
    QVariant userDefineMode;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   291
    mSettingsManager->readSetting(IpsServices::ReceptionUserDefinedProfile, userDefineMode);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   292
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   293
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   294
    // If 'user defined' mode is defined then add it to combo items.
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   295
    if (userDefineMode.toInt()) {
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   296
        modeList << hbTrId("txt_mailips_setlabel_selected_mode_val_user_define");   // 3
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   297
    }
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   298
    infoItem->setContentWidgetData(NmIpsSettingsComboItems, modeList);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   299
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   300
    QStringList infoList;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   301
    infoList << hbTrId("txt_mailips_list_the_mailbox_is_uptodate_during")           // 0
68
hgs
parents: 62
diff changeset
   302
             << hbTrId("txt_mailips_list_the_mailbox_is_refreshed_every_hour")      // 1
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   303
             << hbTrId("txt_mailips_list_the_mailbox_is_refreshed_only_by");        // 2
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   304
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   305
    // If 'user defined' mode is defined then add 'user defined' explanation to label list.
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   306
    if (userDefineMode.toInt()) {
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   307
        infoList << hbTrId("txt_mailips_list_the_mailbox_is_refreshed_as_defin");   // 3
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   308
    }
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   309
    infoItem->setContentWidgetData(NmIpsSettingsLabelTexts, infoList);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   310
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   311
    QVariant profileIndex;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   312
    mSettingsManager->readSetting(IpsServices::ReceptionActiveProfile, profileIndex);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   313
    infoItem->setContentWidgetData(QString("currentIndex"), profileIndex);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   314
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   315
    // 2. Show mail in inbox
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   316
    QVariant mailInInbox;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   317
    mSettingsManager->readSetting(IpsServices::ReceptionInboxSyncWindow, mailInInbox);
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   318
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   319
    CpSettingFormItemData *showMailInInboxItem =
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   320
        new CpSettingFormItemData(HbDataFormModelItem::RadioButtonListItem, hbTrId(
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   321
            "txt_mailips_setlabel_show_mail_in_inbox"));
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   322
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   323
    mSettingsHelper->insertContentItem(IpsServices::ReceptionInboxSyncWindow, showMailInInboxItem);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   324
43
hgs
parents: 23
diff changeset
   325
    // If changes are made to showMailItems, conversion table in
hgs
parents: 23
diff changeset
   326
    // showMailInInboxModified method needs to be updated also.
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   327
    QStringList showMailItems;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   328
    showMailItems << HbStringUtil::convertDigits("50")
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   329
                  << HbStringUtil::convertDigits("100")
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   330
                  << HbStringUtil::convertDigits("500")
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   331
                  << hbTrId("txt_mailips_setlabel_val_all");
68
hgs
parents: 62
diff changeset
   332
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   333
    showMailInInboxItem->setContentWidgetData(NmIpsSettingsItems, showMailItems);
68
hgs
parents: 62
diff changeset
   334
    showMailInInboxItem->setContentWidgetData("displayMode","popup");
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   335
    showMailInInboxItem->setEnabled(true);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   336
    item.appendChild(showMailInInboxItem);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   337
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   338
    // Active sync profile connection
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
    mForm->addConnection(infoItem, SIGNAL(currentIndexChanged(int)),
68
hgs
parents: 62
diff changeset
   340
						 mSettingsHelper, SLOT(receivingScheduleChange(int)));
62
hgs
parents: 57
diff changeset
   341
    mForm->addConnection(showMailInInboxItem, SIGNAL(finished(HbAction *)),
68
hgs
parents: 62
diff changeset
   342
						 this, SLOT(showMailInInboxModified(HbAction *)));
62
hgs
parents: 57
diff changeset
   343
    mForm->addConnection(showMailInInboxItem, SIGNAL(itemSelected(int)),
68
hgs
parents: 62
diff changeset
   344
						 this, SLOT(popupRadioButtonIndexModified(int)));
hgs
parents: 62
diff changeset
   345
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   346
    // Must be called manually here, because the signal->slot connection set above using
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   347
    // HbDataForm::addConnection() is actually established AFTER the properties have first been
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   348
    // set to the widget, causing the first currentIndexChanged signal not to reach
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   349
    // NmIpsSettingsHelper::receivingScheduleChange().
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   350
    mSettingsHelper->receivingScheduleChange(profileIndex.toInt());
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   351
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   352
}
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   353
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   354
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   355
/*!
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
    Appends the user info items to the group item.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   357
    \param item Reference to the parent group item.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   358
*/
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   359
void NmIpsSettingsPlugin::initUserInfoItems(HbDataFormModelItem &item) const
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   360
{
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   361
    // 1. Mail address
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   362
    QVariant mailAddress;
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   363
    mSettingsManager->readSetting(IpsServices::EmailAddress, mailAddress);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   364
    CpSettingFormItemData *mailAddressItem = new CpSettingFormItemData(
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   365
        HbDataFormModelItem::TextItem, hbTrId("txt_mailips_setlabel_mail_address"));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
    mSettingsHelper->insertContentItem(IpsServices::EmailAddress, mailAddressItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   367
    mailAddressItem->setContentWidgetData(QString("text"), mailAddress);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   368
    mForm->addConnection(mailAddressItem, SIGNAL(editingFinished()),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
                         mSettingsHelper, SLOT(saveMailAddress()));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   370
    mForm->addConnection(mailAddressItem, SIGNAL(textChanged(QString)),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   371
                         mSettingsHelper, SLOT(mailAddressTextChange(QString)));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   372
    item.appendChild(mailAddressItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   373
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   374
    // 2. Username
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   375
    QVariant username;
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   376
    mSettingsManager->readSetting(IpsServices::IncomingLoginName, username);
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   377
    CpSettingFormItemData *usernameItem = new CpSettingFormItemData(
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   378
        HbDataFormModelItem::TextItem, hbTrId("txt_mailips_setlabel_username"));
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   379
    mSettingsHelper->insertContentItem(IpsServices::IncomingLoginName, usernameItem);
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   380
    usernameItem->setContentWidgetData(QString("text"), username);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   381
    mForm->addConnection(usernameItem, SIGNAL(editingFinished()),
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   382
                         mSettingsHelper, SLOT(saveIncomingUserName()));
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   383
    mForm->addConnection(usernameItem, SIGNAL(textChanged(QString)),
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   384
                         mSettingsHelper, SLOT(incomingUserNameTextChange(QString)));
44
hgs
parents: 43
diff changeset
   385
    if (mHiddenItem) { // Starred and dimmed.
hgs
parents: 43
diff changeset
   386
        usernameItem->setContentWidgetData(QString("echoMode"), HbLineEdit::Password);
hgs
parents: 43
diff changeset
   387
        usernameItem->setEnabled(false);
hgs
parents: 43
diff changeset
   388
    }
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   389
    item.appendChild(usernameItem);
68
hgs
parents: 62
diff changeset
   390
hgs
parents: 62
diff changeset
   391
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   392
    // 3. Password
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   393
    QVariant password;
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   394
    mSettingsManager->readSetting(IpsServices::IncomingPassword, password);
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   395
    CpSettingFormItemData *passwordItem = new CpSettingFormItemData(
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   396
        HbDataFormModelItem::TextItem, hbTrId("txt_mailips_setlabel_password"));
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   397
    mSettingsHelper->insertContentItem(IpsServices::IncomingPassword, passwordItem);
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   398
    passwordItem->setContentWidgetData(QString("text"), password);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   399
    passwordItem->setContentWidgetData(QString("echoMode"), HbLineEdit::PasswordEchoOnEdit);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   400
    mForm->addConnection(passwordItem, SIGNAL(editingFinished()),
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   401
                         mSettingsHelper, SLOT(saveIncomingPassword()));
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   402
    item.appendChild(passwordItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   403
44
hgs
parents: 43
diff changeset
   404
    // 4. Reply to address
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   405
    QVariant replyToAddress;
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   406
    mSettingsManager->readSetting(IpsServices::ReplyAddress, replyToAddress);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   407
    CpSettingFormItemData *replyToItem = new CpSettingFormItemData(
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   408
       HbDataFormModelItem::TextItem, hbTrId("txt_mailips_setlabel_reply_to_address"));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
    mSettingsHelper->insertContentItem(IpsServices::ReplyAddress, replyToItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   410
    replyToItem->setContentWidgetData(QString("text"), replyToAddress);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
    mForm->addConnection(replyToItem, SIGNAL(editingFinished()),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
                         mSettingsHelper, SLOT(saveReplyTo()));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   413
    mForm->addConnection(replyToItem, SIGNAL(textChanged(QString)),
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   414
                         mSettingsHelper, SLOT(replyToTextChange(QString)));
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   415
    item.appendChild(replyToItem);
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   416
}
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
/*!
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
    Appends the server info items to the group item.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   420
    \param item Reference to the parent group item.
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
*/
68
hgs
parents: 62
diff changeset
   422
void NmIpsSettingsPlugin::initServerInfoItems(HbDataFormModelItem &item)
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   423
{
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   424
    // 1. Incoming mail server address
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   425
    QVariant incomingMailServer;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   426
    mSettingsManager->readSetting(IpsServices::IncomingMailServer, incomingMailServer);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   427
    CpSettingFormItemData *incomingMailServerItem = new CpSettingFormItemData(
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   428
        HbDataFormModelItem::TextItem, hbTrId("txt_mailips_setlabel_incoming_mail_server"));
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   429
    mSettingsHelper->insertContentItem(IpsServices::IncomingMailServer, incomingMailServerItem);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   430
    incomingMailServerItem->setContentWidgetData(QString("text"), incomingMailServer);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   431
    mForm->addConnection(incomingMailServerItem, SIGNAL(editingFinished()),
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   432
                         mSettingsHelper, SLOT(saveIncomingMailServer()));
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   433
    mForm->addConnection(incomingMailServerItem, SIGNAL(textChanged(QString)),
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   434
                         mSettingsHelper, SLOT(incomingMailServerTextChange(QString)));
44
hgs
parents: 43
diff changeset
   435
    if (mHiddenItem) { // Starred and dimmed.
hgs
parents: 43
diff changeset
   436
        incomingMailServerItem->setContentWidgetData(QString("echoMode"), HbLineEdit::Password);
hgs
parents: 43
diff changeset
   437
        incomingMailServerItem->setEnabled(false);
hgs
parents: 43
diff changeset
   438
    }
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   439
    item.appendChild(incomingMailServerItem);
68
hgs
parents: 62
diff changeset
   440
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   441
    // 2. Incoming Secure connection
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   442
    CpSettingFormItemData *incomingSecureConnectionItem =
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   443
        new CpSettingFormItemData(HbDataFormModelItem::RadioButtonListItem, hbTrId(
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   444
            "txt_mailips_setlabel_incoming_security"));
68
hgs
parents: 62
diff changeset
   445
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   446
    mSettingsHelper->insertContentItem(IpsServices::IncomingSecureSockets, incomingSecureConnectionItem);
68
hgs
parents: 62
diff changeset
   447
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   448
    QStringList showSCItems;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   449
    showSCItems << hbTrId("txt_mailips_setlabel_security_val_on_starttls")
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   450
                << hbTrId("txt_mailips_setlabel_security_val_on_ssltls")
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   451
                << hbTrId("txt_mailips_setlabel_security_val_off");
68
hgs
parents: 62
diff changeset
   452
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   453
    incomingSecureConnectionItem->setContentWidgetData(QString("items"), showSCItems);
68
hgs
parents: 62
diff changeset
   454
    incomingSecureConnectionItem->setContentWidgetData("displayMode","popup");
hgs
parents: 62
diff changeset
   455
hgs
parents: 62
diff changeset
   456
    int incomingSecureConnectionItemIndex =
44
hgs
parents: 43
diff changeset
   457
        mSettingsHelper->getCorrectIncomingSecureRadioButtonIndex();
68
hgs
parents: 62
diff changeset
   458
    incomingSecureConnectionItem->setContentWidgetData(QString("selected"),
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   459
                                                       incomingSecureConnectionItemIndex);
68
hgs
parents: 62
diff changeset
   460
hgs
parents: 62
diff changeset
   461
    mForm->addConnection(incomingSecureConnectionItem, SIGNAL(finished(HbAction *)),
hgs
parents: 62
diff changeset
   462
						 this, SLOT(incomingSecureConnectionModified(HbAction *)));
hgs
parents: 62
diff changeset
   463
    mForm->addConnection(incomingSecureConnectionItem, SIGNAL(itemSelected(int)),
hgs
parents: 62
diff changeset
   464
						 this, SLOT(popupRadioButtonIndexModified(int)));
hgs
parents: 62
diff changeset
   465
44
hgs
parents: 43
diff changeset
   466
    if (mHiddenItem) {
hgs
parents: 43
diff changeset
   467
        incomingSecureConnectionItem->setEnabled(false);
hgs
parents: 43
diff changeset
   468
    }
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   469
    item.appendChild(incomingSecureConnectionItem);
68
hgs
parents: 62
diff changeset
   470
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   471
    // 3. Incoming mail server port
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   472
    CpSettingFormItemData *incomingPortItem =
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   473
        new CpSettingFormItemData(HbDataFormModelItem::RadioButtonListItem, hbTrId(
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   474
            "txt_mailips_setlabel_incoming_port"));
44
hgs
parents: 43
diff changeset
   475
    mSettingsHelper->insertContentItem(IpsServices::IncomingPort, incomingPortItem);
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   476
    QStringList incomingPortItems;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   477
    incomingPortItems << hbTrId("txt_mailips_setlabel_incoming_port_default")
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   478
                      << hbTrId("txt_mailips_setlabel_incoming_port_user_defined");
68
hgs
parents: 62
diff changeset
   479
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   480
    incomingPortItem->setContentWidgetData(QString("items"), incomingPortItems);
68
hgs
parents: 62
diff changeset
   481
    incomingPortItem->setContentWidgetData("displayMode","popup");
hgs
parents: 62
diff changeset
   482
hgs
parents: 62
diff changeset
   483
    int incomingPortItemIndex = mSettingsHelper->getCorrectIncomingPortRadioButtonIndex();
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   484
    incomingPortItem->setContentWidgetData(QString("selected"), incomingPortItemIndex);
68
hgs
parents: 62
diff changeset
   485
hgs
parents: 62
diff changeset
   486
    mForm->addConnection(incomingPortItem, SIGNAL(finished(HbAction *)),
hgs
parents: 62
diff changeset
   487
   						 this, SLOT(incomingPortModified(HbAction *)));
47
hgs
parents: 44
diff changeset
   488
    mForm->addConnection(incomingPortItem, SIGNAL(itemSelected(int)),
68
hgs
parents: 62
diff changeset
   489
					 this, SLOT(popupRadioButtonIndexModified(int)));
hgs
parents: 62
diff changeset
   490
44
hgs
parents: 43
diff changeset
   491
    if (mHiddenItem) {
hgs
parents: 43
diff changeset
   492
        incomingPortItem->setEnabled(false);
hgs
parents: 43
diff changeset
   493
    }
hgs
parents: 43
diff changeset
   494
    item.appendChild(incomingPortItem);
68
hgs
parents: 62
diff changeset
   495
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   496
    // 4. Outgoing mail server address
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   497
    QVariant outgoingMailServer;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   498
    mSettingsManager->readSetting(IpsServices::OutgoingMailServer, outgoingMailServer);
68
hgs
parents: 62
diff changeset
   499
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   500
    CpSettingFormItemData *outgoingMailServerItem = new CpSettingFormItemData(
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   501
        HbDataFormModelItem::TextItem, hbTrId("txt_mailips_setlabel_outgoing_mail_server"));
68
hgs
parents: 62
diff changeset
   502
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   503
    mSettingsHelper->insertContentItem(IpsServices::OutgoingMailServer, outgoingMailServerItem);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   504
    outgoingMailServerItem->setContentWidgetData(QString("text"), outgoingMailServer);
68
hgs
parents: 62
diff changeset
   505
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   506
    mForm->addConnection(outgoingMailServerItem, SIGNAL(editingFinished()),
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   507
                         mSettingsHelper, SLOT(saveOutgoingMailServer()));
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   508
    mForm->addConnection(outgoingMailServerItem, SIGNAL(textChanged(QString)),
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   509
                         mSettingsHelper, SLOT(outgoingMailServerTextChange(QString)));
68
hgs
parents: 62
diff changeset
   510
44
hgs
parents: 43
diff changeset
   511
    if (mHiddenItem) {// Starred and dimmed.
hgs
parents: 43
diff changeset
   512
        outgoingMailServerItem->setContentWidgetData(QString("echoMode"), HbLineEdit::Password);
hgs
parents: 43
diff changeset
   513
        outgoingMailServerItem->setEnabled(false);
hgs
parents: 43
diff changeset
   514
    }
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   515
    item.appendChild(outgoingMailServerItem);
68
hgs
parents: 62
diff changeset
   516
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   517
    // 5. Outgoing secure connection
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   518
    CpSettingFormItemData *outgoingSecureConnectionItem =
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   519
        new CpSettingFormItemData(HbDataFormModelItem::RadioButtonListItem, hbTrId(
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   520
            "txt_mailips_setlabel_outgoing_security"));
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   521
    mSettingsHelper->insertContentItem(IpsServices::OutgoingSecureSockets, outgoingSecureConnectionItem);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   522
    QStringList outgoingShowSCItems;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   523
    outgoingShowSCItems << hbTrId("txt_mailips_setlabel_security_val_on_starttls")
44
hgs
parents: 43
diff changeset
   524
                        << hbTrId("txt_mailips_setlabel_security_val_on_ssltls")
hgs
parents: 43
diff changeset
   525
                        << hbTrId("txt_mailips_setlabel_security_val_off");
68
hgs
parents: 62
diff changeset
   526
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   527
    outgoingSecureConnectionItem->setContentWidgetData(QString("items"), outgoingShowSCItems);
68
hgs
parents: 62
diff changeset
   528
    outgoingSecureConnectionItem->setContentWidgetData("displayMode","popup");
hgs
parents: 62
diff changeset
   529
hgs
parents: 62
diff changeset
   530
    int outgoingSecureConnectionItemIndex =
44
hgs
parents: 43
diff changeset
   531
        mSettingsHelper->getCorrectOutgoingSecureRadioButtonIndex();
68
hgs
parents: 62
diff changeset
   532
    outgoingSecureConnectionItem->setContentWidgetData(QString("selected"),
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   533
                                                       outgoingSecureConnectionItemIndex);
68
hgs
parents: 62
diff changeset
   534
hgs
parents: 62
diff changeset
   535
    mForm->addConnection(outgoingSecureConnectionItem, SIGNAL(finished(HbAction *)),
hgs
parents: 62
diff changeset
   536
      				     this, SLOT(outgoingSecureConnectionModified(HbAction *)));
hgs
parents: 62
diff changeset
   537
    mForm->addConnection(outgoingSecureConnectionItem, SIGNAL(itemSelected(int)),
hgs
parents: 62
diff changeset
   538
				         this, SLOT(popupRadioButtonIndexModified(int)));
hgs
parents: 62
diff changeset
   539
44
hgs
parents: 43
diff changeset
   540
    if (mHiddenItem) {
hgs
parents: 43
diff changeset
   541
        outgoingSecureConnectionItem->setEnabled(false);
hgs
parents: 43
diff changeset
   542
    }
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   543
    item.appendChild(outgoingSecureConnectionItem);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   544
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   545
    // 6. Outgoing mail server port
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   546
    CpSettingFormItemData *outgoingPortItem =
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   547
        new CpSettingFormItemData(HbDataFormModelItem::RadioButtonListItem, hbTrId(
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   548
            "txt_mailips_setlabel_outgoing_port"));
44
hgs
parents: 43
diff changeset
   549
    mSettingsHelper->insertContentItem(IpsServices::OutgoingPort, outgoingPortItem);
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   550
    QStringList outgoingPortItems;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   551
    outgoingPortItems << hbTrId("txt_mailips_setlabel_incoming_port_default")
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   552
                      << hbTrId("txt_mailips_setlabel_incoming_port_user_defined");
68
hgs
parents: 62
diff changeset
   553
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   554
    outgoingPortItem->setContentWidgetData(QString("items"), outgoingPortItems);
68
hgs
parents: 62
diff changeset
   555
    outgoingPortItem->setContentWidgetData("displayMode","popup");
hgs
parents: 62
diff changeset
   556
hgs
parents: 62
diff changeset
   557
    int outgoingPortItemIndex = mSettingsHelper->getCorrectOutgoingPortRadioButtonIndex();
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   558
    outgoingPortItem->setContentWidgetData(QString("selected"), outgoingPortItemIndex);
68
hgs
parents: 62
diff changeset
   559
hgs
parents: 62
diff changeset
   560
    mForm->addConnection(outgoingPortItem, SIGNAL(finished(HbAction *)),
hgs
parents: 62
diff changeset
   561
					     this, SLOT(outgoingPortModified(HbAction *)));
hgs
parents: 62
diff changeset
   562
	mForm->addConnection(outgoingPortItem, SIGNAL(itemSelected(int)),
hgs
parents: 62
diff changeset
   563
						 this, SLOT(popupRadioButtonIndexModified(int)));
hgs
parents: 62
diff changeset
   564
44
hgs
parents: 43
diff changeset
   565
    if (mHiddenItem) {
hgs
parents: 43
diff changeset
   566
        outgoingPortItem->setEnabled(false);
hgs
parents: 43
diff changeset
   567
    }
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   568
    item.appendChild(outgoingPortItem);
68
hgs
parents: 62
diff changeset
   569
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   570
    // 7. Outgoing authentication.
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   571
    CpSettingFormItemData *outgoingAuthenticationItem =
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   572
        new CpSettingFormItemData(HbDataFormModelItem::RadioButtonListItem, hbTrId(
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   573
            "txt_mailips_setlabel_outgoing_mail_authentication"));
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   574
    mSettingsHelper->insertContentItem(IpsServices::SMTPAuthentication, outgoingAuthenticationItem);
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   575
    QStringList outgoingAuthenticationItems;
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   576
    outgoingAuthenticationItems << hbTrId("txt_mailips_setlabel_outgoing_authentication_none")
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   577
                                << hbTrId("txt_mailips_setlabel_outgoing_authentication_same")
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   578
                                << hbTrId("txt_mailips_setlabel_outgoing_authentication_user");
68
hgs
parents: 62
diff changeset
   579
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   580
    outgoingAuthenticationItem->setContentWidgetData(QString("items"), outgoingAuthenticationItems);
68
hgs
parents: 62
diff changeset
   581
    outgoingAuthenticationItem->setContentWidgetData("displayMode","popup");
hgs
parents: 62
diff changeset
   582
hgs
parents: 62
diff changeset
   583
    int outgoingAuthenticationIndex =
hgs
parents: 62
diff changeset
   584
        mSettingsHelper->getCorrectOutgoingAuthenticationRadioButtonIndex();
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   585
    outgoingAuthenticationItem->setContentWidgetData(QString("selected"), outgoingAuthenticationIndex);
68
hgs
parents: 62
diff changeset
   586
hgs
parents: 62
diff changeset
   587
    mForm->addConnection(outgoingAuthenticationItem, SIGNAL(finished(HbAction *)),
hgs
parents: 62
diff changeset
   588
    					 this, SLOT(outgoingAuthenticationModified(HbAction *)));
hgs
parents: 62
diff changeset
   589
	mForm->addConnection(outgoingAuthenticationItem, SIGNAL(itemSelected(int)),
hgs
parents: 62
diff changeset
   590
						 this, SLOT(popupRadioButtonIndexModified(int)));
hgs
parents: 62
diff changeset
   591
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   592
    item.appendChild(outgoingAuthenticationItem);
44
hgs
parents: 43
diff changeset
   593
    if (mHiddenItem) {
hgs
parents: 43
diff changeset
   594
        outgoingAuthenticationItem->setEnabled(false);
hgs
parents: 43
diff changeset
   595
    }
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   596
    if (outgoingAuthenticationIndex == IpsServices::EMailAuthUserAuthentication) {
44
hgs
parents: 43
diff changeset
   597
        mSettingsHelper->createServerInfoGroupDynamicItems(mHiddenItem);
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   598
    }
68
hgs
parents: 62
diff changeset
   599
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   600
    // 8. Folder path
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   601
    // This item is only shown for IMAP4 account.
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   602
    if (mSettingsManager->accountType() == IpsServices::EMailImap) {
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   603
        CpSettingFormItemData *folderPathItem =
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   604
            new CpSettingFormItemData(HbDataFormModelItem::RadioButtonListItem, hbTrId(
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   605
                "txt_mailips_setlabel_folder_path"));
68
hgs
parents: 62
diff changeset
   606
        mSettingsHelper->insertContentItem(IpsServices::FolderPath, folderPathItem);
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   607
        QStringList folderPathItems;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   608
        folderPathItems << hbTrId("txt_mailips_setlabel_folder_path_val_default")
44
hgs
parents: 43
diff changeset
   609
                        << hbTrId("txt_mailips_setlabel_folder_path_user_defined");
68
hgs
parents: 62
diff changeset
   610
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   611
        folderPathItem->setContentWidgetData(QString("items"), folderPathItems);
68
hgs
parents: 62
diff changeset
   612
        folderPathItem->setContentWidgetData("displayMode","popup");
hgs
parents: 62
diff changeset
   613
44
hgs
parents: 43
diff changeset
   614
        int folderPathItemIndex = mSettingsHelper->getCorrectFolderPathRadioButtonIndex();
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   615
        folderPathItem->setContentWidgetData(QString("selected"), folderPathItemIndex);
68
hgs
parents: 62
diff changeset
   616
hgs
parents: 62
diff changeset
   617
        mForm->addConnection(folderPathItem, SIGNAL(finished(HbAction *)),
hgs
parents: 62
diff changeset
   618
            			     this, SLOT(folderPathModified(HbAction *)));
hgs
parents: 62
diff changeset
   619
		mForm->addConnection(folderPathItem, SIGNAL(itemSelected(int)),
hgs
parents: 62
diff changeset
   620
							 this, SLOT(popupRadioButtonIndexModified(int)));
hgs
parents: 62
diff changeset
   621
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   622
        item.appendChild(folderPathItem);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   623
    }
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   624
}
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   625
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   626
/*!
43
hgs
parents: 23
diff changeset
   627
    Sets the state of the AlwaysOnline.
hgs
parents: 23
diff changeset
   628
    \param command Command for the state of the AlwaysOnline.
hgs
parents: 23
diff changeset
   629
    \param mailboxId Mailbox id.
hgs
parents: 23
diff changeset
   630
*/
hgs
parents: 23
diff changeset
   631
void NmIpsSettingsPlugin::setAlwaysOnlineState(TAlwaysOnlineServerAPICommands command,
hgs
parents: 23
diff changeset
   632
                                               NmId mailboxId) const
hgs
parents: 23
diff changeset
   633
{
hgs
parents: 23
diff changeset
   634
    RAlwaysOnlineClientSession aosession;
hgs
parents: 23
diff changeset
   635
    TInt err(aosession.Connect());
68
hgs
parents: 62
diff changeset
   636
43
hgs
parents: 23
diff changeset
   637
    if (err == KErrNone) {
hgs
parents: 23
diff changeset
   638
        TPckgBuf<TMsvId> mboxBuf(mailboxId.id32());
68
hgs
parents: 62
diff changeset
   639
43
hgs
parents: 23
diff changeset
   640
        TRAP_IGNORE(aosession.RelayCommandL(command, mboxBuf));
hgs
parents: 23
diff changeset
   641
    }
68
hgs
parents: 62
diff changeset
   642
43
hgs
parents: 23
diff changeset
   643
    aosession.Close();
hgs
parents: 23
diff changeset
   644
}
hgs
parents: 23
diff changeset
   645
hgs
parents: 23
diff changeset
   646
/*!
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   647
    Creates user defined mode if not already exist.
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   648
*/
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   649
void NmIpsSettingsPlugin::createUserDefinedMode()
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   650
{
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   651
    QVariant userDefineMode;
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   652
    mSettingsManager->readSetting(IpsServices::ReceptionUserDefinedProfile, userDefineMode);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   653
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   654
    // If user defined mode do not already exist, create it.
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   655
    if (!userDefineMode.toInt()) {
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   656
        // Add 'user defined' mode to combobox.
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   657
        HbDataFormModelItem *syncProfile =
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   658
            mSettingsHelper->contentItem(IpsServices::ReceptionActiveProfile);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   659
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   660
        QVariant contentWidgetData = syncProfile->contentWidgetData(NmIpsSettingsComboItems);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   661
        QStringList modeList = contentWidgetData.value<QStringList>();
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   662
        modeList << hbTrId("txt_mailips_setlabel_selected_mode_val_user_define");
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   663
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   664
        // Add 'user defined' explanation text to label text.
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   665
        contentWidgetData = syncProfile->contentWidgetData(NmIpsSettingsLabelTexts);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   666
        QStringList infoList = contentWidgetData.value<QStringList>();
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   667
        infoList << hbTrId("txt_mailips_list_the_mailbox_is_refreshed_as_defin");
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   668
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   669
        // Disconnect signal temporarily so that by setting content widget data will
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   670
        // not cause any unnecessary actions in helper.
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   671
        mForm->removeConnection(syncProfile, SIGNAL(currentIndexChanged(int)),
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   672
            mSettingsHelper, SLOT(receivingScheduleChange(int)));
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   673
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   674
        syncProfile->setContentWidgetData(NmIpsSettingsComboItems, modeList);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   675
        syncProfile->setContentWidgetData(NmIpsSettingsLabelTexts, infoList);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   676
23
2dc6caa42ec3 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   677
        // Reconnect signal, so that helper is aware of data modifications.
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   678
        mForm->addConnection(syncProfile, SIGNAL(currentIndexChanged(int)),
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   679
            mSettingsHelper, SLOT(receivingScheduleChange(int)));
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   680
43
hgs
parents: 23
diff changeset
   681
        // Set reception user defined profile enabled.
hgs
parents: 23
diff changeset
   682
        userDefineMode.setValue(NmIpsSettingsReceptionUserDefinedProfileEnabled);
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   683
        mSettingsManager->writeSetting(IpsServices::ReceptionUserDefinedProfile, userDefineMode);
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   684
    }
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   685
}
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   686
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   687
/*!
62
hgs
parents: 57
diff changeset
   688
Handles mail in inbox modifications.
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   689
68
hgs
parents: 62
diff changeset
   690
Index   Value
hgs
parents: 62
diff changeset
   691
0       50
hgs
parents: 62
diff changeset
   692
1       100
hgs
parents: 62
diff changeset
   693
2       500
hgs
parents: 62
diff changeset
   694
3       All
hgs
parents: 62
diff changeset
   695
62
hgs
parents: 57
diff changeset
   696
\param action Action that determines whether user clicked OK or cancel.
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   697
*/
62
hgs
parents: 57
diff changeset
   698
void NmIpsSettingsPlugin::showMailInInboxModified(HbAction *action)
20
ecc8def7944a Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   699
{
62
hgs
parents: 57
diff changeset
   700
    if ((action->text() == hbTrId("txt_common_button_ok"))
68
hgs
parents: 62
diff changeset
   701
            && (mSelectedPopupRadioButtonIndex >=0 && mSelectedPopupRadioButtonIndex <=3)) {
62
hgs
parents: 57
diff changeset
   702
        int conversionTable[] = { 50, 100, 500, 0 };
68
hgs
parents: 62
diff changeset
   703
        int selectedValue(conversionTable[mSelectedPopupRadioButtonIndex]);
hgs
parents: 62
diff changeset
   704
62
hgs
parents: 57
diff changeset
   705
        QVariant previouslySelectedValue;
hgs
parents: 57
diff changeset
   706
        mSettingsManager->readSetting(IpsServices::ReceptionInboxSyncWindow, previouslySelectedValue);
hgs
parents: 57
diff changeset
   707
        if (previouslySelectedValue.toInt() != selectedValue) {
hgs
parents: 57
diff changeset
   708
            mSettingsHelper->handleReceivingScheduleSettingChange(
hgs
parents: 57
diff changeset
   709
                IpsServices::ReceptionInboxSyncWindow, selectedValue);
hgs
parents: 57
diff changeset
   710
        }
hgs
parents: 57
diff changeset
   711
    }
68
hgs
parents: 62
diff changeset
   712
    mSelectedPopupRadioButtonIndex = -1;
hgs
parents: 62
diff changeset
   713
}
hgs
parents: 62
diff changeset
   714
hgs
parents: 62
diff changeset
   715
/*!
hgs
parents: 62
diff changeset
   716
Handles incoming secure connection modifications.
hgs
parents: 62
diff changeset
   717
hgs
parents: 62
diff changeset
   718
\param action Action that determines whether user clicked OK or cancel.
hgs
parents: 62
diff changeset
   719
*/
hgs
parents: 62
diff changeset
   720
void NmIpsSettingsPlugin::incomingSecureConnectionModified(HbAction *action)
hgs
parents: 62
diff changeset
   721
{
hgs
parents: 62
diff changeset
   722
    if(action->text() == hbTrId("txt_common_button_ok") &&
hgs
parents: 62
diff changeset
   723
       mSelectedPopupRadioButtonIndex >=0) {
hgs
parents: 62
diff changeset
   724
       mSettingsHelper->incomingSecureConnectionItemChange(mSelectedPopupRadioButtonIndex);
hgs
parents: 62
diff changeset
   725
    }
hgs
parents: 62
diff changeset
   726
    mSelectedPopupRadioButtonIndex = -1;
62
hgs
parents: 57
diff changeset
   727
}
68
hgs
parents: 62
diff changeset
   728
62
hgs
parents: 57
diff changeset
   729
/*!
68
hgs
parents: 62
diff changeset
   730
Handles incoming port modifications.
hgs
parents: 62
diff changeset
   731
hgs
parents: 62
diff changeset
   732
\param action Action that determines whether user clicked OK or cancel.
hgs
parents: 62
diff changeset
   733
*/
hgs
parents: 62
diff changeset
   734
void NmIpsSettingsPlugin::incomingPortModified(HbAction *action)
hgs
parents: 62
diff changeset
   735
{
hgs
parents: 62
diff changeset
   736
	if ((action->text() == hbTrId("txt_common_button_ok")) &&
hgs
parents: 62
diff changeset
   737
		(mSelectedPopupRadioButtonIndex == IpsServices::NmIpsSettingsDefault ||
hgs
parents: 62
diff changeset
   738
		 mSelectedPopupRadioButtonIndex == IpsServices::NmIpsSettingsUserDefined)) {
hgs
parents: 62
diff changeset
   739
	       mSettingsHelper->incomingPortChange(mSelectedPopupRadioButtonIndex);
hgs
parents: 62
diff changeset
   740
	    }
hgs
parents: 62
diff changeset
   741
	mSelectedPopupRadioButtonIndex = -1;
hgs
parents: 62
diff changeset
   742
}
hgs
parents: 62
diff changeset
   743
hgs
parents: 62
diff changeset
   744
/*!
hgs
parents: 62
diff changeset
   745
Handles outgoing secure connection modifications.
hgs
parents: 62
diff changeset
   746
hgs
parents: 62
diff changeset
   747
\param action Action that determines whether user clicked OK or cancel.
hgs
parents: 62
diff changeset
   748
*/
hgs
parents: 62
diff changeset
   749
void NmIpsSettingsPlugin::outgoingSecureConnectionModified(HbAction *action)
hgs
parents: 62
diff changeset
   750
{
hgs
parents: 62
diff changeset
   751
	if (action->text() == hbTrId("txt_common_button_ok") &&
hgs
parents: 62
diff changeset
   752
		mSelectedPopupRadioButtonIndex >= 0) {
hgs
parents: 62
diff changeset
   753
		       mSettingsHelper->outgoingSecureConnectionItemChange(mSelectedPopupRadioButtonIndex);
hgs
parents: 62
diff changeset
   754
		}
hgs
parents: 62
diff changeset
   755
	mSelectedPopupRadioButtonIndex = -1;
hgs
parents: 62
diff changeset
   756
}
43
hgs
parents: 23
diff changeset
   757
68
hgs
parents: 62
diff changeset
   758
/*!
hgs
parents: 62
diff changeset
   759
Handles outgoing port modifications.
hgs
parents: 62
diff changeset
   760
hgs
parents: 62
diff changeset
   761
\param action Action that determines whether user clicked OK or cancel.
hgs
parents: 62
diff changeset
   762
*/
hgs
parents: 62
diff changeset
   763
void NmIpsSettingsPlugin::outgoingPortModified(HbAction *action)
hgs
parents: 62
diff changeset
   764
{
hgs
parents: 62
diff changeset
   765
	if ((action->text() == hbTrId("txt_common_button_ok")) &&
hgs
parents: 62
diff changeset
   766
		(mSelectedPopupRadioButtonIndex == IpsServices::NmIpsSettingsDefault ||
hgs
parents: 62
diff changeset
   767
		 mSelectedPopupRadioButtonIndex == IpsServices::NmIpsSettingsUserDefined)) {
hgs
parents: 62
diff changeset
   768
	       mSettingsHelper->outgoingPortChange(mSelectedPopupRadioButtonIndex);
hgs
parents: 62
diff changeset
   769
	    }
hgs
parents: 62
diff changeset
   770
	mSelectedPopupRadioButtonIndex = -1;
hgs
parents: 62
diff changeset
   771
}
hgs
parents: 62
diff changeset
   772
hgs
parents: 62
diff changeset
   773
/*!
hgs
parents: 62
diff changeset
   774
Handles outgoing authentication modifications.
hgs
parents: 62
diff changeset
   775
hgs
parents: 62
diff changeset
   776
\param action Action that determines whether user clicked OK or cancel.
hgs
parents: 62
diff changeset
   777
*/
hgs
parents: 62
diff changeset
   778
void NmIpsSettingsPlugin::outgoingAuthenticationModified(HbAction *action)
hgs
parents: 62
diff changeset
   779
{
hgs
parents: 62
diff changeset
   780
	if (action->text() == hbTrId("txt_common_button_ok") &&
hgs
parents: 62
diff changeset
   781
		mSelectedPopupRadioButtonIndex >= 0) {
hgs
parents: 62
diff changeset
   782
	       mSettingsHelper->outgoingAuthenticationChange(mSelectedPopupRadioButtonIndex);
hgs
parents: 62
diff changeset
   783
	    }
hgs
parents: 62
diff changeset
   784
	mSelectedPopupRadioButtonIndex = -1;
hgs
parents: 62
diff changeset
   785
}
hgs
parents: 62
diff changeset
   786
hgs
parents: 62
diff changeset
   787
/*!
hgs
parents: 62
diff changeset
   788
Handles folder path modifications.
hgs
parents: 62
diff changeset
   789
hgs
parents: 62
diff changeset
   790
\param action Action that determines whether user clicked OK or cancel.
hgs
parents: 62
diff changeset
   791
*/
hgs
parents: 62
diff changeset
   792
void NmIpsSettingsPlugin::folderPathModified(HbAction *action)
hgs
parents: 62
diff changeset
   793
{
hgs
parents: 62
diff changeset
   794
	if ((action->text() == hbTrId("txt_common_button_ok")) &&
hgs
parents: 62
diff changeset
   795
		(mSelectedPopupRadioButtonIndex == IpsServices::NmIpsSettingsDefault ||
hgs
parents: 62
diff changeset
   796
		 mSelectedPopupRadioButtonIndex == IpsServices::NmIpsSettingsUserDefined)) {
hgs
parents: 62
diff changeset
   797
	       mSettingsHelper->folderPathChange(mSelectedPopupRadioButtonIndex);
hgs
parents: 62
diff changeset
   798
	    }
hgs
parents: 62
diff changeset
   799
	mSelectedPopupRadioButtonIndex = -1;
hgs
parents: 62
diff changeset
   800
}
hgs
parents: 62
diff changeset
   801
hgs
parents: 62
diff changeset
   802
/*!
62
hgs
parents: 57
diff changeset
   803
hgs
parents: 57
diff changeset
   804
\param index The index value of the selection.
hgs
parents: 57
diff changeset
   805
*/
68
hgs
parents: 62
diff changeset
   806
void NmIpsSettingsPlugin::popupRadioButtonIndexModified(int index)
62
hgs
parents: 57
diff changeset
   807
{
68
hgs
parents: 62
diff changeset
   808
    mSelectedPopupRadioButtonIndex = index;
18
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   809
}
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   810
578830873419 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   811
Q_EXPORT_PLUGIN2(nmipssettings, NmIpsSettingsPlugin);