git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18989 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-10-03 09:19:04 +00:00
parent 0e9f724cf8
commit 0b77c8eb4f

View File

@ -1,28 +1,10 @@
//------------------------------------------------------------------------------ /*
// Copyright (c) 2001-2004, Haiku * Copyright 2001-2006, Haiku.
// * Distributed under the terms of the MIT License.
// Permission is hereby granted, free of charge, to any person obtaining a *
// copy of this software and associated documentation files (the "Software"), * Authors:
// to deal in the Software without restriction, including without limitation * Marc Flerackers (mflerackers@androme.be)
// the rights to use, copy, modify, merge, publish, distribute, sublicense, */
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: ZombieReplicantView.cpp
// Author: Marc Flerackers (mflerackers@androme.be)
// Description: Class for Zombie replicants
//------------------------------------------------------------------------------
#include <Alert.h> #include <Alert.h>
#include <Message.h> #include <Message.h>
@ -33,14 +15,17 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <new>
const static rgb_color kZombieColor = {220, 220, 220, 255}; const static rgb_color kZombieColor = {220, 220, 220, 255};
_BZombieReplicantView_::_BZombieReplicantView_(BRect frame, status_t error)
: BBox(frame, "<Zombie>", B_FOLLOW_NONE, B_WILL_DRAW)
{
fError = error;
_BZombieReplicantView_::_BZombieReplicantView_(BRect frame, status_t error)
:
BBox(frame, "<Zombie>", B_FOLLOW_NONE, B_WILL_DRAW),
fError(error)
{
BFont font(be_bold_font); BFont font(be_bold_font);
font.SetSize(9.0f); // TODO font.SetSize(9.0f); // TODO
SetFont(&font); SetFont(&font);
@ -59,20 +44,23 @@ _BZombieReplicantView_::MessageReceived(BMessage *msg)
switch (msg->what) { switch (msg->what) {
case B_ABOUT_REQUESTED: case B_ABOUT_REQUESTED:
{ {
const char *add_on = NULL; const char *addOn = NULL;
char description[B_MIME_TYPE_LENGTH]; char description[B_MIME_TYPE_LENGTH];
if (fArchive->FindString("add_on", &add_on) == B_OK) { if (fArchive->FindString("add_on", &addOn) == B_OK) {
BMimeType type(add_on); BMimeType type(addOn);
type.GetShortDescription(description); type.GetShortDescription(description);
} }
char error[1024]; char error[1024];
snprintf(error, sizeof(error),
sprintf(error, "Can't create the \"%s\" replicant because the library is in the Trash. (%s)", "Can't create the \"%s\" replicant because the library is in the Trash. (%s)",
description, strerror(fError)); description, strerror(fError));
(new BAlert("Error", error, "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); BAlert *alert = new (nothrow) BAlert("Error", error, "OK", NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT);
if (alert != NULL)
alert->Go();
break; break;
} }