[kmobiletools] KDE/kdepim/kmobiletools/kmobiletools/libkmobiletools

Marco Gulino marco at kmobiletools.org
Wed Jun 20 20:30:40 CEST 2007


SVN commit 678123 by gulino:

Start porting SMS to KMime::Content.
@TODO: port all other data (from/to,date,slots) as headers.


 M  +1 -1      CMakeLists.txt  
 M  +10 -9     sms.cpp  
 M  +2 -1      sms.h  


--- trunk/KDE/kdepim/kmobiletools/kmobiletools/libkmobiletools/CMakeLists.txt #678122:678123
@@ -47,7 +47,7 @@
 
 kde4_add_library(kmobiletools SHARED ${kmobiletools_LIB_SRCS})
 
-target_link_libraries(kmobiletools akonadi ${KDE4_KDECORE_LIBS} ${KDE4_KHTML_LIBS} ${KDE4_THREADWEAVER_LIBRARY} ${KDE4_KABC_LIBS} ${KDE4_KCAL_LIBS})
+target_link_libraries(kmobiletools kmime akonadi ${KDE4_KDECORE_LIBS} ${KDE4_KHTML_LIBS} ${KDE4_THREADWEAVER_LIBRARY} ${KDE4_KABC_LIBS} ${KDE4_KCAL_LIBS})
 
 set_target_properties(kmobiletools PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
 install(TARGETS kmobiletools DESTINATION ${LIB_INSTALL_DIR} )
--- trunk/KDE/kdepim/kmobiletools/kmobiletools/libkmobiletools/sms.cpp #678122:678123
@@ -38,7 +38,7 @@
         i_folder(0), i_slot(0), i_type(SMS::All), b_unread(false)
         { parent=p_parent; }
     QStringList sl_numbers;
-    QString s_text;
+//     QString s_text;
     QDateTime dt_datetime;
     int i_folder;
     int i_slot;
@@ -52,19 +52,20 @@
     {
         KMD5 context;
         QByteArray ba;
-        if ( sl_numbers.isEmpty()) ba = s_text.toUtf8();
-        else ba = ( s_text + sl_numbers.join(",")).toUtf8();
+        if ( sl_numbers.isEmpty()) ba = parent->body();
+        else ba = ( parent->getText() + sl_numbers.join(",")).toUtf8();
         context.update(ba);
 //         s_uid=QString(context.hexDigest() );
     }
 };
 
-SMS::SMS() : d(new SMSPrivate(this) )
+SMS::SMS() : KMime::Content(),
+    d(new SMSPrivate(this) )
 {
 }
 
 SMS::SMS(const QStringList & numbers, const QString & text, const QDateTime & datetime)
- : d(new SMSPrivate(this) )
+ : KMime::Content(), d(new SMSPrivate(this) )
 {
     setNumbers(numbers);
     setText(text);
@@ -77,7 +78,7 @@
 }
 
 SMS::SMS(const QStringList & numbers, const QString & text)
- : d(new SMSPrivate(this) )
+ : KMime::Content(), d(new SMSPrivate(this) )
 {
     setNumbers(numbers);
     setText(text);
@@ -179,7 +180,7 @@
 QStringList SMS::getMultiText() const
 {
     ((SMSPrivate*)d.data() )->refreshUid(); /// @TODO move this to the single setters?
-    return getMultiText(d->s_text);
+    return getMultiText(getText() );
 }
 
 
@@ -295,8 +296,8 @@
     return true;
 }
 
-void SMS::setText(const QString & text) { d->s_text=text; }
-QString SMS::getText() const { return d->s_text; }
+void SMS::setText(const QString & text) { setBody(text.toUtf8()); }
+QString SMS::getText() const { return QString(body() ); }
 QString SMS::getDate() const { return d->dt_datetime.toString(); }
 QDateTime SMS::getDateTime() const { return d->dt_datetime; }
 void SMS::setRawSlot(const QString &rawSlot){ d->s_rawSlot=rawSlot;}
--- trunk/KDE/kdepim/kmobiletools/kmobiletools/libkmobiletools/sms.h #678122:678123
@@ -21,6 +21,7 @@
 #define SMS_H
 
 #include <libkmobiletools/kmobiletools_export.h>
+#include <kmime/kmime_content.h>
 
 #include <QtCore/QObject>
 #include <QtCore/QStringList>
@@ -31,7 +32,7 @@
 */
 
 class SMSPrivate;
-class KMOBILETOOLS_EXPORT SMS
+class KMOBILETOOLS_EXPORT SMS : public KMime::Content
 {
 public:
     SMS();


More information about the kmobiletools mailing list