* Copyright 2020, Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
* Copyright 2015, Axel DΓΆrfler <axeld@pinc-software.de>
* Copyright 2009, Stephan AΓmus <superstippi@gmx.de>
* Copyright 2005, JΓ©rΓ΄me DUVAL.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include "InstallerApp.h"
#include <unistd.h>
#include <Alert.h>
#include <Roster.h>
#include <TextView.h>
#include <syscalls.h>
#include "tracker_private.h"
#include "Utility.h"
static const uint32 kMsgAgree = 'agre';
static const uint32 kMsgNext = 'next';
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "InstallerApp"
int main(int, char **)
{
InstallerApp installer;
installer.Run();
return 0;
}
InstallerApp::InstallerApp()
:
BApplication("application/x-vnd.Haiku-Installer")
{
}
void
InstallerApp::MessageReceived(BMessage* message)
{
switch (message->what) {
case kMsgAgree:
fEULAWindow->PostMessage(B_QUIT_REQUESTED);
break;
case kMsgNext:
new InstallerWindow();
break;
default:
BApplication::MessageReceived(message);
}
}
void
InstallerApp::ReadyToRun()
{
#if 1
fEULAWindow = new EULAWindow();
#else
new InstallerWindow();
#endif
}
void
InstallerApp::Quit()
{
BApplication::Quit();
if (!be_roster->IsRunning(kDeskbarSignature)) {
if (CurrentMessage()->GetBool("install_complete")) {
sync();
if (Utility::IsReadOnlyVolume("/boot")) {
Utility::BlockMedia("/boot", false);
Utility::EjectMedia("/boot");
}
_kern_shutdown(true);
} else {
be_roster->Launch("application/x-vnd.Haiku-FirstBootPrompt");
}
}
}