diff options
Diffstat (limited to 'kfilereplace/kfilereplacepart.cpp')
-rw-r--r-- | kfilereplace/kfilereplacepart.cpp | 352 |
1 files changed, 176 insertions, 176 deletions
diff --git a/kfilereplace/kfilereplacepart.cpp b/kfilereplace/kfilereplacepart.cpp index 9e0be192..adfd6a4f 100644 --- a/kfilereplace/kfilereplacepart.cpp +++ b/kfilereplace/kfilereplacepart.cpp @@ -13,11 +13,11 @@ // // QT -#include <qdir.h> -#include <qdatastream.h> -#include <qregexp.h> -#include <qimage.h> -#include <qtextcodec.h> +#include <tqdir.h> +#include <tqdatastream.h> +#include <tqregexp.h> +#include <tqimage.h> +#include <tqtextcodec.h> // KDE #include <dcopclient.h> @@ -60,7 +60,7 @@ typedef KParts::GenericFactory<KFileReplacePart> FileReplaceFactory; K_EXPORT_COMPONENT_FACTORY( libkfilereplacepart, FileReplaceFactory ) -KFileReplacePart::KFileReplacePart(QWidget* parentWidget, const char* , QObject* parent, const char* name, const QStringList & ) : KParts::ReadOnlyPart(parent,name) +KFileReplacePart::KFileReplacePart(TQWidget* parentWidget, const char* , TQObject* parent, const char* name, const TQStringList & ) : KParts::ReadOnlyPart(parent,name) { setInstance(FileReplaceFactory::instance()); KGlobal::locale()->insertCatalogue("kfilereplace"); @@ -68,7 +68,7 @@ KFileReplacePart::KFileReplacePart(QWidget* parentWidget, const char* , QObject* m_config = new KConfig("kfilereplacerc"); m_aboutDlg = 0; m_stop = false; - m_optionMask = QDir::Files; + m_optionMask = TQDir::Files; m_w = widget(); m_option = 0; @@ -114,13 +114,13 @@ void KFileReplacePart::slotSearchingOperation() rv->setSorting(-1); // show wait cursor - QApplication::setOverrideCursor( Qt::waitCursor ); + TQApplication::setOverrideCursor( Qt::waitCursor ); freezeActions(); setOptionMask(); - QString currentDirectory = m_option->m_directories[0], + TQString currentDirectory = m_option->m_directories[0], currentFilter = m_option->m_filters[0]; //m_currentDir = currentDirectory; @@ -146,7 +146,7 @@ void KFileReplacePart::slotSearchingOperation() // restore false status for stop button m_stop = false; - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); emit setStatusBarText(i18n("Search completed.")); @@ -179,7 +179,7 @@ void KFileReplacePart::slotReplacingOperation() rv->setColumnText(4,i18n("Replaced strings")); } // show wait cursor - QApplication::setOverrideCursor( Qt::waitCursor ); + TQApplication::setOverrideCursor( Qt::waitCursor ); freezeActions(); @@ -189,7 +189,7 @@ void KFileReplacePart::slotReplacingOperation() m_view->showSemaphore("green"); - QString currentDirectory = m_option->m_directories[0]; + TQString currentDirectory = m_option->m_directories[0]; m_view->showSemaphore("red"); @@ -210,7 +210,7 @@ void KFileReplacePart::slotReplacingOperation() // restore false status for stop button m_stop = false; - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); m_option->m_searchingOnlyMode = false; @@ -232,7 +232,7 @@ void KFileReplacePart::slotStop() { emit setStatusBarText(i18n("Stopping...")); m_stop = true; - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); resetActions(); } @@ -248,21 +248,21 @@ void KFileReplacePart::slotCreateReport() return ; } // Select the file where results will be saved - QString documentName = KFileDialog::getSaveFileName(QString::null, "*.xml|XML " + i18n("Files") + " (*.xml)", m_w, i18n("Save Report")); + TQString documentName = KFileDialog::getSaveFileName(TQString::null, "*.xml|XML " + i18n("Files") + " (*.xml)", m_w, i18n("Save Report")); if (documentName.isEmpty()) return ; // delete a spourious extension documentName.truncate(documentName.length()-4); - QFileInfo fileInfo(documentName); + TQFileInfo fileInfo(documentName); if(fileInfo.exists()) { KMessageBox::error(m_w, i18n("<qt>A folder or a file named <b>%1</b> already exists.</qt>").arg(documentName)); return ; } - QDir directoryName; + TQDir directoryName; if(!directoryName.mkdir(documentName, true)) { @@ -272,7 +272,7 @@ void KFileReplacePart::slotCreateReport() directoryName.cd(documentName); - QString documentPath = documentName+"/"+directoryName.dirName(); + TQString documentPath = documentName+"/"+directoryName.dirName(); Report report(m_option, rv, sv); report.createDocument(documentPath); @@ -291,8 +291,8 @@ void KFileReplacePart::slotQuickStringsAdd() //this slot handles a pair of strings that come from project dialog, //if the control character 'N' is found at the position 0 of the two strings, //then we start the search now. - QString qs = m_option->m_quickSearchString; - QStringList map; + TQString qs = m_option->m_quickSearchString; + TQStringList map; map.append(qs.left(1)); map.append(qs.right(qs.length()-1)); @@ -344,8 +344,8 @@ void KFileReplacePart::slotStringsSave() void KFileReplacePart::slotStringsLoad() { // Selects the file to load from - QString menu = "*.kfr|" + i18n("KFileReplace strings") + " (*.kfr)\n*|"+i18n("All Files") + " (*)"; - QString fileName = KFileDialog::getOpenFileName(QString::null, menu, m_w, i18n("Load Strings From File")); + TQString menu = "*.kfr|" + i18n("KFileReplace strings") + " (*.kfr)\n*|"+i18n("All Files") + " (*)"; + TQString fileName = KFileDialog::getOpenFileName(TQString::null, menu, m_w, i18n("Load Strings From File")); if(!fileName.isEmpty()) loadRulesFile(fileName); @@ -367,14 +367,14 @@ void KFileReplacePart::slotStringsInvertAll() void KFileReplacePart::slotOpenRecentStringFile(const KURL& urlFile) { - QString fileName; + TQString fileName; // Downloads file if need (if url is "http://...") if (!(KIO::NetAccess::download(urlFile, fileName, 0))) return; // Checks it's not a directory - QFileInfo fileInfo; + TQFileInfo fileInfo; fileInfo.setFile(fileName); if(fileInfo.isDir()) { @@ -431,7 +431,7 @@ void KFileReplacePart::slotOptionPreferences() void KFileReplacePart::showAboutApplication() { - m_aboutDlg = new KAboutApplication(createAboutData(), (QWidget *)0, (const char *)0, false); + m_aboutDlg = new KAboutApplication(createAboutData(), (TQWidget *)0, (const char *)0, false); if(m_aboutDlg == 0) return; @@ -443,7 +443,7 @@ void KFileReplacePart::showAboutApplication() void KFileReplacePart::appHelpActivated() { - kapp->invokeHelp(QString::null, "kfilereplace"); + kapp->invokeHelp(TQString::null, "kfilereplace"); } void KFileReplacePart::reportBug() @@ -567,48 +567,48 @@ void KFileReplacePart::initGUI() } } // File - (void)new KAction(i18n("Customize Search/Replace Session..."), "projectopen", 0, this, SLOT(slotSetNewParameters()), actionCollection(), "new_project"); - (void)new KAction(i18n("&Search"), "filesearch", 0, this, SLOT(slotSearchingOperation()), actionCollection(), "search"); - (void)new KAction(i18n("S&imulate"), "filesimulate", 0, this, SLOT(slotSimulatingOperation()), actionCollection(), "file_simulate"); - (void)new KAction(i18n("&Replace"), "filereplace", 0, this, SLOT(slotReplacingOperation()), actionCollection(), "replace"); - (void)new KAction(i18n("Sto&p"), "stop", 0, this, SLOT(slotStop()), actionCollection(), "stop"); - (void)new KAction(i18n("Cre&ate Report File..."), "filesaveas", 0, this, SLOT(slotCreateReport()), actionCollection(), "save_results"); + (void)new KAction(i18n("Customize Search/Replace Session..."), "projectopen", 0, this, TQT_SLOT(slotSetNewParameters()), actionCollection(), "new_project"); + (void)new KAction(i18n("&Search"), "filesearch", 0, this, TQT_SLOT(slotSearchingOperation()), actionCollection(), "search"); + (void)new KAction(i18n("S&imulate"), "filesimulate", 0, this, TQT_SLOT(slotSimulatingOperation()), actionCollection(), "file_simulate"); + (void)new KAction(i18n("&Replace"), "filereplace", 0, this, TQT_SLOT(slotReplacingOperation()), actionCollection(), "replace"); + (void)new KAction(i18n("Sto&p"), "stop", 0, this, TQT_SLOT(slotStop()), actionCollection(), "stop"); + (void)new KAction(i18n("Cre&ate Report File..."), "filesaveas", 0, this, TQT_SLOT(slotCreateReport()), actionCollection(), "save_results"); // Strings - (void)new KAction(i18n("&Add String..."), "editadd", 0, this, SLOT(slotStringsAdd()), actionCollection(), "strings_add"); + (void)new KAction(i18n("&Add String..."), "editadd", 0, this, TQT_SLOT(slotStringsAdd()), actionCollection(), "strings_add"); - (void)new KAction(i18n("&Delete String"), "editremove", 0, this, SLOT(slotStringsDeleteItem()), actionCollection(), "strings_del"); - (void)new KAction(i18n("&Empty Strings List"), "editdelete", 0, this, SLOT(slotStringsEmpty()), actionCollection(), "strings_empty"); - (void)new KAction(i18n("Edit Selected String..."), "edit", 0, this, SLOT(slotStringsEdit()), actionCollection(), "strings_edit"); - (void)new KAction(i18n("&Save Strings List to File..."), "filesaveas", 0, this, SLOT(slotStringsSave()), actionCollection(), "strings_save"); - (void)new KAction(i18n("&Load Strings List From File..."), "unsortedList", 0, this, SLOT(slotStringsLoad()), actionCollection(), "strings_load"); - (void)new KRecentFilesAction(i18n("&Load Recent Strings Files"), "fileopen", 0, this, SLOT(slotOpenRecentStringFile(const KURL&)), actionCollection(),"strings_load_recent"); - (void)new KAction(i18n("&Invert Current String (search <--> replace)"), "invert", 0, this, SLOT(slotStringsInvertCur()), actionCollection(), "strings_invert"); - (void)new KAction(i18n("&Invert All Strings (search <--> replace)"), "invert", 0, this, SLOT(slotStringsInvertAll()), actionCollection(), "strings_invert_all"); + (void)new KAction(i18n("&Delete String"), "editremove", 0, this, TQT_SLOT(slotStringsDeleteItem()), actionCollection(), "strings_del"); + (void)new KAction(i18n("&Empty Strings List"), "editdelete", 0, this, TQT_SLOT(slotStringsEmpty()), actionCollection(), "strings_empty"); + (void)new KAction(i18n("Edit Selected String..."), "edit", 0, this, TQT_SLOT(slotStringsEdit()), actionCollection(), "strings_edit"); + (void)new KAction(i18n("&Save Strings List to File..."), "filesaveas", 0, this, TQT_SLOT(slotStringsSave()), actionCollection(), "strings_save"); + (void)new KAction(i18n("&Load Strings List From File..."), "unsortedList", 0, this, TQT_SLOT(slotStringsLoad()), actionCollection(), "strings_load"); + (void)new KRecentFilesAction(i18n("&Load Recent Strings Files"), "fileopen", 0, this, TQT_SLOT(slotOpenRecentStringFile(const KURL&)), actionCollection(),"strings_load_recent"); + (void)new KAction(i18n("&Invert Current String (search <--> replace)"), "invert", 0, this, TQT_SLOT(slotStringsInvertCur()), actionCollection(), "strings_invert"); + (void)new KAction(i18n("&Invert All Strings (search <--> replace)"), "invert", 0, this, TQT_SLOT(slotStringsInvertAll()), actionCollection(), "strings_invert_all"); // Options - (void)new KToggleAction(i18n("&Include Sub-Folders"), "recursive_option", 0, this, SLOT(slotOptionRecursive()), actionCollection(), "options_recursive"); - (void)new KToggleAction(i18n("Create &Backup Files"), "backup_option", 0, this, SLOT(slotOptionBackup()), actionCollection(), "options_backup"); - (void)new KToggleAction(i18n("Case &Sensitive"), "casesensitive_option", 0, this, SLOT(slotOptionCaseSensitive()), actionCollection(), "options_case"); - (void)new KToggleAction(i18n("Enable Commands &in Replace String: [$command:option$]"), "command_option", 0, this, SLOT(slotOptionVariables()), actionCollection(), "options_var"); - (void)new KToggleAction(i18n("Enable &Regular Expressions"), "regularexpression_option", 0, this, SLOT(slotOptionRegularExpressions()), actionCollection(), "options_regularexpressions"); - (void)new KAction(i18n("Configure &KFileReplace..."), "configure", 0, this, SLOT(slotOptionPreferences()), actionCollection(), "configure_kfilereplace"); + (void)new KToggleAction(i18n("&Include Sub-Folders"), "recursive_option", 0, this, TQT_SLOT(slotOptionRecursive()), actionCollection(), "options_recursive"); + (void)new KToggleAction(i18n("Create &Backup Files"), "backup_option", 0, this, TQT_SLOT(slotOptionBackup()), actionCollection(), "options_backup"); + (void)new KToggleAction(i18n("Case &Sensitive"), "casesensitive_option", 0, this, TQT_SLOT(slotOptionCaseSensitive()), actionCollection(), "options_case"); + (void)new KToggleAction(i18n("Enable Commands &in Replace String: [$command:option$]"), "command_option", 0, this, TQT_SLOT(slotOptionVariables()), actionCollection(), "options_var"); + (void)new KToggleAction(i18n("Enable &Regular Expressions"), "regularexpression_option", 0, this, TQT_SLOT(slotOptionRegularExpressions()), actionCollection(), "options_regularexpressions"); + (void)new KAction(i18n("Configure &KFileReplace..."), "configure", 0, this, TQT_SLOT(slotOptionPreferences()), actionCollection(), "configure_kfilereplace"); // Results - (void)new KAction(i18n("&Properties"), "informations", 0, m_view, SLOT(slotResultProperties()), actionCollection(), "results_infos"); - (void)new KAction(i18n("&Open"), "filenew", 0, m_view, SLOT(slotResultOpen()), actionCollection(), "results_openfile"); + (void)new KAction(i18n("&Properties"), "informations", 0, m_view, TQT_SLOT(slotResultProperties()), actionCollection(), "results_infos"); + (void)new KAction(i18n("&Open"), "filenew", 0, m_view, TQT_SLOT(slotResultOpen()), actionCollection(), "results_openfile"); if(quantaFound) { - (void)new KAction(i18n("&Edit in Quanta"), "quanta", 0, m_view, SLOT(slotResultEdit()), actionCollection(), "results_editfile"); + (void)new KAction(i18n("&Edit in Quanta"), "quanta", 0, m_view, TQT_SLOT(slotResultEdit()), actionCollection(), "results_editfile"); } - (void)new KAction(i18n("Open Parent &Folder"), "fileopen", 0, m_view, SLOT(slotResultDirOpen()), actionCollection(), "results_opendir"); - (void)new KAction(i18n("&Delete"), "editdelete", 0, m_view, SLOT(slotResultDelete()), actionCollection(), "results_delete"); - (void)new KAction(i18n("E&xpand Tree"), 0, m_view, SLOT(slotResultTreeExpand()), actionCollection(), "results_treeexpand"); - (void)new KAction(i18n("&Reduce Tree"), 0, m_view, SLOT(slotResultTreeReduce()), actionCollection(), "results_treereduce"); - (void)new KAction(i18n("&About KFileReplace"), "kfilereplace", 0, this, SLOT(showAboutApplication()), actionCollection(), "help_about_kfilereplace"); - (void)new KAction(i18n("KFileReplace &Handbook"), "help", 0, this, SLOT(appHelpActivated()), actionCollection(), "help_kfilereplace"); - (void)new KAction(i18n("&Report Bug"), 0, 0, this, SLOT(reportBug()), actionCollection(), "report_bug"); + (void)new KAction(i18n("Open Parent &Folder"), "fileopen", 0, m_view, TQT_SLOT(slotResultDirOpen()), actionCollection(), "results_opendir"); + (void)new KAction(i18n("&Delete"), "editdelete", 0, m_view, TQT_SLOT(slotResultDelete()), actionCollection(), "results_delete"); + (void)new KAction(i18n("E&xpand Tree"), 0, m_view, TQT_SLOT(slotResultTreeExpand()), actionCollection(), "results_treeexpand"); + (void)new KAction(i18n("&Reduce Tree"), 0, m_view, TQT_SLOT(slotResultTreeReduce()), actionCollection(), "results_treereduce"); + (void)new KAction(i18n("&About KFileReplace"), "kfilereplace", 0, this, TQT_SLOT(showAboutApplication()), actionCollection(), "help_about_kfilereplace"); + (void)new KAction(i18n("KFileReplace &Handbook"), "help", 0, this, TQT_SLOT(appHelpActivated()), actionCollection(), "help_kfilereplace"); + (void)new KAction(i18n("&Report Bug"), 0, 0, this, TQT_SLOT(reportBug()), actionCollection(), "report_bug"); } @@ -703,7 +703,7 @@ void KFileReplacePart::loadOptions() m_option->m_askConfirmReplace = m_config->readBoolEntry(rcAskConfirmReplace, AskConfirmReplaceOption); - QString dontAskAgain = m_config->readEntry(rcDontAskAgain, "no"); + TQString dontAskAgain = m_config->readEntry(rcDontAskAgain, "no"); if(dontAskAgain == "yes") m_option->m_askConfirmReplace = false; @@ -730,7 +730,7 @@ void KFileReplacePart::loadOwnerOptions() { m_config->setGroup("Owner options"); - QStringList ownerList = QStringList::split(',',m_config->readEntry(rcOwnerUser, OwnerOption),true); + TQStringList ownerList = TQStringList::split(',',m_config->readEntry(rcOwnerUser, OwnerOption),true); if(ownerList[0] == "true") m_option->m_ownerUserIsChecked = true; else @@ -740,7 +740,7 @@ void KFileReplacePart::loadOwnerOptions() m_option->m_ownerUserBool = ownerList[2]; m_option->m_ownerUserValue = ownerList[3]; - ownerList = QStringList::split(',',m_config->readEntry(rcOwnerGroup, OwnerOption),true); + ownerList = TQStringList::split(',',m_config->readEntry(rcOwnerGroup, OwnerOption),true); if(ownerList[0] == "true") m_option->m_ownerGroupIsChecked = true; @@ -755,7 +755,7 @@ void KFileReplacePart::loadOwnerOptions() void KFileReplacePart::loadLocationsList() { m_config->setGroup("Directories"); - QStringList locationsEntryList; + TQStringList locationsEntryList; #if KDE_IS_VERSION(3,1,3) locationsEntryList = m_config->readPathListEntry(rcDirectoriesList); #else @@ -763,14 +763,14 @@ void KFileReplacePart::loadLocationsList() #endif if(locationsEntryList.isEmpty()) - locationsEntryList.append(QDir::current().path()); + locationsEntryList.append(TQDir::current().path()); m_option->m_directories = locationsEntryList; } void KFileReplacePart::loadFiltersList() { - QStringList filtersEntryList; + TQStringList filtersEntryList; m_config->setGroup("Filters"); #if KDE_IS_VERSION(3,1,3) @@ -788,7 +788,7 @@ void KFileReplacePart::loadFiltersList() void KFileReplacePart::loadBackupExtensionOptions() { m_config->setGroup("Options"); - QStringList bkList = QStringList::split(',', + TQStringList bkList = TQStringList::split(',', m_config->readEntry(rcBackupExtension, BackupExtensionOption), true); if(bkList[0] == "true") @@ -866,7 +866,7 @@ void KFileReplacePart::saveOwnerOptions() { m_config->setGroup("Owner options"); - QString list; + TQString list; if(m_option->m_ownerUserIsChecked) list = "true,"; else @@ -916,7 +916,7 @@ void KFileReplacePart::saveFiltersList() void KFileReplacePart::saveBackupExtensionOptions() { m_config->setGroup("Options"); - QString bkOptions; + TQString bkOptions; if(m_option->m_backup) bkOptions = "true," + m_option->m_backupExtension; else @@ -928,21 +928,21 @@ void KFileReplacePart::saveBackupExtensionOptions() void KFileReplacePart::fileReplace() { - QString directoryName = m_option->m_directories[0]; - QDir d(directoryName); + TQString directoryName = m_option->m_directories[0]; + TQDir d(directoryName); d.setMatchAllDirs(true); d.setFilter(m_optionMask); - QString currentFilter = m_option->m_filters[0]; - QStringList filesList = d.entryList(currentFilter); - QStringList::iterator filesIt; + TQString currentFilter = m_option->m_filters[0]; + TQStringList filesList = d.entryList(currentFilter); + TQStringList::iterator filesIt; int filesNumber = 0; m_view->displayScannedFiles(filesNumber); for (filesIt = filesList.begin(); filesIt != filesList.end() ; ++filesIt) { - QString fileName = (*filesIt); + TQString fileName = (*filesIt); // m_stop == true means that we pushed the stop button if(m_stop) @@ -962,21 +962,21 @@ void KFileReplacePart::fileReplace() } } -void KFileReplacePart::recursiveFileReplace(const QString& directoryName, int& filesNumber) +void KFileReplacePart::recursiveFileReplace(const TQString& directoryName, int& filesNumber) { //if m_stop == true then interrupts recursion if(m_stop) return; else { - QDir d(directoryName); + TQDir d(directoryName); d.setMatchAllDirs(true); d.setFilter(m_optionMask); - QString currentFilter = m_option->m_filters[0]; - QStringList filesList = d.entryList(currentFilter); - QStringList::iterator filesIt; + TQString currentFilter = m_option->m_filters[0]; + TQStringList filesList = d.entryList(currentFilter); + TQStringList::iterator filesIt; for(filesIt = filesList.begin(); filesIt != filesList.end(); ++filesIt) { @@ -984,15 +984,15 @@ void KFileReplacePart::recursiveFileReplace(const QString& directoryName, int& f if(m_stop) break; - QString fileName = (*filesIt); + TQString fileName = (*filesIt); // Avoids files that not match requirements if(!KFileReplaceLib::isAnAccessibleFile(d.canonicalPath(),fileName, m_option)) continue; - QString filePath = d.canonicalPath()+"/"+fileName; + TQString filePath = d.canonicalPath()+"/"+fileName; - QFileInfo qi(filePath); + TQFileInfo qi(filePath); m_view->displayScannedFiles(filesNumber); @@ -1014,30 +1014,30 @@ void KFileReplacePart::recursiveFileReplace(const QString& directoryName, int& f } } -void KFileReplacePart::replaceAndBackup(const QString& currentDir, const QString& oldFileName) +void KFileReplacePart::replaceAndBackup(const TQString& currentDir, const TQString& oldFileName) { //Creates a path string - QString oldPathString = currentDir+"/"+oldFileName; + TQString oldPathString = currentDir+"/"+oldFileName; - QFile currentFile(oldPathString); + TQFile currentFile(oldPathString); if(!currentFile.open(IO_ReadOnly)) { - KMessageBox::information(m_w, i18n("<qt>Cannot open file <b>%1</b> for reading.</qt>").arg(oldFileName),QString::null, rcNotifyOnErrors); + KMessageBox::information(m_w, i18n("<qt>Cannot open file <b>%1</b> for reading.</qt>").arg(oldFileName),TQString::null, rcNotifyOnErrors); return ; } - QTextStream currentStream(¤tFile); + TQTextStream currentStream(¤tFile); if (m_option->m_encoding == "utf8") - currentStream.setEncoding(QTextStream::UnicodeUTF8); + currentStream.setEncoding(TQTextStream::UnicodeUTF8); else - currentStream.setCodec(QTextCodec::codecForName(m_option->m_encoding)); - QString line = currentStream.read(), + currentStream.setCodec(TQTextCodec::codecForName(m_option->m_encoding)); + TQString line = currentStream.read(), backupLine = line; - QString backupSize = KFileReplaceLib::formatFileSize(currentFile.size()); + TQString backupSize = KFileReplaceLib::formatFileSize(currentFile.size()); currentFile.close(); - QString backupExtension = m_option->m_backupExtension; + TQString backupExtension = m_option->m_backupExtension; bool atLeastOneStringFound = false; KListViewItem *item = 0; @@ -1058,17 +1058,17 @@ void KFileReplacePart::replaceAndBackup(const QString& currentDir, const QString { if(atLeastOneStringFound) { - QFile newFile(oldPathString); + TQFile newFile(oldPathString); if(!newFile.open(IO_WriteOnly)) { - KMessageBox::information(m_w, i18n("<qt>Cannot open file <b>%1</b> for writing.</qt>").arg(oldFileName),QString::null, rcNotifyOnErrors); + KMessageBox::information(m_w, i18n("<qt>Cannot open file <b>%1</b> for writing.</qt>").arg(oldFileName),TQString::null, rcNotifyOnErrors); return ; } - QTextStream newStream(&newFile); + TQTextStream newStream(&newFile); if (m_option->m_encoding == "utf8") - newStream.setEncoding(QTextStream::UnicodeUTF8); + newStream.setEncoding(TQTextStream::UnicodeUTF8); else - newStream.setCodec(QTextCodec::codecForName(m_option->m_encoding)); + newStream.setCodec(TQTextCodec::codecForName(m_option->m_encoding)); newStream << line; newFile.close(); } @@ -1077,14 +1077,14 @@ void KFileReplacePart::replaceAndBackup(const QString& currentDir, const QString if(!m_option->m_ignoreFiles) atLeastOneStringFound = true; - QFileInfo oldFileInfo(oldPathString); + TQFileInfo oldFileInfo(oldPathString); if(atLeastOneStringFound && item/* && atLeastOneStringConfirmed*/) { KFileReplaceLib::setIconForFileEntry(item,currentDir+"/"+oldFileName); item->setText(0,oldFileName); item->setText(1,currentDir); - QString newSize = KFileReplaceLib::formatFileSize(oldFileInfo.size()); + TQString newSize = KFileReplaceLib::formatFileSize(oldFileInfo.size()); if(!m_option->m_simulation) { item->setText(2, backupSize); @@ -1096,33 +1096,33 @@ void KFileReplacePart::replaceAndBackup(const QString& currentDir, const QString item->setText(3, "-"); } - item->setText(4,QString::number(occurrence,10)); - item->setText(5,QString("%1[%2]").arg(oldFileInfo.owner()).arg(oldFileInfo.ownerId())); - item->setText(6,QString("%1[%2]").arg(oldFileInfo.group()).arg(oldFileInfo.groupId())); + item->setText(4,TQString::number(occurrence,10)); + item->setText(5,TQString("%1[%2]").arg(oldFileInfo.owner()).arg(oldFileInfo.ownerId())); + item->setText(6,TQString("%1[%2]").arg(oldFileInfo.group()).arg(oldFileInfo.groupId())); } } -void KFileReplacePart::replaceAndOverwrite(const QString& currentDir, const QString& oldFileName) +void KFileReplacePart::replaceAndOverwrite(const TQString& currentDir, const TQString& oldFileName) { - QString oldPathString = currentDir+"/"+oldFileName; - QFile oldFile(oldPathString); - QFileInfo oldFileInfo(oldPathString); + TQString oldPathString = currentDir+"/"+oldFileName; + TQFile oldFile(oldPathString); + TQFileInfo oldFileInfo(oldPathString); if (!oldFile.open(IO_ReadOnly)) { - KMessageBox::information(m_w, i18n("<qt>Cannot open file <b>%1</b> for reading.</qt>").arg(oldFile.name()),QString::null, rcNotifyOnErrors); + KMessageBox::information(m_w, i18n("<qt>Cannot open file <b>%1</b> for reading.</qt>").arg(oldFile.name()),TQString::null, rcNotifyOnErrors); return ; } - QString fileSizeBeforeReplacing = KFileReplaceLib::formatFileSize(oldFileInfo.size()); + TQString fileSizeBeforeReplacing = KFileReplaceLib::formatFileSize(oldFileInfo.size()); KListViewItem *item = 0; - QTextStream oldStream( &oldFile ); + TQTextStream oldStream( &oldFile ); if (m_option->m_encoding == "utf8") - oldStream.setEncoding(QTextStream::UnicodeUTF8); + oldStream.setEncoding(TQTextStream::UnicodeUTF8); else - oldStream.setCodec(QTextCodec::codecForName(m_option->m_encoding)); - QString line = oldStream.read(); + oldStream.setCodec(TQTextCodec::codecForName(m_option->m_encoding)); + TQString line = oldStream.read(); oldFile.close(); @@ -1136,24 +1136,24 @@ void KFileReplacePart::replaceAndOverwrite(const QString& currentDir, const QStr { if(atLeastOneStringFound) { - QFile newFile(oldPathString); + TQFile newFile(oldPathString); if(!newFile.open(IO_WriteOnly)) { - KMessageBox::information(m_w, i18n("<qt>Cannot open file <b>%1</b> for writing.</qt>").arg(newFile.name()),QString::null, rcNotifyOnErrors); + KMessageBox::information(m_w, i18n("<qt>Cannot open file <b>%1</b> for writing.</qt>").arg(newFile.name()),TQString::null, rcNotifyOnErrors); return ; } - QTextStream newStream( &newFile ); + TQTextStream newStream( &newFile ); if (m_option->m_encoding == "utf8") - newStream.setEncoding(QTextStream::UnicodeUTF8); + newStream.setEncoding(TQTextStream::UnicodeUTF8); else - newStream.setCodec(QTextCodec::codecForName(m_option->m_encoding)); + newStream.setCodec(TQTextCodec::codecForName(m_option->m_encoding)); newStream << line; newFile.close(); } } - QFileInfo nf(oldPathString); - QString fileSizeAfterReplacing = KFileReplaceLib::formatFileSize(nf.size()); + TQFileInfo nf(oldPathString); + TQString fileSizeAfterReplacing = KFileReplaceLib::formatFileSize(nf.size()); //if ignoreFiles == false then every files must be show if(!m_option->m_ignoreFiles) @@ -1170,13 +1170,13 @@ void KFileReplacePart::replaceAndOverwrite(const QString& currentDir, const QStr else item->setText(3,"-"); - item->setText(4,QString::number(occurrence,10)); - item->setText(5,QString("%1[%2]").arg(oldFileInfo.owner()).arg(oldFileInfo.ownerId())); - item->setText(6,QString("%1[%2]").arg(oldFileInfo.group()).arg(oldFileInfo.groupId())); + item->setText(4,TQString::number(occurrence,10)); + item->setText(5,TQString("%1[%2]").arg(oldFileInfo.owner()).arg(oldFileInfo.ownerId())); + item->setText(6,TQString("%1[%2]").arg(oldFileInfo.group()).arg(oldFileInfo.groupId())); } } -void KFileReplacePart::replacingLoop(QString& line, KListViewItem** item, bool& atLeastOneStringFound, int& occur, bool regularExpression, bool& askConfirmReplace) +void KFileReplacePart::replacingLoop(TQString& line, KListViewItem** item, bool& atLeastOneStringFound, int& occur, bool regularExpression, bool& askConfirmReplace) { KeyValueMap tempMap = m_replacementMap; KeyValueMap::Iterator it; @@ -1204,7 +1204,7 @@ void KFileReplacePart::replacingLoop(QString& line, KListViewItem** item, bool& if(answer == KMessageBox::Yes) { atLeastOneStringFound = true; - QString msg = entry.message(entry.capturedText(line), + TQString msg = entry.message(entry.capturedText(line), entry.lineNumber(line), entry.columnNumber(line)); @@ -1226,7 +1226,7 @@ void KFileReplacePart::replacingLoop(QString& line, KListViewItem** item, bool& else { atLeastOneStringFound = true; - QString msg = entry.message(entry.capturedText(line), + TQString msg = entry.message(entry.capturedText(line), entry.lineNumber(line), entry.columnNumber(line)); @@ -1244,16 +1244,16 @@ void KFileReplacePart::replacingLoop(QString& line, KListViewItem** item, bool& } } -void KFileReplacePart::fileSearch(const QString& directoryName, const QString& filters) +void KFileReplacePart::fileSearch(const TQString& directoryName, const TQString& filters) { - QDir d(directoryName); + TQDir d(directoryName); d.setMatchAllDirs(true); d.setFilter(m_optionMask); - QStringList filesList = d.entryList(filters); - QString filePath = d.canonicalPath(); - QStringList::iterator filesIt; + TQStringList filesList = d.entryList(filters); + TQString filePath = d.canonicalPath(); + TQStringList::iterator filesIt; uint filesNumber = 0; m_view->displayScannedFiles(filesNumber); @@ -1264,13 +1264,13 @@ void KFileReplacePart::fileSearch(const QString& directoryName, const QString& f if(m_stop) break; - QString fileName = (*filesIt); + TQString fileName = (*filesIt); // Avoids files that not match if(!KFileReplaceLib::isAnAccessibleFile(filePath, fileName, m_option)) continue; - QFileInfo fileInfo(filePath+"/"+fileName); + TQFileInfo fileInfo(filePath+"/"+fileName); if(fileInfo.isDir()) continue; kapp->processEvents(); @@ -1280,21 +1280,21 @@ void KFileReplacePart::fileSearch(const QString& directoryName, const QString& f } } -void KFileReplacePart::recursiveFileSearch(const QString& directoryName, const QString& filters, uint& filesNumber) +void KFileReplacePart::recursiveFileSearch(const TQString& directoryName, const TQString& filters, uint& filesNumber) { // if m_stop == true then interrupt recursion if(m_stop) return; else { - QDir d(directoryName); + TQDir d(directoryName); d.setMatchAllDirs(true); d.setFilter(m_optionMask); - QStringList filesList = d.entryList(filters); - QString filePath = d.canonicalPath(); - QStringList::iterator filesIt; + TQStringList filesList = d.entryList(filters); + TQString filePath = d.canonicalPath(); + TQStringList::iterator filesIt; for(filesIt = filesList.begin(); filesIt != filesList.end(); ++filesIt) { @@ -1302,13 +1302,13 @@ void KFileReplacePart::recursiveFileSearch(const QString& directoryName, const Q if(m_stop) break; - QString fileName = (*filesIt); + TQString fileName = (*filesIt); // Avoids files that not match if(!KFileReplaceLib::isAnAccessibleFile(filePath, fileName, m_option)) continue; // Composes file path string - QFileInfo fileInfo(filePath+"/"+fileName); + TQFileInfo fileInfo(filePath+"/"+fileName); m_view->displayScannedFiles(filesNumber); @@ -1326,25 +1326,25 @@ void KFileReplacePart::recursiveFileSearch(const QString& directoryName, const Q } } -void KFileReplacePart::search(const QString& currentDir, const QString& fileName) +void KFileReplacePart::search(const TQString& currentDir, const TQString& fileName) { - QFile file(currentDir+"/"+fileName); + TQFile file(currentDir+"/"+fileName); if(!file.open(IO_ReadOnly)) { - KMessageBox::information(m_w, i18n("<qt>Cannot open file <b>%1</b> for reading.</qt>").arg(fileName), QString::null, rcNotifyOnErrors); + KMessageBox::information(m_w, i18n("<qt>Cannot open file <b>%1</b> for reading.</qt>").arg(fileName), TQString::null, rcNotifyOnErrors); return ; } // Creates a stream with the file - QTextStream stream( &file ); + TQTextStream stream( &file ); if (m_option->m_encoding == "utf8") - stream.setEncoding(QTextStream::UnicodeUTF8); + stream.setEncoding(TQTextStream::UnicodeUTF8); else - stream.setCodec(QTextCodec::codecForName(m_option->m_encoding)); - QString line = stream.read(); + stream.setCodec(TQTextCodec::codecForName(m_option->m_encoding)); + TQString line = stream.read(); file.close(); - QFileInfo fileInfo(currentDir+"/"+fileName); + TQFileInfo fileInfo(currentDir+"/"+fileName); KListViewItem *item = 0; @@ -1366,12 +1366,12 @@ void KFileReplacePart::search(const QString& currentDir, const QString& fileName if(m_stop) break; - QString key = it.key(); - QString strKey; - QRegExp rxKey; + TQString key = it.key(); + TQString strKey; + TQRegExp rxKey; if(m_option->m_regularExpressions) - rxKey = QRegExp("("+key+")", m_option->m_caseSensitive, false); + rxKey = TQRegExp("("+key+")", m_option->m_caseSensitive, false); else strKey = key; /* If this option is true then for any string in @@ -1395,7 +1395,7 @@ void KFileReplacePart::search(const QString& currentDir, const QString& fileName item = new KListViewItem(rv); KListViewItem* tempItem= new KListViewItem(item); - QString msg, + TQString msg, capturedText; if(m_option->m_regularExpressions) @@ -1403,7 +1403,7 @@ void KFileReplacePart::search(const QString& currentDir, const QString& fileName else capturedText = line.mid(pos,strKey.length()); - msg = i18n(" Line:%2, Col:%3 - \"%1\"").arg(capturedText).arg(QString::number(lineNumber,10)).arg(QString::number(columnNumber,10)); + msg = i18n(" Line:%2, Col:%3 - \"%1\"").arg(capturedText).arg(TQString::number(lineNumber,10)).arg(TQString::number(columnNumber,10)); tempItem->setMultiLinesEnabled(true); tempItem->setText(0,msg); occurrence = 1; @@ -1427,7 +1427,7 @@ void KFileReplacePart::search(const QString& currentDir, const QString& fileName break; atLeastOneStringFound = true; - QString msg, + TQString msg, capturedText; int lineNumber = line.mid(0,pos).contains('\n')+1; int columnNumber = pos - line.findRev('\n',pos); @@ -1443,7 +1443,7 @@ void KFileReplacePart::search(const QString& currentDir, const QString& fileName pos = line.find(strKey,pos+strKey.length()); } - msg = i18n(" Line:%2, Col:%3 - \"%1\"").arg(capturedText).arg(QString::number(lineNumber,10)).arg(QString::number(columnNumber,10)); + msg = i18n(" Line:%2, Col:%3 - \"%1\"").arg(capturedText).arg(TQString::number(lineNumber,10)).arg(TQString::number(columnNumber,10)); if(!item) item = new KListViewItem(rv); @@ -1474,22 +1474,22 @@ void KFileReplacePart::search(const QString& currentDir, const QString& fileName item->setText(0,fileName); item->setText(1,currentDir); item->setText(2,KFileReplaceLib::formatFileSize(fileInfo.size())); - item->setText(3,QString::number(occurrence,10)); - item->setText(4,QString("%1[%2]").arg(fileInfo.owner()).arg(fileInfo.ownerId())); - item->setText(5,QString("%1[%2]").arg(fileInfo.group()).arg(fileInfo.groupId())); + item->setText(3,TQString::number(occurrence,10)); + item->setText(4,TQString("%1[%2]").arg(fileInfo.owner()).arg(fileInfo.ownerId())); + item->setText(5,TQString("%1[%2]").arg(fileInfo.group()).arg(fileInfo.groupId())); } } void KFileReplacePart::loadViewContent() { - /* Maps the content of the strings view to a QMap */ + /* Maps the content of the strings view to a TQMap */ KeyValueMap tempMap; CommandEngine command; - QListViewItemIterator itlv(m_view->getStringsView()); + TQListViewItemIterator itlv(m_view->getStringsView()); while(itlv.current()) { - QListViewItem *item = itlv.current(); + TQListViewItem *item = itlv.current(); if(m_option->m_variables) tempMap[item->text(0)] = command.variableValue(item->text(1)); else @@ -1499,12 +1499,12 @@ void KFileReplacePart::loadViewContent() m_replacementMap = tempMap; } -void KFileReplacePart::loadRulesFile(const QString& fileName) +void KFileReplacePart::loadRulesFile(const TQString& fileName) { /* Loads a file with kfr extension. * creates a xml document and browses it*/ - QDomDocument doc("mydocument"); - QFile file(fileName); + TQDomDocument doc("mydocument"); + TQFile file(fileName); KListView* sv = m_view->getStringsView(); if(!file.open(IO_ReadOnly)) @@ -1529,9 +1529,9 @@ void KFileReplacePart::loadRulesFile(const QString& fileName) //clears view sv->clear(); - QDomElement docElem = doc.documentElement(); - QDomNode n = docElem.firstChild(); - QString searchAttribute = n.toElement().attribute("search").latin1(); + TQDomElement docElem = doc.documentElement(); + TQDomNode n = docElem.firstChild(); + TQString searchAttribute = n.toElement().attribute("search").latin1(); KeyValueMap docMap; @@ -1557,10 +1557,10 @@ void KFileReplacePart::loadRulesFile(const QString& fileName) //Reads the string list while(!n.isNull()) { - QDomElement e = n.toElement(); // tries to convert the node to an element. + TQDomElement e = n.toElement(); // tries to convert the node to an element. if(!e.isNull()) { - QString oldString = e.firstChild().toElement().text(), + TQString oldString = e.firstChild().toElement().text(), newString = e.lastChild().toElement().text(); docMap[oldString] = newString; } @@ -1568,7 +1568,7 @@ void KFileReplacePart::loadRulesFile(const QString& fileName) } // Adds file to "load strings form file" menu - QStringList fileList = m_option->m_recentStringFileList; + TQStringList fileList = m_option->m_recentStringFileList; if(!fileList.contains(fileName)) { fileList.append(fileName); @@ -1609,13 +1609,13 @@ bool KFileReplacePart::launchNewProjectDialog(const KURL & startURL) void KFileReplacePart::setOptionMask() { - m_optionMask |= QDir::Dirs; + m_optionMask |= TQDir::Dirs; if(!m_option->m_ignoreHidden) - m_optionMask |= QDir::Hidden; + m_optionMask |= TQDir::Hidden; if(!m_option->m_followSymLinks) - m_optionMask |= QDir::NoSymLinks; + m_optionMask |= TQDir::NoSymLinks; } bool KFileReplacePart::checkBeforeOperation() @@ -1631,11 +1631,11 @@ bool KFileReplacePart::checkBeforeOperation() } // Checks if the main directory can be accessed - QString currentDirectory = m_option->m_directories[0]; - QDir dir; + TQString currentDirectory = m_option->m_directories[0]; + TQDir dir; dir.setPath(currentDirectory); - QString directory = dir.absPath(); + TQString directory = dir.absPath(); if(!dir.exists()) { @@ -1643,7 +1643,7 @@ bool KFileReplacePart::checkBeforeOperation() return false; } - QFileInfo dirInfo(directory); + TQFileInfo dirInfo(directory); if(!(dirInfo.isReadable() && dirInfo.isExecutable()) || (!m_option->m_searchingOnlyMode && !m_option->m_simulation && !(dirInfo.isWritable()))) { @@ -1660,7 +1660,7 @@ bool KFileReplacePart::checkBeforeOperation() bool KFileReplacePart::dontAskAgain() { m_config->setGroup("Notification Messages"); - QString dontAskAgain = m_config->readEntry(rcDontAskAgain, "no"); + TQString dontAskAgain = m_config->readEntry(rcDontAskAgain, "no"); if(dontAskAgain == "yes") return true; else |