File tree Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -79,21 +79,20 @@ QSize WidgetUtils::availableScreenSize(QWidget *p_widget)
7979void WidgetUtils::openUrlByDesktop (const QUrl &p_url)
8080{
8181 const auto scheme = p_url.scheme ();
82- if (scheme == " http" || scheme == " https" ||
83- (p_url.isLocalFile () && QFileInfo (p_url.toLocalFile ()).isDir ())) {
84- QDesktopServices::openUrl (p_url);
85- return ;
82+ if (scheme != " http" && scheme != " https" &&
83+ !(p_url.isLocalFile () && QFileInfo (p_url.toLocalFile ()).isDir ())) {
84+ // Prompt for user.
85+ int ret = MessageBoxHelper::questionYesNo (MessageBoxHelper::Warning,
86+ MainWindow::tr (" Are you sure to open link (%1)?" ).arg (p_url.toString ()),
87+ MainWindow::tr (" Malicious link might do harm to your device." ),
88+ QString (),
89+ nullptr );
90+ if (ret == QMessageBox::No) {
91+ return ;
92+ }
8693 }
8794
88- // Prompt for user.
89- int ret = MessageBoxHelper::questionYesNo (MessageBoxHelper::Warning,
90- MainWindow::tr (" Are you sure to open link (%1)?" ).arg (p_url.toString ()),
91- MainWindow::tr (" Malicious link might do harm to your device." ),
92- QString (),
93- nullptr );
94- if (ret == QMessageBox::No) {
95- return ;
96- }
95+ QDesktopServices::openUrl (p_url);
9796}
9897
9998bool WidgetUtils::processKeyEventLikeVi (QWidget *p_widget,
You can’t perform that action at this time.
0 commit comments