kparts: remove unused stream-related API

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-31 15:56:16 +03:00
parent 0a4a0aa423
commit 7f3ecd0f64
2 changed files with 5 additions and 79 deletions

View file

@ -42,7 +42,6 @@
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include <kdebug.h>
#include <kiconloader.h>
@ -557,8 +556,8 @@ void ReadOnlyPartPrivate::_k_slotJobFinished(KJob *job)
{
Q_Q(ReadOnlyPart);
assert( job == m_job );
m_job = 0;
Q_ASSERT(job == m_job);
m_job = nullptr;
if (job->error()) {
emit q->canceled(job->errorString());
} else {
@ -596,29 +595,6 @@ void ReadOnlyPart::guiActivateEvent(GUIActivateEvent *event)
}
}
bool ReadOnlyPart::openStream(const QString &mimeType, const KUrl &url)
{
Q_D(ReadOnlyPart);
OpenUrlArguments args = d->m_arguments;
if (!closeUrl()) {
return false;
}
d->m_arguments = args;
setUrl(url);
return doOpenStream(mimeType);
}
bool ReadOnlyPart::writeStream(const QByteArray &data)
{
return doWriteStream(data);
}
bool ReadOnlyPart::closeStream()
{
return doCloseStream();
}
void KParts::ReadOnlyPart::setArguments(const OpenUrlArguments& arguments)
{
Q_D(ReadOnlyPart);
@ -744,7 +720,7 @@ bool ReadWritePart::closeUrl()
bool ReadWritePart::closeUrl(bool promptToSave)
{
return promptToSave ? closeUrl() : ReadOnlyPart::closeUrl();
return (promptToSave ? closeUrl() : ReadOnlyPart::closeUrl());
}
bool ReadWritePart::save()
@ -820,7 +796,7 @@ bool ReadWritePart::saveToUrl()
setModified(false);
emit completed();
// if m_url is a local file there won't be a temp file -> nothing to remove
assert(!d->m_bTemp);
Q_ASSERT(!d->m_bTemp);
d->m_saveOk = true;
d->m_duringSaveAs = false;
d->m_originalURL = KUrl();
@ -986,7 +962,7 @@ void KParts::OpenUrlArguments::setMimeType(const QString& mime)
d->mimeType = mime;
}
QMap<QString, QString> & KParts::OpenUrlArguments::metaData()
QMap<QString, QString>& KParts::OpenUrlArguments::metaData()
{
return d->metaData;
}

View file

@ -417,56 +417,6 @@ public:
*/
OpenUrlArguments arguments() const;
public:
/**
* Initiate sending data to this part.
* This is an alternative to openUrl, which allows the user of the part
* to load the data itself, and send it progressively to the part.
*
* @param mimeType the type of data that is going to be sent to this part.
* @param url the URL representing this data. Although not directly used,
* every ReadOnlyPart has a URL (see url()), so this simply sets it.
* @return true if the part supports progressive loading and accepts data, false otherwise.
*/
bool openStream(const QString &mimeType, const KUrl &url);
/**
* Send some data to the part. openStream must have been called previously,
* and must have returned true.
* @return true if the data was accepted by the part. If false is returned,
* the application should stop sending data, and doesn't have to call closeStream.
*/
bool writeStream(const QByteArray &data);
/**
* Terminate the sending of data to the part.
* With some data types (text, html...) closeStream might never actually be called,
* in the case of continuous streams, for instance plain text or HTML data.
*/
bool closeStream();
private: // Makes no sense for inherited classes to call those. But make it protected there.
/**
* Called by openStream to initiate sending of data.
* Parts which implement progress loading should check the @p mimeType
* parameter, and return true if they can accept a data stream of that type.
*/
virtual bool doOpenStream(const QString & /*mimeType*/) { return false; }
/**
* Receive some data from the hosting application.
* In this method the part should attempt to display the data progressively.
* With some data types (text, html...) closeStream might never actually be called,
* in the case of continuous streams. This can't happen with e.g. images.
*/
virtual bool doWriteStream(const QByteArray &/*data*/) { return false; }
/**
* This is called by closeStream(), to indicate that all the data has been sent.
* Parts should ensure that all of the data is displayed at this point.
* @return whether the data could be displayed correctly.
*/
virtual bool doCloseStream() { return false; }
Q_SIGNALS:
/**
* The part emits this when starting data.