Browse Source

Moved TDEFileReplace to tdeutils. This resolves bug 767.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/1/head
Michele Calgaro 5 years ago
parent
commit
e9638a300c
90 changed files with 4 additions and 9319 deletions
  1. +1
    -8
      AUTHORS
  2. +0
    -2
      CMakeLists.txt
  3. +0
    -5
      PACKAGING
  4. +0
    -1
      README
  5. +3
    -4
      doc/CMakeLists.txt
  6. +0
    -2
      doc/tdefilereplace/Makefile.am
  7. BIN
      doc/tdefilereplace/addstringsdialog_window.png
  8. BIN
      doc/tdefilereplace/backup_option.png
  9. BIN
      doc/tdefilereplace/casesensitive_option.png
  10. BIN
      doc/tdefilereplace/command_option.png
  11. BIN
      doc/tdefilereplace/edit.png
  12. BIN
      doc/tdefilereplace/edit_add.png
  13. BIN
      doc/tdefilereplace/edit_remove.png
  14. BIN
      doc/tdefilereplace/eraser.png
  15. BIN
      doc/tdefilereplace/filereplace.png
  16. BIN
      doc/tdefilereplace/filesearch.png
  17. BIN
      doc/tdefilereplace/filesimulate.png
  18. +0
    -613
      doc/tdefilereplace/index.docbook
  19. BIN
      doc/tdefilereplace/invert.png
  20. BIN
      doc/tdefilereplace/kfr_standalone_main_window_1.png
  21. BIN
      doc/tdefilereplace/optionsdialog_main_window_1.png
  22. BIN
      doc/tdefilereplace/optionsdialog_main_window_2.png
  23. BIN
      doc/tdefilereplace/project.png
  24. BIN
      doc/tdefilereplace/projectdialog_main_window_1.png
  25. BIN
      doc/tdefilereplace/projectdialog_main_window_2.png
  26. BIN
      doc/tdefilereplace/recursive_option.png
  27. BIN
      doc/tdefilereplace/regularexpression_option.png
  28. BIN
      doc/tdefilereplace/report_example.png
  29. BIN
      doc/tdefilereplace/results_view.png
  30. BIN
      doc/tdefilereplace/stop.png
  31. BIN
      doc/tdefilereplace/strings_view.png
  32. BIN
      doc/tdefilereplace/toolbar.png
  33. BIN
      doc/tdefilereplace/unsortedList.png
  34. +0
    -56
      tdefilereplace/CMakeLists.txt
  35. +0
    -211
      tdefilereplace/ChangeLog
  36. +0
    -43
      tdefilereplace/Makefile.am
  37. +0
    -213
      tdefilereplace/commandengine.cpp
  38. +0
    -58
      tdefilereplace/commandengine.h
  39. +0
    -188
      tdefilereplace/configurationclasses.cpp
  40. +0
    -165
      tdefilereplace/configurationclasses.h
  41. +0
    -12
      tdefilereplace/configure.in.in
  42. BIN
      tdefilereplace/hi22-app-tdefilereplace.png
  43. BIN
      tdefilereplace/hi32-app-tdefilereplace.png
  44. BIN
      tdefilereplace/hi48-app-tdefilereplace.png
  45. +0
    -273
      tdefilereplace/kaddstringdlg.cpp
  46. +0
    -76
      tdefilereplace/kaddstringdlg.h
  47. +0
    -426
      tdefilereplace/kaddstringdlgs.ui
  48. +0
    -533
      tdefilereplace/knewprojectdlg.cpp
  49. +0
    -85
      tdefilereplace/knewprojectdlg.h
  50. +0
    -898
      tdefilereplace/knewprojectdlgs.ui
  51. +0
    -236
      tdefilereplace/koptionsdlg.cpp
  52. +0
    -59
      tdefilereplace/koptionsdlg.h
  53. +0
    -347
      tdefilereplace/koptionsdlgs.ui
  54. +0
    -77
      tdefilereplace/main.cpp
  55. +0
    -282
      tdefilereplace/report.cpp
  56. +0
    -58
      tdefilereplace/report.h
  57. +0
    -111
      tdefilereplace/tdefilereplace.cpp
  58. +0
    -55
      tdefilereplace/tdefilereplace.desktop
  59. +0
    -46
      tdefilereplace/tdefilereplace.h
  60. +0
    -190
      tdefilereplace/tdefilereplace.tdevelop
  61. +0
    -30
      tdefilereplace/tdefilereplaceiface.h
  62. +0
    -381
      tdefilereplace/tdefilereplacelib.cpp
  63. +0
    -65
      tdefilereplace/tdefilereplacelib.h
  64. +0
    -1680
      tdefilereplace/tdefilereplacepart.cpp
  65. +0
    -95
      tdefilereplace/tdefilereplacepart.desktop
  66. +0
    -160
      tdefilereplace/tdefilereplacepart.h
  67. +0
    -75
      tdefilereplace/tdefilereplacepartui.rc
  68. +0
    -10
      tdefilereplace/tdefilereplaceui.rc
  69. +0
    -713
      tdefilereplace/tdefilereplaceview.cpp
  70. +0
    -118
      tdefilereplace/tdefilereplaceview.h
  71. +0
    -555
      tdefilereplace/tdefilereplaceviewwdg.ui
  72. +0
    -3
      tdefilereplace/toolbar/Makefile.am
  73. BIN
      tdefilereplace/toolbar/cr22-action-back.png
  74. BIN
      tdefilereplace/toolbar/cr22-action-backup_option.png
  75. BIN
      tdefilereplace/toolbar/cr22-action-casesensitive_option.png
  76. BIN
      tdefilereplace/toolbar/cr22-action-command_option.png
  77. BIN
      tdefilereplace/toolbar/cr22-action-editadd.png
  78. BIN
      tdefilereplace/toolbar/cr22-action-editremove.png
  79. BIN
      tdefilereplace/toolbar/cr22-action-filereplace.png
  80. BIN
      tdefilereplace/toolbar/cr22-action-filesearch.png
  81. BIN
      tdefilereplace/toolbar/cr22-action-filesimulate.png
  82. BIN
      tdefilereplace/toolbar/cr22-action-informations.png
  83. BIN
      tdefilereplace/toolbar/cr22-action-invert.png
  84. BIN
      tdefilereplace/toolbar/cr22-action-next.png
  85. BIN
      tdefilereplace/toolbar/cr22-action-projectopen.png
  86. BIN
      tdefilereplace/toolbar/cr22-action-recursive_option.png
  87. BIN
      tdefilereplace/toolbar/cr22-action-regularexpression_option.png
  88. BIN
      tdefilereplace/toolbar/cr22-action-unsortedList.png
  89. BIN
      tdefilereplace/tutorial.kwd
  90. +0
    -101
      tdefilereplace/whatthis.h

+ 1
- 8
AUTHORS View File

@@ -24,15 +24,8 @@ Kommander (kommander):
KXSLDbg (kxsldbg):
Author: Keith Isdale <k_isdale@tpg.com.au>

TDEFileReplace:
Maintainer:
Emiliano Gulmini <emi_barbarossa@yahoo.it>
Andras Mantia <amantia@kde.org>
Original author:
François Dupoux <fdupoux@dupoux.com>

KImageMapEditor:
Author: Jan Schäfer <JanSchaefer@gmx.de>
Author: Jan Sch�fer <JanSchaefer@gmx.de>

KLinkStatus:
Author: Paulo Moura Guedes <pmg@netcabo.pt>

+ 0
- 2
CMakeLists.txt View File

@@ -51,7 +51,6 @@ tde_setup_paths( )
##### user requested modules ####################

option( BUILD_ALL "Build all" OFF )
option( BUILD_TDEFILEREPLACE "Build tdefilereplace" ${BUILD_ALL} )
option( BUILD_QUANTA "Build quanta" ${BUILD_ALL} )


@@ -78,7 +77,6 @@ if( BUILD_QUANTA )
add_subdirectory( lib )
endif( )

tde_conditional_add_subdirectory( BUILD_TDEFILEREPLACE tdefilereplace )
tde_conditional_add_subdirectory( BUILD_QUANTA quanta )




+ 0
- 5
PACKAGING View File

@@ -24,11 +24,6 @@ Severity levels mean:
Severity: Highly recommended
Location: tdewebdev module

- TDEFileReplace:
Description: Used to search and replace in external files
Severity: Highly recommended
Location: tdewebdev module

- KLinkStatus:
Description: Used to check the validity of the links
Severity: Highly recommended


+ 0
- 1
README View File

@@ -8,7 +8,6 @@ highly recommended that you install them.
The extra applications are:

Kommander: a GUI script builder and executor tool. Needed for some Quanta functionality.
TDEFileReplace: powerful search and replace in multiple files
KXSLDbg: XSL debugger
KImageMapEditor: image map editor
KLinkStatus: link checker


