2 Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License, version 2, as
6 published by the Free Software Foundation.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License along
14 with this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #include "mboximporterinfogui.h"
19 #include "mboximportwidget.h"
21 #include "mailimporter/importmailswidget.h"
23 #include <KMessageBox>
25 #include <QListWidgetItem>
26 #include <QApplication>
28 MBoxImporterInfoGui::MBoxImporterInfoGui(MBoxImportWidget
*parent
)
29 : MailImporter::FilterInfoGui(),
34 MBoxImporterInfoGui::~MBoxImporterInfoGui()
38 void MBoxImporterInfoGui::setStatusMessage(const QString
&status
)
40 mParent
->mailWidget()->setStatusMessage(status
);
43 void MBoxImporterInfoGui::setFrom(const QString
&from
)
45 mParent
->mailWidget()->setFrom(from
);
48 void MBoxImporterInfoGui::setTo(const QString
&to
)
50 mParent
->mailWidget()->setTo(to
);
53 void MBoxImporterInfoGui::setCurrent(const QString
¤t
)
55 mParent
->mailWidget()->setCurrent(current
);
56 qApp
->processEvents();
59 void MBoxImporterInfoGui::setCurrent(int percent
)
61 mParent
->mailWidget()->setCurrent(percent
);
62 qApp
->processEvents(); // Be careful - back & finish buttons disabled, so only user event that can happen is cancel/close button
65 void MBoxImporterInfoGui::setOverall(int percent
)
67 mParent
->mailWidget()->setOverall(percent
);
70 void MBoxImporterInfoGui::addInfoLogEntry(const QString
&log
)
72 QListWidgetItem
*item
= new QListWidgetItem(log
);
73 item
->setForeground(Qt::blue
);
74 mParent
->mailWidget()->addItem(item
);
75 mParent
->mailWidget()->setLastCurrentItem();
76 qApp
->processEvents();
79 void MBoxImporterInfoGui::addErrorLogEntry(const QString
&log
)
81 QListWidgetItem
*item
= new QListWidgetItem(log
);
82 item
->setForeground(Qt::red
);
83 mParent
->mailWidget()->addItem(item
);
84 mParent
->mailWidget()->setLastCurrentItem();
85 qApp
->processEvents();
88 void MBoxImporterInfoGui::clear()
90 mParent
->mailWidget()->clear();
93 void MBoxImporterInfoGui::alert(const QString
&message
)
95 KMessageBox::information(mParent
, message
);
98 QWidget
*MBoxImporterInfoGui::parent() const