Ticket #5747: FileTypesUpdate.patch

File FileTypesUpdate.patch, 12.6 KB (added by Karvjorm, 14 years ago)

First update for Changeset 36252

  • src/preferences/filetypes/FileTypes.cpp

     
    221221                ref.name, strerror(status));
    222222
    223223            (new BAlert(TR("FileTypes request"),
    224                 buffer, "Ok", NULL, NULL,
     224                buffer, TR("Ok"), NULL, NULL,
    225225                B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
    226226
    227227            message->RemoveData("refs", --index);
     
    366366            if (message->FindMessenger("target", &target) != B_OK)
    367367                target = be_app_messenger;
    368368
    369             BString title = "FileTypes";
     369            BString title = TR("FileTypes");
    370370            if (subTitle != NULL && subTitle[0]) {
    371371                title.Append(": ");
    372372                title.Append(subTitle);
  • src/preferences/filetypes/FileTypeWindow.cpp

     
    9696    fSameTypeAsButton->ResizeToPreferred();
    9797    box->AddChild(fSameTypeAsButton);
    9898
    99     width = font.StringWidth("Icon") + 16.0f;
     99    width = font.StringWidth(TR("Icon")) + 16.0f;
    100100    if (width < B_LARGE_ICON + 16.0f)
    101101        width = B_LARGE_ICON + 16.0f;
    102102
     
    112112    rect.right += width + 8.0f;
    113113    float iconBoxWidth = rect.Width();
    114114    box = new BBox(rect, NULL, B_FOLLOW_RIGHT | B_FOLLOW_TOP);
    115     box->SetLabel("Icon");
     115    box->SetLabel(TR("Icon"));
    116116    topView->AddChild(box);
    117117
    118118    rect = BRect(8.0f, 0.0f, 7.0f + B_LARGE_ICON, B_LARGE_ICON - 1.0f);
     
    221221    } else if (refs.FindRef("refs", 0, &ref) == B_OK)
    222222        title = ref.name;
    223223
    224     title.Append(" file type");
     224    title.Append(TR(" file type"));
    225225    return title;
    226226}
    227227
  • src/preferences/filetypes/AttributeListView.cpp

     
    66
    77#include "AttributeListView.h"
    88
     9#include <Catalog.h>
     10#include <Locale.h>
     11
    912#include <stdio.h>
    1013
     14#undef TR_CONTEXT
     15#define TR_CONTEXT "Attribute List View"
    1116
    1217const struct type_map kTypeMap[] = {
    13     {"String",          B_STRING_TYPE},
    14     {"Boolean",         B_BOOL_TYPE},
    15     {"Integer 8 bit",   B_INT8_TYPE},
    16     {"Integer 16 bit",  B_INT16_TYPE},
    17     {"Integer 32 bit",  B_INT32_TYPE},
    18     {"Integer 64 bit",  B_INT64_TYPE},
    19     {"Float",           B_FLOAT_TYPE},
    20     {"Double",          B_DOUBLE_TYPE},
    21     {"Time",            B_TIME_TYPE},
     18    {TR("String"),          B_STRING_TYPE},
     19    {TR("Boolean"),         B_BOOL_TYPE},
     20    {TR("Integer 8 bit"),   B_INT8_TYPE},
     21    {TR("Integer 16 bit"),  B_INT16_TYPE},
     22    {TR("Integer 32 bit"),  B_INT32_TYPE},
     23    {TR("Integer 64 bit"),  B_INT64_TYPE},
     24    {TR("Float"),           B_FLOAT_TYPE},
     25    {TR("Double"),          B_DOUBLE_TYPE},
     26    {TR("Time"),            B_TIME_TYPE},
    2227    {NULL,              0}
    2328};
    2429
    2530// TODO: in the future, have a (private) Tracker API that exports these
    2631//  as well as a nice GUI for them.
    2732const struct display_as_map kDisplayAsMap[] = {
    28     {"Default",     NULL,       {}},
    29     {"Rating",      "rating",   {B_INT32_TYPE, B_INT8_TYPE, B_INT16_TYPE}},
     33    {TR("Default"),     NULL,       {}},
     34    {TR("Rating"),      "rating",   {B_INT32_TYPE, B_INT8_TYPE, B_INT16_TYPE}},
    3035    {NULL,          NULL,       {}}
    3136};
    3237
  • src/preferences/filetypes/PreferredAppMenu.cpp

     
    287287            "Are you sure you want to set it anyway?"),
    288288            description[0] ? description : preferred);
    289289
    290         BAlert* alert = new BAlert("FileTypes Request", warning,
    291             TR("Set Preferred Application"), "Cancel", NULL, B_WIDTH_AS_USUAL,
    292             B_WARNING_ALERT);
     290        BAlert* alert = new BAlert(TR("FileTypes Request"), warning,
     291            TR("Set Preferred Application"), TR("Cancel"), NULL,
     292                B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    293293        if (alert->Go() == 1)
    294294            return B_ERROR;
    295295    }
  • src/preferences/filetypes/ApplicationTypesWindow.cpp

     
    187187    rect.left = 10.0f;
    188188    rect.right = 170;
    189189
    190     fTypeListView = new MimeTypeListView(rect, "listview", "application", true, true,
    191         B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM);
     190    fTypeListView = new MimeTypeListView(rect, "listview", "application",
     191        true, true, B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM);
    192192    fTypeListView->SetSelectionMessage(new BMessage(kMsgTypeSelected));
    193193    fTypeListView->SetInvocationMessage(new BMessage(kMsgTypeInvoked));
    194194
    195195    BScrollView* scrollView = new BScrollView("scrollview", fTypeListView,
    196         B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_FRAME_EVENTS | B_WILL_DRAW, false, true);
     196        B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_FRAME_EVENTS | B_WILL_DRAW,
     197        false, true);
    197198    topView->AddChild(scrollView);
    198199
    199200    // "Information" group
     
    215216
    216217    innerRect.right = box->Bounds().Width() - 8.0f;
    217218    innerRect.top += ceilf(fontHeight.ascent);
    218     fNameView = new StringView(innerRect, "name", TR("Name:"), NULL, B_FOLLOW_LEFT_RIGHT);
     219    fNameView = new StringView(innerRect, "name", TR("Name:"), NULL,
     220        B_FOLLOW_LEFT_RIGHT);
    219221    fNameView->SetDivider(labelWidth);
    220222    float width, height;
    221223    fNameView->GetPreferredSize(&width, &height);
     
    225227
    226228    innerRect.OffsetBy(0, fNameView->Bounds().Height() + 5.0f);
    227229    innerRect.bottom = innerRect.top + height;
    228     fSignatureView = new StringView(innerRect, "signature", TR("Signature:"), NULL,
    229         B_FOLLOW_LEFT_RIGHT);
     230    fSignatureView = new StringView(innerRect, "signature", TR("Signature:"),
     231        NULL, B_FOLLOW_LEFT_RIGHT);
    230232    fSignatureView->SetDivider(labelWidth);
    231233    box->AddChild(fSignatureView);
    232234
     
    253255
    254256    innerRect.OffsetBy(0, fNameView->Bounds().Height() + 5.0f);
    255257    innerRect.right = innerRect.left + labelWidth;
    256     fDescriptionLabel = new StringView(innerRect, "description", TR("Description:"), NULL);
     258    fDescriptionLabel = new StringView(innerRect, "description",
     259        TR("Description:"), NULL);
    257260    fDescriptionLabel->SetDivider(labelWidth);
    258261    box->AddChild(fDescriptionLabel);
    259262
     
    274277    rect = box->Frame();
    275278    rect.top = rect.bottom + 8.0f;
    276279    rect.bottom = rect.top + 20.0f;
    277     fTrackerButton = new BButton(rect, "tracker", TR("Show in Tracker" B_UTF8_ELLIPSIS), NULL,
    278         B_FOLLOW_RIGHT);
     280    fTrackerButton = new BButton(rect, "tracker",
     281        TR("Show in Tracker" B_UTF8_ELLIPSIS), NULL, B_FOLLOW_RIGHT);
    279282    fTrackerButton->ResizeToPreferred();
    280     fTrackerButton->MoveTo(rect.right - fTrackerButton->Bounds().Width(), rect.top);
     283    fTrackerButton->MoveTo(rect.right - fTrackerButton->Bounds().Width(),
     284        rect.top);
    281285    topView->AddChild(fTrackerButton);
    282286
    283287    fLaunchButton = new BButton(rect, "launch", TR("Launch"), NULL,
     
    287291        - fLaunchButton->Bounds().Width(), rect.top);
    288292    topView->AddChild(fLaunchButton);
    289293   
    290     fEditButton = new BButton(rect, "edit", TR("Edit" B_UTF8_ELLIPSIS), new BMessage(kMsgEdit),
    291         B_FOLLOW_RIGHT);
     294    fEditButton = new BButton(rect, "edit", TR("Edit" B_UTF8_ELLIPSIS),
     295        new BMessage(kMsgEdit), B_FOLLOW_RIGHT);
    292296    fEditButton->ResizeToPreferred();
    293297    fEditButton->MoveTo(fLaunchButton->Frame().left - 6.0f
    294298        - fEditButton->Bounds().Width(), rect.top);
    295299    topView->AddChild(fEditButton);
    296300
    297     SetSizeLimits(scrollView->Frame().right + 22.0f + fTrackerButton->Frame().Width()
    298         + fLaunchButton->Frame().Width() + 6 + fEditButton->Frame().Width(), 32767.0f,
     301    SetSizeLimits(scrollView->Frame().right + 22.0f
     302        + fTrackerButton->Frame().Width() + fLaunchButton->Frame().Width()
     303        + 6 + fEditButton->Frame().Width(), 32767.0f,
    299304        fTrackerButton->Frame().bottom + 8.0f, 32767.0f);
    300305
    301306    BMimeType::StartWatching(this);
     
    328333    int32 removed = 0;
    329334    volatile bool quit = false;
    330335
    331     BWindow* progressWindow = new ProgressWindow(TR("Removing uninstalled application types"),
     336    BWindow* progressWindow =
     337        new ProgressWindow(TR("Removing uninstalled application types"),
    332338        fTypeListView->FullListCountItems(), &quit);
    333339    progressWindow->AddToSubset(this);
    334340    progressWindow->Show();
    335341
    336342    for (int32 i = fTypeListView->FullListCountItems(); i-- > 0 && !quit;) {
    337         MimeTypeItem* item = dynamic_cast<MimeTypeItem*>(fTypeListView->FullListItemAt(i));
     343        MimeTypeItem* item
     344            = dynamic_cast<MimeTypeItem*>(fTypeListView->FullListItemAt(i));
    338345        progressWindow->PostMessage(B_UPDATE_STATUS_BAR);
    339346
    340347        if (item == NULL)
     
    382389
    383390    char message[512];
    384391    // TODO : use ICU to properly format this
    385     snprintf(message, sizeof(message), TR("%ld Application type%s could be removed."),
    386         removed, removed == 1 ? "" : "s");
     392    snprintf(message, sizeof(message),
     393        (removed == 1
     394            ? TR("%ld Application type could be removed.")
     395            : TR("%ld Application types could be removed.")),
     396        removed);
    387397    error_alert(message, B_OK, B_INFO_ALERT);
    388398}
    389399
  • src/preferences/filetypes/FileTypesWindow.cpp

     
    277277
    278278
    279279FileTypesWindow::FileTypesWindow(const BMessage& settings)
    280     : BWindow(_Frame(settings), "FileTypes", B_TITLED_WINDOW,
     280    : BWindow(_Frame(settings), TR("FileTypes"), B_TITLED_WINDOW,
    281281        B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS),
    282282    fNewTypeWindow(NULL)
    283283{
     
    395395
    396396    innerRect.left = 8.0f;
    397397    innerRect.top = plainHeight.ascent + 3.0f
    398         + (rect.Height() - boldHeight.ascent - fIconView->Bounds().Height()) / 2.0f;
    399     if (innerRect.top + fIconView->Bounds().Height() > fIconBox->Bounds().Height() - 6.0f)
    400         innerRect.top = fIconBox->Bounds().Height() - 6.0f - fIconView->Bounds().Height();
     398        + (rect.Height() - boldHeight.ascent - fIconView->Bounds().Height())
     399        / 2.0f;
     400    if (innerRect.top + fIconView->Bounds().Height()
     401        > fIconBox->Bounds().Height() - 6.0f)
     402        innerRect.top = fIconBox->Bounds().Height() - 6.0f
     403        - fIconView->Bounds().Height();
    401404    fIconView->MoveTo(innerRect.LeftTop());
    402405    fIconBox->AddChild(fIconView);
    403406
     
    412415
    413416    innerRect = fRecognitionBox->Bounds().InsetByCopy(8.0f, 4.0f);
    414417    innerRect.top += ceilf(boldHeight.ascent);
    415     fExtensionLabel = new StringView(innerRect, "extension", TR("Extensions:"), NULL);
     418    fExtensionLabel = new StringView(innerRect, "extension",
     419        TR("Extensions:"), NULL);
    416420    fExtensionLabel->SetAlignment(B_ALIGN_LEFT, B_ALIGN_LEFT);
    417421    fExtensionLabel->ResizeToPreferred();
    418422    fRecognitionBox->AddChild(fExtensionLabel);
     
    420424    innerRect.top += fExtensionLabel->Bounds().Height() + 2.0f;
    421425    innerRect.left = innerRect.right - button->StringWidth(TR("Remove")) - 16.0f;
    422426    innerRect.bottom = innerRect.top + button->Bounds().Height();
    423     fAddExtensionButton = new BButton(innerRect, "add ext", TR("Add" B_UTF8_ELLIPSIS),
    424         new BMessage(kMsgAddExtension), B_FOLLOW_RIGHT);
     427    fAddExtensionButton = new BButton(innerRect, "add ext",
     428        TR("Add" B_UTF8_ELLIPSIS), new BMessage(kMsgAddExtension),
     429        B_FOLLOW_RIGHT);
    425430    fRecognitionBox->AddChild(fAddExtensionButton);
    426431
    427432    innerRect.OffsetBy(0, innerRect.Height() + 4.0f);
     
    466471    innerRect = fDescriptionBox->Bounds().InsetByCopy(8.0f, 6.0f);
    467472    innerRect.top += ceilf(boldHeight.ascent);
    468473    innerRect.bottom = innerRect.top + button->Bounds().Height();
    469     fInternalNameView = new StringView(innerRect, "internal", TR("Internal name:"), "",
    470         B_FOLLOW_LEFT_RIGHT);
     474    fInternalNameView = new StringView(innerRect, "internal",
     475        TR("Internal name:"), "", B_FOLLOW_LEFT_RIGHT);
    471476    labelWidth = fInternalNameView->StringWidth(fInternalNameView->Label()) + 2.0f;
    472477    fInternalNameView->SetDivider(labelWidth);
    473478    fInternalNameView->SetEnabled(false);
     
    484489    fDescriptionBox->AddChild(fTypeNameControl);
    485490
    486491    innerRect.OffsetBy(0, fTypeNameControl->Bounds().Height() + 5.0f);
    487     fDescriptionControl = new BTextControl(innerRect, "description", TR("Description:"), "",
    488         new BMessage(kMsgDescriptionEntered), B_FOLLOW_LEFT_RIGHT);
     492    fDescriptionControl = new BTextControl(innerRect, "description",
     493        TR("Description:"), "", new BMessage(kMsgDescriptionEntered),
     494        B_FOLLOW_LEFT_RIGHT);
    489495    fDescriptionControl->SetDivider(labelWidth);
    490496    fDescriptionControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
    491497    fDescriptionBox->AddChild(fDescriptionControl);
  • src/preferences/filetypes/ApplicationTypeWindow.cpp

     
    576576        strcpy(name, "\"-\"");
    577577
    578578    BString title(name);
    579     title.Append(" application type");
     579    title.Append(TR(" application type"));
    580580    return title;
    581581}
    582582