Localization. Cleanup.

CID 6338, 6339, 8912 - Replace strcpy with strlcpy.
CID 9523 - Initialize class member.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41243 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström 2011-04-12 18:31:07 +00:00
parent b2d9843906
commit 924253e4ff
5 changed files with 40 additions and 20 deletions

View File

@ -5,6 +5,8 @@ SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders input interface shared tracker ;
UsePrivateSystemHeaders ;
AddResources <input>keyboard : Keyboard.rdef ;
Addon <input>keyboard :
KeyboardInputDevice.cpp
Keymap.cpp
@ -12,8 +14,15 @@ Addon <input>keyboard :
TeamMonitorWindow.cpp
TeamListItem.cpp
: input_server be libshared.a $(TARGET_LIBSUPC++) ;
: input_server be libshared.a $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) ;
Package haiku-inputkit-cvs :
<input>keyboard :
boot home config add-ons input_server devices ;
DoCatalogs <input>keyboard :
x-vnd.Haiku-KeyboardInputServerDevice
:
TeamMonitorWindow.cpp
;

View File

@ -0,0 +1,2 @@
resource app_signature "application/x-vnd.Haiku-KeyboardInputServerDevice" ;

View File

@ -137,7 +137,7 @@ KeyboardDevice::KeyboardDevice(KeyboardInputDevice* owner, const char* path)
{
KD_CALLED();
strcpy(fPath, path);
strlcpy(fPath, path, B_PATH_NAME_LENGTH);
fDeviceRef.name = get_short_name(path);
fDeviceRef.type = B_KEYBOARD_DEVICE;
fDeviceRef.cookie = this;

View File

@ -24,7 +24,8 @@ TeamListItem::TeamListItem(team_info &tinfo)
:
fInfo(tinfo),
fIcon(BRect(0, 0, 15, 15), B_RGBA32),
fLargeIcon(BRect(0, 0, 31, 31), B_RGBA32)
fLargeIcon(BRect(0, 0, 31, 31), B_RGBA32),
fFound(false)
{
int32 cookie = 0;
image_info info;
@ -156,8 +157,5 @@ TeamListItem::IsSystemServer()
bool
TeamListItem::IsApplication()
{
if (fAppSignature.Length() > 0)
return true;
else
return false;
return !fAppSignature.IsEmpty();
}

View File

@ -14,6 +14,7 @@
#include <stdio.h>
#include <CardLayout.h>
#include <Catalog.h>
#include <GroupLayout.h>
#include <GroupView.h>
#include <Message.h>
@ -32,6 +33,10 @@
#include "TeamListItem.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Team Monitor"
class TeamDescriptionView : public BBox {
public:
TeamDescriptionView();
@ -67,7 +72,8 @@ static const uint32 kMsgRebootTick = 'TMrt';
TeamMonitorWindow::TeamMonitorWindow()
: BWindow(BRect(0, 0, 350, 300), "Team Monitor",
:
BWindow(BRect(0, 0, 350, 300), B_TRANSLATE("Team Monitor"),
B_TITLED_WINDOW_LOOK, B_MODAL_ALL_WINDOW_FEEL,
B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS
| B_CLOSE_ON_ESCAPE,
@ -93,12 +99,12 @@ TeamMonitorWindow::TeamMonitorWindow()
BGroupView* groupView = new BGroupView(B_HORIZONTAL);
layout->AddView(groupView);
fKillButton = new BButton("kill", "Kill Application",
fKillButton = new BButton("kill", B_TRANSLATE("Kill Application"),
new BMessage(TM_KILL_APPLICATION));
groupView->AddChild(fKillButton);
fKillButton->SetEnabled(false);
fQuitButton = new BButton("quit", "Quit Application",
fQuitButton = new BButton("quit", B_TRANSLATE("Quit Application"),
new BMessage(TM_QUIT_APPLICATION));
groupView->AddChild(fQuitButton);
fQuitButton->SetEnabled(false);
@ -111,7 +117,7 @@ TeamMonitorWindow::TeamMonitorWindow()
groupView = new BGroupView(B_HORIZONTAL);
layout->AddView(groupView);
BButton* forceReboot = new BButton("force", "Force Reboot",
BButton* forceReboot = new BButton("force", B_TRANSLATE("Force Reboot"),
new BMessage(TM_FORCE_REBOOT));
groupView->GroupLayout()->AddView(forceReboot);
@ -119,7 +125,7 @@ TeamMonitorWindow::TeamMonitorWindow()
glue->SetExplicitMinSize(BSize(inset, -1));
groupView->GroupLayout()->AddItem(glue);
fRestartButton = new BButton("restart", "Restart the Desktop",
fRestartButton = new BButton("restart", B_TRANSLATE("Restart the Desktop"),
new BMessage(TM_RESTART_DESKTOP));
SetDefaultButton(fRestartButton);
groupView->GroupLayout()->AddView(fRestartButton);
@ -128,7 +134,7 @@ TeamMonitorWindow::TeamMonitorWindow()
glue->SetExplicitMinSize(BSize(inset, -1));
groupView->GroupLayout()->AddItem(glue);
fCancelButton = new BButton("cancel", "Cancel",
fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
new BMessage(TM_CANCEL));
SetDefaultButton(fCancelButton);
groupView->GroupLayout()->AddView(fCancelButton);
@ -269,7 +275,8 @@ TeamMonitorWindow::UpdateList()
bool found = false;
for (int32 i = 0; i < fListView->CountItems(); i++) {
TeamListItem* item = dynamic_cast<TeamListItem*>(fListView->ItemAt(i));
TeamListItem* item
= dynamic_cast<TeamListItem*>(fListView->ItemAt(i));
if (item != NULL && item->GetInfo()->team == info.team) {
item->SetFound(true);
found = true;
@ -345,7 +352,8 @@ TeamMonitorWindow::Disable()
TeamDescriptionView::TeamDescriptionView()
: BBox("description view", B_WILL_DRAW | B_PULSE_NEEDED, B_NO_BORDER),
:
BBox("description view", B_WILL_DRAW | B_PULSE_NEEDED, B_NO_BORDER),
fItem(NULL),
fSeconds(4),
fRebootRunner(NULL)
@ -362,9 +370,12 @@ TeamDescriptionView::TeamDescriptionView()
*/
SetFont(be_plain_font);
fText[0] = "Select an application from the list above and click the";
fText[1] = "\"Kill Application\" button in order to close it.";
fText[2] = "Hold CONTROL+ALT+DELETE for %ld seconds to reboot.";
fText[0] = B_TRANSLATE(
"Select an application from the list above and click the");
fText[1] = B_TRANSLATE(
"\"Kill Application\" button in order to close it.");
fText[2] = B_TRANSLATE(
"Hold CONTROL+ALT+DELETE for %ld seconds to reboot.");
float width, height;
GetPreferredSize(&width, &height);
@ -448,7 +459,7 @@ TeamDescriptionView::Draw(BRect rect)
if (fItem->IsSystemServer()) {
line.y += height;
//SetFont(be_bold_font);
DrawString("(This team is a system component)", line);
DrawString(B_TRANSLATE("(This team is a system component)"), line);
//SetFont(be_plain_font);
}
} else {
@ -463,7 +474,7 @@ TeamDescriptionView::Draw(BRect rect)
if (fSeconds >= 0)
snprintf(text, sizeof(text), fText[2], fSeconds);
else
strcpy(text, "Booom!");
strlcpy(text, B_TRANSLATE("Booom!"), sizeof(text));
line.y += height;
DrawString(text, line);