2 * Copyright 2004-2012, Haiku Inc. All rights reserved.
3 * Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
4 * Copyright 2011 Clemens Zeidler.
6 * Distributed under the terms of the MIT License.
8 #ifndef MAIL_SETTINGS_H
9 #define MAIL_SETTINGS_H
14 #include <Archivable.h>
18 #include <ObjectList.h>
26 B_MAIL_SHOW_STATUS_WINDOW_NEVER
= 0,
27 B_MAIL_SHOW_STATUS_WINDOW_WHEN_SENDING
= 1,
28 B_MAIL_SHOW_STATUS_WINDOW_WHEN_ACTIVE
= 2,
29 B_MAIL_SHOW_STATUS_WINDOW_ALWAYS
= 3
30 } b_mail_status_window_option
;
40 status_t
InitCheck() const;
43 int32
WindowFollowsCorner();
44 void SetWindowFollowsCorner(int32 which_corner
);
46 uint32
ShowStatusWindow();
47 void SetShowStatusWindow(uint32 mode
);
49 bool DaemonAutoStarts();
50 void SetDaemonAutoStarts(bool does_it
);
52 void SetConfigWindowFrame(BRect frame
);
53 BRect
ConfigWindowFrame();
55 void SetStatusWindowFrame(BRect frame
);
56 BRect
StatusWindowFrame();
58 int32
StatusWindowWorkspaces();
59 void SetStatusWindowWorkspaces(int32 workspaces
);
61 int32
StatusWindowLook();
62 void SetStatusWindowLook(int32 look
);
64 bigtime_t
AutoCheckInterval();
65 void SetAutoCheckInterval(bigtime_t
);
67 bool CheckOnlyIfPPPUp();
68 void SetCheckOnlyIfPPPUp(bool yes
);
70 bool SendOnlyIfPPPUp();
71 void SetSendOnlyIfPPPUp(bool yes
);
73 int32
DefaultOutboundAccount();
74 void SetDefaultOutboundAccount(int32 to
);
82 class BMailAddOnSettings
: public BMessage
{
85 virtual ~BMailAddOnSettings();
87 virtual status_t
Load(const BMessage
& message
);
88 virtual status_t
Save(BMessage
& message
);
90 void SetAddOnRef(const entry_ref
& ref
);
91 const entry_ref
& AddOnRef() const;
93 virtual bool HasBeenModified() const;
96 const char* _RelativizePath(const BPath
& path
) const;
99 BMessage fOriginalSettings
;
101 entry_ref fOriginalRef
;
105 class BMailProtocolSettings
: public BMailAddOnSettings
{
107 BMailProtocolSettings();
108 virtual ~BMailProtocolSettings();
110 virtual status_t
Load(const BMessage
& message
);
111 virtual status_t
Save(BMessage
& message
);
113 int32
CountFilterSettings() const;
114 int32
AddFilterSettings(const entry_ref
* ref
= NULL
);
115 void RemoveFilterSettings(int32 index
);
116 bool MoveFilterSettings(int32 from
, int32 to
);
117 BMailAddOnSettings
* FilterSettingsAt(int32 index
) const;
119 virtual bool HasBeenModified() const;
122 BObjectList
<BMailAddOnSettings
> fFiltersSettings
;
126 class BMailAccountSettings
{
128 BMailAccountSettings();
129 BMailAccountSettings(BEntry account
);
130 ~BMailAccountSettings();
132 status_t
InitCheck() { return fStatus
; }
134 void SetAccountID(int32 id
);
135 int32
AccountID() const;
137 void SetName(const char* name
);
138 const char* Name() const;
140 void SetRealName(const char* realName
);
141 const char* RealName() const;
143 void SetReturnAddress(const char* returnAddress
);
144 const char* ReturnAddress() const;
146 bool SetInboundAddOn(const char* name
);
147 bool SetOutboundAddOn(const char* name
);
148 const entry_ref
& InboundAddOnRef() const;
149 const entry_ref
& OutboundAddOnRef() const;
151 BMailProtocolSettings
& InboundSettings();
152 const BMailProtocolSettings
& InboundSettings() const;
153 BMailProtocolSettings
& OutboundSettings();
154 const BMailProtocolSettings
& OutboundSettings() const;
159 void SetInboundEnabled(bool enabled
= true);
160 bool IsInboundEnabled() const;
161 void SetOutboundEnabled(bool enabled
= true);
162 bool IsOutboundEnabled() const;
168 bool HasBeenModified() const;
170 const BEntry
& AccountFile() const;
173 status_t
_CreateAccountFilePath();
174 status_t
_GetAddOnRef(const char* subPath
,
175 const char* name
, entry_ref
& ref
);
183 BString fAccountName
;
185 BString fReturnAdress
;
187 BMailProtocolSettings fInboundSettings
;
188 BMailProtocolSettings fOutboundSettings
;
190 bool fInboundEnabled
;
191 bool fOutboundEnabled
;
197 class BMailAccounts
{
202 static status_t
AccountsPath(BPath
& path
);
204 int32
CountAccounts();
205 BMailAccountSettings
* AccountAt(int32 index
);
207 BMailAccountSettings
* AccountByID(int32 id
);
208 BMailAccountSettings
* AccountByName(const char* name
);
210 BObjectList
<BMailAccountSettings
> fAccounts
;
214 #endif /* ZOIDBERG_MAIL_SETTINGS_H */