|
|
|
@ -467,16 +467,13 @@ void TDEFileReplaceView::slotStringsSave()
|
|
|
|
|
{
|
|
|
|
|
// Check there are strings in the list
|
|
|
|
|
TDEListView *sv = getStringsView();
|
|
|
|
|
|
|
|
|
|
if (sv->firstChild() == 0)
|
|
|
|
|
if (!sv->firstChild())
|
|
|
|
|
{
|
|
|
|
|
KMessageBox::error(0, i18n("No strings to save as the list is empty."));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQString header("<?xml version=\"1.0\" ?>\n<kfr>"),
|
|
|
|
|
footer("\n</kfr>"),
|
|
|
|
|
body;
|
|
|
|
|
TQString header("<?xml version=\"1.0\" ?>\n<kfr>"), footer("\n</kfr>"), body;
|
|
|
|
|
if(m_option->m_searchingOnlyMode)
|
|
|
|
|
header += "\n\t<mode search=\"true\"/>";
|
|
|
|
|
else
|
|
|
|
@ -487,8 +484,8 @@ void TDEFileReplaceView::slotStringsSave()
|
|
|
|
|
while (lvi)
|
|
|
|
|
{
|
|
|
|
|
body += TQString("\n\t<replacement>"
|
|
|
|
|
"\n\t\t<oldstring><![CDATA[%1]]></oldstring>"
|
|
|
|
|
"\n\t\t<newstring><![CDATA[%2]]></newstring>"
|
|
|
|
|
"\n\t\t<oldstring>%1</oldstring>"
|
|
|
|
|
"\n\t\t<newstring>%2</newstring>"
|
|
|
|
|
"\n\t</replacement>").arg(lvi->text(0)).arg(lvi->text(1));
|
|
|
|
|
lvi = lvi->nextSibling();
|
|
|
|
|
}
|
|
|
|
@ -500,9 +497,7 @@ void TDEFileReplaceView::slotStringsSave()
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Forces the extension to be "kfr" == TDEFileReplace extension
|
|
|
|
|
|
|
|
|
|
fileName = TDEFileReplaceLib::addExtension(fileName, "kfr");
|
|
|
|
|
|
|
|
|
|
TQFile file(fileName);
|
|
|
|
|
if(!file.open(IO_WriteOnly))
|
|
|
|
|
{
|
|
|
|
@ -511,9 +506,7 @@ void TDEFileReplaceView::slotStringsSave()
|
|
|
|
|
}
|
|
|
|
|
TQTextStream oTStream(&file);
|
|
|
|
|
oTStream.setEncoding(TQTextStream::UnicodeUTF8);
|
|
|
|
|
oTStream << header
|
|
|
|
|
<< body
|
|
|
|
|
<< footer;
|
|
|
|
|
oTStream << header << body << footer;
|
|
|
|
|
file.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -726,7 +719,6 @@ void TDEFileReplaceView::loadMapIntoView(KeyValueMap map)
|
|
|
|
|
{
|
|
|
|
|
m_sv->clear();
|
|
|
|
|
KeyValueMap::Iterator itMap;
|
|
|
|
|
|
|
|
|
|
for(itMap = map.begin(); itMap != map.end(); ++itMap)
|
|
|
|
|
{
|
|
|
|
|
TQListViewItem* lvi = new TQListViewItem(m_sv);
|
|
|
|
|