haiku/src/apps/poorman/PoorManApplication.cpp
Jonas Sundström 11c7ff531a Removing most About windows and menu items as discussed here
http://www.freelists.org/post/haiku-commits/r40968-in-haikutrunksrcapps-activitymonitor-bootmanager-charactermap-codycam-deskbar,3
Leaving them for now in replicants, and in Terminal, according to (my interpretation of) the instructions here
http://dev.haiku-os.org/browser/haiku/trunk/src/apps/terminal/README.GPL_to_OBOS#L70
Some sporadic cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41108 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-26 02:18:52 +00:00

78 lines
1.5 KiB
C++

/* PoorManApplication.cpp
*
* Philip Harrison
* Started: 4/25/2004
* Version: 0.1
*/
#include "PoorManApplication.h"
#include <Application.h>
#include <Alert.h>
#include <Catalog.h>
#include <Directory.h>
#include "constants.h"
#include "PoorManWindow.h"
PoorManApplication::PoorManApplication()
: BApplication(STR_APP_SIG),
mainWindow(NULL)
{
BRect mainRect(82.0f, 30.0f, 400.0f, 350.0f);
mainWindow = new PoorManWindow(mainRect);
mainWindow->Hide();
mainWindow->Show();
BDirectory webDir;
if (mainWindow->ReadSettings() != B_OK) {
if (webDir.SetTo(STR_DEFAULT_WEB_DIRECTORY) != B_OK)
mainWindow->DefaultSettings();
else
PostMessage(kStartServer);
} else {
if (webDir.SetTo(mainWindow->WebDir()) != B_OK)
mainWindow->DefaultSettings();
else
PostMessage(kStartServer);
}
}
void
PoorManApplication::MessageReceived(BMessage *message)
{
switch (message->what) {
case MSG_FILE_PANEL_SELECT_WEB_DIR:
mainWindow->MessageReceived(message);
break;
case kStartServer:
mainWindow->StartServer();
mainWindow->SetDirLabel(mainWindow->WebDir());
mainWindow->Show();
break;
case B_CANCEL: {
BDirectory webDir;
if (mainWindow->ReadSettings() != B_OK) {
if (webDir.SetTo(STR_DEFAULT_WEB_DIRECTORY) != B_OK)
mainWindow->DefaultSettings();
else
mainWindow->StartServer();
} else {
if (webDir.SetTo(mainWindow->WebDir()) != B_OK)
mainWindow->DefaultSettings();
else
mainWindow->StartServer();
}
}
break;
default:
BApplication::MessageReceived(message);
}
}