- 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>
//this method convert old format in new XML-based format
typedefstruct
{
charpgm[13];// Must be "TDEFileReplace" : like MZ for EXE files
intstringNumber;// Number of strings in file
charreserved[64];// Reserved for future use
}KFRHeader;
KFRHeaderhead;
FILE*f=fopen(fileName.ascii(),"rb");
interr=fread(&head,sizeof(KFRHeader),1,f);
TQStringpgm(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));
(void)newTDEAction(i18n("&Save Strings List to File..."),"document-save-as",0,TQT_TQOBJECT(m_view),TQT_SLOT(slotStringsSave()),actionCollection(),"strings_save");
(void)newTDEAction(i18n("&Load Strings List From File..."),"unsortedList",0,TQT_TQOBJECT(this),TQT_SLOT(slotStringsLoad()),actionCollection(),"strings_load");
(void)newTDEAction(i18n("&Load Strings List From File..."),"unsortedList",0,TQT_TQOBJECT(m_view),TQT_SLOT(slotStringsLoad()),actionCollection(),"strings_load");
(void)newTDEAction(i18n("&Invert Current String (search <--> replace)"),"invert",0,TQT_TQOBJECT(m_view),TQT_SLOT(slotStringsInvertCur()),actionCollection(),"strings_invert");
(void)newTDEAction(i18n("&Invert All Strings (search <--> replace)"),"invert",0,TQT_TQOBJECT(m_view),TQT_SLOT(slotStringsInvertAll()),actionCollection(),"strings_invert_all");
// Loads a file with kfr extension, creates a xml document and browses it
TQDomDocumentdoc("mydocument");
TQFilefile(fileName);
TDEListView*sv=m_view->getStringsView();
if(!file.open(IO_ReadOnly))
{
KMessageBox::error(m_w,i18n("<qt>Cannot open the file <b>%1</b> and load the string list.</qt>").arg(fileName));
return;
}
if(!doc.setContent(&file))
{
file.close();
KMessageBox::information(m_w,i18n("<qt>File <b>%1</b> seems not to be written in new kfr format. Remember that the old kfr format will be soon abandoned. You can convert your old rules files by simply saving them with tdefilereplace.</qt>").arg(fileName),i18n("Warning"));
intanswer=KMessageBox::warningYesNo(m_w,i18n("<qt>The format of kfr files has been changed; attempting to load <b>%1</b>. Please see the KFilereplace manual for details. Do you want to load a search-and-replace list of strings?</qt>").arg(fileName),i18n("Warning"),i18n("Load"),i18n("Do Not Load"));
intanswer=KMessageBox::warningYesNo(this,i18n("<qt>Missing search type. Is this a search-and-replace list of strings?</qt>").arg(fileName),i18n("Warning"),i18n("Yes"),i18n("No"));
if(answer==KMessageBox::Yes)
{
m_option->m_searchingOnlyMode=false;
}
else
{
m_option->m_searchingOnlyMode=true;
}
}
// Refreshes the view appearances
changeView(m_option->m_searchingOnlyMode);
// Reads the string list
KeyValueMapdocMap;
n=n.nextSibling();
while(!n.isNull())
{
TQDomElemente=n.toElement();// tries to convert the node to an element.