Apply a nice patch from Taos, just some smaller style fixes by myself.

Localize the mail kit.
The Japanese translation is attached to #7689. Please give a notice when it is in the translation system and the ticket can be closed.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42267 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2011-06-20 21:12:23 +00:00
parent aa56e459e0
commit cba256dc5b
4 changed files with 60 additions and 43 deletions
+36 -28
View File
@@ -1,30 +1,34 @@
/* /* BMailFileConfigView - a file configuration view for filters
* Copyright 2011, Haiku Inc. All Rights Reserved. **
* Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. ** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
*/ */
//! A file configuration view for filters.
#include <FileConfigView.h>
#include <stdio.h> #include <stdio.h>
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <Message.h> #include <Message.h>
#include <Path.h> #include <Path.h>
#include <String.h> #include <String.h>
#include <TextControl.h> #include <TextControl.h>
#include <MDRLanguage.h> #include <FileConfigView.h>
class _EXPORT BFileControl;
class _EXPORT BMailFileConfigView;
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MailKit"
const uint32 kMsgSelectButton = 'fsel'; const uint32 kMsgSelectButton = 'fsel';
BFileControl::BFileControl(BRect rect, const char* name, const char* label, BFileControl::BFileControl(BRect rect, const char* name, const char* label,
const char* pathOfFile, uint32 flavors) const char *pathOfFile,uint32 flavors)
: :
BView(rect, name, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0) BView(rect, name, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0)
{ {
@@ -33,26 +37,26 @@ BFileControl::BFileControl(BRect rect, const char* name, const char* label,
// determine font height // determine font height
font_height fontHeight; font_height fontHeight;
GetFontHeight(&fontHeight); GetFontHeight(&fontHeight);
float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 13;
+ fontHeight.leading) + 13; BString selectString = B_TRANSLATE("Select");
float labelWidth = StringWidth("Select" B_UTF8_ELLIPSIS) + 20; selectString += B_UTF8_ELLIPSIS;
float labelWidth = StringWidth(selectString) + 20;
rect = Bounds(); rect = Bounds();
rect.right -= labelWidth; rect.right -= labelWidth;
rect.top = 4; rect.bottom = itemHeight + 2; rect.top = 4; rect.bottom = itemHeight + 2;
fText = new BTextControl(rect, "file_path", label, pathOfFile, NULL); fText = new BTextControl(rect,"file_path",label,pathOfFile,NULL);
if (label) if (label)
fText->SetDivider(fText->StringWidth(label) + 6); fText->SetDivider(fText->StringWidth(label) + 6);
AddChild(fText); AddChild(fText);
fButton = new BButton(BRect(0, 0, 1, 1), "select_file", fButton = new BButton(BRect(0,0,1,1), "select_file", selectString,
MDR_DIALECT_CHOICE ("Select","選択") B_UTF8_ELLIPSIS,
new BMessage(kMsgSelectButton)); new BMessage(kMsgSelectButton));
fButton->ResizeToPreferred(); fButton->ResizeToPreferred();
fButton->MoveBy(rect.right + 6, fButton->MoveBy(rect.right + 6,
(rect.Height() - fButton->Frame().Height()) / 2); (rect.Height() - fButton->Frame().Height()) / 2);
AddChild(fButton); AddChild(fButton);
fPanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL, flavors, false); fPanel = new BFilePanel(B_OPEN_PANEL,NULL,NULL,flavors,false);
ResizeToPreferred(); ResizeToPreferred();
} }
@@ -78,10 +82,12 @@ BFileControl::AttachedToWindow()
void void
BFileControl::MessageReceived(BMessage *msg) BFileControl::MessageReceived(BMessage *msg)
{ {
switch (msg->what) { switch (msg->what)
{
case kMsgSelectButton: case kMsgSelectButton:
{ {
fPanel->Hide(); fPanel->Hide();
//fPanel->Window()->SetTitle(title);
BPath path(fText->Text()); BPath path(fText->Text());
if (path.InitCheck() >= B_OK) if (path.InitCheck() >= B_OK)
@@ -137,17 +143,17 @@ BFileControl::SetEnabled(bool enabled)
void void
BFileControl::GetPreferredSize(float* width, float* height) BFileControl::GetPreferredSize(float *width, float *height)
{ {
*width = fButton->Frame().right + 5; *width = fButton->Frame().right + 5;
*height = fText->Bounds().Height() + 8; *height = fText->Bounds().Height() + 8;
} }
//--------------------------------------------------------------------------
// #pragma mark - // #pragma mark -
BMailFileConfigView::BMailFileConfigView(const char* label, const char*name,
BMailFileConfigView::BMailFileConfigView(const char* label, const char* name,
bool useMeta, const char* defaultPath, uint32 flavors) bool useMeta, const char* defaultPath, uint32 flavors)
: :
BFileControl(BRect(5, 0, 255, 10), name, label, defaultPath, flavors), BFileControl(BRect(5, 0, 255, 10), name, label, defaultPath, flavors),
@@ -158,23 +164,25 @@ BMailFileConfigView::BMailFileConfigView(const char* label, const char* name,
void void
BMailFileConfigView::SetTo(const BMessage* archive, BMessage* meta) BMailFileConfigView::SetTo(const BMessage *archive, BMessage *meta)
{ {
fMeta = meta; fMeta = meta;
BString path = (fUseMeta ? meta : archive)->FindString(fName); BString path = (fUseMeta ? meta : archive)->FindString(fName);
if (path != "") if (path != "")
SetText(path.String()); SetText(path.String());
} }
status_t status_t
BMailFileConfigView::Archive(BMessage* into, bool /*deep*/) const BMailFileConfigView::Archive(BMessage *into, bool /*deep*/) const
{ {
const char* path = Text(); const char *path = Text();
BMessage* archive = fUseMeta ? fMeta : into; BMessage *archive = fUseMeta ? fMeta : into;
if (archive->ReplaceString(fName, path) != B_OK) if (archive->ReplaceString(fName,path) != B_OK)
archive->AddString(fName, path); archive->AddString(fName,path);
return B_OK; return B_OK;
} }
+9
View File
@@ -58,4 +58,13 @@ SharedLibrary libmail.so :
$(TARGET_NETWORK_LIBS) $(TARGET_NETWORK_LIBS)
$(TARGET_SELECT_UNAME_ETC_LIB) $(TARGET_SELECT_UNAME_ETC_LIB)
$(HAIKU_OPENSSL_LIBS) $(HAIKU_OPENSSL_LIBS)
$(HAIKU_LOCALE_LIBS)
;
DoCatalogs libmail.so :
x-vnd.Haiku-libmail
:
FileConfigView.cpp
ProtocolConfigView.cpp
; ;
-2
View File
@@ -23,8 +23,6 @@
#include <StringList.h> #include <StringList.h>
#include <VolumeRoster.h> #include <VolumeRoster.h>
#include <MDRLanguage.h>
#include <mail_util.h> #include <mail_util.h>
#include <MailAddon.h> #include <MailAddon.h>
#include <MailDaemon.h> #include <MailDaemon.h>
+15 -13
View File
@@ -13,6 +13,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <Catalog.h>
#include <CheckBox.h> #include <CheckBox.h>
#include <MenuField.h> #include <MenuField.h>
#include <MenuItem.h> #include <MenuItem.h>
@@ -22,7 +23,10 @@
#include <TextControl.h> #include <TextControl.h>
#include <crypt.h> #include <crypt.h>
#include <MDRLanguage.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "ProtocolConfigView"
const char* kPartialDownloadLimit = "partial_download_limit"; const char* kPartialDownloadLimit = "partial_download_limit";
@@ -32,9 +36,8 @@ BodyDownloadConfig::BodyDownloadConfig()
: :
BView(BRect(0,0,50,50), "body_config", B_FOLLOW_ALL_SIDES, 0) BView(BRect(0,0,50,50), "body_config", B_FOLLOW_ALL_SIDES, 0)
{ {
const char *partial_text = MDR_DIALECT_CHOICE ( const char *partial_text = B_TRANSLATE(
"Partially download messages larger than", "Partially download messages larger than");
"部分ダウンロードする");
BRect r(0, 0, 280, 15); BRect r(0, 0, 280, 15);
fPartialBox = new BCheckBox(r, "size_if", partial_text, fPartialBox = new BCheckBox(r, "size_if", partial_text,
@@ -213,22 +216,23 @@ BMailProtocolConfigView::BMailProtocolConfigView(uint32 options_mask)
rect.bottom = rect.top - 2 + sItemHeight; rect.bottom = rect.top - 2 + sItemHeight;
if (options_mask & B_MAIL_PROTOCOL_HAS_HOSTNAME) if (options_mask & B_MAIL_PROTOCOL_HAS_HOSTNAME)
AddChild(AddTextField(rect,"host",MDR_DIALECT_CHOICE ("Mail server:","サーバ名 "))); AddChild(AddTextField(rect, "host", B_TRANSLATE("Mail server:")));
if (options_mask & B_MAIL_PROTOCOL_HAS_USERNAME) if (options_mask & B_MAIL_PROTOCOL_HAS_USERNAME)
AddChild(AddTextField(rect,"user",MDR_DIALECT_CHOICE ("Username:","ユーザーID"))); AddChild(AddTextField(rect, "user", B_TRANSLATE("Username:")));
if (options_mask & B_MAIL_PROTOCOL_HAS_PASSWORD) { if (options_mask & B_MAIL_PROTOCOL_HAS_PASSWORD) {
BTextControl *control = AddTextField(rect,"pass",MDR_DIALECT_CHOICE ("Password:","パスワード:")); BTextControl *control = AddTextField(rect, "pass",
B_TRANSLATE("Password:"));
control->TextView()->HideTyping(true); control->TextView()->HideTyping(true);
AddChild(control); AddChild(control);
} }
if (options_mask & B_MAIL_PROTOCOL_HAS_FLAVORS) if (options_mask & B_MAIL_PROTOCOL_HAS_FLAVORS)
AddChild(AddMenuField(rect,"flavor","Connection type:")); AddChild(AddMenuField(rect, "flavor", B_TRANSLATE("Connection type:")));
if (options_mask & B_MAIL_PROTOCOL_HAS_AUTH_METHODS) if (options_mask & B_MAIL_PROTOCOL_HAS_AUTH_METHODS)
AddChild(AddMenuField(rect,"auth_method",MDR_DIALECT_CHOICE ("Login type:","認証方法 "))); AddChild(AddMenuField(rect, "auth_method", B_TRANSLATE("Login type:")));
// set divider // set divider
float width = FindWidestLabel(this); float width = FindWidestLabel(this);
@@ -239,11 +243,9 @@ BMailProtocolConfigView::BMailProtocolConfigView(uint32 options_mask)
if (options_mask & B_MAIL_PROTOCOL_CAN_LEAVE_MAIL_ON_SERVER) { if (options_mask & B_MAIL_PROTOCOL_CAN_LEAVE_MAIL_ON_SERVER) {
AddChild(AddCheckBox(rect, "leave_mail_on_server", AddChild(AddCheckBox(rect, "leave_mail_on_server",
MDR_DIALECT_CHOICE ("Leave mail on server", B_TRANSLATE("Leave mail on server"), new BMessage('lmos')));
"受信後にサーバ内のメールを削除しない"), new BMessage('lmos')));
BCheckBox* box = AddCheckBox(rect, "delete_remote_when_local", BCheckBox* box = AddCheckBox(rect, "delete_remote_when_local",
MDR_DIALECT_CHOICE ("Remove mail from server when deleted", B_TRANSLATE("Remove mail from server when deleted"));
"端末で削除されたらサーバ保存分も削除"));
box->SetEnabled(false); box->SetEnabled(false);
AddChild(box); AddChild(box);
} }