[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/pim/mailody
From:       Tom Albers <tomalbers () kde ! nl>
Date:       2006-11-01 22:45:33
Message-ID: 1162421133.987617.22166.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 601063 by toma:

- Change QObject to QWidget so the dialogs have a proper parent
- make sure that the to and cc headers will contain a ", " between them, so wrapping is possible.



 M  +1 -1      TODO  
 M  +8 -10     src/qmafetch.cpp  
 M  +3 -3      src/qmafetch.h  
 M  +0 -2      src/qmamailbox.cpp  
 M  +11 -6     src/qmamessage.cpp  
 M  +5 -3      src/qmamessage.h  
 M  +6 -4      src/qmamessageview.cpp  
 M  +4 -1      src/qmawidget.cpp  
 M  +0 -1      src/setupaccount.cpp  


--- trunk/playground/pim/mailody/TODO #601062:601063
@@ -9,7 +9,7 @@
 ------------------------------------
 
 Settings:
-check capabilities
+check capabilities [delayed for now]
 
 ------------------------------------
 
--- trunk/playground/pim/mailody/src/qmafetch.cpp #601062:601063
@@ -37,10 +37,11 @@
 
 QMAFetch *QMAFetch::m_instance = 0;
 
-QMAFetch::QMAFetch()
-    : QObject( 0 )
+QMAFetch::QMAFetch( QWidget* parent,  const char* name)
+    : QWidget( parent, name )
     , m_imap(0)
 {
+    m_instance = this;
     m_db = QMADB::dbinstance();
 
     reconnect();
@@ -65,9 +66,6 @@
 
 QMAFetch *QMAFetch::instance()
 {
-    if ( !m_instance )
-        m_instance = new QMAFetch();
-
     return m_instance;
 }
 
@@ -161,7 +159,7 @@
         m_readyToSend = false;
 
         emit status(i18n("Offline"));
-        int i = KMessageBox::questionYesNoCancel(0,
+        int i = KMessageBox::questionYesNoCancel(this,
                 i18n("The server refused the supplied username and password, "
                      "do you want to go to the settings, re-enter it for one "
                      "time or do nothing?"),
@@ -169,7 +167,7 @@
                 i18n("Settings"), i18n("Single Input"));
         if (i == KMessageBox::Yes)
         {
-            Setup setup(0,"Setup");
+            Setup setup(this,"Setup");
             if (setup.exec() != QDialog::Accepted)
                 return;
             slotLogin();
@@ -188,7 +186,7 @@
     }
     else if (received.find("a02 NO") != -1 || received.find("a02 BAD") != -1)
     {
-        KMessageBox::information(0,
+        KMessageBox::information(this,
             i18n("The server reported: %1\nThe command was: %2")
                 .arg(received.mid(7).stripWhiteSpace(),
                      m_currentQueueItem.command()));
@@ -197,7 +195,7 @@
     }
     else if (received.find("[ALERT]") != -1)
     {
-        KMessageBox::information(0,
+        KMessageBox::information(this,
             i18n("Server reported: %1")
                 .arg(received.mid(received.find("[ALERT]")+7)));
         m_currentQueueItem=Queue();
@@ -638,7 +636,7 @@
     }
 
     emit status(i18n("Offline"));
-    KMessageBox::information(0,error);
+    KMessageBox::information(this,error);
 }
 
 void QMAFetch::reconnect()
--- trunk/playground/pim/mailody/src/qmafetch.h #601062:601063
@@ -21,7 +21,7 @@
 #ifndef QMAFETCH_H
 #define QMAFETCH_H
 
-#include "qobject.h"
+#include "qwidget.h"
 class QSocket;
 class QMADB;
 
@@ -68,7 +68,7 @@
  * database.
  * @author Tom Albers <tomalbers@kde.nl>
  */
-class QMAFetch : public QObject
+class QMAFetch : public QWidget
 {
   Q_OBJECT
 
@@ -76,7 +76,7 @@
     /**
      * Contructor
      */
-      QMAFetch();
+      QMAFetch( QWidget* parent,  const char* name );
 
     /**
      * Destructor
--- trunk/playground/pim/mailody/src/qmamailbox.cpp #601062:601063
@@ -21,10 +21,8 @@
 #include <qdragobject.h>
 #include <qtimer.h>
 #include <klistview.h>
-#include <klistview.h>
 #include <klocale.h>
 #include <kdebug.h>
-#include <knotifyclient.h>
 
 class QMAMailbox;
 #include "qmamailbox.h"
--- trunk/playground/pim/mailody/src/qmamessage.cpp #601062:601063
@@ -35,8 +35,9 @@
 #include "qmawidget.h" // myEmail()
 #include "qmamessage.h"
 
-QMAMessage::QMAMessage( int uid, const QString& mb  )
-    : QObject(0)
+QMAMessage::QMAMessage( QWidget* parent,  const char* name,
+                        int uid, const QString& mb  )
+    : QWidget(parent, name)
 {
     m_db = QMADB::dbinstance();
 
@@ -48,9 +49,10 @@
     initialise();
 }
 
-QMAMessage::QMAMessage( int uid, const QString& mb,
+QMAMessage::QMAMessage( QWidget* parent,  const char* name,
+                        int uid, const QString& mb,
                         const QString& headers)
-    : QObject(0)
+    : QWidget(parent, name)
 {
     m_db = QMADB::dbinstance();
 
@@ -63,7 +65,6 @@
 
 QMAMessage::~QMAMessage()
 {
-    delete m_db;
 }
 
 void QMAMessage::initialise()
@@ -89,7 +90,8 @@
     for (it = headerlist.begin(); it != headerlist.end(); ++it)
     {
         if ((*it).startsWith("Subject", false))
-            m_subject = decodeRFC2047String((*it).section(' ',1).stripWhiteSpace());
+            m_subject =
+                    decodeRFC2047String((*it).section(' ',1).stripWhiteSpace());
         else if ((*it).startsWith("From", false))
         {
             QString t = (*it).section(' ',1).stripWhiteSpace();
@@ -135,6 +137,9 @@
 {
     m_bodyType = i;
     QMAFetch* t = QMAFetch::instance();
+    if (!t)
+        t = new QMAFetch(this, "connection");
+
     connect(t, SIGNAL(bodyAvailable()), this, SLOT(slotBodyReady()));
     t->getBody(m_uid, m_mb);
 }
--- trunk/playground/pim/mailody/src/qmamessage.h #601062:601063
@@ -38,7 +38,7 @@
  * This is het main class
  * @author Tom Albers <tomalbers@kde.nl>
  */
-class QMAMessage : public QObject
+class QMAMessage : public QWidget
 {
     Q_OBJECT
 
@@ -46,8 +46,10 @@
     /**
      * Contructor
      */
-      QMAMessage( int uid, const QString& mb );
-      QMAMessage( int uid, const QString& mb, const QString& headers);
+      QMAMessage( QWidget* parent,  const char* name,
+                  int uid, const QString& mb );
+      QMAMessage( QWidget* parent,  const char* name,
+                  int uid, const QString& mb, const QString& headers);
 
     /**
      * Destructor
--- trunk/playground/pim/mailody/src/qmamessageview.cpp #601062:601063
@@ -156,7 +156,9 @@
         m_sender->setPaletteForegroundColor(paletteForegroundColor());
 
     m_subject->setText(m_currentMessage->subject());
-    m_to->setText(m_currentMessage->to());
+    QStringList* to = m_currentMessage->to_list();
+    if ((*to).count()>0)
+        m_to->setText((*to).join(", "));
 
     // copied from KMail...
     QString photoURL;
@@ -194,10 +196,10 @@
     else
         m_foto->setText("&nbsp;");
 
-    QString cc = m_currentMessage->cc();
-    if (!cc.isEmpty())
+    QStringList* cc = m_currentMessage->cc_list();
+    if ((*cc).count()>0)
     {
-        m_cc_data->setText(cc);
+        m_cc_data->setText((*cc).join(", "));
         m_layout->addWidget( m_cc, 3, 0 );
         m_layout->addWidget( m_cc_data, 3, 1 );
         m_cc->show();
--- trunk/playground/pim/mailody/src/qmawidget.cpp #601062:601063
@@ -109,6 +109,9 @@
 
     d->db = QMADB::dbinstance();
     d->connection = QMAFetch::instance();
+    if (!d->connection)
+        d->connection = new QMAFetch(this, "connection");
+
     connect(d->connection, SIGNAL(mailBoxListUpdated()),
             SLOT(slotPopulateMailBoxList()));
     connect(d->connection, SIGNAL(headersAvailable( const QStringList& )),
@@ -509,7 +512,7 @@
         QMAHeaders* exists = d->headerMap[uid];
         if (!exists ||  mbi->fullName() != "All")
         {
-            QMAMessage* r = new QMAMessage(uid, mb, headers);
+            QMAMessage* r = new QMAMessage(this, "message", uid, mb, headers);
             exists = new QMAHeaders(d->headerList, r);
             d->headerMap[uid] = exists;
         }
--- trunk/playground/pim/mailody/src/setupaccount.cpp #601062:601063
@@ -193,7 +193,6 @@
 {
     KConfig* config = kapp->config();
     KUser* currentUser = new KUser();
-
     KEMailSettings esetting;
 
     config->setGroup("General");
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic