kamail.h
00001 /* 00002 * kamail.h - email functions 00003 * Program: kalarm 00004 * Copyright © 2002-2008 by David Jarvie <djarvie@kde.org> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program; if not, write to the Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KAMAIL_H 00022 #define KAMAIL_H 00023 00024 #include <tqstring.h> 00025 #include <tqstringlist.h> 00026 class KURL; 00027 class KAEvent; 00028 class EmailAddressList; 00029 namespace KPIM { class IdentityManager; } 00030 namespace KMime { namespace Types { struct Address; } } 00031 00032 struct KAMailData; 00033 00034 00035 class KAMail 00036 { 00037 public: 00038 static bool send(const KAEvent&, TQStringList& errmsgs, bool allowNotify = true); 00039 static int checkAddress(TQString& address); 00040 static int checkAttachment(TQString& attachment, KURL* = 0); 00041 static bool checkAttachment(const KURL&); 00042 static TQString convertAddresses(const TQString& addresses, EmailAddressList&); 00043 static TQString convertAttachments(const TQString& attachments, TQStringList& list); 00044 static KPIM::IdentityManager* identityManager(); 00045 static bool identitiesExist(); 00046 static uint identityUoid(const TQString& identityUoidOrName); 00047 static TQString controlCentreAddress(); 00048 static TQString getMailBody(TQ_UINT32 serialNumber); 00049 static TQString i18n_NeedFromEmailAddress(); 00050 static TQString i18n_sent_mail(); 00051 00052 private: 00053 static KPIM::IdentityManager* mIdentityManager; // KMail identity manager 00054 static TQString sendKMail(const KAMailData&); 00055 static TQString initHeaders(const KAMailData&, bool dateId); 00056 static TQString appendBodyAttachments(TQString& message, const KAEvent&); 00057 static TQString addToKMailFolder(const KAMailData&, const char* folder, bool checkKmailRunning); 00058 static bool callKMail(const TQByteArray& callData, const TQCString& iface, const TQCString& function, const TQCString& funcType); 00059 static TQString convertAddress(KMime::Types::Address, EmailAddressList&); 00060 static void notifyQueued(const KAEvent&); 00061 static char* base64Encode(const char* in, TQIODevice::Offset size, TQIODevice::Offset& outSize); 00062 static TQStringList errors(const TQString& error = TQString(), bool sendfail = true); 00063 }; 00064 00065 #endif // KAMAIL_H