kmail

folderdiaquotatab_p.cpp

00001 
00032 #include "folderdiaquotatab_p.h"
00033 
00034 #include <tqlayout.h>
00035 #include <tqlabel.h>
00036 #include <tqprogressbar.h>
00037 #include <tqwhatsthis.h>
00038 #include <tqcombobox.h>
00039 
00040 #include <math.h>
00041 
00042 #include "kmkernel.h"
00043 #include "klocale.h"
00044 #include "kconfig.h"
00045 #include "kdebug.h"
00046 #include "kdialog.h"
00047 #include "globalsettings.h"
00048 #include "quotajobs.h"
00049 
00050 using namespace KMail;
00051 
00052 struct QuotaInfo;
00053 
00054 QuotaWidget::QuotaWidget( TQWidget* parent, const char* name )
00055         :TQWidget( parent, name )
00056 {
00057       TQVBoxLayout *box = new TQVBoxLayout(this);
00058       TQWidget *stuff = new TQWidget( this );
00059       TQGridLayout* layout =
00060           new TQGridLayout( stuff, 3, 3,
00061                            KDialog::marginHint(),
00062                            KDialog::spacingHint() );
00063       mInfoLabel = new TQLabel("", stuff );
00064       mRootLabel = new TQLabel("", stuff );
00065       mProgressBar = new TQProgressBar( stuff );
00066       layout->addWidget( new TQLabel( i18n("Root:" ), stuff ), 0, 0 );
00067       layout->addWidget( mRootLabel, 0, 1 );
00068       layout->addWidget( new TQLabel( i18n("Usage:"), stuff ), 1, 0 );
00069       //layout->addWidget( new TQLabel( i18n("Status:"), stuff ), 2, 0 );
00070       layout->addWidget( mInfoLabel, 1, 1 );
00071       layout->addWidget( mProgressBar, 2, 1 );
00072       box->addWidget( stuff );
00073       box->addStretch( 2 );
00074 }
00075 
00076 void QuotaWidget::setQuotaInfo( const QuotaInfo& info )
00077 {
00078       // we are assuming only to get STORAGE type info here, thus
00079       // casting to int is safe
00080       int current = info.current().toInt();
00081       int max = info.max().toInt();
00082       mProgressBar->setProgress( current, max );
00083       mInfoLabel->setText( info.toString() );
00084       mRootLabel->setText( info.root() );
00085 }
00086 
00087 
00088 #include "folderdiaquotatab_p.moc"