* Style cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42258 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2011-06-19 22:03:49 +00:00
parent 4a135b33b7
commit ab383924fc
2 changed files with 66 additions and 50 deletions

View File

@ -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 <stdio.h>
@ -13,7 +15,7 @@
#include <E-mail.h>
#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 */

View File

@ -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 <BeBuild.h>
class _EXPORT BFileControl;
class _EXPORT BMailFileConfigView;
//! A file configuration view for filters.
#include <TextControl.h>
#include <Button.h>
#include <String.h>
#include <Message.h>
#include <Path.h>
#include <stdio.h>
#include <FileConfigView.h>
#include <stdio.h>
#include <Button.h>
#include <Message.h>
#include <Path.h>
#include <String.h>
#include <TextControl.h>
#include <MDRLanguage.h>
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;
}