[haiku-commits] BRANCH axeld-github.imap - src/kits/mail headers/os/mail src/preferences/mail

  • From: axeld-github.imap <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 27 Nov 2012 00:30:44 +0100 (CET)

added 7 changesets to branch 'refs/remotes/axeld-github/imap'
old head: eb7b20781e01ef96b33b6ce5a6f25d17a010f8d9
new head: 9e8514a6f537992fb67f61dc7578e77a146ae1af
overview: https://github.com/axeld/haiku/compare/eb7b207...9e8514a

----------------------------------------------------------------------------

7d75f5e: Minor coding style fix.

6fd50f9: Major coding style cleanup.

3ceef2e: The E-mail window's frame is no longer stored.
  
  * This is part of a clean up of BMailSettings; storing the window
    position might be implemented again later -- it just doesn't
    belong there.
  * Changed the logic when the daemon is set to auto start. It's now
    always started if at least a single account exists.

3bbdfc6: Cleaned up BMailSettings.
  
  * Removed superfluous and outdated settings.
  * The setters now return an error code since they actually can fail.

3fd14fa: Align all protocol config view labels to the right.

aacdcfa: Improved label of the button to configure the IMAP folders.

9e8514a: The protocol config view now adds some glue at the bottom.
  
  * This makes all boxes fill the complete height of the window.
  * The SMTP add-on did that itself which makes no sense.

                                   [ Axel DÃrfler <axeld@xxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

11 files changed, 380 insertions(+), 514 deletions(-)
headers/os/mail/MailMessage.h                    | 215 +++++----
headers/os/mail/MailSettings.h                   |  29 +-
.../inbound_protocols/imap/ConfigView.cpp        |   2 +-
.../outbound_protocols/smtp/ConfigView.cpp       |   3 -
src/apps/people/AttributeTextControl.cpp         |   7 +-
src/kits/mail/MailMessage.cpp                    | 446 +++++++++----------
src/kits/mail/MailSettings.cpp                   | 145 +-----
src/kits/mail/ProtocolConfigView.cpp             |   4 +
src/preferences/mail/ConfigViews.cpp             |   3 +-
src/preferences/mail/ConfigWindow.cpp            |  35 +-
src/servers/mail/MailDaemonApplication.cpp       |   5 +-

############################################################################

Commit:      7d75f5eb96a6e516233d58379d416312d2155770
Author:      Axel DÃrfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Mon Nov 26 21:36:34 2012 UTC

Minor coding style fix.

----------------------------------------------------------------------------

diff --git a/src/apps/people/AttributeTextControl.cpp 
b/src/apps/people/AttributeTextControl.cpp
index ff1694c..e3197f6 100644
--- a/src/apps/people/AttributeTextControl.cpp
+++ b/src/apps/people/AttributeTextControl.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2011, Haiku, Inc. All rights reserved.
+ * Copyright 2005-2012, Haiku, Inc. All rights reserved.
  * Distributed under the terms of the MIT license.
  *
  * Authors:
@@ -24,15 +24,16 @@
 
 
 AttributeTextControl::AttributeTextControl(const char* label,
-               const char* attribute)
+       const char* attribute)
        :
        BTextControl(NULL, "", NULL),
        fAttribute(attribute),
        fOriginalValue()
 {
-       if (label != NULL && label[0] != 0)
+       if (label != NULL && label[0] != 0) {
                SetLabel(BString(B_TRANSLATE("%attribute_label:"))
                        .ReplaceFirst("%attribute_label", label));
+       }
        SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
 }
 

############################################################################

Commit:      6fd50f9386f9d3f7fc6a548d96c07d7544217534
Author:      Axel DÃrfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Mon Nov 26 23:05:52 2012 UTC

Major coding style cleanup.

----------------------------------------------------------------------------

