Branch: master

bfd50121 2019-06-20 07:02:22 Michele Calgaro
tdefilereplace: simplified format of kfr files for string lists.

Signed-off-by: Michele Calgaro <michele.calgaro@...>
M tdefilereplace/tdefilereplacepart.cpp
M tdefilereplace/tdefilereplaceview.cpp

tdefilereplace/tdefilereplacepart.cpp

diff --git a/tdefilereplace/tdefilereplacepart.cpp b/tdefilereplace/tdefilereplacepart.cpp
index 7d0da75..5e08355 100644
--- a/tdefilereplace/tdefilereplacepart.cpp
+++ b/tdefilereplace/tdefilereplacepart.cpp
@@ -1570,8 +1570,7 @@
 
 void TDEFileReplacePart::loadRulesFile(const TQString& fileName)
 {
-  /* Loads a file with kfr extension.
-  *  creates a xml document and browses it*/
+  // Loads a file with kfr extension, creates a xml document and browses it
   TQDomDocument doc("mydocument");
   TQFile file(fileName);
   TDEListView* sv = m_view->getStringsView();
@@ -1636,7 +1635,7 @@
       n = n.nextSibling();
     }
 
-  // Adds file to "load strings form file" menu
+  // Adds file to "load strings from file" menu
   TQStringList fileList = m_option->m_recentStringFileList;
   if(!fileList.contains(fileName))
     {

tdefilereplace/tdefilereplaceview.cpp

diff --git a/tdefilereplace/tdefilereplaceview.cpp b/tdefilereplace/tdefilereplaceview.cpp
index dd23ad5..2220c13 100644
--- a/tdefilereplace/tdefilereplaceview.cpp
+++ b/tdefilereplace/tdefilereplaceview.cpp
@@ -466,54 +466,47 @@
 void TDEFileReplaceView::slotStringsSave()
 {
   // Check there are strings in the list
-  TDEListView* sv = getStringsView();
-
-  if (sv->firstChild() == 0)
+  TDEListView *sv = getStringsView();
+  if (!sv->firstChild())
   {
     KMessageBox::error(0, i18n("No strings to save as the list is empty."));
-    return ;
+    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
     header += "\n\t<mode search=\"false\"/>";
 
-  TQListViewItem*  lvi = sv->firstChild();
+  TQListViewItem *lvi = sv->firstChild();
 
-  while( lvi )
+  while (lvi)
   {
     body += TQString("\n\t<replacement>"
-	"\n\t\t<oldstring><![CDATA[%1]]></oldstring>"
-	"\n\t\t<newstring><![CDATA[%2]]></newstring>"
-	"\n\t</replacement>").arg(lvi->text(0)).arg(lvi->text(1));
+				"\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();
   }
 
-   // Selects the file where strings will be saved
+  // Selects the file where strings will be saved
   TQString menu = "*.kfr|" + i18n("TDEFileReplace Strings") + " (*.kfr)\n*|" + i18n("All Files") + " (*)";
   TQString fileName = KFileDialog::getSaveFileName(TQString(), menu, 0, i18n("Save Strings to File"));
   if (fileName.isEmpty())
     return;
 
-   // Forces the extension to be "kfr" == TDEFileReplace extension
-
+  // Forces the extension to be "kfr" == TDEFileReplace extension
   fileName = TDEFileReplaceLib::addExtension(fileName, "kfr");
-
-  TQFile file( fileName );
-  if(!file.open( IO_WriteOnly ))
+  TQFile file(fileName);
+  if(!file.open(IO_WriteOnly))
   {
     KMessageBox::error(0, i18n("File %1 cannot be saved.").arg(fileName));
     return ;
   }
-  TQTextStream oTStream( &file );
+  TQTextStream oTStream(&file);
   oTStream.setEncoding(TQTextStream::UnicodeUTF8);
-  oTStream << header
-      << body
-      << footer;
+  oTStream << header << body << footer;
   file.close();
 }
 
@@ -726,7 +719,6 @@
 {
   m_sv->clear();
   KeyValueMap::Iterator itMap;
-
   for(itMap = map.begin(); itMap != map.end(); ++itMap)
     {
       TQListViewItem* lvi = new TQListViewItem(m_sv);
281f1ab5 2019-06-20 13:42:20 Michele Calgaro
tdefilereplace: fixed up interaction between tdefilereplacepart and
tdefilereplaceview, which was causing some odd issues with GUI updates
at some times.

Signed-off-by: Michele Calgaro <michele.calgaro@...>
M tdefilereplace/tdefilereplacepart.cpp
M tdefilereplace/tdefilereplacepart.h
M tdefilereplace/tdefilereplaceview.cpp
M tdefilereplace/tdefilereplaceview.h

tdefilereplace/tdefilereplacepart.cpp

diff --git a/tdefilereplace/tdefilereplacepart.cpp b/tdefilereplace/tdefilereplacepart.cpp
index 5e08355..804b0f5 100644
--- a/tdefilereplace/tdefilereplacepart.cpp
+++ b/tdefilereplace/tdefilereplacepart.cpp
@@ -159,7 +159,7 @@
 
   m_option->m_searchingOnlyMode = true;
 
-  resetActions();
+  updateGUI();
 
   m_searchingOperation = true;
 
@@ -223,7 +223,7 @@
 
   m_option->m_searchingOnlyMode = false;
 
-  resetActions();
+  updateGUI();
 
   m_searchingOperation = false;
 
@@ -242,7 +242,7 @@
   emit setStatusBarText(i18n("Stopping..."));
   m_stop = true;
   TQApplication::restoreOverrideCursor();
-  resetActions();
+  updateGUI();
 }
 
 void TDEFileReplacePart::slotCreateReport()
@@ -286,13 +286,7 @@
   Report report(m_option, rv, sv);
          report.createDocument(documentPath);
 
-  //resetActions();
-}
-
-void TDEFileReplacePart::slotStringsAdd()
-{
-  m_view->slotStringsAdd();
-  resetActions();
+  //updateGUI();
 }
 
 void TDEFileReplacePart::slotQuickStringsAdd()
@@ -328,29 +322,6 @@
   }
 }
 
