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:
@@ -1,30 +1,34 @@
|
||||
/*
|
||||
* Copyright 2011, Haiku Inc. All Rights Reserved.
|
||||
* Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
/* BMailFileConfigView - a file configuration view for filters
|
||||
**
|
||||
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
//! A file configuration view for filters.
|
||||
|
||||
|
||||
#include <FileConfigView.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Button.h>
|
||||
#include <Catalog.h>
|
||||
#include <Message.h>
|
||||
#include <Path.h>
|
||||
#include <String.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';
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -33,26 +37,26 @@ BFileControl::BFileControl(BRect rect, const char* name, const char* label,
|
||||
// determine font height
|
||||
font_height fontHeight;
|
||||
GetFontHeight(&fontHeight);
|
||||
float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent
|
||||
+ fontHeight.leading) + 13;
|
||||
float labelWidth = StringWidth("Select" B_UTF8_ELLIPSIS) + 20;
|
||||
float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 13;
|
||||
BString selectString = B_TRANSLATE("Select");
|
||||
selectString += B_UTF8_ELLIPSIS;
|
||||
float labelWidth = StringWidth(selectString) + 20;
|
||||
rect = Bounds();
|
||||
rect.right -= labelWidth;
|
||||
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)
|
||||
fText->SetDivider(fText->StringWidth(label) + 6);
|
||||
AddChild(fText);
|
||||
|
||||
fButton = new BButton(BRect(0, 0, 1, 1), "select_file",
|
||||
MDR_DIALECT_CHOICE ("Select","選択") B_UTF8_ELLIPSIS,
|
||||
fButton = new BButton(BRect(0,0,1,1), "select_file", selectString,
|
||||
new BMessage(kMsgSelectButton));
|
||||
fButton->ResizeToPreferred();
|
||||
fButton->MoveBy(rect.right + 6,
|
||||
(rect.Height() - fButton->Frame().Height()) / 2);
|
||||
AddChild(fButton);
|
||||
|
||||
fPanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL, flavors, false);
|
||||
fPanel = new BFilePanel(B_OPEN_PANEL,NULL,NULL,flavors,false);
|
||||
|
||||
ResizeToPreferred();
|
||||
}
|
||||
@@ -78,10 +82,12 @@ BFileControl::AttachedToWindow()
|
||||
void
|
||||
BFileControl::MessageReceived(BMessage *msg)
|
||||
{
|
||||
switch (msg->what) {
|
||||
switch (msg->what)
|
||||
{
|
||||
case kMsgSelectButton:
|
||||
{
|
||||
fPanel->Hide();
|
||||
//fPanel->Window()->SetTitle(title);
|
||||
|
||||
BPath path(fText->Text());
|
||||
if (path.InitCheck() >= B_OK)
|
||||
@@ -137,17 +143,17 @@ BFileControl::SetEnabled(bool enabled)
|
||||
|
||||
|
||||
void
|
||||
BFileControl::GetPreferredSize(float* width, float* height)
|
||||
BFileControl::GetPreferredSize(float *width, float *height)
|
||||
{
|
||||
*width = fButton->Frame().right + 5;
|
||||
*height = fText->Bounds().Height() + 8;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// #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)
|
||||
:
|
||||
BFileControl(BRect(5, 0, 255, 10), name, label, defaultPath, flavors),
|
||||
@@ -158,23 +164,25 @@ BMailFileConfigView::BMailFileConfigView(const char* label, const char* name,
|
||||
|
||||
|
||||
void
|
||||
BMailFileConfigView::SetTo(const BMessage* archive, BMessage* meta)
|
||||
BMailFileConfigView::SetTo(const BMessage *archive, BMessage *meta)
|
||||
{
|
||||
fMeta = meta;
|
||||
BString path = (fUseMeta ? meta : archive)->FindString(fName);
|
||||
|
||||
if (path != "")
|
||||
SetText(path.String());
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BMailFileConfigView::Archive(BMessage* into, bool /*deep*/) const
|
||||
BMailFileConfigView::Archive(BMessage *into, bool /*deep*/) const
|
||||
{
|
||||
const char* path = Text();
|
||||
BMessage* archive = fUseMeta ? fMeta : into;
|
||||
const char *path = Text();
|
||||
BMessage *archive = fUseMeta ? fMeta : into;
|
||||
|
||||
if (archive->ReplaceString(fName, path) != B_OK)
|
||||
archive->AddString(fName, path);
|
||||
if (archive->ReplaceString(fName,path) != B_OK)
|
||||
archive->AddString(fName,path);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,4 +58,13 @@ SharedLibrary libmail.so :
|
||||
$(TARGET_NETWORK_LIBS)
|
||||
$(TARGET_SELECT_UNAME_ETC_LIB)
|
||||
$(HAIKU_OPENSSL_LIBS)
|
||||
$(HAIKU_LOCALE_LIBS)
|
||||
;
|
||||
|
||||
|
||||
DoCatalogs libmail.so :
|
||||
x-vnd.Haiku-libmail
|
||||
:
|
||||
FileConfigView.cpp
|
||||
ProtocolConfigView.cpp
|
||||
;
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#include <StringList.h>
|
||||
#include <VolumeRoster.h>
|
||||
|
||||
#include <MDRLanguage.h>
|
||||
|
||||
#include <mail_util.h>
|
||||
#include <MailAddon.h>
|
||||
#include <MailDaemon.h>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <Catalog.h>
|
||||
#include <CheckBox.h>
|
||||
#include <MenuField.h>
|
||||
#include <MenuItem.h>
|
||||
@@ -22,7 +23,10 @@
|
||||
#include <TextControl.h>
|
||||
|
||||
#include <crypt.h>
|
||||
#include <MDRLanguage.h>
|
||||
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "ProtocolConfigView"
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
const char *partial_text = MDR_DIALECT_CHOICE (
|
||||
"Partially download messages larger than",
|
||||
"部分ダウンロードする");
|
||||
const char *partial_text = B_TRANSLATE(
|
||||
"Partially download messages larger than");
|
||||
|
||||
BRect r(0, 0, 280, 15);
|
||||
fPartialBox = new BCheckBox(r, "size_if", partial_text,
|
||||
@@ -213,22 +216,23 @@ BMailProtocolConfigView::BMailProtocolConfigView(uint32 options_mask)
|
||||
rect.bottom = rect.top - 2 + sItemHeight;
|
||||
|
||||
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)
|
||||
AddChild(AddTextField(rect,"user",MDR_DIALECT_CHOICE ("Username:","ユーザーID:")));
|
||||
AddChild(AddTextField(rect, "user", B_TRANSLATE("Username:")));
|
||||
|
||||
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);
|
||||
AddChild(control);
|
||||
}
|
||||
|
||||
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)
|
||||
AddChild(AddMenuField(rect,"auth_method",MDR_DIALECT_CHOICE ("Login type:","認証方法 :")));
|
||||
AddChild(AddMenuField(rect, "auth_method", B_TRANSLATE("Login type:")));
|
||||
|
||||
// set divider
|
||||
float width = FindWidestLabel(this);
|
||||
@@ -239,11 +243,9 @@ BMailProtocolConfigView::BMailProtocolConfigView(uint32 options_mask)
|
||||
|
||||
if (options_mask & B_MAIL_PROTOCOL_CAN_LEAVE_MAIL_ON_SERVER) {
|
||||
AddChild(AddCheckBox(rect, "leave_mail_on_server",
|
||||
MDR_DIALECT_CHOICE ("Leave mail on server",
|
||||
"受信後にサーバ内のメールを削除しない"), new BMessage('lmos')));
|
||||
B_TRANSLATE("Leave mail on server"), new BMessage('lmos')));
|
||||
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);
|
||||
AddChild(box);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user