diff --git a/headers/os/mail/MailMessage.h b/headers/os/mail/MailMessage.h
index dcca852..0c87e8b 100644
--- a/headers/os/mail/MailMessage.h
+++ b/headers/os/mail/MailMessage.h
@@ -1,20 +1,27 @@
-#ifndef ZOIDBERG_MAIL_MESSAGE_H
-#define ZOIDBERG_MAIL_MESSAGE_H
-/* Message - the main general purpose mail message class
-**
-** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
-*/
+/*
+ * Copyright 2007-2012, Haiku Inc. All Rights Reserved.
+ * Copyright 2001, Dr. Zoidberg Enterprises. All rights reserved.
+ *
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _MAIL_MESSAGE_H_
+#define _MAIL_MESSAGE_H_
+
+
+//! The main general purpose mail message class
 
 
 #include <MailContainer.h>
 
 
-// add our additional attributes 
+// add our additional attributes
 #define B_MAIL_ATTR_ACCOUNT "MAIL:account"
 #define B_MAIL_ATTR_THREAD "MAIL:thread"
 
 
 class BDirectory;
+class BEntry;
+
 
 enum mail_reply_to_mode {
        B_MAIL_REPLY_TO = 0,
@@ -22,91 +29,115 @@ enum mail_reply_to_mode {
        B_MAIL_REPLY_TO_SENDER
 };
 
+
 class BEmailMessage : public BMailContainer {
-       public:
-               BEmailMessage(BPositionIO *mail_file = NULL, bool own = false, 
uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
-               BEmailMessage(const entry_ref *ref,
-                       uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
-               virtual ~BEmailMessage();
-
-               status_t InitCheck() const;
-               BPositionIO *Data() const { return fData; }
-                       // is only set if the message owns the data
-
-               BEmailMessage *ReplyMessage(mail_reply_to_mode replyTo, bool 
accountFromMail, const char *quote_style = "> ");
-               BEmailMessage *ForwardMessage(bool accountFromMail, bool 
includeAttachments = false);
-                       // These return messages with the body quoted and
-                       // ready to send via the appropriate channel. 
ReplyMessage()
-                       // addresses the message appropriately, but 
ForwardMessage()
-                       // leaves it unaddressed.
-
-               const char *To();
-               const char *From();
-               const char *ReplyTo();
-               const char *CC();
-               const char *Subject();
-               const char *Date();
-               int Priority();
-
-               void SetSubject(const char *to, uint32 charset = 
B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
-               void SetReplyTo(const char *to, uint32 charset = 
B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
-               void SetFrom(const char *to, uint32 charset = 
B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
-               void SetTo(const char *to, uint32 charset = 
B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
-               void SetCC(const char *to, uint32 charset = 
B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
-               void SetBCC(const char *to);
-               void SetPriority(int to);
-
-               status_t GetName(char *name,int32 maxLength) const;
-               status_t GetName(BString *name) const;
-
-               void SendViaAccountFrom(BEmailMessage *message);
-               void SendViaAccount(const char *account_name);
-               void SendViaAccount(int32 account);
-               int32 Account() const;
-               status_t GetAccountName(BString& accountName) const;
-
-               virtual status_t AddComponent(BMailComponent *component);
-               virtual status_t RemoveComponent(BMailComponent *component);
-               virtual status_t RemoveComponent(int32 index);
-
-               virtual BMailComponent *GetComponent(int32 index, bool 
parse_now = false);
-               virtual int32 CountComponents() const;
-
-               void Attach(entry_ref *ref, bool include_attributes = true);
-               bool IsComponentAttachment(int32 index);
-
-               void SetBodyTextTo(const char *text);
-               const char *BodyText();
-
-               status_t SetBody(BTextMailComponent *body);
-               BTextMailComponent *Body();
-
-               virtual status_t SetToRFC822(BPositionIO *data, size_t length, 
bool parse_now = false);
-               virtual status_t RenderToRFC822(BPositionIO *render_to);
-
-               status_t RenderTo(BDirectory *dir, BEntry *message = NULL);
-                       //---message will be set to the message file if not 
equal to NULL
-
-               status_t Send(bool send_now);
-
-       private:
-               BTextMailComponent *RetrieveTextBody(BMailComponent *);
-
-               virtual void _ReservedMessage1();
-               virtual void _ReservedMessage2();
-               virtual void _ReservedMessage3();
-
-               BPositionIO *fData;
-
-               status_t _status;
-               int32 _account_id;
-               char *_bcc;
-
-               int32 _num_components;
-               BMailComponent *_body;
-               BTextMailComponent *_text_body;
-
-               uint32 _reserved[5];
+public:
+                                                               
BEmailMessage(BPositionIO* stream = NULL,
+                                                                       bool 
ownStream = false,
+                                                                       uint32 
defaultCharSet
+                                                                               
= B_MAIL_NULL_CONVERSION);
+                                                               
BEmailMessage(const entry_ref* ref,
+                                                                       uint32 
defaultCharSet
+                                                                               
= B_MAIL_NULL_CONVERSION);
+       virtual                                         ~BEmailMessage();
+
+                       status_t                        InitCheck() const;
+                       BPositionIO*            Data() const { return fData; }
+                               // is only set if the message owns the data
+
+                       BEmailMessage*          ReplyMessage(mail_reply_to_mode 
replyTo,
+                                                                       bool 
accountFromMail,
+                                                                       const 
char* quoteStyle = "> ");
+                       BEmailMessage*          ForwardMessage(bool 
accountFromMail,
+                                                                       bool 
includeAttachments = false);
+                               // These return messages with the body quoted 
and
+                               // ready to send via the appropriate channel. 
ReplyMessage()
+                               // addresses the message appropriately, but 
ForwardMessage()
+                               // leaves it unaddressed.
+
+                       const char*                     To();
+                       const char*                     From();
+                       const char*                     ReplyTo();
+                       const char*                     CC();
+                       const char*                     Subject();
+                       const char*                     Date();
+                       int                                     Priority();
+
+                       void                            SetSubject(const char* 
to,
+                                                                       uint32 
charset = B_MAIL_NULL_CONVERSION,
+                                                                       
mail_encoding encoding = null_encoding);
+                       void                            SetReplyTo(const char* 
to,
+                                                                       uint32 
charset = B_MAIL_NULL_CONVERSION,
+                                                                       
mail_encoding encoding = null_encoding);
+                       void                            SetFrom(const char* to,
+                                                                       uint32 
charset = B_MAIL_NULL_CONVERSION,
+                                                                       
mail_encoding encoding = null_encoding);
+                       void                            SetTo(const char* to,
+                                                                       uint32 
charset = B_MAIL_NULL_CONVERSION,
+                                                                       
mail_encoding encoding = null_encoding);
+                       void                            SetCC(const char* to,
+                                                                       uint32 
charset = B_MAIL_NULL_CONVERSION,
+                                                                       
mail_encoding encoding = null_encoding);
+                       void                            SetBCC(const char* to);
+                       void                            SetPriority(int to);
+
+                       status_t                        GetName(char* name, 
int32 maxLength) const;
+                       status_t                        GetName(BString* name) 
const;
+
+                       void                            
SendViaAccountFrom(BEmailMessage* message);
+                       void                            SendViaAccount(const 
char* accountName);
+                       void                            SendViaAccount(int32 
account);
+                       int32                           Account() const;
+                       status_t                        GetAccountName(BString& 
accountName) const;
+
+       virtual status_t                        AddComponent(BMailComponent 
*component);
+       virtual status_t                        RemoveComponent(BMailComponent 
*component);
+       virtual status_t                        RemoveComponent(int32 index);
+
+       virtual BMailComponent*         GetComponent(int32 index,
+                                                                       bool 
parseNow = false);
+       virtual int32                           CountComponents() const;
+
+                       void                            Attach(entry_ref* ref,
+                                                                       bool 
includeAttributes = true);
+                       bool                            
IsComponentAttachment(int32 index);
+
+                       void                            SetBodyTextTo(const 
char* text);
+                       const char*                     BodyText();
+
+                       status_t                        
SetBody(BTextMailComponent* body);
+                       BTextMailComponent*     Body();
+
+       virtual status_t                        SetToRFC822(BPositionIO* data, 
size_t length,
+                                                                       bool 
parseNow = false);
+       virtual status_t                        RenderToRFC822(BPositionIO* 
renderTo);
+
+                       status_t                        RenderTo(BDirectory* 
dir,
+                                                                       BEntry* 
message = NULL);
+                               // Message will be set to the message file if 
not equal to NULL
+
+                       status_t                        Send(bool sendNow);
+
+private:
+                       BTextMailComponent*     
_RetrieveTextBody(BMailComponent* component);
+
+       virtual void                            _ReservedMessage1();
+       virtual void                            _ReservedMessage2();
+       virtual void                            _ReservedMessage3();
+
+private:
+                       BPositionIO*            fData;
+
+                       status_t                        fStatus;
+                       int32                           fAccountID;
+                       char*                           fBCC;
+
+                       int32                           fComponentCount;
+                       BMailComponent*         fBody;
+                       BTextMailComponent*     fTextBody;
+
+                       uint32                          _reserved[5];
 };
 
-#endif /* ZOIDBERG_MAIL_MESSAGE_H */
+
+#endif // _MAIL_MESSAGE_H_
diff --git a/src/kits/mail/MailMessage.cpp b/src/kits/mail/MailMessage.cpp
index 73916f1..b7345e2 100644
--- a/src/kits/mail/MailMessage.cpp
+++ b/src/kits/mail/MailMessage.cpp
@@ -9,33 +9,37 @@
 //! The main general purpose mail message class
 
 
-#include <List.h>
-#include <String.h>
-#include <Directory.h>
-#include <File.h>
-#include <E-mail.h>
-#include <Entry.h>
-#include <FindDirectory.h>
-#include <netdb.h>
-#include <NodeInfo.h>
-#include <Messenger.h>
-#include <Path.h>
+#include <MailMessage.h>
 
-#include <string.h>
+#include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/utsname.h>
-#include <ctype.h>
+
 #include <parsedate.h>
 
-#include <MailMessage.h>
+#include <Directory.h>
+#include <E-mail.h>
+#include <Entry.h>
+#include <File.h>
+#include <FindDirectory.h>
+#include <List.h>
 #include <MailAttachment.h>
-#include <MailSettings.h>
 #include <MailDaemon.h>
-#include <mail_util.h>
+#include <MailSettings.h>
+#include <Messenger.h>
+#include <netdb.h>
+#include <NodeInfo.h>
+#include <Path.h>
+#include <String.h>
 #include <StringList.h>
 
 #include <MailPrivate.h>
+#include <mail_util.h>
+
+
+using namespace BPrivate;
 
 
 //-------Change the following!----------------------
@@ -43,51 +47,51 @@
 #define mime_warning "This is a multipart message in MIME format."
 
 
-BEmailMessage::BEmailMessage(BPositionIO *file, bool own, uint32 
defaultCharSet)
+BEmailMessage::BEmailMessage(BPositionIO* file, bool own, uint32 
defaultCharSet)
        :
-       BMailContainer (defaultCharSet),
+       BMailContainer(defaultCharSet),
        fData(NULL),
-       _status(B_NO_ERROR),
-       _bcc(NULL),
-       _num_components(0),
-       _body(NULL),
-       _text_body(NULL)
+       fStatus(B_NO_ERROR),
+       fBCC(NULL),
+       fComponentCount(0),
+       fBody(NULL),
+       fTextBody(NULL)
 {
        BMailSettings settings;
-       _account_id = settings.DefaultOutboundAccount();
+       fAccountID = settings.DefaultOutboundAccount();
 
        if (own)
                fData = file;
 
        if (file != NULL)
-               SetToRFC822(file,-1);
+               SetToRFC822(file, ~0L);
 }
 
 
-BEmailMessage::BEmailMessage(const entry_ref *ref, uint32 defaultCharSet)
+BEmailMessage::BEmailMessage(const entry_ref* ref, uint32 defaultCharSet)
        :
        BMailContainer(defaultCharSet),
-       _bcc(NULL),
-       _num_components(0),
-       _body(NULL),
-       _text_body(NULL)
+       fBCC(NULL),
+       fComponentCount(0),
+       fBody(NULL),
+       fTextBody(NULL)
 {
        BMailSettings settings;
-       _account_id = settings.DefaultOutboundAccount();
+       fAccountID = settings.DefaultOutboundAccount();
 
        fData = new BFile();
-       _status = static_cast<BFile *>(fData)->SetTo(ref,B_READ_ONLY);
+       fStatus = static_cast<BFile*>(fData)->SetTo(ref, B_READ_ONLY);
 
-       if (_status == B_OK)
-               SetToRFC822(fData,-1);
+       if (fStatus == B_OK)
+               SetToRFC822(fData, ~0L);
 }
 
 
 BEmailMessage::~BEmailMessage()
 {
-       free(_bcc);
+       free(fBCC);
 
-       delete _body;
+       delete fBody;
        delete fData;
 }
 
