Skip to content

Commit

Permalink
when bulk renaming or moving do not forget to update tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhendricks committed Apr 9, 2024
1 parent a243ff4 commit 5de76f6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/ResourceObjects/Resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ bool Resource::RenameTo(const QString &new_filename, bool in_bulk)
SetShortPathName(new_filename);
if (!in_bulk) {
emit Renamed(this, old_path);
} else {
emit TellTabUpdateName(this, old_path);
}
}

Expand All @@ -225,6 +227,8 @@ bool Resource::MoveTo(const QString &new_bookpath, bool in_bulk)
m_FullFilePath = new_path;
if (!in_bulk) {
emit Moved(this, old_path);
} else {
emit TellTabUpdateName(this, old_path);
}
}

Expand Down
8 changes: 7 additions & 1 deletion src/ResourceObjects/Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,19 @@ class Resource : public QObject
*/
void Renamed(const Resource *resource, QString old_full_path);

/**
* Emitted whena resource is renamed or moved under builk mode
*
*/
void TellTabUpdateName(const Resource *resource, QString old_full_path);

/**
* Emitted whenever the resource changes location.
*
* @param resource The resource's that was moved.
*/
void Moved(const Resource *resource, QString old_full_path);

/**
* Emitted when the resource has been scheduled for deletion.
*
Expand Down
1 change: 1 addition & 0 deletions src/Tabs/ContentTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ContentTab::ContentTab(Resource *resource, QWidget *parent)
connect(resource, SIGNAL(Deleted(const Resource *)), this, SLOT(UnderlyingResourceDeleted()));
connect(resource, SIGNAL(Renamed(const Resource *, QString)), this, SLOT(EmitTabRenamed()));
connect(resource, SIGNAL(Moved(const Resource *, QString)), this, SLOT(EmitTabRenamed()));
connect(resource, SIGNAL(TellTabUpdateName(const Resource *, QString)), this, SLOT(EmitTabRenamed()));
m_Layout->setContentsMargins(0, 0, 0, 0);
setLayout(m_Layout);
}
Expand Down

0 comments on commit 5de76f6

Please sign in to comment.