Adds Warning Dialog When Following an External Link in Project Manager (#6003)

Signed-off-by: Alex Peterson <26804013+AMZN-alexpete@users.noreply.github.com>
This commit is contained in:
AMZN-nggieber
2021-11-30 13:13:42 -08:00
committed by GitHub
parent 8637b41401
commit b3bf02a4d5
9 changed files with 170 additions and 9 deletions
@@ -7,6 +7,11 @@
*/
#include <LinkWidget.h>
#include <ExternalLinkDialog.h>
#include <ProjectManagerSettings.h>
#include <AzCore/Settings/SettingsRegistry.h>
#include <QDesktopServices>
#include <QEvent>
#include <QMouseEvent>
@@ -26,7 +31,29 @@ namespace O3DE::ProjectManager
{
if (m_url.isValid())
{
QDesktopServices::openUrl(m_url);
// Check if user request not to be shown external link warning dialog
bool skipDialog = false;
auto settingsRegistry = AZ::SettingsRegistry::Get();
if (settingsRegistry)
{
QString settingsKey = GetExternalLinkWarningKey();
settingsRegistry->Get(skipDialog, settingsKey.toStdString().c_str());
}
if (!skipDialog)
{
// Style does not apply if LinkLabel is parent so use parentWidget as parent instead
ExternalLinkDialog* linkDialog = new ExternalLinkDialog(m_url.toString(), parentWidget());
if (linkDialog->exec() == QDialog::Accepted)
{
QDesktopServices::openUrl(m_url);
}
}
else
{
QDesktopServices::openUrl(m_url);
}
}
emit clicked();