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

List:       kde-core-devel
Subject:    [PATCH] Re: kdelibs 3.4.0 BICs -- KIO::Job, KNS::DownloadDialog,
From:       Will Stephenson <lists () stevello ! free-online ! co ! uk>
Date:       2005-02-28 11:59:56
Message-ID: 200502281159.56960.lists () stevello ! free-online ! co ! uk
[Download RAW message or body]

On Monday 28 Feb 2005 11:44, Will Stephenson wrote:
> On Sunday 27 Feb 2005 18:17, Andras Mantia wrote:
> > On Sunday 27 February 2005 20:09, Maks Orlovich wrote:
> > > An alternative is something like this:
>
> <replacing a KNewStuff * with a Private * and moving the KNewStuff into the
> Private * along with the added BIC member>
>
> > If this is BC (and looks like so, nice trick!), I'd vote for it.
>
> So this is BC because it replaces one pointer with another and puts the
> extra members into the new Private struct?
>
> If I understand this correctly I'll make the same fix in KIMProxy.

Please review, unless I've got the above completely wrong.

-- 
Will Stephenson
IRC: Bille

["kimproxy_BIC_fix.diff" (text/x-diff)]

? interfaces/kimproxy/Doxyfile
? interfaces/kimproxy/kimproxy.kdevelop
? interfaces/kimproxy/kimproxy.kdevelop.pcs
? interfaces/kimproxy/kimproxy.kdevses
Index: interfaces/kimproxy/interface/kimiface.h
===================================================================
RCS file: /home/kde/kdelibs/interfaces/kimproxy/interface/kimiface.h,v
retrieving revision 1.9
diff -u -5 -d -p -r1.9 kimiface.h
--- interfaces/kimproxy/interface/kimiface.h	9 Feb 2005 12:11:10 -0000	1.9
+++ interfaces/kimproxy/interface/kimiface.h	28 Feb 2005 11:54:13 -0000
@@ -181,10 +181,15 @@ k_dcop:
 	 * @see locate     
 	 */
 	virtual bool addContact( const QString &contactId, const QString &protocol ) = 0;
 // SIGNALS
 k_dcop_signals:
