aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/GuiUtil.cpp
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-05-31 20:12:12 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-05-31 20:12:12 +0300
commit29c3dc40ef7f5b1fce5ab5970a39613d0f7f5089 (patch)
treece92f8a86d08531879105a16194a14391c0ae2ea /launcher/ui/GuiUtil.cpp
parente8ee4497f77a571b305a48b70f84c8729b800859 (diff)
parent954d4d701a136e79c25b58f9680d26a555a6e6fe (diff)
downloadPrismLauncher-29c3dc40ef7f5b1fce5ab5970a39613d0f7f5089.tar.gz
PrismLauncher-29c3dc40ef7f5b1fce5ab5970a39613d0f7f5089.tar.bz2
PrismLauncher-29c3dc40ef7f5b1fce5ab5970a39613d0f7f5089.zip
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into logdir
Diffstat (limited to 'launcher/ui/GuiUtil.cpp')
-rw-r--r--launcher/ui/GuiUtil.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp
index 5a62e4d0..930e088a 100644
--- a/launcher/ui/GuiUtil.cpp
+++ b/launcher/ui/GuiUtil.cpp
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Lenny McLennington <lenny@sneed.church>
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Copyright (C) 2022 TheKodeToad <TheKodeToad@proton.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -39,6 +40,7 @@
#include <QClipboard>
#include <QApplication>
#include <QFileDialog>
+#include <QStandardPaths>
#include "ui/dialogs/ProgressDialog.h"
#include "ui/dialogs/CustomMessageBox.h"
@@ -49,11 +51,34 @@
#include <DesktopServices.h>
#include <BuildConfig.h>
-QString GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget)
+std::optional<QString> GuiUtil::uploadPaste(const QString &name, const QString &text, QWidget *parentWidget)
{
ProgressDialog dialog(parentWidget);
auto pasteTypeSetting = static_cast<PasteUpload::PasteType>(APPLICATION->settings()->get("PastebinType").toInt());
auto pasteCustomAPIBaseSetting = APPLICATION->settings()->get("PastebinCustomAPIBase").toString();
+
+ {
+ QUrl baseUrl;
+ if (pasteCustomAPIBaseSetting.isEmpty())
+ baseUrl = PasteUpload::PasteTypes[pasteTypeSetting].defaultBase;
+ else
+ baseUrl = pasteCustomAPIBaseSetting;
+
+ if (baseUrl.isValid())
+ {
+ auto response = CustomMessageBox::selectable(parentWidget, QObject::tr("Confirm Upload"),
+ QObject::tr("You are about to upload \"%1\" to %2.\n"
+ "You should double-check for personal information.\n\n"
+ "Are you sure?")
+ .arg(name, baseUrl.host()),
+ QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
+ ->exec();
+
+ if (response != QMessageBox::Yes)
+ return {};
+ }
+ }
+
std::unique_ptr<PasteUpload> paste(new PasteUpload(parentWidget, text, pasteCustomAPIBaseSetting, pasteTypeSetting));
dialog.execWithTask(paste.get());