Backport r950340 | aacid | 2009-04-06 23:21:18 +0200 (Mon, 06 Apr 2009) | 4 lines
[kdepim.git] / kmail / folderdialogquotatab_p.cpp
blobbcb5cd22f5d90be9601071ab224920c16c3c92d9
1 /**
2 * folderdialogquotatab_p.cpp
4 * Copyright (c) 2006 Till Adam <adam@kde.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * In addition, as a special exception, the copyright holders give
21 * permission to link the code of this program with any edition of
22 * the Qt library by Trolltech AS, Norway (or with modified versions
23 * of Qt that use the same license as Qt), and distribute linked
24 * combinations including the two. You must obey the GNU General
25 * Public License in all respects for all of the code used other than
26 * Qt. If you modify this file, you may extend this exception to
27 * your version of the file, but you are not obligated to do so. If
28 * you do not wish to do so, delete this exception statement from
29 * your version.
32 #include "folderdialogquotatab_p.h"
34 #include <qlayout.h>
35 #include <qlabel.h>
36 #include <qprogressbar.h>
37 #include <qwhatsthis.h>
38 #include <qcombobox.h>
40 #include <math.h>
42 #include "kmkernel.h"
43 #include "klocale.h"
44 #include "kconfig.h"
45 #include "kdebug.h"
46 #include "kdialog.h"
47 #include "globalsettings.h"
48 #include "quotajobs.h"
50 namespace KMail { class QuotaInfo; }
52 using namespace KMail;
54 QuotaWidget::QuotaWidget( QWidget* parent, const char* name )
55 :QWidget( parent )
57 setObjectName( name );
58 QVBoxLayout *box = new QVBoxLayout( this );
59 QWidget *stuff = new QWidget( this );
60 QGridLayout* layout = new QGridLayout( stuff );
61 layout->setMargin( KDialog::marginHint() );
62 layout->setSpacing( KDialog::spacingHint() );
63 mInfoLabel = new QLabel("", stuff );
64 mRootLabel = new QLabel("", stuff );
65 mProgressBar = new QProgressBar( stuff );
66 layout->addWidget( new QLabel( i18n("Root:" ), stuff ), 0, 0 );
67 layout->addWidget( mRootLabel, 0, 1 );
68 layout->addWidget( new QLabel( i18n("Usage:"), stuff ), 1, 0 );
69 //layout->addWidget( new QLabel( i18n("Status:"), stuff ), 2, 0 );
70 layout->addWidget( mInfoLabel, 1, 1 );
71 layout->addWidget( mProgressBar, 2, 1 );
72 box->addWidget( stuff );
73 box->addStretch( 2 );
76 void QuotaWidget::setQuotaInfo( const QuotaInfo& info )
78 // we are assuming only to get STORAGE type info here, thus
79 // casting to int is safe
80 int current = info.current().toInt();
81 int max = info.max().toInt();
82 mProgressBar->setMaximum( max );
83 mProgressBar->setValue( current );
84 mInfoLabel->setText( info.toString() );
85 mRootLabel->setText( info.root() );
89 #include "folderdialogquotatab_p.moc"