2010-07-10 08:37:58 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2010, Andrea Anzani. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Andrea Anzani, andrea.anzani@gmail.com
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "QueueFileDownload.h"
|
|
|
|
#include "ActionDownload.h"
|
|
|
|
#include "Messenger.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
QueueFileDownload::ActionReadyToPerform(Action* action)
|
|
|
|
{
|
|
|
|
ActionDownload* ad = dynamic_cast<ActionDownload*>(action);
|
2013-01-04 07:52:14 -06:00
|
|
|
if (!ad)
|
|
|
|
return;
|
2010-07-10 08:37:58 -05:00
|
|
|
|
|
|
|
ad->SetLooper(fLooper, fMsg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-01-04 07:52:14 -06:00
|
|
|
|
2010-07-10 08:37:58 -05:00
|
|
|
void
|
|
|
|
QueueFileDownload::ActionPerformed(Action* action, status_t state, BMessage* msg)
|
|
|
|
{
|
|
|
|
|
|
|
|
ActionDownload* ad = dynamic_cast<ActionDownload*>(action);
|
2013-01-04 07:52:14 -06:00
|
|
|
if (!ad)
|
|
|
|
return;
|
2010-07-10 08:37:58 -05:00
|
|
|
|
|
|
|
BMessage notify(*msg);
|
|
|
|
notify.what = fMsg;
|
|
|
|
|
|
|
|
if (fLooper)
|
|
|
|
BMessenger(fLooper).SendMessage(¬ify);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-01-04 07:52:14 -06:00
|
|
|
|
2010-07-10 08:37:58 -05:00
|
|
|
void
|
|
|
|
QueueFileDownload::SuppressAction(Action* action)
|
|
|
|
{
|
|
|
|
ActionDownload* ad = dynamic_cast<ActionDownload*>(action);
|
2013-01-04 07:52:14 -06:00
|
|
|
if (!ad)
|
|
|
|
return;
|
2010-07-10 08:37:58 -05:00
|
|
|
|
|
|
|
ad->SetShouldStop(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--
|
|
|
|
|