Skip to content

Commit

Permalink
fix: [mount] allow reenter smb/ftp/sftp to re-mount when failed.
Browse files Browse the repository at this point in the history
1. as title.
2. decrease warning.

Log: as above.

Bug: https://pms.uniontech.com/bug-view-275269.html
  • Loading branch information
itsXuSt committed Sep 24, 2024
1 parent 7d62ae3 commit b354b46
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ bool SmbBrowserEventReceiver::hookSetTabName(const QUrl &url, QString *tabName)
return true;
}

if (url.scheme() == "smb" && url.path().contains(QRegularExpression(R"([^/]*)"))) {
static QRegularExpression regx(R"([^/]*)");
if (url.scheme() == "smb" && url.path().contains(regx)) {
auto path = url.toString();
while (path.endsWith("/"))
path.chop(1);
Expand All @@ -93,6 +94,12 @@ bool SmbBrowserEventReceiver::hookTitleBarAddrHandle(QUrl *url)
return false;
}

bool SmbBrowserEventReceiver::hookAllowRepeatUrl(const QUrl &cur, const QUrl &pre)

Check warning on line 97 in src/plugins/filemanager/dfmplugin-smbbrowser/events/smbbrowsereventreceiver.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'hookAllowRepeatUrl' is never used.
{
QStringList allowReEnterScehmes { Global::Scheme::kSmb, Global::Scheme::kSFtp, Global::Scheme::kFtp };
return allowReEnterScehmes.contains(cur.scheme()) && allowReEnterScehmes.contains(pre.scheme());
}

bool SmbBrowserEventReceiver::getOriginalUri(const QUrl &in, QUrl *out)
{
QString path = in.path();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public Q_SLOTS:
bool hookSetTabName(const QUrl &url, QString *tabName);

bool hookTitleBarAddrHandle(QUrl *url);
bool hookAllowRepeatUrl(const QUrl &cur, const QUrl &pre);

private:
bool getOriginalUri(const QUrl &in, QUrl *out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ void SmbBrowser::followEvents()
dpfHookSequence->follow("dfmplugin_workspace", "hook_Tab_SetTabName", SmbBrowserEventReceiver::instance(), &SmbBrowserEventReceiver::hookSetTabName);
dpfHookSequence->follow("dfmplugin_titlebar", "hook_Show_Addr", SmbBrowserEventReceiver::instance(), &SmbBrowserEventReceiver::hookTitleBarAddrHandle);
dpfHookSequence->follow("dfmplugin_titlebar", "hook_Copy_Addr", SmbBrowserEventReceiver::instance(), &SmbBrowserEventReceiver::hookTitleBarAddrHandle);
dpfHookSequence->follow("dfmplugin_workspace", "hook_Tab_Allow_Repeat_Url", SmbBrowserEventReceiver::instance(), &SmbBrowserEventReceiver::hookAllowRepeatUrl);
}

void SmbBrowser::updateNeighborToSidebar()
Expand Down

0 comments on commit b354b46

Please sign in to comment.