|
|
@ -131,12 +131,12 @@ void TDEFileReplacePart::slotSearchingOperation()
|
|
|
|
|
|
|
|
|
|
|
|
m_view->showSemaphore("red");
|
|
|
|
m_view->showSemaphore("red");
|
|
|
|
|
|
|
|
|
|
|
|
uint filesNumber = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(m_option->m_recursive)
|
|
|
|
if(m_option->m_recursive)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
int foldersNumber = 0;
|
|
|
|
|
|
|
|
int filesNumber = 0;
|
|
|
|
m_circ_ref_warning_shown = false;
|
|
|
|
m_circ_ref_warning_shown = false;
|
|
|
|
recursiveFileSearch(currentDirectory, currentFilter, filesNumber, 0);
|
|
|
|
recursiveFileSearch(currentDirectory, currentFilter, foldersNumber, filesNumber, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
fileSearch(currentDirectory, currentFilter);
|
|
|
|
fileSearch(currentDirectory, currentFilter);
|
|
|
@ -202,9 +202,10 @@ void TDEFileReplacePart::slotReplacingOperation()
|
|
|
|
|
|
|
|
|
|
|
|
if(m_option->m_recursive)
|
|
|
|
if(m_option->m_recursive)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
int foldersNumber = 0;
|
|
|
|
int filesNumber = 0;
|
|
|
|
int filesNumber = 0;
|
|
|
|
m_circ_ref_warning_shown = false;
|
|
|
|
m_circ_ref_warning_shown = false;
|
|
|
|
recursiveFileReplace(currentDirectory, filesNumber, 0);
|
|
|
|
recursiveFileReplace(currentDirectory, foldersNumber, filesNumber, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -951,7 +952,7 @@ void TDEFileReplacePart::fileReplace()
|
|
|
|
TQStringList::iterator filesIt;
|
|
|
|
TQStringList::iterator filesIt;
|
|
|
|
int filesNumber = 0;
|
|
|
|
int filesNumber = 0;
|
|
|
|
|
|
|
|
|
|
|
|
m_view->displayScannedFiles(filesNumber);
|
|
|
|
m_view->displayScannedFiles(0, filesNumber);
|
|
|
|
|
|
|
|
|
|
|
|
for (filesIt = filesList.begin(); filesIt != filesList.end() ; ++filesIt)
|
|
|
|
for (filesIt = filesList.begin(); filesIt != filesList.end() ; ++filesIt)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -971,11 +972,13 @@ void TDEFileReplacePart::fileReplace()
|
|
|
|
replaceAndOverwrite(d.canonicalPath(), fileName);
|
|
|
|
replaceAndOverwrite(d.canonicalPath(), fileName);
|
|
|
|
|
|
|
|
|
|
|
|
filesNumber++;
|
|
|
|
filesNumber++;
|
|
|
|
m_view->displayScannedFiles(filesNumber);
|
|
|
|
m_view->displayScannedFiles(0, filesNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_view->displayScannedFiles(1, filesNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TDEFileReplacePart::recursiveFileReplace(const TQString& directoryName, int& filesNumber, int depth)
|
|
|
|
void TDEFileReplacePart::recursiveFileReplace(const TQString &directoryName, int &foldersNumber, int &filesNumber,
|
|
|
|
|
|
|
|
int depth)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// if m_stop == true or the max depth level is reached, then interrupt recursion
|
|
|
|
// if m_stop == true or the max depth level is reached, then interrupt recursion
|
|
|
|
if (m_stop || (m_option->m_limitDepth && depth > m_option->m_maxDepth))
|
|
|
|
if (m_stop || (m_option->m_limitDepth && depth > m_option->m_maxDepth))
|
|
|
@ -993,8 +996,7 @@ void TDEFileReplacePart::recursiveFileReplace(const TQString& directoryName, int
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TQDir d(directoryName);
|
|
|
|
TQDir d(directoryName);
|
|
|
|
|
|
|
|
|
|
|
|
d.setMatchAllDirs(true);
|
|
|
|
d.setMatchAllDirs(true);
|
|
|
@ -1010,7 +1012,6 @@ void TDEFileReplacePart::recursiveFileReplace(const TQString& directoryName, int
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
TQString fileName = (*filesIt);
|
|
|
|
TQString fileName = (*filesIt);
|
|
|
|
|
|
|
|
|
|
|
|
// Avoids files that not match requirements
|
|
|
|
// Avoids files that not match requirements
|
|
|
|
if(!TDEFileReplaceLib::isAnAccessibleFile(d.canonicalPath(), fileName, m_option))
|
|
|
|
if(!TDEFileReplaceLib::isAnAccessibleFile(d.canonicalPath(), fileName, m_option))
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
@ -1019,15 +1020,15 @@ void TDEFileReplacePart::recursiveFileReplace(const TQString& directoryName, int
|
|
|
|
|
|
|
|
|
|
|
|
TQFileInfo qi(filePath);
|
|
|
|
TQFileInfo qi(filePath);
|
|
|
|
|
|
|
|
|
|
|
|
m_view->displayScannedFiles(filesNumber);
|
|
|
|
m_view->displayScannedFiles(foldersNumber, filesNumber);
|
|
|
|
|
|
|
|
|
|
|
|
kapp->processEvents();
|
|
|
|
kapp->processEvents();
|
|
|
|
|
|
|
|
|
|
|
|
// Replace recursively if "filePath" is a directory and we have not reached the max depth level
|
|
|
|
// Replace recursively if "filePath" is a directory and we have not reached the max depth level
|
|
|
|
if (qi.isDir())
|
|
|
|
if (qi.isDir())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!m_option->m_limitDepth || depth < m_option->m_maxDepth)
|
|
|
|
if (!m_option->m_limitDepth || depth < m_option->m_maxDepth)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
recursiveFileReplace(filePath, filesNumber, depth+1);
|
|
|
|
recursiveFileReplace(filePath, foldersNumber, filesNumber, depth+1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -1038,10 +1039,12 @@ void TDEFileReplacePart::recursiveFileReplace(const TQString& directoryName, int
|
|
|
|
replaceAndOverwrite(d.canonicalPath(), fileName);
|
|
|
|
replaceAndOverwrite(d.canonicalPath(), fileName);
|
|
|
|
|
|
|
|
|
|
|
|
filesNumber++;
|
|
|
|
filesNumber++;
|
|
|
|
m_view->displayScannedFiles(filesNumber);
|
|
|
|
m_view->displayScannedFiles(foldersNumber, filesNumber);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foldersNumber++;
|
|
|
|
|
|
|
|
m_view->displayScannedFiles(foldersNumber, filesNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TDEFileReplacePart::replaceAndBackup(const TQString& currentDir, const TQString& oldFileName)
|
|
|
|
void TDEFileReplacePart::replaceAndBackup(const TQString& currentDir, const TQString& oldFileName)
|
|
|
@ -1286,7 +1289,7 @@ void TDEFileReplacePart::fileSearch(const TQString& directoryName, const TQStrin
|
|
|
|
TQStringList::iterator filesIt;
|
|
|
|
TQStringList::iterator filesIt;
|
|
|
|
uint filesNumber = 0;
|
|
|
|
uint filesNumber = 0;
|
|
|
|
|
|
|
|
|
|
|
|
m_view->displayScannedFiles(filesNumber);
|
|
|
|
m_view->displayScannedFiles(0, filesNumber);
|
|
|
|
|
|
|
|
|
|
|
|
for (filesIt = filesList.begin(); filesIt != filesList.end() ; ++filesIt)
|
|
|
|
for (filesIt = filesList.begin(); filesIt != filesList.end() ; ++filesIt)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1306,12 +1309,13 @@ void TDEFileReplacePart::fileSearch(const TQString& directoryName, const TQStrin
|
|
|
|
kapp->processEvents();
|
|
|
|
kapp->processEvents();
|
|
|
|
search(filePath, fileName);
|
|
|
|
search(filePath, fileName);
|
|
|
|
filesNumber++;
|
|
|
|
filesNumber++;
|
|
|
|
m_view->displayScannedFiles(filesNumber);
|
|
|
|
m_view->displayScannedFiles(0, filesNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_view->displayScannedFiles(1, filesNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TDEFileReplacePart::recursiveFileSearch(const TQString &directoryName, const TQString &filters,
|
|
|
|
void TDEFileReplacePart::recursiveFileSearch(const TQString &directoryName, const TQString &filters,
|
|
|
|
uint& filesNumber, int depth)
|
|
|
|
int &foldersNumber, int &filesNumber, int depth)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// if m_stop == true or the max depth level is reached, then interrupt recursion
|
|
|
|
// if m_stop == true or the max depth level is reached, then interrupt recursion
|
|
|
|
if (m_stop || (m_option->m_limitDepth && depth > m_option->m_maxDepth))
|
|
|
|
if (m_stop || (m_option->m_limitDepth && depth > m_option->m_maxDepth))
|
|
|
@ -1329,8 +1333,7 @@ void TDEFileReplacePart::recursiveFileSearch(const TQString& directoryName, cons
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TQDir d(directoryName);
|
|
|
|
TQDir d(directoryName);
|
|
|
|
|
|
|
|
|
|
|
|
d.setMatchAllDirs(true);
|
|
|
|
d.setMatchAllDirs(true);
|
|
|
@ -1353,7 +1356,7 @@ void TDEFileReplacePart::recursiveFileSearch(const TQString& directoryName, cons
|
|
|
|
// Composes file path string
|
|
|
|
// Composes file path string
|
|
|
|
TQFileInfo fileInfo(filePath+"/"+fileName);
|
|
|
|
TQFileInfo fileInfo(filePath+"/"+fileName);
|
|
|
|
|
|
|
|
|
|
|
|
m_view->displayScannedFiles(filesNumber);
|
|
|
|
m_view->displayScannedFiles(foldersNumber, filesNumber);
|
|
|
|
|
|
|
|
|
|
|
|
kapp->processEvents();
|
|
|
|
kapp->processEvents();
|
|
|
|
// Searchs recursively if "filePath" is a directory and we have not reached the max depth level
|
|
|
|
// Searchs recursively if "filePath" is a directory and we have not reached the max depth level
|
|
|
@ -1361,17 +1364,19 @@ void TDEFileReplacePart::recursiveFileSearch(const TQString& directoryName, cons
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!m_option->m_limitDepth || depth < m_option->m_maxDepth)
|
|
|
|
if (!m_option->m_limitDepth || depth < m_option->m_maxDepth)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
recursiveFileSearch(filePath+"/"+fileName, filters, filesNumber, depth+1);
|
|
|
|
recursiveFileSearch(filePath+"/"+fileName, filters, foldersNumber, filesNumber, depth+1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
search(filePath, fileName);
|
|
|
|
search(filePath, fileName);
|
|
|
|
filesNumber++;
|
|
|
|
filesNumber++;
|
|
|
|
m_view->displayScannedFiles(filesNumber);
|
|
|
|
m_view->displayScannedFiles(foldersNumber, filesNumber);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foldersNumber++;
|
|
|
|
|
|
|
|
m_view->displayScannedFiles(foldersNumber, filesNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TDEFileReplacePart::search(const TQString& currentDir, const TQString& fileName)
|
|
|
|
void TDEFileReplacePart::search(const TQString& currentDir, const TQString& fileName)
|
|
|
|