tdefilereplace/toolbar/CMakeLists.txt → doc/CMakeLists.txt View File

@@ -1,7 +1,7 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
# (C) 2012 Golubev Alexander
# fatzer2 (AT) gmail.com
#
# Improvements and feedback are welcome
#
@@ -9,5 +9,4 @@
#
#################################################


tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/tdefilereplacepart/icons )
tde_auto_add_subdirectories( )

+ 0
- 2
doc/tdefilereplace/Makefile.am View File

@@ -1,2 +0,0 @@
KDE_DOCS = AUTO
KDE_LANG = en

BIN
doc/tdefilereplace/addstringsdialog_window.png View File

Before After
Width: 594  |  Height: 375  |  Size: 24 KiB

BIN
doc/tdefilereplace/backup_option.png View File

Before After
Width: 22  |  Height: 22  |  Size: 979 B

BIN
doc/tdefilereplace/casesensitive_option.png View File

Before After
Width: 22  |  Height: 22  |  Size: 1.1 KiB

BIN
doc/tdefilereplace/command_option.png View File

Before After
Width: 22  |  Height: 22  |  Size: 1.1 KiB

BIN
doc/tdefilereplace/edit.png View File

Before After
Width: 22  |  Height: 22  |  Size: 1.1 KiB

BIN
doc/tdefilereplace/edit_add.png View File

Before After
Width: 22  |  Height: 22  |  Size: 820 B

BIN
doc/tdefilereplace/edit_remove.png View File

Before After
Width: 22  |  Height: 22  |  Size: 713 B

BIN
doc/tdefilereplace/eraser.png View File

Before After
Width: 22  |  Height: 22  |  Size: 339 B

BIN
doc/tdefilereplace/filereplace.png View File

Before After
Width: 22  |  Height: 22  |  Size: 1.1 KiB

BIN
doc/tdefilereplace/filesearch.png View File

Before After
Width: 22  |  Height: 22  |  Size: 1.1 KiB

BIN
doc/tdefilereplace/filesimulate.png View File

Before After
Width: 22  |  Height: 22  |  Size: 1.1 KiB

+ 0
- 613
doc/tdefilereplace/index.docbook View File

@@ -1,613 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY tdefilereplace "<application>TDEFileReplace</application>">
<!ENTITY kappname "&tdefilereplace;">
<!ENTITY package "tdewebdev">
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE">
<!ENTITY tdewebdev "<application>tdewebdev</application>">
<!ENTITY bc "<application>bc</application>">
]>

<book lang="&language;">

<bookinfo>
<title>The &tdefilereplace; Handbook</title>

<authorgroup>
<author>
<firstname>Emiliano</firstname>
<surname>Gulmini</surname>
<affiliation>
<address><email>emi_barbarossa&#64;yahoo&#46;it</email></address>
</affiliation>
</author>

<!-- TRANS:ROLES_OF_TRANSLATORS -->

</authorgroup>

<copyright>
<year>2004</year>
<holder>Emiliano Gulmini</holder>
</copyright>

<legalnotice>&FDLNotice;</legalnotice>

<date>2004-08-09</date>
<releaseinfo>1&#46;0&#46;0</releaseinfo>

<!-- Abstract about this handbook -->

<abstract>
<para>
&tdefilereplace; is an utility to search and replace strings.
</para>
</abstract>

<keywordset>
<keyword>TDE</keyword>
<keyword>TDEFileReplace</keyword>
<keyword>replace</keyword>
<keyword>search</keyword>
<keyword>string</keyword>
</keywordset>

</bookinfo>

<chapter id="introduction">
<title>Introduction</title>
<para>&tdefilereplace; is an application used to search and replace a list of strings in a file tree. The strings may be literal or Qt-like regular expressions. There are also other options to tune your search.
</para>
</chapter>

<chapter id="using-tdefilereplace">
<title>Using &tdefilereplace;</title>

<para>
<screenshot>
<screeninfo>&tdefilereplace; in its standalone incarnation</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="kfr_standalone_main_window_1.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&tdefilereplace; in its standalone incarnation</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>


<sect1 id="tdefilereplace-the-toolbar">
<title>The Toolbar</title>

<para>The &tdefilereplace; toolbar should looks like this:
<screenshot>
<screeninfo>&tdefilereplace;'s toolbar</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="toolbar.png" format="PNG"/>
</imageobject>
<imageobject>
<imagedata fileref="toolbar.eps" format="EPS"/>
</imageobject>
<textobject>
<phrase>&tdefilereplace;'s toolbar</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>

<para>The toolbar shows you the buttons of the main functionalities.
<variablelist>
<title>Toolbar Icons</title>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="project.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>New session</guiicon></term>
<listitem>
<para>This button shows a <link linkend="tdefilereplace-the-project-dialog">session dialog</link> in which you can set several basic options; if &tdefilereplace; run as standalone application you should click this button as first step.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="filesearch.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Search only</guiicon></term>
<listitem>
<para>This button starts a search loop.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="filereplace.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Replace</guiicon></term>
<listitem>
<para>This button starts a search&amp;replace loop. When a string has been found, &tdefilereplace; replaces it with another string.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="filesimulate.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Simulated Replace</guiicon></term>
<listitem>
<para>This button starts a simulated search&amp;replace loop. Nothing really happens when you click this button.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="stop.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Stop</guiicon></term>
<listitem>
<para>This button stops an operation.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="edit_add.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Add Strings</guiicon></term>
<listitem>
<para>This button opens the <link linkend="tdefilereplace-the-add-dialog">Add Strings</link> dialog in which you can edit your string list.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="edit_remove.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Delete Strings</guiicon></term>
<listitem>
<para>This button deletes the selected (or the current if there is no selection) string from the list.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="edit.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Edit Strings</guiicon></term>
<listitem>
<para>This button edits a selected string.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="eraser.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Delete List</guiicon></term>
<listitem>
<para>This button deletes all the strings in the list.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="invert.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Invert Strings</guiicon></term>
<listitem>
<para>This button swaps the search string with the replace string, so you can revert a search/replace operation.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="unsortedList.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Load String List</guiicon></term>
<listitem>
<para>This button loads a <link linkend="tdefilereplace-the-kfr-file">string list</link> saved in a xml file with a <literal role="extension">kfr</literal> extension.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="recursive_option.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Search in Subfolders</guiicon></term>
<listitem>
<para>This button allows you to search/replace recursively in the subfolders of your base directory.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="backup_option.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Make Backup Files</guiicon></term>
<listitem>
<para>This button enables generation of <link linkend="tdefilereplace-backup-file">backup</link> files.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="casesensitive_option.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Case-sensitive Search</guiicon></term>
<listitem>
<para>This button enables case-sensitive searching.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="command_option.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Commands</guiicon></term>
<listitem>
<para>This button enables commands capability. Commands are special strings. See <xref linkend="tdefilereplace-commands"/>.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>
<inlinemediaobject>
<imageobject>
<imagedata fileref="regularexpression_option.png" format="PNG"/>
</imageobject>
</inlinemediaobject><guiicon>Regular expressions</guiicon></term>
<listitem>
<para>This button enables <link linkend="tdefilereplace-QT-regexp">Qt-like regular expressions</link>.</para>
</listitem>
</varlistentry>

</variablelist>
</para>

</sect1>

<sect1 id="tdefilereplace-the-results-view">
<title>The Results List</title>
<screenshot>
<screeninfo>&tdefilereplace;'s Results view</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="results_view.png" format="PNG"/>
</imageobject>
<imageobject>
<imagedata fileref="results_view.eps" format="EPS"/>
</imageobject>
<textobject>
<phrase>&tdefilereplace;'s Results view</phrase>
</textobject>
</mediaobject>
</screenshot>
<para>The <guilabel>Results</guilabel> view shows the name of the files that contain the strings you have to retrieve (and replace), their path, their size, the number of strings found and the user id of the files. This view also provides the exact position of each match. You can also open a file by clicking with the &RMB; on an list entry that contains line and column position.</para>

</sect1>

<sect1 id="tdefilereplace-the-strings-view">
<title>The String List</title>

<para>This is the <guilabel>Strings</guilabel> view:
<screenshot>
<screeninfo>&tdefilereplace;'s Strings view</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="strings_view.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&tdefilereplace;'s Strings view</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>

<para>The <guilabel>Strings</guilabel> view visualizes the list of strings you want search/replace. Please note that in search mode the <guilabel>Results</guilabel> view and the <guilabel>Strings</guilabel> view have a different layout.</para>

</sect1>

<sect1 id="tdefilereplace-the-project-dialog">
<title>The <guilabel>New Session</guilabel> Dialog</title>
<para>The <guilabel>New Session</guilabel> dialog is used to setup the basic parameters needed by &tdefilereplace; to work. It consists of two tabs, <guilabel>General</guilabel> and <guilabel>Advanced</guilabel>.
</para>

