Adding MessageStatus class, meant to replace booleans passed around.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35835 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström 2010-03-13 12:32:22 +00:00
parent f427f6af3f
commit 5975d86a38
3 changed files with 127 additions and 0 deletions

View File

@ -24,6 +24,7 @@ Application Mail :
MailPopUpMenu.cpp
MailSupport.cpp
MailWindow.cpp
MessageStatus.cpp
Prefs.cpp
QueryMenu.cpp
Signature.cpp

View File

@ -0,0 +1,85 @@
#include "MessageStatus.h"
MessageStatus::MessageStatus()
:
fStatus(MAIL_WRITING)
{
}
MessageStatus::~MessageStatus()
{
}
void
MessageStatus::SetStatus(messageStatus status)
{
fStatus = status;
}
messageStatus
MessageStatus::Status()
{
return fStatus;
}
bool
MessageStatus::Reading()
{
return fStatus == MAIL_READING;
}
bool
MessageStatus::Writing()
{
return fStatus == MAIL_WRITING;
}
bool
MessageStatus::WritingDraft()
{
return fStatus == MAIL_WRITING_DRAFT;
}
bool
MessageStatus::Replying()
{
return fStatus == MAIL_REPLYING;
}
bool
MessageStatus::Forwarding()
{
return fStatus == MAIL_FORWARDING;
}
bool
MessageStatus::Outgoing()
{
return (fStatus == MAIL_WRITING
|| fStatus == MAIL_WRITING_DRAFT
|| fStatus == MAIL_REPLYING
|| fStatus == MAIL_FORWARDING);
}
bool
MessageStatus::MailIsOnDisk()
{
return (fStatus == MAIL_READING
|| fStatus == MAIL_WRITING_DRAFT
|| fStatus == MAIL_REPLYING
|| fStatus == MAIL_FORWARDING);
}

View File

@ -0,0 +1,41 @@
#ifndef _MESSAGE_STATUS_H
#define _MESSAGE_STATUS_H
#include <SupportDefs.h>
enum messageStatus {
MAIL_READING = 0,
MAIL_WRITING,
MAIL_WRITING_DRAFT,
MAIL_REPLYING,
MAIL_FORWARDING
};
class MessageStatus {
public:
MessageStatus();
~MessageStatus();
void SetStatus(messageStatus status);
messageStatus Status();
bool Reading();
bool Writing();
bool WritingDraft();
bool Replying();
bool Forwarding();
bool Outgoing();
bool MailIsOnDisk();
private:
messageStatus fStatus;
};
#endif // _MESSAGE_STATUS_H