kalarm
kamail.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KAMAIL_H
00022 #define KAMAIL_H
00023
00024 #include <QObject>
00025 #include <QString>
00026 #include <QStringList>
00027 #include <QQueue>
00028
00029 #include "alarmevent.h"
00030
00031 class KUrl;
00032 class KJob;
00033 class DateTime;
00034 class EmailAddressList;
00035 namespace KPIMIdentities { class IdentityManager; }
00036 namespace MailTransport { class TransportJob; }
00037 namespace KMime { namespace Types { struct Address; } }
00038
00039
00040 class KAMail : public QObject
00041 {
00042 Q_OBJECT
00043 public:
00044
00045
00046 struct JobData
00047 {
00048 JobData() {}
00049 JobData(KAEvent& e, const KAAlarm& a, bool resched, bool notify)
00050 : event(e), alarm(a), reschedule(resched), allowNotify(notify), queued(false) {}
00051 KAEvent event;
00052 KAAlarm alarm;
00053 QString from, bcc;
00054 bool reschedule;
00055 bool allowNotify;
00056 bool queued;
00057 };
00058
00059 static int send(JobData&, QStringList& errmsgs);
00060 static int checkAddress(QString& address);
00061 static int checkAttachment(QString& attachment, KUrl* = 0);
00062 static bool checkAttachment(const KUrl&);
00063 static QString convertAddresses(const QString& addresses, EmailAddressList&);
00064 static QString convertAttachments(const QString& attachments, QStringList& list);
00065 static KPIMIdentities::IdentityManager* identityManager();
00066 static bool identitiesExist();
00067 static uint identityUoid(const QString& identityUoidOrName);
00068 static QString controlCentreAddress();
00069 #ifdef KMAIL_SUPPORTED
00070 static QString getMailBody(quint32 serialNumber);
00071 #endif
00072 static QString i18n_NeedFromEmailAddress();
00073 static QString i18n_sent_mail();
00074
00075 private slots:
00076 void slotEmailSent(KJob*);
00077
00078 private:
00079 KAMail() {}
00080 static KAMail* instance();
00081 static QString appendBodyAttachments(QString& message, const KAEvent&);
00082 #ifdef KMAIL_SUPPORTED
00083 static QString addToKMailFolder(const JobData&, const char* folder, bool checkKmailRunning);
00084 #endif
00085 static QString convertAddress(KMime::Types::Address, EmailAddressList&);
00086 static void notifyQueued(const KAEvent&);
00087 enum ErrType { SEND_FAIL, SEND_ERROR, COPY_ERROR };
00088 static QStringList errors(const QString& error = QString(), ErrType = SEND_FAIL);
00089
00090 static KAMail* mInstance;
00091 static QQueue<MailTransport::TransportJob*> mJobs;
00092 static QQueue<JobData> mJobData;
00093 static KPIMIdentities::IdentityManager* mIdentityManager;
00094 };
00095
00096 #endif // KAMAIL_H