Chat-O-Matic/libs/libdownload/QueueFileDownload.cpp

55 lines
903 B
C++
Raw Normal View History

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);
if (!ad)
return;
2010-07-10 08:37:58 -05:00
ad->SetLooper(fLooper, fMsg);
}
2010-07-10 08:37:58 -05:00
void
QueueFileDownload::ActionPerformed(Action* action, status_t state, BMessage* msg)
{
ActionDownload* ad = dynamic_cast<ActionDownload*>(action);
if (!ad)
return;
2010-07-10 08:37:58 -05:00
BMessage notify(*msg);
notify.what = fMsg;
if (fLooper)
BMessenger(fLooper).SendMessage(&notify);
return;
}
2010-07-10 08:37:58 -05:00
void
QueueFileDownload::SuppressAction(Action* action)
{
ActionDownload* ad = dynamic_cast<ActionDownload*>(action);
if (!ad)
return;
2010-07-10 08:37:58 -05:00
ad->SetShouldStop(true);
}
//--