@@ -95,15 +99,15 @@ BEmailMessage::~BEmailMessage()
 status_t
 BEmailMessage::InitCheck() const
 {
-       return _status;
+       return fStatus;
 }
 
 
-BEmailMessage *
+BEmailMessage*
 BEmailMessage::ReplyMessage(mail_reply_to_mode replyTo, bool accountFromMail,
-       const char *quoteStyle)
+       const char* quoteStyle)
 {
-       BEmailMessage *reply = new BEmailMessage;
+       BEmailMessage* reply = new BEmailMessage;
 
        // Set ReplyTo:
 
@@ -118,16 +122,17 @@ BEmailMessage::ReplyMessage(mail_reply_to_mode replyTo, 
bool accountFromMail,
                BMailAccounts accounts;
                BMailAccountSettings* account = accounts.AccountByID(Account());
                BString sender;
-               if (account)
+               if (account != NULL)
                        sender = account->ReturnAddress();
                extract_address(sender);
 
                BString cc;
 
                for (int32 i = list.CountItems(); i-- > 0;) {
-                       char *address = (char *)list.RemoveItem(0L);
+                       char* address = (char*)list.RemoveItem(0L);
 
-                       // add everything which is not the sender and not 
already in the list
+                       // Add everything which is not the sender and not 
already in the
+                       // list
                        if (sender.ICompare(address) && cc.FindFirst(address) < 
0) {
                                if (cc.Length() > 0)
                                        cc << ", ";
@@ -146,7 +151,7 @@ BEmailMessage::ReplyMessage(mail_reply_to_mode replyTo, 
bool accountFromMail,
                reply->SetTo(ReplyTo());
 
        // Set special "In-Reply-To:" header (used for threading)
-       const char *messageID = _body ? _body->HeaderField("Message-Id") : NULL;
+       const char* messageID = fBody ? fBody->HeaderField("Message-Id") : NULL;
        if (messageID != NULL)
                reply->SetHeaderField("In-Reply-To", messageID);
 
@@ -169,7 +174,7 @@ BEmailMessage::ReplyMessage(mail_reply_to_mode replyTo, 
bool accountFromMail,
 }
 
 
-BEmailMessage *
+BEmailMessage*
 BEmailMessage::ForwardMessage(bool accountFromMail, bool includeAttachments)
 {
        BString header = "------ Forwarded Message: ------\n";
@@ -181,8 +186,8 @@ BEmailMessage::ForwardMessage(bool accountFromMail, bool 
includeAttachments)
        }
        header << "Subject: " << Subject() << '\n';
        header << "Date: " << Date() << "\n\n";
-       if (_text_body != NULL)
-               header << _text_body->Text() << '\n';
+       if (fTextBody != NULL)
+               header << fTextBody->Text() << '\n';
        BEmailMessage *message = new BEmailMessage();
        message->SetBodyTextTo(header.String());
 
@@ -196,8 +201,8 @@ BEmailMessage::ForwardMessage(bool accountFromMail, bool 
includeAttachments)
 
        if (includeAttachments) {
                for (int32 i = 0; i < CountComponents(); i++) {
-                       BMailComponent *cmpt = GetComponent(i);
-                       if (cmpt == _text_body || cmpt == NULL)
+                       BMailComponent* component = GetComponent(i);
+                       if (component == fTextBody || component == NULL)
                                continue;
 
                        //---I am ashamed to have the written the code between 
here and the next comment
@@ -206,8 +211,8 @@ BEmailMessage::ForwardMessage(bool accountFromMail, bool 
includeAttachments)
                        // or something like that
 
                        BMallocIO io;
-                       cmpt->RenderToRFC822(&io);
-                       BMailComponent *clone = cmpt->WhatIsThis();
+                       component->RenderToRFC822(&io);
+                       BMailComponent* clone = component->WhatIsThis();
                        io.Seek(0, SEEK_SET);
                        clone->SetToRFC822(&io, io.BufferLength(), true);
                        message->AddComponent(clone);
@@ -220,28 +225,28 @@ BEmailMessage::ForwardMessage(bool accountFromMail, bool 
includeAttachments)
 }
 
 
-const char *
+const char*
 BEmailMessage::To()
 {
        return HeaderField("To");
 }
 
 
-const char *
+const char*
 BEmailMessage::From()
 {
        return HeaderField("From");
 }
 
 
-const char *
+const char*
 BEmailMessage::ReplyTo()
 {
        return HeaderField("Reply-To");
 }
 
 
-const char *
+const char*
 BEmailMessage::CC()
 {
        return HeaderField("Cc");
@@ -249,14 +254,14 @@ BEmailMessage::CC()
 }
 
 
-const char *
+const char*
 BEmailMessage::Subject()
 {
        return HeaderField("Subject");
 }
 
 
-const char *
+const char*
 BEmailMessage::Date()
 {
        return HeaderField("Date");
@@ -267,7 +272,7 @@ int
 BEmailMessage::Priority()
 {
        int priorityNumber;
-       const char *priorityString;
+       const char* priorityString;
 
        /* The usual values are a number from 1 to 5, or one of three words:
        X-Priority: 1 and/or X-MSMail-Priority: High
@@ -301,7 +306,7 @@ BEmailMessage::Priority()
 
 
 void
-BEmailMessage::SetSubject(const char *subject, uint32 charset,
+BEmailMessage::SetSubject(const char* subject, uint32 charset,
        mail_encoding encoding)
 {
        SetHeaderField("Subject", subject, charset, encoding);
@@ -309,29 +314,29 @@ BEmailMessage::SetSubject(const char *subject, uint32 
charset,
 
 
 void
-BEmailMessage::SetReplyTo(const char *reply_to, uint32 charset,
+BEmailMessage::SetReplyTo(const char* replyTo, uint32 charset,
        mail_encoding encoding)
 {
-       SetHeaderField("Reply-To", reply_to, charset, encoding);
+       SetHeaderField("Reply-To", replyTo, charset, encoding);
 }
 
 
 void
-BEmailMessage::SetFrom(const char *from, uint32 charset, mail_encoding 
encoding)
+BEmailMessage::SetFrom(const char* from, uint32 charset, mail_encoding 
encoding)
 {
        SetHeaderField("From", from, charset, encoding);
 }
 
 
 void
-BEmailMessage::SetTo(const char *to, uint32 charset, mail_encoding encoding)
+BEmailMessage::SetTo(const char* to, uint32 charset, mail_encoding encoding)
 {
        SetHeaderField("To", to, charset, encoding);
 }
 
 
 void
-BEmailMessage::SetCC(const char *cc, uint32 charset, mail_encoding encoding)
+BEmailMessage::SetCC(const char* cc, uint32 charset, mail_encoding encoding)
 {
        // For consistency with our header names, use Cc as the name.
        SetHeaderField("Cc", cc, charset, encoding);
@@ -339,17 +344,17 @@ BEmailMessage::SetCC(const char *cc, uint32 charset, 
mail_encoding encoding)
 
 
 void
-BEmailMessage::SetBCC(const char *bcc)
+BEmailMessage::SetBCC(const char* bcc)
 {
-       free(_bcc);
-       _bcc = strdup(bcc);
+       free(fBCC);
+       fBCC = strdup(bcc);
 }
 
 
 void
 BEmailMessage::SetPriority(int to)
 {
-       char tempString [20];
+       char tempString[20];
 
        if (to < 1)
                to = 1;
@@ -371,12 +376,12 @@ BEmailMessage::SetPriority(int to)
 
 
 status_t
-BEmailMessage::GetName(char *name, int32 maxLength) const
+BEmailMessage::GetName(char* name, int32 maxLength) const
 {
        if (name == NULL || maxLength <= 0)
                return B_BAD_VALUE;
 
-       if (BFile *file = dynamic_cast<BFile *>(fData)) {
+       if (BFile* file = dynamic_cast<BFile*>(fData)) {
                status_t status = file->ReadAttr(B_MAIL_ATTR_NAME, 
B_STRING_TYPE, 0,
                        name, maxLength);
                name[maxLength - 1] = '\0';
@@ -390,10 +395,10 @@ BEmailMessage::GetName(char *name, int32 maxLength) const
 
 
 status_t
-BEmailMessage::GetName(BString *name) const
+BEmailMessage::GetName(BString* name) const
 {
-       char *buffer = name->LockBuffer(B_FILE_NAME_LENGTH);
-       status_t status = GetName(buffer,B_FILE_NAME_LENGTH);
+       char* buffer = name->LockBuffer(B_FILE_NAME_LENGTH);
+       status_t status = GetName(buffer, B_FILE_NAME_LENGTH);
        name->UnlockBuffer();
 
        return status;
@@ -401,7 +406,7 @@ BEmailMessage::GetName(BString *name) const
 
 
 void
-BEmailMessage::SendViaAccountFrom(BEmailMessage *message)
+BEmailMessage::SendViaAccountFrom(BEmailMessage* message)
 {
        BString name;
        if (message->GetAccountName(name) < B_OK) {
@@ -414,23 +419,22 @@ BEmailMessage::SendViaAccountFrom(BEmailMessage *message)
 
 
 void
-BEmailMessage::SendViaAccount(const char *account_name)
+BEmailMessage::SendViaAccount(const char* accountName)
 {
        BMailAccounts accounts;
-       BMailAccountSettings* account = accounts.AccountByName(account_name);
-       if (!account)
-               return;
-       SendViaAccount(account->AccountID());
+       BMailAccountSettings* account = accounts.AccountByName(accountName);
+       if (account != NULL)
+               SendViaAccount(account->AccountID());
 }
 
 
 void
 BEmailMessage::SendViaAccount(int32 account)
 {
-       _account_id = account;
+       fAccountID = account;
 
        BMailAccounts accounts;
-       BMailAccountSettings* accountSettings = 
accounts.AccountByID(_account_id);
+       BMailAccountSettings* accountSettings = 
accounts.AccountByID(fAccountID);
 
        BString from;
        if (accountSettings) {
@@ -444,26 +448,26 @@ BEmailMessage::SendViaAccount(int32 account)
 int32
 BEmailMessage::Account() const
 {
-       return _account_id;
+       return fAccountID;
 }
 
 
 status_t
 BEmailMessage::GetAccountName(BString& accountName) const
 {
-       BFile *file = dynamic_cast<BFile *>(fData);
+       BFile* file = dynamic_cast<BFile*>(fData);
        if (file == NULL)
                return B_ERROR;
 
-       int32 accountId;
+       int32 accountID;
        size_t read = file->ReadAttr(B_MAIL_ATTR_ACCOUNT, B_INT32_TYPE, 0,
-               &accountId, sizeof(int32));
+               &accountID, sizeof(int32));
        if (read < sizeof(int32))
                return B_ERROR;
 
        BMailAccounts accounts;
-       BMailAccountSettings* account =  accounts.AccountByID(accountId);
-       if (account)
+       BMailAccountSettings* account =  accounts.AccountByID(accountID);
+       if (account != NULL)
                accountName = account->Name();
        else
                accountName = "";
@@ -473,23 +477,23 @@ BEmailMessage::GetAccountName(BString& accountName) const
 
 
 status_t
-BEmailMessage::AddComponent(BMailComponent *component)
+BEmailMessage::AddComponent(BMailComponent* component)
 {
        status_t status = B_OK;
 
-       if (_num_components == 0)
-               _body = component;
-       else if (_num_components == 1) {
+       if (fComponentCount == 0)
+               fBody = component;
+       else if (fComponentCount == 1) {
                BMIMEMultipartMailContainer *container
                        = new BMIMEMultipartMailContainer(
                                mime_boundary, mime_warning, 
_charSetForTextDecoding);
-               status = container->AddComponent(_body);
+               status = container->AddComponent(fBody);
                if (status == B_OK)
                        status = container->AddComponent(component);
-               _body = container;
+               fBody = container;
        } else {
-               BMIMEMultipartMailContainer *container
-                       = dynamic_cast<BMIMEMultipartMailContainer *>(_body);
+               BMIMEMultipartMailContainer* container
+                       = dynamic_cast<BMIMEMultipartMailContainer*>(fBody);
                if (container == NULL)
                        return B_MISMATCHED_VALUES;
 
@@ -497,13 +501,13 @@ BEmailMessage::AddComponent(BMailComponent *component)
        }
 
        if (status == B_OK)
-               _num_components++;
+               fComponentCount++;
        return status;
 }
 
 
 status_t
-BEmailMessage::RemoveComponent(BMailComponent */*component*/)
+BEmailMessage::RemoveComponent(BMailComponent* /*component*/)
 {
        // not yet implemented
        // BeMail/Enclosures.cpp:169: contains a warning about this fact
@@ -519,15 +523,15 @@ BEmailMessage::RemoveComponent(int32 /*index*/)
 }
 
 
-BMailComponent *
+BMailComponent*
 BEmailMessage::GetComponent(int32 i, bool parseNow)
 {
-       if (BMIMEMultipartMailContainer *container
-                       = dynamic_cast<BMIMEMultipartMailContainer *>(_body))
+       if (BMIMEMultipartMailContainer* container
+                       = dynamic_cast<BMIMEMultipartMailContainer*>(fBody))
                return container->GetComponent(i, parseNow);
 
-       if (i < _num_components)
-               return _body;
+       if (i < fComponentCount)
+               return fBody;
 
        return NULL;
 }
@@ -536,98 +540,97 @@ BEmailMessage::GetComponent(int32 i, bool parseNow)
 int32
 BEmailMessage::CountComponents() const
 {
-       return _num_components;
+       return fComponentCount;
 }
 
 
 void
-BEmailMessage::Attach(entry_ref *ref, bool includeAttributes)
+BEmailMessage::Attach(entry_ref* ref, bool includeAttributes)
 {
-       if (includeAttributes)
-               AddComponent(new BAttributedMailAttachment(ref));
-       else
-               AddComponent(new BSimpleMailAttachment(ref));
+       AddComponent(includeAttributes
+               ? new BAttributedMailAttachment(ref) : new 
BSimpleMailAttachment(ref));
 }
 
 
 bool
 BEmailMessage::IsComponentAttachment(int32 i)
 {
-       if ((i >= _num_components) || (_num_components == 0))
+       if ((i >= fComponentCount) || (fComponentCount == 0))
                return false;
 
-       if (_num_components == 1)
-               return _body->IsAttachment();
+       if (fComponentCount == 1)
+               return fBody->IsAttachment();
 
-       BMIMEMultipartMailContainer *container
-               = dynamic_cast<BMIMEMultipartMailContainer *>(_body);
+       BMIMEMultipartMailContainer* container
+               = dynamic_cast<BMIMEMultipartMailContainer*>(fBody);
        if (container == NULL)
                return false;
 
-       BMailComponent *component = container->GetComponent(i);
+       BMailComponent* component = container->GetComponent(i);
        if (component == NULL)
                return false;
+
        return component->IsAttachment();
 }
 
 
 void
-BEmailMessage::SetBodyTextTo(const char *text)
+BEmailMessage::SetBodyTextTo(const char* text)
 {
-       if (_text_body == NULL) {
-               _text_body = new BTextMailComponent;
-               AddComponent(_text_body);
+       if (fTextBody == NULL) {
+               fTextBody = new BTextMailComponent;
+               AddComponent(fTextBody);
        }
 
-       _text_body->SetText(text);
+       fTextBody->SetText(text);
 }
 
 
-BTextMailComponent *
+BTextMailComponent*
 BEmailMessage::Body()
 {
-       if (_text_body == NULL)
-               _text_body = RetrieveTextBody(_body);
+       if (fTextBody == NULL)
+               fTextBody = _RetrieveTextBody(fBody);
 
-       return _text_body;
+       return fTextBody;
 }
 
 
-const char *
+const char*
 BEmailMessage::BodyText()
 {
        if (Body() == NULL)
                return NULL;
 
-       return _text_body->Text();
+       return fTextBody->Text();
 }
 
 
 status_t
-BEmailMessage::SetBody(BTextMailComponent *body)
+BEmailMessage::SetBody(BTextMailComponent* body)
 {
-       if (_text_body != NULL) {
+       if (fTextBody != NULL) {
                return B_ERROR;
 //     removing doesn't exist for now
-//             RemoveComponent(_text_body);
-//             delete _text_body;
+//             RemoveComponent(fTextBody);
+//             delete fTextBody;
        }
-       _text_body = body;
-       AddComponent(_text_body);
+       fTextBody = body;
+       AddComponent(fTextBody);
 
        return B_OK;
 }
 
 
-BTextMailComponent *
-BEmailMessage::RetrieveTextBody(BMailComponent *component)
+BTextMailComponent*
+BEmailMessage::_RetrieveTextBody(BMailComponent* component)
 {
-       BTextMailComponent *body = dynamic_cast<BTextMailComponent 
*>(component);
+       BTextMailComponent* body = dynamic_cast<BTextMailComponent*>(component);
        if (body != NULL)
                return body;
 
-       BMIMEMultipartMailContainer *container
-               = dynamic_cast<BMIMEMultipartMailContainer *>(component);
+       BMIMEMultipartMailContainer* container
+               = dynamic_cast<BMIMEMultipartMailContainer*>(component);
        if (container != NULL) {
                for (int32 i = 0; i < container->CountComponents(); i++) {
                        if ((component = container->GetComponent(i)) == NULL)
@@ -637,14 +640,14 @@ BEmailMessage::RetrieveTextBody(BMailComponent *component)
                                case B_MAIL_PLAIN_TEXT_BODY:
                                        // AttributedAttachment returns the 
MIME type of its
                                        // contents, so we have to use 
dynamic_cast here
-                                       body = dynamic_cast<BTextMailComponent 
*>(
+                                       body = 
dynamic_cast<BTextMailComponent*>(
                                                container->GetComponent(i));
                                        if (body != NULL)
                                                return body;
                                        break;
 
                                case B_MAIL_MULTIPART_CONTAINER:
-                                       body = 
RetrieveTextBody(container->GetComponent(i));
+                                       body = 
_RetrieveTextBody(container->GetComponent(i));
                                        if (body != NULL)
                                                return body;
                                        break;
@@ -656,81 +659,81 @@ BEmailMessage::RetrieveTextBody(BMailComponent *component)
 
 
 status_t
-BEmailMessage::SetToRFC822(BPositionIO *mail_file, size_t length,
-       bool parse_now)
+BEmailMessage::SetToRFC822(BPositionIO* mailFile, size_t length,
+       bool parseNow)
 {
-       if (BFile *file = dynamic_cast<BFile *>(mail_file)) {
-               file->ReadAttr(B_MAIL_ATTR_ACCOUNT_ID, B_INT32_TYPE, 0, 
&_account_id,
-                       sizeof(_account_id));
+       if (BFile* file = dynamic_cast<BFile*>(mailFile)) {
+               file->ReadAttr(B_MAIL_ATTR_ACCOUNT_ID, B_INT32_TYPE, 0, 
&fAccountID,
+                       sizeof(fAccountID));
        }
 
-       mail_file->Seek(0,SEEK_END);
-       length = mail_file->Position();
-       mail_file->Seek(0,SEEK_SET);
-
-       _status = BMailComponent::SetToRFC822(mail_file,length,parse_now);
-       if (_status < B_OK)
-               return _status;
-
-       _body = WhatIsThis();
-
-       mail_file->Seek(0,SEEK_SET);
-       _status = _body->SetToRFC822(mail_file,length,parse_now);
-       if (_status < B_OK)
-               return _status;
-
-       //------------Move headers that we use to us, everything else to _body
-       const char *name;
-       for (int32 i = 0; (name = _body->HeaderAt(i)) != NULL; i++) {
-               if (strcasecmp(name,"Subject") != 0
-                       && strcasecmp(name,"To") != 0
-                       && strcasecmp(name,"From") != 0
-                       && strcasecmp(name,"Reply-To") != 0
-                       && strcasecmp(name,"Cc") != 0
-                       && strcasecmp(name,"Priority") != 0
-                       && strcasecmp(name,"X-Priority") != 0
-                       && strcasecmp(name,"X-Msmail-Priority") != 0
-                       && strcasecmp(name,"Date") != 0) {
+       mailFile->Seek(0, SEEK_END);
+       length = mailFile->Position();
+       mailFile->Seek(0, SEEK_SET);
+
+       fStatus = BMailComponent::SetToRFC822(mailFile, length, parseNow);
+       if (fStatus < B_OK)
+               return fStatus;
+
+       fBody = WhatIsThis();
+
+       mailFile->Seek(0, SEEK_SET);
+       fStatus = fBody->SetToRFC822(mailFile, length, parseNow);
+       if (fStatus < B_OK)
+               return fStatus;
+
+       // Move headers that we use to us, everything else to fBody
+       const char* name;
+       for (int32 i = 0; (name = fBody->HeaderAt(i)) != NULL; i++) {
+               if (strcasecmp(name, "Subject") != 0
+                       && strcasecmp(name, "To") != 0
+                       && strcasecmp(name, "From") != 0
+                       && strcasecmp(name, "Reply-To") != 0
+                       && strcasecmp(name, "Cc") != 0
+                       && strcasecmp(name, "Priority") != 0
+                       && strcasecmp(name, "X-Priority") != 0
+                       && strcasecmp(name, "X-Msmail-Priority") != 0
+                       && strcasecmp(name, "Date") != 0) {
                        RemoveHeader(name);
                }
        }
 
-       _body->RemoveHeader("Subject");
-       _body->RemoveHeader("To");
-       _body->RemoveHeader("From");
-       _body->RemoveHeader("Reply-To");
-       _body->RemoveHeader("Cc");
-       _body->RemoveHeader("Priority");
-       _body->RemoveHeader("X-Priority");
-       _body->RemoveHeader("X-Msmail-Priority");
-       _body->RemoveHeader("Date");
-
-       _num_components = 1;
-       if (BMIMEMultipartMailContainer *container
-                       = dynamic_cast<BMIMEMultipartMailContainer *>(_body))
-               _num_components = container->CountComponents();
+       fBody->RemoveHeader("Subject");
+       fBody->RemoveHeader("To");
+       fBody->RemoveHeader("From");
+       fBody->RemoveHeader("Reply-To");
+       fBody->RemoveHeader("Cc");
+       fBody->RemoveHeader("Priority");
+       fBody->RemoveHeader("X-Priority");
+       fBody->RemoveHeader("X-Msmail-Priority");
+       fBody->RemoveHeader("Date");
+
+       fComponentCount = 1;
+       if (BMIMEMultipartMailContainer* container
+                       = dynamic_cast<BMIMEMultipartMailContainer*>(fBody))
+               fComponentCount = container->CountComponents();
 
        return B_OK;
 }
 
 
 status_t
-BEmailMessage::RenderToRFC822(BPositionIO *file)
+BEmailMessage::RenderToRFC822(BPositionIO* file)
 {
-       if (_body == NULL)
+       if (fBody == NULL)
                return B_MAIL_INVALID_MAIL;
 
        // Do real rendering
 
        if (From() == NULL) {
                // set the "From:" string
-               SendViaAccount(_account_id);
+               SendViaAccount(fAccountID);
        }
 
        BList recipientList;
        get_address_list(recipientList, To(), extract_address);
        get_address_list(recipientList, CC(), extract_address);
-       get_address_list(recipientList, _bcc, extract_address);
+       get_address_list(recipientList, fBCC, extract_address);
 
        BString recipients;
        for (int32 i = recipientList.CountItems(); i-- > 0;) {
@@ -785,7 +788,7 @@ BEmailMessage::RenderToRFC822(BPositionIO *file)
        file->Seek(-2, SEEK_CUR);
                // Remove division between headers
 
-       err = _body->RenderToRFC822(file);
+       err = fBody->RenderToRFC822(file);
        if (err < B_OK)
                return err;
 
@@ -794,7 +797,7 @@ BEmailMessage::RenderToRFC822(BPositionIO *file)
        // (since the daemon may send it when it sees the status attribute 
getting
        // set to "Pending").
 
-       if (BFile *attributed = dynamic_cast <BFile *>(file)) {
+       if (BFile* attributed = dynamic_cast <BFile*>(file)) {
                BNodeInfo(attributed).SetType(B_MAIL_TYPE);
 
                attributed->WriteAttrString(B_MAIL_ATTR_RECIPIENTS,&recipients);
@@ -802,19 +805,19 @@ BEmailMessage::RenderToRFC822(BPositionIO *file)
                BString attr;
 
                attr = To();
-               attributed->WriteAttrString(B_MAIL_ATTR_TO,&attr);
+               attributed->WriteAttrString(B_MAIL_ATTR_TO, &attr);
                attr = CC();
-               attributed->WriteAttrString(B_MAIL_ATTR_CC,&attr);
+               attributed->WriteAttrString(B_MAIL_ATTR_CC, &attr);
                attr = Subject();
-               attributed->WriteAttrString(B_MAIL_ATTR_SUBJECT,&attr);
+               attributed->WriteAttrString(B_MAIL_ATTR_SUBJECT, &attr);
                attr = ReplyTo();
-               attributed->WriteAttrString(B_MAIL_ATTR_REPLY,&attr);
+               attributed->WriteAttrString(B_MAIL_ATTR_REPLY, &attr);
                attr = From();
-               attributed->WriteAttrString(B_MAIL_ATTR_FROM,&attr);
+               attributed->WriteAttrString(B_MAIL_ATTR_FROM, &attr);
                if (Priority() != 3 /* Normal is 3 */) {
-                       sprintf (attr.LockBuffer (40), "%d", Priority());
+                       sprintf(attr.LockBuffer(40), "%d", Priority());
                        attr.UnlockBuffer(-1);
-                       attributed->WriteAttrString(B_MAIL_ATTR_PRIORITY,&attr);
+                       attributed->WriteAttrString(B_MAIL_ATTR_PRIORITY, 
&attr);
                }
                attr = "Pending";
                attributed->WriteAttrString(B_MAIL_ATTR_STATUS, &attr);
@@ -822,7 +825,7 @@ BEmailMessage::RenderToRFC822(BPositionIO *file)
                attributed->WriteAttrString(B_MAIL_ATTR_MIME, &attr);
 
                attributed->WriteAttr(B_MAIL_ATTR_ACCOUNT, B_INT32_TYPE, 0,
-                       &_account_id, sizeof(int32));
+                       &fAccountID, sizeof(int32));
 
                attributed->WriteAttr(B_MAIL_ATTR_WHEN, B_TIME_TYPE, 0, 
&creationTime,
                        sizeof(int32));
@@ -831,7 +834,7 @@ BEmailMessage::RenderToRFC822(BPositionIO *file)
                        sizeof(int32));
 
                attributed->WriteAttr(B_MAIL_ATTR_ACCOUNT_ID, B_INT32_TYPE, 0,
-                       &_account_id, sizeof(int32));
+                       &fAccountID, sizeof(int32));
        }
 
        return B_OK;
@@ -839,10 +842,10 @@ BEmailMessage::RenderToRFC822(BPositionIO *file)
 
 
 status_t
-BEmailMessage::RenderTo(BDirectory *dir, BEntry *msg)
+BEmailMessage::RenderTo(BDirectory* dir, BEntry* msg)
 {
        time_t currentTime;
-       char numericDateString [40];
+       char numericDateString[40];
        struct tm timeFields;
        BString worker;
 
@@ -851,11 +854,14 @@ BEmailMessage::RenderTo(BDirectory *dir, BEntry *msg)
        // incoming messages.
 
        BString name = Subject();
-       SubjectToThread (name); // Extract the core subject words.
+       SubjectToThread(name);
+               // Extract the core subject words.
        if (name.Length() <= 0)
                name = "No Subject";
-       if (name[0] == '.')
-               name.Prepend ("_"); // Avoid hidden files, starting with a dot.
+       if (name[0] == '.') {
+               // Avoid hidden files, starting with a dot.
+               name.Prepend("_");
+       }
 
        // Convert the date into a year-month-day fixed digit width format, so 
that
        // sorting by file name will give all the messages with the same 
subject in
@@ -863,12 +869,8 @@ BEmailMessage::RenderTo(BDirectory *dir, BEntry *msg)
        time (&currentTime);
        localtime_r (&currentTime, &timeFields);
        sprintf (numericDateString, "%04d%02d%02d%02d%02d%02d",
-               timeFields.tm_year + 1900,
-               timeFields.tm_mon + 1,
-               timeFields.tm_mday,
-               timeFields.tm_hour,
-               timeFields.tm_min,
-               timeFields.tm_sec);
+               timeFields.tm_year + 1900, timeFields.tm_mon + 1, 
timeFields.tm_mday,
+               timeFields.tm_hour, timeFields.tm_min, timeFields.tm_sec);
        name << " " << numericDateString;
 
        worker = From();
@@ -884,8 +886,10 @@ BEmailMessage::RenderTo(BDirectory *dir, BEntry *msg)
        name.ReplaceAll('!','_');
        name.ReplaceAll('<','_');
        name.ReplaceAll('>','_');
-       while (name.FindFirst("  ") >= 0) // Remove multiple spaces.
-               name.Replace("  " /* Old */, " " /* New */, 1024 /* Count */);
+
+       // Remove multiple spaces.
+       while (name.FindFirst("  ") >= 0)
+               name.Replace("  ", " ", 1024);
 
        int32 uniquer = time(NULL);
        worker = name;
@@ -905,7 +909,7 @@ BEmailMessage::RenderTo(BDirectory *dir, BEntry *msg)
 
        BFile file;
        status_t status = dir->CreateFile(worker.String(), &file);
-       if (status < B_OK)
+       if (status != B_OK)
                return status;
 
        if (msg != NULL)
@@ -919,8 +923,8 @@ status_t
 BEmailMessage::Send(bool sendNow)
 {
        BMailAccounts accounts;
-       BMailAccountSettings* account = accounts.AccountByID(_account_id);
-       if (!account || !account->HasOutbound()) {
+       BMailAccountSettings* account = accounts.AccountByID(fAccountID);
+       if (account == NULL || !account->HasOutbound()) {
                account = accounts.AccountByID(
                        BMailSettings().DefaultOutboundAccount());
                if (!account)
@@ -945,20 +949,16 @@ BEmailMessage::Send(bool sendNow)
 
        status_t status = RenderTo(&directory, &message);
        if (status >= B_OK && sendNow) {
-               BMailSettings settings_file;
-               if (settings_file.SendOnlyIfPPPUp()) {
-                       // TODO!
-               }
-
+               // TODO: check whether or not the internet connection is 
available
                BMessenger daemon(B_MAIL_DAEMON_SIGNATURE);
                if (!daemon.IsValid())
                        return B_MAIL_NO_DAEMON;
 
-               BMessage msg('msnd');
-               msg.AddInt32("account",_account_id);
+               BMessage msg(kMsgSendMessages);
+               msg.AddInt32("account", fAccountID);
                BPath path;
                message.GetPath(&path);
-               msg.AddString("message_path",path.Path());
+               msg.AddString("message_path", path.Path());
                daemon.SendMessage(&msg);
        }
 

############################################################################

Commit:      3ceef2e1af90bdcf1a43f0b4f736ecf79884a59f
Author:      Axel DÃrfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Mon Nov 26 23:09:15 2012 UTC

The E-mail window's frame is no longer stored.

* This is part of a clean up of BMailSettings; storing the window
  position might be implemented again later -- it just doesn't
  belong there.
* Changed the logic when the daemon is set to auto start. It's now
  always started if at least a single account exists.

----------------------------------------------------------------------------

diff --git a/src/preferences/mail/ConfigWindow.cpp 
b/src/preferences/mail/ConfigWindow.cpp
index 951a7db..7175b14 100644
--- a/src/preferences/mail/ConfigWindow.cpp
+++ b/src/preferences/mail/ConfigWindow.cpp
@@ -409,22 +409,12 @@ ConfigWindow::_LoadSettings()
        // load in general settings
        BMailSettings settings;
        status_t status = _SetToGeneralSettings(&settings);
-       if (status == B_OK) {
-               // move own window
-               MoveTo(settings.ConfigWindowFrame().LeftTop());
-       } else {
+       if (status != B_OK) {
                fprintf(stderr, B_TRANSLATE("Error retrieving general settings: 
%s\n"),
                        strerror(status));
        }
 
-       BScreen screen(this);
-       BRect screenFrame(screen.Frame().InsetByCopy(0, 5));
-       if (!screenFrame.Contains(Frame().LeftTop())
-               || !screenFrame.Contains(Frame().RightBottom()))
-               status = B_ERROR;
-
-       if (status != B_OK)
-               CenterOnScreen();
+       CenterOnScreen();
 }
 
 
@@ -466,9 +456,8 @@ ConfigWindow::_SaveSettings()
        }
        fToDeleteAccounts.MakeEmpty();
 
-       /*** save general settings ***/
+       // Apply and save general settings
 
-       // apply and save general settings
        BMailSettings settings;
        if (fSaveSettings) {
                // figure out time interval
@@ -477,21 +466,17 @@ ConfigWindow::_SaveSettings()
                bigtime_t interval = bigtime_t(60000000L * floatInterval);
 
                settings.SetAutoCheckInterval(interval);
-               settings.SetDaemonAutoStarts(interval != 0);
+               settings.SetDaemonAutoStarts(!fAccounts.IsEmpty());
 
                // status mode (alway, fetching/retrieving, ...)
                int32 index = fStatusModeField->Menu()->IndexOf(
                        fStatusModeField->Menu()->FindMarked());
                settings.SetShowStatusWindow(index);
-       } else {
-               // restore status window look
-               settings.SetStatusWindowLook(settings.StatusWindowLook());
-       }
 
-       settings.SetConfigWindowFrame(Frame());
-       settings.Save();
+               settings.Save();
+       }
 
-       /*** save accounts ***/
+       // Save accounts
 
        if (fSaveSettings) {
                for (int i = 0; i < fAccounts.CountItems(); i++)
@@ -703,8 +688,7 @@ ConfigWindow::_SetToGeneralSettings(BMailSettings* settings)
 
        // retrieval frequency
        uint32 interval = uint32(settings->AutoCheckInterval() / 60000000L);
-       fCheckMailCheckBox->SetValue(settings->DaemonAutoStarts()
-               && interval != 0 ? B_CONTROL_ON : B_CONTROL_OFF);
+       fCheckMailCheckBox->SetValue(interval != 0 ? B_CONTROL_ON : 
B_CONTROL_OFF);
 
        if (interval == 0)
                interval = 5;
@@ -733,9 +717,6 @@ ConfigWindow::_RevertToLastSettings()
        // revert general settings
        BMailSettings settings;
 
-       // restore status window look
-       settings.SetStatusWindowLook(settings.StatusWindowLook());
-
        status_t status = _SetToGeneralSettings(&settings);
        if (status != B_OK) {
                char text[256];

############################################################################

Commit:      3bbdfc6937828f79d279491b2c0644a2e04f991b
Author:      Axel DÃrfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Mon Nov 26 23:11:05 2012 UTC

Cleaned up BMailSettings.

* Removed superfluous and outdated settings.
* The setters now return an error code since they actually can fail.

----------------------------------------------------------------------------

diff --git a/headers/os/mail/MailSettings.h b/headers/os/mail/MailSettings.h
index eac7c85..b52ee0a 100644
--- a/headers/os/mail/MailSettings.h
+++ b/headers/os/mail/MailSettings.h
@@ -40,38 +40,17 @@ public:
                        status_t                        InitCheck() const;
 
                        // Global settings
-                       int32                           WindowFollowsCorner();
-                       void                            
SetWindowFollowsCorner(int32 which_corner);
-
                        uint32                          ShowStatusWindow();
-                       void                            
SetShowStatusWindow(uint32 mode);
+                       status_t                        
SetShowStatusWindow(uint32 mode);
 
                        bool                            DaemonAutoStarts();
-                       void                            
SetDaemonAutoStarts(bool does_it);
-
-                       void                            
SetConfigWindowFrame(BRect frame);
-                       BRect                           ConfigWindowFrame();
-
-                       void                            
SetStatusWindowFrame(BRect frame);
-                       BRect                           StatusWindowFrame();
-
-                       int32                           
StatusWindowWorkspaces();
-                       void                            
SetStatusWindowWorkspaces(int32 workspaces);
-
-                       int32                           StatusWindowLook();
-                       void                            
SetStatusWindowLook(int32 look);
+                       status_t                        
SetDaemonAutoStarts(bool autoStart);
 
                        bigtime_t                       AutoCheckInterval();
-                       void                            
SetAutoCheckInterval(bigtime_t);
-
-                       bool                            CheckOnlyIfPPPUp();
-                       void                            
SetCheckOnlyIfPPPUp(bool yes);
-
-                       bool                            SendOnlyIfPPPUp();
-                       void                            SetSendOnlyIfPPPUp(bool 
yes);
+                       status_t                        
SetAutoCheckInterval(bigtime_t interval);
 
                        int32                           
DefaultOutboundAccount();
-                       void                            
SetDefaultOutboundAccount(int32 to);
+                       status_t                        
SetDefaultOutboundAccount(int32 to);
 
 private:
                        BMessage                        fData;
diff --git a/src/kits/mail/MailSettings.cpp b/src/kits/mail/MailSettings.cpp
index 638a383..b2e2bc7 100644
--- a/src/kits/mail/MailSettings.cpp
+++ b/src/kits/mail/MailSettings.cpp
@@ -115,39 +115,23 @@ BMailSettings::Reload()
 //     # pragma mark - Global settings
 
 
-int32
-BMailSettings::WindowFollowsCorner()
-{
-       return fData.FindInt32("WindowFollowsCorner");
-}
-
-
-void
-BMailSettings::SetWindowFollowsCorner(int32 whichCorner)
-{
-       if (fData.ReplaceInt32("WindowFollowsCorner", whichCorner) != B_OK)
-               fData.AddInt32("WindowFollowsCorner", whichCorner);
-}
-
-
 uint32
 BMailSettings::ShowStatusWindow()
 {
        int32 showStatusWindow;
        if (fData.FindInt32("ShowStatusWindow", &showStatusWindow) != B_OK) {
                // show during send and receive
-               return 2;
+               return B_MAIL_SHOW_STATUS_WINDOW_WHEN_ACTIVE;
        }
 
        return showStatusWindow;
 }
 
 
-void
+status_t
 BMailSettings::SetShowStatusWindow(uint32 mode)
 {
-       if (fData.ReplaceInt32("ShowStatusWindow", mode) != B_OK)
-               fData.AddInt32("ShowStatusWindow", mode);
+       return fData.SetInt32("ShowStatusWindow", mode);
 }
 
 
@@ -158,87 +142,10 @@ BMailSettings::DaemonAutoStarts()
 }
 
 
-void
+status_t
 BMailSettings::SetDaemonAutoStarts(bool startIt)
 {
-       if (fData.ReplaceBool("DaemonAutoStarts", startIt) != B_OK)
-               fData.AddBool("DaemonAutoStarts", startIt);
-}
-
-
-BRect
-BMailSettings::ConfigWindowFrame()
-{
-       return fData.FindRect("ConfigWindowFrame");
-}
-
-
-void
-BMailSettings::SetConfigWindowFrame(BRect frame)
-{
-       if (fData.ReplaceRect("ConfigWindowFrame", frame) != B_OK)
-               fData.AddRect("ConfigWindowFrame", frame);
-}
-
-
-BRect
-BMailSettings::StatusWindowFrame()
-{
-       BRect frame;
-       if (fData.FindRect("StatusWindowFrame", &frame) != B_OK)
-               return BRect(100, 100, 200, 120);
-
-       return frame;
-}
-
-
-void
-BMailSettings::SetStatusWindowFrame(BRect frame)
-{
-       if (fData.ReplaceRect("StatusWindowFrame", frame) != B_OK)
-               fData.AddRect("StatusWindowFrame", frame);
-}
-
-
-int32
-BMailSettings::StatusWindowWorkspaces()
-{
-       uint32 workspaces;
-       if (fData.FindInt32("StatusWindowWorkSpace", (int32*)&workspaces) != 
B_OK)
-               return B_ALL_WORKSPACES;
-
-       return workspaces;
-}
-
-
-void
-BMailSettings::SetStatusWindowWorkspaces(int32 workspace)
-{
-       if (fData.ReplaceInt32("StatusWindowWorkSpace", workspace) != B_OK)
-               fData.AddInt32("StatusWindowWorkSpace", workspace);
-
-       BMessage msg('wsch');
-       msg.AddInt32("StatusWindowWorkSpace",workspace);
-       BMessenger(B_MAIL_DAEMON_SIGNATURE).SendMessage(&msg);
-}
-
-
-int32
-BMailSettings::StatusWindowLook()
-{
-       return fData.FindInt32("StatusWindowLook");
-}
-
-
-void
-BMailSettings::SetStatusWindowLook(int32 look)
-{
-       if (fData.ReplaceInt32("StatusWindowLook", look) != B_OK)
-               fData.AddInt32("StatusWindowLook", look);
-
-       BMessage msg('lkch');
-       msg.AddInt32("StatusWindowLook", look);
-       BMessenger(B_MAIL_DAEMON_SIGNATURE).SendMessage(&msg);
+       return fData.SetBool("DaemonAutoStarts", startIt);
 }
 
 
@@ -254,41 +161,10 @@ BMailSettings::AutoCheckInterval()
 }
 
 
-void
+status_t
 BMailSettings::SetAutoCheckInterval(bigtime_t interval)
 {
-       if (fData.ReplaceInt64("AutoCheckInterval", interval) != B_OK)
-               fData.AddInt64("AutoCheckInterval", interval);
-}
-
-
-bool
-BMailSettings::CheckOnlyIfPPPUp()
-{
-       return fData.FindBool("CheckOnlyIfPPPUp");
-}
-
-
-void
-BMailSettings::SetCheckOnlyIfPPPUp(bool yes)
-{
-       if (fData.ReplaceBool("CheckOnlyIfPPPUp", yes))
-               fData.AddBool("CheckOnlyIfPPPUp", yes);
-}
-
-
-bool
-BMailSettings::SendOnlyIfPPPUp()
-{
-       return fData.FindBool("SendOnlyIfPPPUp");
-}
-
-
-void
-BMailSettings::SetSendOnlyIfPPPUp(bool yes)
-{
-       if (fData.ReplaceBool("SendOnlyIfPPPUp", yes))
-               fData.AddBool("SendOnlyIfPPPUp", yes);
+       return fData.SetInt64("AutoCheckInterval", interval);
 }
 
 
@@ -299,11 +175,10 @@ BMailSettings::DefaultOutboundAccount()
 }
 
 
-void
+status_t
 BMailSettings::SetDefaultOutboundAccount(int32 to)
 {
-       if (fData.ReplaceInt32("DefaultOutboundAccount", to) != B_OK)
-               fData.AddInt32("DefaultOutboundAccount", to);
+       return fData.SetInt32("DefaultOutboundAccount", to);
 }
 
 
@@ -460,8 +335,6 @@ BMailAddOnSettings::Load(const BMessage& message)
 
        MakeEmpty();
        Append(settings);
-puts("settings:");
-settings.PrintToStream();
 
        fOriginalSettings = *this;
        fOriginalRef = fRef;
diff --git a/src/servers/mail/MailDaemonApplication.cpp 
b/src/servers/mail/MailDaemonApplication.cpp
index b66a70c..3e604ef 100644
--- a/src/servers/mail/MailDaemonApplication.cpp
+++ b/src/servers/mail/MailDaemonApplication.cpp
@@ -305,9 +305,8 @@ MailDaemonApplication::MessageReceived(BMessage* msg)
 {
        switch (msg->what) {
                case 'moto':
-                       if (fSettingsFile.CheckOnlyIfPPPUp()) {
-                               // TODO: check whether internet is up and 
running!
-                       }
+                       // TODO: check whether internet is up and running!
+
                        // supposed to fall through
                case kMsgCheckAndSend:  // check & send messages
                        msg->what = kMsgSendMessages;

############################################################################

Commit:      3fd14fa5e9c080e5054a9033cb047a51fb3c7287
Author:      Axel DÃrfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Mon Nov 26 23:13:31 2012 UTC

Align all protocol config view labels to the right.

----------------------------------------------------------------------------

diff --git a/src/kits/mail/ProtocolConfigView.cpp 
b/src/kits/mail/ProtocolConfigView.cpp
index 3235bfc..02158e4 100644
--- a/src/kits/mail/ProtocolConfigView.cpp
+++ b/src/kits/mail/ProtocolConfigView.cpp
@@ -350,6 +350,8 @@ MailProtocolConfigView::_AddTextControl(BGridLayout* 
layout, const char* name,
        const char* label)
 {
        BTextControl* control = new BTextControl(name, label, "", NULL);
+       control->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
+
        int32 row = layout->CountRows();
        layout->AddItem(control->CreateLabelLayoutItem(), 0, row);
        layout->AddItem(control->CreateTextViewLayoutItem(), 1, row);
@@ -363,6 +365,8 @@ MailProtocolConfigView::_AddMenuField(BGridLayout* layout, 
const char* name,
 {
        BPopUpMenu* menu = new BPopUpMenu("");
        BMenuField* field = new BMenuField(name, label, menu);
+       field->SetAlignment(B_ALIGN_RIGHT);
+
        int32 row = layout->CountRows();
        layout->AddItem(field->CreateLabelLayoutItem(), 0, row);
        layout->AddItem(field->CreateMenuBarLayoutItem(), 1, row);

############################################################################

Commit:      aacdcfaa36531b29a777717c0df45de331bbf3a4
Author:      Axel DÃrfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Mon Nov 26 23:14:15 2012 UTC

Improved label of the button to configure the IMAP folders.

----------------------------------------------------------------------------

diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/ConfigView.cpp 
b/src/add-ons/mail_daemon/inbound_protocols/imap/ConfigView.cpp
index a704cc4..6cfaf45 100644
--- a/src/add-ons/mail_daemon/inbound_protocols/imap/ConfigView.cpp
+++ b/src/add-ons/mail_daemon/inbound_protocols/imap/ConfigView.cpp
@@ -73,7 +73,7 @@ ConfigView::ConfigView(const BMailAccountSettings& 
accountSettings,
        ((BControl*)(FindView("leave_mail_on_server")))->Hide();
 
        fFolderButton = new BButton("IMAP Folders", B_TRANSLATE(
-               "IMAP Folders"), new BMessage(kMsgOpenIMAPFolder));
+               "Configure IMAP Folders"), new BMessage(kMsgOpenIMAPFolder));
        Layout()->AddView(fFolderButton, 0, Layout()->CountRows(), 2);
 
        BPath defaultFolder = BPrivate::default_mail_directory();

############################################################################

Commit:      9e8514a6f537992fb67f61dc7578e77a146ae1af
Author:      Axel DÃrfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Mon Nov 26 23:15:02 2012 UTC

The protocol config view now adds some glue at the bottom.

* This makes all boxes fill the complete height of the window.
* The SMTP add-on did that itself which makes no sense.

----------------------------------------------------------------------------

diff --git a/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp 
b/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp
index 01c472b..c66ccd9 100644
--- a/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp
+++ b/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp
@@ -11,7 +11,6 @@
 #include <GridLayout.h>
 #include <MailFilter.h>
 #include <MenuField.h>
-#include <SpaceLayoutItem.h>
 #include <TextControl.h>
 
 #include <FileConfigView.h>
@@ -73,8 +72,6 @@ SMTPConfigView::SMTPConfigView(const BMailAccountSettings& 
settings)
 
        Layout()->AddView(fFileView, 0, Layout()->CountRows(),
                Layout()->CountColumns());
-       Layout()->AddItem(BSpaceLayoutItem::CreateGlue(), 0, 
Layout()->CountRows());
-       Layout()->SetRowWeight(Layout()->CountRows() - 1, 1.0f);
 }
 
 
diff --git a/src/preferences/mail/ConfigViews.cpp 
b/src/preferences/mail/ConfigViews.cpp
index 05c66f7..10d3223 100644
--- a/src/preferences/mail/ConfigViews.cpp
+++ b/src/preferences/mail/ConfigViews.cpp
@@ -147,7 +147,8 @@ ProtocolSettingsView::ProtocolSettingsView(const entry_ref& 
ref,
 
        BLayoutBuilder::Group<>(contents, B_VERTICAL)
                .SetInsets(B_USE_DEFAULT_SPACING)
-               .Add(view);
+               .Add(view)
+               .AddGlue();
 }
 
 


Other related posts:

  • » [haiku-commits] BRANCH axeld-github.imap - src/kits/mail headers/os/mail src/preferences/mail - axeld-github . imap