1 /* 2 * Copyright 2013-2017, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Ingo Weinhold <ingo_weinhold@gmx.de> 7 * Rene Gollent <rene@gollent.com> 8 * Brian Hill <supernova@tycho.email> 9 */ 10 #ifndef CHECK_MANAGER_H 11 #define CHECK_MANAGER_H 12 13 14 #include <Bitmap.h> 15 16 #include <package/DaemonClient.h> 17 #include <package/manager/PackageManager.h> 18 19 #include "constants.h" 20 #include "SoftwareUpdaterWindow.h" 21 22 class ProblemWindow; 23 24 //using namespace BPackageKit; 25 using BPackageKit::BPackageInstallationLocation; 26 using BPackageKit::BPrivate::BDaemonClient; 27 using BPackageKit::BManager::BPrivate::BPackageManager; 28 29 30 class CheckManager : public BPackageManager, 31 private BPackageManager::UserInteractionHandler { 32 public: 33 CheckManager( 34 BPackageInstallationLocation location, 35 bool verbose); 36 37 void CheckNetworkConnection(); 38 virtual void JobFailed(BSupportKit::BJob* job); 39 virtual void JobAborted(BSupportKit::BJob* job); 40 void NoUpdatesNotification(); 41 42 private: 43 // UserInteractionHandler 44 virtual void HandleProblems(); 45 virtual void ConfirmChanges(bool fromMostSpecific); 46 virtual void Warn(status_t error, const char* format, ...); 47 48 virtual void ProgressPackageDownloadStarted( 49 const char* packageName); 50 virtual void ProgressPackageDownloadActive( 51 const char* packageName, 52 float completionPercentage, 53 off_t bytes, off_t totalBytes); 54 virtual void ProgressPackageDownloadComplete( 55 const char* packageName); 56 virtual void ProgressPackageChecksumStarted( 57 const char* packageName); 58 virtual void ProgressPackageChecksumComplete( 59 const char* packageName); 60 61 private: 62 void _CountUpdates(InstalledRepository& 63 installationRepository, 64 int32& updateCount); 65 void _SendNotification(const char* title, 66 const char* text); 67 68 private: 69 BPackageManager::ClientInstallationInterface 70 fClientInstallationInterface; 71 72 ProblemWindow* fProblemWindow; 73 bool fVerbose; 74 BString fNotificationId; 75 BString fHeaderChecking; 76 BString fTextContacting; 77 }; 78 79 80 #endif // CHECK_MANAGER_H 81