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

List:       kde-commits
Subject:    KDE/kdepim/views/conversationview
From:       Aron Boström <c02ab () efd ! lth ! se>
Date:       2006-07-13 10:00:11
Message-ID: 1152784811.862858.6755.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 561796 by bostrom:

SoC
Refactor.
Prepare for automatic grouping of messages into conversations.



 M  +2 -2      dummykonadiadapter.cpp  
 M  +12 -2     foldermodel.cpp  
 M  +2 -7      foldermodel.h  
 M  +0 -3      main.cpp  


--- trunk/KDE/kdepim/views/conversationview/dummykonadiadapter.cpp #561795:561796
@@ -35,10 +35,10 @@
   model->insertMessage(msg);
 
   msg = new Message();
-  msg->setSubject("My first post!");
+  msg->setSubject("Re: My first post!");
   msg->setAuthor("Aron Bostrom");
   msg->setContent("Great! Welcome along.");
-  msg->setArrivalTime(QDateTime(QDate(2006, 6, 23), QTime(17, 20)));
+  msg->setArrivalTime(QDateTime(QDate::currentDate(), \
QTime::currentTime()).addDays(-2).addSecs(-(7*3600+807)));  msg->markAs(true);
   model->insertMessage(msg);
 
--- trunk/KDE/kdepim/views/conversationview/foldermodel.cpp #561795:561796
@@ -79,11 +79,21 @@
 void FolderModel::insertMessage(Message *m)
 {
   emit layoutAboutToBeChanged();
-  m_conversations.push_front(new Conversation(m_me, m));
-  insertRows(0, 1);
+  Conversation *c = findConversation(m);
+  if (c == 0) {
+    m_conversations.push_front(new Conversation(m_me, m));
+    insertRows(0, 1);
+  } else {
+    c->addMessage(m);
+  }
   emit layoutChanged();
 }
 
+Conversation* FolderModel::findConversation(const Message *m) const
+{
+  return 0;
+}
+
 bool FolderModel::insertRows(int row, int count, const QModelIndex& parent)
 {
   emit beginInsertRows(parent, 0, 0);
--- trunk/KDE/kdepim/views/conversationview/foldermodel.h #561795:561796
@@ -38,10 +38,7 @@
    * Constructs an empty FolderModel.
    * @param listOfMe is a set of aliases for the user. This model takes ownership of \
                this parameter.
    */
-  FolderModel(QStringList *listOfMe, QObject *parent = 0) : \
                QAbstractItemModel(parent), m_me(listOfMe) 
-  {
-    QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex&, int, int)), this, \
                SLOT(slotDebug(const QModelIndex, int, int)));
-  }
+  FolderModel(QStringList *listOfMe, QObject *parent = 0) : \
QAbstractItemModel(parent), m_me(listOfMe) {}  ~FolderModel() 
   { 
     Conversation *tmp;
@@ -64,10 +61,8 @@
    */
   void insertMessage(Message *m);
   bool insertRows(int /*row*/, int /*count*/, const QModelIndex& parent = \
QModelIndex()); +  Conversation* findConversation(const Message *m) const;
 
-public slots:
-  void slotDebug(const QModelIndex &/*parent*/, int start, int end) const { qDebug() \
                << start << end; }
-
 private:
   QList<Conversation*> m_conversations;
   QStringList *m_me;
--- trunk/KDE/kdepim/views/conversationview/main.cpp #561795:561796
@@ -95,15 +95,12 @@
   ConversationWidget *cWidget = new ConversationWidget(cView);
   DummyKonadiAdapter *data = new DummyKonadiAdapter(model);
 
-
-
 //  QItemSelectionModel *selection = new QItemSelectionModel(proxyModel);
 //  cView->setSelectionModel(selection);
 
   QObject::connect(cView, SIGNAL(clicked(const QModelIndex&)), mail, \
SLOT(setConversation(const QModelIndex)));  QObject::connect(cView, \
SIGNAL(activated(const QModelIndex&)), mail, SLOT(setConversation(const \
QModelIndex)));  QObject::connect(splitter, SIGNAL(splitterMoved(int, int)), cView, \
                SLOT(updateWidth(int, int)));
-//  QObject::connect(model, SIGNAL(rowsInserted(const QModelIndex&, int, int)), \
proxyModel, SLOT(clear()));  
   splitter->addWidget(cWidget);
   splitter->addWidget(mail);


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

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