diff --git a/src/blackgui/components/downloadcomponent.cpp b/src/blackgui/components/downloadcomponent.cpp index 7642dceae..253dd1681 100644 --- a/src/blackgui/components/downloadcomponent.cpp +++ b/src/blackgui/components/downloadcomponent.cpp @@ -197,7 +197,7 @@ namespace BlackGui this->showStartedFileMessage(remoteFile); m_fileInProgress = remoteFile; - const QString saveAsFile = CFileUtils::appendFilePaths(ui->le_DownloadDir->text(), remoteFile.getName()); + const QString saveAsFile = CFileUtils::appendFilePaths(ui->le_DownloadDir->text(), remoteFile.getBaseName()); const QFileInfo fiSaveAs(saveAsFile); if (fiSaveAs.exists()) { @@ -294,7 +294,7 @@ namespace BlackGui for (const CRemoteFile &rf : executables) { - const QString executable = CFileUtils::appendFilePaths(dir.absolutePath(), rf.getName()); + const QString executable = CFileUtils::appendFilePaths(dir.absolutePath(), rf.getBaseName()); const QFile executableFile(executable); if (!executableFile.exists()) { continue; } @@ -360,7 +360,7 @@ namespace BlackGui void CDownloadComponent::showStartedFileMessage(const CRemoteFile &rf) { const int current = m_remoteFiles.size() - m_waitingForDownload.size(); - ui->le_Started->setText(rf.getName()); + ui->le_Started->setText(rf.getBaseName()); ui->le_StartedNumber->setText(QStringLiteral("%1/%2").arg(current).arg(m_remoteFiles.size())); ui->le_StartedUrl->setText(rf.getUrl().getFullUrl()); ui->prb_Total->setMaximum(m_remoteFiles.size()); @@ -370,7 +370,7 @@ namespace BlackGui void CDownloadComponent::showCompletedFileMessage(const CRemoteFile &rf) { const int current = m_remoteFiles.size() - m_waitingForDownload.size(); - ui->le_Completed->setText(rf.getName()); + ui->le_Completed->setText(rf.getBaseName()); ui->le_CompletedNumber->setText(QStringLiteral("%1/%2").arg(current).arg(m_remoteFiles.size())); ui->le_CompletedUrl->setText(rf.getUrl().getFullUrl()); ui->prb_Total->setMaximum(m_remoteFiles.size()); diff --git a/src/blackmisc/network/remotefile.cpp b/src/blackmisc/network/remotefile.cpp index 46f58ff21..9d8ee26be 100644 --- a/src/blackmisc/network/remotefile.cpp +++ b/src/blackmisc/network/remotefile.cpp @@ -36,9 +36,9 @@ namespace BlackMisc bool CRemoteFile::matchesName(const QString &name) const { if (name.isEmpty()) { return false; } - if (caseInsensitiveStringCompare(name, this->getName())) { return true; } - if (name.startsWith(this->getName(), Qt::CaseInsensitive)) { return true; } - if (this->getName().startsWith(name, Qt::CaseInsensitive)) { return true; } + if (caseInsensitiveStringCompare(name, this->getBaseName())) { return true; } + if (name.startsWith(this->getBaseName(), Qt::CaseInsensitive)) { return true; } + if (this->getBaseName().startsWith(name, Qt::CaseInsensitive)) { return true; } return false; } diff --git a/src/blackmisc/network/remotefile.h b/src/blackmisc/network/remotefile.h index 6836d9c70..d3a22b427 100644 --- a/src/blackmisc/network/remotefile.h +++ b/src/blackmisc/network/remotefile.h @@ -59,6 +59,9 @@ namespace BlackMisc //! Name const QString &getName() const { return m_name; } + //! Name with directory stripped + QString getBaseName() const { return m_name.section('/', -1); } + //! Has name? bool hasName() const { return !m_name.isEmpty(); }