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

List:       kmail-devel
Subject:    Re: [PATCH] yet more threading fixes and fixes for search folders
From:       Till Adam <till () adam-lilienthal ! de>
Date:       2003-04-04 17:43:42
[Download RAW message or body]

On Sunday 30 March 2003 23:34, Till Adam wrote:
> On Sunday 30 March 2003 18:11, Till Adam wrote:
> > The second, searchFoldersAndImap.diff contains changes necessary to make
> > search folders work correctly with imap folders. It implements getMsg()
> > for search folders by forwarding the request to the folder of origin of
> > the message.
>
> I've extracted that part and extended it with an implementation of
> KMFolderSearch::ignoreJobsForMessage( KMMessage* msg ) which appears to be
> also needed.

New version attached. This adds updating of search folders when mail arrives 
in imap folders (when the folder the new mail arrives in is open or when it 
is opened after mail arrival). Any better way to solve this?

Till (semi-happily talking to himself ;)
["searchFoldersAndImap3.diff" (text/x-diff)]

Index: kmfolderimap.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmfolderimap.cpp,v
retrieving revision 1.89
diff -u -3 -p -w -r1.89 kmfolderimap.cpp
--- kmfolderimap.cpp	12 Mar 2003 01:45:24 -0000	1.89
+++ kmfolderimap.cpp	4 Apr 2003 17:34:56 -0000
@@ -894,6 +894,11 @@ void KMFolderImap::slotGetMessagesData(K
       open();
       KMFolderImapInherited::addMsg(msg, 0);
       close();
+      /* The above calls emitMsgAddedSignals, but since we are in quiet mode,
+         that has no effect. To get search folders to update on arrival of new
+         messages explicitely emit the signal below on its own, so the folder
+         manager realizes there is a new message. */
+      emit msgAdded(this, msg->getMsgSerNum());
       if (count() > 1) unGetMsg(count() - 1);
       mLastUid = uid;
 /*      if ((*it).total > 20 &&
Index: kmfoldersearch.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmfoldersearch.cpp,v
retrieving revision 1.17
diff -u -3 -p -w -r1.17 kmfoldersearch.cpp
--- kmfoldersearch.cpp	21 Mar 2003 10:44:19 -0000	1.17
+++ kmfoldersearch.cpp	4 Apr 2003 17:34:57 -0000
@@ -661,6 +661,33 @@ KMMsgBase* KMFolderSearch::getMsgBase(in
     return folder->getMsgBase(folderIdx);
 }
 
+//-----------------------------------------------------------------------------
+KMMessage* KMFolderSearch::getMsg(int idx)
+{
+    int folderIdx = -1;
+    KMFolder *folder = 0;
+    if (idx < 0 || (Q_UINT32)idx >= mSerNums.count())
+	return 0;
+    kernel->msgDict()->getLocation(mSerNums[idx], &folder, &folderIdx);
+    assert(folder && (folderIdx != -1));
+    KMMessage* msg = folder->getMsg( folderIdx );
+    return msg;
+}
+
+//-------------------------------------------------------------
+void
+KMFolderSearch::ignoreJobsForMessage( KMMessage* msg )
+{
+  if (!msg || msg->transferInProgress())
+    return;
+  KMAcctImap *account;
+  if ( !(account = static_cast<KMFolderImap*>(msg->parent())->account()) )
+    return;
+
+  account->ignoreJobsForMessage( msg );
+}
+
+
 int KMFolderSearch::find(const KMMsgBase* msg) const
 {
     int pos = 0;
Index: kmfoldersearch.h
===================================================================
RCS file: /home/kde/kdepim/kmail/kmfoldersearch.h,v
retrieving revision 1.11
diff -u -3 -p -w -r1.11 kmfoldersearch.h
--- kmfoldersearch.h	9 Mar 2003 13:01:42 -0000	1.11
+++ kmfoldersearch.h	4 Apr 2003 17:34:57 -0000
@@ -96,6 +96,9 @@ public:
   // Stops the current search
   void stopSearch() { if (mSearch) mSearch->stop(); }
 
+  virtual KMMessage* getMsg(int idx);
+  virtual void ignoreJobsForMessage( KMMessage* );
+
 protected slots:
   // Reads search definition for this folder and creates a KMSearch
   bool readSearch();


_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail


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

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