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
21 #include "storageserviceaccountinfodialog.h"
22 #include "PimCommon/StorageServiceAbstract"
24 #include <KLocalizedString>
26 #include <QVBoxLayout>
30 #include <KConfigGroup>
31 #include <QDialogButtonBox>
32 #include <QPushButton>
34 StorageServiceAccountInfoDialog::StorageServiceAccountInfoDialog(const QString
&serviceName
, const PimCommon::AccountInfo
&accountInfo
, QWidget
*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
;
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))));
60 QLabel
*lab
= new QLabel(i18n("Unable to get account information."));
61 QFont font
= lab
->font();
68 StorageServiceAccountInfoDialog::~StorageServiceAccountInfoDialog()