<sect2 id="tdefilereplace-the-project-dialog-general-page">
<title>The <guilabel>General</guilabel> Tab</title>
<screenshot>
<screeninfo>&tdefilereplace; General tab</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="projectdialog_main_window_1.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&tdefilereplace; General tab</phrase>
</textobject>
</mediaobject>
</screenshot>
<para>When you want to begin a new session the first step is to click on the <link linkend="tdefilereplace-the-toolbar"><guiicon>New Session</guiicon> button</link>. Then you must enter the base path and a sequence of shell-like wildcards to use as filter.</para>
<para>Then you could set some useful options, like searching in all the subfolders, doing a case-sensitive search, enabling commands and/or regular expressions<footnote id="performancewarning"><para>Please note that regular expressions and commands could slow down the speed performances.</para></footnote>, doing a backup copy of each file before replacing.</para>
<para>If you want to start searching, you can put a string in the search box and press <guibutton>Search Now</guibutton>, otherwise leave the search box empty and press <guibutton>Search Later</guibutton>.</para>
</sect2>

<sect2 id="tdefilereplace-the-project-dialog-advanced-page">
<title>The <guilabel>Advanced</guilabel> Tab</title>
<screenshot>
<screeninfo>&tdefilereplace; Advanced tab</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="projectdialog_main_window_2.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&tdefilereplace; Advanced tab</phrase>
</textobject>
</mediaobject>
</screenshot>
<para>The <guilabel>Advanced</guilabel> tab allows you to set up some useful options to restrict the search to a subset of your target file tree. If you want to run &tdefilereplace; only over files that have a size in the range of 10KB - 100KB, then you could use the size options. There is also a date option that restricts the search in a temporal range, and a last option that allows you to only search for files owned (or not owned) by a particular user (this may be more useful to the system administrators).</para>
</sect2>
</sect1>

<sect1 id="tdefilereplace-the-options-dialog">
<title>The <guilabel>Options</guilabel> Dialog</title>
<para>This dialog contains options that are in the toolbar and extra options that may come in handy in some situations. You can invoke it selecting <menuchoice><guimenu>Settings</guimenu><guimenuitem>Configure TDEFileReplace...</guimenuitem></menuchoice> in the main menu.
</para>
<sect2 id="tdefilereplace-the-options-dialog-general-page">
<title>General options</title>
<para>These options have been presented in the <link linkend="tdefilereplace-the-toolbar">Toolbar</link> section.
<screenshot>
<screeninfo>The General tab of the Options window</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="optionsdialog_main_window_1.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>The General tab of the Options window</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
</sect2>
<sect2 id="tdefilereplace-the-options-dialog-advanced-page">
<title>Advanced options</title>
<para>
<screenshot>
<screeninfo>The Advanced tab of the Options window</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="optionsdialog_main_window_2.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>The Advanced tab of the Options window</phrase>
</textobject>
</mediaobject>
</screenshot>
<segmentedlist>
<segtitle>Do not show files if no strings are found or replaced</segtitle>
<segtitle>When searching, stop on first string found</segtitle>
<segtitle>Follow symbolic links</segtitle>
<segtitle>Ignore hidden files and directories</segtitle>
<seglistitem>
<seg>shows only the files that match some of your strings. This will speed up the search.</seg>
<seg>&tdefilereplace; will stop when it finds a matching string, and will continue to search for other strings or, if you search for only one string, it will continue with the next file.</seg>
<seg>if a file is a link to another one, then search in the real file.</seg>
<seg>if hidden files or folders are encountered, ignore them.</seg>
</seglistitem>
</segmentedlist>
</para>
</sect2>
</sect1>
<sect1 id="tdefilereplace-the-add-dialog">
<title>The <guilabel>Add Strings</guilabel> Dialog</title>
<screenshot>
<screeninfo>&tdefilereplace;'s Add Strings dialog</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="addstringsdialog_window.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&tdefilereplace;'s Add Strings dialog</phrase>
</textobject>
</mediaobject>
</screenshot>
<para>This dialog is used to insert and edit a list of strings. You just have to insert either a search-only or a search-and-replace list, and then with the two mini-editors you will introduce your text. The arrow buttons allow you to add pairs of strings or delete them. When you finish, click <guibutton>OK</guibutton>.</para>
</sect1>
</chapter>

