kmobiletools
sms.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 #ifndef SMS_H
00021 #define SMS_H
00022
00023 #include <libkmobiletools/kmobiletools_export.h>
00024 #include <kmime/kmime_content.h>
00025 #include <kmime/kmime_headers.h>
00026
00027 #include <QtCore/QObject>
00028 #include <QtCore/QStringList>
00029 #include <kdatetime.h>
00034 class SMSPrivate;
00035 class SenderPrivate;
00036 class DestinationPrivate;
00037 namespace KMobileTools {
00038 typedef QHash<QString,QString> PhoneNumbers;
00039
00040 class KMOBILETOOLS_EXPORT Sender : public KMime::Headers::Generics::Structured
00041 {
00042 public:
00043 Sender();
00044 virtual ~Sender();
00045 virtual const char *type() const;
00046 virtual void addNumber(const QString &number, const QString &displayname=QString() );
00047 virtual void clear();
00048 virtual bool isEmpty() const;
00049 virtual bool parse(const char *&scursor, const char *const send, bool isCRLF=false);
00050 virtual QByteArray as7BitString(bool withHeaderType=true) const;
00051 PhoneNumbers phoneNumbers() const;
00052 private:
00053 SenderPrivate *const d;
00054 };
00055 class KMOBILETOOLS_EXPORT Destination : public Sender
00056 {
00057 public:
00058 Destination();
00059 virtual const char *type() const;
00060 private:
00061 DestinationPrivate *const d;
00062 };
00063
00064 class KMOBILETOOLS_EXPORT SMS : public KMime::Content
00065 {
00066 public:
00075 enum MemorySlot { Phone = 0x01, Sim = 0x02, DataCard = 0x04, Unknown = 0x08 };
00076
00077 Q_DECLARE_FLAGS(MemorySlots, MemorySlot)
00078
00079 SMS();
00080 KDE_CONSTRUCTOR_DEPRECATED SMS(const QStringList & numbers, const QString & text);
00081 KDE_CONSTRUCTOR_DEPRECATED SMS(const QStringList & numbers, const QString & text, const KDateTime & datetime);
00082
00083 virtual ~SMS();
00084
00085 enum SMSType
00086 { Unread=0x1, Read=0x2, Unsent=0x4, Sent=0x8, All=0xA };
00087 static QString SMSTypeString(SMSType smstype);
00088
00089 static SMSType SMSIntType (const QString& type);
00090
00091 bool isIncoming() const;
00092 void setText(const QString & text);
00093 virtual QString getText() const;
00094 virtual QStringList getMultiText() const;
00095 static QStringList getMultiText(const QString&);
00096 static int getMultiTextCount(const QString&);
00097 static int getMultiTextCount(int);
00098
00099 virtual KDE_DEPRECATED QString getFrom() const;
00100 virtual QStringList getTo() const;
00101 void KDE_DEPRECATED setNumbers(const QStringList & numbers);
00102 virtual QString getDate() const;
00103 virtual KDateTime getDateTime() const;
00104 virtual void setRawSlot(const QString &rawSlot);
00105 virtual QString rawSlot() const;
00106 void setDateTime(const KDateTime & datetime);
00107
00108 void KDE_DEPRECATED setFolder( int newFolder );
00109 int KDE_DEPRECATED folder() const;
00110 QList<int> *idList();
00111
00112
00113 void KDE_DEPRECATED setSlot( int newSlot );
00114 SMSType type() const;
00115 void setType( SMSType newType );
00116 int slot() const;
00117 QString uid() const;
00118 bool operator ==(SMS* compSMS);
00119 bool unread() const;
00120 void setUnread(bool unread);
00121 bool writeToSlot( const QString &slotDir);
00122 bool exportMD(const QString &dir);
00123 bool exportCSV(const QString &filename);
00124 bool writeToSlotCSV( const QString &filename);
00125
00126
00127 KMime::Headers::Date *date() const;
00128 Sender *sender() const;
00129 Destination *destination() const;
00130
00131 void setSender(const QString& number, const QString &displayname=QString() );
00132 void addDestination(const QString& number, const QString &displayname=QString() );
00133
00134 protected:
00135 virtual QByteArray assembleHeaders();
00136
00137 private:
00138 SMSPrivate *const d;
00140
00141
00142
00143
00144 };
00145 }
00146
00147 Q_DECLARE_OPERATORS_FOR_FLAGS(KMobileTools::SMS::MemorySlots)
00148
00149 #endif