diff --git a/headers/private/mail/mail_util.h b/headers/private/mail/mail_util.h index 25247c1522..205b2c9af1 100644 --- a/headers/private/mail/mail_util.h +++ b/headers/private/mail/mail_util.h @@ -1,9 +1,11 @@ +/* + * Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. + */ #ifndef ZOIDBERG_GARGOYLE_MAIL_UTIL_H #define ZOIDBERG_GARGOYLE_MAIL_UTIL_H -/* mail util - header parsing -** -** Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. -*/ + + +//! Header parsing utilities #include @@ -13,7 +15,7 @@ #include -#define R5_COMPATIBLE 1 +// TODO: this should only be preserved for gcc2 compatibility class BString; @@ -95,6 +97,8 @@ void extract_address_name(BString &address); // Given a header field (usually the From: e-mail address) with gobbledygook in // it, find the longest human-readable phrase (usually the person's name). -void get_address_list(BList &list, const char *string, void (*cleanupFunc)(BString &) = NULL); +void get_address_list(BList &list, const char *string, + void (*cleanupFunc)(BString &) = NULL); + #endif /* ZOIDBERG_GARGOYLE_MAIL_UTIL_H */ diff --git a/src/kits/mail/FileConfigView.cpp b/src/kits/mail/FileConfigView.cpp index 039fe7562a..b014ee3992 100644 --- a/src/kits/mail/FileConfigView.cpp +++ b/src/kits/mail/FileConfigView.cpp @@ -1,52 +1,58 @@ -/* BMailFileConfigView - a file configuration view for filters -** -** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. -*/ +/* + * Copyright 20011, Haiku Inc. All Rights Reserved. + * Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. + */ -#include -class _EXPORT BFileControl; -class _EXPORT BMailFileConfigView; +//! A file configuration view for filters. -#include -#include -#include -#include -#include - -#include #include +#include + +#include +#include +#include +#include +#include + #include + const uint32 kMsgSelectButton = 'fsel'; -BFileControl::BFileControl(BRect rect,const char *name,const char *label,const char *pathOfFile,uint32 flavors) - : BView(rect,name,B_FOLLOW_LEFT | B_FOLLOW_TOP,0) + +BFileControl::BFileControl(BRect rect, const char* name, const char* label, + const char* pathOfFile, uint32 flavors) + : + BView(rect, name, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); // determine font height font_height fontHeight; GetFontHeight(&fontHeight); - float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 13; + float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent + + fontHeight.leading) + 13; float labelWidth = StringWidth("Select" B_UTF8_ELLIPSIS) + 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, - new BMessage(kMsgSelectButton)); + fButton = new BButton(BRect(0, 0, 1, 1), "select_file", + MDR_DIALECT_CHOICE ("Select","選択") B_UTF8_ELLIPSIS, + new BMessage(kMsgSelectButton)); fButton->ResizeToPreferred(); - fButton->MoveBy(rect.right + 6, (rect.Height() - fButton->Frame().Height()) / 2); + 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(); } @@ -58,7 +64,8 @@ BFileControl::~BFileControl() } -void BFileControl::AttachedToWindow() +void +BFileControl::AttachedToWindow() { fButton->SetTarget(this); @@ -68,14 +75,13 @@ void BFileControl::AttachedToWindow() } -void BFileControl::MessageReceived(BMessage *msg) +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) @@ -108,61 +114,67 @@ void BFileControl::MessageReceived(BMessage *msg) } -void BFileControl::SetText(const char *pathOfFile) +void +BFileControl::SetText(const char *pathOfFile) { fText->SetText(pathOfFile); } -const char *BFileControl::Text() const +const char* +BFileControl::Text() const { return fText->Text(); } -void BFileControl::SetEnabled(bool enabled) +void +BFileControl::SetEnabled(bool enabled) { fText->SetEnabled(enabled); fButton->SetEnabled(enabled); } -void BFileControl::GetPreferredSize(float *width, float *height) +void +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,bool useMeta,const char *defaultPath,uint32 flavors) - : BFileControl(BRect(5,0,255,10),name,label,defaultPath,flavors), - fUseMeta(useMeta), - fName(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), + fUseMeta(useMeta), + fName(name) { } -void BMailFileConfigView::SetTo(const BMessage *archive, BMessage *meta) +void +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 +status_t +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; } -