HaikuDepot: Stub out various support classes for package kit use.
- DecisionProvider and JobStateListener will be needed in order to interact with the package kit in various ways eventually, though the implementations are currently all empty. - Adjust HaikuDepot's PackageManager class to inherit from BPackageManager, so as to be able to actually interface with the package repositories.
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Oliver Tappe <[email protected]>
|
||||||
|
* Copyright 2013, Rene Gollent, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "DecisionProvider.h"
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
DecisionProvider::YesNoDecisionNeeded(const BString& description,
|
||||||
|
const BString& question, const BString& yes, const BString& no,
|
||||||
|
const BString& defaultChoice)
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Oliver Tappe <[email protected]>
|
||||||
|
* Copyright 2013, Oliver Tappe <[email protected]>
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef DECISION_PROVIDER_H
|
||||||
|
#define DECISION_PROVIDER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <package/Context.h>
|
||||||
|
|
||||||
|
|
||||||
|
struct DecisionProvider : public BPackageKit::BDecisionProvider {
|
||||||
|
virtual bool YesNoDecisionNeeded(const BString& description,
|
||||||
|
const BString& question, const BString& yes, const BString& no,
|
||||||
|
const BString& defaultChoice);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // DECISION_PROVIDER_H
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
SubDir HAIKU_TOP src apps haiku-depot ;
|
SubDir HAIKU_TOP src apps haiku-depot ;
|
||||||
|
|
||||||
UsePrivateHeaders interface shared ;
|
UsePrivateHeaders interface shared package ;
|
||||||
|
|
||||||
# source directories
|
# source directories
|
||||||
local sourceDirs =
|
local sourceDirs =
|
||||||
@@ -33,7 +33,9 @@ Application HaikuDepot :
|
|||||||
App.cpp
|
App.cpp
|
||||||
BitmapButton.cpp
|
BitmapButton.cpp
|
||||||
BitmapView.cpp
|
BitmapView.cpp
|
||||||
|
DecisionProvider.cpp
|
||||||
FilterView.cpp
|
FilterView.cpp
|
||||||
|
JobStateListener.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
MainWindow.cpp
|
MainWindow.cpp
|
||||||
Model.cpp
|
Model.cpp
|
||||||
@@ -47,8 +49,8 @@ Application HaikuDepot :
|
|||||||
# text view stuff
|
# text view stuff
|
||||||
$(textDocumentSources)
|
$(textDocumentSources)
|
||||||
|
|
||||||
: be translation libcolumnlistview.a libshared.a $(TARGET_LIBSUPC++)
|
: be package translation libcolumnlistview.a libshared.a
|
||||||
localestub
|
$(TARGET_LIBSTDC++) $(TARGET_LIBSUPC++) localestub
|
||||||
: HaikuDepot.rdef
|
: HaikuDepot.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Oliver Tappe <[email protected]>
|
||||||
|
* Copyright 2013, Rene Gollent, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "JobStateListener.h"
|
||||||
|
|
||||||
|
|
||||||
|
using BPackageKit::BJob;
|
||||||
|
|
||||||
|
|
||||||
|
JobStateListener::JobStateListener()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
JobStateListener::JobStarted(BJob* job)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
JobStateListener::JobSucceeded(BJob* job)
|
||||||
|
{
|
||||||
|
// TODO: notify user
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
JobStateListener::JobFailed(BJob* job)
|
||||||
|
{
|
||||||
|
// TODO: notify user
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
JobStateListener::JobAborted(BJob* job)
|
||||||
|
{
|
||||||
|
// TODO: notify user
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Oliver Tappe <[email protected]>
|
||||||
|
* Copyright 2013, Rene Gollent, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef JOB_STATE_LISTENER_H
|
||||||
|
#define JOB_STATE_LISTENER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <package/Job.h>
|
||||||
|
|
||||||
|
|
||||||
|
class JobStateListener : public BPackageKit::BJobStateListener {
|
||||||
|
public:
|
||||||
|
JobStateListener();
|
||||||
|
|
||||||
|
virtual void JobStarted(BPackageKit::BJob* job);
|
||||||
|
virtual void JobSucceeded(BPackageKit::BJob* job);
|
||||||
|
virtual void JobFailed(BPackageKit::BJob* job);
|
||||||
|
virtual void JobAborted(BPackageKit::BJob* job);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // JOB_STATE_LISTENER_H
|
||||||
@@ -1,19 +1,34 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013, Stephan Aßmus <[email protected]>.
|
* Copyright 2013, Haiku, Inc. All Rights Reserved.
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Ingo Weinhold <[email protected]>
|
||||||
|
* Stephan Aßmus <[email protected]>
|
||||||
|
* Rene Gollent, reneGollent.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "PackageManager.h"
|
#include "PackageManager.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
|
||||||
|
#include <package/DownloadFileRequest.h>
|
||||||
|
#include <package/RefreshRepositoryRequest.h>
|
||||||
|
#include <package/solver/SolverPackage.h>
|
||||||
|
#include <package/solver/SolverProblem.h>
|
||||||
|
#include <package/solver/SolverProblemSolution.h>
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
#undef B_TRANSLATION_CONTEXT
|
||||||
#define B_TRANSLATION_CONTEXT "PackageManager"
|
#define B_TRANSLATION_CONTEXT "PackageManager"
|
||||||
|
|
||||||
|
|
||||||
|
using BPackageKit::BRefreshRepositoryRequest;
|
||||||
|
using BPackageKit::DownloadFileRequest;
|
||||||
|
using namespace BPackageKit::BPrivate;
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - PackageAction
|
// #pragma mark - PackageAction
|
||||||
|
|
||||||
|
|
||||||
@@ -56,8 +71,18 @@ public:
|
|||||||
// #pragma mark - PackageManager
|
// #pragma mark - PackageManager
|
||||||
|
|
||||||
|
|
||||||
PackageManager::PackageManager()
|
PackageManager::PackageManager(BPackageInstallationLocation location)
|
||||||
|
:
|
||||||
|
BPackageManager(location),
|
||||||
|
BPackageManager::UserInteractionHandler(),
|
||||||
|
fDecisionProvider(),
|
||||||
|
fJobStateListener(),
|
||||||
|
fContext(fDecisionProvider, fJobStateListener),
|
||||||
|
fClientInstallationInterface()
|
||||||
{
|
{
|
||||||
|
fInstallationInterface = &fClientInstallationInterface;
|
||||||
|
fRequestHandler = this;
|
||||||
|
fUserInteractionHandler = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -92,3 +117,69 @@ PackageManager::GetPackageActions(const PackageInfo& package)
|
|||||||
|
|
||||||
return actionList;
|
return actionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
PackageManager::RefreshRepository(const BRepositoryConfig& repoConfig)
|
||||||
|
{
|
||||||
|
return BRefreshRepositoryRequest(fContext, repoConfig).Process();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
PackageManager::DownloadPackage(const BString& fileURL,
|
||||||
|
const BEntry& targetEntry, const BString& checksum)
|
||||||
|
{
|
||||||
|
return DownloadFileRequest(fContext, fileURL, targetEntry, checksum)
|
||||||
|
.Process();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageManager::HandleProblems()
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageManager::ConfirmChanges(bool fromMostSpecific)
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageManager::Warn(status_t error, const char* format, ...)
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageManager::ProgressStartApplyingChanges(InstalledRepository& repository)
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageManager::ProgressTransactionCommitted(InstalledRepository& repository,
|
||||||
|
const char* transactionDirectoryName)
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageManager::ProgressApplyingChangesDone(InstalledRepository& repository)
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageManager::_PrintResult(InstalledRepository& installationRepository)
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013, Stephan Aßmus <[email protected]>.
|
* Copyright 2013, Stephan Aßmus <[email protected]>.
|
||||||
|
* Copyright 2011, Ingo Weinhold, <[email protected]>
|
||||||
|
* Copyright 2013, Rene Gollent, <[email protected]>
|
||||||
|
*
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef PACKAGE_MANAGER_H
|
#ifndef PACKAGE_MANAGER_H
|
||||||
#define PACKAGE_MANAGER_H
|
#define PACKAGE_MANAGER_H
|
||||||
|
|
||||||
|
#include <package/DaemonClient.h>
|
||||||
|
#include <package/manager/PackageManager.h>
|
||||||
|
|
||||||
|
#include "DecisionProvider.h"
|
||||||
|
#include "JobStateListener.h"
|
||||||
#include "PackageInfo.h"
|
#include "PackageInfo.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -32,15 +39,56 @@ private:
|
|||||||
typedef BReference<PackageAction> PackageActionRef;
|
typedef BReference<PackageAction> PackageActionRef;
|
||||||
typedef List<PackageActionRef, false> PackageActionList;
|
typedef List<PackageActionRef, false> PackageActionList;
|
||||||
|
|
||||||
|
using BPackageKit::BContext;
|
||||||
|
using BPackageKit::BPackageInstallationLocation;
|
||||||
|
using BPackageKit::BRepositoryConfig;
|
||||||
|
using BPackageKit::BPrivate::BDaemonClient;
|
||||||
|
using BPackageKit::BManager::BPrivate::BPackageManager;
|
||||||
|
|
||||||
class PackageManager {
|
|
||||||
|
class PackageManager : public BPackageManager,
|
||||||
|
private BPackageManager::RequestHandler,
|
||||||
|
private BPackageManager::UserInteractionHandler {
|
||||||
public:
|
public:
|
||||||
PackageManager();
|
PackageManager(
|
||||||
|
BPackageInstallationLocation location);
|
||||||
virtual ~PackageManager();
|
virtual ~PackageManager();
|
||||||
|
|
||||||
virtual PackageState GetPackageState(const PackageInfo& package);
|
virtual PackageState GetPackageState(const PackageInfo& package);
|
||||||
virtual PackageActionList GetPackageActions(const PackageInfo& package);
|
virtual PackageActionList GetPackageActions(const PackageInfo& package);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// RequestHandler
|
||||||
|
virtual status_t RefreshRepository(
|
||||||
|
const BRepositoryConfig& repoConfig);
|
||||||
|
virtual status_t DownloadPackage(const BString& fileURL,
|
||||||
|
const BEntry& targetEntry,
|
||||||
|
const BString& checksum);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// UserInteractionHandler
|
||||||
|
virtual void HandleProblems();
|
||||||
|
virtual void ConfirmChanges(bool fromMostSpecific);
|
||||||
|
|
||||||
|
virtual void Warn(status_t error, const char* format, ...);
|
||||||
|
virtual void ProgressStartApplyingChanges(
|
||||||
|
InstalledRepository& repository);
|
||||||
|
virtual void ProgressTransactionCommitted(
|
||||||
|
InstalledRepository& repository,
|
||||||
|
const char* transactionDirectoryName);
|
||||||
|
virtual void ProgressApplyingChangesDone(
|
||||||
|
InstalledRepository& repository);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void _PrintResult(InstalledRepository&
|
||||||
|
installationRepository);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DecisionProvider fDecisionProvider;
|
||||||
|
JobStateListener fJobStateListener;
|
||||||
|
BContext fContext;
|
||||||
|
BPackageManager::ClientInstallationInterface
|
||||||
|
fClientInstallationInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // PACKAGE_MANAGER_H
|
#endif // PACKAGE_MANAGER_H
|
||||||
|
|||||||
Reference in New Issue
Block a user