fix open alert

This commit is contained in:
Le Tan 2024-08-06 21:23:48 +08:00
parent f1af78573a
commit 5da9268aa7

View File

@ -79,12 +79,8 @@ 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()),
@ -94,6 +90,9 @@ void WidgetUtils::openUrlByDesktop(const QUrl &p_url)
if (ret == QMessageBox::No) {
return;
}
}
QDesktopServices::openUrl(p_url);
}
bool WidgetUtils::processKeyEventLikeVi(QWidget *p_widget,