From 10db438b9a5b758a384d4c007e88f1cda2981cc8 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Fri, 21 Jun 2019 23:01:51 +0900 Subject: tdefilereplace: - removed old unused code - removed broken and non functional "recent string files" menu code - moved string load code from part to view, together with the save code. Signed-off-by: Michele Calgaro --- tdefilereplace/tdefilereplacelib.cpp | 78 +----------------------------------- 1 file changed, 1 insertion(+), 77 deletions(-) (limited to 'tdefilereplace/tdefilereplacelib.cpp') diff --git a/tdefilereplace/tdefilereplacelib.cpp b/tdefilereplace/tdefilereplacelib.cpp index cf9b578..4246fc8 100644 --- a/tdefilereplace/tdefilereplacelib.cpp +++ b/tdefilereplace/tdefilereplacelib.cpp @@ -3,7 +3,7 @@ ------------------- begin : lun mai 3 20:19:52 CEST 1999 - copyright : (C) 1999 by François Dupoux + copyright : (C) 1999 by François Dupoux (C) 2003 Andras Mantia (C) 2004 Emiliano Gulmini email : dupoux@dupoux.com @@ -119,82 +119,6 @@ TQString TDEFileReplaceLib::formatFileSize(double size) return stringSize; } -void TDEFileReplaceLib::convertOldToNewKFRFormat(const TQString& fileName, TDEListView* stringView) -{ - //this method convert old format in new XML-based format - typedef struct - { - char pgm[13]; // Must be "TDEFileReplace" : like MZ for EXE files - int stringNumber; // Number of strings in file - char reserved[64]; // Reserved for future use - } KFRHeader; - - KFRHeader head; - - FILE* f = fopen(fileName.ascii(),"rb"); - int err = fread(&head, sizeof(KFRHeader), 1, f); - TQString pgm(head.pgm); - - if(!f || (err != 1) || (pgm != "TDEFileReplace")) - { - KMessageBox::error(0, i18n("Cannot open the file %1 and load the string list. This file seems not to be a valid old kfr file or it is broken.").arg(fileName)); - return ; - } - - stringView->clear(); - - int oldTextSize, - newTextSize, - errors = 0, - stringSize; - TQStringList l; - - int i ; - for (i=0; i < head.stringNumber; i++) - { - errors += (fread(&oldTextSize, sizeof(int), 1, f)) != 1; - errors += (fread(&newTextSize, sizeof(int), 1, f)) != 1; - if(errors > 0) - KMessageBox::error(0, i18n("Cannot read data.")); - else - { - stringSize = ((oldTextSize > newTextSize) ? oldTextSize : newTextSize) + 2; - char* oldString = (char*) malloc(stringSize+10), - * newString = (char*) malloc(stringSize+10); - memset(oldString, 0, stringSize); - memset(newString,0, stringSize); - if (oldString == 0 || newString == 0) - KMessageBox::error(0, i18n("Out of memory.")); - else - { - if (fread(oldString, oldTextSize, 1, f) != 1) - KMessageBox::error(0, i18n("Cannot read data.")); - else - { - if (newTextSize > 0) // If there is a Replace text - { - if (fread(newString, newTextSize, 1, f) != 1) - KMessageBox::error(0, i18n("Cannot read data.")); - else - { - TQListViewItem* lvi = new TQListViewItem(stringView); - lvi->setText(0,oldString); - lvi->setText(1,newString); - - if(newString) - free(newString); - if(oldString) - free(oldString); - } - } - } - } - } - } - fclose(f); - return ; - } - bool TDEFileReplaceLib::isAnAccessibleFile(const TQString& filePath, const TQString& fileName, RCOptions* info) { TQString bkExt = info->m_backupExtension; -- cgit v1.2.1