From kde-core-devel Sun Feb 27 18:09:05 2005 From: Maks Orlovich Date: Sun, 27 Feb 2005 18:09:05 +0000 To: kde-core-devel Subject: Re: kdelibs 3.4.0 BICs -- KIO::Job, KNS::DownloadDialog, KNS::Engine, Message-Id: <200502271309.05749.mo85 () cornell ! edu> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=110952775813923 On Sunday 27 February 2005 12:25, you wrote: > Am Sonntag, 27. Februar 2005 17:50 schrieb Maks Orlovich: > > KNS::DownloadDialog is incompatible due to a size change: there is an > > extra field, QString m_providerlist; > > > > Similarly, KNS::Engine adds in bool mIgnoreInstallResult; > > In both cases it should be possible to mark the new members as static. > Can this be confirmed? That would fix the BC bug, yes; but is there any risk of multiple instances of the object? An alternative is something like this: --- engine.h 21 Feb 2005 21:23:06 -0000 1.13 +++ engine.h 27 Feb 2005 18:07:48 -0000 @@ -51,6 +51,7 @@ class ProviderDialog; class KDE_EXPORT Engine : public QObject { Q_OBJECT + struct Private; public: /** Constructor. @@ -177,11 +178,9 @@ class KDE_EXPORT Engine : public QObject QString mPreviewFile; QString mProviderList; - KNewStuff *mNewStuff; + Private* d; QString mType; - - bool mIgnoreInstallResult; }; } --- engine.cpp 8 Feb 2005 09:47:41 -0000 1.22 +++ engine.cpp 27 Feb 2005 18:07:48 -0000 @@ -39,12 +39,19 @@ using namespace KNS; +struct Engine::Private +{ + bool mIgnoreInstallResult; + KNewStuff *mNewStuff; +}; + Engine::Engine( KNewStuff *newStuff, const QString &type, QWidget *parentWidget ) : mParentWidget( parentWidget ), mDownloadDialog( 0 ), mUploadDialog( 0 ), mProviderDialog( 0 ), mUploadProvider( 0 ), - mNewStuff( newStuff ), mType( type ) + d(new Private), mType( type ) { + d->mNewStuff = newStuff; mProviderLoader = new ProviderLoader( mParentWidget ); mNewStuffList.setAutoDelete( true ); @@ -55,15 +62,17 @@ Engine::Engine( KNewStuff *newStuff, con mParentWidget( parentWidget ), mDownloadDialog( 0 ), mUploadDialog( 0 ), mProviderDialog( 0 ), mUploadProvider( 0 ), - mProviderList( providerList ), mNewStuff( newStuff ), + mProviderList( providerList ), d(new Private), mType( type ) { + d->mNewStuff = newStuff; mProviderLoader = new ProviderLoader( mParentWidget ); mNewStuffList.setAutoDelete( true ); } Engine::~Engine() { + delete d; delete mProviderLoader; delete mUploadDialog; @@ -180,7 +189,7 @@ void Engine::download( Entry *entry ) kdDebug(5850) << "Engine::download(entry)" << endl; KURL source = entry->payload(); - mDownloadDestination = mNewStuff->downloadDestination( entry ); + mDownloadDestination = d->mNewStuff->downloadDestination( entry ); if ( mDownloadDestination.isEmpty() ) { kdDebug(5850) << "Empty downloadDestination. Cancelling download." << endl; @@ -205,13 +214,13 @@ void Engine::slotDownloadJobResult( KIO: return; } - if ( mNewStuff->install( mDownloadDestination ) ) { - if ( !mIgnoreInstallResult ) { + if ( d->mNewStuff->install( mDownloadDestination ) ) { + if ( !d->mIgnoreInstallResult ) { KMessageBox::information( mParentWidget, i18n("Successfully installed hot new stuff.") ); } } else - if ( !mIgnoreInstallResult ){ + if ( !d->mIgnoreInstallResult ){ KMessageBox::error( mParentWidget, i18n("Failed to install hot new stuff.") ); } @@ -266,7 +275,7 @@ void Engine::upload( Entry *entry ) mUploadFile = entry->fullName(); mUploadFile = locateLocal( "data", QString(kapp->instanceName()) + "/upload/" + mUploadFile ); - if ( !mNewStuff->createUploadFile( mUploadFile ) ) { + if ( !d->mNewStuff->createUploadFile( mUploadFile ) ) { KMessageBox::error( mParentWidget, i18n("Unable to create file to upload.") ); emit uploadFinished( false ); return; @@ -415,5 +424,5 @@ void Engine::slotUploadMetaJobResult( KI void Engine::ignoreInstallResult(bool ignore) { - mIgnoreInstallResult = ignore; + d->mIgnoreInstallResult = ignore; } Oh, and *bug*: mIgnoreInstallResult doesn't seem to be initialized in the constructor. > (I still couldn't revive my dead harddisk...) ouch.