[haiku-commits] r41243 - haiku/trunk/src/add-ons/input_server/devices/keyboard

  • From: jonas@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 12 Apr 2011 20:31:07 +0200 (CEST)

Author: kirilla
Date: 2011-04-12 20:31:07 +0200 (Tue, 12 Apr 2011)
New Revision: 41243
Changeset: https://dev.haiku-os.org/changeset/41243

Added:
   haiku/trunk/src/add-ons/input_server/devices/keyboard/Keyboard.rdef
Modified:
   haiku/trunk/src/add-ons/input_server/devices/keyboard/Jamfile
   haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp
   haiku/trunk/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp
   haiku/trunk/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.cpp
Log:
Localization. Cleanup.
CID 6338, 6339, 8912 - Replace strcpy with strlcpy.
CID 9523 - Initialize class member.

Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/Jamfile
===================================================================
--- haiku/trunk/src/add-ons/input_server/devices/keyboard/Jamfile       
2011-04-12 18:10:02 UTC (rev 41242)
+++ haiku/trunk/src/add-ons/input_server/devices/keyboard/Jamfile       
2011-04-12 18:31:07 UTC (rev 41243)
@@ -5,6 +5,8 @@
 UsePrivateHeaders input interface shared tracker ;
 UsePrivateSystemHeaders ;
 
+AddResources <input>keyboard : Keyboard.rdef ;
+
 Addon <input>keyboard :
        KeyboardInputDevice.cpp
        Keymap.cpp
@@ -12,8 +14,15 @@
        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
+;
+

Added: haiku/trunk/src/add-ons/input_server/devices/keyboard/Keyboard.rdef
===================================================================
--- haiku/trunk/src/add-ons/input_server/devices/keyboard/Keyboard.rdef         
                (rev 0)
+++ haiku/trunk/src/add-ons/input_server/devices/keyboard/Keyboard.rdef 
2011-04-12 18:31:07 UTC (rev 41243)
@@ -0,0 +1,2 @@
+
+resource app_signature "application/x-vnd.Haiku-KeyboardInputServerDevice" ;

Modified: 
haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp
===================================================================
--- 
haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp   
    2011-04-12 18:10:02 UTC (rev 41242)
+++ 
haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp   
    2011-04-12 18:31:07 UTC (rev 41243)
@@ -137,7 +137,7 @@
 {
        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;

Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp
===================================================================
--- haiku/trunk/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp      
2011-04-12 18:10:02 UTC (rev 41242)
+++ haiku/trunk/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp      
2011-04-12 18:31:07 UTC (rev 41243)
@@ -24,7 +24,8 @@
        :
        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 @@
 bool
 TeamListItem::IsApplication()
 {
-       if (fAppSignature.Length() > 0)
-               return true;
-       else
-               return false;
+       return !fAppSignature.IsEmpty();
 }

Modified: 
haiku/trunk/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.cpp
===================================================================
--- haiku/trunk/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.cpp 
2011-04-12 18:10:02 UTC (rev 41242)
+++ haiku/trunk/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.cpp 
2011-04-12 18:31:07 UTC (rev 41243)
@@ -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 @@
 
 
 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 @@
        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 @@
        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 @@
        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 @@
        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 @@
 
                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 @@
 
 
 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 @@
 */
        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 @@
                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 @@
                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);


Other related posts:

  • » [haiku-commits] r41243 - haiku/trunk/src/add-ons/input_server/devices/keyboard - jonas