~ubuntu-branches/ubuntu/oneiric/kdepim/oneiric-updates

« back to all changes in this revision

Viewing changes to libkdepim/statusbarprogresswidget.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-06-28 19:33:24 UTC
  • mfrom: (0.2.13) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20110628193324-8yvjs8sdv9rdoo6c
Tags: 4:4.7.0-0ubuntu1
* New upstream release
  - update install files
  - add missing kdepim-doc package to control file
  - Fix Vcs lines
  - kontact breaks/replaces korganizer << 4:4.6.80
  - tighten the dependency of kdepim-dev on libkdepim4 to fix lintian error

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
45
45
#include <KLocale>
46
46
#include <KIconLoader>
 
47
#include <KDebug>
47
48
 
48
49
#include <QEvent>
49
50
#include <QFrame>
60
61
//-----------------------------------------------------------------------------
61
62
StatusbarProgressWidget::StatusbarProgressWidget( ProgressDialog* progressDialog, QWidget* parent, bool button )
62
63
  : QFrame( parent ), mCurrentItem( 0 ), mProgressDialog( progressDialog ),
63
 
    mDelayTimer( 0 ), mBusyTimer( 0 )
 
64
    mDelayTimer( 0 ), mBusyTimer( 0 ), mCleanTimer( 0 )
64
65
{
65
66
  m_bShowButton = button;
66
67
  int w = fontMetrics().width( " 999.9 kB/s 00:00:01 " ) + 8;
71
72
  m_pButton = new QPushButton( this );
72
73
  m_pButton->setSizePolicy( QSizePolicy( QSizePolicy::Minimum,
73
74
                                         QSizePolicy::Minimum ) );
74
 
  m_pButton->setIcon( SmallIcon( "go-up" ) );
 
75
  QPixmap smallIcon = SmallIcon( "go-up" );
 
76
  m_pButton->setIcon( smallIcon );
75
77
  box->addWidget( m_pButton  );
76
78
  stack = new QStackedWidget( this );
77
 
  stack->setMaximumHeight( fontMetrics().height() );
 
79
  int maximumHeight = qMax( smallIcon.height(), fontMetrics().height() );
 
80
  stack->setMaximumHeight( maximumHeight );
78
81
  box->addWidget( stack );
79
82
 
80
83
  m_sslLabel = new SSLLabel( this );
92
95
  m_pLabel->installEventFilter( this );
93
96
  m_pLabel->setMinimumWidth( w );
94
97
  stack->insertWidget( 2, m_pLabel );
95
 
  m_pButton->setMaximumHeight( fontMetrics().height() );
 
98
  m_pButton->setMaximumHeight( maximumHeight );
96
99
  setMinimumWidth( minimumSizeHint().width() );
97
100
 
98
101
  mode = None;
112
115
            this, SLOT( slotProgressDialogVisible( bool ) ) );
113
116
 
114
117
  mDelayTimer = new QTimer( this );
 
118
  mDelayTimer->setSingleShot( true );
115
119
  connect ( mDelayTimer, SIGNAL( timeout() ),
116
120
            this, SLOT( slotShowItemDelayed() ) );
 
121
 
 
122
  mCleanTimer = new QTimer( this );
 
123
  mCleanTimer->setSingleShot( true );
 
124
  connect ( mCleanTimer, SIGNAL(timeout()),
 
125
            this, SLOT(slotClean()) );
117
126
}
118
127
 
119
128
// There are three cases: no progressitem, one progressitem (connect to it directly),
127
136
  if ( mCurrentItem ) { // Exactly one item
128
137
    delete mBusyTimer;
129
138
    mBusyTimer = 0;
130
 
    mDelayTimer->setSingleShot( true );
131
139
    mDelayTimer->start( 1000 );
132
140
  }
133
141
  else { // N items
135
143
      mBusyTimer = new QTimer( this );
136
144
      connect( mBusyTimer, SIGNAL( timeout() ),
137
145
               this, SLOT( slotBusyIndicator() ) );
138
 
      mDelayTimer->setSingleShot( true );
139
146
      mDelayTimer->start( 1000 );
140
147
    }
141
148
  }
155
162
  connectSingleItem(); // if going back to 1 item
156
163
  if ( ProgressManager::instance()->isEmpty() ) { // No item
157
164
    // Done. In 5s the progress-widget will close, then we can clean up the statusbar
158
 
    QTimer::singleShot( 5000, this, SLOT( slotClean() ) );
 
165
    mCleanTimer->start( 5000 );
159
166
  } else if ( mCurrentItem ) { // Exactly one item
160
167
    delete mBusyTimer;
161
168
    mBusyTimer = 0;
212
219
void StatusbarProgressWidget::slotProgressItemProgress( ProgressItem *item, unsigned int value )
213
220
{
214
221
  Q_ASSERT( item == mCurrentItem); // the only one we should be connected to
 
222
  Q_UNUSED( item );
215
223
  m_pProgressBar->setValue( value );
216
224
}
217
225