mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 14:38:04 -06:00
BUGFIX: Fix overwrite check when renaming a folder in a torrent
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.1.2
|
||||||
|
- BUGFIX: Fix overwrite check when renaming a folder in a torrent
|
||||||
|
|
||||||
* Wed Jan 20 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.1
|
* Wed Jan 20 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.1
|
||||||
- BUGFIX: Fix compilation with Qt4.4
|
- BUGFIX: Fix compilation with Qt4.4
|
||||||
- BUGFIX: Save torrent metadata so that it does not have to be re-downloaded on restart (Magnet links)
|
- BUGFIX: Save torrent metadata so that it does not have to be re-downloaded on restart (Magnet links)
|
||||||
|
|||||||
@@ -595,14 +595,15 @@ void PropertiesWidget::renameSelectedFile() {
|
|||||||
path_items.removeLast();
|
path_items.removeLast();
|
||||||
path_items << new_name_last;
|
path_items << new_name_last;
|
||||||
QString new_path = path_items.join(QDir::separator());
|
QString new_path = path_items.join(QDir::separator());
|
||||||
|
if(!new_path.endsWith(QDir::separator())) new_path += QDir::separator();
|
||||||
// Check for overwriting
|
// Check for overwriting
|
||||||
int num_files = h.num_files();
|
int num_files = h.num_files();
|
||||||
for(int i=0; i<num_files; ++i) {
|
for(int i=0; i<num_files; ++i) {
|
||||||
QString current_name = misc::toQString(h.get_torrent_info().file_at(i).path.string());
|
QString current_name = misc::toQString(h.get_torrent_info().file_at(i).path.string());
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
if(current_name.contains(new_path, Qt::CaseInsensitive)) {
|
if(current_name.startsWith(new_path, Qt::CaseInsensitive)) {
|
||||||
#else
|
#else
|
||||||
if(current_name.contains(new_path, Qt::CaseSensitive)) {
|
if(current_name.startsWith(new_path, Qt::CaseSensitive)) {
|
||||||
#endif
|
#endif
|
||||||
QMessageBox::warning(this, tr("The folder could not be renamed"),
|
QMessageBox::warning(this, tr("The folder could not be renamed"),
|
||||||
tr("This name is already in use in this folder. Please use a different name."),
|
tr("This name is already in use in this folder. Please use a different name."),
|
||||||
|
|||||||
@@ -333,13 +333,14 @@ public slots:
|
|||||||
path_items.removeLast();
|
path_items.removeLast();
|
||||||
path_items << new_name_last;
|
path_items << new_name_last;
|
||||||
QString new_path = path_items.join(QDir::separator());
|
QString new_path = path_items.join(QDir::separator());
|
||||||
|
if(!new_path.endsWith(QDir::separator())) new_path += QDir::separator();
|
||||||
// Check for overwriting
|
// Check for overwriting
|
||||||
for(uint i=0; i<nbFiles; ++i) {
|
for(uint i=0; i<nbFiles; ++i) {
|
||||||
QString current_name = files_path.at(i);
|
QString current_name = files_path.at(i);
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
if(current_name.contains(new_path, Qt::CaseInsensitive)) {
|
if(current_name.startsWith(new_path, Qt::CaseInsensitive)) {
|
||||||
#else
|
#else
|
||||||
if(current_name.contains(new_path, Qt::CaseSensitive)) {
|
if(current_name.startsWith(new_path, Qt::CaseSensitive)) {
|
||||||
#endif
|
#endif
|
||||||
QMessageBox::warning(this, tr("The folder could not be renamed"),
|
QMessageBox::warning(this, tr("The folder could not be renamed"),
|
||||||
tr("This name is already in use in this folder. Please use a different name."),
|
tr("This name is already in use in this folder. Please use a different name."),
|
||||||
|
|||||||
Reference in New Issue
Block a user