diff options
author | Eike Ziller <eike.ziller@qt.io> | 2020-12-01 14:41:17 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2020-12-07 15:06:30 +0000 |
commit | 43249f655be5b676fd324c9ce1e0cd0a7cd48fd0 (patch) | |
tree | 5c0a4b28d62ec9c954c47f9082059e8f66692a1d /src/plugins/cpaster | |
parent | c400923308f5c4df4e8d96a04d12dc54322f7ade (diff) |
CPaster: Use new message manager API
Only show the panel if an error occurs, or if the user opted to have the
paste link shown to him.
Task-number: QTCREATORBUG-24430
Change-Id: Ie474acbe2b4d3b6d3332111bdd7ae18b16bd8618
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/cpaster')
-rw-r--r-- | src/plugins/cpaster/cpasterplugin.cpp | 12 | ||||
-rw-r--r-- | src/plugins/cpaster/dpastedotcomprotocol.cpp | 4 | ||||
-rw-r--r-- | src/plugins/cpaster/fileshareprotocol.cpp | 4 |
3 files changed, 12 insertions, 8 deletions
diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index aa01c7edb3..455d674877 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -326,7 +326,10 @@ void CodePasterPluginPrivate::finishPost(const QString &link) { if (m_settings.copyToClipboard) QApplication::clipboard()->setText(link); - MessageManager::write(link, m_settings.displayOutput ? MessageManager::ModeSwitch : MessageManager::Silent); + if (m_settings.displayOutput) + MessageManager::writeDisrupting(link); + else + MessageManager::writeSilently(link); } // Extract the characters that can be used for a file name from a title @@ -369,11 +372,12 @@ void CodePasterPluginPrivate::finishFetch(const QString &titleDescription, { // Failure? if (error) { - MessageManager::write(content); + MessageManager::writeDisrupting(content); return; } if (content.isEmpty()) { - MessageManager::write(tr("Empty snippet received for \"%1\".").arg(titleDescription)); + MessageManager::writeDisrupting( + tr("Empty snippet received for \"%1\".").arg(titleDescription)); return; } // If the mime type has a preferred suffix (cpp/h/patch...), use that for @@ -393,7 +397,7 @@ void CodePasterPluginPrivate::finishFetch(const QString &titleDescription, saver.setAutoRemove(false); saver.write(byteContent); if (!saver.finalize()) { - MessageManager::write(saver.errorString()); + MessageManager::writeDisrupting(saver.errorString()); return; } const QString fileName = saver.fileName(); diff --git a/src/plugins/cpaster/dpastedotcomprotocol.cpp b/src/plugins/cpaster/dpastedotcomprotocol.cpp index 48f5f8e357..da9863bb4d 100644 --- a/src/plugins/cpaster/dpastedotcomprotocol.cpp +++ b/src/plugins/cpaster/dpastedotcomprotocol.cpp @@ -59,7 +59,7 @@ void DPasteDotComProtocol::fetchFinished(const QString &id, QNetworkReply * cons const QString location = QString::fromUtf8(reply->rawHeader("Location")); if (status == 301 || status == 308) { const QString m = QString("HTTP redirect (%1) to \"%2\"").arg(status).arg(location); - Core::MessageManager::write(m, Core::MessageManager::ModeSwitch); + Core::MessageManager::writeSilently(m); } QNetworkReply * const newRep = httpGet(location); connect(newRep, &QNetworkReply::finished, this, [this, id, newRep] { @@ -150,7 +150,7 @@ bool DPasteDotComProtocol::checkConfiguration(QString *errorMessage) void DPasteDotComProtocol::reportError(const QString &message) { const QString fullMessage = tr("%1: %2").arg(protocolName(), message); - Core::MessageManager::write(fullMessage, Core::MessageManager::ModeSwitch); + Core::MessageManager::writeDisrupting(fullMessage); } } // namespace CodePaster diff --git a/src/plugins/cpaster/fileshareprotocol.cpp b/src/plugins/cpaster/fileshareprotocol.cpp index 3669a1c7b7..216e9069ae 100644 --- a/src/plugins/cpaster/fileshareprotocol.cpp +++ b/src/plugins/cpaster/fileshareprotocol.cpp @@ -206,10 +206,10 @@ void FileShareProtocol::paste( saver.setResult(&writer); } if (!saver.finalize()) { - Core::MessageManager::write(saver.errorString()); + Core::MessageManager::writeDisrupting(saver.errorString()); return; } - Core::MessageManager::write(tr("Pasted: %1").arg(saver.fileName())); + Core::MessageManager::writeSilently(tr("Pasted: %1").arg(saver.fileName())); } } // namespace CodePaster |