aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cpaster/pastebindotcomprotocol.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-05-04 14:52:47 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-05-05 12:35:11 +0000
commit97165f0cb89921439b4f0c9eee92d8599606ac04 (patch)
tree874458015aebdebda34398dd97131899d89edf37 /src/plugins/cpaster/pastebindotcomprotocol.cpp
parent43a0e9d2c57cdbaf1c73cb5af2e4dbf6095ad59b (diff)
CodePaster: Expose privacy setting
Let the user decide whether their pasted content is public. Default is non-public, for safety reasons. Task-number: QTCREATORBUG-23972 Change-Id: I5be444807d3f2cb41c629825715f0eaaa50d34c7 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/cpaster/pastebindotcomprotocol.cpp')
-rw-r--r--src/plugins/cpaster/pastebindotcomprotocol.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/cpaster/pastebindotcomprotocol.cpp b/src/plugins/cpaster/pastebindotcomprotocol.cpp
index fb3d60ba92..ed4db9cf46 100644
--- a/src/plugins/cpaster/pastebindotcomprotocol.cpp
+++ b/src/plugins/cpaster/pastebindotcomprotocol.cpp
@@ -99,11 +99,15 @@ static inline QByteArray expirySpecification(int expiryDays)
return QByteArray("N");
}
-void PasteBinDotComProtocol::paste(const QString &text,
- ContentType ct, int expiryDays,
- const QString & /* username */, // Not used unless registered user
- const QString &comment,
- const QString &description)
+void PasteBinDotComProtocol::paste(
+ const QString &text,
+ ContentType ct,
+ int expiryDays,
+ bool publicPaste,
+ const QString & /* username */, // Not used unless registered user
+ const QString &comment,
+ const QString &description
+ )
{
Q_UNUSED(comment)
Q_UNUSED(description)
@@ -118,6 +122,7 @@ void PasteBinDotComProtocol::paste(const QString &text,
pasteData += format(ct);
pasteData += "api_paste_name="; // Title or name.
pasteData += QUrl::toPercentEncoding(description);
+ pasteData.append("&api_paste_private=").append(QByteArray(publicPaste ? "0" : "1"));
pasteData += "&api_paste_code=";
pasteData += QUrl::toPercentEncoding(fixNewLines(text));
// fire request