Reverted partial size checkbox simplification change and made according GetPreferredSize changes

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19506 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2006-12-14 00:10:03 +00:00
parent 0a7b5658d2
commit b9a3b1c414

View File

@ -339,46 +339,69 @@ class FolderConfig : public BView {
FolderConfig(BMessage *settings, BMessage *meta_data) : BView(BRect(0,0,50,50),"folder_config",B_FOLLOW_ALL_SIDES,0) {
const char *partial_text = MDR_DIALECT_CHOICE (
"Partially download large messages",
"Partially download messages larger than",
"部分ダウンロードする");
view = new BMailFileConfigView(
MDR_DIALECT_CHOICE ("Location:","受信箱:"),
MDR_DIALECT_CHOICE ("Destination Folder:","受信箱:"),
"path",true,"/boot/home/mail/in");
view->SetTo(settings,meta_data);
view->ResizeToPreferred();
BRect r(view->Frame());
r.OffsetBy(0,r.Height() + 5);
partial_box = new BCheckBox(r, "size_if", partial_text, new BMessage('SIZF'));
partial_box->ResizeToPreferred();
partial_box = new BCheckBox(BRect(view->Frame().left, view->Frame().bottom + 5,
view->Frame().left + 18 + be_plain_font->StringWidth(partial_text),
view->Frame().bottom + 25), "size_if", partial_text, new BMessage('SIZF'));
size = new BTextControl(BRect(
view->Frame().left + 20 + be_plain_font->StringWidth(partial_text),
view->Frame().bottom + 5,
view->Frame().left + 42 + be_plain_font->StringWidth(partial_text),
view->Frame().bottom + 25), "size", "", "", NULL);
bytes_label = new BStringView(BRect(
view->Frame().left + 42 + be_plain_font->StringWidth(partial_text),
view->Frame().bottom + 5, view->Frame().right,view->Frame().bottom+21),
"kb", "KB");
AddChild(bytes_label);
size->SetDivider(0);
if (settings->HasInt32("size_limit")) {
BString kb;
kb << int32(settings->FindInt32("size_limit")/1024);
size->SetText(kb.String());
partial_box->SetValue(B_CONTROL_ON);
} else
size->SetEnabled(false);
AddChild(view);
SetViewColor(216,216,216);
AddChild(partial_box);
AddChild(size);
ResizeToPreferred();
}
void MessageReceived(BMessage *msg) {
if (msg->what != 'SIZF')
return BView::MessageReceived(msg);
size->SetEnabled(partial_box->Value());
}
void AttachedToWindow() {
partial_box->SetTarget(this);
}
void GetPreferredSize(float *width, float *height) {
view->GetPreferredSize(width,height);
*height = partial_box->Frame().bottom + 5;
*width = MAX(partial_box->Frame().right + 5, *width) + 5;
*width = MAX(bytes_label->Frame().right + 5, *width) + 5;
}
status_t Archive(BMessage *into, bool) const {
into->MakeEmpty();
view->Archive(into);
// 100KB should be a reasonable limit -- the only people that will probably be
// concerned about size are dial-up users
if (partial_box->Value())
into->AddInt32("size_limit",102400);
into->AddInt32("size_limit",atoi(size->Text()) * 1024);
return B_OK;
}
private:
BMailFileConfigView *view;
// BTextControl *size;
BTextControl *size;
BCheckBox *partial_box;
BStringView *bytes_label;
};
BView* instantiate_config_panel(BMessage *settings, BMessage *meta_data)