|
|
|
@ -29,7 +29,7 @@ using namespace std;
|
|
|
|
|
|
|
|
|
|
namespace adept {
|
|
|
|
|
|
|
|
|
|
AcqtqStatus::Item::Item (KListView *parent, pkgAcquire::ItemDesc &item, bool hit)
|
|
|
|
|
AcqStatus::Item::Item (KListView *parent, pkgAcquire::ItemDesc &item, bool hit)
|
|
|
|
|
: KListViewItem( parent )
|
|
|
|
|
{
|
|
|
|
|
m_pbcol = 0;
|
|
|
|
@ -50,19 +50,19 @@ AcqtqStatus::Item::Item (KListView *parent, pkgAcquire::ItemDesc &item, bool hit
|
|
|
|
|
// /* TQString (Itm . Owner -> ID) + */ TQString (Itm.Description . c_str ()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AcqtqStatus::Item::~Item ()
|
|
|
|
|
AcqStatus::Item::~Item ()
|
|
|
|
|
{
|
|
|
|
|
delete m_prog;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int AcqtqStatus::Item::compare (TQListViewItem *i, int /*col*/, bool /*ascend*/) const
|
|
|
|
|
int AcqStatus::Item::compare (TQListViewItem *i, int /*col*/, bool /*ascend*/) const
|
|
|
|
|
{
|
|
|
|
|
int id1 = m_id;
|
|
|
|
|
int id2 = ((Item *) i) -> m_id;
|
|
|
|
|
return (id2 >= id1) - (id2 <= id1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AcqtqStatus::Item::pulse (pkgAcquire::Worker *w)
|
|
|
|
|
void AcqStatus::Item::pulse (pkgAcquire::Worker *w)
|
|
|
|
|
{
|
|
|
|
|
if (w) {
|
|
|
|
|
if (w->TotalSize)
|
|
|
|
@ -74,12 +74,12 @@ void AcqtqStatus::Item::pulse (pkgAcquire::Worker *w)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AcqtqStatus::Item::settqStatus( const std::string &s, int i )
|
|
|
|
|
void AcqStatus::Item::settqStatus( const std::string &s, int i )
|
|
|
|
|
{
|
|
|
|
|
m_prog->settqStatus( s, i );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AcqtqStatus::Item::paintCell (TQPainter *p, const TQColorGroup &cg,
|
|
|
|
|
void AcqStatus::Item::paintCell (TQPainter *p, const TQColorGroup &cg,
|
|
|
|
|
int column, int width, int tqalignment )
|
|
|
|
|
{
|
|
|
|
|
TQColorGroup _cg( cg );
|
|
|
|
@ -100,7 +100,7 @@ void AcqtqStatus::Item::paintCell (TQPainter *p, const TQColorGroup &cg,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AcqtqStatus::Item *AcqtqStatus::findItem (pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
AcqStatus::Item *AcqStatus::findItem (pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
{
|
|
|
|
|
if ( Itm.Owner->ID < m_idOffset )
|
|
|
|
|
return 0;
|
|
|
|
@ -109,7 +109,7 @@ AcqtqStatus::Item *AcqtqStatus::findItem (pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
return m_items[ Itm.Owner->ID - m_idOffset ];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AcqtqStatus::AcqtqStatus(TQWidget *parent, const char *name)
|
|
|
|
|
AcqStatus::AcqStatus(TQWidget *parent, const char *name)
|
|
|
|
|
: KListView (parent, name), m_idOffset( 0 ), m_continue( true )
|
|
|
|
|
{
|
|
|
|
|
// m_lastItem = 0;
|
|
|
|
@ -122,7 +122,7 @@ AcqtqStatus::AcqtqStatus(TQWidget *parent, const char *name)
|
|
|
|
|
ID = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AcqtqStatus::Done (pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
void AcqStatus::Done (pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
{
|
|
|
|
|
Item *i = findItem (Itm);
|
|
|
|
|
if (i) {
|
|
|
|
@ -133,14 +133,14 @@ void AcqtqStatus::Done (pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
KApplication::kApplication()->processEvents();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AcqtqStatus::clear()
|
|
|
|
|
void AcqStatus::clear()
|
|
|
|
|
{
|
|
|
|
|
KListView::clear();
|
|
|
|
|
m_idOffset += m_items.size();
|
|
|
|
|
m_items.clear(); // got deleted by klistview already
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AcqtqStatus::Start()
|
|
|
|
|
void AcqStatus::Start()
|
|
|
|
|
{
|
|
|
|
|
clear();
|
|
|
|
|
pkgAcquireStatus::Start();
|
|
|
|
@ -151,7 +151,7 @@ void AcqtqStatus::Start()
|
|
|
|
|
KApplication::kApplication()->processEvents();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AcqtqStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
void AcqStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
{
|
|
|
|
|
Itm.Owner->ID = ID++;
|
|
|
|
|
Item *i = new Item( this, Itm, true );
|
|
|
|
@ -164,7 +164,7 @@ void AcqtqStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
KApplication::kApplication()->processEvents();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void AcqtqStatus::Fetch(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
void AcqStatus::Fetch(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
// an item started to download
|
|
|
|
|
{
|
|
|
|
|
Update = true;
|
|
|
|
@ -183,7 +183,7 @@ void AcqtqStatus::Fetch(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
KApplication::kApplication()->processEvents();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void AcqtqStatus::Fail(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
void AcqStatus::Fail(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
// item failed to download
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "fail, status = " << Itm.Owner->tqStatus
|
|
|
|
@ -208,7 +208,7 @@ void AcqtqStatus::Fail(pkgAcquire::ItemDesc &Itm)
|
|
|
|
|
KApplication::kApplication()->processEvents();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void AcqtqStatus::Stop()
|
|
|
|
|
void AcqStatus::Stop()
|
|
|
|
|
{
|
|
|
|
|
pkgAcquireStatus::Stop();
|
|
|
|
|
emit statusChanged( StDone );
|
|
|
|
@ -216,7 +216,7 @@ void AcqtqStatus::Stop()
|
|
|
|
|
KApplication::kApplication()->processEvents();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AcqtqStatus::Pulse(pkgAcquire *Owner)
|
|
|
|
|
bool AcqStatus::Pulse(pkgAcquire *Owner)
|
|
|
|
|
{
|
|
|
|
|
pkgAcquireStatus::Pulse(Owner);
|
|
|
|
|
|
|
|
|
@ -248,7 +248,7 @@ bool AcqtqStatus::Pulse(pkgAcquire *Owner)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AcqtqStatus::MediaChange(string Media,string Drive)
|
|
|
|
|
bool AcqStatus::MediaChange(string Media,string Drive)
|
|
|
|
|
{
|
|
|
|
|
int res = KMessageBox::warningContinueCancel(
|
|
|
|
|
this, i18n( "Please insert the disc "
|
|
|
|
@ -261,7 +261,7 @@ bool AcqtqStatus::MediaChange(string Media,string Drive)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AcqtqStatus::cancel()
|
|
|
|
|
void AcqStatus::cancel()
|
|
|
|
|
{
|
|
|
|
|
m_continue = false;
|
|
|
|
|
}
|
|
|
|
@ -271,20 +271,20 @@ AcqStatusDialog::AcqStatusDialog (TQWidget *parent, const char *name, bool modal
|
|
|
|
|
u8( "progress dialog (FIXME: waiting for headers, done)" ),
|
|
|
|
|
Ok|Cancel, Cancel, true )
|
|
|
|
|
{
|
|
|
|
|
m_status = new AcqtqStatus (this, "");
|
|
|
|
|
m_status = new AcqStatus (this, "");
|
|
|
|
|
setMainWidget( m_status.data() );
|
|
|
|
|
enableButton (Ok, false);
|
|
|
|
|
connect (m_status.data(), TQT_SIGNAL (statusChanged (AcqtqStatus::tqStatus)),
|
|
|
|
|
this, TQT_SLOT (statusChange (AcqtqStatus::tqStatus)));
|
|
|
|
|
connect (m_status.data(), TQT_SIGNAL (statusChanged (AcqStatus::tqStatus)),
|
|
|
|
|
this, TQT_SLOT (statusChange (AcqStatus::tqStatus)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AcqStatusDialog::statusChange (AcqtqStatus::tqStatus st)
|
|
|
|
|
void AcqStatusDialog::statusChange (AcqStatus::tqStatus st)
|
|
|
|
|
{
|
|
|
|
|
if (st == AcqtqStatus::StDownloading || st == AcqtqStatus::StWaiting) {
|
|
|
|
|
if (st == AcqStatus::StDownloading || st == AcqStatus::StWaiting) {
|
|
|
|
|
enableButton (Ok, false);
|
|
|
|
|
// XXX: cancel should be true; but needs implementation first
|
|
|
|
|
enableButton (Cancel, false);
|
|
|
|
|
} else if (st == AcqtqStatus::StDone) {
|
|
|
|
|
} else if (st == AcqStatus::StDone) {
|
|
|
|
|
enableButton (Ok, true);
|
|
|
|
|
enableButton (Cancel, false);
|
|
|
|
|
}
|
|
|
|
|