KIO::Job, JobUiDelegate strangeness (was: Preparing terrain for kio_uiserver)

Rafael Fernández López ereslibre at gmail.com
Sat Dec 23 08:39:30 GMT 2006


Hi folks,

I've been trying to find the root of all problems that I'm going to describe
now, but I didn't succeed, at least totally. We all know there is an
advantage having separated the part of the jobs that do the work itself, and
the "graphical part" of the jobs (the delegate). It seems there are strange
behaviours. Let's see:

In job.cpp I have this code:

Job::Job(bool showProgressInfo) : KCompositeJob(0), m_speedTimer(0), d( new
JobPrivate )
{
    JobUiDelegate *jobUiDelegate = new JobUiDelegate( showProgressInfo );

    kDebug() << "LOOK: Before setUiDelegate(). uiDelegate() = " <<
uiDelegate() << ". jobUiDelegate = " << jobUiDelegate << endl;

    setUiDelegate( jobUiDelegate );

    kDebug() << "LOOK: After setUiDelegate(). uiDelegate() = " <<
uiDelegate() << endl;
}

In my Observer::newJob, I have the next:

int Observer::newJob( KIO::Job * job, bool showProgress )
{
    // Tell the UI Server about this new job, and give it the application id
    // at the same time

    int progressId;

    if (job->ui())
    {
        progressId  = m_uiserver->newJob(
QDBusConnection::sessionBus().baseService(), showProgress,
                                             job->ui()->internalAppName(),
job->ui()->jobIcon(), job->ui()->appName() );
    }
    else
    {
        progressId  = m_uiserver->newJob(
QDBusConnection::sessionBus().baseService(), showProgress,
                                             QString(), QString(), QString()
);
    }

    // Keep the result in a dict
    m_dctJobs.insert( progressId, job );

    return progressId;
}

What amazes me is that when a job that is meant to be shown on the
kio_uiserver, it always go through the else, because it seems that ui() is
null. Even more, when taking a look at the debug output, I have the next:

konqueror: LOOK: KJob::uiDelegate() returned QObject(0x0)
konqueror: LOOK: Before setUiDelegate(). uiDelegate() = QObject(0x0)  .
jobUiDelegate = KIO::JobUiDelegate(0x6e93a0)
kio (KIOJob): kio_uiserver registered
konqueror: LOOK: KJob::uiDelegate() returned QObject(0x0)
konqueror: LOOK: KIO::Job::ui() returned QObject(0x0)
konqueror: LOOK: KJob::uiDelegate() returned QObject(0x0)

Hey !!! I'm not getting kDebug() << "LOOK: After setUiDelegate().
uiDelegate() = " << uiDelegate() << endl;. What's happening ? Why it writes
"kio (KIOJob): kio_uiserver registered" before "After setUiDelegate().....",
and even more, "After setUiDelegate()....." is never written.

I have visited setUiDelegate and I don't find (at a first look) anything
that should be calling Observer constructor (or Observer::self()) there
(that is the one that writes that on the debug information).

The result is that the kio_uiserver is always getting nulls strings on the
icon, internalAppName, and appName.

Bye,
Rafael Fernández López.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20061223/a4c6f31d/attachment.htm>


More information about the kde-core-devel mailing list