--nextPart18395556.uraA4bOHnf Content-Type: multipart/mixed; boundary="Boundary-01=_KAU1CVO2fcsKAys" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_KAU1CVO2fcsKAys Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello, Could someone review the attached patch? It basically adds a warning() signal to Job class, and allow to avoid Job=20 instances to display themselves warning messages. The resulting message box= =20 was crashing forwarding ioslaves. Moreover ForwardingSlaveBase class is modified to forward the new warning()= =20 signal coming from Job instances. It is needed in order to close BR:105369 I wait approval before committing. Regards. =2D-=20 K=E9vin 'ervin' Ottens, http://ervin.ipsquad.net "Ni le ma=EEtre sans disciple, Ni le disciple sans ma=EEtre, Ne font reculer l'ignorance." --Boundary-01=_KAU1CVO2fcsKAys Content-Type: text/x-diff; charset="iso-8859-15"; name="forward_warnings.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="forward_warnings.diff" Index: kio/kio/jobclasses.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- kio/kio/jobclasses.h (revision 433385) +++ kio/kio/jobclasses.h (working copy) @@ -178,6 +178,30 @@ bool isAutoErrorHandlingEnabled() const; =20 /** + * Enable or disable the automatic warning handling. When automatic + * warning handling is enabled and an error occurs, then a message= box + * is displayed with the warning message + * + * The default is true. + * + * See also isAutoWarningHandlingEnabled , showErrorDialog + * + * @param enable enable or disable automatic warning handling + * @see isAutoWarningHandlingEnabled() + * @since 3.5 + */ + void setAutoWarningHandlingEnabled( bool enable ); + + /** + * Returns whether automatic warning handling is enabled or disabl= ed. + * See also setAutoWarningHandlingEnabled . + * @return true if automatic warning handling is enabled + * @see setAutoWarningHandlingEnabled() + * @since 3.5 + */ + bool isAutoWarningHandlingEnabled() const; + + /** * Enable or disable the message display from the job. * * The default is true. @@ -319,6 +343,14 @@ // KDE4: Separate rich-text string from plain-text string, for dif= ferent widgets. =20 /** + * Emitted to display a warning about this job, as sent by the sla= ve. + * @param job the job that emitted this signal + * @param msg the info message + */ + void warning( KIO::Job *job, const QString & msg ); + // KDE4: Separate rich-text string from plain-text string, for dif= ferent widgets. + + /** * Emitted when the slave successfully connected to the host. * There is no guarantee the slave will send this, and this is * currently unused (in the applications). Index: kio/kio/job.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- kio/kio/job.cpp (revision 433777) +++ kio/kio/job.cpp (working copy) @@ -81,11 +81,13 @@ class Job::JobPrivate { public: =2D JobPrivate() : m_autoErrorHandling( false ), m_interactive( true ), = m_parentJob( 0L ), m_extraFlags(0), + JobPrivate() : m_autoErrorHandling( false ), m_autoWarningHandling( tr= ue ), + m_interactive( true ), m_parentJob( 0L ), m_extraFlags(= 0), m_processedSize(0) {} =20 bool m_autoErrorHandling; + bool m_autoWarningHandling; bool m_interactive; QGuardedPtr m_errorParentWidget; // Maybe we could use the QObject parent/child mechanism instead @@ -314,6 +316,16 @@ return d->m_autoErrorHandling; } =20 +void Job::setAutoWarningHandlingEnabled( bool enable ) +{ + d->m_autoWarningHandling =3D enable; +} + +bool Job::isAutoWarningHandlingEnabled() const +{ + return d->m_autoWarningHandling; +} + void Job::setInteractive(bool enable) { d->m_interactive =3D enable; @@ -566,16 +578,19 @@ =20 void SimpleJob::slotWarning( const QString & errorText ) { =2D if (!isInteractive()) return; =2D =2D static uint msgBoxDisplayed =3D 0; =2D if ( msgBoxDisplayed =3D=3D 0 ) // don't bomb the user with message = boxes, only one at a time + if (isAutoWarningHandlingEnabled()) { =2D msgBoxDisplayed++; =2D KMessageBox::information( 0L, errorText ); =2D msgBoxDisplayed--; + static uint msgBoxDisplayed =3D 0; + if ( msgBoxDisplayed =3D=3D 0 ) // don't bomb the user with messag= e boxes, only one at a time + { + msgBoxDisplayed++; + KMessageBox::information( 0L, errorText ); + msgBoxDisplayed--; + } + // otherwise just discard it. } =2D // otherwise just discard it. + + emit warning( this, errorText ); } =20 void SimpleJob::slotInfoMessage( const QString & msg ) Index: kio/kio/forwardingslavebase.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- kio/kio/forwardingslavebase.h (revision 433385) +++ kio/kio/forwardingslavebase.h (working copy) @@ -174,6 +174,7 @@ private slots: // KIO::Job void slotResult(KIO::Job *job); + void slotWarning(KIO::Job *job, const QString &msg); void slotInfoMessage(KIO::Job *job, const QString &msg); void slotTotalSize(KIO::Job *job, KIO::filesize_t size); void slotProcessedSize(KIO::Job *job, KIO::filesize_t size); Index: kio/kio/forwardingslavebase.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- kio/kio/forwardingslavebase.cpp (revision 433385) +++ kio/kio/forwardingslavebase.cpp (working copy) @@ -342,8 +342,14 @@ =20 void ForwardingSlaveBase::connectJob(KIO::Job *job) { + // We will forward the warning message, no need to let the job + // display it itself + job->setAutoWarningHandlingEnabled(false); + connect( job, SIGNAL( result(KIO::Job *) ), this, SLOT( slotResult(KIO::Job *) ) ); + connect( job, SIGNAL( warning(KIO::Job *, const QString &) ), + this, SLOT( slotWarning(KIO::Job *, const QString &) ) ); connect( job, SIGNAL( infoMessage(KIO::Job *, const QString &) ), this, SLOT( slotInfoMessage(KIO::Job *, const QString &) ) ); connect( job, SIGNAL( totalSize(KIO::Job *, KIO::filesize_t) ), @@ -404,6 +410,11 @@ qApp->eventLoop()->exitLoop(); } =20 +void ForwardingSlaveBase::slotWarning(KIO::Job* /*job*/, const QString &ms= g) +{ + warning(msg); +} + void ForwardingSlaveBase::slotInfoMessage(KIO::Job* /*job*/, const QString= &msg) { infoMessage(msg); --Boundary-01=_KAU1CVO2fcsKAys-- --nextPart18395556.uraA4bOHnf Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBC1UAPB0u7y43syeIRAsYnAJ4m0lz3v2gkjehFN3pYk0fhtUzcfACdFaKJ h8TTj6oZd56rmOCVclx+PMM= =M/yP -----END PGP SIGNATURE----- --nextPart18395556.uraA4bOHnf--