2011-01-22 01:18:58 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2011, Haiku, Inc.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2011-01-25 20:07:27 +03:00
|
|
|
#ifndef _PACKAGE__CONTEXT_H_
|
|
|
|
#define _PACKAGE__CONTEXT_H_
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
#include <Entry.h>
|
|
|
|
#include <String.h>
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
namespace BPackageKit {
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
class BJobStateListener;
|
|
|
|
namespace BPrivate {
|
|
|
|
class TempfileManager;
|
|
|
|
}
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
struct BDecisionProvider {
|
|
|
|
virtual ~BDecisionProvider();
|
2011-01-22 22:30:21 +03:00
|
|
|
|
|
|
|
virtual bool YesNoDecisionNeeded(const BString& description,
|
|
|
|
const BString& question,
|
|
|
|
const BString& yes, const BString& no,
|
|
|
|
const BString& defaultChoice) = 0;
|
|
|
|
// virtual bool ActionsAcceptanceDecisionNeeded(
|
|
|
|
// const BString& description,
|
|
|
|
// const BString& question) = 0;
|
|
|
|
// virtual int32 ChoiceDecisionNeeded(
|
|
|
|
// const BString& question) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
class BContext {
|
2011-01-22 01:18:58 +03:00
|
|
|
public:
|
2011-01-25 20:07:27 +03:00
|
|
|
BContext(BDecisionProvider& decisionProvider,
|
|
|
|
BJobStateListener& jobStateListener);
|
|
|
|
~BContext();
|
2011-01-22 01:18:58 +03:00
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
status_t InitCheck() const;
|
2011-01-22 01:18:58 +03:00
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
status_t GetNewTempfile(const BString& baseName,
|
|
|
|
BEntry* entry) const;
|
2011-01-22 22:30:21 +03:00
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
BDecisionProvider& DecisionProvider() const;
|
|
|
|
BJobStateListener& JobStateListener() const;
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
private:
|
2011-01-25 20:07:27 +03:00
|
|
|
status_t _Initialize();
|
2011-01-22 01:18:58 +03:00
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
BDecisionProvider& fDecisionProvider;
|
|
|
|
BJobStateListener& fJobStateListener;
|
|
|
|
status_t fInitStatus;
|
|
|
|
|
|
|
|
mutable BPrivate::TempfileManager* fTempfileManager;
|
|
|
|
};
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
} // namespace BPackageKit
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
#endif // _PACKAGE__CONTEXT_H_
|