--Boundary-00=_JlUD/DxHGfeunpt Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, Here is a patch against the implementation of the KopeteView behaviour handling. The messages for activating and destroying the views as been moved to KMMF. This avoid to make some *_cast in the plugins, and make the KMMF handling the whole KopeteView life cycle. I commented the signals virtual entries in the KopeteView as this is a design mistake. (Signals should not be accessible from the outside of the class). But it should be left there for KopeteView devloppers. I don't used the connect(obj,SIGNAL(),obj,SIGNAL()) trick to allow some getActiveView user to implement it in the new code. This would allow to remore the current getActiveView "ugly workaround". Comments are welcome! --Boundary-00=_JlUD/DxHGfeunpt Content-Type: text/x-diff; charset="us-ascii"; name="kopeteview.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kopeteview.diff" Index: libkopete/kopetemessagemanagerfactory.cpp =================================================================== RCS file: /home/kde/kdenonbeta/kopete/libkopete/kopetemessagemanagerfactory.cpp,v retrieving revision 1.54 diff -u -3 -p -B -w -r1.54 kopetemessagemanagerfactory.cpp --- libkopete/kopetemessagemanagerfactory.cpp 30 Jun 2003 09:29:48 -0000 1.54 +++ libkopete/kopetemessagemanagerfactory.cpp 10 Jul 2003 11:00:54 -0000 @@ -18,6 +18,8 @@ #include "kopetemessagemanagerfactory.h" #include + +#include "ui/kopeteview.h" #include "kopetecontact.h" @@ -155,10 +157,33 @@ KopeteView * KopeteMessageManagerFactory kdDebug(14010) << k_funcinfo << "View not successfuly created" << endl; return 0L; } + + QObject *viewObject = dynamic_cast(newView); + if(viewObject) + { + connect(viewObject, SIGNAL(activated(KopeteView *)), + this, SLOT(slotActivatedView(KopeteView *))); + connect(viewObject, SIGNAL(closing(KopeteView *)), + this, SLOT(slotClosingView(KopeteView *))); + } + else + { + kdWarning(14010) << "Failed to cast view to QObject *" << endl; + } + emit viewCreated( newView ) ; return newView; } +void KopeteMessageManagerFactory::slotActivatedView(KopeteView *view) +{ + emit activatedView(view); +} + +void KopeteMessageManagerFactory::slotClosingView(KopeteView *view) +{ + emit closingView(view); +} #include "kopetemessagemanagerfactory.moc" Index: libkopete/kopetemessagemanagerfactory.h =================================================================== RCS file: /home/kde/kdenonbeta/kopete/libkopete/kopetemessagemanagerfactory.h,v retrieving revision 1.33 diff -u -3 -p -B -w -r1.33 kopetemessagemanagerfactory.h --- libkopete/kopetemessagemanagerfactory.h 4 Jul 2003 13:08:58 -0000 1.33 +++ libkopete/kopetemessagemanagerfactory.h 10 Jul 2003 11:00:55 -0000 @@ -134,6 +134,17 @@ signals: * A new view has been created */ void viewCreated( KopeteView * ); + + /** + * A view as been activated(manually only?). + */ + void activatedView( KopeteView *view ); + + /* + * A view is about to close. + */ + void closingView( KopeteView *view ); + /** * a new KMM has been created */ @@ -153,6 +164,10 @@ signals: * obsolete temporary method used by the spellchecking plugin (ugly workaround) */ void getActiveView(KopeteView*& ); public: void activeView(KopeteView*&v) { emit getActiveView(v); } + +private slots: + void slotActivatedView(KopeteView *view); + void slotClosingView(KopeteView *view); private: KopeteMessageManagerFactory( QObject* parent = 0, const char* name = 0 ); Index: libkopete/ui/kopeteview.h =================================================================== RCS file: /home/kde/kdenonbeta/kopete/libkopete/ui/kopeteview.h,v retrieving revision 1.7 diff -u -3 -p -B -w -r1.7 kopeteview.h --- libkopete/ui/kopeteview.h 3 Jul 2003 11:19:58 -0000 1.7 +++ libkopete/ui/kopeteview.h 10 Jul 2003 11:00:55 -0000 @@ -133,17 +133,17 @@ class KopeteView * The window remains open until the KopeteMessageManager::messageSentSuccessfully() * signal is emitted */ - virtual void messageSent( KopeteMessage & ) = 0; +// virtual void messageSent( KopeteMessage & ) = 0; /** * SIGNAL Emitted when the view is closing. */ - virtual void closing( KopeteView * ) = 0; +// virtual void closing( KopeteView * ) = 0; /** * SIGNAL Emitted when the view is activated ( raised by the user ) */ - virtual void activated( KopeteView * ) = 0; +// virtual void activated( KopeteView * ) = 0; protected: --Boundary-00=_JlUD/DxHGfeunpt Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kopete-devel mailing list Kopete-devel@mail.kde.org http://mail.kde.org/mailman/listinfo/kopete-devel --Boundary-00=_JlUD/DxHGfeunpt--