Patch by mt : localize expander.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35577 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0497cb9f12
commit
ab7b656898
@ -9,6 +9,8 @@
|
||||
|
||||
#include "DirectoryFilePanel.h"
|
||||
|
||||
#include <Catalog.h>
|
||||
#include <Locale.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -41,10 +43,13 @@ DirectoryRefFilter::Filter(const entry_ref *ref, BNode* node,
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
#undef TR_CONTEXT
|
||||
#define TR_CONTEXT "DirectoryFilePanel"
|
||||
|
||||
DirectoryFilePanel::DirectoryFilePanel(file_panel_mode mode, BMessenger *target,
|
||||
const entry_ref *startDirectory, uint32 nodeFlavors,
|
||||
bool allowMultipleSelection, BMessage *message, BRefFilter *filter,
|
||||
|
||||
DirectoryFilePanel::DirectoryFilePanel(file_panel_mode mode, BMessenger* target,
|
||||
const entry_ref* startDirectory, uint32 nodeFlavors,
|
||||
bool allowMultipleSelection, BMessage* message, BRefFilter* filter,
|
||||
bool modal, bool hideWhenDone)
|
||||
: BFilePanel(mode, target, startDirectory, nodeFlavors,
|
||||
allowMultipleSelection, message, filter, modal, hideWhenDone),
|
||||
@ -72,16 +77,16 @@ DirectoryFilePanel::Show()
|
||||
}
|
||||
|
||||
rect.right = rect.left -= 30;
|
||||
float width = be_plain_font->StringWidth("Select current") + 20;
|
||||
float width = be_plain_font->StringWidth(TR("Select current")) + 20;
|
||||
rect.left = width > 75 ? rect.right - width : rect.right - 75;
|
||||
fCurrentButton = new BButton(rect, "directoryButton", "Select current",
|
||||
fCurrentButton = new BButton(rect, "directoryButton", TR("Select current"),
|
||||
new BMessage(MSG_DIRECTORY), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||
|
||||
background->AddChild(fCurrentButton);
|
||||
fCurrentButton->SetTarget(Messenger());
|
||||
|
||||
SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
||||
Window()->SetTitle("Expander: Choose destination");
|
||||
SetButtonLabel(B_DEFAULT_BUTTON, TR("Select"));
|
||||
Window()->SetTitle(TR("Expander: Choose destination"));
|
||||
|
||||
Window()->Unlock();
|
||||
|
||||
@ -100,8 +105,9 @@ DirectoryFilePanel::SelectionChanged()
|
||||
char label[64];
|
||||
entry_ref ref;
|
||||
GetPanelDirectory(&ref);
|
||||
if (snprintf(label, sizeof(label), "Select '%s'", ref.name) >= (int)sizeof(label))
|
||||
strcpy(label + sizeof(label) - 5, B_UTF8_ELLIPSIS "'");
|
||||
if (snprintf(label, sizeof(label),
|
||||
TR("Select '%s'"), ref.name) >= (int)sizeof(label))
|
||||
strcpy(label + sizeof(label) - 5, B_UTF8_ELLIPSIS "'");
|
||||
|
||||
// Resize button so that the label fits
|
||||
// maximum width is dictated by the window's size limits
|
||||
|
@ -8,12 +8,15 @@
|
||||
#include "ExpanderWindow.h"
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Catalog.h>
|
||||
#include <Locale.h>
|
||||
#include <TextView.h>
|
||||
|
||||
|
||||
ExpanderApp::ExpanderApp()
|
||||
: BApplication("application/x-vnd.Haiku-Expander")
|
||||
{
|
||||
be_locale->GetAppCatalog(&fCatalog);
|
||||
|
||||
BPoint windowPosition = fSettings.Message().FindPoint("window_position");
|
||||
BRect windowFrame(0, 0, 450, 120);
|
||||
windowFrame.OffsetBy(windowPosition);
|
||||
@ -22,15 +25,16 @@ ExpanderApp::ExpanderApp()
|
||||
}
|
||||
|
||||
|
||||
#undef TR_CONTEXT
|
||||
#define TR_CONTEXT "About"
|
||||
|
||||
void
|
||||
ExpanderApp::AboutRequested()
|
||||
{
|
||||
BAlert *alert = new BAlert("about", "Expander\n"
|
||||
"\twritten by Jérôme Duval\n"
|
||||
"\tCopyright 2004-2006, Haiku Inc.\n\n"
|
||||
"original Be version by \n"
|
||||
"Dominic, Hiroshi, Peter, Pavel and Robert\n", "OK");
|
||||
BTextView *view = alert->TextView();
|
||||
BAlert* alert = new BAlert("about",
|
||||
TR("Expander\n\twritten by Jérôme Duval\n\tCopyright 2004-2006, Haiku Inc.\n\noriginal Be version by \nDominic, Hiroshi, Peter, Pavel and Robert\n"),
|
||||
TR("OK"));
|
||||
BTextView* view = alert->TextView();
|
||||
BFont font;
|
||||
|
||||
view->SetStylable(true);
|
||||
@ -53,7 +57,7 @@ ExpanderApp::ReadyToRun()
|
||||
void
|
||||
ExpanderApp::ArgvReceived(int32 argc, char **argv)
|
||||
{
|
||||
BMessage *msg = NULL;
|
||||
BMessage* msg = NULL;
|
||||
for (int32 i = 1; i < argc; i++) {
|
||||
entry_ref ref;
|
||||
status_t err = get_ref_for_path(argv[i], &ref);
|
||||
@ -71,7 +75,7 @@ ExpanderApp::ArgvReceived(int32 argc, char **argv)
|
||||
|
||||
|
||||
void
|
||||
ExpanderApp::RefsReceived(BMessage *msg)
|
||||
ExpanderApp::RefsReceived(BMessage* msg)
|
||||
{
|
||||
BMessenger messenger(fWindow);
|
||||
msg->AddBool("fromApp", true);
|
||||
@ -80,7 +84,7 @@ ExpanderApp::RefsReceived(BMessage *msg)
|
||||
|
||||
|
||||
void
|
||||
ExpanderApp::UpdateSettingsFrom(BMessage *message)
|
||||
ExpanderApp::UpdateSettingsFrom(BMessage* message)
|
||||
{
|
||||
fSettings.UpdateFrom(message);
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#define _ExpanderApp_h
|
||||
|
||||
#include <Application.h>
|
||||
#include <Catalog.h>
|
||||
#include "ExpanderSettings.h"
|
||||
#include "ExpanderWindow.h"
|
||||
|
||||
@ -47,6 +48,7 @@ class ExpanderApp : public BApplication {
|
||||
void UpdateSettingsFrom(BMessage *message);
|
||||
private:
|
||||
ExpanderWindow *fWindow;
|
||||
BCatalog fCatalog;
|
||||
};
|
||||
|
||||
#endif /* _ExpanderApp_h */
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
#include "ExpanderPreferences.h"
|
||||
#include <Box.h>
|
||||
#include <Catalog.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
#include <Path.h>
|
||||
#include <Screen.h>
|
||||
#include <StringView.h>
|
||||
@ -17,169 +21,101 @@ const uint32 MSG_DESTUSE = 'mDeu';
|
||||
const uint32 MSG_DESTTEXT = 'mDet';
|
||||
const uint32 MSG_DESTSELECT = 'mDes';
|
||||
|
||||
#undef TR_CONTEXT
|
||||
#define TR_CONTEXT "ExpanderPreferences"
|
||||
|
||||
ExpanderPreferences::ExpanderPreferences(BMessage *settings)
|
||||
: BWindow(BRect(0, 0, 325, 305), "Expander", B_MODAL_WINDOW,
|
||||
B_NOT_CLOSABLE | B_NOT_RESIZABLE),
|
||||
B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS),
|
||||
fSettings(settings),
|
||||
fUsePanel(NULL)
|
||||
{
|
||||
BBox* box = new BBox("background");
|
||||
box->SetLabel(TR("Expander settings"));
|
||||
|
||||
BRect rect = Bounds();
|
||||
BBox *background = new BBox(rect, "background", B_FOLLOW_ALL,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
|
||||
AddChild(background);
|
||||
fAutoExpand = new BCheckBox("autoExpand",
|
||||
TR("Automatically expand files"), NULL);
|
||||
fCloseWindow = new BCheckBox("closeWindowWhenDone",
|
||||
TR("Close window when done expanding"), NULL);
|
||||
|
||||
rect.OffsetBy(11, 9);
|
||||
rect.bottom -= 64;
|
||||
rect.right -= 22;
|
||||
BBox *box = new BBox(rect, "background", B_FOLLOW_NONE,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
|
||||
box->SetLabel("Expander settings");
|
||||
background->AddChild(box);
|
||||
|
||||
float maxWidth = box->Bounds().right;
|
||||
|
||||
BRect frameRect = box->Bounds();
|
||||
frameRect.OffsetBy(15, 23);
|
||||
frameRect.right = frameRect.left + 200;
|
||||
frameRect.bottom = frameRect.top + 20;
|
||||
BRect textRect(frameRect);
|
||||
textRect.OffsetTo(B_ORIGIN);
|
||||
textRect.InsetBy(1, 1);
|
||||
BStringView *stringView = new BStringView(frameRect, "expansion", "Expansion:",
|
||||
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
stringView->ResizeToPreferred();
|
||||
if (stringView->Frame().right > maxWidth)
|
||||
maxWidth = stringView->Frame().right;
|
||||
box->AddChild(stringView);
|
||||
|
||||
frameRect.top = stringView->Frame().bottom + 5;
|
||||
frameRect.left += 10;
|
||||
|
||||
fAutoExpand = new BCheckBox(frameRect, "autoExpand", "Automatically expand files", NULL);
|
||||
fAutoExpand->ResizeToPreferred();
|
||||
if (fAutoExpand->Frame().right > maxWidth)
|
||||
maxWidth = fAutoExpand->Frame().right;
|
||||
box->AddChild(fAutoExpand);
|
||||
|
||||
frameRect = fAutoExpand->Frame();
|
||||
frameRect.top = fAutoExpand->Frame().bottom + 1;
|
||||
fCloseWindow = new BCheckBox(frameRect, "closeWindowWhenDone", "Close window when done expanding", NULL);
|
||||
fCloseWindow->ResizeToPreferred();
|
||||
if (fCloseWindow->Frame().right > maxWidth)
|
||||
maxWidth = fCloseWindow->Frame().right;
|
||||
box->AddChild(fCloseWindow);
|
||||
|
||||
frameRect = stringView->Frame();
|
||||
frameRect.top = fCloseWindow->Frame().bottom + 10;
|
||||
stringView = new BStringView(frameRect, "destinationFolder", "Destination folder:",
|
||||
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
stringView->ResizeToPreferred();
|
||||
if (stringView->Frame().right > maxWidth)
|
||||
maxWidth = stringView->Frame().right;
|
||||
box->AddChild(stringView);
|
||||
|
||||
frameRect.top = stringView->Frame().bottom + 5;
|
||||
frameRect.left += 10;
|
||||
|
||||
fLeaveDest = new BRadioButton(frameRect, "leaveDest", "Leave destination folder path empty",
|
||||
fLeaveDest = new BRadioButton("leaveDest",
|
||||
TR("Leave destination folder path empty"),
|
||||
new BMessage(MSG_LEAVEDEST));
|
||||
fLeaveDest->ResizeToPreferred();
|
||||
if (fLeaveDest->Frame().right > maxWidth)
|
||||
maxWidth = fLeaveDest->Frame().right;
|
||||
box->AddChild(fLeaveDest);
|
||||
|
||||
frameRect = fLeaveDest->Frame();
|
||||
frameRect.top = fLeaveDest->Frame().bottom + 1;
|
||||
fSameDest = new BRadioButton(frameRect, "sameDir", "Same directory as source (archive) file",
|
||||
fSameDest = new BRadioButton("sameDir",
|
||||
TR("Same directory as source (archive) file"),
|
||||
new BMessage(MSG_SAMEDIR));
|
||||
fSameDest->ResizeToPreferred();
|
||||
if (fSameDest->Frame().right > maxWidth)
|
||||
maxWidth = fSameDest->Frame().right;
|
||||
box->AddChild(fSameDest);
|
||||
|
||||
frameRect = fSameDest->Frame();
|
||||
frameRect.top = frameRect.bottom + 1;
|
||||
fDestUse = new BRadioButton(frameRect, "destUse", "Use:", new BMessage(MSG_DESTUSE));
|
||||
fDestUse->ResizeToPreferred();
|
||||
if (fDestUse->Frame().right > maxWidth)
|
||||
maxWidth = fDestUse->Frame().right;
|
||||
box->AddChild(fDestUse);
|
||||
|
||||
frameRect = fDestUse->Frame();
|
||||
frameRect.left = fDestUse->Frame().right + 1;
|
||||
frameRect.right = frameRect.left + 58;
|
||||
frameRect.bottom = frameRect.top + 38;
|
||||
|
||||
fDestText = new BTextControl(frameRect, "destText", "", "", new BMessage(MSG_DESTTEXT));
|
||||
box->AddChild(fDestText);
|
||||
fDestText->ResizeToPreferred();
|
||||
fDestUse = new BRadioButton("destUse",
|
||||
TR("Use:"), new BMessage(MSG_DESTUSE));
|
||||
fDestText = new BTextControl("destText", "", "", new BMessage(MSG_DESTTEXT));
|
||||
fDestText->SetDivider(0);
|
||||
fDestText->TextView()->MakeEditable(false);
|
||||
fDestText->ResizeTo(158, fDestText->Frame().Height());
|
||||
|
||||
fDestText->SetEnabled(false);
|
||||
|
||||
frameRect = fDestText->Frame();
|
||||
frameRect.left = frameRect.right + 5;
|
||||
fSelect = new BButton(frameRect, "selectButton", "Select", new BMessage(MSG_DESTSELECT));
|
||||
fSelect->ResizeToPreferred();
|
||||
if (fSelect->Frame().right > maxWidth)
|
||||
maxWidth = fSelect->Frame().right;
|
||||
box->AddChild(fSelect);
|
||||
fSelect = new BButton("selectButton", TR("Select"),
|
||||
new BMessage(MSG_DESTSELECT));
|
||||
fSelect->SetEnabled(false);
|
||||
|
||||
fDestText->MoveBy(0, (fSelect->Frame().Height() - fDestText->Frame().Height()) / 2.0);
|
||||
fDestText->ResizeTo(158, fDestText->Frame().Height());
|
||||
fOpenDest = new BCheckBox("openDestination",
|
||||
TR("Open destination folder after extraction"), NULL);
|
||||
fAutoShow = new BCheckBox("autoShow",
|
||||
TR("Automatically show contents listing"), NULL);
|
||||
|
||||
frameRect = stringView->Frame();
|
||||
frameRect.top = fDestUse->Frame().bottom + 10;
|
||||
BView* view = new BGroupView();
|
||||
view->SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||
view->AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.Add(new BStringView("expansion", TR("Expansion:")))
|
||||
.AddGlue()
|
||||
.End()
|
||||
.AddGroup(B_VERTICAL, 1)
|
||||
.Add(fAutoExpand)
|
||||
.Add(fCloseWindow)
|
||||
.SetInsets(10, 0, 0, 10)
|
||||
.End()
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.Add(new BStringView("destinationFolder", TR("Destination folder:")))
|
||||
.AddGlue()
|
||||
.End()
|
||||
.AddGroup(B_VERTICAL, 1)
|
||||
.Add(fLeaveDest)
|
||||
.Add(fSameDest)
|
||||
.Add(fDestUse)
|
||||
.AddGroup(B_HORIZONTAL, 5)
|
||||
.Add(fDestText, 0.8)
|
||||
.Add(fSelect, 0.2)
|
||||
.SetInsets(20, 0, 0, 0)
|
||||
.End()
|
||||
.SetInsets(10, 0, 0, 10)
|
||||
.End()
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.Add(new BStringView("other", TR("Other:")))
|
||||
.AddGlue()
|
||||
.End()
|
||||
.AddGroup(B_VERTICAL, 1)
|
||||
.Add(fOpenDest)
|
||||
.Add(fAutoShow)
|
||||
.SetInsets(10, 0, 0, 0)
|
||||
.End()
|
||||
.SetInsets(10, 10, 10, 10)
|
||||
);
|
||||
box->AddChild(view);
|
||||
|
||||
stringView = new BStringView(frameRect, "other", "Other:", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
stringView->ResizeToPreferred();
|
||||
if (stringView->Frame().right > maxWidth)
|
||||
maxWidth = stringView->Frame().right;
|
||||
box->AddChild(stringView);
|
||||
|
||||
frameRect.top = stringView->Frame().bottom + 5;
|
||||
frameRect.left += 10;
|
||||
|
||||
fOpenDest = new BCheckBox(frameRect, "openDestination", "Open destination folder after extraction", NULL);
|
||||
fOpenDest->ResizeToPreferred();
|
||||
if (fOpenDest->Frame().right > maxWidth)
|
||||
maxWidth = fOpenDest->Frame().right;
|
||||
box->AddChild(fOpenDest);
|
||||
|
||||
frameRect = fOpenDest->Frame();
|
||||
frameRect.top = frameRect.bottom + 1;
|
||||
fAutoShow = new BCheckBox(frameRect, "autoShow", "Automatically show contents listing", NULL);
|
||||
fAutoShow->ResizeToPreferred();
|
||||
if (fAutoShow->Frame().right > maxWidth)
|
||||
maxWidth = fAutoShow->Frame().right;
|
||||
box->AddChild(fAutoShow);
|
||||
|
||||
box->ResizeTo(maxWidth + 15, fAutoShow->Frame().bottom + 10);
|
||||
|
||||
rect = BRect(Bounds().right - 89, Bounds().bottom - 40, Bounds().right - 14, Bounds().bottom - 16);
|
||||
|
||||
rect = Bounds();
|
||||
BButton *button = new BButton(rect, "OKButton", "OK", new BMessage(MSG_OK));
|
||||
BButton* button = new BButton("OKButton", TR("OK"), new BMessage(MSG_OK));
|
||||
button->MakeDefault(true);
|
||||
button->ResizeToPreferred();
|
||||
button->MoveTo(box->Frame().right - button->Frame().Width(), box->Frame().bottom + 10);
|
||||
background->AddChild(button);
|
||||
BButton* cancel = new BButton("CancelButton", TR("Cancel"),
|
||||
new BMessage(MSG_CANCEL));
|
||||
|
||||
rect = button->Frame();
|
||||
BButton *cancel = new BButton(rect, "CancelButton", "Cancel", new BMessage(MSG_CANCEL));
|
||||
cancel->ResizeToPreferred();
|
||||
cancel->MoveBy(-cancel->Frame().Width() - 10, (button->Frame().Height() - cancel->Frame().Height()) / 2.0);
|
||||
background->AddChild(cancel);
|
||||
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, 11)
|
||||
.Add(box)
|
||||
.AddGroup(B_HORIZONTAL, 10)
|
||||
.AddGlue()
|
||||
.Add(cancel)
|
||||
.Add(button)
|
||||
.End()
|
||||
.SetInsets(10, 10, 10, 10)
|
||||
);
|
||||
|
||||
ResizeTo(box->Frame().right + 11 , button->Frame().bottom + 11);
|
||||
|
||||
BScreen screen(this);
|
||||
MoveBy((screen.Frame().Width() - Bounds().Width()) / 2,
|
||||
(screen.Frame().Height() - Bounds().Height()) / 2);
|
||||
CenterOnScreen();
|
||||
|
||||
bool automatically_expand_files;
|
||||
bool close_when_done;
|
||||
@ -239,7 +175,7 @@ ExpanderPreferences::~ExpanderPreferences()
|
||||
|
||||
|
||||
void
|
||||
ExpanderPreferences::MessageReceived(BMessage *msg)
|
||||
ExpanderPreferences::MessageReceived(BMessage* msg)
|
||||
{
|
||||
switch (msg->what) {
|
||||
case MSG_DESTSELECT:
|
||||
|
@ -15,12 +15,14 @@
|
||||
#include <Application.h>
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
#include <Catalog.h>
|
||||
#include <CheckBox.h>
|
||||
#include <ControlLook.h>
|
||||
#include <Entry.h>
|
||||
#include <File.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
#include <Menu.h>
|
||||
#include <MenuBar.h>
|
||||
#include <MenuItem.h>
|
||||
@ -42,10 +44,13 @@ const uint32 MSG_DESTTEXT = 'mDTX';
|
||||
const uint32 MSG_SHOWCONTENTS = 'mSCT';
|
||||
|
||||
|
||||
#undef TR_CONTEXT
|
||||
#define TR_CONTEXT "ExpanderWindow"
|
||||
|
||||
ExpanderWindow::ExpanderWindow(BRect frame, const entry_ref* ref,
|
||||
BMessage* settings)
|
||||
:
|
||||
BWindow(frame, "Expander", B_TITLED_WINDOW, B_NORMAL_WINDOW_FEEL),
|
||||
BWindow(frame, TR_CMT("Expander", "!! Window Title !!"), B_TITLED_WINDOW, B_NORMAL_WINDOW_FEEL),
|
||||
fSourcePanel(NULL),
|
||||
fDestPanel(NULL),
|
||||
fSourceChanged(true),
|
||||
@ -61,9 +66,9 @@ ExpanderWindow::ExpanderWindow(BRect frame, const entry_ref* ref,
|
||||
|
||||
_AddMenuBar(layout);
|
||||
|
||||
fDestButton = new BButton("Destination", new BMessage(MSG_DEST));
|
||||
fSourceButton = new BButton("Source", new BMessage(MSG_SOURCE));
|
||||
fExpandButton = new BButton("Expand", new BMessage(MSG_EXPAND));
|
||||
fDestButton = new BButton(TR("Destination"), new BMessage(MSG_DEST));
|
||||
fSourceButton = new BButton(TR("Source"), new BMessage(MSG_SOURCE));
|
||||
fExpandButton = new BButton(TR("Expand"), new BMessage(MSG_EXPAND));
|
||||
|
||||
BSize size = fDestButton->PreferredSize();
|
||||
size.width = max_c(size.width, fSourceButton->PreferredSize().width);
|
||||
@ -98,7 +103,7 @@ ExpanderWindow::ExpanderWindow(BRect frame, const entry_ref* ref,
|
||||
.Add(fDestText = new BTextControl(NULL, NULL,
|
||||
new BMessage(MSG_DESTTEXT)))
|
||||
.AddGroup(B_HORIZONTAL, spacing)
|
||||
.Add(fShowContents = new BCheckBox("Show contents",
|
||||
.Add(fShowContents = new BCheckBox(TR("Show contents"),
|
||||
new BMessage(MSG_SHOWCONTENTS)))
|
||||
.Add(fStatusView = new BStringView(NULL, NULL))
|
||||
.End()
|
||||
@ -139,19 +144,22 @@ ExpanderWindow::ValidateDest()
|
||||
BEntry entry(fDestText->Text(), true);
|
||||
BVolume volume;
|
||||
if (!entry.Exists()) {
|
||||
BAlert* alert = new BAlert("destAlert", "The destination"
|
||||
" folder does not exist.", "Cancel", NULL, NULL,
|
||||
BAlert* alert = new BAlert("destAlert",
|
||||
TR("The destination folder does not exist."),
|
||||
TR("Cancel"), NULL, NULL,
|
||||
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
|
||||
alert->Go();
|
||||
return false;
|
||||
} else if (!entry.IsDirectory()) {
|
||||
(new BAlert("destAlert", "The destination"
|
||||
" is not a folder.", "Cancel", NULL, NULL,
|
||||
(new BAlert("destAlert",
|
||||
TR("The destination is not a folder."),
|
||||
TR("Cancel"), NULL, NULL,
|
||||
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT))->Go();
|
||||
return false;
|
||||
} else if (entry.GetVolume(&volume) != B_OK || volume.IsReadOnly()) {
|
||||
(new BAlert("destAlert", "The destination is read only.",
|
||||
"Cancel", NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING,
|
||||
(new BAlert("destAlert",
|
||||
TR("The destination is read only."),
|
||||
TR("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING,
|
||||
B_WARNING_ALERT))->Go();
|
||||
return false;
|
||||
} else {
|
||||
@ -175,6 +183,7 @@ ExpanderWindow::MessageReceived(BMessage* msg)
|
||||
BMessenger messenger(this);
|
||||
fSourcePanel = new BFilePanel(B_OPEN_PANEL, &messenger, &srcRef,
|
||||
B_FILE_NODE, false, NULL, new RuleRefFilter(fRules), true);
|
||||
(fSourcePanel->Window())->SetTitle(TR("Expander: Open"));
|
||||
} else
|
||||
fSourcePanel->SetPanelDirectory(&srcRef);
|
||||
fSourcePanel->Show();
|
||||
@ -226,9 +235,9 @@ ExpanderWindow::MessageReceived(BMessage* msg)
|
||||
case MSG_STOP:
|
||||
if (fExpandingStarted) {
|
||||
fExpandingThread->SuspendExternalExpander();
|
||||
BAlert* alert = new BAlert("stopAlert", "Are you sure you want "
|
||||
"to stop expanding this\narchive? The expanded items may "
|
||||
"not be complete.", "Stop", "Continue", NULL,
|
||||
BAlert* alert = new BAlert("stopAlert",
|
||||
TR("Are you sure you want to stop expanding this\narchive? The expanded items may not be complete."),
|
||||
TR("Stop"), TR("Continue"), NULL,
|
||||
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
|
||||
if (alert->Go() == 0) {
|
||||
fExpandingThread->ResumeExternalExpander();
|
||||
@ -245,7 +254,7 @@ ExpanderWindow::MessageReceived(BMessage* msg)
|
||||
case MSG_SHOWCONTENTS:
|
||||
// change menu item label
|
||||
fShowItem->SetLabel(fShowContents->Value() == B_CONTROL_OFF
|
||||
? "Show contents" : "Hide contents");
|
||||
? TR("Show contents") : TR("Hide contents"));
|
||||
|
||||
if (fShowContents->Value() == B_CONTROL_OFF) {
|
||||
if (fListingStarted)
|
||||
@ -260,8 +269,8 @@ ExpanderWindow::MessageReceived(BMessage* msg)
|
||||
{
|
||||
BEntry entry(fSourceText->Text(), true);
|
||||
if (!entry.Exists()) {
|
||||
BAlert* alert = new BAlert("srcAlert", "The file doesn't exist",
|
||||
"Cancel", NULL, NULL,
|
||||
BAlert* alert = new BAlert("srcAlert", TR("The file doesn't exist"),
|
||||
TR("Cancel"), NULL, NULL,
|
||||
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
|
||||
alert->Go();
|
||||
break;
|
||||
@ -282,8 +291,8 @@ ExpanderWindow::MessageReceived(BMessage* msg)
|
||||
|
||||
BString string = "The file : ";
|
||||
string += fSourceText->Text();
|
||||
string += " is not supported";
|
||||
BAlert* alert = new BAlert("srcAlert", string.String(), "Cancel",
|
||||
string += TR_MARK(" is not supported");
|
||||
BAlert* alert = new BAlert("srcAlert", string.String(), TR("Cancel"),
|
||||
NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_INFO_ALERT);
|
||||
alert->Go();
|
||||
|
||||
@ -324,7 +333,7 @@ ExpanderWindow::MessageReceived(BMessage* msg)
|
||||
// thread has finished (finished, quit, killed, we don't know)
|
||||
// reset window state
|
||||
if (fExpandingStarted) {
|
||||
fStatusView->SetText("File expanded");
|
||||
fStatusView->SetText(TR("File expanded"));
|
||||
StopExpanding();
|
||||
OpenDestFolder();
|
||||
CloseWindowOrKeepOpen();
|
||||
@ -339,7 +348,7 @@ ExpanderWindow::MessageReceived(BMessage* msg)
|
||||
case 'exrr': // thread has finished
|
||||
// reset window state
|
||||
|
||||
fStatusView->SetText("Error when expanding archive");
|
||||
fStatusView->SetText(TR("Error when expanding archive"));
|
||||
CloseWindowOrKeepOpen();
|
||||
break;
|
||||
|
||||
@ -359,9 +368,9 @@ ExpanderWindow::CanQuit()
|
||||
|
||||
if (fExpandingStarted) {
|
||||
fExpandingThread->SuspendExternalExpander();
|
||||
BAlert* alert = new BAlert("stopAlert", "Are you sure you want to stop "
|
||||
"expanding this\narchive? The expanded items may not be complete.",
|
||||
"Stop", "Continue", NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING,
|
||||
BAlert* alert = new BAlert("stopAlert",
|
||||
TR("Are you sure you want to stop expanding this\narchive? The expanded items may not be complete."),
|
||||
TR("Stop"), TR("Continue"), NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING,
|
||||
B_WARNING_ALERT);
|
||||
if (alert->Go() == 0) {
|
||||
fExpandingThread->ResumeExternalExpander();
|
||||
@ -446,42 +455,50 @@ ExpanderWindow::RefsReceived(BMessage* msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#undef TR_CONTEXT
|
||||
#define TR_CONTEXT "ExpanderMenu"
|
||||
|
||||
void
|
||||
ExpanderWindow::_AddMenuBar(BLayout* layout)
|
||||
{
|
||||
fBar = new BMenuBar("menu_bar", B_ITEMS_IN_ROW, B_INVALIDATE_AFTER_LAYOUT);
|
||||
BMenu* menu = new BMenu("File");
|
||||
BMenu* menu = new BMenu(TR("File"));
|
||||
BMenuItem* item;
|
||||
menu->AddItem(item = new BMenuItem("About Expander" B_UTF8_ELLIPSIS,
|
||||
menu->AddItem(item = new BMenuItem(TR("About Expander…"),
|
||||
new BMessage(B_ABOUT_REQUESTED)));
|
||||
item->SetTarget(be_app_messenger);
|
||||
menu->AddSeparatorItem();
|
||||
menu->AddItem(fSourceItem = new BMenuItem("Set source" B_UTF8_ELLIPSIS,
|
||||
menu->AddItem(fSourceItem = new BMenuItem(TR("Set source…"),
|
||||
new BMessage(MSG_SOURCE), 'O'));
|
||||
menu->AddItem(fDestItem = new BMenuItem("Set destination" B_UTF8_ELLIPSIS,
|
||||
menu->AddItem(fDestItem = new BMenuItem(TR("Set destination…"),
|
||||
new BMessage(MSG_DEST), 'D'));
|
||||
menu->AddSeparatorItem();
|
||||
menu->AddItem(fExpandItem = new BMenuItem("Expand", new BMessage(MSG_EXPAND),
|
||||
'E'));
|
||||
menu->AddItem(fExpandItem = new BMenuItem(TR("Expand"),
|
||||
new BMessage(MSG_EXPAND), 'E'));
|
||||
fExpandItem->SetEnabled(false);
|
||||
menu->AddItem(fShowItem = new BMenuItem("Show contents",
|
||||
menu->AddItem(fShowItem = new BMenuItem(TR("Show contents"),
|
||||
new BMessage(MSG_SHOW), 'L'));
|
||||
fShowItem->SetEnabled(false);
|
||||
menu->AddSeparatorItem();
|
||||
menu->AddItem(fStopItem = new BMenuItem("Stop", new BMessage(MSG_STOP), 'K'));
|
||||
menu->AddItem(fStopItem = new BMenuItem(TR("Stop"),
|
||||
new BMessage(MSG_STOP), 'K'));
|
||||
fStopItem->SetEnabled(false);
|
||||
menu->AddSeparatorItem();
|
||||
menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W'));
|
||||
menu->AddItem(new BMenuItem(TR("Close"), new BMessage(B_QUIT_REQUESTED), 'W'));
|
||||
fBar->AddItem(menu);
|
||||
|
||||
menu = new BMenu("Settings");
|
||||
menu->AddItem(fPreferencesItem = new BMenuItem("Settings" B_UTF8_ELLIPSIS,
|
||||
menu = new BMenu(TR("Settings"));
|
||||
menu->AddItem(fPreferencesItem = new BMenuItem(TR("Settings…"),
|
||||
new BMessage(MSG_PREFERENCES), 'S'));
|
||||
fBar->AddItem(menu);
|
||||
layout->AddView(fBar);
|
||||
}
|
||||
|
||||
|
||||
#undef TR_CONTEXT
|
||||
#define TR_CONTEXT "ExpanderWindow"
|
||||
|
||||
void
|
||||
ExpanderWindow::StartExpanding()
|
||||
{
|
||||
@ -491,8 +508,9 @@ ExpanderWindow::StartExpanding()
|
||||
|
||||
BEntry destEntry(fDestText->Text(), true);
|
||||
if (!destEntry.Exists()) {
|
||||
BAlert* alert = new BAlert("destAlert", "The folder was either moved, "
|
||||
"renamed or not\nsupported.", "Cancel", NULL, NULL,
|
||||
BAlert* alert = new BAlert("destAlert",
|
||||
TR("The folder was either moved, renamed or not\nsupported."),
|
||||
TR("Cancel"), NULL, NULL,
|
||||
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
|
||||
alert->Go();
|
||||
return;
|
||||
@ -503,7 +521,7 @@ ExpanderWindow::StartExpanding()
|
||||
message.AddRef("srcRef", &fSourceRef);
|
||||
message.AddRef("destRef", &fDestRef);
|
||||
|
||||
fExpandButton->SetLabel("Stop");
|
||||
fExpandButton->SetLabel(TR("Stop"));
|
||||
fSourceButton->SetEnabled(false);
|
||||
fDestButton->SetEnabled(false);
|
||||
fShowContents->SetEnabled(false);
|
||||
@ -516,7 +534,7 @@ ExpanderWindow::StartExpanding()
|
||||
|
||||
BEntry entry(&fSourceRef);
|
||||
BPath path(&entry);
|
||||
BString text("Expanding file ");
|
||||
BString text(TR("Expanding file "));
|
||||
text.Append(path.Leaf());
|
||||
fStatusView->SetText(text.String());
|
||||
|
||||
@ -537,7 +555,7 @@ ExpanderWindow::StopExpanding(void)
|
||||
|
||||
fExpandingStarted = false;
|
||||
|
||||
fExpandButton->SetLabel("Expand");
|
||||
fExpandButton->SetLabel(TR("Expand"));
|
||||
fSourceButton->SetEnabled(true);
|
||||
fDestButton->SetEnabled(true);
|
||||
fShowContents->SetEnabled(true);
|
||||
@ -642,7 +660,7 @@ ExpanderWindow::StartListing()
|
||||
fDestItem->SetEnabled(false);
|
||||
fExpandItem->SetEnabled(false);
|
||||
fShowItem->SetEnabled(true);
|
||||
fShowItem->SetLabel("Hide contents");
|
||||
fShowItem->SetLabel(TR("Hide contents"));
|
||||
fStopItem->SetEnabled(false);
|
||||
fPreferencesItem->SetEnabled(false);
|
||||
|
||||
@ -652,7 +670,7 @@ ExpanderWindow::StartListing()
|
||||
|
||||
BEntry entry(&fSourceRef);
|
||||
BPath path(&entry);
|
||||
BString text("Creating listing for ");
|
||||
BString text(TR("Creating listing for "));
|
||||
text.Append(path.Leaf());
|
||||
fStatusView->SetText(text.String());
|
||||
fListingText->SetText("");
|
||||
|
@ -1,7 +1,5 @@
|
||||
SubDir HAIKU_TOP src apps expander ;
|
||||
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
|
||||
Application Expander :
|
||||
ExpanderApp.cpp
|
||||
ExpanderWindow.cpp
|
||||
@ -11,7 +9,17 @@ Application Expander :
|
||||
ExpanderPreferences.cpp
|
||||
DirectoryFilePanel.cpp
|
||||
ExpanderRules.cpp
|
||||
: be tracker $(TARGET_LIBSUPC++)
|
||||
: be tracker liblocale.so $(TARGET_LIBSUPC++)
|
||||
: Expander.rdef
|
||||
;
|
||||
|
||||
DoCatalogs Expander :
|
||||
x-vnd.Haiku-Expander
|
||||
:
|
||||
ExpanderApp.cpp
|
||||
ExpanderWindow.cpp
|
||||
ExpanderSettings.cpp
|
||||
DirectoryFilePanel.cpp
|
||||
: en.catalog
|
||||
:
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user