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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user