summaryrefslogtreecommitdiffstats
path: root/tdefilereplace/tdefilereplacelib.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tdefilereplace/tdefilereplacelib.cpp')
-rw-r--r--tdefilereplace/tdefilereplacelib.cpp78
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;