-
Notifications
You must be signed in to change notification settings - Fork 586
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow rename of case varaints and greatly speed up bulk renaming
- Loading branch information
1 parent
e3b0fea
commit e9f3ffa
Showing
8 changed files
with
125 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/************************************************************************ | ||
** | ||
** Copyright (C) 2015-2023 Kevin B. Hendricks, Stratford, Ontario, Canada | ||
** Copyright (C) 2015-2024 Kevin B. Hendricks, Stratford, Ontario, Canada | ||
** Copyright (C) 2009-2011 Strahinja Markovic <[email protected]> | ||
** | ||
** This file is part of Sigil. | ||
|
@@ -595,6 +595,28 @@ void FolderKeeper::RemoveResource(const Resource *resource) | |
emit ResourceRemoved(resource); | ||
} | ||
|
||
|
||
void FolderKeeper::BulkRenameResources(const QList<Resource *> resources, const QStringList &newnames) | ||
{ | ||
bool in_bulk = true; | ||
QHash<QString, Resource*> renamedDict; | ||
for (int i=0; i < resources.size(); i++) { | ||
Resource * rsc = resources.at(i); | ||
QString newnm = newnames.at(i); | ||
QString oldbookpath = rsc->GetRelativePath(); | ||
bool success = rsc->RenameTo(newnm, in_bulk); | ||
if (success) { | ||
renamedDict[oldbookpath] = rsc; | ||
QString newbookpath = rsc->GetRelativePath(); | ||
m_Path2Resource.remove(oldbookpath); | ||
m_Path2Resource[newbookpath] = rsc; | ||
} | ||
} | ||
m_OPF->BulkResourcesRenamed(renamedDict); | ||
updateShortPathNames(); | ||
} | ||
|
||
|
||
void FolderKeeper::ResourceRenamed(const Resource *resource, const QString &old_full_path) | ||
{ | ||
// Renaming means the resource book path has changed and so we need to update it | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/************************************************************************ | ||
** | ||
** Copyright (C) 2015-2023 Kevin B. Hendricks, Stratford ON | ||
** Copyright (C) 2015-2024 Kevin B. Hendricks, Stratford ON | ||
** Copyright (C) 2013 John Schember <[email protected]> | ||
** Copyright (C) 2009-2011 Strahinja Markovic <[email protected]> | ||
** | ||
|
@@ -174,6 +174,7 @@ public slots: | |
void UpdateSpineOrder(const QList<HTMLResource *> html_files); | ||
|
||
void ResourceRenamed(const Resource *resource, QString old_full_path); | ||
void BulkResourcesRenamed(const QHash<QString, Resource *> renamedDict); | ||
|
||
void ResourceMoved(const Resource *resource, QString old_full_path); | ||
void BulkResourcesMoved(const QHash<QString, Resource *> movedDict); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters