|
|
|
@ -34,7 +34,7 @@ AcqStatus::Item::Item (KListView *parent, pkgAcquire::ItemDesc &item, bool hit)
|
|
|
|
|
{
|
|
|
|
|
m_pbcol = 0;
|
|
|
|
|
m_prog = new ItemProgress( 0, 0 );
|
|
|
|
|
m_prog->setStatus( "waiting" );
|
|
|
|
|
m_prog->settqStatus( "waiting" );
|
|
|
|
|
m_prog->setTotalSteps( 100 );
|
|
|
|
|
m_item = item;
|
|
|
|
|
m_id = m_item.Owner->ID;
|
|
|
|
@ -43,9 +43,9 @@ AcqStatus::Item::Item (KListView *parent, pkgAcquire::ItemDesc &item, bool hit)
|
|
|
|
|
setText( 1, u8( item.Description ) );
|
|
|
|
|
// cerr << "create: id = " << item . Owner -> ID << ", myId = " << m_item . Owner -> ID << endl;
|
|
|
|
|
if (hit) {
|
|
|
|
|
m_prog->setStatus( "hit" );
|
|
|
|
|
m_prog->settqStatus( "hit" );
|
|
|
|
|
} else
|
|
|
|
|
m_prog->setStatus( "waiting" );
|
|
|
|
|
m_prog->settqStatus( "waiting" );
|
|
|
|
|
// TQString (SizeToStr (Itm.Owner -> FileSize) . c_str ()) + TQString ("B"),
|
|
|
|
|
// /* TQString (Itm . Owner -> ID) + */ TQString (Itm.Description . c_str ()));
|
|
|
|
|
}
|
|
|
|
@ -66,21 +66,21 @@ void AcqStatus::Item::pulse (pkgAcquire::Worker *w)
|
|
|
|
|
{
|
|
|
|
|
if (w) {
|
|
|
|
|
if (w->TotalSize)
|
|
|
|
|
setStatus( "progress", long( double(
|
|
|
|
|
settqStatus( "progress", long( double(
|
|
|
|
|
w -> CurrentSize * 100.0)
|
|
|
|
|
/ double( w->TotalSize ) ) );
|
|
|
|
|
else
|
|
|
|
|
setStatus( "downloading", 0 );
|
|
|
|
|
settqStatus( "downloading", 0 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AcqStatus::Item::setStatus( const std::string &s, int i )
|
|
|
|
|
void AcqStatus::Item::settqStatus( const std::string &s, int i )
|
|
|
|
|
{
|
|
|
|
|
m_prog->setStatus( s, i );
|
|
|
|
|
m_prog->settqStatus( s, i );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AcqStatus::Item::paintCell (TQPainter *p, const TQColorGroup &cg,
|
|
|
|
|
int column, int width, int alignment )
|
|
|
|
|
int column, int width, int tqalignment )
|
|
|
|
|
{
|
|
|
|
|
TQColorGroup _cg( cg );
|
|
|
|
|
TQColor c = _cg.text();
|
|
|
|
@ -95,7 +95,7 @@ void AcqStatus::Item::paintCell (TQPainter *p, const TQColorGroup &cg,
|
|
|
|
|
TQPixmap pm( width, height() );
|
|
|
|
|
TQPainter _p( &pm );
|
|
|
|
|
_cg.setColor( TQColorGroup::Text, c );
|
|
|
|
|
KListViewItem::paintCell( &_p, _cg, column, width, alignment );
|
|
|
|
|
KListViewItem::paintCell( &_p, _cg, column, width, tqalignment );
|
|
|
|
|
p->drawPixmap( 0, 0, pm );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -126,7 +126,7 @@ void AcqStatus::Done (pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
{
|
|
|
|
|
Item *i = findItem (Itm);
|
|
|
|
|
if (i) {
|
|
|
|
|
i->setStatus( "done" );
|
|
|
|
|
i->settqStatus( "done" );
|
|
|
|
|
}
|
|
|
|
|
emit statusChanged( StWaiting );
|
|
|
|
|
triggerUpdate();
|
|
|
|
@ -156,7 +156,7 @@ void AcqStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
Itm.Owner->ID = ID++;
|
|
|
|
|
Item *i = new Item( this, Itm, true );
|
|
|
|
|
// ensureItemVisible( i );
|
|
|
|
|
i->setStatus( "hit" );
|
|
|
|
|
i->settqStatus( "hit" );
|
|
|
|
|
m_items.push_back( i );
|
|
|
|
|
|
|
|
|
|
kdDebug() << "imshit called on ID = " << ID - 1 << " i = " << (void *)i << endl;
|
|
|
|
@ -186,10 +186,10 @@ void AcqStatus::Fetch(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
void AcqStatus::Fail(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
// item failed to download
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "fail, status = " << Itm.Owner->Status
|
|
|
|
|
kdDebug() << "fail, status = " << Itm.Owner->tqStatus
|
|
|
|
|
<< " ID = " << Itm.Owner->ID << endl;
|
|
|
|
|
// Ignore certain kinds of transient failures (bad code)
|
|
|
|
|
if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) {
|
|
|
|
|
if (Itm.Owner->tqStatus == pkgAcquire::Item::StatIdle) {
|
|
|
|
|
kdDebug() << "fail with StatIdle, ignoring" << endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -198,10 +198,10 @@ void AcqStatus::Fail(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
kdDebug() << "fail, i = " << i << endl;
|
|
|
|
|
if (! i)
|
|
|
|
|
return;
|
|
|
|
|
if (Itm.Owner->Status == pkgAcquire::Item::StatDone) {
|
|
|
|
|
i->setStatus( "ignored" );
|
|
|
|
|
if (Itm.Owner->tqStatus == pkgAcquire::Item::StatDone) {
|
|
|
|
|
i->settqStatus( "ignored" );
|
|
|
|
|
} else {
|
|
|
|
|
i->setStatus( "error" );
|
|
|
|
|
i->settqStatus( "error" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
triggerUpdate();
|
|
|
|
@ -230,7 +230,7 @@ bool AcqStatus::Pulse(pkgAcquire *Owner)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
triggerUpdate ();
|
|
|
|
|
// repaint ();
|
|
|
|
|
// tqrepaint ();
|
|
|
|
|
|
|
|
|
|
if (TotalBytes > 0)
|
|
|
|
|
emit totalProgress(
|
|
|
|
@ -253,8 +253,8 @@ bool AcqStatus::MediaChange(string Media,string Drive)
|
|
|
|
|
int res = KMessageBox::warningContinueCancel(
|
|
|
|
|
this, i18n( "Please insert the disc "
|
|
|
|
|
"labeled '%1' in the drive "
|
|
|
|
|
"'%2' and press enter" ).arg(
|
|
|
|
|
u8( Media ) ).arg( u8( Drive ) ),
|
|
|
|
|
"'%2' and press enter" ).tqarg(
|
|
|
|
|
u8( Media ) ).tqarg( u8( Drive ) ),
|
|
|
|
|
i18n( "Media Change" ) );
|
|
|
|
|
if ( res == KMessageBox::Cancel )
|
|
|
|
|
cancel();
|
|
|
|
@ -274,11 +274,11 @@ AcqStatusDialog::AcqStatusDialog (TQWidget *parent, const char *name, bool modal
|
|
|
|
|
m_status = new AcqStatus (this, "");
|
|
|
|
|
setMainWidget( m_status.data() );
|
|
|
|
|
enableButton (Ok, false);
|
|
|
|
|
connect (m_status.data(), TQT_SIGNAL (statusChanged (AcqStatus::Status)),
|
|
|
|
|
this, TQT_SLOT (statusChange (AcqStatus::Status)));
|
|
|
|
|
connect (m_status.data(), TQT_SIGNAL (statusChanged (AcqStatus::tqStatus)),
|
|
|
|
|
this, TQT_SLOT (statusChange (AcqStatus::tqStatus)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AcqStatusDialog::statusChange (AcqStatus::Status st)
|
|
|
|
|
void AcqStatusDialog::statusChange (AcqStatus::tqStatus st)
|
|
|
|
|
{
|
|
|
|
|
if (st == AcqStatus::StDownloading || st == AcqStatus::StWaiting) {
|
|
|
|
|
enableButton (Ok, false);
|
|
|
|
|