From 668921543af3d8b58467f8f98bfb5f2d78d072c1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 19 Mar 2021 13:36:40 +0100 Subject: [PATCH] [libcalamaresui] Convenience method to check if paste would do anything --- src/libcalamaresui/utils/Paste.cpp | 7 +++++++ src/libcalamaresui/utils/Paste.h | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/libcalamaresui/utils/Paste.cpp b/src/libcalamaresui/utils/Paste.cpp index 2f0cfa143..a61b80b4e 100644 --- a/src/libcalamaresui/utils/Paste.cpp +++ b/src/libcalamaresui/utils/Paste.cpp @@ -126,3 +126,10 @@ CalamaresUtils::Paste::doLogUpload( QObject* parent ) } return QString(); } + +bool +CalamaresUtils::Paste::isEnabled() +{ + auto [ type, serverUrl ] = Calamares::Branding::instance()->uploadServer(); + return type != Calamares::Branding::UploadServerType::None; +} diff --git a/src/libcalamaresui/utils/Paste.h b/src/libcalamaresui/utils/Paste.h index 6258e57a0..c6b0adba8 100644 --- a/src/libcalamaresui/utils/Paste.h +++ b/src/libcalamaresui/utils/Paste.h @@ -18,12 +18,17 @@ namespace CalamaresUtils { namespace Paste { - /** @brief Send the current log file to a pastebin * * Returns the (string) URL that the pastebin gives us. */ QString doLogUpload( QObject* parent ); + +/** @brief Is paste enabled? + * + * Checks the branding instance if paste can be done. + */ +bool isEnabled(); } // namespace Paste } // namespace CalamaresUtils