|
@@ -25,6 +25,7 @@
|
|
|
#include <QPushButton>
|
|
|
#include <QSplitter>
|
|
|
#include <QFormLayout>
|
|
|
+#include <QFileInfo>
|
|
|
|
|
|
#include <core/global.h>
|
|
|
#include <widgets/messageboxhelper.h>
|
|
@@ -78,19 +79,21 @@ QSize WidgetUtils::availableScreenSize(QWidget *p_widget)
|
|
|
void WidgetUtils::openUrlByDesktop(const QUrl &p_url)
|
|
|
{
|
|
|
const auto scheme = p_url.scheme();
|
|
|
- if (scheme != "http" && scheme != "https") {
|
|
|
- // 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;
|
|
|
- }
|
|
|
+ if (scheme == "http" || scheme == "https" ||
|
|
|
+ (p_url.isLocalFile() && QFileInfo(p_url.toLocalFile()).isDir())) {
|
|
|
+ QDesktopServices::openUrl(p_url);
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- QDesktopServices::openUrl(p_url);
|
|
|
+ // 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;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
bool WidgetUtils::processKeyEventLikeVi(QWidget *p_widget,
|