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)
79
79
void WidgetUtils::openUrlByDesktop (const QUrl &p_url)
80
80
{
81
81
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
+ }
86
93
}
87
94
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);
97
96
}
98
97
99
98
bool WidgetUtils::processKeyEventLikeVi (QWidget *p_widget,
You can’t perform that action at this time.
0 commit comments