diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-06-21 23:01:51 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-06-21 23:01:51 +0900 |
commit | 10db438b9a5b758a384d4c007e88f1cda2981cc8 (patch) | |
tree | 0ea1dcecb2f18ce4d77ec5081dad16e8b76fb654 /tdefilereplace/tdefilereplacelib.cpp | |
parent | c722431cbb37b120038bd2d0731e7ef74cce9d75 (diff) | |
download | tdeutils-10db438b9a5b758a384d4c007e88f1cda2981cc8.tar.gz tdeutils-10db438b9a5b758a384d4c007e88f1cda2981cc8.zip |
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 <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdefilereplace/tdefilereplacelib.cpp')
-rw-r--r-- | tdefilereplace/tdefilereplacelib.cpp | 78 |
1 files changed, 1 insertions, 77 deletions
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 <amantia@kde.org> (C) 2004 Emiliano Gulmini <emi_barbarossa@yahoo.it> 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("<qt>Cannot open the file <b>%1</b> and load the string list. This file seems not to be a valid old kfr file or it is broken.</qt>").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; |