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) void WidgetUtils::openUrlByDesktop(const QUrl &p_url)
{ {
const auto scheme = p_url.scheme(); const auto scheme = p_url.scheme();
if (scheme == "http" || scheme == "https" || if (scheme != "http" && scheme != "https" &&
(p_url.isLocalFile() && QFileInfo(p_url.toLocalFile()).isDir())) { !(p_url.isLocalFile() && QFileInfo(p_url.toLocalFile()).isDir())) {
QDesktopServices::openUrl(p_url);
return;
}
// Prompt for user. // Prompt for user.
int ret = MessageBoxHelper::questionYesNo(MessageBoxHelper::Warning, int ret = MessageBoxHelper::questionYesNo(MessageBoxHelper::Warning,
MainWindow::tr("Are you sure to open link (%1)?").arg(p_url.toString()), MainWindow::tr("Are you sure to open link (%1)?").arg(p_url.toString()),
@ -96,6 +92,9 @@ void WidgetUtils::openUrlByDesktop(const QUrl &p_url)
} }
} }
QDesktopServices::openUrl(p_url);
}
bool WidgetUtils::processKeyEventLikeVi(QWidget *p_widget, bool WidgetUtils::processKeyEventLikeVi(QWidget *p_widget,
QKeyEvent *p_event, QKeyEvent *p_event,
QWidget *p_escTargetWidget) QWidget *p_escTargetWidget)