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

List:       kde-devel
Subject:    Re: Valgrind output, please help
From:       Giuseppe Torelli <colossus () 3000 ! it>
Date:       2004-03-31 12:54:04
Message-ID: 200403311454.04723.colossus () 3000 ! it
[Download RAW message or body]

Alle Monday 29 March 2004 11:53, Thiago Macieira ha scritto:

> If you've got that from an example, can you find us the original code?
> Either you've made a mistake in copying, or a typo, or the original
> code very likely has a bug.
>
> The code above does this:
> - calculate GoogleBuffer + data
> - discard the calculation
> - calculate data.size() + 1
> - store it in GoogleBuffer

I asked on this very mailing list on July 17,2003, I got a kind reply
from Waldo, it follows his answers:

If you are writing a KDE application you can, instead of using QSocket
yourself, use KIO::get(). See e.g. kdelibs/kio/kioslavetest.cpp

The interesting parts are KioslaveTest::startJob() that starts the get:

    myJob = KIO::get( src, true );
    myJob->addMetaData("accept", "audio/x-mp3, video/mpeg,
application/x-ogg");
    myJob->addMetaData("UserAgent", "aRts/1.2.0");
    connect(myJob, SIGNAL( data( KIO::Job*, const QByteArray &)),
            SLOT( slotData( KIO::Job*, const QByteArray &)));


Don't forget the signals that indicate that the job is finished:
  connect( job, SIGNAL( result( KIO::Job * ) ),
           SLOT( slotResult( KIO::Job * ) ) );

  connect( job, SIGNAL( canceled( KIO::Job * ) ),
           SLOT( slotResult( KIO::Job * ) ) );

And the data will then be available in KioslaveTest::slotData():

void KioslaveTest::slotData(KIO::Job*, const QByteArray &data)
{
    if (data.size() == 0)
    {
       kdDebug(0) << "Data: <End>" << endl;
    }
    else
    {
       kdDebug(0) << "Data: \"" << QCString(data, data.size()+1) << "\"" <<
endl;
    }
}

That's all,
-- 
Giuseppe Torelli
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

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

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