Skip to content

Commit

Permalink
fix open alert
Browse files Browse the repository at this point in the history
  • Loading branch information
tamlok committed Aug 6, 2024
1 parent f1af785 commit 5da9268
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/utils/widgetutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,20 @@ QSize WidgetUtils::availableScreenSize(QWidget *p_widget)
void WidgetUtils::openUrlByDesktop(const QUrl &p_url)
{
const auto scheme = p_url.scheme();
if (scheme == "http" || scheme == "https" ||
(p_url.isLocalFile() && QFileInfo(p_url.toLocalFile()).isDir())) {
QDesktopServices::openUrl(p_url);
return;
if (scheme != "http" && scheme != "https" &&
!(p_url.isLocalFile() && QFileInfo(p_url.toLocalFile()).isDir())) {
// Prompt for user.
int ret = MessageBoxHelper::questionYesNo(MessageBoxHelper::Warning,
MainWindow::tr("Are you sure to open link (%1)?").arg(p_url.toString()),
MainWindow::tr("Malicious link might do harm to your device."),
QString(),
nullptr);
if (ret == QMessageBox::No) {
return;
}
}

// Prompt for user.
int ret = MessageBoxHelper::questionYesNo(MessageBoxHelper::Warning,
MainWindow::tr("Are you sure to open link (%1)?").arg(p_url.toString()),
MainWindow::tr("Malicious link might do harm to your device."),
QString(),
nullptr);
if (ret == QMessageBox::No) {
return;
}
QDesktopServices::openUrl(p_url);
}

bool WidgetUtils::processKeyEventLikeVi(QWidget *p_widget,
Expand Down

0 comments on commit 5da9268

Please sign in to comment.