Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Fix Focus Lost when renaming new created folder

Abel You3258bb2d4905
diff --git a/toonz/sources/toonz/filebrowser.cpp b/toonz/sources/toonz/filebrowser.cpp
index c3c40770b..dfe34783f 100644
--- a/toonz/sources/toonz/filebrowser.cpp
+++ b/toonz/sources/toonz/filebrowser.cpp
@@ -2180,14 +2180,30 @@ void FileBrowser::newFolder() {
int i = 1;
while (TFileStatus(folderPath).doesExist())
folderPath = parentFolder + (folderName + L" " + std::to_wstring(++i));
+
+ if (Preferences::instance()->isWatchFileSystemEnabled()) {
+ MyFileSystemWatcher *watcher = MyFileSystemWatcher::instance();
+ // Remove parent folder from watcher
+ watcher->removePaths(QStringList() << parentFolder.getQString());
- try {
- TSystem::mkDir(folderPath);
-
- } catch (...) {
- DVGui::error(tr("It is not possible to create the %1 folder.")
- .arg(toQString(folderPath)));
- return;
+ try {
+ TSystem::mkDir(folderPath);
+ } catch (...) {
+ DVGui::error(tr("It is not possible to create the %1 folder.")
+ .arg(toQString(folderPath)));
+ watcher->addPaths(QStringList() << parentFolder.getQString());
+ return;
+ }
+ // Add the parent folder back
+ watcher->addPaths(QStringList() << parentFolder.getQString());
+ } else {
+ try {
+ TSystem::mkDir(folderPath);
+ } catch (...) {
+ DVGui::error(tr("It is not possible to create the %1 folder.")
+ .arg(toQString(folderPath)));
+ return;
+ }
}
DvDirModel *model = DvDirModel::instance();