1/*
2 Copyright (c) 2009 Volker Krause <vkrause@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#include "setuppage.h"
21
22#include <qstandarditemmodel.h>
23
24SetupPage::SetupPage(KAssistantDialog* parent) :
25 Page(parent),
26 m_msgModel( new QStandardItemModel( this ) )
27{
28 ui.setupUi( this );
29 ui.detailView->setModel( m_msgModel );
30 connect( ui.detailsButton, SIGNAL(clicked()), SLOT(detailsClicked()) );
31}
32
33void SetupPage::enterPageNext()
34{
35 ui.stackWidget->setCurrentIndex( 0 );
36}
37
38void SetupPage::detailsClicked()
39{
40 ui.stackWidget->setCurrentIndex( 1 );
41}
42
43void SetupPage::addMessage(SetupPage::MessageType type, const QString& msg)
44{
45 QStandardItem *item = new QStandardItem;
46 item->setText( msg );
47 item->setEditable( false );
48 switch ( type ) {
49 case Success:
50 item->setIcon( KIcon( QLatin1String("dialog-ok") ) );
51 break;
52 case Info:
53 item->setIcon( KIcon( QLatin1String("dialog-information" )) );
54 break;
55 case Error:
56 item->setIcon( KIcon( QLatin1String("dialog-error") ) );
57 break;
58 }
59 m_msgModel->appendRow( item );
60}
61
62void SetupPage::setStatus(const QString& msg)
63{
64 ui.progressLabel->setText( msg );
65}
66
67void SetupPage::setProgress(int percent)
68{
69 ui.progressBar->setValue( percent );
70}
71
72