Localize FileTypes.
It does not use the layout kit yet, so the tranlation doesn't look perfect. Anyone willing to update it ? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36252 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -16,8 +16,10 @@
|
|||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <ListView.h>
|
#include <ListView.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
@@ -36,6 +38,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "Application Type Window"
|
||||||
|
|
||||||
|
|
||||||
const uint32 kMsgSave = 'save';
|
const uint32 kMsgSave = 'save';
|
||||||
const uint32 kMsgSignatureChanged = 'sgch';
|
const uint32 kMsgSignatureChanged = 'sgch';
|
||||||
const uint32 kMsgToggleAppFlags = 'tglf';
|
const uint32 kMsgToggleAppFlags = 'tglf';
|
||||||
@@ -229,7 +235,7 @@ SupportedTypeListView::AcceptsDrag(const BMessage* message)
|
|||||||
|
|
||||||
ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entry)
|
ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entry)
|
||||||
: BWindow(BRect(0.0f, 0.0f, 250.0f, 340.0f).OffsetBySelf(position),
|
: BWindow(BRect(0.0f, 0.0f, 250.0f, 340.0f).OffsetBySelf(position),
|
||||||
"Application Type", B_TITLED_WINDOW,
|
TR("Application Type"), B_TITLED_WINDOW,
|
||||||
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS),
|
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS),
|
||||||
fChangedProperties(0)
|
fChangedProperties(0)
|
||||||
{
|
{
|
||||||
@@ -238,17 +244,17 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entr
|
|||||||
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
|
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
|
||||||
AddChild(menuBar);
|
AddChild(menuBar);
|
||||||
|
|
||||||
BMenu* menu = new BMenu("File");
|
BMenu* menu = new BMenu(TR("File"));
|
||||||
fSaveMenuItem = new BMenuItem("Save", new BMessage(kMsgSave), 'S');
|
fSaveMenuItem = new BMenuItem(TR("Save"), new BMessage(kMsgSave), 'S');
|
||||||
fSaveMenuItem->SetEnabled(false);
|
fSaveMenuItem->SetEnabled(false);
|
||||||
menu->AddItem(fSaveMenuItem);
|
menu->AddItem(fSaveMenuItem);
|
||||||
BMenuItem* item;
|
BMenuItem* item;
|
||||||
menu->AddItem(item = new BMenuItem("Save into resource file" B_UTF8_ELLIPSIS,
|
menu->AddItem(item = new BMenuItem(
|
||||||
NULL));
|
TR("Save into resource file" B_UTF8_ELLIPSIS), NULL));
|
||||||
item->SetEnabled(false);
|
item->SetEnabled(false);
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED),
|
menu->AddItem(new BMenuItem(TR("Close"), new BMessage(B_QUIT_REQUESTED),
|
||||||
'W', B_COMMAND_KEY));
|
'W', B_COMMAND_KEY));
|
||||||
menuBar->AddItem(menu);
|
menuBar->AddItem(menu);
|
||||||
|
|
||||||
@@ -261,7 +267,7 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entr
|
|||||||
AddChild(topView);
|
AddChild(topView);
|
||||||
|
|
||||||
rect = topView->Bounds().InsetByCopy(8.0f, 8.0f);
|
rect = topView->Bounds().InsetByCopy(8.0f, 8.0f);
|
||||||
fSignatureControl = new BTextControl(rect, "signature", "Signature:", NULL,
|
fSignatureControl = new BTextControl(rect, "signature", TR("Signature:"), NULL,
|
||||||
new BMessage(kMsgSignatureChanged), B_FOLLOW_LEFT_RIGHT);
|
new BMessage(kMsgSignatureChanged), B_FOLLOW_LEFT_RIGHT);
|
||||||
fSignatureControl->SetModificationMessage(
|
fSignatureControl->SetModificationMessage(
|
||||||
new BMessage(kMsgSignatureChanged));
|
new BMessage(kMsgSignatureChanged));
|
||||||
@@ -296,40 +302,40 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entr
|
|||||||
BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
topView->AddChild(box);
|
topView->AddChild(box);
|
||||||
|
|
||||||
fFlagsCheckBox = new BCheckBox(rect, "flags", "Application flags",
|
fFlagsCheckBox = new BCheckBox(rect, "flags", TR("Application flags"),
|
||||||
new BMessage(kMsgToggleAppFlags));
|
new BMessage(kMsgToggleAppFlags));
|
||||||
fFlagsCheckBox->SetValue(B_CONTROL_ON);
|
fFlagsCheckBox->SetValue(B_CONTROL_ON);
|
||||||
fFlagsCheckBox->ResizeToPreferred();
|
fFlagsCheckBox->ResizeToPreferred();
|
||||||
box->SetLabel(fFlagsCheckBox);
|
box->SetLabel(fFlagsCheckBox);
|
||||||
|
|
||||||
rect.top = fFlagsCheckBox->Bounds().Height() + 4.0f;
|
rect.top = fFlagsCheckBox->Bounds().Height() + 4.0f;
|
||||||
fSingleLaunchButton = new BRadioButton(rect, "single", "Single launch",
|
fSingleLaunchButton = new BRadioButton(rect, "single", TR("Single launch"),
|
||||||
new BMessage(kMsgAppFlagsChanged));
|
new BMessage(kMsgAppFlagsChanged));
|
||||||
fSingleLaunchButton->ResizeToPreferred();
|
fSingleLaunchButton->ResizeToPreferred();
|
||||||
box->AddChild(fSingleLaunchButton);
|
box->AddChild(fSingleLaunchButton);
|
||||||
|
|
||||||
rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
|
rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
|
||||||
fMultipleLaunchButton = new BRadioButton(rect, "multiple",
|
fMultipleLaunchButton = new BRadioButton(rect, "multiple",
|
||||||
"Multiple launch", new BMessage(kMsgAppFlagsChanged));
|
TR("Multiple launch"), new BMessage(kMsgAppFlagsChanged));
|
||||||
fMultipleLaunchButton->ResizeToPreferred();
|
fMultipleLaunchButton->ResizeToPreferred();
|
||||||
box->AddChild(fMultipleLaunchButton);
|
box->AddChild(fMultipleLaunchButton);
|
||||||
|
|
||||||
rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
|
rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
|
||||||
fExclusiveLaunchButton = new BRadioButton(rect, "exclusive",
|
fExclusiveLaunchButton = new BRadioButton(rect, "exclusive",
|
||||||
"Exclusive launch", new BMessage(kMsgAppFlagsChanged));
|
TR("Exclusive launch"), new BMessage(kMsgAppFlagsChanged));
|
||||||
fExclusiveLaunchButton->ResizeToPreferred();
|
fExclusiveLaunchButton->ResizeToPreferred();
|
||||||
box->AddChild(fExclusiveLaunchButton);
|
box->AddChild(fExclusiveLaunchButton);
|
||||||
|
|
||||||
rect.top = fSingleLaunchButton->Frame().top;
|
rect.top = fSingleLaunchButton->Frame().top;
|
||||||
rect.left = fExclusiveLaunchButton->Frame().right + 4.0f;
|
rect.left = fExclusiveLaunchButton->Frame().right + 4.0f;
|
||||||
fArgsOnlyCheckBox = new BCheckBox(rect, "args only", "Args only",
|
fArgsOnlyCheckBox = new BCheckBox(rect, "args only", TR("Args only"),
|
||||||
new BMessage(kMsgAppFlagsChanged));
|
new BMessage(kMsgAppFlagsChanged));
|
||||||
fArgsOnlyCheckBox->ResizeToPreferred();
|
fArgsOnlyCheckBox->ResizeToPreferred();
|
||||||
box->AddChild(fArgsOnlyCheckBox);
|
box->AddChild(fArgsOnlyCheckBox);
|
||||||
|
|
||||||
rect.top += fArgsOnlyCheckBox->Bounds().Height();
|
rect.top += fArgsOnlyCheckBox->Bounds().Height();
|
||||||
fBackgroundAppCheckBox = new BCheckBox(rect, "background",
|
fBackgroundAppCheckBox = new BCheckBox(rect, "background",
|
||||||
"Background app", new BMessage(kMsgAppFlagsChanged));
|
TR("Background app"), new BMessage(kMsgAppFlagsChanged));
|
||||||
fBackgroundAppCheckBox->ResizeToPreferred();
|
fBackgroundAppCheckBox->ResizeToPreferred();
|
||||||
box->AddChild(fBackgroundAppCheckBox);
|
box->AddChild(fBackgroundAppCheckBox);
|
||||||
|
|
||||||
@@ -373,12 +379,12 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entr
|
|||||||
rect.left = 8.0f;
|
rect.left = 8.0f;
|
||||||
rect.right = Bounds().Width() - 8.0f;
|
rect.right = Bounds().Width() - 8.0f;
|
||||||
BBox* typeBox = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
BBox* typeBox = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
typeBox->SetLabel("Supported types");
|
typeBox->SetLabel(TR("Supported types"));
|
||||||
topView->AddChild(typeBox);
|
topView->AddChild(typeBox);
|
||||||
|
|
||||||
rect = typeBox->Bounds().InsetByCopy(8.0f, 6.0f);
|
rect = typeBox->Bounds().InsetByCopy(8.0f, 6.0f);
|
||||||
rect.top += ceilf(fontHeight.ascent);
|
rect.top += ceilf(fontHeight.ascent);
|
||||||
fAddTypeButton = new BButton(rect, "add type", "Add" B_UTF8_ELLIPSIS,
|
fAddTypeButton = new BButton(rect, "add type", TR("Add" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgAddType), B_FOLLOW_RIGHT);
|
new BMessage(kMsgAddType), B_FOLLOW_RIGHT);
|
||||||
fAddTypeButton->ResizeToPreferred();
|
fAddTypeButton->ResizeToPreferred();
|
||||||
fAddTypeButton->MoveBy(rect.right - fAddTypeButton->Bounds().Width()
|
fAddTypeButton->MoveBy(rect.right - fAddTypeButton->Bounds().Width()
|
||||||
@@ -387,7 +393,7 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entr
|
|||||||
|
|
||||||
rect = fAddTypeButton->Frame();
|
rect = fAddTypeButton->Frame();
|
||||||
rect.OffsetBy(0, rect.Height() + 4.0f);
|
rect.OffsetBy(0, rect.Height() + 4.0f);
|
||||||
fRemoveTypeButton = new BButton(rect, "remove type", "Remove",
|
fRemoveTypeButton = new BButton(rect, "remove type", TR("Remove"),
|
||||||
new BMessage(kMsgRemoveType), B_FOLLOW_RIGHT);
|
new BMessage(kMsgRemoveType), B_FOLLOW_RIGHT);
|
||||||
typeBox->AddChild(fRemoveTypeButton);
|
typeBox->AddChild(fRemoveTypeButton);
|
||||||
|
|
||||||
@@ -426,7 +432,7 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entr
|
|||||||
rect.right = Bounds().Width() - 8.0f;
|
rect.right = Bounds().Width() - 8.0f;
|
||||||
box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
// the resizing mode will later also be set to B_FOLLOW_BOTTOM
|
// the resizing mode will later also be set to B_FOLLOW_BOTTOM
|
||||||
box->SetLabel("Version info");
|
box->SetLabel(TR("Version info"));
|
||||||
topView->AddChild(box);
|
topView->AddChild(box);
|
||||||
|
|
||||||
BMenuField* menuField;
|
BMenuField* menuField;
|
||||||
@@ -446,7 +452,7 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entr
|
|||||||
|
|
||||||
rect.top = 4.0f + ceilf(fontHeight.ascent + fontHeight.descent);
|
rect.top = 4.0f + ceilf(fontHeight.ascent + fontHeight.descent);
|
||||||
rect.bottom = rect.top + height;
|
rect.bottom = rect.top + height;
|
||||||
fMajorVersionControl = new BTextControl(rect, "major", "Version:", NULL,
|
fMajorVersionControl = new BTextControl(rect, "major", TR("Version:"), NULL,
|
||||||
NULL);
|
NULL);
|
||||||
fMajorVersionControl->SetDivider(fMajorVersionControl->StringWidth(
|
fMajorVersionControl->SetDivider(fMajorVersionControl->StringWidth(
|
||||||
fMajorVersionControl->Label()) + 4.0f);
|
fMajorVersionControl->Label()) + 4.0f);
|
||||||
@@ -475,13 +481,13 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entr
|
|||||||
box->AddChild(fMinorVersionControl);
|
box->AddChild(fMinorVersionControl);
|
||||||
|
|
||||||
fVarietyMenu = new BPopUpMenu("variety", true, true);
|
fVarietyMenu = new BPopUpMenu("variety", true, true);
|
||||||
fVarietyMenu->AddItem(new BMenuItem("Development", NULL));
|
fVarietyMenu->AddItem(new BMenuItem(TR("Development"), NULL));
|
||||||
fVarietyMenu->AddItem(new BMenuItem("Alpha", NULL));
|
fVarietyMenu->AddItem(new BMenuItem(TR("Alpha"), NULL));
|
||||||
fVarietyMenu->AddItem(new BMenuItem("Beta", NULL));
|
fVarietyMenu->AddItem(new BMenuItem(TR("Beta"), NULL));
|
||||||
fVarietyMenu->AddItem(new BMenuItem("Gamma", NULL));
|
fVarietyMenu->AddItem(new BMenuItem(TR("Gamma"), NULL));
|
||||||
fVarietyMenu->AddItem(item = new BMenuItem("Golden master", NULL));
|
fVarietyMenu->AddItem(item = new BMenuItem(TR("Golden master"), NULL));
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
fVarietyMenu->AddItem(new BMenuItem("Final", NULL));
|
fVarietyMenu->AddItem(new BMenuItem(TR("Final"), NULL));
|
||||||
|
|
||||||
rect.top--;
|
rect.top--;
|
||||||
// BMenuField oddity
|
// BMenuField oddity
|
||||||
@@ -503,7 +509,7 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entr
|
|||||||
|
|
||||||
rect = box->Bounds().InsetByCopy(8.0f, 0.0f);
|
rect = box->Bounds().InsetByCopy(8.0f, 0.0f);
|
||||||
rect.top = fInternalVersionControl->Frame().bottom + 8.0f;
|
rect.top = fInternalVersionControl->Frame().bottom + 8.0f;
|
||||||
fShortDescriptionControl = new BTextControl(rect, "short desc", "Short description:",
|
fShortDescriptionControl = new BTextControl(rect, "short desc", TR("Short description:"),
|
||||||
NULL, NULL, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
NULL, NULL, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
||||||
float labelWidth = fShortDescriptionControl->StringWidth(
|
float labelWidth = fShortDescriptionControl->StringWidth(
|
||||||
fShortDescriptionControl->Label()) + 4.0f;
|
fShortDescriptionControl->Label()) + 4.0f;
|
||||||
@@ -518,7 +524,7 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entr
|
|||||||
|
|
||||||
rect.OffsetBy(0.0f, fShortDescriptionControl->Bounds().Height() + 5.0f);
|
rect.OffsetBy(0.0f, fShortDescriptionControl->Bounds().Height() + 5.0f);
|
||||||
rect.right = rect.left + labelWidth;
|
rect.right = rect.left + labelWidth;
|
||||||
StringView* label = new StringView(rect, NULL, "Long description:", NULL);
|
StringView* label = new StringView(rect, NULL, TR("Long description:"), NULL);
|
||||||
label->SetDivider(labelWidth);
|
label->SetDivider(labelWidth);
|
||||||
box->AddChild(label);
|
box->AddChild(label);
|
||||||
|
|
||||||
@@ -1088,9 +1094,9 @@ bool
|
|||||||
ApplicationTypeWindow::QuitRequested()
|
ApplicationTypeWindow::QuitRequested()
|
||||||
{
|
{
|
||||||
if (_NeedsSaving(CHECK_ALL) != 0) {
|
if (_NeedsSaving(CHECK_ALL) != 0) {
|
||||||
BAlert* alert = new BAlert("Save request", "Do you want to save "
|
BAlert* alert = new BAlert(TR("Save request"), TR("Do you want to "
|
||||||
"the changes?", "Quit, don't save", "Cancel", "Save",
|
"save the changes?"), TR("Quit, don't save"), TR("Cancel"),
|
||||||
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
TR("Save"), B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
||||||
int32 choice = alert->Go();
|
int32 choice = alert->Go();
|
||||||
switch (choice) {
|
switch (choice) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
@@ -35,6 +37,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "Application Types Window"
|
||||||
|
|
||||||
|
|
||||||
class ProgressWindow : public BWindow {
|
class ProgressWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
ProgressWindow(const char* message, int32 max, volatile bool* signalQuit);
|
ProgressWindow(const char* message, int32 max, volatile bool* signalQuit);
|
||||||
@@ -68,17 +74,17 @@ variety_to_text(uint32 variety)
|
|||||||
|
|
||||||
switch (variety) {
|
switch (variety) {
|
||||||
case B_DEVELOPMENT_VERSION:
|
case B_DEVELOPMENT_VERSION:
|
||||||
return "Development";
|
return TR("Development");
|
||||||
case B_ALPHA_VERSION:
|
case B_ALPHA_VERSION:
|
||||||
return "Alpha";
|
return TR("Alpha");
|
||||||
case B_BETA_VERSION:
|
case B_BETA_VERSION:
|
||||||
return "Beta";
|
return TR("Beta");
|
||||||
case B_GAMMA_VERSION:
|
case B_GAMMA_VERSION:
|
||||||
return "Gamma";
|
return TR("Gamma");
|
||||||
case B_GOLDEN_MASTER_VERSION:
|
case B_GOLDEN_MASTER_VERSION:
|
||||||
return "Golden master";
|
return TR("Golden master");
|
||||||
case B_FINAL_VERSION:
|
case B_FINAL_VERSION:
|
||||||
return "Final";
|
return TR("Final");
|
||||||
}
|
}
|
||||||
|
|
||||||
return "-";
|
return "-";
|
||||||
@@ -89,7 +95,7 @@ variety_to_text(uint32 variety)
|
|||||||
|
|
||||||
|
|
||||||
ProgressWindow::ProgressWindow(const char* message, int32 max, volatile bool* signalQuit)
|
ProgressWindow::ProgressWindow(const char* message, int32 max, volatile bool* signalQuit)
|
||||||
: BWindow(BRect(0, 0, 300, 200), "Progress", B_MODAL_WINDOW_LOOK,
|
: BWindow(BRect(0, 0, 300, 200), TR("Progress"), B_MODAL_WINDOW_LOOK,
|
||||||
B_MODAL_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_V_RESIZABLE),
|
B_MODAL_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_V_RESIZABLE),
|
||||||
fQuitListener(signalQuit)
|
fQuitListener(signalQuit)
|
||||||
{
|
{
|
||||||
@@ -109,7 +115,7 @@ ProgressWindow::ProgressWindow(const char* message, int32 max, volatile bool* si
|
|||||||
fStatusBar->ResizeTo(rect.Width(), height);
|
fStatusBar->ResizeTo(rect.Width(), height);
|
||||||
topView->AddChild(fStatusBar);
|
topView->AddChild(fStatusBar);
|
||||||
|
|
||||||
fAbortButton = new BButton(rect, "abort", "Abort", new BMessage(B_CANCEL),
|
fAbortButton = new BButton(rect, "abort", TR("Abort"), new BMessage(B_CANCEL),
|
||||||
B_FOLLOW_H_CENTER | B_FOLLOW_TOP);
|
B_FOLLOW_H_CENTER | B_FOLLOW_TOP);
|
||||||
fAbortButton->ResizeToPreferred();
|
fAbortButton->ResizeToPreferred();
|
||||||
fAbortButton->MoveTo((Bounds().Width() - fAbortButton->Bounds().Width()) / 2,
|
fAbortButton->MoveTo((Bounds().Width() - fAbortButton->Bounds().Width()) / 2,
|
||||||
@@ -160,7 +166,7 @@ ProgressWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
|
|
||||||
ApplicationTypesWindow::ApplicationTypesWindow(const BMessage &settings)
|
ApplicationTypesWindow::ApplicationTypesWindow(const BMessage &settings)
|
||||||
: BWindow(_Frame(settings), "Application types", B_TITLED_WINDOW,
|
: BWindow(_Frame(settings), TR("Application types"), B_TITLED_WINDOW,
|
||||||
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
|
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
|
||||||
{
|
{
|
||||||
// Application list
|
// Application list
|
||||||
@@ -170,7 +176,7 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage &settings)
|
|||||||
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
AddChild(topView);
|
AddChild(topView);
|
||||||
|
|
||||||
BButton* button = new BButton(rect, "remove", "Remove uninstalled",
|
BButton* button = new BButton(rect, "remove", TR("Remove uninstalled"),
|
||||||
new BMessage(kMsgRemoveUninstalled), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
new BMessage(kMsgRemoveUninstalled), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
||||||
button->ResizeToPreferred();
|
button->ResizeToPreferred();
|
||||||
button->MoveTo(8.0f, rect.bottom - 8.0f - button->Bounds().Height());
|
button->MoveTo(8.0f, rect.bottom - 8.0f - button->Bounds().Height());
|
||||||
@@ -201,15 +207,15 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage &settings)
|
|||||||
rect.right = topView->Bounds().Width() - 8.0f;
|
rect.right = topView->Bounds().Width() - 8.0f;
|
||||||
rect.bottom = rect.top + ceilf(fontHeight.ascent) + 24.0f;
|
rect.bottom = rect.top + ceilf(fontHeight.ascent) + 24.0f;
|
||||||
BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
box->SetLabel("Information");
|
box->SetLabel(TR("Information"));
|
||||||
topView->AddChild(box);
|
topView->AddChild(box);
|
||||||
|
|
||||||
BRect innerRect = box->Bounds().InsetByCopy(8.0f, 6.0f);
|
BRect innerRect = box->Bounds().InsetByCopy(8.0f, 6.0f);
|
||||||
float labelWidth = topView->StringWidth("Description:") + 4.0f;
|
float labelWidth = topView->StringWidth(TR("Description:")) + 4.0f;
|
||||||
|
|
||||||
innerRect.right = box->Bounds().Width() - 8.0f;
|
innerRect.right = box->Bounds().Width() - 8.0f;
|
||||||
innerRect.top += ceilf(fontHeight.ascent);
|
innerRect.top += ceilf(fontHeight.ascent);
|
||||||
fNameView = new StringView(innerRect, "name", "Name:", NULL, B_FOLLOW_LEFT_RIGHT);
|
fNameView = new StringView(innerRect, "name", TR("Name:"), NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
fNameView->SetDivider(labelWidth);
|
fNameView->SetDivider(labelWidth);
|
||||||
float width, height;
|
float width, height;
|
||||||
fNameView->GetPreferredSize(&width, &height);
|
fNameView->GetPreferredSize(&width, &height);
|
||||||
@@ -219,13 +225,13 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage &settings)
|
|||||||
|
|
||||||
innerRect.OffsetBy(0, fNameView->Bounds().Height() + 5.0f);
|
innerRect.OffsetBy(0, fNameView->Bounds().Height() + 5.0f);
|
||||||
innerRect.bottom = innerRect.top + height;
|
innerRect.bottom = innerRect.top + height;
|
||||||
fSignatureView = new StringView(innerRect, "signature", "Signature:", NULL,
|
fSignatureView = new StringView(innerRect, "signature", TR("Signature:"), NULL,
|
||||||
B_FOLLOW_LEFT_RIGHT);
|
B_FOLLOW_LEFT_RIGHT);
|
||||||
fSignatureView->SetDivider(labelWidth);
|
fSignatureView->SetDivider(labelWidth);
|
||||||
box->AddChild(fSignatureView);
|
box->AddChild(fSignatureView);
|
||||||
|
|
||||||
innerRect.OffsetBy(0, fNameView->Bounds().Height() + 5.0f);
|
innerRect.OffsetBy(0, fNameView->Bounds().Height() + 5.0f);
|
||||||
fPathView = new StringView(innerRect, "path", "Path:", NULL,
|
fPathView = new StringView(innerRect, "path", TR("Path:"), NULL,
|
||||||
B_FOLLOW_LEFT_RIGHT);
|
B_FOLLOW_LEFT_RIGHT);
|
||||||
fPathView->SetDivider(labelWidth);
|
fPathView->SetDivider(labelWidth);
|
||||||
box->AddChild(fPathView);
|
box->AddChild(fPathView);
|
||||||
@@ -236,18 +242,18 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage &settings)
|
|||||||
rect.bottom = rect.top + ceilf(fontHeight.ascent)
|
rect.bottom = rect.top + ceilf(fontHeight.ascent)
|
||||||
+ fNameView->Bounds().Height() * 4.0f + 20.0f;
|
+ fNameView->Bounds().Height() * 4.0f + 20.0f;
|
||||||
box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
box->SetLabel("Version");
|
box->SetLabel(TR("Version"));
|
||||||
topView->AddChild(box);
|
topView->AddChild(box);
|
||||||
|
|
||||||
innerRect = fNameView->Frame();
|
innerRect = fNameView->Frame();
|
||||||
fVersionView = new StringView(innerRect, "version", "Version:", NULL,
|
fVersionView = new StringView(innerRect, "version", TR("Version:"), NULL,
|
||||||
B_FOLLOW_LEFT_RIGHT);
|
B_FOLLOW_LEFT_RIGHT);
|
||||||
fVersionView->SetDivider(labelWidth);
|
fVersionView->SetDivider(labelWidth);
|
||||||
box->AddChild(fVersionView);
|
box->AddChild(fVersionView);
|
||||||
|
|
||||||
innerRect.OffsetBy(0, fNameView->Bounds().Height() + 5.0f);
|
innerRect.OffsetBy(0, fNameView->Bounds().Height() + 5.0f);
|
||||||
innerRect.right = innerRect.left + labelWidth;
|
innerRect.right = innerRect.left + labelWidth;
|
||||||
fDescriptionLabel = new StringView(innerRect, "description", "Description:", NULL);
|
fDescriptionLabel = new StringView(innerRect, "description", TR("Description:"), NULL);
|
||||||
fDescriptionLabel->SetDivider(labelWidth);
|
fDescriptionLabel->SetDivider(labelWidth);
|
||||||
box->AddChild(fDescriptionLabel);
|
box->AddChild(fDescriptionLabel);
|
||||||
|
|
||||||
@@ -268,20 +274,20 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage &settings)
|
|||||||
rect = box->Frame();
|
rect = box->Frame();
|
||||||
rect.top = rect.bottom + 8.0f;
|
rect.top = rect.bottom + 8.0f;
|
||||||
rect.bottom = rect.top + 20.0f;
|
rect.bottom = rect.top + 20.0f;
|
||||||
fTrackerButton = new BButton(rect, "tracker", "Show in Tracker" B_UTF8_ELLIPSIS, NULL,
|
fTrackerButton = new BButton(rect, "tracker", TR("Show in Tracker" B_UTF8_ELLIPSIS), NULL,
|
||||||
B_FOLLOW_RIGHT);
|
B_FOLLOW_RIGHT);
|
||||||
fTrackerButton->ResizeToPreferred();
|
fTrackerButton->ResizeToPreferred();
|
||||||
fTrackerButton->MoveTo(rect.right - fTrackerButton->Bounds().Width(), rect.top);
|
fTrackerButton->MoveTo(rect.right - fTrackerButton->Bounds().Width(), rect.top);
|
||||||
topView->AddChild(fTrackerButton);
|
topView->AddChild(fTrackerButton);
|
||||||
|
|
||||||
fLaunchButton = new BButton(rect, "launch", "Launch", NULL,
|
fLaunchButton = new BButton(rect, "launch", TR("Launch"), NULL,
|
||||||
B_FOLLOW_RIGHT);
|
B_FOLLOW_RIGHT);
|
||||||
fLaunchButton->ResizeToPreferred();
|
fLaunchButton->ResizeToPreferred();
|
||||||
fLaunchButton->MoveTo(fTrackerButton->Frame().left - 6.0f
|
fLaunchButton->MoveTo(fTrackerButton->Frame().left - 6.0f
|
||||||
- fLaunchButton->Bounds().Width(), rect.top);
|
- fLaunchButton->Bounds().Width(), rect.top);
|
||||||
topView->AddChild(fLaunchButton);
|
topView->AddChild(fLaunchButton);
|
||||||
|
|
||||||
fEditButton = new BButton(rect, "edit", "Edit" B_UTF8_ELLIPSIS, new BMessage(kMsgEdit),
|
fEditButton = new BButton(rect, "edit", TR("Edit" B_UTF8_ELLIPSIS), new BMessage(kMsgEdit),
|
||||||
B_FOLLOW_RIGHT);
|
B_FOLLOW_RIGHT);
|
||||||
fEditButton->ResizeToPreferred();
|
fEditButton->ResizeToPreferred();
|
||||||
fEditButton->MoveTo(fLaunchButton->Frame().left - 6.0f
|
fEditButton->MoveTo(fLaunchButton->Frame().left - 6.0f
|
||||||
@@ -322,7 +328,7 @@ ApplicationTypesWindow::_RemoveUninstalled()
|
|||||||
int32 removed = 0;
|
int32 removed = 0;
|
||||||
volatile bool quit = false;
|
volatile bool quit = false;
|
||||||
|
|
||||||
BWindow* progressWindow = new ProgressWindow("Removing uninstalled application types",
|
BWindow* progressWindow = new ProgressWindow(TR("Removing uninstalled application types"),
|
||||||
fTypeListView->FullListCountItems(), &quit);
|
fTypeListView->FullListCountItems(), &quit);
|
||||||
progressWindow->AddToSubset(this);
|
progressWindow->AddToSubset(this);
|
||||||
progressWindow->Show();
|
progressWindow->Show();
|
||||||
@@ -375,7 +381,8 @@ ApplicationTypesWindow::_RemoveUninstalled()
|
|||||||
progressWindow->PostMessage(B_QUIT_REQUESTED);
|
progressWindow->PostMessage(B_QUIT_REQUESTED);
|
||||||
|
|
||||||
char message[512];
|
char message[512];
|
||||||
snprintf(message, sizeof(message), "%ld Application type%s could be removed.",
|
// TODO : use ICU to properly format this
|
||||||
|
snprintf(message, sizeof(message), TR("%ld Application type%s could be removed."),
|
||||||
removed, removed == 1 ? "" : "s");
|
removed, removed == 1 ? "" : "s");
|
||||||
error_alert(message, B_OK, B_INFO_ALERT);
|
error_alert(message, B_OK, B_INFO_ALERT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,9 @@
|
|||||||
|
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
@@ -24,6 +26,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "Attribute Window"
|
||||||
|
|
||||||
|
|
||||||
const uint32 kMsgAttributeUpdated = 'atup';
|
const uint32 kMsgAttributeUpdated = 'atup';
|
||||||
const uint32 kMsgTypeChosen = 'typc';
|
const uint32 kMsgTypeChosen = 'typc';
|
||||||
const uint32 kMsgDisplayAsChosen = 'dach';
|
const uint32 kMsgDisplayAsChosen = 'dach';
|
||||||
@@ -85,7 +91,7 @@ display_as_parameter(const char* special)
|
|||||||
|
|
||||||
AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
||||||
AttributeItem* attributeItem)
|
AttributeItem* attributeItem)
|
||||||
: BWindow(BRect(100, 100, 350, 200), "Attribute", B_MODAL_WINDOW_LOOK,
|
: BWindow(BRect(100, 100, 350, 200), TR("Attribute"), B_MODAL_WINDOW_LOOK,
|
||||||
B_MODAL_SUBSET_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE
|
B_MODAL_SUBSET_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE
|
||||||
| B_ASYNCHRONOUS_CONTROLS),
|
| B_ASYNCHRONOUS_CONTROLS),
|
||||||
fTarget(target),
|
fTarget(target),
|
||||||
@@ -100,7 +106,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
|||||||
AddChild(topView);
|
AddChild(topView);
|
||||||
|
|
||||||
rect.InsetBy(8.0f, 8.0f);
|
rect.InsetBy(8.0f, 8.0f);
|
||||||
fPublicNameControl = new BTextControl(rect, "public", "Attribute name:",
|
fPublicNameControl = new BTextControl(rect, "public", TR("Attribute name:"),
|
||||||
fAttribute.PublicName(), NULL, B_FOLLOW_LEFT_RIGHT);
|
fAttribute.PublicName(), NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
fPublicNameControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
|
fPublicNameControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
|
||||||
|
|
||||||
@@ -115,7 +121,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
|||||||
|
|
||||||
rect = fPublicNameControl->Frame();
|
rect = fPublicNameControl->Frame();
|
||||||
rect.OffsetBy(0.0f, rect.Height() + 5.0f);
|
rect.OffsetBy(0.0f, rect.Height() + 5.0f);
|
||||||
fAttributeControl = new BTextControl(rect, "internal", "Internal name:",
|
fAttributeControl = new BTextControl(rect, "internal", TR("Internal name:"),
|
||||||
fAttribute.Name(), NULL, B_FOLLOW_LEFT_RIGHT);
|
fAttribute.Name(), NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
fAttributeControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
|
fAttributeControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
|
||||||
fAttributeControl->SetDivider(labelWidth);
|
fAttributeControl->SetDivider(labelWidth);
|
||||||
@@ -145,7 +151,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
|||||||
|
|
||||||
rect.OffsetBy(0.0f, rect.Height() + 4.0f);
|
rect.OffsetBy(0.0f, rect.Height() + 4.0f);
|
||||||
BMenuField* menuField = new BMenuField(rect, "types",
|
BMenuField* menuField = new BMenuField(rect, "types",
|
||||||
"Type:", fTypeMenu);
|
TR("Type:"), fTypeMenu);
|
||||||
menuField->SetDivider(labelWidth);
|
menuField->SetDivider(labelWidth);
|
||||||
menuField->SetAlignment(B_ALIGN_RIGHT);
|
menuField->SetAlignment(B_ALIGN_RIGHT);
|
||||||
menuField->GetPreferredSize(&width, &height);
|
menuField->GetPreferredSize(&width, &height);
|
||||||
@@ -157,7 +163,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
|||||||
BBox* box = new BBox(rect, "", B_FOLLOW_LEFT_RIGHT);
|
BBox* box = new BBox(rect, "", B_FOLLOW_LEFT_RIGHT);
|
||||||
topView->AddChild(box);
|
topView->AddChild(box);
|
||||||
|
|
||||||
fVisibleCheckBox = new BCheckBox(rect, "visible", "Visible",
|
fVisibleCheckBox = new BCheckBox(rect, "visible", TR("Visible"),
|
||||||
new BMessage(kMsgVisibilityChanged));
|
new BMessage(kMsgVisibilityChanged));
|
||||||
fVisibleCheckBox->SetValue(fAttribute.Visible());
|
fVisibleCheckBox->SetValue(fAttribute.Visible());
|
||||||
fVisibleCheckBox->ResizeToPreferred();
|
fVisibleCheckBox->ResizeToPreferred();
|
||||||
@@ -185,13 +191,13 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
|||||||
rect.OffsetTo(8.0f, fVisibleCheckBox->Bounds().Height());
|
rect.OffsetTo(8.0f, fVisibleCheckBox->Bounds().Height());
|
||||||
rect.right -= 18.0f;
|
rect.right -= 18.0f;
|
||||||
fDisplayAsMenuField = new BMenuField(rect, "display as",
|
fDisplayAsMenuField = new BMenuField(rect, "display as",
|
||||||
"Display as:", menu);
|
TR("Display as:"), menu);
|
||||||
fDisplayAsMenuField->SetDivider(labelWidth);
|
fDisplayAsMenuField->SetDivider(labelWidth);
|
||||||
fDisplayAsMenuField->SetAlignment(B_ALIGN_RIGHT);
|
fDisplayAsMenuField->SetAlignment(B_ALIGN_RIGHT);
|
||||||
fDisplayAsMenuField->ResizeTo(rect.Width(), height);
|
fDisplayAsMenuField->ResizeTo(rect.Width(), height);
|
||||||
box->AddChild(fDisplayAsMenuField);
|
box->AddChild(fDisplayAsMenuField);
|
||||||
|
|
||||||
fEditableCheckBox = new BCheckBox(rect, "editable", "Editable",
|
fEditableCheckBox = new BCheckBox(rect, "editable", TR("Editable"),
|
||||||
new BMessage(kMsgAttributeUpdated), B_FOLLOW_RIGHT);
|
new BMessage(kMsgAttributeUpdated), B_FOLLOW_RIGHT);
|
||||||
fEditableCheckBox->SetValue(fAttribute.Editable());
|
fEditableCheckBox->SetValue(fAttribute.Editable());
|
||||||
fEditableCheckBox->ResizeToPreferred();
|
fEditableCheckBox->ResizeToPreferred();
|
||||||
@@ -202,7 +208,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
|||||||
|
|
||||||
rect.OffsetBy(0.0f, menuField->Bounds().Height() + 4.0f);
|
rect.OffsetBy(0.0f, menuField->Bounds().Height() + 4.0f);
|
||||||
rect.bottom = rect.top + fPublicNameControl->Bounds().Height();
|
rect.bottom = rect.top + fPublicNameControl->Bounds().Height();
|
||||||
fSpecialControl = new BTextControl(rect, "special", "Special:",
|
fSpecialControl = new BTextControl(rect, "special", TR("Special:"),
|
||||||
display_as_parameter(fAttribute.DisplayAs()), NULL,
|
display_as_parameter(fAttribute.DisplayAs()), NULL,
|
||||||
B_FOLLOW_LEFT_RIGHT);
|
B_FOLLOW_LEFT_RIGHT);
|
||||||
fSpecialControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
|
fSpecialControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
|
||||||
@@ -214,7 +220,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
|||||||
char text[64];
|
char text[64];
|
||||||
snprintf(text, sizeof(text), "%ld", fAttribute.Width());
|
snprintf(text, sizeof(text), "%ld", fAttribute.Width());
|
||||||
rect.OffsetBy(0.0f, fSpecialControl->Bounds().Height() + 4.0f);
|
rect.OffsetBy(0.0f, fSpecialControl->Bounds().Height() + 4.0f);
|
||||||
fWidthControl = new BTextControl(rect, "width", "Width:",
|
fWidthControl = new BTextControl(rect, "width", TR("Width:"),
|
||||||
text, NULL, B_FOLLOW_LEFT_RIGHT);
|
text, NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
fWidthControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
|
fWidthControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
|
||||||
fWidthControl->SetDivider(labelWidth);
|
fWidthControl->SetDivider(labelWidth);
|
||||||
@@ -234,9 +240,9 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
|||||||
int32 alignment;
|
int32 alignment;
|
||||||
const char* name;
|
const char* name;
|
||||||
} kAlignmentMap[] = {
|
} kAlignmentMap[] = {
|
||||||
{B_ALIGN_LEFT, "Left"},
|
{B_ALIGN_LEFT, TR("Left")},
|
||||||
{B_ALIGN_RIGHT, "Right"},
|
{B_ALIGN_RIGHT, TR("Right")},
|
||||||
{B_ALIGN_CENTER, "Center"},
|
{B_ALIGN_CENTER, TR("Center")},
|
||||||
{0, NULL}
|
{0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -254,7 +260,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
|||||||
|
|
||||||
rect.OffsetBy(0.0f, menuField->Bounds().Height() + 1.0f);
|
rect.OffsetBy(0.0f, menuField->Bounds().Height() + 1.0f);
|
||||||
fAlignmentMenuField = new BMenuField(rect, "alignment",
|
fAlignmentMenuField = new BMenuField(rect, "alignment",
|
||||||
"Alignment:", menu);
|
TR("Alignment:"), menu);
|
||||||
fAlignmentMenuField->SetDivider(labelWidth);
|
fAlignmentMenuField->SetDivider(labelWidth);
|
||||||
fAlignmentMenuField->SetAlignment(B_ALIGN_RIGHT);
|
fAlignmentMenuField->SetAlignment(B_ALIGN_RIGHT);
|
||||||
fAlignmentMenuField->ResizeTo(rect.Width(), height);
|
fAlignmentMenuField->ResizeTo(rect.Width(), height);
|
||||||
@@ -262,7 +268,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
|||||||
box->ResizeBy(0.0f, fAlignmentMenuField->Bounds().Height() * 2.0f
|
box->ResizeBy(0.0f, fAlignmentMenuField->Bounds().Height() * 2.0f
|
||||||
+ fVisibleCheckBox->Bounds().Height());
|
+ fVisibleCheckBox->Bounds().Height());
|
||||||
|
|
||||||
fAcceptButton = new BButton(rect, "add", item ? "Done" : "Add",
|
fAcceptButton = new BButton(rect, "add", item ? TR("Done") : TR("Add"),
|
||||||
new BMessage(kMsgAccept), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
new BMessage(kMsgAccept), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
fAcceptButton->ResizeToPreferred();
|
fAcceptButton->ResizeToPreferred();
|
||||||
fAcceptButton->MoveTo(Bounds().Width() - 8.0f - fAcceptButton->Bounds().Width(),
|
fAcceptButton->MoveTo(Bounds().Width() - 8.0f - fAcceptButton->Bounds().Width(),
|
||||||
@@ -270,7 +276,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
|||||||
fAcceptButton->SetEnabled(false);
|
fAcceptButton->SetEnabled(false);
|
||||||
topView->AddChild(fAcceptButton);
|
topView->AddChild(fAcceptButton);
|
||||||
|
|
||||||
BButton* button = new BButton(rect, "cancel", "Cancel",
|
BButton* button = new BButton(rect, "cancel", TR("Cancel"),
|
||||||
new BMessage(B_QUIT_REQUESTED), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
new BMessage(B_QUIT_REQUESTED), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
button->ResizeToPreferred();
|
button->ResizeToPreferred();
|
||||||
button->MoveTo(fAcceptButton->Frame().left - 10.0f - button->Bounds().Width(),
|
button->MoveTo(fAcceptButton->Frame().left - 10.0f - button->Bounds().Width(),
|
||||||
@@ -489,7 +495,7 @@ AttributeWindow::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
error_alert("Could not change attributes", status);
|
error_alert(TR("Could not change attributes"), status);
|
||||||
|
|
||||||
PostMessage(B_QUIT_REQUESTED);
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
#include "FileTypesWindow.h"
|
#include "FileTypesWindow.h"
|
||||||
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
@@ -19,6 +21,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "Extension Window"
|
||||||
|
|
||||||
|
|
||||||
const uint32 kMsgExtensionUpdated = 'exup';
|
const uint32 kMsgExtensionUpdated = 'exup';
|
||||||
const uint32 kMsgAccept = 'acpt';
|
const uint32 kMsgAccept = 'acpt';
|
||||||
|
|
||||||
@@ -103,7 +109,7 @@ replace_extension(BMimeType& type, const char* newExtension,
|
|||||||
|
|
||||||
ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type,
|
ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type,
|
||||||
const char* extension)
|
const char* extension)
|
||||||
: BWindow(BRect(100, 100, 350, 200), "Extension", B_MODAL_WINDOW_LOOK,
|
: BWindow(BRect(100, 100, 350, 200), TR("Extension"), B_MODAL_WINDOW_LOOK,
|
||||||
B_MODAL_SUBSET_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE
|
B_MODAL_SUBSET_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE
|
||||||
| B_ASYNCHRONOUS_CONTROLS),
|
| B_ASYNCHRONOUS_CONTROLS),
|
||||||
fTarget(target),
|
fTarget(target),
|
||||||
@@ -116,7 +122,7 @@ ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type,
|
|||||||
AddChild(topView);
|
AddChild(topView);
|
||||||
|
|
||||||
rect.InsetBy(8.0f, 8.0f);
|
rect.InsetBy(8.0f, 8.0f);
|
||||||
fExtensionControl = new BTextControl(rect, "extension", "Extension:", extension,
|
fExtensionControl = new BTextControl(rect, "extension", TR("Extension:"), extension,
|
||||||
NULL, B_FOLLOW_LEFT_RIGHT);
|
NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
|
|
||||||
float labelWidth = fExtensionControl->StringWidth(fExtensionControl->Label()) + 2.0f;
|
float labelWidth = fExtensionControl->StringWidth(fExtensionControl->Label()) + 2.0f;
|
||||||
@@ -136,7 +142,7 @@ ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type,
|
|||||||
fExtensionControl->ResizeTo(rect.Width(), height);
|
fExtensionControl->ResizeTo(rect.Width(), height);
|
||||||
topView->AddChild(fExtensionControl);
|
topView->AddChild(fExtensionControl);
|
||||||
|
|
||||||
fAcceptButton = new BButton(rect, "add", extension ? "Done" : "Add",
|
fAcceptButton = new BButton(rect, "add", extension ? TR("Done") : TR("Add"),
|
||||||
new BMessage(kMsgAccept), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
new BMessage(kMsgAccept), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
fAcceptButton->ResizeToPreferred();
|
fAcceptButton->ResizeToPreferred();
|
||||||
fAcceptButton->MoveTo(Bounds().Width() - 8.0f - fAcceptButton->Bounds().Width(),
|
fAcceptButton->MoveTo(Bounds().Width() - 8.0f - fAcceptButton->Bounds().Width(),
|
||||||
@@ -144,7 +150,7 @@ ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type,
|
|||||||
fAcceptButton->SetEnabled(false);
|
fAcceptButton->SetEnabled(false);
|
||||||
topView->AddChild(fAcceptButton);
|
topView->AddChild(fAcceptButton);
|
||||||
|
|
||||||
BButton* button = new BButton(rect, "cancel", "Cancel",
|
BButton* button = new BButton(rect, "cancel", TR("Cancel"),
|
||||||
new BMessage(B_QUIT_REQUESTED), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
new BMessage(B_QUIT_REQUESTED), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
button->ResizeToPreferred();
|
button->ResizeToPreferred();
|
||||||
button->MoveTo(fAcceptButton->Frame().left - 10.0f - button->Bounds().Width(),
|
button->MoveTo(fAcceptButton->Frame().left - 10.0f - button->Bounds().Width(),
|
||||||
@@ -202,7 +208,7 @@ ExtensionWindow::MessageReceived(BMessage* message)
|
|||||||
status_t status = replace_extension(fMimeType, newExtension,
|
status_t status = replace_extension(fMimeType, newExtension,
|
||||||
fExtension.String());
|
fExtension.String());
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
error_alert("Could not change file extensions", status);
|
error_alert(TR("Could not change file extensions"), status);
|
||||||
|
|
||||||
PostMessage(B_QUIT_REQUESTED);
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
break;
|
break;
|
||||||
@@ -213,4 +219,3 @@ ExtensionWindow::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,9 @@
|
|||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
@@ -25,6 +27,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "FileType Window"
|
||||||
|
|
||||||
|
|
||||||
const uint32 kMsgTypeEntered = 'type';
|
const uint32 kMsgTypeEntered = 'type';
|
||||||
const uint32 kMsgSelectType = 'sltp';
|
const uint32 kMsgSelectType = 'sltp';
|
||||||
const uint32 kMsgTypeSelected = 'tpsd';
|
const uint32 kMsgTypeSelected = 'tpsd';
|
||||||
@@ -40,7 +46,7 @@ const uint32 kMsgSamePreferredAppAsOpened = 'spaO';
|
|||||||
|
|
||||||
FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
|
FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
|
||||||
: BWindow(BRect(0.0f, 0.0f, 200.0f, 200.0f).OffsetBySelf(position),
|
: BWindow(BRect(0.0f, 0.0f, 200.0f, 200.0f).OffsetBySelf(position),
|
||||||
"File type", B_TITLED_WINDOW,
|
TR("File type"), B_TITLED_WINDOW,
|
||||||
B_NOT_V_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
|
B_NOT_V_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
|
||||||
{
|
{
|
||||||
BRect rect = Bounds();
|
BRect rect = Bounds();
|
||||||
@@ -56,7 +62,7 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
|
|||||||
|
|
||||||
rect.InsetBy(8.0f, 8.0f);
|
rect.InsetBy(8.0f, 8.0f);
|
||||||
BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
box->SetLabel("File type");
|
box->SetLabel(TR("File type"));
|
||||||
topView->AddChild(box);
|
topView->AddChild(box);
|
||||||
|
|
||||||
rect = box->Bounds();
|
rect = box->Bounds();
|
||||||
@@ -77,13 +83,15 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rect.OffsetBy(0.0f, fTypeControl->Bounds().Height() + 5.0f);
|
rect.OffsetBy(0.0f, fTypeControl->Bounds().Height() + 5.0f);
|
||||||
fSelectTypeButton = new BButton(rect, "select type", "Select" B_UTF8_ELLIPSIS,
|
fSelectTypeButton = new BButton(rect, "select type",
|
||||||
|
TR("Select" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgSelectType), B_FOLLOW_LEFT | B_FOLLOW_TOP);
|
new BMessage(kMsgSelectType), B_FOLLOW_LEFT | B_FOLLOW_TOP);
|
||||||
fSelectTypeButton->ResizeToPreferred();
|
fSelectTypeButton->ResizeToPreferred();
|
||||||
box->AddChild(fSelectTypeButton);
|
box->AddChild(fSelectTypeButton);
|
||||||
|
|
||||||
rect.OffsetBy(fSelectTypeButton->Bounds().Width() + 8.0f, 0.0f);
|
rect.OffsetBy(fSelectTypeButton->Bounds().Width() + 8.0f, 0.0f);
|
||||||
fSameTypeAsButton = new BButton(rect, "same type as", "Same as" B_UTF8_ELLIPSIS,
|
fSameTypeAsButton = new BButton(rect, "same type as",
|
||||||
|
TR("Same as" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgSameTypeAs), B_FOLLOW_LEFT | B_FOLLOW_TOP);
|
new BMessage(kMsgSameTypeAs), B_FOLLOW_LEFT | B_FOLLOW_TOP);
|
||||||
fSameTypeAsButton->ResizeToPreferred();
|
fSameTypeAsButton->ResizeToPreferred();
|
||||||
box->AddChild(fSameTypeAsButton);
|
box->AddChild(fSameTypeAsButton);
|
||||||
@@ -121,12 +129,12 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
|
|||||||
rect.left = 8.0f;
|
rect.left = 8.0f;
|
||||||
rect.right = Bounds().Width() - 8.0f;
|
rect.right = Bounds().Width() - 8.0f;
|
||||||
box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
box->SetLabel("Preferred application");
|
box->SetLabel(TR("Preferred application"));
|
||||||
topView->AddChild(box);
|
topView->AddChild(box);
|
||||||
|
|
||||||
BMenu* menu = new BPopUpMenu("preferred");
|
BMenu* menu = new BPopUpMenu("preferred");
|
||||||
BMenuItem* item;
|
BMenuItem* item;
|
||||||
menu->AddItem(item = new BMenuItem("Default application",
|
menu->AddItem(item = new BMenuItem(TR("Default application"),
|
||||||
new BMessage(kMsgPreferredAppChosen)));
|
new BMessage(kMsgPreferredAppChosen)));
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
|
|
||||||
@@ -147,13 +155,15 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
|
|||||||
box->AddChild(constrainingView);
|
box->AddChild(constrainingView);
|
||||||
|
|
||||||
rect.OffsetBy(0.0f, height + 5.0f);
|
rect.OffsetBy(0.0f, height + 5.0f);
|
||||||
fSelectAppButton = new BButton(rect, "select app", "Select" B_UTF8_ELLIPSIS,
|
fSelectAppButton = new BButton(rect, "select app",
|
||||||
|
TR("Select" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgSelectPreferredApp), B_FOLLOW_LEFT | B_FOLLOW_TOP);
|
new BMessage(kMsgSelectPreferredApp), B_FOLLOW_LEFT | B_FOLLOW_TOP);
|
||||||
fSelectAppButton->ResizeToPreferred();
|
fSelectAppButton->ResizeToPreferred();
|
||||||
box->AddChild(fSelectAppButton);
|
box->AddChild(fSelectAppButton);
|
||||||
|
|
||||||
rect.OffsetBy(fSelectAppButton->Bounds().Width() + 8.0f, 0.0f);
|
rect.OffsetBy(fSelectAppButton->Bounds().Width() + 8.0f, 0.0f);
|
||||||
fSameAppAsButton = new BButton(rect, "same app as", "Same as" B_UTF8_ELLIPSIS,
|
fSameAppAsButton = new BButton(rect, "same app as",
|
||||||
|
TR("Same as" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgSamePreferredAppAs), B_FOLLOW_LEFT | B_FOLLOW_TOP);
|
new BMessage(kMsgSamePreferredAppAs), B_FOLLOW_LEFT | B_FOLLOW_TOP);
|
||||||
fSameAppAsButton->ResizeToPreferred();
|
fSameAppAsButton->ResizeToPreferred();
|
||||||
box->AddChild(fSameAppAsButton);
|
box->AddChild(fSameAppAsButton);
|
||||||
@@ -203,11 +213,11 @@ FileTypeWindow::_Title(const BMessage& refs)
|
|||||||
|
|
||||||
char name[B_FILE_NAME_LENGTH];
|
char name[B_FILE_NAME_LENGTH];
|
||||||
if (same && parent.GetName(name) == B_OK) {
|
if (same && parent.GetName(name) == B_OK) {
|
||||||
title = "Multiple files from \"";
|
title = TR("Multiple files from \"");
|
||||||
title.Append(name);
|
title.Append(name);
|
||||||
title.Append("\"");
|
title.Append("\"");
|
||||||
} else
|
} else
|
||||||
title = "[Multiple files]";
|
title = TR("[Multiple files]");
|
||||||
} else if (refs.FindRef("refs", 0, &ref) == B_OK)
|
} else if (refs.FindRef("refs", 0, &ref) == B_OK)
|
||||||
title = ref.name;
|
title = ref.name;
|
||||||
|
|
||||||
@@ -294,7 +304,7 @@ FileTypeWindow::_AdoptType(BMessage* message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
error_alert("Could not open file", status);
|
error_alert(TR("Could not open file"), status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +401,7 @@ FileTypeWindow::MessageReceived(BMessage* message)
|
|||||||
case kMsgSameTypeAs:
|
case kMsgSameTypeAs:
|
||||||
{
|
{
|
||||||
BMessage panel(kMsgOpenFilePanel);
|
BMessage panel(kMsgOpenFilePanel);
|
||||||
panel.AddString("title", "Select same type as");
|
panel.AddString("title", TR("Select same type as"));
|
||||||
panel.AddInt32("message", kMsgSameTypeAsOpened);
|
panel.AddInt32("message", kMsgSameTypeAsOpened);
|
||||||
panel.AddMessenger("target", this);
|
panel.AddMessenger("target", this);
|
||||||
|
|
||||||
@@ -419,7 +429,7 @@ FileTypeWindow::MessageReceived(BMessage* message)
|
|||||||
case kMsgSelectPreferredApp:
|
case kMsgSelectPreferredApp:
|
||||||
{
|
{
|
||||||
BMessage panel(kMsgOpenFilePanel);
|
BMessage panel(kMsgOpenFilePanel);
|
||||||
panel.AddString("title", "Select preferred application");
|
panel.AddString("title", TR("Select preferred application"));
|
||||||
panel.AddInt32("message", kMsgPreferredAppOpened);
|
panel.AddInt32("message", kMsgPreferredAppOpened);
|
||||||
panel.AddMessenger("target", this);
|
panel.AddMessenger("target", this);
|
||||||
|
|
||||||
@@ -433,7 +443,7 @@ FileTypeWindow::MessageReceived(BMessage* message)
|
|||||||
case kMsgSamePreferredAppAs:
|
case kMsgSamePreferredAppAs:
|
||||||
{
|
{
|
||||||
BMessage panel(kMsgOpenFilePanel);
|
BMessage panel(kMsgOpenFilePanel);
|
||||||
panel.AddString("title", "Select same preferred application as");
|
panel.AddString("title", TR("Select same preferred application as"));
|
||||||
panel.AddInt32("message", kMsgSamePreferredAppAsOpened);
|
panel.AddInt32("message", kMsgSamePreferredAppAsOpened);
|
||||||
panel.AddMessenger("target", this);
|
panel.AddMessenger("target", this);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
#include <AppFileInfo.h>
|
#include <AppFileInfo.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
#include <FilePanel.h>
|
#include <FilePanel.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
@@ -24,6 +26,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "FileTypes"
|
||||||
|
|
||||||
|
|
||||||
const char *kSignature = "application/x-vnd.Haiku-FileTypes";
|
const char *kSignature = "application/x-vnd.Haiku-FileTypes";
|
||||||
|
|
||||||
static const uint32 kMsgFileTypesSettings = 'FTst';
|
static const uint32 kMsgFileTypesSettings = 'FTst';
|
||||||
@@ -70,6 +76,8 @@ class FileTypes : public BApplication {
|
|||||||
BWindow *fApplicationTypesWindow;
|
BWindow *fApplicationTypesWindow;
|
||||||
uint32 fWindowCount;
|
uint32 fWindowCount;
|
||||||
uint32 fTypeWindowCount;
|
uint32 fTypeWindowCount;
|
||||||
|
|
||||||
|
BCatalog fCatalog;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -163,6 +171,7 @@ FileTypes::FileTypes()
|
|||||||
fWindowCount(0),
|
fWindowCount(0),
|
||||||
fTypeWindowCount(0)
|
fTypeWindowCount(0)
|
||||||
{
|
{
|
||||||
|
be_locale->GetAppCatalog(&fCatalog);
|
||||||
fFilePanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL,
|
fFilePanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL,
|
||||||
B_FILE_NODE | B_DIRECTORY_NODE, false);
|
B_FILE_NODE | B_DIRECTORY_NODE, false);
|
||||||
}
|
}
|
||||||
@@ -207,11 +216,11 @@ FileTypes::RefsReceived(BMessage *message)
|
|||||||
|
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
snprintf(buffer, sizeof(buffer),
|
snprintf(buffer, sizeof(buffer),
|
||||||
"Could not open \"%s\":\n"
|
TR("Could not open \"%s\":\n"
|
||||||
"%s",
|
"%s"),
|
||||||
ref.name, strerror(status));
|
ref.name, strerror(status));
|
||||||
|
|
||||||
(new BAlert("FileTypes request",
|
(new BAlert(TR("FileTypes request"),
|
||||||
buffer, "Ok", NULL, NULL,
|
buffer, "Ok", NULL, NULL,
|
||||||
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
|
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
|
||||||
|
|
||||||
@@ -278,7 +287,7 @@ FileTypes::ArgvReceived(int32 argc, char **argv)
|
|||||||
|
|
||||||
if ((status = entry.SetTo(path.Path(), false)) != B_OK
|
if ((status = entry.SetTo(path.Path(), false)) != B_OK
|
||||||
|| (status = entry.GetRef(&ref)) != B_OK) {
|
|| (status = entry.GetRef(&ref)) != B_OK) {
|
||||||
fprintf(stderr, "Could not open file \"%s\": %s\n",
|
fprintf(stderr, TR("Could not open file \"%s\": %s\n"),
|
||||||
path.Path(), strerror(status));
|
path.Path(), strerror(status));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -347,7 +356,7 @@ FileTypes::MessageReceived(BMessage *message)
|
|||||||
// the open file panel sends us a message when it's done
|
// the open file panel sends us a message when it's done
|
||||||
const char* subTitle;
|
const char* subTitle;
|
||||||
if (message->FindString("title", &subTitle) != B_OK)
|
if (message->FindString("title", &subTitle) != B_OK)
|
||||||
subTitle = "Open File";
|
subTitle = TR("Open File");
|
||||||
|
|
||||||
int32 what;
|
int32 what;
|
||||||
if (message->FindInt32("message", &what) != B_OK)
|
if (message->FindInt32("message", &what) != B_OK)
|
||||||
@@ -398,9 +407,9 @@ FileTypes::MessageReceived(BMessage *message)
|
|||||||
void
|
void
|
||||||
FileTypes::AboutRequested()
|
FileTypes::AboutRequested()
|
||||||
{
|
{
|
||||||
BAlert *alert = new BAlert("about", "FileTypes\n"
|
BAlert *alert = new BAlert("about", TR("FileTypes\n"
|
||||||
"\twritten by Axel Dörfler\n"
|
"\twritten by Axel Dörfler\n"
|
||||||
"\tCopyright 2006-2007, Haiku.\n", "Ok");
|
"\tCopyright 2006-2007, Haiku.\n"), TR("Ok"));
|
||||||
BTextView *view = alert->TextView();
|
BTextView *view = alert->TextView();
|
||||||
BFont font;
|
BFont font;
|
||||||
|
|
||||||
@@ -448,7 +457,7 @@ error_alert(const char* message, status_t status, alert_type type)
|
|||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
snprintf(warning, sizeof(warning), "%s:\n\t%s\n", message, strerror(status));
|
snprintf(warning, sizeof(warning), "%s:\n\t%s\n", message, strerror(status));
|
||||||
|
|
||||||
(new BAlert("FileTypes Request",
|
(new BAlert(TR("FileTypes Request"),
|
||||||
status == B_OK ? message : warning,
|
status == B_OK ? message : warning,
|
||||||
"Ok", NULL, NULL, B_WIDTH_AS_USUAL, type))->Go();
|
"Ok", NULL, NULL, B_WIDTH_AS_USUAL, type))->Go();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,9 @@
|
|||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <ListView.h>
|
#include <ListView.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
@@ -39,6 +41,10 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "FileType Window"
|
||||||
|
|
||||||
|
|
||||||
const uint32 kMsgTypeSelected = 'typs';
|
const uint32 kMsgTypeSelected = 'typs';
|
||||||
const uint32 kMsgAddType = 'atyp';
|
const uint32 kMsgAddType = 'atyp';
|
||||||
const uint32 kMsgRemoveType = 'rtyp';
|
const uint32 kMsgRemoveType = 'rtyp';
|
||||||
@@ -125,13 +131,13 @@ TypeIconView::Draw(BRect updateRect)
|
|||||||
|
|
||||||
switch (IconSource()) {
|
switch (IconSource()) {
|
||||||
case kNoIcon:
|
case kNoIcon:
|
||||||
text = "no icon";
|
text = TR("no icon");
|
||||||
break;
|
break;
|
||||||
case kApplicationIcon:
|
case kApplicationIcon:
|
||||||
text = "(from application)";
|
text = TR("(from application)");
|
||||||
break;
|
break;
|
||||||
case kSupertypeIcon:
|
case kSupertypeIcon:
|
||||||
text = "(from super type)";
|
text = TR("(from super type)");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -160,8 +166,8 @@ void
|
|||||||
TypeIconView::GetPreferredSize(float* _width, float* _height)
|
TypeIconView::GetPreferredSize(float* _width, float* _height)
|
||||||
{
|
{
|
||||||
if (_width) {
|
if (_width) {
|
||||||
float a = StringWidth("(from application)");
|
float a = StringWidth(TR("(from application)"));
|
||||||
float b = StringWidth("(from super type)");
|
float b = StringWidth(TR("(from super type)"));
|
||||||
float width = max_c(a, b);
|
float width = max_c(a, b);
|
||||||
if (width < IconSize())
|
if (width < IconSize())
|
||||||
width = IconSize();
|
width = IconSize();
|
||||||
@@ -186,7 +192,7 @@ TypeIconView::BitmapRect() const
|
|||||||
font_height fontHeight;
|
font_height fontHeight;
|
||||||
GetFontHeight(&fontHeight);
|
GetFontHeight(&fontHeight);
|
||||||
|
|
||||||
float width = StringWidth("no icon") + 8.0f;
|
float width = StringWidth(TR("no icon")) + 8.0f;
|
||||||
float height = ceilf(fontHeight.ascent + fontHeight.descent) + 6.0f;
|
float height = ceilf(fontHeight.ascent + fontHeight.descent) + 6.0f;
|
||||||
float x = (Bounds().Width() - width) / 2.0f;
|
float x = (Bounds().Width() - width) / 2.0f;
|
||||||
float y = ceilf((IconSize() - fontHeight.ascent - fontHeight.descent) / 2.0f) - 3.0f;
|
float y = ceilf((IconSize() - fontHeight.ascent - fontHeight.descent) / 2.0f) - 3.0f;
|
||||||
@@ -287,37 +293,38 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
|||||||
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
|
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
|
||||||
AddChild(menuBar);
|
AddChild(menuBar);
|
||||||
|
|
||||||
BMenu* menu = new BMenu("File");
|
BMenu* menu = new BMenu(TR("File"));
|
||||||
BMenuItem* item;
|
BMenuItem* item;
|
||||||
menu->AddItem(item = new BMenuItem("New resource file" B_UTF8_ELLIPSIS,
|
menu->AddItem(item = new BMenuItem(TR("New resource file" B_UTF8_ELLIPSIS),
|
||||||
NULL, 'N', B_COMMAND_KEY));
|
NULL, 'N', B_COMMAND_KEY));
|
||||||
item->SetEnabled(false);
|
item->SetEnabled(false);
|
||||||
|
|
||||||
BMenu* recentsMenu = BRecentFilesList::NewFileListMenu("Open" B_UTF8_ELLIPSIS,
|
BMenu* recentsMenu = BRecentFilesList::NewFileListMenu(
|
||||||
|
TR("Open" B_UTF8_ELLIPSIS),
|
||||||
NULL, NULL, be_app, 10, false, NULL, kSignature);
|
NULL, NULL, be_app, 10, false, NULL, kSignature);
|
||||||
item = new BMenuItem(recentsMenu, new BMessage(kMsgOpenFilePanel));
|
item = new BMenuItem(recentsMenu, new BMessage(kMsgOpenFilePanel));
|
||||||
item->SetShortcut('O', B_COMMAND_KEY);
|
item->SetShortcut('O', B_COMMAND_KEY);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
menu->AddItem(new BMenuItem("Application types" B_UTF8_ELLIPSIS,
|
menu->AddItem(new BMenuItem(TR("Application types" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgOpenApplicationTypesWindow)));
|
new BMessage(kMsgOpenApplicationTypesWindow)));
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
menu->AddItem(new BMenuItem("About FileTypes" B_UTF8_ELLIPSIS,
|
menu->AddItem(new BMenuItem(TR("About FileTypes" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(B_ABOUT_REQUESTED)));
|
new BMessage(B_ABOUT_REQUESTED)));
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED),
|
menu->AddItem(new BMenuItem(TR("Quit"), new BMessage(B_QUIT_REQUESTED),
|
||||||
'Q', B_COMMAND_KEY));
|
'Q', B_COMMAND_KEY));
|
||||||
menu->SetTargetForItems(be_app);
|
menu->SetTargetForItems(be_app);
|
||||||
menuBar->AddItem(menu);
|
menuBar->AddItem(menu);
|
||||||
|
|
||||||
menu = new BMenu("Settings");
|
menu = new BMenu(TR("Settings"));
|
||||||
item = new BMenuItem("Show icons in list", new BMessage(kMsgToggleIcons));
|
item = new BMenuItem(TR("Show icons in list"), new BMessage(kMsgToggleIcons));
|
||||||
item->SetMarked(showIcons);
|
item->SetMarked(showIcons);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
|
||||||
item = new BMenuItem("Show recognition rule", new BMessage(kMsgToggleRule));
|
item = new BMenuItem(TR("Show recognition rule"), new BMessage(kMsgToggleRule));
|
||||||
item->SetMarked(showRule);
|
item->SetMarked(showRule);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
@@ -331,7 +338,7 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
|||||||
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
AddChild(topView);
|
AddChild(topView);
|
||||||
|
|
||||||
BButton* button = new BButton(rect, "add", "Add" B_UTF8_ELLIPSIS,
|
BButton* button = new BButton(rect, "add", TR("Add" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgAddType), B_FOLLOW_BOTTOM);
|
new BMessage(kMsgAddType), B_FOLLOW_BOTTOM);
|
||||||
button->ResizeToPreferred();
|
button->ResizeToPreferred();
|
||||||
button->MoveTo(8.0f, topView->Bounds().bottom - 8.0f - button->Bounds().Height());
|
button->MoveTo(8.0f, topView->Bounds().bottom - 8.0f - button->Bounds().Height());
|
||||||
@@ -339,7 +346,7 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
|||||||
|
|
||||||
rect = button->Frame();
|
rect = button->Frame();
|
||||||
rect.OffsetBy(rect.Width() + 8.0f, 0.0f);
|
rect.OffsetBy(rect.Width() + 8.0f, 0.0f);
|
||||||
fRemoveTypeButton = new BButton(rect, "remove", "Remove",
|
fRemoveTypeButton = new BButton(rect, "remove", TR("Remove"),
|
||||||
new BMessage(kMsgRemoveType), B_FOLLOW_BOTTOM);
|
new BMessage(kMsgRemoveType), B_FOLLOW_BOTTOM);
|
||||||
fRemoveTypeButton->ResizeToPreferred();
|
fRemoveTypeButton->ResizeToPreferred();
|
||||||
topView->AddChild(fRemoveTypeButton);
|
topView->AddChild(fRemoveTypeButton);
|
||||||
@@ -367,7 +374,7 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
|||||||
+ plainHeight.leading) + 2.0f;
|
+ plainHeight.leading) + 2.0f;
|
||||||
|
|
||||||
BFont font(be_bold_font);
|
BFont font(be_bold_font);
|
||||||
float labelWidth = font.StringWidth("Icon");
|
float labelWidth = font.StringWidth(TR("Icon"));
|
||||||
font_height boldHeight;
|
font_height boldHeight;
|
||||||
font.GetHeight(&boldHeight);
|
font.GetHeight(&boldHeight);
|
||||||
|
|
||||||
@@ -383,7 +390,7 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
|||||||
button->Bounds().Height() * 2.0f + height + 4.0f) + 12.0f;
|
button->Bounds().Height() * 2.0f + height + 4.0f) + 12.0f;
|
||||||
rect.top -= 2.0f;
|
rect.top -= 2.0f;
|
||||||
fIconBox = new BBox(rect);
|
fIconBox = new BBox(rect);
|
||||||
fIconBox->SetLabel("Icon");
|
fIconBox->SetLabel(TR("Icon"));
|
||||||
topView->AddChild(fIconBox);
|
topView->AddChild(fIconBox);
|
||||||
|
|
||||||
innerRect.left = 8.0f;
|
innerRect.left = 8.0f;
|
||||||
@@ -400,25 +407,25 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
|||||||
rightRect.left = rect.right + 8.0f;
|
rightRect.left = rect.right + 8.0f;
|
||||||
rightRect.right = topView->Bounds().Width() - 8.0f;
|
rightRect.right = topView->Bounds().Width() - 8.0f;
|
||||||
fRecognitionBox = new BBox(rightRect, NULL, B_FOLLOW_LEFT_RIGHT);
|
fRecognitionBox = new BBox(rightRect, NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
fRecognitionBox->SetLabel("File recognition");
|
fRecognitionBox->SetLabel(TR("File recognition"));
|
||||||
topView->AddChild(fRecognitionBox);
|
topView->AddChild(fRecognitionBox);
|
||||||
|
|
||||||
innerRect = fRecognitionBox->Bounds().InsetByCopy(8.0f, 4.0f);
|
innerRect = fRecognitionBox->Bounds().InsetByCopy(8.0f, 4.0f);
|
||||||
innerRect.top += ceilf(boldHeight.ascent);
|
innerRect.top += ceilf(boldHeight.ascent);
|
||||||
fExtensionLabel = new StringView(innerRect, "extension", "Extensions:", NULL);
|
fExtensionLabel = new StringView(innerRect, "extension", TR("Extensions:"), NULL);
|
||||||
fExtensionLabel->SetAlignment(B_ALIGN_LEFT, B_ALIGN_LEFT);
|
fExtensionLabel->SetAlignment(B_ALIGN_LEFT, B_ALIGN_LEFT);
|
||||||
fExtensionLabel->ResizeToPreferred();
|
fExtensionLabel->ResizeToPreferred();
|
||||||
fRecognitionBox->AddChild(fExtensionLabel);
|
fRecognitionBox->AddChild(fExtensionLabel);
|
||||||
|
|
||||||
innerRect.top += fExtensionLabel->Bounds().Height() + 2.0f;
|
innerRect.top += fExtensionLabel->Bounds().Height() + 2.0f;
|
||||||
innerRect.left = innerRect.right - button->StringWidth("Remove") - 16.0f;
|
innerRect.left = innerRect.right - button->StringWidth(TR("Remove")) - 16.0f;
|
||||||
innerRect.bottom = innerRect.top + button->Bounds().Height();
|
innerRect.bottom = innerRect.top + button->Bounds().Height();
|
||||||
fAddExtensionButton = new BButton(innerRect, "add ext", "Add" B_UTF8_ELLIPSIS,
|
fAddExtensionButton = new BButton(innerRect, "add ext", TR("Add" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgAddExtension), B_FOLLOW_RIGHT);
|
new BMessage(kMsgAddExtension), B_FOLLOW_RIGHT);
|
||||||
fRecognitionBox->AddChild(fAddExtensionButton);
|
fRecognitionBox->AddChild(fAddExtensionButton);
|
||||||
|
|
||||||
innerRect.OffsetBy(0, innerRect.Height() + 4.0f);
|
innerRect.OffsetBy(0, innerRect.Height() + 4.0f);
|
||||||
fRemoveExtensionButton = new BButton(innerRect, "remove ext", "Remove",
|
fRemoveExtensionButton = new BButton(innerRect, "remove ext", TR("Remove"),
|
||||||
new BMessage(kMsgRemoveExtension), B_FOLLOW_RIGHT);
|
new BMessage(kMsgRemoveExtension), B_FOLLOW_RIGHT);
|
||||||
fRecognitionBox->AddChild(fRemoveExtensionButton);
|
fRecognitionBox->AddChild(fRemoveExtensionButton);
|
||||||
|
|
||||||
@@ -440,7 +447,7 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
|||||||
innerRect.top = innerRect.bottom + 10.0f;
|
innerRect.top = innerRect.bottom + 10.0f;
|
||||||
innerRect.right = fRecognitionBox->Bounds().right - 8.0f;
|
innerRect.right = fRecognitionBox->Bounds().right - 8.0f;
|
||||||
innerRect.bottom = innerRect.top + 20.0f;
|
innerRect.bottom = innerRect.top + 20.0f;
|
||||||
fRuleControl = new BTextControl(innerRect, "rule", "Rule:", "",
|
fRuleControl = new BTextControl(innerRect, "rule", TR("Rule:"), "",
|
||||||
new BMessage(kMsgRuleEntered), B_FOLLOW_LEFT_RIGHT);
|
new BMessage(kMsgRuleEntered), B_FOLLOW_LEFT_RIGHT);
|
||||||
//fRuleControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
//fRuleControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
||||||
fRuleControl->SetDivider(fRuleControl->StringWidth(fRuleControl->Label()) + 6.0f);
|
fRuleControl->SetDivider(fRuleControl->StringWidth(fRuleControl->Label()) + 6.0f);
|
||||||
@@ -453,13 +460,13 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
|||||||
rect.bottom = rect.top + ceilf(boldHeight.ascent) + 24.0f;
|
rect.bottom = rect.top + ceilf(boldHeight.ascent) + 24.0f;
|
||||||
rect.right = rightRect.right;
|
rect.right = rightRect.right;
|
||||||
fDescriptionBox = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
fDescriptionBox = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
fDescriptionBox->SetLabel("Description");
|
fDescriptionBox->SetLabel(TR("Description"));
|
||||||
topView->AddChild(fDescriptionBox);
|
topView->AddChild(fDescriptionBox);
|
||||||
|
|
||||||
innerRect = fDescriptionBox->Bounds().InsetByCopy(8.0f, 6.0f);
|
innerRect = fDescriptionBox->Bounds().InsetByCopy(8.0f, 6.0f);
|
||||||
innerRect.top += ceilf(boldHeight.ascent);
|
innerRect.top += ceilf(boldHeight.ascent);
|
||||||
innerRect.bottom = innerRect.top + button->Bounds().Height();
|
innerRect.bottom = innerRect.top + button->Bounds().Height();
|
||||||
fInternalNameView = new StringView(innerRect, "internal", "Internal name:", "",
|
fInternalNameView = new StringView(innerRect, "internal", TR("Internal name:"), "",
|
||||||
B_FOLLOW_LEFT_RIGHT);
|
B_FOLLOW_LEFT_RIGHT);
|
||||||
labelWidth = fInternalNameView->StringWidth(fInternalNameView->Label()) + 2.0f;
|
labelWidth = fInternalNameView->StringWidth(fInternalNameView->Label()) + 2.0f;
|
||||||
fInternalNameView->SetDivider(labelWidth);
|
fInternalNameView->SetDivider(labelWidth);
|
||||||
@@ -468,7 +475,7 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
|||||||
fDescriptionBox->AddChild(fInternalNameView);
|
fDescriptionBox->AddChild(fInternalNameView);
|
||||||
|
|
||||||
innerRect.OffsetBy(0, fInternalNameView->Bounds().Height() + 5.0f);
|
innerRect.OffsetBy(0, fInternalNameView->Bounds().Height() + 5.0f);
|
||||||
fTypeNameControl = new BTextControl(innerRect, "type", "Type name:", "",
|
fTypeNameControl = new BTextControl(innerRect, "type", TR("Type name:"), "",
|
||||||
new BMessage(kMsgTypeEntered), B_FOLLOW_LEFT_RIGHT);
|
new BMessage(kMsgTypeEntered), B_FOLLOW_LEFT_RIGHT);
|
||||||
fTypeNameControl->SetDivider(labelWidth);
|
fTypeNameControl->SetDivider(labelWidth);
|
||||||
fTypeNameControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
fTypeNameControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
||||||
@@ -477,7 +484,7 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
|||||||
fDescriptionBox->AddChild(fTypeNameControl);
|
fDescriptionBox->AddChild(fTypeNameControl);
|
||||||
|
|
||||||
innerRect.OffsetBy(0, fTypeNameControl->Bounds().Height() + 5.0f);
|
innerRect.OffsetBy(0, fTypeNameControl->Bounds().Height() + 5.0f);
|
||||||
fDescriptionControl = new BTextControl(innerRect, "description", "Description:", "",
|
fDescriptionControl = new BTextControl(innerRect, "description", TR("Description:"), "",
|
||||||
new BMessage(kMsgDescriptionEntered), B_FOLLOW_LEFT_RIGHT);
|
new BMessage(kMsgDescriptionEntered), B_FOLLOW_LEFT_RIGHT);
|
||||||
fDescriptionControl->SetDivider(labelWidth);
|
fDescriptionControl->SetDivider(labelWidth);
|
||||||
fDescriptionControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
fDescriptionControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
||||||
@@ -490,26 +497,26 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
|||||||
rect.bottom = rect.top + ceilf(boldHeight.ascent)
|
rect.bottom = rect.top + ceilf(boldHeight.ascent)
|
||||||
+ button->Bounds().Height() + 14.0f;
|
+ button->Bounds().Height() + 14.0f;
|
||||||
fPreferredBox = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
fPreferredBox = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
fPreferredBox->SetLabel("Preferred application");
|
fPreferredBox->SetLabel(TR("Preferred application"));
|
||||||
topView->AddChild(fPreferredBox);
|
topView->AddChild(fPreferredBox);
|
||||||
|
|
||||||
innerRect = fPreferredBox->Bounds().InsetByCopy(8.0f, 6.0f);
|
innerRect = fPreferredBox->Bounds().InsetByCopy(8.0f, 6.0f);
|
||||||
innerRect.top += ceilf(boldHeight.ascent);
|
innerRect.top += ceilf(boldHeight.ascent);
|
||||||
innerRect.left = innerRect.right - button->StringWidth(
|
innerRect.left = innerRect.right - button->StringWidth(
|
||||||
"Same as" B_UTF8_ELLIPSIS) - 24.0f;
|
TR("Same as" B_UTF8_ELLIPSIS)) - 24.0f;
|
||||||
innerRect.bottom = innerRect.top + button->Bounds().Height();
|
innerRect.bottom = innerRect.top + button->Bounds().Height();
|
||||||
fSameAsButton = new BButton(innerRect, "same as",
|
fSameAsButton = new BButton(innerRect, "same as",
|
||||||
"Same as" B_UTF8_ELLIPSIS,
|
TR("Same as" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgSamePreferredAppAs), B_FOLLOW_RIGHT);
|
new BMessage(kMsgSamePreferredAppAs), B_FOLLOW_RIGHT);
|
||||||
fPreferredBox->AddChild(fSameAsButton);
|
fPreferredBox->AddChild(fSameAsButton);
|
||||||
|
|
||||||
innerRect.OffsetBy(-innerRect.Width() - 6.0f, 0.0f);
|
innerRect.OffsetBy(-innerRect.Width() - 6.0f, 0.0f);
|
||||||
fSelectButton = new BButton(innerRect, "select", "Select" B_UTF8_ELLIPSIS,
|
fSelectButton = new BButton(innerRect, "select", TR("Select" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgSelectPreferredApp), B_FOLLOW_RIGHT);
|
new BMessage(kMsgSelectPreferredApp), B_FOLLOW_RIGHT);
|
||||||
fPreferredBox->AddChild(fSelectButton);
|
fPreferredBox->AddChild(fSelectButton);
|
||||||
|
|
||||||
menu = new BPopUpMenu("preferred");
|
menu = new BPopUpMenu("preferred");
|
||||||
menu->AddItem(item = new BMenuItem("None",
|
menu->AddItem(item = new BMenuItem(TR("None"),
|
||||||
new BMessage(kMsgPreferredAppChosen)));
|
new BMessage(kMsgPreferredAppChosen)));
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
|
|
||||||
@@ -531,19 +538,19 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
|||||||
rect.bottom = topView->Bounds().Height() - 8.0f;
|
rect.bottom = topView->Bounds().Height() - 8.0f;
|
||||||
fAttributeBox = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT
|
fAttributeBox = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT
|
||||||
| B_FOLLOW_TOP_BOTTOM);
|
| B_FOLLOW_TOP_BOTTOM);
|
||||||
fAttributeBox->SetLabel("Extra attributes");
|
fAttributeBox->SetLabel(TR("Extra attributes"));
|
||||||
topView->AddChild(fAttributeBox);
|
topView->AddChild(fAttributeBox);
|
||||||
|
|
||||||
innerRect = fAttributeBox->Bounds().InsetByCopy(8.0f, 6.0f);
|
innerRect = fAttributeBox->Bounds().InsetByCopy(8.0f, 6.0f);
|
||||||
innerRect.top += ceilf(boldHeight.ascent);
|
innerRect.top += ceilf(boldHeight.ascent);
|
||||||
innerRect.left = innerRect.right - button->StringWidth("Remove") - 16.0f;
|
innerRect.left = innerRect.right - button->StringWidth(TR("Remove")) - 16.0f;
|
||||||
innerRect.bottom = innerRect.top + button->Bounds().Height();
|
innerRect.bottom = innerRect.top + button->Bounds().Height();
|
||||||
fAddAttributeButton = new BButton(innerRect, "add attr",
|
fAddAttributeButton = new BButton(innerRect, "add attr",
|
||||||
"Add" B_UTF8_ELLIPSIS, new BMessage(kMsgAddAttribute), B_FOLLOW_RIGHT);
|
TR("Add" B_UTF8_ELLIPSIS), new BMessage(kMsgAddAttribute), B_FOLLOW_RIGHT);
|
||||||
fAttributeBox->AddChild(fAddAttributeButton);
|
fAttributeBox->AddChild(fAddAttributeButton);
|
||||||
|
|
||||||
innerRect.OffsetBy(0, innerRect.Height() + 4.0f);
|
innerRect.OffsetBy(0, innerRect.Height() + 4.0f);
|
||||||
fRemoveAttributeButton = new BButton(innerRect, "remove attr", "Remove",
|
fRemoveAttributeButton = new BButton(innerRect, "remove attr", TR("Remove"),
|
||||||
new BMessage(kMsgRemoveAttribute), B_FOLLOW_RIGHT);
|
new BMessage(kMsgRemoveAttribute), B_FOLLOW_RIGHT);
|
||||||
fAttributeBox->AddChild(fRemoveAttributeButton);
|
fAttributeBox->AddChild(fRemoveAttributeButton);
|
||||||
/*
|
/*
|
||||||
@@ -669,7 +676,7 @@ FileTypesWindow::_AdoptPreferredApplication(BMessage* message, bool sameAs)
|
|||||||
|
|
||||||
status_t status = fCurrentType.SetPreferredApp(preferred.String());
|
status_t status = fCurrentType.SetPreferredApp(preferred.String());
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
error_alert("Could not set preferred application", status);
|
error_alert(TR("Could not set preferred application"), status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -863,26 +870,26 @@ FileTypesWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
BAlert* alert;
|
BAlert* alert;
|
||||||
if (fCurrentType.IsSupertypeOnly()) {
|
if (fCurrentType.IsSupertypeOnly()) {
|
||||||
alert = new BPrivate::OverrideAlert("FileTypes Request",
|
alert = new BPrivate::OverrideAlert(TR("FileTypes Request"),
|
||||||
"Removing a super type cannot be reverted.\n"
|
TR("Removing a super type cannot be reverted.\n"
|
||||||
"All file types that belong to this super type "
|
"All file types that belong to this super type "
|
||||||
"will be lost!\n\n"
|
"will be lost!\n\n"
|
||||||
"Are you sure you want to do this? To remove the whole "
|
"Are you sure you want to do this? To remove the whole "
|
||||||
"group, hold down the Shift key and press \"Remove\".",
|
"group, hold down the Shift key and press \"Remove\"."),
|
||||||
"Remove", B_SHIFT_KEY, "Cancel", 0, NULL, 0,
|
TR("Remove"), B_SHIFT_KEY, TR("Cancel"), 0, NULL, 0,
|
||||||
B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
||||||
} else {
|
} else {
|
||||||
alert = new BAlert("FileTypes Request",
|
alert = new BAlert(TR("FileTypes Request"),
|
||||||
"Removing a file type cannot be reverted.\n"
|
TR("Removing a file type cannot be reverted.\n"
|
||||||
"Are you sure you want to remove it?",
|
"Are you sure you want to remove it?"),
|
||||||
"Remove", "Cancel", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
TR("Remove"), TR("Cancel"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
||||||
}
|
}
|
||||||
if (alert->Go())
|
if (alert->Go())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
status_t status = fCurrentType.Delete();
|
status_t status = fCurrentType.Delete();
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
fprintf(stderr, "Could not remove file type: %s\n", strerror(status));
|
fprintf(stderr, TR("Could not remove file type: %s\n"), strerror(status));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -952,7 +959,7 @@ FileTypesWindow::MessageReceived(BMessage* message)
|
|||||||
// check rule
|
// check rule
|
||||||
BString parseError;
|
BString parseError;
|
||||||
if (BMimeType::CheckSnifferRule(fRuleControl->Text(), &parseError) != B_OK) {
|
if (BMimeType::CheckSnifferRule(fRuleControl->Text(), &parseError) != B_OK) {
|
||||||
parseError.Prepend("Recognition rule is not valid:\n\n");
|
parseError.Prepend(TR("Recognition rule is not valid:\n\n"));
|
||||||
error_alert(parseError.String());
|
error_alert(parseError.String());
|
||||||
} else
|
} else
|
||||||
fCurrentType.SetSnifferRule(fRuleControl->Text());
|
fCurrentType.SetSnifferRule(fRuleControl->Text());
|
||||||
@@ -988,7 +995,7 @@ FileTypesWindow::MessageReceived(BMessage* message)
|
|||||||
case kMsgSelectPreferredApp:
|
case kMsgSelectPreferredApp:
|
||||||
{
|
{
|
||||||
BMessage panel(kMsgOpenFilePanel);
|
BMessage panel(kMsgOpenFilePanel);
|
||||||
panel.AddString("title", "Select preferred application");
|
panel.AddString("title", TR("Select preferred application"));
|
||||||
panel.AddInt32("message", kMsgPreferredAppOpened);
|
panel.AddInt32("message", kMsgPreferredAppOpened);
|
||||||
panel.AddMessenger("target", this);
|
panel.AddMessenger("target", this);
|
||||||
|
|
||||||
@@ -1002,7 +1009,7 @@ FileTypesWindow::MessageReceived(BMessage* message)
|
|||||||
case kMsgSamePreferredAppAs:
|
case kMsgSamePreferredAppAs:
|
||||||
{
|
{
|
||||||
BMessage panel(kMsgOpenFilePanel);
|
BMessage panel(kMsgOpenFilePanel);
|
||||||
panel.AddString("title", "Select same preferred application as");
|
panel.AddString("title", TR("Select same preferred application as"));
|
||||||
panel.AddInt32("message", kMsgSamePreferredAppAsOpened);
|
panel.AddInt32("message", kMsgSamePreferredAppAsOpened);
|
||||||
panel.AddMessenger("target", this);
|
panel.AddMessenger("target", this);
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <AppFileInfo.h>
|
#include <AppFileInfo.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
#include <NodeMonitor.h>
|
#include <NodeMonitor.h>
|
||||||
@@ -26,6 +28,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "Icon View"
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
@@ -816,12 +823,16 @@ IconView::MouseDown(BPoint where)
|
|||||||
menu->SetFont(be_plain_font);
|
menu->SetFont(be_plain_font);
|
||||||
|
|
||||||
bool hasIcon = fHasType ? fSource == kOwnIcon : fIcon != NULL;
|
bool hasIcon = fHasType ? fSource == kOwnIcon : fIcon != NULL;
|
||||||
if (hasIcon)
|
if (hasIcon) {
|
||||||
menu->AddItem(new BMenuItem("Edit icon" B_UTF8_ELLIPSIS, new BMessage(kMsgEditIcon)));
|
menu->AddItem(new BMenuItem(TR("Edit icon" B_UTF8_ELLIPSIS),
|
||||||
else
|
new BMessage(kMsgEditIcon)));
|
||||||
menu->AddItem(new BMenuItem("Add icon" B_UTF8_ELLIPSIS, new BMessage(kMsgAddIcon)));
|
} else {
|
||||||
|
menu->AddItem(new BMenuItem(TR("Add icon" B_UTF8_ELLIPSIS),
|
||||||
|
new BMessage(kMsgAddIcon)));
|
||||||
|
}
|
||||||
|
|
||||||
BMenuItem* item = new BMenuItem("Remove icon", new BMessage(kMsgRemoveIcon));
|
BMenuItem* item = new BMenuItem(TR("Remove icon"),
|
||||||
|
new BMessage(kMsgRemoveIcon));
|
||||||
if (!hasIcon)
|
if (!hasIcon)
|
||||||
item->SetEnabled(false);
|
item->SetEnabled(false);
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,25 @@ Preference FileTypes :
|
|||||||
|
|
||||||
PreferredAppMenu.cpp
|
PreferredAppMenu.cpp
|
||||||
StringView.cpp
|
StringView.cpp
|
||||||
: be tracker $(TARGET_LIBSUPC++)
|
: be tracker $(TARGET_LIBSUPC++) liblocale.so
|
||||||
: FileTypes.rdef FileTypes.icons.rdef
|
: FileTypes.rdef FileTypes.icons.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs FileTypes :
|
||||||
|
x-vnd.Haiku-FileTypes
|
||||||
|
:
|
||||||
|
ApplicationTypeWindow.cpp
|
||||||
|
AttributeWindow.cpp
|
||||||
|
ExtensionWindow.cpp
|
||||||
|
FileTypes.cpp
|
||||||
|
FileTypeWindow.cpp
|
||||||
|
FileTypesWindow.cpp
|
||||||
|
IconView.cpp
|
||||||
|
NewFileTypeWindow.cpp
|
||||||
|
PreferredAppMenu.cpp
|
||||||
|
TypeListWindow.cpp
|
||||||
|
;
|
||||||
|
|
||||||
if $(TARGET_PLATFORM) = libbe_test {
|
if $(TARGET_PLATFORM) = libbe_test {
|
||||||
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : FileTypes
|
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : FileTypes
|
||||||
: tests!apps ;
|
: tests!apps ;
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
#include "NewFileTypeWindow.h"
|
#include "NewFileTypeWindow.h"
|
||||||
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
@@ -19,6 +21,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "New File Type Window"
|
||||||
|
|
||||||
|
|
||||||
const uint32 kMsgSupertypeChosen = 'sptc';
|
const uint32 kMsgSupertypeChosen = 'sptc';
|
||||||
const uint32 kMsgNewSupertypeChosen = 'nstc';
|
const uint32 kMsgNewSupertypeChosen = 'nstc';
|
||||||
|
|
||||||
@@ -28,7 +34,7 @@ const uint32 kMsgAddType = 'atyp';
|
|||||||
|
|
||||||
|
|
||||||
NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target, const char* currentType)
|
NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target, const char* currentType)
|
||||||
: BWindow(BRect(100, 100, 350, 200), "New file type", B_TITLED_WINDOW,
|
: BWindow(BRect(100, 100, 350, 200), TR("New file type"), B_TITLED_WINDOW,
|
||||||
B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE | B_ASYNCHRONOUS_CONTROLS),
|
B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE | B_ASYNCHRONOUS_CONTROLS),
|
||||||
fTarget(target)
|
fTarget(target)
|
||||||
{
|
{
|
||||||
@@ -37,7 +43,7 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target, const char* curren
|
|||||||
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
AddChild(topView);
|
AddChild(topView);
|
||||||
|
|
||||||
float labelWidth = be_plain_font->StringWidth("Internal name:") + 2.0f;
|
float labelWidth = be_plain_font->StringWidth(TR("Internal name:")) + 2.0f;
|
||||||
|
|
||||||
rect.InsetBy(8.0f, 6.0f);
|
rect.InsetBy(8.0f, 6.0f);
|
||||||
fSupertypesMenu = new BPopUpMenu("supertypes");
|
fSupertypesMenu = new BPopUpMenu("supertypes");
|
||||||
@@ -61,11 +67,11 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target, const char* curren
|
|||||||
if (i > 1)
|
if (i > 1)
|
||||||
fSupertypesMenu->AddSeparatorItem();
|
fSupertypesMenu->AddSeparatorItem();
|
||||||
}
|
}
|
||||||
fSupertypesMenu->AddItem(new BMenuItem("Add new group",
|
fSupertypesMenu->AddItem(new BMenuItem(TR("Add new group"),
|
||||||
new BMessage(kMsgNewSupertypeChosen)));
|
new BMessage(kMsgNewSupertypeChosen)));
|
||||||
|
|
||||||
BMenuField* menuField = new BMenuField(rect, "supertypes",
|
BMenuField* menuField = new BMenuField(rect, "supertypes",
|
||||||
"Group:", fSupertypesMenu);
|
TR("Group:"), fSupertypesMenu);
|
||||||
menuField->SetDivider(labelWidth);
|
menuField->SetDivider(labelWidth);
|
||||||
menuField->SetAlignment(B_ALIGN_RIGHT);
|
menuField->SetAlignment(B_ALIGN_RIGHT);
|
||||||
float width, height;
|
float width, height;
|
||||||
@@ -73,7 +79,7 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target, const char* curren
|
|||||||
menuField->ResizeTo(rect.Width(), height);
|
menuField->ResizeTo(rect.Width(), height);
|
||||||
topView->AddChild(menuField);
|
topView->AddChild(menuField);
|
||||||
|
|
||||||
fNameControl = new BTextControl(rect, "internal", "Internal name:", "",
|
fNameControl = new BTextControl(rect, "internal", TR("Internal name:"), "",
|
||||||
NULL, B_FOLLOW_LEFT_RIGHT);
|
NULL, B_FOLLOW_LEFT_RIGHT);
|
||||||
fNameControl->SetModificationMessage(new BMessage(kMsgNameUpdated));
|
fNameControl->SetModificationMessage(new BMessage(kMsgNameUpdated));
|
||||||
fNameControl->SetDivider(labelWidth);
|
fNameControl->SetDivider(labelWidth);
|
||||||
@@ -91,7 +97,7 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target, const char* curren
|
|||||||
fNameControl->MoveTo(8.0f, 12.0f + menuField->Bounds().Height());
|
fNameControl->MoveTo(8.0f, 12.0f + menuField->Bounds().Height());
|
||||||
topView->AddChild(fNameControl);
|
topView->AddChild(fNameControl);
|
||||||
|
|
||||||
fAddButton = new BButton(rect, "add", "Add type", new BMessage(kMsgAddType),
|
fAddButton = new BButton(rect, "add", TR("Add type"), new BMessage(kMsgAddType),
|
||||||
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
fAddButton->ResizeToPreferred();
|
fAddButton->ResizeToPreferred();
|
||||||
fAddButton->MoveTo(Bounds().Width() - 8.0f - fAddButton->Bounds().Width(),
|
fAddButton->MoveTo(Bounds().Width() - 8.0f - fAddButton->Bounds().Width(),
|
||||||
@@ -99,7 +105,7 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target, const char* curren
|
|||||||
fAddButton->SetEnabled(false);
|
fAddButton->SetEnabled(false);
|
||||||
topView->AddChild(fAddButton);
|
topView->AddChild(fAddButton);
|
||||||
|
|
||||||
BButton* button = new BButton(rect, "cancel", "Cancel",
|
BButton* button = new BButton(rect, "cancel", TR("Cancel"),
|
||||||
new BMessage(B_QUIT_REQUESTED), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
new BMessage(B_QUIT_REQUESTED), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
button->ResizeToPreferred();
|
button->ResizeToPreferred();
|
||||||
button->MoveTo(fAddButton->Frame().left - 10.0f - button->Bounds().Width(),
|
button->MoveTo(fAddButton->Frame().left - 10.0f - button->Bounds().Width(),
|
||||||
@@ -128,14 +134,14 @@ NewFileTypeWindow::MessageReceived(BMessage* message)
|
|||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case kMsgSupertypeChosen:
|
case kMsgSupertypeChosen:
|
||||||
fAddButton->SetLabel("Add type");
|
fAddButton->SetLabel(TR("Add type"));
|
||||||
fNameControl->SetLabel("Internal name:");
|
fNameControl->SetLabel(TR("Internal name:"));
|
||||||
fNameControl->MakeFocus(true);
|
fNameControl->MakeFocus(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgNewSupertypeChosen:
|
case kMsgNewSupertypeChosen:
|
||||||
fAddButton->SetLabel("Add group");
|
fAddButton->SetLabel(TR("Add group"));
|
||||||
fNameControl->SetLabel("Group name:");
|
fNameControl->SetLabel(TR("Group name:"));
|
||||||
fNameControl->MakeFocus(true);
|
fNameControl->MakeFocus(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -164,13 +170,13 @@ NewFileTypeWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
BMimeType mimeType(type.String());
|
BMimeType mimeType(type.String());
|
||||||
if (mimeType.IsInstalled()) {
|
if (mimeType.IsInstalled()) {
|
||||||
error_alert("This file type already exists.");
|
error_alert(TR("This file type already exists."));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t status = mimeType.Install();
|
status_t status = mimeType.Install();
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
error_alert("Could not install file type", status);
|
error_alert(TR("Could not install file type"), status);
|
||||||
else {
|
else {
|
||||||
BMessage update(kMsgSelectNewType);
|
BMessage update(kMsgSelectNewType);
|
||||||
update.AddString("type", type.String());
|
update.AddString("type", type.String());
|
||||||
|
|||||||
@@ -15,10 +15,17 @@
|
|||||||
#include <NodeInfo.h>
|
#include <NodeInfo.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "Preferred App Menu"
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
compare_menu_items(const void* _a, const void* _b)
|
compare_menu_items(const void* _a, const void* _b)
|
||||||
{
|
{
|
||||||
@@ -240,13 +247,14 @@ retrieve_preferred_app(BMessage* message, bool sameAs, const char* forType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
error_alert("File could not be opened", status, B_STOP_ALERT);
|
error_alert(TR("File could not be opened"), status, B_STOP_ALERT);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preferred[0]) {
|
if (!preferred[0]) {
|
||||||
error_alert(sameAs ? "Could not retrieve preferred application of this file."
|
error_alert(sameAs ?
|
||||||
: "Could not retrieve application signature.");
|
TR("Could not retrieve preferred application of this file.")
|
||||||
|
: TR("Could not retrieve application signature."));
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,13 +282,13 @@ retrieve_preferred_app(BMessage* message, bool sameAs, const char* forType,
|
|||||||
description[0] = '\0';
|
description[0] = '\0';
|
||||||
|
|
||||||
char warning[512];
|
char warning[512];
|
||||||
snprintf(warning, sizeof(warning), "The application \"%s\" does not "
|
snprintf(warning, sizeof(warning), TR("The application \"%s\" does "
|
||||||
"support this file type.\n"
|
"not support this file type.\n"
|
||||||
"Are you sure you want to set it anyway?",
|
"Are you sure you want to set it anyway?"),
|
||||||
description[0] ? description : preferred);
|
description[0] ? description : preferred);
|
||||||
|
|
||||||
BAlert* alert = new BAlert("FileTypes Request", warning,
|
BAlert* alert = new BAlert("FileTypes Request", warning,
|
||||||
"Set Preferred Application", "Cancel", NULL, B_WIDTH_AS_USUAL,
|
TR("Set Preferred Application"), "Cancel", NULL, B_WIDTH_AS_USUAL,
|
||||||
B_WARNING_ALERT);
|
B_WARNING_ALERT);
|
||||||
if (alert->Go() == 1)
|
if (alert->Go() == 1)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|||||||
@@ -8,17 +8,24 @@
|
|||||||
#include "TypeListWindow.h"
|
#include "TypeListWindow.h"
|
||||||
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "TypeListWindow"
|
||||||
|
|
||||||
|
|
||||||
const uint32 kMsgTypeSelected = 'tpsl';
|
const uint32 kMsgTypeSelected = 'tpsl';
|
||||||
const uint32 kMsgSelected = 'seld';
|
const uint32 kMsgSelected = 'seld';
|
||||||
|
|
||||||
|
|
||||||
TypeListWindow::TypeListWindow(const char* currentType, uint32 what, BWindow* target)
|
TypeListWindow::TypeListWindow(const char* currentType, uint32 what,
|
||||||
: BWindow(BRect(100, 100, 360, 440), "Choose type", B_MODAL_WINDOW,
|
BWindow* target)
|
||||||
|
: BWindow(BRect(100, 100, 360, 440), TR("Choose type"), B_MODAL_WINDOW,
|
||||||
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS),
|
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS),
|
||||||
fTarget(target),
|
fTarget(target),
|
||||||
fWhat(what)
|
fWhat(what)
|
||||||
@@ -28,15 +35,16 @@ TypeListWindow::TypeListWindow(const char* currentType, uint32 what, BWindow* ta
|
|||||||
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
AddChild(topView);
|
AddChild(topView);
|
||||||
|
|
||||||
fSelectButton = new BButton(rect, "select", "Done",
|
fSelectButton = new BButton(rect, "select", TR("Done"),
|
||||||
new BMessage(kMsgSelected), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
new BMessage(kMsgSelected), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
fSelectButton->ResizeToPreferred();
|
fSelectButton->ResizeToPreferred();
|
||||||
fSelectButton->MoveTo(topView->Bounds().right - 8.0f - fSelectButton->Bounds().Width(),
|
fSelectButton->MoveTo(topView->Bounds().right - 8.0f
|
||||||
|
- fSelectButton->Bounds().Width(),
|
||||||
topView->Bounds().bottom - 8.0f - fSelectButton->Bounds().Height());
|
topView->Bounds().bottom - 8.0f - fSelectButton->Bounds().Height());
|
||||||
fSelectButton->SetEnabled(false);
|
fSelectButton->SetEnabled(false);
|
||||||
topView->AddChild(fSelectButton);
|
topView->AddChild(fSelectButton);
|
||||||
|
|
||||||
BButton* button = new BButton(fSelectButton->Frame(), "cancel", "Cancel",
|
BButton* button = new BButton(fSelectButton->Frame(), "cancel", TR("Cancel"),
|
||||||
new BMessage(B_CANCEL), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
new BMessage(B_CANCEL), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
button->ResizeToPreferred();
|
button->ResizeToPreferred();
|
||||||
button->MoveBy(-button->Bounds().Width() - 8.0f, 0.0f);
|
button->MoveBy(-button->Bounds().Width() - 8.0f, 0.0f);
|
||||||
|
|||||||
Reference in New Issue
Block a user