2 * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "kio_proto.h"
27 #include <kio/global.h>
28 #include <kio/jobclasses.h>
29 #include <kio/scheduler.h>
34 KIO_Read::KIO_Read( QObject
* parent
)
39 _message
= new QString
;
48 void KIO_Read::readMail( const QVariant mailid
, KKioDrop
* drop
)
51 KUrl kurl
= *_kio
->_kurl
;
52 KIO::MetaData metadata
= *_kio
->_metadata
;
54 if( mailid
.type() != QVariant::String
)
56 kDebug() <<"Got wrong type of id in KIO_Read::readMail";
59 kurl
= mailid
.toString();
61 _kio
->_protocol
->readMailKUrl( kurl
, metadata
);
63 _job
= KIO::get( kurl
, KIO::NoReload
, KIO::HideProgressInfo
);
64 _job
->addMetaData( metadata
);
66 connect( _job
, SIGNAL( result( KJob
* ) ), this, SLOT( slotResult( KJob
* ) ) );
67 connect( _job
, SIGNAL( data( KIO::Job
*, const QByteArray
& ) ), this, SLOT( slotData( KIO::Job
*, const QByteArray
& ) ) );
70 void KIO_Read::canceled( )
77 void KIO_Read::slotResult( KJob
* job
)
80 kWarning() << i18n("Unknown job returned; I will try if this one will do..." );
83 kWarning() << i18n("An error occurred when fetching the requested email: %1.", job
->errorString() );
85 _kio
->emitReadMailReady( _message
);
91 void KIO_Read::slotData( KIO::Job
* job
, const QByteArray
& data
)
94 kWarning() << i18n("Unknown job returned; I will try if this one will do..." );
97 _message
->append( data
);
100 #include "kio_read.moc"