summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mail2/libmail/mailfactory.h
blob: c938c27b00ba33e610892001b0770502cc408618 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef MAILFACTORY_H
#define MAILFACTORY_H

#include <qobject.h>

#include <qpe/applnk.h>

#include "configfile.h"

class Attachment
{
public:
	void setFileName(QString fileName) { _fileName = fileName; }
	void setNewName(QString newName) { _newName = newName; }
	void setDescription(QString description) { _description = description; }
	void setDocLnk(DocLnk docLnk) { _docLnk = docLnk; }

	QString fileName() { return _fileName; }
	QString newName() { return _newName; }
	QString description() { return _description; }
	DocLnk docLnk() { return _docLnk; }

protected:
	QString _fileName, _newName, _description;
	DocLnk _docLnk;

};

class SendMail
{
public:
	SendMail() { _needsMime = false; }

	void setAccount(Account account) { _account = account; }

	void setFrom(QString from) { _from = from; }
	void setReplyTo(QString replyTo) { _replyTo = replyTo; }
	void setTo(QString to) { _to = to; }
	void setCc(QString cc) { _cc = cc; }
	void setBcc(QString bcc) { _bcc = bcc; }
	void setSubject(QString subject) { _subject = subject; }
	void setPriority(QString priority) { _priority = priority; }
	void setMessage(QString message) { _message = message; }
	void setInReplyTo(QString inReplyTo) { _inReplyTo = inReplyTo; }

	void setNeedsMime(bool needsMime) { _needsMime = needsMime; }

	//void setEncrypt(bool encrypt) { _encrypt = encrypt; }
	//void setSign(bool sign) { _sign = sign; }
	//void setGpgReceivers(QValueList<GpgKey> receivers) { _receivers = receivers; }
	//void setGpgPassphrase(QString passphrase) { _passphrase = passphrase; }

	void setAttachments(QValueList<Attachment> attachments) { _attachments = attachments; }
	void addAttachment(Attachment attachment) { _attachments.append(attachment); }

	Account account() { return _account; }

	QString from() { return _from; }
	QString replyTo() { return _replyTo; }
	QString to() { return _to; }
	QString cc() { return _cc; }
	QString bcc() { return _bcc; }
	QString subject() { return _subject; }
	QString priority() { return _priority; }
	QString message() { return _message; }
	QString inReplyTo() { return _inReplyTo; }

	bool needsMime() { return _needsMime; }

	//bool encrypt() { return _encrypt; }
	//bool sign() { return _sign; }
	//QValueList<GpgKey> gpgReceivers() { return _receivers; }
	//QString gpgPassphrase() { return _passphrase; }

	QValueList<Attachment> attachments() { return _attachments; }

protected:
	Account _account;
	QString _from, _replyTo, _to, _cc, _bcc, _subject, _priority, _message, _inReplyTo;
	bool _needsMime;
	//bool _encrypt, _sign;
	//QValueList<GpgKey> _receivers;
	//QString _passphrase;
	QValueList<Attachment> _attachments;

};

class MailFactory : public QObject
{
	Q_OBJECT

public:
	static void genMail(QString &header, QString &message, SendMail &smail, QWidget *parent);

protected:
	MailFactory(SendMail &smail, QWidget *parent);

//	void openPgpEncrypt(const QString &text, QString &header, QString &message);
//	void openPgpSign(const QString &text, QString &header, QString &message);
//	void openPgpSignEncrypt(const QString &text, QString &header, QString &message);

	bool _abort;
	SendMail _smail;
	QWidget *_parent;
	QString _header, _body;

};

#endif