<chapter id="tdefilereplace-features">
<title>&tdefilereplace; features</title>
<para>This chapter provides informations about some useful capabilities of &tdefilereplace;.</para>
<sect1 id="tdefilereplace-the-kfr-file">
<title>How to save your string list</title>
<para>When you want to reuse a list of strings you can save it in a <literal role="extension">xml</literal> file. To do this select from the menubar <menuchoice><guimenu>Search/Replace</guimenu><guisubmenu>Strings</guisubmenu><guimenuitem>Save Strings List to File</guimenuitem></menuchoice>. When you save a list, a simple <literal role="extension">xml</literal> file with extension <literal role="extension">kfr</literal> is created. To load a <literal role="extension">kfr</literal> file select from menubar <menuchoice><guimenu>Search/Replace</guimenu><guisubmenu>Strings</guisubmenu><guimenuitem>Load Strings List from File</guimenuitem></menuchoice>. The actual file looks like this:</para>
<screen>
&lt;?xml version="1.0" ?>
&lt;kfr>
&lt;mode search="false"/>
&lt;replacement>
&lt;oldstring>&lt;![CDATA[SEARCH_STRING_1]&#93; >&lt;/oldstring>
&lt;newstring>&lt;![CDATA[REPLACE_STRING_1]&#93;>&lt;/newstring>
&lt;/replacement>
&lt;replacement>
&lt;oldstring>&lt;![CDATA[SEARCH_STRING_2]&#93;>&lt;/oldstring>
&lt;newstring>&lt;![CDATA[REPLACE_STRING_2]&#93;>&lt;/newstring>
&lt;/replacement>


&lt;replacement>
&lt;oldstring>&lt;![CDATA[SEARCH_STRING_N]&#93;>&lt;/oldstring>
&lt;newstring>&lt;![CDATA[REPLACE_STRING_N]&#93;>&lt;/newstring>
&lt;/replacement>

&lt;/kfr></screen>

<para>If you are using a previous format, you can update by hand your file by simply modifying it according to the above scheme. Alternatively, you can load the file written in the old format and save it again with &tdefilereplace; in the way explained before.</para>
</sect1>

<sect1 id="tdefilereplace-the-report-file">
<title>How to Create a Simple Report</title>
<para>You can create a report by choosing <menuchoice><guimenu>Search/Replace</guimenu><guisubmenu>Results</guisubmenu><guimenuitem>Create Report File</guimenuitem></menuchoice> from the main menu. A report is a folder containing an <literal role="extension">xml</literal> and a <literal role="extension">css</literal> file. Reports may be useful to maintain a simple log of your operations.
<screenshot>
<screeninfo>&tdefilereplace;'s Report feature</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="report_example.png" format="PNG"/>
</imageobject>
<imageobject>
<imagedata fileref="report_example.eps" format="EPS"/>
</imageobject>
<textobject>
<phrase>&tdefilereplace;'s Report feature</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
</sect1>

<sect1 id="tdefilereplace-QT-regexp">
<title>How to use Regular Expressions</title>
<para>
If you want search for every string that starts with <quote>x</quote>, <quote>ht</quote> or <quote>u</quote> and ends with <quote>ml</quote>, you can write a regular expression like this: <userinput>(x|ht|u)ml</userinput>. Insert this expression in the search editor, click <guibutton>OK</guibutton>, and enable regular expressions by toggling the <link linkend="tdefilereplace-the-toolbar"><guibutton>Regular Expression</guibutton> button</link>. Please note that using regular expressions lets you to make very complicated searches, but the cost could be a performance degradation. Regular expression can be very tricky, and it is often the case that <quote>if you want to solve a problem with a regular expression, you have two problems</quote>.</para>
</sect1>

<sect1 id="tdefilereplace-backup-file">
<title>How to Protect Original Files</title>
<para>If you do not want to lose your original files, you can make a copy of them before replacing the strings. After inserting your strings, and before starting the replacement process, you have just to toggle the <link linkend="tdefilereplace-the-toolbar"><guiicon>Backup</guiicon> button</link>. If you want to customize the extension of the backup files open the <link linkend="tdefilereplace-the-options-dialog"><guilabel>Options</guilabel> dialog</link>.
</para>
</sect1>

<sect1 id="tdefilereplace-open-file">
<title>How to Open a File</title>
<para>If you want to open a file that matches some of your strings, you have to select a line in the result view and click on it with the &RMB;. A context menu will appear from which you can open the file. If you use &tdefilereplace; embedded in &quantaplus;, you can open the file directly in it at the specified line and column.</para>
</sect1>

<sect1 id="tdefilereplace-commands">
<title>Commands</title>
<para>Suppose you want replace the phrase <quote>Alice's adventures in Wonderland</quote> with the <ulink url="http://www.textlibrary.com/download/alice-wo.txt">entire file that contains Carroll's novel</ulink>. Probably you don't want to do this by hand, what you need is a command that will do it for you. Click the <link linkend="tdefilereplace-the-toolbar"><guiicon>Add</guiicon></link> button, select <guilabel>Search and Replace Mode</guilabel> and insert the following strings: <userinput>Alice's adventure in Wonderland</userinput> in the search mini-editor and the string <userinput>[$loadfile:<replaceable>/the-path-to-my-folder/my-folder/my-file</replaceable>$]</userinput> in the replacement mini-editor. Click <guibutton>OK</guibutton>. When you come back to the &tdefilereplace; main window, toggle the <link linkend="tdefilereplace-the-toolbar">Command action</link> button that enables the commands, and start the replacement process. There are also other commands, see <xref linkend="available-commands"/> for a list of all of them.</para>
</sect1>
</chapter>

<chapter id="credits">
<title>Credits and License</title>

<para>&tdefilereplace;. Program copyright 1999 by François Dupoux <email>dupoux&#64;dupoux&#46;com</email>, 2003 Andras Mantia <email>amantia&#64;kde&#46;org</email>, 2004 Emiliano Gulmini <email>emi_barbarossa&#64;yahoo&#46;it</email>
</para>

<variablelist>
<title>The &tdefilereplace; authors and maintainers:</title>
<varlistentry>
<term>François Dupoux <email>dupoux&#64;dupoux&#46;com</email></term>
<listitem><para>Original author</para></listitem>
</varlistentry>
<varlistentry>
<term>Andras Mantia <email>amantia&#64;kde&#46;org</email></term>
<listitem><para>Shell autor, KPart creator, co-maintainer</para></listitem>
</varlistentry>
<varlistentry>
<term>Emiliano Gulmini <email>emi_barbarossa&#64;yahoo&#46;it</email></term>
<listitem><para>Current maintainer, code cleaner &amp; rewriter</para></listitem>
</varlistentry>
</variablelist>

<para>
Documentation Copyright &copy; 2004 Emiliano Gulmini <email>emi_barbarossa&#64;yahoo&#46;it</email>
</para>

<!-- TRANS:CREDIT_FOR_TRANSLATORS -->

&underFDL; <!-- FDL: do not remove -->
&underGPL; <!-- GPL License -->

</chapter>

<appendix id="installation">
<title>Installation</title>

<sect1 id="getting-tdefilereplace">
<title>How to install &tdefilereplace;</title>
<para>
&tdefilereplace; is currently part of &tdewebdev; package, so, in order to install it, you have to get a copy of &tdewebdev;. Note that if you are using a &kde; installation provided by your OS vendor, probably you already have &tdewebdev; installed; in this case, you can use &tdefilereplace; either by opening &quantaplus; Web editor, or by calling it directly (unless you have an old &kde; version). Else you can download the &tdewebdev; package from the Internet: please refer to <ulink url="http://kdewebdev.org">&tdewebdev; home site</ulink> for more information.
<!--&install.intro.documentation;-->
</para>

</sect1>

<sect1 id="requirements">
<title>Requirements</title>
<para>In order to use the command <link linkend="available-commands">[$mathexp:<replaceable>some_math_expression</replaceable>$]</link> you should install the &bc; mathematical utility (version 1.06 or newer) written by Philip A. Nelson (<email>philnelson@acm.org</email>).</para>
</sect1>

</appendix>

<appendix id="available-commands">
<title>&tdefilereplace; commands</title>
<para>
<segmentedlist>
<segtitle>[$datetime:iso$]</segtitle>
<segtitle>[$datetime:local$]</segtitle>
<segtitle>[$user:uid$]</segtitle>
<segtitle>[$user:gid$]</segtitle>
<segtitle>[$user:loginname$]</segtitle>
<segtitle>[$user:fullname$]</segtitle>
<segtitle>[$user:homedir$]</segtitle>
<segtitle>[$user:shell$]</segtitle>
<segtitle>[$loadfile:<replaceable>/my-path/my-directory/my-file</replaceable>$]</segtitle>
<segtitle>[$empty:$]</segtitle>
<segtitle>[$random:<replaceable>AN_INTEGER_NUMBER</replaceable>$]</segtitle>
<segtitle>[$random:$]</segtitle>
<segtitle>[$mathexp:<replaceable>bc-expression</replaceable>$]</segtitle>
<seglistitem>
<seg>this command return the current date and time in Qt ISO format.</seg>
<seg>like above but in local format.</seg>
<seg>return the UID of the current user.</seg>
<seg>return the GID of the current user.</seg>
<seg>return the login name of the current user.</seg>
<seg>return the full name of the current user.</seg>
<seg>return the home directory of the current user.</seg>
<seg>return the shell of the current user.</seg>
<seg>return the content of the <emphasis>my-file</emphasis> file.</seg>
<seg>return the empty string.</seg>
<seg>return a random number string using <emphasis>AN_INTEGER_NUMBER</emphasis> as the initial seed.</seg>
<seg>like above, but without initial seed.</seg>
<seg>return the result of a &bc; v1.06 mathematical expression.</seg>
</seglistitem>
</segmentedlist>
</para>
</appendix>

&documentation.index;
</book>


BIN
doc/tdefilereplace/invert.png View File

Before After
Width: 22  |  Height: 22  |  Size: 1.2 KiB

BIN
doc/tdefilereplace/kfr_standalone_main_window_1.png View File

Before After
Width: 930  |  Height: 647  |  Size: 83 KiB

BIN
doc/tdefilereplace/optionsdialog_main_window_1.png View File

Before After
Width: 515  |  Height: 379  |  Size: 44 KiB

BIN
doc/tdefilereplace/optionsdialog_main_window_2.png View File

Before After
Width: 515  |  Height: 379  |  Size: 36 KiB

BIN
doc/tdefilereplace/project.png View File

Before After
Width: 22  |  Height: 22  |  Size: 808 B

BIN
doc/tdefilereplace/projectdialog_main_window_1.png View File

Before After
Width: 643  |  Height: 550  |  Size: 53 KiB

BIN
doc/tdefilereplace/projectdialog_main_window_2.png View File

Before After
Width: 643  |  Height: 550  |  Size: 60 KiB

BIN
doc/tdefilereplace/recursive_option.png View File

Before After
Width: 22  |  Height: 22  |  Size: 615 B

BIN
doc/tdefilereplace/regularexpression_option.png View File

Before After
Width: 22  |  Height: 22  |  Size: 959 B

BIN
doc/tdefilereplace/report_example.png View File

Before After
Width: 700  |  Height: 480  |  Size: 60 KiB

BIN
doc/tdefilereplace/results_view.png View File

Before After
Width: 926  |  Height: 360  |  Size: 54 KiB

BIN
doc/tdefilereplace/stop.png View File

Before After
Width: 22  |  Height: 22  |  Size: 1.3 KiB

BIN
doc/tdefilereplace/strings_view.png View File

Before After
Width: 929  |  Height: 167  |  Size: 9.3 KiB

BIN
doc/tdefilereplace/toolbar.png View File

Before After
Width: 688  |  Height: 30  |  Size: 8.0 KiB

BIN
doc/tdefilereplace/unsortedList.png View File

Before After
Width: 20  |  Height: 20  |  Size: 279 B

+ 0
- 56
tdefilereplace/CMakeLists.txt View File

@@ -1,56 +0,0 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################

add_subdirectory( toolbar )

include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
)

link_directories(
${TQT_LIBRARY_DIRS}
)


##### other data ################################

tde_install_icons( )
install( FILES tdefilereplace.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install( FILES tdefilereplacepart.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES tdefilereplacepartui.rc DESTINATION ${DATA_INSTALL_DIR}/tdefilereplacepart )
install( FILES tdefilereplaceui.rc DESTINATION ${DATA_INSTALL_DIR}/tdefilereplace )


##### libtdefilereplacepart (module) ##############

tde_add_kpart( libtdefilereplacepart AUTOMOC
SOURCES
commandengine.cpp configurationclasses.cpp
tdefilereplacepart.cpp tdefilereplaceview.cpp
tdefilereplaceviewwdg.ui kaddstringdlg.cpp kaddstringdlgs.ui
knewprojectdlg.cpp knewprojectdlgs.ui koptionsdlg.cpp
koptionsdlgs.ui tdefilereplacelib.cpp report.cpp
LINK tdeio-shared tdeparts-shared
DESTINATION ${PLUGIN_INSTALL_DIR}
)


##### tdefilereplace (executable) #################

tde_add_executable( tdefilereplace AUTOMOC
SOURCES
tdefilereplace.cpp main.cpp
LINK tdeio-shared tdeparts-shared
DESTINATION ${BIN_INSTALL_DIR}
)

+ 0
- 211
tdefilereplace/ChangeLog View File

@@ -1,211 +0,0 @@
2005-02-20: Andras Mantia <amantia@kde.org>
* Added the possibility to select the encoding of the files and a warning about
the possible damaged result if the wrong encoding is chosen
2005-02-16: Andras Mantia <amantia@kde.org>
* Accept paths as command line arguments

2005-01-29 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* Cleaning up.

2005-01-23 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* Some clean up.
* Now the text 'captured text "blabla" at line...' etc. is substituted with
'Line:xyz, Col:abc "blabla"'
* Fixed a bug in the string view, that cause KFR to crash if the string list is empty
and the user click on it with the mouse.

2005-01-17 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* Now it should be possible to handle other characters encoding, like japanese.
* Added, but still buggy, a "replace confirmation" option.
* Now when open KFilereplace as standalone application it uses
this "*.c*;*.h*;*.sh;*.txt*;*.p*;*.java;*.log" string as default filter.

2005-01-14 Andras Mantia <amantia@kde.org>
* Don't show the cannot open file dialogs for directories
* Don't create a backup for every scanned file, only for those that were modified
* Don't update the timestap for every scanned file
* Fix installation of the icons (they go to the part's data dir now)

2005-01-13 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I added some other infos to the docbook manual, I hope to complete it as soon as possible.
* I added a new command: [$mathexp:some_expression$]. It uses the bc calculator to
compute the result of an expression.

2005-01-11 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* Fixed a bug in KAddStringDlg: now when we want edit a string the search-only mode and search-replace mode
don't merge.
* Modified KFR file format: I added the tag '<mode search=""/>' just after the root <kfr> to allows
tdefilereplace to recognize if the list to load is a list of only search strings. I added some lines of code
to permit users to load files that don't have this new tag.
* I'm writing docbook manual.

2005-01-10 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* The KFilereplaceView widget has been modified. Now it change the layout of tdefilereplace depending of the
value of m_option->m_searchOnlyMode.
* I fixed a bug in the backup file option.

2004-12-13 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I modified the way we can open files in quanta. Now we can select one or more entries
in the QListView that store the results, and open several files, at the same time.
For selecting more than one file, we must press CTRL button while clicking with mouse
on the entry we want open.

2004-11-10 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I added a graphical file counter.
* I added a semaphore to notify user about the state of the search.
* I improved a little the speed.
* I made some cleanup.

2004-09-27 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I fixed a bug that affect some strings in case of translation.
* I fixed a bug that affect "Create backup" option, I think that now this feature should work
properly.

2004-09-26 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I did some cleanup.

2004-09-11 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I added the class ResultViewEntry in configurationclasses.(h,cpp) to make the replace algorithm more clean.
* I make multiline text searching more useable.
* Now the file entries in the result view are shown with descriptive icons.
* I'm trying to write some documentation, in the meanwhile a tutorial is present.

2004-08-13 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I added CommandEngine class and Report class.
In fact I moved the code that do the report document and the
code that do commands feature from KFileREplaceLib to these two classes.

2004-08-09 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I fixed a bug that affected the method "void TDEFileReplaceView::slotStringsClear()" in tdefilereplaceview.cpp file.
This bug caused the list of strings not to be correctly erased.

2004-08-07 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I modified the save-results system(thanks Luciano for the idea of using xml/css tecnology).
Now KFR creates a directory with name "NAME" that contains a xml file "NAME.xml"
and a css file "NAME.css". These two files are the new "report document"
that substitutes the xhtml file. To try it choose "Search/Replace|Results|Create Report File" menu option.
* I fixed a bug that causes Quanta to crash when we push Cancel button in new project
dialog.
* I finished the tutorial.

2004-08-01 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* The line "if(::access(directory.local8Bit(), R_OK | X_OK) == -1)" has been removed,
and subtitued with "QFileInfo dirInfo(directory); "
"if(not(dirInfo.isReadable() and dirInfo.isExecutable())"
" or "
" not(dirInfo.isWritable())) "
in tdefilereplacepart.cpp

2004-07-30 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* The icons have been fixed!!! What a miracle!!!

2004-07-24 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I added a little feature. When KFR matches a string, it shows the row and the column
where that match is, by using a message like this:
/my/path/file
|
|__ string "xyz" found at line:40, column:2
|__ string "xyz" found at line:18, column:57
|__.............
Now if you use "Edit with Quanta" popup menu option, say, on the line:
"string "xyz" found at line:40, column:2"
of the result view, Quanta will open the file /my/path/file at row 40, column 2.

2004-07-20 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I fixed a bug that affects the generation of extension of
the backup files.

2004-07-17 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I fixed the bug that causes quanta to crash when KFR is active.
* I fixed (I hope!) the simulation feature.
* I reorganize the KOptionsDlg UI.
* I Added some tool tips.
* I' m tired and I go on bed ;-)

2004-07-16 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* The KNewProjectDlg was modified, adding quick search/replace line edit objects
* A option in KOptionDlg was added, so that the files that don't
contain the strings we are searching for, will not be shown.
* Some code clean-up
* A bug with KAddStringDlg was fixed.
* I found a bug that makes quanta to crash when we close quanta with the x button...
I'm trying to fix it.

2004-05-30 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* Well, KFR has been entirely (more or less :-)) rewrote.
the files:
apistruct.h
kernel.(cpp,h)
kexpression.(cpp,h)
tdefilereplacedoc.(cpp,h)
tdefilereplacepref.(cpp,h)

were removed and these files are added:

configurationclasses.h

. the internal architecture was redesigned, to use QT/KDE tecnologies in particular:
. C-like code were removed (where possible).
. some system dependent functions were substituted with more portable code.
. the apistructs.h file were substituted with one class in configurationclasses.h.
. the UIs were modified in particular:
. new "add string" dialog were added.
. project dialog were modified.
. some new features were added in particular:
. the variable replace mechanism were modified.
. the result view shows the line and column where the string has been found.
. now the mechanism of search/replace with wildcards inherits from QT regular expression engine.

* I wrote a little tutorial(TUTOR.txt), but a more exhaustive tutorial will be released soon.
Note: there some bugs to fix and some feature to implement, in particular:
. Simulation is not yet implemented.
. Some options are presents but disabled.
. I want to add more KFR variable commands.


2004-03-26 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* Added a feature. Now we can open a file from the result view of KFR in Quanta(thanks Andras).

2004-03-14 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* Replaced two QLineEdit with two QSpinbox in knewprojectdlg.ui
* Fixed a bug in the new kfr (XML-based) file format.

2004-03-12 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* Removed KresultView(.h,.cpp). Now TDEFileReplaceView is a QWidget that contains results and
strings view.
* Added whatthis.h that contains the "what's this" strings.
* Fixed a bug that generate a wrong XHTML result file.

2004-03-06 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* Added tdeconfirmdlgs.ui.
* Fixed a bug in KOptionDlg, now when we select a option, the selection is shown correctly.
* Fixed a bug KNewProjectDlg.

2004-02-26 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* I added a method 'editStrings' that fixes tha behaviour when a user
chooses edit string option instead of add string option.
* I modified the property textFormat of the QTextEdit widgets of
KAddstringDlg, from the value 'AutoText' to the value 'PlainText',
so the QTextEdit widgets will not try to render a string containing
html code.

2004-02-24 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* tdefilereplacepref.(h,cpp) were removed.
* kernel.(h,cpp) now are a singleton class.
* Some macros in kernel.h were replaced with integer constants.
* Methods in kernel.h file were renamed.
* Some superflous #include lines were removed.
* The filelib.(h,cpp) were subtituted with KFilereplaceLib singleton class.
* Now tdefilereplace logo and icons in the result view appear.

2004-02-18 Emiliano Gulmini <emi_barbarossa@yahoo.it>
* The icons in toolbar directory were redrawn.
* Deleted the KFRHeader struct from apistruct.h.
* The mechanism of saving the string rules has been modified: now we can save the rules in a
file like this "a_file_name.kfr" that is an XML file.
* The file containing the results of the operations is now a XHTML file.
* Two new files UI added: now KOptionDlg inherits from KOptionDlgS and KAddstringDlg inherits
from KAddstringDlgS.
* The tdelistviewstring.(h,cpp) were removed.
* A lot of clean up has been made in all files.

+ 0
- 43
tdefilereplace/Makefile.am View File

@@ -1,43 +0,0 @@
## Makefile.am for tdefilereplace

# set the include path for X, qt and KDE
INCLUDES = $(all_includes)

# this has all of the subdirectories that make will recurse into. if
# there are none, comment this out
SUBDIRS = toolbar

# these are the headers for your project
noinst_HEADERS = kaddstringdlg.h tdefilereplaceiface.h tdefilereplacelib.h \
knewprojectdlg.h tdefilereplaceview.h koptionsdlg.h report.h commandengine.h \
configurationclasses.h tdefilereplace.h
# let automoc handle all of the meta source files (moc)
METASOURCES = AUTO

kde_module_LTLIBRARIES = libtdefilereplacepart.la
libtdefilereplacepart_la_SOURCES = tdefilereplacepart.cpp tdefilereplaceview.cpp \
tdefilereplaceviewwdg.ui kaddstringdlg.cpp kaddstringdlgs.ui knewprojectdlg.cpp \
knewprojectdlgs.ui koptionsdlg.cpp koptionsdlgs.ui tdefilereplacelib.cpp report.cpp \
commandengine.cpp configurationclasses.cpp
libtdefilereplacepart_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) -ltdecore -ltdeui $(LIB_QT) -lkjs -ltdefx -ltdeio -ltdeparts -lDCOP
libtdefilereplacepart_la_LIBADD = $(LIB_TDEFILE) $(LIB_TDEPARTS) $(LIB_TDEHTML)

messages: rc.cpp
$(XGETTEXT) *.cpp *.h -o $(podir)/tdefilereplace.pot

KDE_ICON = AUTO
kde_services_DATA = tdefilereplacepart.desktop
xdg_apps_DATA = tdefilereplace.desktop

# this is where the XML-GUI resource file goes
partrcdir = $(kde_datadir)/tdefilereplacepart
partrc_DATA = tdefilereplacepartui.rc

shellrcdir = $(kde_datadir)/tdefilereplace
shellrc_DATA = tdefilereplaceui.rc
bin_PROGRAMS = tdefilereplace
tdefilereplace_LDFLAGS = $(KDE_RPATH) $(all_libraries) -ltdecore -ltdeui $(LIB_QT) -lkjs -ltdefx -ltdeio -ltdeparts -lDCOP
tdefilereplace_LDADD = $(LIB_TDEPARTS)
tdefilereplace_SOURCES = tdefilereplace.cpp main.cpp

+ 0
- 213
tdefilereplace/commandengine.cpp View File

@@ -1,213 +0,0 @@
/***************************************************************************
commandengine.cpp - kfr commands feature class
-------------------
begin : fri aug 13 15:29:46 CEST 2004

copyright : (C) 2004 Emiliano Gulmini
email : emi_barbarossa@yahoo.it
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

// QT
#include <tqdatetime.h>
#include <tqfile.h>
#include <tqtextstream.h>
#include <tqdom.h>

// KDE
#include <kuser.h>
#include <krandomsequence.h>
#include <kprocess.h>

// local
#include "commandengine.h"

TQString CommandEngine::datetime(const TQString& opt, const TQString& arg)
{
Q_UNUSED(arg);
if(opt == "iso")
return TQDateTime::currentDateTime(Qt::LocalTime).toString(Qt::ISODate);
if(opt == "local")
return TQDateTime::currentDateTime(Qt::LocalTime).toString(Qt::LocalDate);
return TQString();
}

TQString CommandEngine::user(const TQString& opt, const TQString& arg)
{
Q_UNUSED(arg);
KUser u;
if(opt == "uid")
return TQString::number(u.uid(),10);
if(opt == "gid")
return TQString::number(u.gid(),10);
if(opt == "loginname")
return u.loginName();
if(opt == "fullname")
return u.fullName();
if(opt == "homedir")
return u.homeDir();
if(opt == "shell")
return u.shell();
return TQString();
}

TQString CommandEngine::loadfile(const TQString& opt, const TQString& arg)
{
Q_UNUSED(arg);

TQFile f(opt);
if(!f.open(IO_ReadOnly)) return TQString();

TQTextStream t(&f);

TQString s = t.read();

f.close();

return s;
}

TQString CommandEngine::empty(const TQString& opt, const TQString& arg)
{
Q_UNUSED(opt);
Q_UNUSED(arg);
return "";
}

TQString CommandEngine::mathexp(const TQString& opt, const TQString& arg)
{
/* We will use bc 1.06 by Philip A. Nelson <philnelson@acm.org> */
//Q_UNUSED(opt);
Q_UNUSED(arg);

TQString tempOpt = opt;
tempOpt.replace("ln","l");
tempOpt.replace("sin","s");
tempOpt.replace("cos","c");
tempOpt.replace("arctan","a");
tempOpt.replace("exp","e");
TQString program = "var=("+tempOpt+");print var";
TQString script = "echo '"+program+"' | bc -l;";

TDEProcess* proc = new TDEProcess();

proc->setUseShell(true);

*(proc) << script;

connect(proc, TQT_SIGNAL(receivedStdout(TDEProcess*,char*,int)), this, TQT_SLOT(slotGetScriptOutput(TDEProcess*,char*,int)));
connect(proc, TQT_SIGNAL(receivedStderr(TDEProcess*,char*,int)), this, TQT_SLOT(slotGetScriptError(TDEProcess*,char*,int)));
connect(proc, TQT_SIGNAL(processExited(TDEProcess*)), this, TQT_SLOT(slotProcessExited(TDEProcess*)));

//Through slotGetScriptOutput, m_processOutput contains the result of the TDEProcess call
if(!proc->start(TDEProcess::Block, TDEProcess::All))
{
return TQString();
}
else
{
proc->wait();
}
if(proc)
delete proc;

TQString tempbuf = m_processOutput;
m_processOutput = TQString();

return tempbuf;

}

TQString CommandEngine::random(const TQString& opt, const TQString& arg)
{
Q_UNUSED(arg);
long seed;
if(opt.isEmpty())
{
TQDateTime dt;
seed = dt.toTime_t();
}
else
seed = opt.toLong();

KRandomSequence seq(seed);
return TQString::number(seq.getLong(1000000),10);
}

TQString CommandEngine::stringmanip(const TQString& opt, const TQString& arg)
{
Q_UNUSED(opt);
Q_UNUSED(arg);
return "";
}

TQString CommandEngine::variableValue(const TQString &variable)
{
TQString s = variable;

s.remove("[$").remove("$]").remove(" ");

if(s.contains(":") == 0)
return variable;
else
{
TQString leftValue = s.section(":",0,0),
midValue = s.section(":",1,1),
rightValue = s.section(":",2,2);

TQString opt = midValue;
TQString arg = rightValue;

if(leftValue == "stringmanip")
return stringmanip(opt, arg);
if(leftValue == "datetime")
return datetime(opt, arg);
if(leftValue == "user")
return user(opt, arg);
if(leftValue == "loadfile")
return loadfile(opt, arg);
if(leftValue == "empty")
return empty(opt, arg);
if(leftValue == "mathexp")
return mathexp(opt, arg);
if(leftValue == "random")
return random(opt, arg);

return variable;
}
}

//SLOTS
void CommandEngine::slotGetScriptError(TDEProcess* proc, char* s, int i)
{
Q_UNUSED(proc);
Q_UNUSED(proc);
TQCString temp(s,i+1);
if(temp.isEmpty() || temp == "\n") return;
}

void CommandEngine::slotGetScriptOutput(TDEProcess* proc, char* s, int i)
{
Q_UNUSED(proc);
TQCString temp(s,i+1);

if(temp.isEmpty() || temp == "\n") return;

m_processOutput += TQString::fromLocal8Bit(temp);
}

void CommandEngine::slotProcessExited(TDEProcess* proc)
{
Q_UNUSED(proc);
}

#include "commandengine.moc"

+ 0
- 58
tdefilereplace/commandengine.h View File

@@ -1,58 +0,0 @@
/***************************************************************************
commandengine.h - kfr commands feature class
-------------------
begin : fri aug 13 15:29:46 CEST 2004

copyright : (C) 2004 Emiliano Gulmini
email : emi_barbarossa@yahoo.it
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef COMMANDENGINE_H
#define COMMANDENGINE_H

// QT
class TQString;
#include <tqobject.h>

//KDE
class TDEProcess;

class CommandEngine : public TQObject
{
Q_OBJECT
private:
TQString m_processOutput;
public:
CommandEngine() {}

public:

/**
These functions implement the KFR commands
*/
TQString datetime(const TQString& opt, const TQString& arg);
TQString user(const TQString& opt, const TQString& arg);
TQString loadfile(const TQString& opt, const TQString& arg);
TQString empty(const TQString& opt, const TQString& arg);
TQString mathexp(const TQString& opt, const TQString& arg);
TQString random(const TQString& opt, const TQString& arg);
TQString stringmanip(const TQString& opt, const TQString& arg);
TQString variableValue(const TQString &variable);

private slots:
void slotGetScriptOutput(TDEProcess*,char*,int);
void slotGetScriptError(TDEProcess*,char*,int);
void slotProcessExited(TDEProcess*);
};

#endif // COMMANDENGINE_H

+ 0
- 188
tdefilereplace/configurationclasses.cpp View File

@@ -1,188 +0,0 @@
/***************************************************************************
configurationclasses.cpp - description
-------------------
begin : Sat Sep 11 2004
copyright : (C) 2004 Emiliano Gulmini
email : emi_barbarossa@yahoo.it
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// QT

// KDE

// local
#include "configurationclasses.h"
#include "whatthis.h"

using namespace whatthisNameSpace;

//RCOptions Class
RCOptions::RCOptions()
{
m_searchingOnlyMode = false;
}

RCOptions& RCOptions::operator=(const RCOptions& ci)
{
//m_callResetActions = ci.m_callResetActions;

m_directories = ci.m_directories;
m_filters = ci.m_filters;
m_currentDirectory = ci.m_currentDirectory;
m_minSize = ci.m_minSize;
m_maxSize = ci.m_maxSize;

m_dateAccess = ci.m_dateAccess;
m_minDate = ci.m_minDate;
m_maxDate = ci.m_maxDate;

m_caseSensitive = ci.m_caseSensitive;
m_recursive = ci.m_recursive;
m_followSymLinks = ci.m_followSymLinks;
m_allStringsMustBeFound = ci.m_allStringsMustBeFound;
m_backup = ci.m_backup;
m_backupExtension = ci.m_backupExtension;
m_ignoreFiles = ci.m_ignoreFiles;
m_regularExpressions = ci.m_regularExpressions;

m_variables = ci.m_variables;
m_haltOnFirstOccur = ci.m_haltOnFirstOccur;
m_ignoreHidden = ci.m_ignoreHidden;
m_simulation = ci.m_simulation;
m_searchingOnlyMode = ci.m_searchingOnlyMode;

m_ownerUserIsChecked = ci.m_ownerUserIsChecked;
m_ownerGroupIsChecked = ci.m_ownerGroupIsChecked;

m_ownerUserBool = ci.m_ownerUserBool;
m_ownerGroupBool = ci.m_ownerGroupBool;

m_ownerUserType = ci.m_ownerUserType;
m_ownerGroupType = ci.m_ownerGroupType;

m_ownerUserValue = ci.m_ownerUserValue;
m_ownerGroupValue = ci.m_ownerGroupValue;

m_mapStringsView = ci.m_mapStringsView;

m_quickSearchString = ci.m_quickSearchString;
m_quickReplaceString = ci.m_quickReplaceString;

m_recentStringFileList = ci.m_recentStringFileList;

m_notifyOnErrors = ci.m_notifyOnErrors;

return (*this);
}

//ResultViewEntry Class
ResultViewEntry::ResultViewEntry(TQString nkey, TQString ndata, bool regexp, bool caseSensitive)
{
m_caseSensitive = caseSensitive;
m_regexp = regexp;

if(regexp)
{
m_rxKey = TQRegExp("("+nkey+")", caseSensitive, false);
}
else
{
m_key = nkey;
}
m_data = ndata;
m_matchedStringsOccurrence = 0;
m_pos = 0;
}

int ResultViewEntry::lineNumber(const TQString& line) const
{
return line.mid(0,m_pos).contains('\n')+1;
}

int ResultViewEntry::columnNumber(const TQString& line) const
{
return(m_pos - line.findRev('\n',m_pos));
}

void ResultViewEntry::incOccurrences()
{
m_matchedStringsOccurrence++;
}

int ResultViewEntry::occurrences() const
{
return m_matchedStringsOccurrence;
}

bool ResultViewEntry::regexp()const
{
return m_regexp;
}

int ResultViewEntry::pos(const TQString& line)
{
if(m_regexp)
m_pos = m_rxKey.search(line,m_pos);
else
m_pos = line.find(m_key, m_pos, m_caseSensitive);

return m_pos;
}

void ResultViewEntry::incPos()
{
int kl = keyLength(),
dl = dataLength();

if(kl < dl)
m_pos += kl;
else
m_pos += dl;

}

TQString ResultViewEntry::capturedText(const TQString& line)
{
TQString cap;

if(m_regexp)
cap = m_rxKey.cap(1);
else
cap =line.mid(m_pos,m_key.length());

return cap;
}

TQString ResultViewEntry::message(const TQString& capturedText, int x, int y) const
{
TQString data = m_data;
//return i18n(" captured text \"%1\" replaced with \"%2\" at line: %3, column: %4 ").arg(capturedText).arg(data).arg(TQString::number(x,10)).arg(TQString::number(y,10));
return i18n(" Line:%3,Col:%4 - \"%1\" -> \"%2\"").arg(capturedText).arg(data).arg(TQString::number(x,10)).arg(TQString::number(y,10));
}

int ResultViewEntry::keyLength() const
{
if(m_regexp)
return m_rxKey.matchedLength();
else
return m_key.length();
}

int ResultViewEntry::dataLength() const
{
return m_data.length();
}

void ResultViewEntry::updateLine(TQString& line)
{
line.insert(m_pos, m_data);
line.remove(m_pos + dataLength(), keyLength());
}

+ 0
- 165
tdefilereplace/configurationclasses.h View File

@@ -1,165 +0,0 @@
/***************************************************************************
configurationclasses.h - description
-------------------
begin : Sat Apr 17 2004
copyright : (C) 2004 Emiliano Gulmini
email : <emi_barbarossa@yahoo.it>
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CONFIGURATIONCLASSES_H
#define CONFIGURATIONCLASSES_H

// QT
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqdatetime.h>
#include <tqmap.h>
#include <tqregexp.h>

typedef TQMap<TQString,TQString> KeyValueMap;
// entry strings in the tdefilereplacerc file
const TQString rcDirectoriesList = "Directories list";
const TQString rcFiltersList = "Filters list";
const TQString rcRecentFiles = "Recent files";
const TQString rcAllStringsMustBeFound = "All strings must be found";
const TQString rcEncoding = "Encoding";
const TQString rcCaseSensitive = "Case sensitive";
const TQString rcConfirmStrings = "Confirm strings";
const TQString rcConfirmFiles = "Confirm files";
const TQString rcConfirmDirs = "Confirm directories";
const TQString rcFollowSymLinks = "Follow symbolic links";
const TQString rcHaltOnFirstOccur = "Halt on first occurrence";
const TQString rcIgnoreHidden = "Ignore hidden files";
const TQString rcRecursive = "Search/replace in sub folders";
const TQString rcVariables = "Enable variables";
const TQString rcRegularExpressions = "Enable regular expressions";
const TQString rcMinFileSize = "Minimum file size";
const TQString rcMaxFileSize = "Maximum file size";
const TQString rcValidAccessDate = "Access mode";
const TQString rcMinDate = "Minimum access date";
const TQString rcMaxDate = "Maximum access date";
const TQString rcOwnerUser = "Owner user filters";
const TQString rcOwnerGroup = "Owner group filters";
const TQString rcSearchMode = "Search only mode";
const TQString rcBackupExtension = "Backup file extension";
const TQString rcIgnoreFiles = "Ignore files if there is no match";
const TQString rcNotifyOnErrors = "NotifyOnErrors";
const TQString rcAskConfirmReplace = "Ask confirmation on replace";
const TQString rcDontAskAgain = "Dont ask again";
// Default configuration options
const TQString EncodingOption = "utf8";
const bool RecursiveOption = true;
const bool CaseSensitiveOption = false;
const bool FollowSymbolicLinksOption = false;
const bool RegularExpressionsOption = false;
const bool VariablesOption = false;
const bool StopWhenFirstOccurenceOption = false;
const bool IgnoreHiddenOption = false;
const int FileSizeOption = -1;
const TQString AccessDateOption="unknown";
const TQString ValidAccessDateOption="unknown";
const TQString OwnerOption="false,Name,Equals To";
const bool SearchModeOption=true;
const TQString BackupExtensionOption="false,~";
const bool IgnoreFilesOption = true;
const bool NotifyOnErrorsOption = false;
const bool AskConfirmReplaceOption = false;

// This class store configuration informations
class RCOptions
{
public:
bool m_callResetActions;

bool m_askConfirmReplace,
m_dontAskAgain;

TQStringList m_directories;
TQStringList m_filters;
TQString m_currentDirectory;

int m_minSize,
m_maxSize;

TQString m_dateAccess,
m_minDate,
m_maxDate;
TQString m_encoding;

bool m_caseSensitive,
m_recursive,
m_followSymLinks,
m_allStringsMustBeFound,
m_backup,
m_regularExpressions;

bool m_variables,
m_haltOnFirstOccur,
m_ignoreHidden,
m_simulation,
m_searchingOnlyMode;

bool m_ownerUserIsChecked,
m_ownerGroupIsChecked;

TQString m_ownerUserType,
m_ownerGroupType,
m_ownerUserValue,
m_ownerGroupValue,
m_ownerUserBool,
m_ownerGroupBool;

TQString m_backupExtension;

bool m_ignoreFiles;

KeyValueMap m_mapStringsView;

TQString m_quickSearchString,
m_quickReplaceString;

TQStringList m_recentStringFileList;

bool m_notifyOnErrors;

public:
RCOptions();
RCOptions& operator=(const RCOptions& ci);
};

class ResultViewEntry
{
private:
TQString m_key;
TQString m_data;
TQRegExp m_rxKey;
bool m_regexp;
bool m_caseSensitive;
int m_pos;
int m_matchedStringsOccurrence;

public:
ResultViewEntry(TQString nkey, TQString ndata, bool regexp, bool caseSensitive);
int lineNumber(const TQString& line) const ;
int columnNumber(const TQString& line) const ;
void incOccurrences();
int occurrences() const ;
bool regexp()const ;
int pos(const TQString& line) ;
void incPos();
TQString capturedText(const TQString& line) ;
TQString message(const TQString& capturedText, int x, int y) const;
int keyLength() const;
int dataLength() const;
void updateLine(TQString& line);
};
#endif

+ 0
- 12
tdefilereplace/configure.in.in View File

@@ -1,12 +0,0 @@
#MIN_CONFIG

AM_INIT_AUTOMAKE(tdefilereplace, 0.8.0)

dnl These are common macros that you might or might not want to use

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h stdlib.h paths.h)
AC_CHECK_FUNCS(usleep)

BIN
tdefilereplace/hi22-app-tdefilereplace.png View File

Before After
Width: 22  |  Height: 22  |  Size: 999 B

BIN
tdefilereplace/hi32-app-tdefilereplace.png View File

Before After
Width: 32  |  Height: 32  |  Size: 1.7 KiB

BIN
tdefilereplace/hi48-app-tdefilereplace.png View File

Before After
Width: 48  |  Height: 48  |  Size: 2.8 KiB

+ 0
- 273
tdefilereplace/kaddstringdlg.cpp View File

@@ -1,273 +0,0 @@
/***************************************************************************
KAddStringDlg.cpp - description
-------------------
begin : Sat Oct 16 1999
copyright : (C) 1999 by Fran�ois Dupoux
(C) 2004 Emiliano Gulmini <emi_barbarossa@yahoo.it>
email : dupoux@dupoux.com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// QT
#include <tqtextedit.h>
#include <tqlabel.h>
#include <tqpushbutton.h>
#include <tqradiobutton.h>
#include <tqlistview.h>
#include <tqwhatsthis.h>
#include <tqwidgetstack.h>

// KDE
#include <tdemessagebox.h>
#include <kiconloader.h>
#include <kdebug.h>
#include <tdeconfig.h>
#include <tdeapplication.h>

// local
#include "kaddstringdlg.h"
#include "whatthis.h"

using namespace whatthisNameSpace;

KAddStringDlg::KAddStringDlg(RCOptions* info, bool wantEdit, TQWidget *parent, const char *name) : KAddStringDlgS(parent,name,true)
{
m_option = info;
m_wantEdit = wantEdit;
m_currentMap = m_option->m_mapStringsView;

initGUI();

connect(m_pbOK, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotOK()));
connect(m_rbSearchOnly, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotSearchOnly()));
connect(m_rbSearchReplace, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotSearchReplace()));
connect(m_pbAdd, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotAddStringToView()));
connect(m_pbDel, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotDeleteStringFromView()));
connect(m_pbHelp, TQT_SIGNAL(clicked()), this ,TQT_SLOT(slotHelp()));

whatsThis();
}

//PRIVATE
void KAddStringDlg::initGUI()
{
m_pbAdd->setIconSet(SmallIconSet(TQString::fromLatin1("forward")));
m_pbDel->setIconSet(SmallIconSet(TQString::fromLatin1("back")));

m_stack->addWidget(m_stringView);
m_stack->addWidget(m_stringView_2);


if(m_option->m_searchingOnlyMode)
{
if(m_wantEdit)
m_rbSearchReplace->setEnabled(false);
m_rbSearchOnly->setChecked(true);
m_edSearch->setEnabled(true);
m_edReplace->setEnabled(false);
m_tlSearch->setEnabled(true);
m_tlReplace->setEnabled(false);
}
else
{
if(m_wantEdit)
m_rbSearchOnly->setEnabled(false);
m_rbSearchReplace->setChecked(true);
m_edSearch->setEnabled(true);
m_edReplace->setEnabled(true);
m_tlSearch->setEnabled(true);
m_tlReplace->setEnabled(true);
}

raiseView();

if(m_wantEdit)
loadMapIntoView();
}

void KAddStringDlg::eraseViewItems()
{
TQListViewItem* item = m_sv->firstChild();
if(item == 0)
return;
else
{
while(item)
{
TQListViewItem* tempItem = item;
item = item->nextSibling();
delete tempItem;
}
}
}

void KAddStringDlg::raiseView()
{
if(m_option->m_searchingOnlyMode)
m_sv = m_stringView_2;
else
m_sv = m_stringView;

m_stack->raiseWidget(m_sv);
}

bool KAddStringDlg::columnContains(TQListView* lv,const TQString& s, int column)
{
TQListViewItem* i = lv->firstChild();
while (i != 0)
{
if(i->text(column) == s)
return true;
i = i->nextSibling();
}
return false;
}

void KAddStringDlg::saveViewContentIntoMap()
{
TQListViewItem* i = m_sv->firstChild();
while(i != 0)
{
if(m_option->m_searchingOnlyMode)
m_currentMap[i->text(0)] = TQString();
else
m_currentMap[i->text(0)] = i->text(1);
i = i->nextSibling();
}
}

void KAddStringDlg::loadMapIntoView()
{
KeyValueMap::Iterator itMap;

for (itMap = m_currentMap.begin(); itMap != m_currentMap.end(); ++itMap)
{
TQListViewItem* temp = new TQListViewItem(m_sv);
temp->setText(0,itMap.key());
if(!m_option->m_searchingOnlyMode)
temp->setText(1,itMap.data());
}
}

void KAddStringDlg::whatsThis()
{
TQWhatsThis::add(m_rbSearchOnly, rbSearchOnlyWhatthis);
TQWhatsThis::add(m_rbSearchReplace, rbSearchReplaceWhatthis);
TQWhatsThis::add(m_edSearch, edSearchWhatthis);
TQWhatsThis::add(m_edReplace, edReplaceWhatthis);
}

//PRIVATE SLOTS
void KAddStringDlg::slotOK()
{
m_option->m_mapStringsView = m_currentMap;

accept();
}

void KAddStringDlg::slotSearchOnly()
{
m_option->m_searchingOnlyMode = true;

m_rbSearchOnly->setChecked(true);
m_edSearch->setEnabled(true);
m_edReplace->setEnabled(false);
m_tlSearch->setEnabled(true);
m_tlReplace->setEnabled(false);

//sets the right view appearance
raiseView();
//empties the view content
eraseViewItems();
}

void KAddStringDlg::slotSearchReplace()
{
m_option->m_searchingOnlyMode = false;

m_rbSearchReplace->setChecked(true);
m_edSearch->setEnabled(true);
m_edReplace->setEnabled(true);
m_tlSearch->setEnabled(true);
m_tlReplace->setEnabled(true);

//sets the right view appearance
raiseView();
//empties the view content
eraseViewItems();
}

void KAddStringDlg::slotAddStringToView()
{
if(m_option->m_searchingOnlyMode)
{
TQString text = m_edSearch->text();
if(!(text.isEmpty() || columnContains(m_sv, text, 0)))
{
TQListViewItem* lvi = new TQListViewItem(m_sv);
lvi->setMultiLinesEnabled(true);
lvi->setText(0,text);
m_currentMap[text] = TQString();
m_edSearch->clear();
}
}
else
{
TQString searchText = m_edSearch->text(),
replaceText = m_edReplace->text();

if(!(searchText.isEmpty() || replaceText.isEmpty() || columnContains(m_sv,searchText,0) || columnContains(m_sv,replaceText,1)))
{
TQListViewItem* lvi = new TQListViewItem(m_sv);
lvi->setMultiLinesEnabled(true);
lvi->setText(0,searchText);
m_edSearch->clear();
lvi->setText(1,replaceText);
m_currentMap[searchText] = replaceText;
m_edReplace->clear();
}
}
}

void KAddStringDlg::slotDeleteStringFromView()
{
// Choose current item or selected item
TQListViewItem* currentItem = m_sv->currentItem();