-void TDEFileReplacePart::slotStringsDeleteItem()
-{
-  m_view->slotStringsDeleteItem();
-  resetActions();
-}
-
-void TDEFileReplacePart::slotStringsEmpty()
-{
-  m_view->slotStringsEmpty();
-  resetActions();
-}
-
-void TDEFileReplacePart::slotStringsEdit()
-{
-  m_view->slotStringsEdit();
-  resetActions();
-}
-
-void TDEFileReplacePart::slotStringsSave()
-{
-  m_view->slotStringsSave();
-}
-
 void TDEFileReplacePart::slotStringsLoad()
 {
   // Selects the file to load from
@@ -360,19 +331,7 @@
   if(!fileName.isEmpty())
     loadRulesFile(fileName);
 
-  resetActions();
-}
-
-void TDEFileReplacePart::slotStringsInvertCur()
-{
-  m_view->stringsInvert(false);
-  resetActions();
-}
-
-void TDEFileReplacePart::slotStringsInvertAll()
-{
-  m_view->stringsInvert(true);
-  resetActions();
+  updateGUI();
 }
 
 void TDEFileReplacePart::slotOpenRecentStringFile(const KURL& urlFile)
@@ -393,50 +352,48 @@
     }
 
   loadRulesFile(fileName);
-  resetActions();
+  updateGUI();
 }
 
 void TDEFileReplacePart::slotOptionRecursive()
 {
   m_option->m_recursive = !m_option->m_recursive;
-  resetActions();
+  updateGUI();
 }
 
 void TDEFileReplacePart::slotOptionBackup()
 {
   m_option->m_backup = !m_option->m_backup;
-  resetActions();
+  updateGUI();
 }
 
 void TDEFileReplacePart::slotOptionCaseSensitive()
 {
   m_option->m_caseSensitive = !m_option->m_caseSensitive;
-  resetActions();
+  updateGUI();
 }
 
 void TDEFileReplacePart::slotOptionVariables()
 {
   m_option->m_variables = !m_option->m_variables;
-  resetActions();
+  updateGUI();
 }
 
 void TDEFileReplacePart::slotOptionRegularExpressions()
 {
   m_option->m_regularExpressions = !m_option->m_regularExpressions;
-  resetActions();
+  updateGUI();
 }
 
 void TDEFileReplacePart::slotOptionPreferences()
 {
   KOptionsDlg dlg(m_option, m_w, 0);
-
-  if(!dlg.exec())
** Diff limit reached (max: 250 lines) **
a58ed210 2019-06-20 14:02:54 Michele Calgaro
tdefilereplace: improved logic for string add/edit/remove dialog.
Removed the string edit action which is now no longer required.

Signed-off-by: Michele Calgaro <michele.calgaro@...>
M tdefilereplace/kaddstringdlg.cpp
M tdefilereplace/kaddstringdlg.h
M tdefilereplace/tdefilereplacepart.cpp
M tdefilereplace/tdefilereplacepartui.rc
M tdefilereplace/tdefilereplaceview.cpp
M tdefilereplace/tdefilereplaceview.h
** Diff limit reached (max: 250 lines) **
c722431c 2019-06-20 15:31:23 Michele Calgaro
tdefilereplace: fixed SEGFAULT when trying to delete or remove an entry
from the result listview.

Signed-off-by: Michele Calgaro <michele.calgaro@...>
M tdefilereplace/tdefilereplaceview.cpp
M tdefilereplace/tdefilereplaceview.h
** Diff limit reached (max: 250 lines) **
10db438b 2019-06-21 14:01:51 Michele Calgaro
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@...>
M tdefilereplace/configurationclasses.cpp
M tdefilereplace/configurationclasses.h
M tdefilereplace/tdefilereplacelib.cpp
M tdefilereplace/tdefilereplacelib.h
M tdefilereplace/tdefilereplacepart.cpp
M tdefilereplace/tdefilereplacepart.h
M tdefilereplace/tdefilereplacepartui.rc
M tdefilereplace/tdefilereplaceview.cpp
M tdefilereplace/tdefilereplaceview.h
** Diff limit reached (max: 250 lines) **
ae564d14 2019-06-23 01:50:34 Michele Calgaro
tdefilereplace: added save/load results functionality.

Signed-off-by: Michele Calgaro <michele.calgaro@...>
M tdefilereplace/tdefilereplacelib.cpp
M tdefilereplace/tdefilereplacelib.h
M tdefilereplace/tdefilereplacepart.cpp
M tdefilereplace/tdefilereplacepartui.rc
M tdefilereplace/tdefilereplaceview.cpp
M tdefilereplace/tdefilereplaceview.h
M tdefilereplace/tdefilereplaceviewwdg.ui
** Diff limit reached (max: 250 lines) **