Mail: minor cleanup.
This commit is contained in:
parent
f8300bd979
commit
b20d210d5a
@ -1253,6 +1253,13 @@ BComboBox::Text() const
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
BComboBox::TextLength() const
|
||||
{
|
||||
return fText->TextLength();
|
||||
}
|
||||
|
||||
|
||||
BTextView *
|
||||
BComboBox::TextView()
|
||||
{
|
||||
|
@ -150,6 +150,7 @@ public:
|
||||
virtual void SetLabel(const char *text);
|
||||
virtual void SetText(const char *text);
|
||||
const char *Text() const;
|
||||
int32 TextLength() const;
|
||||
BTextView *TextView();
|
||||
virtual void SetDivider(float dividing_line);
|
||||
float Divider() const;
|
||||
|
@ -138,11 +138,30 @@ static const uint32 kByForumlaItem = 'Fbyq';
|
||||
// taken from src/kits/tracker/FindPanel.h
|
||||
|
||||
|
||||
// static bitmap cache
|
||||
BObjectList<TMailWindow::BitmapItem> TMailWindow::sBitmapCache;
|
||||
BLocker TMailWindow::sBitmapCacheLock;
|
||||
|
||||
// static list for tracking of Windows
|
||||
BList TMailWindow::sWindowList;
|
||||
BLocker TMailWindow::sWindowListLock;
|
||||
|
||||
|
||||
class HorizontalLine : public BView {
|
||||
public:
|
||||
HorizontalLine(BRect rect)
|
||||
:
|
||||
BView (rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Draw(BRect rect)
|
||||
{
|
||||
FillRect(rect, B_SOLID_HIGH);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
@ -216,8 +235,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
||||
// few seconds.
|
||||
|
||||
if (!fIncoming) {
|
||||
QueryMenu *queryMenu;
|
||||
queryMenu = new QueryMenu(B_TRANSLATE("Open draft"), false);
|
||||
QueryMenu* queryMenu = new QueryMenu(B_TRANSLATE("Open draft"), false);
|
||||
queryMenu->SetTargetForItems(be_app);
|
||||
|
||||
queryMenu->SetPredicate("MAIL:draft==1");
|
||||
@ -554,20 +572,17 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
||||
}
|
||||
|
||||
|
||||
BObjectList<TMailWindow::BitmapItem> TMailWindow::fBitmapCache;
|
||||
BLocker TMailWindow::fBitmapCacheLock;
|
||||
|
||||
BBitmap*
|
||||
TMailWindow::_RetrieveVectorIcon(int32 id)
|
||||
{
|
||||
// Lock access to the list
|
||||
BAutolock lock(fBitmapCacheLock);
|
||||
BAutolock lock(sBitmapCacheLock);
|
||||
if (!lock.IsLocked())
|
||||
return NULL;
|
||||
|
||||
// Check for the bitmap in the cache first
|
||||
BitmapItem* item;
|
||||
for (int32 i = 0; (item = fBitmapCache.ItemAt(i)) != NULL; i++) {
|
||||
for (int32 i = 0; (item = sBitmapCache.ItemAt(i)) != NULL; i++) {
|
||||
if (item->id == id)
|
||||
return item->bm;
|
||||
}
|
||||
@ -588,7 +603,7 @@ TMailWindow::_RetrieveVectorIcon(int32 id)
|
||||
item = (BitmapItem*)malloc(sizeof(BitmapItem));
|
||||
item->bm = bitmap;
|
||||
item->id = id;
|
||||
fBitmapCache.AddItem(item);
|
||||
sBitmapCache.AddItem(item);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
@ -599,7 +614,7 @@ TMailWindow::_RetrieveVectorIcon(int32 id)
|
||||
void
|
||||
TMailWindow::BuildToolBar()
|
||||
{
|
||||
fToolBar = new BToolBar(BRect(0, 0, 100, 50));
|
||||
fToolBar = new BToolBar();
|
||||
fToolBar->AddAction(M_NEW, this, _RetrieveVectorIcon(11), NULL,
|
||||
B_TRANSLATE("New"));
|
||||
fToolBar->AddSeparator();
|
||||
@ -1039,7 +1054,7 @@ TMailWindow::MessageReceived(BMessage *msg)
|
||||
fChanged = true;
|
||||
|
||||
// Update title bar if "subject" has changed
|
||||
if (!fIncoming && fieldMask & FIELD_SUBJECT) {
|
||||
if (!fIncoming && (fieldMask & FIELD_SUBJECT) != 0) {
|
||||
// If no subject, set to "Mail"
|
||||
if (!fHeaderView->fSubject->TextView()->TextLength())
|
||||
SetTitle(B_TRANSLATE_SYSTEM_NAME("Mail"));
|
||||
@ -1182,7 +1197,7 @@ TMailWindow::MessageReceived(BMessage *msg)
|
||||
case M_DELETE_PREV:
|
||||
case M_DELETE_NEXT:
|
||||
{
|
||||
if (msg->what == M_DELETE_NEXT && (modifiers() & B_SHIFT_KEY))
|
||||
if (msg->what == M_DELETE_NEXT && (modifiers() & B_SHIFT_KEY) != 0)
|
||||
msg->what = M_DELETE_PREV;
|
||||
|
||||
bool foundRef = false;
|
||||
@ -1272,10 +1287,8 @@ TMailWindow::MessageReceived(BMessage *msg)
|
||||
break;
|
||||
case M_CLOSE_CUSTOM:
|
||||
if (msg->HasString("status")) {
|
||||
const char *str;
|
||||
msg->FindString("status", (const char**) &str);
|
||||
BMessage message(B_CLOSE_REQUESTED);
|
||||
message.AddString("status", str);
|
||||
message.AddString("status", msg->GetString("status"));
|
||||
PostMessage(&message);
|
||||
} else {
|
||||
BRect r = Frame();
|
||||
@ -1331,7 +1344,7 @@ TMailWindow::MessageReceived(BMessage *msg)
|
||||
case M_SAVE:
|
||||
{
|
||||
const char* address;
|
||||
if (msg->FindString("address", (const char**)&address) != B_NO_ERROR)
|
||||
if (msg->FindString("address", (const char**)&address) != B_OK)
|
||||
break;
|
||||
|
||||
BVolumeRoster volumeRoster;
|
||||
@ -1822,61 +1835,57 @@ TMailWindow::Zoom(BPoint /*pos*/, float /*x*/, float /*y*/)
|
||||
{
|
||||
float height;
|
||||
float width;
|
||||
BScreen screen(this);
|
||||
BRect r;
|
||||
BRect s_frame = screen.Frame();
|
||||
|
||||
r = Frame();
|
||||
BRect rect = Frame();
|
||||
width = 80 * fApp->ContentFont().StringWidth("M")
|
||||
+ (r.Width() - fContentView->fTextView->Bounds().Width() + 6);
|
||||
if (width > (s_frame.Width() - 8))
|
||||
width = s_frame.Width() - 8;
|
||||
+ (rect.Width() - fContentView->fTextView->Bounds().Width() + 6);
|
||||
|
||||
BScreen screen(this);
|
||||
BRect screenFrame = screen.Frame();
|
||||
if (width > (screenFrame.Width() - 8))
|
||||
width = screenFrame.Width() - 8;
|
||||
|
||||
height = max_c(fContentView->fTextView->CountLines(), 20)
|
||||
* fContentView->fTextView->LineHeight(0)
|
||||
+ (r.Height() - fContentView->fTextView->Bounds().Height());
|
||||
if (height > (s_frame.Height() - 29))
|
||||
height = s_frame.Height() - 29;
|
||||
+ (rect.Height() - fContentView->fTextView->Bounds().Height());
|
||||
if (height > (screenFrame.Height() - 29))
|
||||
height = screenFrame.Height() - 29;
|
||||
|
||||
r.right = r.left + width;
|
||||
r.bottom = r.top + height;
|
||||
rect.right = rect.left + width;
|
||||
rect.bottom = rect.top + height;
|
||||
|
||||
if (abs((int)(Frame().Width() - r.Width())) < 5
|
||||
&& abs((int)(Frame().Height() - r.Height())) < 5) {
|
||||
r = fZoom;
|
||||
if (abs((int)(Frame().Width() - rect.Width())) < 5
|
||||
&& abs((int)(Frame().Height() - rect.Height())) < 5) {
|
||||
rect = fZoom;
|
||||
} else {
|
||||
fZoom = Frame();
|
||||
s_frame.InsetBy(6, 6);
|
||||
screenFrame.InsetBy(6, 6);
|
||||
|
||||
if (r.Width() > s_frame.Width())
|
||||
r.right = r.left + s_frame.Width();
|
||||
if (r.Height() > s_frame.Height())
|
||||
r.bottom = r.top + s_frame.Height();
|
||||
if (rect.Width() > screenFrame.Width())
|
||||
rect.right = rect.left + screenFrame.Width();
|
||||
if (rect.Height() > screenFrame.Height())
|
||||
rect.bottom = rect.top + screenFrame.Height();
|
||||
|
||||
if (r.right > s_frame.right)
|
||||
{
|
||||
r.left -= r.right - s_frame.right;
|
||||
r.right = s_frame.right;
|
||||
if (rect.right > screenFrame.right) {
|
||||
rect.left -= rect.right - screenFrame.right;
|
||||
rect.right = screenFrame.right;
|
||||
}
|
||||
if (r.bottom > s_frame.bottom)
|
||||
{
|
||||
r.top -= r.bottom - s_frame.bottom;
|
||||
r.bottom = s_frame.bottom;
|
||||
if (rect.bottom > screenFrame.bottom) {
|
||||
rect.top -= rect.bottom - screenFrame.bottom;
|
||||
rect.bottom = screenFrame.bottom;
|
||||
}
|
||||
if (r.left < s_frame.left)
|
||||
{
|
||||
r.right += s_frame.left - r.left;
|
||||
r.left = s_frame.left;
|
||||
if (rect.left < screenFrame.left) {
|
||||
rect.right += screenFrame.left - rect.left;
|
||||
rect.left = screenFrame.left;
|
||||
}
|
||||
if (r.top < s_frame.top)
|
||||
{
|
||||
r.bottom += s_frame.top - r.top;
|
||||
r.top = s_frame.top;
|
||||
if (rect.top < screenFrame.top) {
|
||||
rect.bottom += screenFrame.top - rect.top;
|
||||
rect.top = screenFrame.top;
|
||||
}
|
||||
}
|
||||
|
||||
ResizeTo(r.Width(), r.Height());
|
||||
MoveTo(r.LeftTop());
|
||||
ResizeTo(rect.Width(), rect.Height());
|
||||
MoveTo(rect.LeftTop());
|
||||
}
|
||||
|
||||
|
||||
@ -1939,19 +1948,6 @@ TMailWindow::Forward(entry_ref *ref, TMailWindow *window,
|
||||
}
|
||||
|
||||
|
||||
class HorizontalLine : public BView {
|
||||
public:
|
||||
HorizontalLine(BRect rect)
|
||||
:
|
||||
BView (rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW) {}
|
||||
|
||||
virtual void Draw(BRect rect)
|
||||
{
|
||||
FillRect(rect, B_SOLID_HIGH);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
TMailWindow::Print()
|
||||
{
|
||||
@ -1989,8 +1985,7 @@ TMailWindow::Print()
|
||||
|
||||
add_header_field(fSubject);
|
||||
add_header_field(fTo);
|
||||
if ((fHeaderView->fCc != NULL)
|
||||
&& (strcmp(fHeaderView->fCc->Text(),"") != 0))
|
||||
if (fHeaderView->fCc != NULL && fHeaderView->fCc->TextLength() != 0)
|
||||
add_header_field(fCc);
|
||||
|
||||
if (fHeaderView->fDate != NULL)
|
||||
@ -2025,21 +2020,18 @@ TMailWindow::Print()
|
||||
BPoint(0.0, curPageRect.bottom - ((curPage == 1)
|
||||
? header_height : 0)));
|
||||
|
||||
float curPageHeight = fContentView->fTextView->
|
||||
TextHeight(fromLine, lastLine) + ((curPage == 1)
|
||||
? header_height : 0);
|
||||
float curPageHeight = fContentView->fTextView->TextHeight(
|
||||
fromLine, lastLine) + (curPage == 1 ? header_height : 0);
|
||||
|
||||
if (curPageHeight > pageRect.Height()) {
|
||||
curPageHeight = fContentView->fTextView->TextHeight(
|
||||
fromLine, --lastLine) + ((curPage == 1)
|
||||
? header_height : 0);
|
||||
fromLine, --lastLine) + (curPage == 1 ? header_height : 0);
|
||||
}
|
||||
curPageRect.bottom = curPageRect.top + curPageHeight - 1.0;
|
||||
|
||||
if ((curPage >= print.FirstPage())
|
||||
&& (curPage <= print.LastPage())) {
|
||||
if (curPage >= print.FirstPage() && curPage <= print.LastPage()) {
|
||||
print.DrawView(fContentView->fTextView, curPageRect,
|
||||
BPoint(0.0, (curPage == 1) ? header_height : 0.0));
|
||||
BPoint(0.0, curPage == 1 ? header_height : 0.0));
|
||||
print.SpoolPage();
|
||||
}
|
||||
|
||||
@ -2529,7 +2521,8 @@ TMailWindow::Send(bool now)
|
||||
|
||||
if (result != B_NO_ERROR && result != B_MAIL_NO_DAEMON) {
|
||||
beep();
|
||||
BAlert* alert = new BAlert("", errorMessage.String(), B_TRANSLATE("OK"));
|
||||
BAlert* alert = new BAlert("", errorMessage.String(),
|
||||
B_TRANSLATE("OK"));
|
||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
alert->Go();
|
||||
}
|
||||
@ -2547,20 +2540,20 @@ TMailWindow::Send(bool now)
|
||||
status_t
|
||||
TMailWindow::SaveAsDraft()
|
||||
{
|
||||
status_t status;
|
||||
BPath draftPath;
|
||||
BDirectory dir;
|
||||
BFile draft;
|
||||
uint32 flags = 0;
|
||||
|
||||
if (fDraft) {
|
||||
if ((status = draft.SetTo(fRef,
|
||||
B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE)) != B_OK) {
|
||||
status_t status = draft.SetTo(fRef,
|
||||
B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
}
|
||||
} else {
|
||||
// Get the user home directory
|
||||
if ((status = find_directory(B_USER_DIRECTORY, &draftPath)) != B_OK)
|
||||
status_t status = find_directory(B_USER_DIRECTORY, &draftPath);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
// Append the relative path of the draft directory
|
||||
@ -2589,11 +2582,17 @@ TMailWindow::SaveAsDraft()
|
||||
|
||||
// convert /, \ and : to -
|
||||
for (char* bad = fileName; (bad = strchr(bad, '/')) != NULL;
|
||||
++bad) *bad = '-';
|
||||
++bad) {
|
||||
*bad = '-';
|
||||
}
|
||||
for (char* bad = fileName; (bad = strchr(bad, '\\')) != NULL;
|
||||
++bad) *bad = '-';
|
||||
++bad) {
|
||||
*bad = '-';
|
||||
}
|
||||
for (char* bad = fileName; (bad = strchr(bad, ':')) != NULL;
|
||||
++bad) *bad = '-';
|
||||
++bad) {
|
||||
*bad = '-';
|
||||
}
|
||||
|
||||
// Create the file; if the name exists, find a unique name
|
||||
flags = B_WRITE_ONLY | B_CREATE_FILE | B_FAIL_IF_EXISTS;
|
||||
@ -2627,9 +2626,7 @@ TMailWindow::SaveAsDraft()
|
||||
draft.Write(fContentView->fTextView->Text(),
|
||||
fContentView->fTextView->TextLength());
|
||||
|
||||
//
|
||||
// Add the header stuff as attributes
|
||||
//
|
||||
WriteAttrString(&draft, B_MAIL_ATTR_NAME, fHeaderView->fTo->Text());
|
||||
WriteAttrString(&draft, B_MAIL_ATTR_TO, fHeaderView->fTo->Text());
|
||||
WriteAttrString(&draft, B_MAIL_ATTR_SUBJECT, fHeaderView->fSubject->Text());
|
||||
@ -2655,11 +2652,10 @@ TMailWindow::SaveAsDraft()
|
||||
// Add Attachment paths in attribute
|
||||
if (fEnclosuresView != NULL) {
|
||||
TListItem* item;
|
||||
BPath path;
|
||||
BString pathStr;
|
||||
|
||||
for (int32 i = 0; (item = (TListItem *)
|
||||
fEnclosuresView->fList->ItemAt(i)) != NULL; i++) {
|
||||
for (int32 i = 0; (item = (TListItem*)fEnclosuresView->fList->ItemAt(i))
|
||||
!= NULL; i++) {
|
||||
if (i > 0)
|
||||
pathStr.Append(":");
|
||||
|
||||
@ -2667,6 +2663,7 @@ TMailWindow::SaveAsDraft()
|
||||
if (!entry.Exists())
|
||||
continue;
|
||||
|
||||
BPath path;
|
||||
entry.GetPath(&path);
|
||||
pathStr.Append(path.Path());
|
||||
}
|
||||
@ -2688,10 +2685,9 @@ TMailWindow::SaveAsDraft()
|
||||
|
||||
|
||||
status_t
|
||||
TMailWindow::TrainMessageAs(const char *CommandWord)
|
||||
TMailWindow::TrainMessageAs(const char* commandWord)
|
||||
{
|
||||
status_t errorCode = -1;
|
||||
char errorString[1500];
|
||||
BEntry fileEntry;
|
||||
BPath filePath;
|
||||
BMessage replyMessage;
|
||||
@ -2700,7 +2696,7 @@ TMailWindow::TrainMessageAs(const char *CommandWord)
|
||||
|
||||
if (fRef == NULL)
|
||||
goto ErrorExit; // Need to have a real file and name.
|
||||
errorCode = fileEntry.SetTo(fRef, true /* traverse */);
|
||||
errorCode = fileEntry.SetTo(fRef, true);
|
||||
if (errorCode != B_OK)
|
||||
goto ErrorExit;
|
||||
errorCode = fileEntry.GetPath(&filePath);
|
||||
@ -2717,15 +2713,17 @@ TMailWindow::TrainMessageAs(const char *CommandWord)
|
||||
if (errorCode != B_OK) {
|
||||
BPath path;
|
||||
entry_ref ref;
|
||||
directory_which places[]
|
||||
= {B_SYSTEM_NONPACKAGED_BIN_DIRECTORY, B_SYSTEM_BIN_DIRECTORY};
|
||||
directory_which places[] = {B_SYSTEM_NONPACKAGED_BIN_DIRECTORY,
|
||||
B_SYSTEM_BIN_DIRECTORY};
|
||||
for (int32 i = 0; i < 2; i++) {
|
||||
find_directory(places[i],&path);
|
||||
path.Append("spamdbm");
|
||||
if (!BEntry(path.Path()).Exists())
|
||||
continue;
|
||||
get_ref_for_path(path.Path(),&ref);
|
||||
if ((errorCode = be_roster->Launch (&ref)) == B_OK)
|
||||
|
||||
errorCode = be_roster->Launch(&ref);
|
||||
if (errorCode == B_OK)
|
||||
break;
|
||||
}
|
||||
if (errorCode != B_OK)
|
||||
@ -2751,9 +2749,9 @@ TMailWindow::TrainMessageAs(const char *CommandWord)
|
||||
|
||||
scriptingMessage.MakeEmpty();
|
||||
scriptingMessage.what = B_SET_PROPERTY;
|
||||
scriptingMessage.AddSpecifier(CommandWord);
|
||||
scriptingMessage.AddSpecifier(commandWord);
|
||||
errorCode = scriptingMessage.AddData("data", B_STRING_TYPE,
|
||||
filePath.Path(), strlen(filePath.Path()) + 1, false /* fixed size */);
|
||||
filePath.Path(), strlen(filePath.Path()) + 1, false);
|
||||
if (errorCode != B_OK)
|
||||
goto ErrorExit;
|
||||
replyMessage.MakeEmpty();
|
||||
@ -2770,9 +2768,10 @@ TMailWindow::TrainMessageAs(const char *CommandWord)
|
||||
|
||||
ErrorExit:
|
||||
beep();
|
||||
sprintf(errorString, "Unable to train the message file \"%s\" as %s. "
|
||||
"Possibly useful error code: %s (%" B_PRId32 ").",
|
||||
filePath.Path(), CommandWord, strerror(errorCode), errorCode);
|
||||
char errorString[1500];
|
||||
snprintf(errorString, sizeof(errorString), "Unable to train the message "
|
||||
"file \"%s\" as %s. Possibly useful error code: %s (%" B_PRId32 ").",
|
||||
filePath.Path(), commandWord, strerror(errorCode), errorCode);
|
||||
BAlert* alert = new BAlert("", errorString, B_TRANSLATE("OK"));
|
||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
alert->Go();
|
||||
@ -2784,9 +2783,7 @@ ErrorExit:
|
||||
void
|
||||
TMailWindow::SetTitleForMessage()
|
||||
{
|
||||
//
|
||||
// Figure out the title of this message and set the title bar
|
||||
//
|
||||
BString title = B_TRANSLATE_SYSTEM_NAME("Mail");
|
||||
|
||||
if (fIncoming) {
|
||||
@ -2804,14 +2801,14 @@ TMailWindow::SetTitleForMessage()
|
||||
char numberString[30];
|
||||
BString oldTitle(title);
|
||||
float spamRatio;
|
||||
if (node.InitCheck() != B_OK || node.ReadAttrString
|
||||
("MAIL:classification", &classification) != B_OK)
|
||||
if (node.InitCheck() != B_OK || node.ReadAttrString(
|
||||
"MAIL:classification", &classification) != B_OK)
|
||||
classification = "Unrated";
|
||||
if (classification != "Spam" && classification != "Genuine") {
|
||||
// Uncertain, Unrated and other unknown classes, show the ratio.
|
||||
if (node.InitCheck() == B_OK && sizeof (spamRatio) ==
|
||||
node.ReadAttr("MAIL:ratio_spam", B_FLOAT_TYPE, 0,
|
||||
&spamRatio, sizeof (spamRatio))) {
|
||||
if (node.InitCheck() == B_OK && node.ReadAttr("MAIL:ratio_spam",
|
||||
B_FLOAT_TYPE, 0, &spamRatio, sizeof(spamRatio))
|
||||
== sizeof(spamRatio)) {
|
||||
sprintf(numberString, "%.4f", spamRatio);
|
||||
classification << " " << numberString;
|
||||
}
|
||||
@ -2824,20 +2821,17 @@ TMailWindow::SetTitleForMessage()
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Open *another* message in the existing mail window. Some code here is
|
||||
// duplicated from various constructors.
|
||||
// The duplicated code should be in a private initializer method -- axeld.
|
||||
//
|
||||
|
||||
/*! Open *another* message in the existing mail window. Some code here is
|
||||
duplicated from various constructors.
|
||||
TODO: The duplicated code should be moved to a private initializer method
|
||||
*/
|
||||
status_t
|
||||
TMailWindow::OpenMessage(const entry_ref* ref, uint32 characterSetForDecoding)
|
||||
{
|
||||
if (ref == NULL)
|
||||
return B_ERROR;
|
||||
//
|
||||
|
||||
// Set some references to the email file
|
||||
//
|
||||
delete fRef;
|
||||
fRef = new entry_ref(*ref);
|
||||
|
||||
@ -2908,7 +2902,7 @@ TMailWindow::OpenMessage(const entry_ref *ref, uint32 characterSetForDecoding)
|
||||
entry_ref enc_ref;
|
||||
|
||||
char* s = strtok((char*)string.String(), ":");
|
||||
while (s) {
|
||||
while (s != NULL) {
|
||||
BEntry entry(s, true);
|
||||
if (entry.Exists()) {
|
||||
entry.GetRef(&enc_ref);
|
||||
@ -2942,9 +2936,7 @@ TMailWindow::OpenMessage(const entry_ref *ref, uint32 characterSetForDecoding)
|
||||
SetTitleForMessage();
|
||||
|
||||
if (fIncoming) {
|
||||
//
|
||||
// Put the addresses in the 'Save Address' Menu
|
||||
//
|
||||
BMenuItem* item;
|
||||
while ((item = fSaveAddrMenu->RemoveItem((int32)0)) != NULL)
|
||||
delete item;
|
||||
@ -2984,9 +2976,7 @@ TMailWindow::OpenMessage(const entry_ref *ref, uint32 characterSetForDecoding)
|
||||
free(address);
|
||||
}
|
||||
|
||||
//
|
||||
// Clear out existing contents of text view.
|
||||
//
|
||||
fContentView->fTextView->SetText("", (int32)0);
|
||||
|
||||
fContentView->fTextView->LoadMessage(fMail, false, NULL);
|
||||
@ -3010,39 +3000,6 @@ TMailWindow::FrontmostWindow()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// Copied from src/kits/tracker/FindPanel.cpp.
|
||||
uint32
|
||||
TMailWindow::InitialMode(const BNode *node)
|
||||
{
|
||||
if (!node || node->InitCheck() != B_OK)
|
||||
return kByNameItem;
|
||||
|
||||
uint32 result;
|
||||
if (node->ReadAttr(kAttrQueryInitialMode, B_INT32_TYPE, 0,
|
||||
(int32 *)&result, sizeof(int32)) <= 0)
|
||||
return kByNameItem;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Copied from src/kits/tracker/FindPanel.cpp.
|
||||
int32
|
||||
TMailWindow::InitialAttrCount(const BNode *node)
|
||||
{
|
||||
if (!node || node->InitCheck() != B_OK)
|
||||
return 1;
|
||||
|
||||
int32 result;
|
||||
if (node->ReadAttr(kAttrQueryInitialNumAttrs, B_INT32_TYPE, 0,
|
||||
&result, sizeof(int32)) <= 0)
|
||||
return 1;
|
||||
|
||||
return result;
|
||||
}*/
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
@ -65,6 +65,7 @@ class BMenuBar;
|
||||
class BMenuItem;
|
||||
class Words;
|
||||
|
||||
|
||||
class TMailWindow : public BWindow {
|
||||
public:
|
||||
TMailWindow(BRect frame, const char* title,
|
||||
@ -94,7 +95,7 @@ class TMailWindow : public BWindow {
|
||||
void PrintSetup();
|
||||
void Reply(entry_ref*, TMailWindow*, uint32);
|
||||
void CopyMessage(entry_ref* ref, TMailWindow* src);
|
||||
status_t Send(bool);
|
||||
status_t Send(bool now);
|
||||
status_t SaveAsDraft();
|
||||
status_t OpenMessage(const entry_ref* ref,
|
||||
uint32 characterSetForDecoding
|
||||
@ -134,6 +135,9 @@ class TMailWindow : public BWindow {
|
||||
|
||||
void _SetDownloading(bool downloading);
|
||||
|
||||
static BBitmap* _RetrieveVectorIcon(int32 id);
|
||||
|
||||
private:
|
||||
TMailApp* fApp;
|
||||
|
||||
BEmailMessage* fMail;
|
||||
@ -166,13 +170,12 @@ class TMailWindow : public BWindow {
|
||||
BMenu* fQueryMenu;
|
||||
BMenu* fLeaveStatusMenu;
|
||||
|
||||
static BBitmap* _RetrieveVectorIcon(int32 id);
|
||||
struct BitmapItem {
|
||||
BBitmap* bm;
|
||||
int32 id;
|
||||
};
|
||||
static BObjectList<BitmapItem> fBitmapCache;
|
||||
static BLocker fBitmapCacheLock;
|
||||
static BObjectList<BitmapItem> sBitmapCache;
|
||||
static BLocker sBitmapCacheLock;
|
||||
|
||||
BToolBar* fToolBar;
|
||||
|
||||
@ -213,5 +216,5 @@ class TMailWindow : public BWindow {
|
||||
bool fDownloading;
|
||||
};
|
||||
|
||||
#endif // _MAIL_WINDOW_H
|
||||
|
||||
#endif // _MAIL_WINDOW_H
|
||||
|
Loading…
Reference in New Issue
Block a user