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