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

List:       kde-core-devel
Subject:    knode patch
From:       Christian Gebauer <gebauer () bigfoot ! com>
Date:       2000-09-19 2:06:39
[Download RAW message or body]

Hi,

This patch is a fix for #10865, when we unsubscribe from a group
we have to close all external article windows that show articles
from this group. We have to do the same when expiring.
The composer windows are fine, we already have a check there.

Christian
-- 
>><< Christian Gebauer >><< gebauer@bigfoot.com >><< ICQ 14916141 >><<
["extWin.patch" (text/plain)]

Index: knarticlewindow.h
===================================================================
RCS file: /home/kde/kdenetwork/knode/knarticlewindow.h,v
retrieving revision 1.9
diff -u -3 -p -r1.9 knarticlewindow.h
--- knarticlewindow.h	2000/09/16 20:47:05	1.9
+++ knarticlewindow.h	2000/09/19 02:06:10
@@ -37,11 +37,14 @@ class KNArticleWindow : public KMainWind
     KNArticleWidget* artWidget()        { return artW; }
 
     virtual QSize sizeHint() const;   // useful default value
+
+    static void closeAllWindowsForCollection(KNArticleCollection *col);
       
   protected:
     KNArticleWidget *artW;
     KAction *actPostReply, *actMailReply, *actForward, *actCancel, *actSupersede;
     KToggleAction *actShowToolbar;
+    static QList<KNArticleWindow> instances;
     
   protected slots:
     void slotArticleLoaded();
Index: knarticlewindow.cpp
===================================================================
RCS file: /home/kde/kdenetwork/knode/knarticlewindow.cpp,v
retrieving revision 1.20
diff -u -3 -p -r1.20 knarticlewindow.cpp
--- knarticlewindow.cpp	2000/09/16 20:47:05	1.20
+++ knarticlewindow.cpp	2000/09/19 02:06:10
@@ -31,10 +31,25 @@
 #include "knode.h"
 #include "knarticlewindow.h"
 
+QList<KNArticleWindow> KNArticleWindow::instances;
 
+
+void KNArticleWindow::closeAllWindowsForCollection(KNArticleCollection *col)
+{
+  QList<KNArticleWindow> list=instances;
+  for(KNArticleWindow *i=list.first(); i; i=list.next())
+    if(i->artW->collection()==col)
+      i->close();
+}
+
+
+//==================================================================================
+
 KNArticleWindow::KNArticleWindow(KNArticle *art, KNArticleCollection *col)
   : KMainWindow(0, "articleWindow")
 {
+  instances.append(this);
+
   if(art)
     setCaption(art->subject());
   //setIcon(UserIcon("posting"));
@@ -85,6 +100,7 @@ KNArticleWindow::KNArticleWindow(KNArtic
 
 KNArticleWindow::~KNArticleWindow()
 {
+  instances.removeRef(this);
 }
 
 
@@ -179,10 +195,7 @@ void KNArticleWindow::slotConfToolbar()
 {
   KEditToolbar *dlg = new KEditToolbar(guiFactory(),this);
   if (dlg->exec()) {
-    //guiFactory()->removeClient(artW->part());
-    createGUI("knreaderui.rc",false);
-    //guiFactory()->addClient(artW->part());
-    conserveMemory();
+    createGUI("knreaderui.rc");
   }
   delete dlg;
 }
Index: kngroupmanager.cpp
===================================================================
RCS file: /home/kde/kdenetwork/knode/kngroupmanager.cpp,v
retrieving revision 1.24
diff -u -3 -p -r1.24 kngroupmanager.cpp
--- kngroupmanager.cpp	2000/09/18 22:16:34	1.24
+++ kngroupmanager.cpp	2000/09/19 02:06:10
@@ -42,6 +42,7 @@
 #include "knglobals.h"
 #include "resource.h"
 #include "utilities.h"
+#include "knarticlewindow.h"
 #include "kngroupmanager.h"
 
 
@@ -337,6 +338,7 @@ void KNGroupManager::expireAll(KNPurgePr
       dlg->setInfo(var->groupname());
       kapp->processEvents();
     }
+    KNArticleWindow::closeAllWindowsForCollection(var);
     cup.group(var);
     kdDebug() << var->groupname() << " => " << cup.deleted() << " expired , " << \
cup.left() << " left" << endl;  if(dlg) dlg->progress();
@@ -418,6 +420,8 @@ void KNGroupManager::unsubscribeGroup(KN
     return;
   }
 
+  KNArticleWindow::closeAllWindowsForCollection(g);
+
   acc=g->account();
   
   QDir dir(acc->path(),g->groupname()+"*");
@@ -430,7 +434,7 @@ void KNGroupManager::unsubscribeGroup(KN
         ++it;
       }
     }
-    kdDebug(5003) << "Files deleted!\n" << endl;
+    kdDebug(5003) << "Files deleted!" << endl;
     
     if(c_urrentGroup==g) setCurrentGroup(0);
     
@@ -468,6 +472,9 @@ void KNGroupManager::expireGroupNow(KNGr
 {
   if(!g) g=c_urrentGroup;
   if(!g) return;
+
+  KNArticleWindow::closeAllWindowsForCollection(g);
+
   KNCleanUp cup;
   cup.group(g, true);
   kdDebug(5003) << "KNExpire: " << g->groupname() << " => " << cup.deleted() << " \
expired , " << cup.left() << " left" << endl;



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

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