Browse Source

- Fix overwrite check when renaming a folder in a torrent

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
dc9edf7538
  1. 5
      src/propertieswidget.cpp
  2. 5
      src/torrentadditiondlg.h

5
src/propertieswidget.cpp

@ -595,14 +595,15 @@ void PropertiesWidget::renameSelectedFile() { @@ -595,14 +595,15 @@ void PropertiesWidget::renameSelectedFile() {
path_items.removeLast();
path_items << new_name_last;
QString new_path = path_items.join(QDir::separator());
if(!new_path.endsWith(QDir::separator())) new_path += QDir::separator();
// Check for overwriting
int num_files = h.num_files();
for(int i=0; i<num_files; ++i) {
QString current_name = misc::toQString(h.get_torrent_info().file_at(i).path.string());
#ifdef Q_WS_WIN
if(current_name.contains(new_path, Qt::CaseInsensitive)) {
if(current_name.startsWith(new_path, Qt::CaseInsensitive)) {
#else
if(current_name.contains(new_path, Qt::CaseSensitive)) {
if(current_name.startsWith(new_path, Qt::CaseSensitive)) {
#endif
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."),

5
src/torrentadditiondlg.h

@ -333,13 +333,14 @@ public slots: @@ -333,13 +333,14 @@ public slots:
path_items.removeLast();
path_items << new_name_last;
QString new_path = path_items.join(QDir::separator());
if(!new_path.endsWith(QDir::separator())) new_path += QDir::separator();
// Check for overwriting
for(uint i=0; i<nbFiles; ++i) {
QString current_name = files_path.at(i);
#ifdef Q_WS_WIN
if(current_name.contains(new_path, Qt::CaseInsensitive)) {
if(current_name.startsWith(new_path, Qt::CaseInsensitive)) {
#else
if(current_name.contains(new_path, Qt::CaseSensitive)) {
if(current_name.startsWith(new_path, Qt::CaseSensitive)) {
#endif
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."),

Loading…
Cancel
Save