<commit_before>/*
 * This file is part of accounts-ui
 *
 * Copyright (C) 2009-2010 Nokia Corporation.
 *
 * Contact: <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * version 2.1 as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

//libAccounts
#include <Accounts/Provider>
#include <Accounts/Account>
#include <Accounts/ServiceType>
#include <Accounts/Manager>

//Meegotouch
#include <MLayout>
#include <MLinearLayoutPolicy>
#include <MContentItem>
#include <MLocale>
#include <MAction>
#include <MLabel>
#include <MGridLayoutPolicy>
#include <MSeparator>
#include <MImageWidget>
#include <MButton>

//Qt
#include <QDebug>

//Accounts-Ui
#include "account-setup-finished-page-priv.h"
#include "accountsmanagersingleton.h"
#include "last-page-actions.h"
#include "provider-plugin-process.h"
#include "account-setup-finished-widget.h"

namespace AccountsUI {

void AccountSetupFinishedPagePrivate::actionButtonClicked()
{
    QString serviceName = sender()->property("serviceName").toString();
    qDebug() << "Invoking service" << serviceName;
    LastPageActions::executeService(serviceName);
    ProviderPluginProcess::instance()->quit();
}

AccountSetupFinishedPage::AccountSetupFinishedPage(AbstractAccountSetupContext *context)
        : MApplicationPage(),
          d_ptr(new AccountSetupFinishedPagePrivate())
{
    Q_D(AccountSetupFinishedPage);
    d->q_ptr = this;
    d->account = context->account();
    d->serviceType = context->serviceType();
    setObjectName("wgAccountSetupFinishedPage");
    setStyleName("AccountsUiPage");
}

AccountSetupFinishedPage::~AccountSetupFinishedPage()
{
    delete d_ptr;
}

void AccountSetupFinishedPage::createContent()
{
    Q_D(AccountSetupFinishedPage);

    setComponentsDisplayMode(EscapeButton, MApplicationPageModel::Hide);

    MWidget *centralWidget = new MWidget();
    MLayout *layout = new MLayout(centralWidget);
    MLinearLayoutPolicy *layoutPolicy = new MLinearLayoutPolicy(layout, Qt::Vertical);
    layoutPolicy->setSpacing(0);

    QString providerName(d->account->providerName());
    // xml file that describes the ui elements for the provider
    Accounts::Provider *provider = AccountsManager::instance()->provider(providerName);
    if (provider) {
        QDomElement root = provider->domDocument().documentElement();
        QDomElement providerIcon = root.firstChildElement("icon");
        QString providerIconId = providerIcon.text();

        MContentItem *providerItem = new MContentItem(MContentItem::IconAndSingleTextLabel, this);
        providerItem->setStyleName("SetupFinishedProviderName");
        providerItem->setImageID(providerIconId);
        providerItem->setTitle(provider->displayName());
        layoutPolicy->addItem(providerItem);
    }

    MSeparator *separatorTop = new MSeparator(this);
    separatorTop->setOrientation(Qt::Horizontal);
    separatorTop->setStyleName("CommonItemDividerInverted");

    layoutPolicy->addItem(separatorTop);

    AccountSetupFinishedWidget *widget = new AccountSetupFinishedWidget(providerName, this);<commit_msg>Fixing: 229894 - Logical string qtn_mail_other_mailbox displayed in Account Setup Complete view<commit_after>/*
 * This file is part of accounts-ui
 *
 * Copyright (C) 2009-2010 Nokia Corporation.
 *
 * Contact: <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * version 2.1 as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

//libAccounts
#include <Accounts/Provider>
#include <Accounts/Account>
#include <Accounts/ServiceType>
#include <Accounts/Manager>

//Meegotouch
#include <MLayout>
#include <MLinearLayoutPolicy>
#include <MContentItem>
#include <MLocale>
#include <MAction>
#include <MLabel>
#include <MGridLayoutPolicy>
#include <MSeparator>
#include <MImageWidget>
#include <MButton>

//Qt
#include <QDebug>

//Accounts-Ui
#include "account-setup-finished-page-priv.h"
#include "accountsmanagersingleton.h"
#include "last-page-actions.h"
#include "provider-plugin-process.h"
#include "account-setup-finished-widget.h"

namespace AccountsUI {

void AccountSetupFinishedPagePrivate::actionButtonClicked()
{
    QString serviceName = sender()->property("serviceName").toString();
    qDebug() << "Invoking service" << serviceName;
    LastPageActions::executeService(serviceName);
    ProviderPluginProcess::instance()->quit();
}

AccountSetupFinishedPage::AccountSetupFinishedPage(AbstractAccountSetupContext *context)
        : MApplicationPage(),
          d_ptr(new AccountSetupFinishedPagePrivate())
{
    Q_D(AccountSetupFinishedPage);
    d->q_ptr = this;
    d->account = context->account();
    d->serviceType = context->serviceType();
    setObjectName("wgAccountSetupFinishedPage");
    setStyleName("AccountsUiPage");
}

AccountSetupFinishedPage::~AccountSetupFinishedPage()
{
    delete d_ptr;
}

void AccountSetupFinishedPage::createContent()
{
    Q_D(AccountSetupFinishedPage);

    setComponentsDisplayMode(EscapeButton, MApplicationPageModel::Hide);

    MWidget *centralWidget = new MWidget();
    MLayout *layout = new MLayout(centralWidget);
    MLinearLayoutPolicy *layoutPolicy = new MLinearLayoutPolicy(layout, Qt::Vertical);
    layoutPolicy->setSpacing(0);

    QString providerName(d->account->providerName());
    // xml file that describes the ui elements for the provider
    Accounts::Provider *provider = AccountsManager::instance()->provider(providerName);
    if (provider) {
        QDomElement root = provider->domDocument().documentElement();
        QDomElement providerIcon = root.firstChildElement("icon");
        QString catalog = provider->trCatalog();
        MLocale locale;
        if (!catalog.isEmpty() && !locale.isInstalledTrCatalog(catalog)) {
            locale.installTrCatalog(catalog);
            MLocale::setDefault(locale);
        }
        QString providerIconId = providerIcon.text();

        MContentItem *providerItem = new MContentItem(MContentItem::IconAndSingleTextLabel, this);
        providerItem->setStyleName("SetupFinishedProviderName");
        providerItem->setImageID(providerIconId);
        providerItem->setTitle(qtTrId(provider->displayName().toLatin1()));

        layoutPolicy->addItem(providerItem);
    }

    MSeparator *separatorTop = new MSeparator(this);
    separatorTop->setOrientation(Qt::Horizontal);
    separatorTop->setStyleName("CommonItemDividerInverted");

    layoutPolicy->addItem(separatorTop);

    AccountSetupFinishedWidget *widget = new AccountSetupFinishedWidget(providerName, this);
{'fraction_non_alphanumeric': 0.10810455799290687, 'fraction_numerical': 0.0066990673847366344, 'mean_word_length': 4.9069045771916215, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 80, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5442629', 'n_tokens_mistral': 2147, 'n_tokens_neox': 2085, 'n_words': 539}