+  /**
+   * Indicate that the KIMIface is ready.
+   * Doing this using appRegistered does not let us control when apps start calling \
KIMIface functions, which we may not be able to handle +   */
+  
 	/**
 	 * Indicates that a contact's presence has changed
 	 * @param uid the KABC uid whose presence changed.
 	 * @param appId the dcop application id of the program the signal originates from.
 	 * @param presence the new numeric presence @ref presenceStatus
Index: interfaces/kimproxy/library/kimproxy.cpp
===================================================================
RCS file: /home/kde/kdelibs/interfaces/kimproxy/library/kimproxy.cpp,v
retrieving revision 1.16
diff -u -5 -d -p -r1.16 kimproxy.cpp
--- interfaces/kimproxy/library/kimproxy.cpp	9 Feb 2005 12:18:08 -0000	1.16
+++ interfaces/kimproxy/library/kimproxy.cpp	28 Feb 2005 11:54:13 -0000
@@ -39,10 +39,19 @@
 
 static KStaticDeleter<KIMProxy> _staticDeleter;
 
 KIMProxy * KIMProxy::s_instance = 0L;
 
+struct KIMProxy::Private
+{
+	DCOPClient * dc;
+	// list of the strings in use by KIMIface
+	QStringList presence_strings;
+	// list of the icon names in use by KIMIface
+	QStringList presence_icons;
+};
+
 bool ContactPresenceList::update( AppPresence ap )
 {
 	if ( isEmpty() )
 	{
 		append( ap );
@@ -147,31 +156,31 @@ KIMProxy * KIMProxy::instance( DCOPClien
 	}
 	else
 		return 0L;
 }
 
-KIMProxy::KIMProxy( DCOPClient* dc ) : DCOPObject( "KIMProxyIface" ), QObject()
+KIMProxy::KIMProxy( DCOPClient* dc ) : DCOPObject( "KIMProxyIface" ), QObject(), d( \
new Private )  {
 	m_im_client_stubs.setAutoDelete( true );
 
-	m_dc = dc;
+	d->dc = dc;
 	m_initialized = false;
-	connect( m_dc, SIGNAL( applicationRemoved( const QCString& ) ) , this, SLOT( \
                unregisteredFromDCOP( const QCString& ) ) );
-	connect( m_dc, SIGNAL( applicationRegistered( const QCString& ) ) , this, SLOT( \
                registeredToDCOP( const QCString& ) ) );
-	m_dc->setNotifications( true );
+	connect( d->dc, SIGNAL( applicationRemoved( const QCString& ) ) , this, SLOT( \
unregisteredFromDCOP( const QCString& ) ) ); +	connect( d->dc, SIGNAL( \
applicationRegistered( const QCString& ) ) , this, SLOT( registeredToDCOP( const \
QCString& ) ) ); +	d->dc->setNotifications( true );
 
-	m_presence_strings.append( "Unknown" );
-	m_presence_strings.append( "Offline" );
-	m_presence_strings.append( "Connecting" );
-	m_presence_strings.append( "Away" );
-	m_presence_strings.append( "Online" );
+	d->presence_strings.append( "Unknown" );
+	d->presence_strings.append( "Offline" );
+	d->presence_strings.append( "Connecting" );
+	d->presence_strings.append( "Away" );
+	d->presence_strings.append( "Online" );
 	
-	m_presence_icons.append( "presence_unknown" );
-	m_presence_icons.append( "presence_offline" );
-	m_presence_icons.append( "presence_connecting" );
-	m_presence_icons.append( "presence_away" );
-	m_presence_icons.append( "presence_online" );
+	d->presence_icons.append( "presence_unknown" );
+	d->presence_icons.append( "presence_offline" );
+	d->presence_icons.append( "presence_connecting" );
+	d->presence_icons.append( "presence_away" );
+	d->presence_icons.append( "presence_online" );
 	
 	//QCString senderApp = "Kopete";
 	//QCString senderObjectId = "KIMIface";
 	QCString method = "contactPresenceChanged( QString, QCString, int )";
 	//QCString receiverObjectId = "KIMProxyIface";
@@ -181,11 +190,11 @@ KIMProxy::KIMProxy( DCOPClient* dc ) : D
 		KMessageBox::information( 0, QString( "Couldn't connect DCOP signal.\nWon't \
receive any status notifications!" ) );  }
 
 KIMProxy::~KIMProxy( )
 {
-	//m_dc->setNotifications( false );
+	//d->dc->setNotifications( false );
 }
 
 bool KIMProxy::initialize()
 {
 	if ( !m_initialized )
@@ -199,11 +208,11 @@ bool KIMProxy::initialize()
 	
 			// see what apps implementing our service type are out there
 			KService::List offers = KServiceType::offers( IM_SERVICE_TYPE );
 			KService::List::iterator offer;
 			typedef QValueList<QCString> QCStringList;
-			QCStringList registeredApps = m_dc->registeredApplications();
+			QCStringList registeredApps = d->dc->registeredApplications();
 			QCStringList::iterator app;
 			const QCStringList::iterator end = registeredApps.end();
 			// for each registered app
 			for ( app = registeredApps.begin(); app != end; ++app )
 			{
@@ -223,11 +232,11 @@ bool KIMProxy::initialize()
 							m_apps_available = true;
 							//kdDebug( 790 ) << " app name: " << (*offer)->name() << ", has instance " << \
*app << ", dcopService: " << dcopService << endl;  if ( !m_im_client_stubs.find( \
dcopService ) )  {
 								kdDebug( 790 ) << "App " << *app << ", dcopObjectId " << dcopObjectId << " \
                found, using it for presence info." << endl;
-								m_im_client_stubs.insert( *app, new KIMIface_stub( m_dc, *app, dcopObjectId \
) ); +								m_im_client_stubs.insert( *app, new KIMIface_stub( d->dc, *app, \
dcopObjectId ) );  pollApp( *app );
 							}
 						}
 					}
 				}
@@ -260,11 +269,11 @@ void KIMProxy::registeredToDCOP( const Q
 			// if it's not already known, insert it
 			if ( !m_im_client_stubs.find( appId ) )
 			{
 				newApp = true;
 				kdDebug( 790 ) << "App: " << appId << ", dcopService: " << dcopService << " \
                started, using it for presence info."<< endl;
-				m_im_client_stubs.insert( appId, new KIMIface_stub( m_dc, appId, dcopObjectId ) \
); +				m_im_client_stubs.insert( appId, new KIMIface_stub( d->dc, appId, \
dcopObjectId ) );  }
 		}
 		//else
 		//	kdDebug( 790 ) << "App doesn't implement our ServiceType" << endl;
 	}
@@ -339,11 +348,11 @@ QString KIMProxy::presenceString( const 
 		ap = presence.best();
 	}
 	if ( ap.appId.isEmpty() )
 		return QString::null;
 	else
-		return m_presence_strings[ ap.presence ];
+		return d->presence_strings[ ap.presence ];
 }
 
 QPixmap KIMProxy::presenceIcon( const QString& uid )
 {
 	AppPresence ap;
@@ -358,12 +367,12 @@ QPixmap KIMProxy::presenceIcon( const QS
 		//kdDebug( 790 ) << k_funcinfo << "returning a null QPixmap because we were asked \
for an icon for a uid we know nothing about" << endl;  return QPixmap();
 	}
 	else
 	{
-		//kdDebug( 790 ) << k_funcinfo << "returning this: " << m_presence_icons[ \
                ap.presence ] << endl;
-		return SmallIcon( m_presence_icons[ ap.presence ]);
+		//kdDebug( 790 ) << k_funcinfo << "returning this: " << d->presence_icons[ \
ap.presence ] << endl; +		return SmallIcon( d->presence_icons[ ap.presence ]);
 	}
 }
 
 QStringList KIMProxy::allContacts()
 {
Index: interfaces/kimproxy/library/kimproxy.h
===================================================================
RCS file: /home/kde/kdelibs/interfaces/kimproxy/library/kimproxy.h,v
retrieving revision 1.13
diff -u -5 -d -p -r1.13 kimproxy.h
--- interfaces/kimproxy/library/kimproxy.h	9 Feb 2005 12:18:08 -0000	1.13
+++ interfaces/kimproxy/library/kimproxy.h	28 Feb 2005 11:54:14 -0000
@@ -55,11 +55,11 @@ class ContactPresenceList : public QValu
 		AppPresence best();
 };
 
 //typedef QValueList<AppPresence> ContactPresenceList;
 typedef QMap<QString, ContactPresenceList> PresenceMap;
-//typedef QMap<int, QString> PresenceStringMap;
+typedef QMap<int, QString> PresenceStringMap;
 //typedef QDict<AppPresence> PresenceMap;			// uid->AppPresence; contains a \
AppPresences for all users  //typedef QMap<QCString, int> AppPresence; 		// \
appId->presence; contains all applications' ideas of a user's presence  
 /**
  * This class provides an easy-to-use interface to any instant messengers or chat \
programs @@ -82,10 +82,11 @@ typedef QMap<QString, ContactPresenceLis
  * @author Will Stephenson <lists@stevello.free-online.co.uk>
  */
 class KIMPROXY_EXPORT KIMProxy : public QObject, virtual public KIMProxyIface
 {
 	Q_OBJECT
+	struct Private;
 
 	template<class> friend class KStaticDeleter;
 	~KIMProxy();
 
 	public:
@@ -301,18 +302,16 @@ class KIMPROXY_EXPORT KIMProxy : public 
 		// appId (from DCOP) -> KIMIface_stub
 		QDict<KIMIface_stub> m_im_client_stubs;
 		// map containing numeric presence and the originating application ID for each \
KABC uid we know of  // KABC Uid -> (appId, numeric presence )(AppPresence)
 		PresenceMap m_presence_map;
-		// list of the strings in use by KIMIface
-		QStringList m_presence_strings;
-		// list of the icon names in use by KIMIface
-		QStringList m_presence_icons;
 		// cache of the client strings in use by each application
 		// dictionary of KIMIface_stub -> map of numeric presence -> string presence
-		//QPtrDict<PresenceStringMap> m_client_presence_strings;
-		DCOPClient *m_dc;
+		// UNUSED but maintained for binary compatibility in KDE 3.4
+		// FIXME: remove for KDE4
+		QPtrDict<PresenceStringMap> m_client_presence_strings;
+		Private * d;
 		bool m_apps_available;
 		bool m_initialized;
 		/**
 		 * Construct an instance of the proxy library.
 		 */



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

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