Version 2.15
[accounts-sso:libaccounts-ui.git] / lib / AccountsUI / account-setup-finished-page.cpp
1 /*
2  * This file is part of accounts-ui
3  *
4  * Copyright (C) 2009-2010 Nokia Corporation.
5  *
6  * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * version 2.1 as published by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22
23 //libAccounts
24 #include <Accounts/Provider>
25 #include <Accounts/Account>
26 #include <Accounts/ServiceType>
27 #include <Accounts/Manager>
28
29 //Meegotouch
30 #include <MLayout>
31 #include <MLinearLayoutPolicy>
32 #include <MPannableViewport>
33 #include <MPositionIndicator>
34
35 //Qt
36 #include <QDebug>
37
38 //Accounts-Ui
39 #include "account-setup-finished-page-priv.h"
40 #include "accountsmanagersingleton.h"
41 #include "last-page-actions.h"
42 #include "provider-plugin-process.h"
43 #include "account-setup-finished-widget.h"
44
45 namespace AccountsUI {
46
47 AccountSetupFinishedPage::AccountSetupFinishedPage(AbstractAccountSetupContext *context)
48         : MApplicationPage(),
49           d_ptr(new AccountSetupFinishedPagePrivate())
50 {
51     Q_D(AccountSetupFinishedPage);
52     d->q_ptr = this;
53     d->account = context->account();
54     d->serviceType = context->serviceType();
55     setObjectName("wgAccountSetupFinishedPage");
56     setStyleName("AccountsUiPage");
57     pannableViewport()->positionIndicator()->setStyleName("CommonPositionIndicatorInverted");
58     AccountsUI::ProviderPluginProcess::instance()->setSetupComplete(true);
59 }
60
61 AccountSetupFinishedPage::~AccountSetupFinishedPage()
62 {
63     delete d_ptr;
64 }
65
66 void AccountSetupFinishedPage::createContent()
67 {
68     Q_D(AccountSetupFinishedPage);
69
70     setComponentsDisplayMode(EscapeButton, MApplicationPageModel::Hide);
71
72     MWidget *centralWidget = new MWidget();
73     MLayout *layout = new MLayout(centralWidget);
74     MLinearLayoutPolicy *layoutPolicy = new MLinearLayoutPolicy(layout, Qt::Vertical);
75     layoutPolicy->setSpacing(0);
76
77     AccountSetupFinishedWidget *widget = new AccountSetupFinishedWidget(d->account->providerName(), this);
78     layoutPolicy->addItem(widget);
79     setCentralWidget(centralWidget);
80 }
81
82 void AccountSetupFinishedPage::goToApplication()
83 {
84     /* this slot is deprecated */
85 }
86
87 }