SVN_SILENT made messages (.desktop file)
[kdepim.git] / storageservicemanager / storageserviceaccountinfodialog.cpp
blob48a210221b7721483fab3270321485aa9ed9c00a
1 /*
2 Copyright (c) 2014-2015 Montel Laurent <montel@kde.org>
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.
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.
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.
21 #include "storageserviceaccountinfodialog.h"
22 #include "PimCommon/StorageServiceAbstract"
24 #include <KLocalizedString>
26 #include <QVBoxLayout>
27 #include <QGroupBox>
28 #include <QLabel>
29 #include <KFormat>
30 #include <KConfigGroup>
31 #include <QDialogButtonBox>
32 #include <QPushButton>
34 StorageServiceAccountInfoDialog::StorageServiceAccountInfoDialog(const QString &serviceName, const PimCommon::AccountInfo &accountInfo, QWidget *parent)
35 : QDialog(parent)
37 setWindowTitle(i18n("Account Info"));
38 QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
39 QVBoxLayout *mainLayout = new QVBoxLayout;
40 setLayout(mainLayout);
41 connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
43 QGroupBox *grp = new QGroupBox(serviceName);
44 mainLayout->addWidget(grp);
45 mainLayout->addWidget(buttonBox);
47 QVBoxLayout *vbox = new QVBoxLayout;
48 grp->setLayout(vbox);
49 if (accountInfo.isValid()) {
50 if (accountInfo.accountSize >= 0) {
51 vbox->addWidget(new QLabel(i18n("Size: %1", KFormat().formatByteSize(accountInfo.accountSize, 1))));
53 if (accountInfo.quota >= 0) {
54 vbox->addWidget(new QLabel(i18n("Quota: %1", KFormat().formatByteSize(accountInfo.quota, 1))));
56 if (accountInfo.shared >= 0) {
57 vbox->addWidget(new QLabel(i18n("Shared: %1", KFormat().formatByteSize(accountInfo.shared, 1))));
59 } else {
60 QLabel *lab = new QLabel(i18n("Unable to get account information."));
61 QFont font = lab->font();
62 font.setBold(true);
63 lab->setFont(font);
64 vbox->addWidget(lab);
68 StorageServiceAccountInfoDialog::~StorageServiceAccountInfoDialog()