From 7f3ecd0f64a08a117603290a0f38f8a20b275ad0 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 31 Aug 2023 15:56:16 +0300 Subject: [PATCH] kparts: remove unused stream-related API Signed-off-by: Ivailo Monev --- kparts/part.cpp | 34 +++++---------------------------- kparts/part.h | 50 ------------------------------------------------- 2 files changed, 5 insertions(+), 79 deletions(-) diff --git a/kparts/part.cpp b/kparts/part.cpp index dac088d5..b885eaf0 100644 --- a/kparts/part.cpp +++ b/kparts/part.cpp @@ -42,7 +42,6 @@ #include #include -#include #include #include @@ -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 & KParts::OpenUrlArguments::metaData() +QMap& KParts::OpenUrlArguments::metaData() { return d->metaData; } diff --git a/kparts/part.h b/kparts/part.h index 60048912..da09ee21 100644 --- a/kparts/part.h +++ b/kparts/part.h @@ -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.